From 45d88ff3ab1a13a9dd0f40872d3d341d4480775d Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Mon, 31 Dec 2012 12:18:50 +0800 Subject: [PATCH] IDEMPIERE-369 Master Detail layout improvements. Performance tuning - reduce use of borderlayout. --- .../adempiere/webui/adwindow/ADTabpanel.java | 6 +++ .../webui/adwindow/ADWindowContent.java | 43 +++++++++---------- .../adwindow/AbstractADWindowContent.java | 3 +- .../adempiere/webui/adwindow/DetailPane.java | 9 ++++ .../theme/default/css/theme.css.dsp | 26 ++++++++--- 5 files changed, 57 insertions(+), 30 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java index 1cbd5b0069..b3ac1be6a1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java @@ -189,6 +189,7 @@ DataStatusListener, IADTabpanel, IdSpace removeAttribute(ATTR_ON_ACTIVATE_POSTED); } }); + addEventListener("onPostInit", this); } private void initComponents() @@ -930,6 +931,11 @@ DataStatusListener, IADTabpanel, IdSpace else if (WPaymentEditor.ON_SAVE_PAYMENT.equals(event.getName())) { windowPanel.onSavePayment(); } + else if ("onPostInit".equals(event.getName())) { + if (detailPane != null) { + Events.postEvent(new Event(LayoutUtils.ON_REDRAW_EVENT, detailPane)); + } + } } private void navigateTo(DefaultTreeNode value) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java index 5f57941945..0d80540643 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java @@ -36,12 +36,9 @@ import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.KeyEvent; -import org.zkoss.zul.Borderlayout; -import org.zkoss.zul.Center; import org.zkoss.zul.Div; -import org.zkoss.zul.North; -import org.zkoss.zul.South; import org.zkoss.zul.Tab; +import org.zkoss.zul.Vlayout; /** * @@ -58,9 +55,9 @@ public class ADWindowContent extends AbstractADWindowContent @SuppressWarnings("unused") private static final CLogger logger = CLogger.getCLogger(ADWindowContent.class); - private Borderlayout layout; + private Vlayout layout; - private Center contentArea; + private Div contentArea; private Keylistener keyListener; @@ -71,7 +68,7 @@ public class ADWindowContent extends AbstractADWindowContent protected Component doCreatePart(Component parent) { - layout = new Borderlayout(); + layout = new Vlayout(); if (parent != null) { layout.setParent(parent); layout.setSclass("adwindow-layout"); @@ -80,14 +77,13 @@ public class ADWindowContent extends AbstractADWindowContent } //toolbar - North n = new North(); - n.setParent(layout); - n.setCollapsible(false); - n.setSclass("adwindow-north"); + Div north = new Div(); + north.setParent(layout); + north.setSclass("adwindow-north"); Div div = new Div(); - div.setHflex("1"); - div.setVflex("1"); - n.appendChild(div); + div.setStyle("height: 100%; width: 100%"); + north.appendChild(div); + north.setVflex("0"); toolbar.setParent(div); toolbar.setWindowNo(getWindowNo()); breadCrumb = new BreadCrumb(getWindowNo()); @@ -96,18 +92,21 @@ public class ADWindowContent extends AbstractADWindowContent div.appendChild(breadCrumb); //status bar - South s = new South(); - layout.appendChild(s); - s.setCollapsible(false); - s.setSclass("adwindow-south"); - statusBar.setParent(s); + Div south = new Div(); + south.setSclass("adwindow-south"); + south.setVflex("0"); + statusBar.setParent(south); LayoutUtils.addSclass("adwindow-status", statusBar); - contentArea = new Center(); + contentArea = new Div(); contentArea.setParent(layout); - contentArea.setAutoscroll(true); + contentArea.setVflex("1"); + contentArea.setHflex("1"); + contentArea.setStyle("overflow: auto;"); adTabbox.createPart(contentArea); + + layout.appendChild(south); if (parent instanceof Tabpanel) { TabOnCloseHanlder handler = new TabOnCloseHanlder(); @@ -132,7 +131,7 @@ public class ADWindowContent extends AbstractADWindowContent return composite; } - public Borderlayout getComponent() { + public Vlayout getComponent() { return layout; } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index 519c11074b..ca11145a1e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -585,7 +585,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements private void initFirstTabpanel() { adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); - adTabbox.getSelectedTabpanel().activate(true); + adTabbox.getSelectedTabpanel().activate(true); + Events.echoEvent(new Event("onPostInit", adTabbox.getSelectedTabpanel())); } /** diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java index f8fd0642ba..a1c90162bb 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java @@ -106,6 +106,8 @@ public class DetailPane extends Panel implements EventListener, IdSpace { addEventListener(LayoutUtils.ON_REDRAW_EVENT, this); + addEventListener("onPostInit", this); + setId("detailPane"); } @@ -405,6 +407,13 @@ public class DetailPane extends Panel implements EventListener, IdSpace { return; } LayoutUtils.redraw(this); + } else if (event.getName().equals("onPostInit")) { + IADTabpanel adtabpanel = getSelectedADTabpanel(); + if (adtabpanel != null) { + GridView gridView = adtabpanel.getGridView(); + if (gridView != null && gridView.getListbox() != null) + Clients.resize(gridView.getListbox()); + } } } diff --git a/org.adempiere.ui.zk/theme/default/css/theme.css.dsp b/org.adempiere.ui.zk/theme/default/css/theme.css.dsp index 0e7adaf6e8..0cea8785fb 100644 --- a/org.adempiere.ui.zk/theme/default/css/theme.css.dsp +++ b/org.adempiere.ui.zk/theme/default/css/theme.css.dsp @@ -267,10 +267,17 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none { } .menu-search-panel .z-comboitem-img { - vertical-align:top; padding-bottom:4px; } +.z-comboitem-img { + vertical-align:top; +} + +.z-combobox input { + vertical-align:top; +} + .menu-panel .z-toolbar-panel { padding-right: 0; } @@ -477,16 +484,18 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none { } .adwindow-north { + height: 56px; + width: 100%; + padding: 0px; + margin: 0px; border: none; - border-bottom: 1px solid #C5C5C5 !important; } .adwindow-south { - border-left: none; - border-right: none; -} - -.adwindow-layout .z-south { + height: 20px; + width: 100%; + padding: 0px; + margin: 0px; border-top: 1px solid #C5C5C5 !important; } @@ -497,12 +506,15 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none { .adwindow-toolbar { border: 0px; + height: 26px; } .adwindow-breadcrumb { height: 30px; background-color: #FFF; + padding: 0px; padding-left: 5px; + border-bottom: 1px solid #C5C5C5 !important; } .adwindow-detailpane {