IDEMPIERE-369 Master Detail layout improvements. Performance tuning - reduce use of borderlayout.

This commit is contained in:
Heng Sin Low 2012-12-31 12:18:50 +08:00
parent caf7b53e5e
commit 45d88ff3ab
5 changed files with 57 additions and 30 deletions

View File

@ -189,6 +189,7 @@ DataStatusListener, IADTabpanel, IdSpace
removeAttribute(ATTR_ON_ACTIVATE_POSTED); removeAttribute(ATTR_ON_ACTIVATE_POSTED);
} }
}); });
addEventListener("onPostInit", this);
} }
private void initComponents() private void initComponents()
@ -930,6 +931,11 @@ DataStatusListener, IADTabpanel, IdSpace
else if (WPaymentEditor.ON_SAVE_PAYMENT.equals(event.getName())) { else if (WPaymentEditor.ON_SAVE_PAYMENT.equals(event.getName())) {
windowPanel.onSavePayment(); windowPanel.onSavePayment();
} }
else if ("onPostInit".equals(event.getName())) {
if (detailPane != null) {
Events.postEvent(new Event(LayoutUtils.ON_REDRAW_EVENT, detailPane));
}
}
} }
private void navigateTo(DefaultTreeNode<MTreeNode> value) { private void navigateTo(DefaultTreeNode<MTreeNode> value) {

View File

@ -36,12 +36,9 @@ import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.event.KeyEvent; 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.Div;
import org.zkoss.zul.North;
import org.zkoss.zul.South;
import org.zkoss.zul.Tab; import org.zkoss.zul.Tab;
import org.zkoss.zul.Vlayout;
/** /**
* *
@ -58,9 +55,9 @@ public class ADWindowContent extends AbstractADWindowContent
@SuppressWarnings("unused") @SuppressWarnings("unused")
private static final CLogger logger = CLogger.getCLogger(ADWindowContent.class); private static final CLogger logger = CLogger.getCLogger(ADWindowContent.class);
private Borderlayout layout; private Vlayout layout;
private Center contentArea; private Div contentArea;
private Keylistener keyListener; private Keylistener keyListener;
@ -71,7 +68,7 @@ public class ADWindowContent extends AbstractADWindowContent
protected Component doCreatePart(Component parent) protected Component doCreatePart(Component parent)
{ {
layout = new Borderlayout(); layout = new Vlayout();
if (parent != null) { if (parent != null) {
layout.setParent(parent); layout.setParent(parent);
layout.setSclass("adwindow-layout"); layout.setSclass("adwindow-layout");
@ -80,14 +77,13 @@ public class ADWindowContent extends AbstractADWindowContent
} }
//toolbar //toolbar
North n = new North(); Div north = new Div();
n.setParent(layout); north.setParent(layout);
n.setCollapsible(false); north.setSclass("adwindow-north");
n.setSclass("adwindow-north");
Div div = new Div(); Div div = new Div();
div.setHflex("1"); div.setStyle("height: 100%; width: 100%");
div.setVflex("1"); north.appendChild(div);
n.appendChild(div); north.setVflex("0");
toolbar.setParent(div); toolbar.setParent(div);
toolbar.setWindowNo(getWindowNo()); toolbar.setWindowNo(getWindowNo());
breadCrumb = new BreadCrumb(getWindowNo()); breadCrumb = new BreadCrumb(getWindowNo());
@ -96,18 +92,21 @@ public class ADWindowContent extends AbstractADWindowContent
div.appendChild(breadCrumb); div.appendChild(breadCrumb);
//status bar //status bar
South s = new South(); Div south = new Div();
layout.appendChild(s); south.setSclass("adwindow-south");
s.setCollapsible(false); south.setVflex("0");
s.setSclass("adwindow-south"); statusBar.setParent(south);
statusBar.setParent(s);
LayoutUtils.addSclass("adwindow-status", statusBar); LayoutUtils.addSclass("adwindow-status", statusBar);
contentArea = new Center(); contentArea = new Div();
contentArea.setParent(layout); contentArea.setParent(layout);
contentArea.setAutoscroll(true); contentArea.setVflex("1");
contentArea.setHflex("1");
contentArea.setStyle("overflow: auto;");
adTabbox.createPart(contentArea); adTabbox.createPart(contentArea);
layout.appendChild(south);
if (parent instanceof Tabpanel) { if (parent instanceof Tabpanel) {
TabOnCloseHanlder handler = new TabOnCloseHanlder(); TabOnCloseHanlder handler = new TabOnCloseHanlder();
@ -132,7 +131,7 @@ public class ADWindowContent extends AbstractADWindowContent
return composite; return composite;
} }
public Borderlayout getComponent() { public Vlayout getComponent() {
return layout; return layout;
} }

View File

@ -585,7 +585,8 @@ public abstract class AbstractADWindowContent extends AbstractUIPart implements
private void initFirstTabpanel() { private void initFirstTabpanel() {
adTabbox.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); 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()));
} }
/** /**

View File

@ -106,6 +106,8 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
addEventListener(LayoutUtils.ON_REDRAW_EVENT, this); addEventListener(LayoutUtils.ON_REDRAW_EVENT, this);
addEventListener("onPostInit", this);
setId("detailPane"); setId("detailPane");
} }
@ -405,6 +407,13 @@ public class DetailPane extends Panel implements EventListener<Event>, IdSpace {
return; return;
} }
LayoutUtils.redraw(this); 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());
}
} }
} }

View File

@ -267,10 +267,17 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
} }
.menu-search-panel .z-comboitem-img { .menu-search-panel .z-comboitem-img {
vertical-align:top;
padding-bottom:4px; padding-bottom:4px;
} }
.z-comboitem-img {
vertical-align:top;
}
.z-combobox input {
vertical-align:top;
}
.menu-panel .z-toolbar-panel { .menu-panel .z-toolbar-panel {
padding-right: 0; padding-right: 0;
} }
@ -477,16 +484,18 @@ div.wc-modal, div.wc-modal-none, div.wc-highlighted, div.wc-highlighted-none {
} }
.adwindow-north { .adwindow-north {
height: 56px;
width: 100%;
padding: 0px;
margin: 0px;
border: none; border: none;
border-bottom: 1px solid #C5C5C5 !important;
} }
.adwindow-south { .adwindow-south {
border-left: none; height: 20px;
border-right: none; width: 100%;
} padding: 0px;
margin: 0px;
.adwindow-layout .z-south {
border-top: 1px solid #C5C5C5 !important; 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 { .adwindow-toolbar {
border: 0px; border: 0px;
height: 26px;
} }
.adwindow-breadcrumb { .adwindow-breadcrumb {
height: 30px; height: 30px;
background-color: #FFF; background-color: #FFF;
padding: 0px;
padding-left: 5px; padding-left: 5px;
border-bottom: 1px solid #C5C5C5 !important;
} }
.adwindow-detailpane { .adwindow-detailpane {