IDEMPIERE-1433 Make grid customization dialog window layout similar with layout of the Field/Grid Sequence tab.

This commit is contained in:
Heng Sin Low 2013-11-22 20:01:38 +08:00
parent 5e342989c0
commit 69ca16cbd9
2 changed files with 89 additions and 97 deletions

View File

@ -28,6 +28,7 @@ import java.util.Set;
import java.util.logging.Level; import java.util.logging.Level;
import org.adempiere.model.MTabCustomization; import org.adempiere.model.MTabCustomization;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.adwindow.GridView; import org.adempiere.webui.adwindow.GridView;
import org.adempiere.webui.component.Button; import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.Checkbox;
@ -49,7 +50,6 @@ import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
import org.compiere.util.NamePair; import org.compiere.util.NamePair;
import org.compiere.util.ValueNamePair; import org.compiere.util.ValueNamePair;
import org.zkoss.zhtml.Span;
import org.zkoss.zk.au.out.AuFocus; import org.zkoss.zk.au.out.AuFocus;
import org.zkoss.zk.ui.event.DropEvent; import org.zkoss.zk.ui.event.DropEvent;
import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.Event;
@ -58,10 +58,9 @@ import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients; import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Borderlayout;
import org.zkoss.zul.Center; import org.zkoss.zul.Center;
import org.zkoss.zul.Div; import org.zkoss.zul.Hlayout;
import org.zkoss.zul.Separator; import org.zkoss.zul.Separator;
import org.zkoss.zul.South; import org.zkoss.zul.South;
import org.zkoss.zul.Vbox;
/** /**
* *
@ -95,7 +94,7 @@ public class CustomizeGridViewPanel extends Panel
m_AD_User_ID = AD_User_ID; m_AD_User_ID = AD_User_ID;
m_columnsWidth = columnsWidth; m_columnsWidth = columnsWidth;
tableSeqs = gridFieldIds; tableSeqs = gridFieldIds;
this.setStyle("position : absolute;height: 460px; width:600px; margin: none; border: none;"); this.setStyle("position : relative;height: 100%; width:100%; margin: none; border: none; padding: none;");
} // } //
/** Logger */ /** Logger */
@ -107,10 +106,14 @@ public class CustomizeGridViewPanel extends Panel
// 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.createButton(null,
private Button bRemove = new Button(); ThemeManager.getThemeResource("images/MoveLeft16.png"), null);
private Button bUp = new Button(); private Button bRemove = ButtonFactory.createButton(null,
private Button bDown = new Button(); ThemeManager.getThemeResource("images/MoveRight16.png"), null);
private Button bUp = ButtonFactory.createButton(null,
ThemeManager.getThemeResource("images/MoveUp16.png"), null);
private Button bDown = ButtonFactory.createButton(null,
ThemeManager.getThemeResource("images/MoveDown16.png"), null);
private Checkbox chkSaveWidth = new Checkbox(); private Checkbox chkSaveWidth = new Checkbox();
private Label lblGridMode = new Label(); private Label lblGridMode = new Label();
private Listbox lstGridMode = new Listbox(); private Listbox lstGridMode = new Listbox();
@ -123,20 +126,17 @@ public class CustomizeGridViewPanel extends Panel
private boolean uiCreated; private boolean uiCreated;
private boolean m_saved = false; private boolean m_saved = false;
private ConfirmPanel confirmPanel = new ConfirmPanel(true);
/**
* Static Layout /**
* @throws Exception * Static Layout
*
* @throws Exception
*/ */
private void init() throws Exception private void init() throws Exception {
{
Borderlayout layout = new Borderlayout(); Borderlayout layout = new Borderlayout();
layout.setStyle("position: absolute; width: 600px; height: 100%; border: none; margin: none;"); layout.setStyle("position: absolute; width: 100%; height: 100%; border: none; margin: none; padding: none;");
Panel centerPanel = new Panel();
centerPanel.setStyle("border: none; margin: none");
centerPanel.setHeight("100%");
Center center = new Center(); Center center = new Center();
center.setStyle("border: none; margin: none");
noLabel.setValue(Msg.getMsg(Env.getCtx(), "Available")); noLabel.setValue(Msg.getMsg(Env.getCtx(), "Available"));
yesLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected")); yesLabel.setValue(Msg.getMsg(Env.getCtx(), "Selected"));
@ -166,11 +166,13 @@ public class CustomizeGridViewPanel extends Panel
}; };
yesModel.setMultiple(true); yesModel.setMultiple(true);
noModel.setMultiple(true); noModel.setMultiple(true);
bAdd.setImage(ThemeManager.getThemeResource("images/Next24.png")); LayoutUtils.addSclass("btn-small", bAdd);
LayoutUtils.addSclass("btn-sorttab small-img-btn", 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);
LayoutUtils.addSclass("btn-sorttab small-img-btn", bRemove);
bRemove.addEventListener(Events.ON_CLICK, actionListener); bRemove.addEventListener(Events.ON_CLICK, actionListener);
EventListener<Event> crossListMouseListener = new DragListener(); EventListener<Event> crossListMouseListener = new DragListener();
@ -186,110 +188,99 @@ public class CustomizeGridViewPanel extends Panel
} }
}; };
bUp.setImage(ThemeManager.getThemeResource("images/Parent24.png")); LayoutUtils.addSclass("btn-small", bUp);
LayoutUtils.addSclass("btn-sorttab small-img-btn", bUp);
bUp.addEventListener(Events.ON_CLICK, actionListener); bUp.addEventListener(Events.ON_CLICK, actionListener);
bDown.setImage(ThemeManager.getThemeResource("images/Detail24.png")); LayoutUtils.addSclass("btn-small", bDown);
LayoutUtils.addSclass("btn-sorttab small-img-btn", bDown);
bDown.addEventListener(Events.ON_CLICK, actionListener); bDown.addEventListener(Events.ON_CLICK, actionListener);
ListHead listHead = new ListHead(); ListHead listHead = new ListHead();
listHead.setParent(yesList); listHead.setParent(yesList);
ListHeader listHeader = new ListHeader(); ListHeader listHeader = new ListHeader();
listHeader.appendChild(yesLabel); listHeader.appendChild(yesLabel);
Hlayout yesButtonLayout = new Hlayout();
yesButtonLayout.appendChild(bUp);
yesButtonLayout.appendChild(bDown);
listHeader.appendChild(yesButtonLayout);
yesButtonLayout.setStyle("display: inline-block; float: right;");
listHeader.setParent(listHead); listHeader.setParent(listHead);
listHead = new ListHead(); listHead = new ListHead();
listHead.setParent(noList); listHead.setParent(noList);
listHeader = new ListHeader(); listHeader = new ListHeader();
listHeader.appendChild(noLabel); listHeader.appendChild(noLabel);
Hlayout noButtonLayout = new Hlayout();
noButtonLayout.appendChild(bRemove);
noButtonLayout.appendChild(bAdd);
listHeader.appendChild(noButtonLayout);
noButtonLayout.setStyle("display: inline-block; float: right;");
listHeader.setParent(listHead); listHeader.setParent(listHead);
Span span = new Span(); Hlayout hlayout = new Hlayout();
span.setParent(centerPanel);
span.setStyle("height: 90%; display: inline-block; width: 250px; border:none; margin: none;");
span.appendChild(noList);
Vbox vbox = new Vbox();
vbox.setStyle("border: none; margin: none;");
vbox.appendChild(bAdd);
vbox.appendChild(bRemove);
span = new Span();
span.setParent(centerPanel);
span.setStyle("height: 90%; display: inline-block; width: 50px; border:none; margin: none;");
span.appendChild(vbox);
span = new Span(); hlayout.setVflex("true");
span.setParent(centerPanel); hlayout.setHflex("true");
span.setStyle("height: 90%; display: inline-block; width: 250px; border:none; margin: none;"); hlayout.setStyle("margin: auto; margin-top: 2px;");
span.appendChild(yesList);
yesList.setStyle("margin: none");
vbox = new Vbox();
vbox.appendChild(bUp);
vbox.appendChild(bDown);
vbox.setStyle("border: none; margin: none");
span = new Span();
span.setParent(centerPanel);
span.setStyle("height: 90%; display: inline-block; width: 50px; border:none; margin: none;");
span.appendChild(vbox);
Div div = new Div();
div.setStyle("margin-top:5px");
div.appendChild(chkSaveWidth);
chkSaveWidth.setLabel(Msg.getMsg(Env.getCtx(), "SaveColumnWidth"));
centerPanel.appendChild(div);
Separator sep = new Separator("vertical"); noList.setHflex("1");
sep.setSpacing("200px"); noList.setVflex(true);
div.appendChild(sep); hlayout.appendChild(noList);
lblGridMode.setValue(Msg.getMsg(Env.getCtx(), "OpenInGridMode"));
div.appendChild(lblGridMode); yesList.setVflex(true);
lstGridMode.setMold("select"); yesList.setHflex("1");
div.appendChild(lstGridMode); hlayout.appendChild(yesList);
centerPanel.appendChild(div);
center.appendChild(hlayout);
center.appendChild(centerPanel);
centerPanel.setVflex("1");
centerPanel.setHflex("1");
layout.appendChild(center); layout.appendChild(center);
South south = new South(); South south = new South();
south.setStyle("border: none; margin: none"); south.setStyle("border: none; margin: 0; padding: 0; ");
Panel southPanel = new Panel(); Panel southPanel = new Panel();
south.setHeight("35px");
south.setStyle("text-align: right;");
southPanel.setStyle("margin-top: 2px; margin-right: 4px");
Button bOK = ButtonFactory.createNamedButton(ConfirmPanel.A_OK);
bOK.setId("Ok");
EventListener<Event> onClickListener = new EventListener<Event>()
{
public void onEvent(Event event) throws Exception Separator sep = new Separator();
{ sep.setSpacing("2px");
if (Events.ON_CLICK.equals(event.getName())) southPanel.appendChild(sep);
{
saveData();
}
}
}; southPanel.appendChild(chkSaveWidth);
bOK.addActionListener(onClickListener); chkSaveWidth.setLabel(Msg.getMsg(Env.getCtx(), "SaveColumnWidth"));
southPanel.appendChild(bOK);
Button btn = ButtonFactory.createNamedButton(ConfirmPanel.A_CANCEL);
btn.setId("Cancel");
EventListener<Event> onClickCancelListener = new EventListener<Event>()
{
public void onEvent(Event event) throws Exception sep = new Separator("vertical");
{ sep.setSpacing("200px");
if (Events.ON_CLICK.equals(event.getName())) southPanel.appendChild(sep);
{ lblGridMode.setValue(Msg.getMsg(Env.getCtx(), "OpenInGridMode"));
southPanel.appendChild(lblGridMode);
lstGridMode.setMold("select");
lstGridMode.setStyle("margin-left: 2px");
southPanel.appendChild(lstGridMode);
sep = new Separator();
sep.setSpacing("2px");
southPanel.appendChild(sep);
LayoutUtils.addSclass("dialog-footer", confirmPanel);
EventListener<Event> onClickListener = new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
if (event.getTarget().equals(
confirmPanel.getButton(ConfirmPanel.A_OK))) {
saveData();
} else if (event.getTarget().equals(
confirmPanel.getButton(ConfirmPanel.A_CANCEL))) {
getParent().detach(); getParent().detach();
} }
} }
}; };
btn.addActionListener(onClickCancelListener); confirmPanel.addActionListener(onClickListener);
southPanel.appendChild(confirmPanel);
southPanel.appendChild(btn);
south.appendChild(southPanel); south.appendChild(southPanel);
layout.appendChild(south); layout.appendChild(south);

View File

@ -39,6 +39,7 @@ public class CustomizeGridViewDialog extends Window {
this.setWidth("600px"); this.setWidth("600px");
this.setHeight("500px"); this.setHeight("500px");
this.setBorder("normal"); this.setBorder("normal");
this.setSclass("popup-dialog");
appendChild(customizePanel); appendChild(customizePanel);
customizePanel.createUI(); customizePanel.createUI();
customizePanel.query(); customizePanel.query();