IDEMPIERE-800 Zk: Add API to ease implementation of consistent button style across the whole application.

This commit is contained in:
Heng Sin Low 2013-03-26 22:42:12 +08:00
parent b50ae57c3b
commit 901c17639b
3 changed files with 17 additions and 16 deletions

View File

@ -25,6 +25,7 @@ import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Label;
import org.adempiere.webui.component.ListHead; import org.adempiere.webui.component.ListHead;
@ -33,7 +34,7 @@ import org.adempiere.webui.component.ListItem;
import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Panel;
import org.adempiere.webui.component.SimpleListModel; import org.adempiere.webui.component.SimpleListModel;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.factory.ButtonFactory;
import org.adempiere.webui.window.FDialog; import org.adempiere.webui.window.FDialog;
import org.compiere.model.GridTab; import org.compiere.model.GridTab;
import org.compiere.model.MRole; import org.compiere.model.MRole;
@ -109,10 +110,10 @@ public class ADSortTab extends Panel implements IADTabpanel
// UI variables // UI variables
private Label noLabel = new Label(); private Label noLabel = new Label();
private Label yesLabel = new Label(); private Label yesLabel = new Label();
private Button bAdd = new Button(); private Button bAdd = ButtonFactory.createNamedButton("Next", false, true);
private Button bRemove = new Button(); private Button bRemove = ButtonFactory.createNamedButton("Previous", false, true);
private Button bUp = new Button(); private Button bUp = ButtonFactory.createNamedButton("Parent", false, true);
private Button bDown = new Button(); private Button bDown = ButtonFactory.createNamedButton("Detail", false, true);
// //
SimpleListModel noModel = new SimpleListModel() { SimpleListModel noModel = new SimpleListModel() {
/** /**
@ -289,10 +290,10 @@ public class ADSortTab extends Panel implements IADTabpanel
yesModel.setMultiple(true); yesModel.setMultiple(true);
noModel.setMultiple(true); noModel.setMultiple(true);
bAdd.setImage(ThemeManager.getThemeResource("images/Next24.png")); LayoutUtils.addSclass("btn-small", bAdd);
bAdd.addEventListener(Events.ON_CLICK, actionListener); bAdd.addEventListener(Events.ON_CLICK, actionListener);
bRemove.setImage(ThemeManager.getThemeResource("images/Previous24.png")); LayoutUtils.addSclass("btn-small", bRemove);
bRemove.addEventListener(Events.ON_CLICK, actionListener); bRemove.addEventListener(Events.ON_CLICK, actionListener);
EventListener<Event> crossListMouseListener = new DragListener(); EventListener<Event> crossListMouseListener = new DragListener();
@ -308,10 +309,10 @@ public class ADSortTab extends Panel implements IADTabpanel
} }
}; };
bUp.setImage(ThemeManager.getThemeResource("images/Parent24.png")); LayoutUtils.addSclass("btn-small", bUp);
bUp.addEventListener(Events.ON_CLICK, actionListener2); bUp.addEventListener(Events.ON_CLICK, actionListener2);
bDown.setImage(ThemeManager.getThemeResource("images/Detail24.png")); LayoutUtils.addSclass("btn-small", bDown);
bDown.addEventListener(Events.ON_CLICK, actionListener2); bDown.addEventListener(Events.ON_CLICK, actionListener2);
ListHead listHead = new ListHead(); ListHead listHead = new ListHead();
@ -338,6 +339,7 @@ public class ADSortTab extends Panel implements IADTabpanel
vbox.appendChild(bAdd); vbox.appendChild(bAdd);
vbox.appendChild(bRemove); vbox.appendChild(bRemove);
vbox.setWidth("46px"); vbox.setWidth("46px");
vbox.setAlign("center");
hlayout.appendChild(vbox); hlayout.appendChild(vbox);
yesList.setVflex(true); yesList.setVflex(true);

View File

@ -48,6 +48,7 @@ import org.adempiere.webui.apps.ProcessModalDialog;
import org.adempiere.webui.apps.form.WCreateFromFactory; import org.adempiere.webui.apps.form.WCreateFromFactory;
import org.adempiere.webui.apps.form.WCreateFromWindow; import org.adempiere.webui.apps.form.WCreateFromWindow;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.ConfirmPanel;
import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Listbox;
import org.adempiere.webui.component.Mask; import org.adempiere.webui.component.Mask;
import org.adempiere.webui.component.ProcessInfoDialog; import org.adempiere.webui.component.ProcessInfoDialog;
@ -60,6 +61,7 @@ import org.adempiere.webui.event.ActionListener;
import org.adempiere.webui.event.DialogEvents; import org.adempiere.webui.event.DialogEvents;
import org.adempiere.webui.event.ToolbarListener; import org.adempiere.webui.event.ToolbarListener;
import org.adempiere.webui.exception.ApplicationException; import org.adempiere.webui.exception.ApplicationException;
import org.adempiere.webui.factory.ButtonFactory;
import org.adempiere.webui.panel.ADForm; import org.adempiere.webui.panel.ADForm;
import org.adempiere.webui.panel.InfoPanel; import org.adempiere.webui.panel.InfoPanel;
import org.adempiere.webui.panel.WAttachment; import org.adempiere.webui.panel.WAttachment;
@ -2118,12 +2120,11 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
messagePanel.appendChild(div); messagePanel.appendChild(div);
Hbox hbox = new Hbox(); Hbox hbox = new Hbox();
hbox.setStyle("padding-top: 2px");
div.appendChild(hbox); div.appendChild(hbox);
Button btnOk = new Button(); Button btnOk = ButtonFactory.createNamedButton(ConfirmPanel.A_OK);
// Invert - Unify OK/Cancel IDEMPIERE-77 // Invert - Unify OK/Cancel IDEMPIERE-77
//btnOk.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "OK")));
btnOk.setImage(ThemeManager.getThemeResource("images/Ok16.png"));
btnOk.addEventListener(Events.ON_CLICK, new EventListener<Event>() btnOk.addEventListener(Events.ON_CLICK, new EventListener<Event>()
{ {
public void onEvent(Event event) throws Exception public void onEvent(Event event) throws Exception
@ -2171,9 +2172,7 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
}); });
hbox.appendChild(btnOk); hbox.appendChild(btnOk);
Button btnCancel = new Button(); Button btnCancel = ButtonFactory.createNamedButton(ConfirmPanel.A_CANCEL);
//btnCancel.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Cancel")));
btnCancel.setImage(ThemeManager.getThemeResource("images/Cancel16.png"));
btnCancel.addEventListener(Events.ON_CLICK, new EventListener<Event>() btnCancel.addEventListener(Events.ON_CLICK, new EventListener<Event>()
{ {
public void onEvent(Event event) throws Exception public void onEvent(Event event) throws Exception

View File

@ -21,7 +21,7 @@ public class ProcessButtonPopup extends Window {
private static final long serialVersionUID = 304878472233552113L; private static final long serialVersionUID = 304878472233552113L;
public void render(List<Button> buttons) { public void render(List<Button> buttons) {
setSclass("toolbar-popup-window"); setSclass("toolbar-popup-window process-buttons-popup");
//setWidth("250px"); //setWidth("250px");
setHflex("min"); setHflex("min");
setBorder("normal"); setBorder("normal");