From 638d303322fde5a9f100f62977f0ae5350f873c7 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 9 Oct 2012 18:36:09 +0800 Subject: [PATCH 1/9] IDEMPIERE-352 Zk: Upgrade to release 6.5 --- org.adempiere.ui.zk/META-INF/MANIFEST.MF | 3 +- .../src}/metainfo/zk/lang-addon.xml | 0 .../adempiere/webui/AdempiereIdGenerator.java | 3 +- .../src/org/adempiere/webui/WLogin.java | 3 +- .../org/adempiere/webui/acct/WAcctViewer.java | 8 +-- .../adempiere/webui/apps/ProcessDialog.java | 5 +- .../webui/apps/form/WAllocation.java | 6 ++- .../adempiere/webui/apps/form/WCharge.java | 3 +- .../webui/apps/form/WFileImport.java | 3 +- .../adempiere/webui/apps/form/WGenForm.java | 6 ++- .../org/adempiere/webui/apps/form/WMatch.java | 6 ++- .../webui/apps/form/WSetupWizard.java | 3 +- .../adempiere/webui/apps/form/WTreeBOM.java | 3 +- .../webui/apps/form/WTreeMaintenance.java | 3 +- .../webui/apps/form/WTrxMaterial.java | 5 +- .../org/adempiere/webui/apps/wf/WFPanel.java | 4 +- .../adempiere/webui/apps/wf/WWFActivity.java | 6 ++- .../adempiere/webui/component/Accordion.java | 3 +- .../webui/component/FolderBrowser.java | 3 +- .../webui/dashboard/DPFavourites.java | 4 +- .../webui/dashboard/EventWindow.java | 3 +- .../webui/dashboard/RequestWindow.java | 3 +- .../webui/desktop/DefaultDesktop.java | 6 +-- .../org/adempiere/webui/desktop/IDesktop.java | 2 +- .../webui/desktop/NavBar2Desktop.java | 7 ++- .../webui/desktop/NavBarDesktop.java | 4 +- .../webui/desktop/TabbedDesktop.java | 2 +- .../webui/panel/AbstractMenuPanel.java | 4 +- .../webui/panel/CustomizeGridViewPanel.java | 3 +- .../adempiere/webui/panel/HeaderPanel.java | 3 +- .../adempiere/webui/panel/InfoAssetPanel.java | 3 +- .../webui/panel/InfoAssignmentPanel.java | 3 +- .../webui/panel/InfoBPartnerPanel.java | 3 +- .../webui/panel/InfoCashLinePanel.java | 3 +- .../webui/panel/InfoGeneralPanel.java | 3 +- .../adempiere/webui/panel/InfoInOutPanel.java | 3 +- .../webui/panel/InfoInvoicePanel.java | 3 +- .../adempiere/webui/panel/InfoOrderPanel.java | 3 +- .../panel/InfoPAttributeInstancePanel.java | 5 +- .../webui/panel/InfoPaymentPanel.java | 3 +- .../webui/panel/InfoProductPanel.java | 8 +-- .../adempiere/webui/panel/InvoiceHistory.java | 5 +- .../adempiere/webui/panel/WAttachment.java | 3 +- .../webui/panel/action/ExportAction.java | 12 ++--- .../webui/panel/action/ReportAction.java | 6 +-- .../adempiere/webui/part/WindowContainer.java | 8 ++- .../adempiere/webui/session/WebUIServlet.java | 4 -- .../webui/util/LogEventInterceptor.java | 49 +++++++++++++++++++ .../webui/util/ZkResourceLocator.java | 45 ----------------- .../adempiere/webui/window/FindWindow.java | 3 +- .../webui/window/WAccountDialog.java | 2 +- org.adempiere.ui.zk/WEB-INF/zk.xml | 5 ++ org.zkoss.zk.library/META-INF/MANIFEST.MF | 2 +- .../org/zkoss/util/resource/ClassLocator.java | 24 --------- .../zkoss/util/resource/IResourceLocator.java | 31 ------------ 55 files changed, 174 insertions(+), 182 deletions(-) rename org.adempiere.ui.zk/{ => WEB-INF/src}/metainfo/zk/lang-addon.xml (100%) create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/LogEventInterceptor.java delete mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/ZkResourceLocator.java delete mode 100644 org.zkoss.zk.library/src/org/zkoss/util/resource/IResourceLocator.java diff --git a/org.adempiere.ui.zk/META-INF/MANIFEST.MF b/org.adempiere.ui.zk/META-INF/MANIFEST.MF index 4da72e9bd6..6f00ad4d6b 100644 --- a/org.adempiere.ui.zk/META-INF/MANIFEST.MF +++ b/org.adempiere.ui.zk/META-INF/MANIFEST.MF @@ -44,7 +44,8 @@ Export-Package: metainfo.zk, org.adempiere.webui.session, org.adempiere.webui.theme, org.adempiere.webui.util, - org.adempiere.webui.window + org.adempiere.webui.window, + metainfo.zk Require-Bundle: org.adempiere.report.jasper;bundle-version="1.0.0", org.adempiere.base;bundle-version="1.0.0", org.adempiere.report.jasper.library;bundle-version="1.0.0", diff --git a/org.adempiere.ui.zk/metainfo/zk/lang-addon.xml b/org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml similarity index 100% rename from org.adempiere.ui.zk/metainfo/zk/lang-addon.xml rename to org.adempiere.ui.zk/WEB-INF/src/metainfo/zk/lang-addon.xml diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereIdGenerator.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereIdGenerator.java index 2af4bc4987..e5aa5792ea 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereIdGenerator.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/AdempiereIdGenerator.java @@ -20,6 +20,7 @@ import java.util.regex.Pattern; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Desktop; import org.zkoss.zk.ui.Page; +import org.zkoss.zk.ui.metainfo.ComponentInfo; import org.zkoss.zk.ui.sys.IdGenerator; public class AdempiereIdGenerator implements IdGenerator { @@ -33,7 +34,7 @@ public class AdempiereIdGenerator implements IdGenerator { public static final String ZK_COMPONENT_PREFIX_ATTRIBUTE = "zk_component_prefix"; @Override - public String nextComponentUuid(Desktop desktop, Component comp) { + public String nextComponentUuid(Desktop desktop, Component comp, ComponentInfo compInfo) { String prefix = (String) comp.getAttribute(ZK_COMPONENT_PREFIX_ATTRIBUTE); if (prefix == null || prefix.length() == 0) prefix = DEFAULT_ZK_COMP_PREFIX; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WLogin.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WLogin.java index adad7a1c8a..26fa854291 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WLogin.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WLogin.java @@ -69,7 +69,6 @@ public class WLogin extends AbstractUIPart Center center = new Center(); center.setParent(layout); center.setBorder("none"); - center.setFlex(true); center.setAutoscroll(true); center.setStyle("border: none; background-color: transparent;"); @@ -80,6 +79,8 @@ public class WLogin extends AbstractUIPart vb.setPack("center"); vb.setAlign("center"); vb.setStyle("background-color: transparent;"); + vb.setHflex("1"); + vb.setVflex("1"); loginWindow = new LoginWindow(app); loginWindow.setParent(vb); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/acct/WAcctViewer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/acct/WAcctViewer.java index 311b39bac8..752aeb8633 100755 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/acct/WAcctViewer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/acct/WAcctViewer.java @@ -510,13 +510,14 @@ public class WAcctViewer extends Window implements EventListener result.appendChild(resultPanel); Center resultCenter = new Center(); - resultCenter.setFlex(true); resultPanel.appendChild(resultCenter); table.setHflex("1"); table.setVflex(true); table.setHeight("99%"); table.setStyle("position: absolute;"); resultCenter.appendChild(table); + table.setHflex("1"); + table.setVflex("1"); pagingPanel = new South(); resultPanel.appendChild(pagingPanel); @@ -563,17 +564,18 @@ public class WAcctViewer extends Window implements EventListener Center center = new Center(); center.setParent(layout); - center.setFlex(true); center.setStyle("background-color: transparent; padding: 2px;"); tabbedPane.setParent(center); + tabbedPane.setHflex("1"); + tabbedPane.setVflex("1"); South south = new South(); south.setParent(layout); - south.setFlex(true); south.setStyle("background-color: transparent"); south.setHeight("36px"); southPanel.setParent(south); southPanel.setVflex("1"); + southPanel.setHflex("1"); this.setTitle(TITLE); this.setClosable(true); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java index ebcf6cedd4..96cf91f251 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/ProcessDialog.java @@ -159,7 +159,8 @@ public class ProcessDialog extends Window implements EventListener, IProc center = new Center(); layout.appendChild(center); center.appendChild(centerPanel); - center.setFlex(true); + centerPanel.setHflex("1"); + centerPanel.setVflex("1"); center.setAutoscroll(true); center.setStyle("border: none"); @@ -459,6 +460,8 @@ public class ProcessDialog extends Window implements EventListener, IProc messageDiv.setStyle(""); north.setVisible(false); center.appendChild(messageDiv); + messageDiv.setVflex("1"); + messageDiv.setHflex("1"); invalidate(); Clients.response(new AuEcho(this, "onAfterProcess", null)); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java index 823c1b65a1..ce24f42fc3 100755 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java @@ -268,9 +268,10 @@ public class WAllocation extends Allocation center.setStyle("border: none"); // center = new Center(); - center.setFlex(true); mainLayout.appendChild(center); center.appendChild(infoPanel); + infoPanel.setHflex("1"); + infoPanel.setVflex("1"); infoPanel.setStyle("border: none"); infoPanel.setWidth("100%"); @@ -284,9 +285,10 @@ public class WAllocation extends Allocation north.setSplittable(true); center = new Center(); center.setStyle("border: none"); - center.setFlex(true); infoPanel.appendChild(center); center.appendChild(invoicePanel); + invoicePanel.setHflex("1"); + invoicePanel.setVflex("1"); } // jbInit /** diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCharge.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCharge.java index 1b1c7b46c5..99be87a404 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCharge.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WCharge.java @@ -261,10 +261,11 @@ public class WCharge extends Charge implements IFormController, EventListener Center center = new Center(); center.setBorder("none"); - center.setFlex(true); center.setAutoscroll(true); borderlayout.appendChild(center); center.appendChild(m_tblData); + m_tblData.setVflex("1"); + m_tblData.setHflex("1"); South south = new South(); south.setBorder("none"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFileImport.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFileImport.java index 1342abcd3e..41c5c44fae 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFileImport.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WFileImport.java @@ -145,9 +145,10 @@ public class WFileImport extends ADForm implements EventListener layout.appendChild(north); north.appendChild(northPanel); Center center = new Center(); - center.setFlex(true); layout.appendChild(center); center.appendChild(centerPanel); + centerPanel.setVflex("1"); + centerPanel.setHflex("1"); South south = new South(); layout.appendChild(south); south.appendChild(confirmPanel); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WGenForm.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WGenForm.java index 979c9d12fe..28507b835e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WGenForm.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WGenForm.java @@ -115,7 +115,8 @@ public class WGenForm extends ADForm implements EventListener, WTableModelListen center.setStyle("border: none"); contentPane.appendChild(center); center.appendChild(tabbedPane); - center.setFlex(true); + tabbedPane.setVflex("1"); + tabbedPane.setHflex("1"); South south = new South(); south.setStyle("border: none"); contentPane.appendChild(south); @@ -167,7 +168,8 @@ public class WGenForm extends ADForm implements EventListener, WTableModelListen Center center = new Center(); selPanel.appendChild(center); center.appendChild(miniTable); - center.setFlex(true); + miniTable.setVflex("1"); + miniTable.setHflex("1"); miniTable.setHeight("99%"); confirmPanelSel.addActionListener(this); // diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WMatch.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WMatch.java index b09134e29a..37cba7e55e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WMatch.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WMatch.java @@ -272,7 +272,8 @@ public class WMatch extends Match Center center = new Center(); mainLayout.appendChild(center); center.appendChild(centerPanel); - center.setFlex(true); + centerPanel.setHflex("1"); + centerPanel.setVflex("1"); centerLayout.setWidth("100%"); centerLayout.setHeight("100%"); north = new North(); @@ -298,9 +299,10 @@ public class WMatch extends Match center = new Center(); centerLayout.appendChild(center); center.setStyle("border: none"); - center.setFlex(false); // center.setHeight("6%"); center.appendChild(xPanel); + xPanel.setVflex("1"); + xPanel.setHflex("1"); xPanel.appendChild(sameBPartner); xPanel.appendChild(new Space()); xPanel.appendChild(sameProduct); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WSetupWizard.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WSetupWizard.java index 83f6f79512..d90ab54e47 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WSetupWizard.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WSetupWizard.java @@ -251,7 +251,8 @@ public class WSetupWizard extends SetupWizard implements IFormController, EventL West west = new West(); mainLayout.appendChild(west); west.appendChild(wfnodeTree); - west.setFlex(true); + wfnodeTree.setVflex("1"); + wfnodeTree.setHflex("1"); west.setAutoscroll(true); west.setWidth("30%"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WTreeBOM.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WTreeBOM.java index dcc7598c3e..50e6fb26c0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WTreeBOM.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WTreeBOM.java @@ -228,7 +228,8 @@ public class WTreeBOM extends TreeBOM implements IFormController, EventListener mainLayout.appendChild(center); center.appendChild(dataPane); dataPane.appendChild(tableBOM); - center.setFlex(true); + dataPane.setHflex("1"); + dataPane.setVflex("1"); center.setAutoscroll(true); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WTreeMaintenance.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WTreeMaintenance.java index 685145abc1..aa0909b2e3 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WTreeMaintenance.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WTreeMaintenance.java @@ -169,7 +169,8 @@ public class WTreeMaintenance extends TreeMaintenance implements IFormController Center center = new Center(); mainLayout.appendChild(center); center.appendChild(centerTree); - center.setFlex(true); + centerTree.setVflex("1"); + centerTree.setHflex("1"); center.setAutoscroll(true); East east = new East(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WTrxMaterial.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WTrxMaterial.java index f11ddb2e30..a59ba329d1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WTrxMaterial.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/form/WTrxMaterial.java @@ -21,6 +21,7 @@ import java.util.Properties; import java.util.logging.Level; import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.adwindow.ADTabpanel; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.Grid; @@ -36,7 +37,6 @@ import org.adempiere.webui.editor.WTableDirEditor; import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeListener; import org.adempiere.webui.panel.ADForm; -import org.adempiere.webui.panel.ADTabpanel; import org.adempiere.webui.panel.CustomForm; import org.adempiere.webui.panel.IFormController; import org.adempiere.webui.panel.StatusBarPanel; @@ -212,8 +212,9 @@ public class WTrxMaterial extends TrxMaterial m_gridController.switchRowPresentation(); Center center = new Center(); mainLayout.appendChild(center); - center.setFlex(true); center.appendChild(m_gridController); + m_gridController.setVflex("1"); + m_gridController.setHflex("1"); } // dynInit diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WFPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WFPanel.java index c37c79e093..c5ac1ec68c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WFPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WFPanel.java @@ -108,7 +108,6 @@ public class WFPanel extends Borderlayout implements EventListener center.appendChild(table); contentPanel.setStyle("width: 100%; heigh: 100%;"); center.setAutoscroll(true); - center.setFlex(false); South south = new South(); this.appendChild(south); @@ -120,7 +119,8 @@ public class WFPanel extends Borderlayout implements EventListener south.setSplittable(true); south.setCollapsible(true); south.setAutoscroll(true); - south.setFlex(true); + div.setVflex("1"); + div.setHflex("1"); } // jbInit private void createTable() { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WWFActivity.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WWFActivity.java index 2b72f6b7b1..cba1db924b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WWFActivity.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/apps/wf/WWFActivity.java @@ -243,7 +243,8 @@ public class WWFActivity extends ADForm implements EventListener North north = new North(); north.appendChild(listbox); north.setSplittable(true); - north.setFlex(true); + listbox.setVflex("1"); + listbox.setHflex("1"); north.setHeight("50%"); layout.appendChild(north); north.setStyle("background-color: transparent"); @@ -253,7 +254,8 @@ public class WWFActivity extends ADForm implements EventListener center.appendChild(grid); layout.appendChild(center); center.setStyle("background-color: transparent"); - center.setFlex(true); + grid.setVflex("1"); + grid.setHflex("1"); South south = new South(); south.appendChild(statusBar); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Accordion.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Accordion.java index 8ffcdefac2..42d03702de 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Accordion.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Accordion.java @@ -54,8 +54,7 @@ public class Accordion extends Borderlayout implements EventListener { north.setCollapsible(false); Center center = new Center(); - center.setFlex(true); - appendChild(new Center()); + appendChild(center); South south = new South(); appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/FolderBrowser.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/FolderBrowser.java index faee0f4991..f0398c37aa 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/FolderBrowser.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/FolderBrowser.java @@ -90,9 +90,10 @@ public class FolderBrowser extends Window implements EventListener north.appendChild(txtPath); Center center = new Center(); - center.setFlex(true); contentLayout.appendChild(center); center.appendChild(listDir); + listDir.setVflex("1"); + listDir.setHflex("1"); South south = new South(); south.setStyle("border: none"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java index bcf254556d..14429fb6bc 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/DPFavourites.java @@ -15,11 +15,11 @@ package org.adempiere.webui.dashboard; import java.util.Enumeration; +import org.adempiere.webui.adwindow.ADWindow; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.event.TouchEventHelper; import org.adempiere.webui.exception.ApplicationException; import org.adempiere.webui.session.SessionManager; -import org.adempiere.webui.window.ADWindow; import org.adempiere.webui.window.FDialog; import org.compiere.model.GridTab; import org.compiere.model.MMenu; @@ -293,7 +293,7 @@ public class DPFavourites extends DashboardPanel implements EventListener if(frame == null) return; - GridTab tab = frame.getADWindowPanel().getActiveGridTab(); + GridTab tab = frame.getADWindowContent().getActiveGridTab(); tab.dataNew(false); } catch (Exception e) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/EventWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/EventWindow.java index 08293b1097..1076ec953c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/EventWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/EventWindow.java @@ -131,7 +131,8 @@ public class EventWindow extends Window implements EventListener { Center center = new Center(); borderlayout.appendChild(center); center.appendChild(grid); - center.setFlex(true); + grid.setVflex("1"); + grid.setHflex("1"); South south = new South(); borderlayout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/RequestWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/RequestWindow.java index 96eca44b5e..801639bef0 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/RequestWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/dashboard/RequestWindow.java @@ -237,7 +237,8 @@ public class RequestWindow extends Window implements EventListener { Center center = new Center(); borderlayout.appendChild(center); center.appendChild(grid); - center.setFlex(true); + grid.setVflex("1"); + grid.setHflex("1"); South south = new South(); borderlayout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java index c5ae43cd3d..6f85b60849 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/DefaultDesktop.java @@ -34,6 +34,7 @@ import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.util.IServerPushCallback; import org.adempiere.webui.util.ServerPushTemplate; import org.adempiere.webui.util.UserPreference; +import org.compiere.Adempiere; import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -120,7 +121,6 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria w.setSclass("desktop-left-column"); w.setCollapsible(true); w.setSplittable(true); - w.setFlex(false); w.setHflex("1"); w.addEventListener(Events.ON_OPEN, new EventListener() { @Override @@ -139,7 +139,6 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria windowArea = new Center(); windowArea.setParent(layout); - windowArea.setFlex(true); windowArea.setSclass("desktop-center"); windowContainer.createPart(windowArea); @@ -178,8 +177,7 @@ public class DefaultDesktop extends TabbedDesktop implements MenuListener, Seria } }; - Thread thread = new Thread(runnable); - thread.start(); + Adempiere.getThreadPoolExecutor().submit(runnable); return layout; } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java index 373a5f33d9..47dc9f56f6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/IDesktop.java @@ -14,12 +14,12 @@ package org.adempiere.webui.desktop; import org.adempiere.webui.ClientInfo; +import org.adempiere.webui.adwindow.ADWindow; import org.adempiere.webui.apps.ProcessDialog; import org.adempiere.webui.component.Window; import org.adempiere.webui.panel.ADForm; import org.adempiere.webui.part.UIPart; import org.adempiere.webui.util.ServerPushTemplate; -import org.adempiere.webui.window.ADWindow; import org.compiere.model.MQuery; import org.compiere.util.WebDoc; import org.zkoss.zk.ui.Component; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBar2Desktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBar2Desktop.java index 22beaeee73..6db684281a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBar2Desktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBar2Desktop.java @@ -17,6 +17,7 @@ import java.io.Serializable; import java.util.Properties; import org.adempiere.util.ServerContext; +import org.adempiere.webui.adwindow.ADWindow; import org.adempiere.webui.apps.BusyDialog; import org.adempiere.webui.apps.ProcessDialog; import org.adempiere.webui.component.Accordion; @@ -32,7 +33,6 @@ import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.util.IServerPushCallback; import org.adempiere.webui.util.ServerPushTemplate; import org.adempiere.webui.util.UserPreference; -import org.adempiere.webui.window.ADWindow; import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -118,7 +118,6 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria w.setWidth("300px"); w.setCollapsible(true); w.setSplittable(true); - w.setFlex(true); w.addEventListener(Events.ON_OPEN, new EventListener() { @Override public void onEvent(Event event) throws Exception { @@ -136,12 +135,13 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria Center center = new Center(); center.setParent(layout); - center.setFlex(true); Borderlayout innerLayout = new Borderlayout(); innerLayout.setHeight("100%"); innerLayout.setWidth("100%"); innerLayout.setParent(center); + innerLayout.setVflex("1"); + innerLayout.setHflex("1"); West innerW = new West(); innerW.setWidth("200px"); @@ -173,7 +173,6 @@ public class NavBar2Desktop extends TabbedDesktop implements MenuListener, Seria windowArea = new Center(); windowArea.setParent(innerLayout); - windowArea.setFlex(true); windowContainer.createPart(windowArea); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java index 375b508101..084160ae39 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/NavBarDesktop.java @@ -17,6 +17,7 @@ import java.io.Serializable; import java.util.Properties; import org.adempiere.util.ServerContext; +import org.adempiere.webui.adwindow.ADWindow; import org.adempiere.webui.apps.BusyDialog; import org.adempiere.webui.apps.ProcessDialog; import org.adempiere.webui.component.Accordion; @@ -34,7 +35,6 @@ import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.util.IServerPushCallback; import org.adempiere.webui.util.ServerPushTemplate; import org.adempiere.webui.util.UserPreference; -import org.adempiere.webui.window.ADWindow; import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.Msg; @@ -127,7 +127,6 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial leftRegion.setCollapsible(true); leftRegion.setSplittable(true); leftRegion.setTitle("Navigation"); - leftRegion.setFlex(true); leftRegion.addEventListener(Events.ON_OPEN, new EventListener() { @Override public void onEvent(Event event) throws Exception { @@ -174,7 +173,6 @@ public class NavBarDesktop extends TabbedDesktop implements MenuListener, Serial windowArea = new Center(); windowArea.setParent(layout); - windowArea.setFlex(true); windowContainer.createPart(windowArea); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java index fffd04a665..73afe6ea71 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/desktop/TabbedDesktop.java @@ -15,6 +15,7 @@ package org.adempiere.webui.desktop; import java.util.List; +import org.adempiere.webui.adwindow.ADWindow; import org.adempiere.webui.apps.ProcessDialog; import org.adempiere.webui.apps.wf.WFPanel; import org.adempiere.webui.component.DesktopTabpanel; @@ -24,7 +25,6 @@ import org.adempiere.webui.component.Window; import org.adempiere.webui.panel.ADForm; import org.adempiere.webui.part.WindowContainer; import org.adempiere.webui.session.SessionManager; -import org.adempiere.webui.window.ADWindow; import org.adempiere.webui.window.WTask; import org.compiere.model.MQuery; import org.compiere.model.MTask; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractMenuPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractMenuPanel.java index 2201f19497..c2fea41b63 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractMenuPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractMenuPanel.java @@ -20,12 +20,12 @@ import java.util.Collection; import java.util.Enumeration; import java.util.Properties; +import org.adempiere.webui.adwindow.ADWindow; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.event.TouchEventHelper; import org.adempiere.webui.event.TouchEvents; import org.adempiere.webui.exception.ApplicationException; import org.adempiere.webui.session.SessionManager; -import org.adempiere.webui.window.ADWindow; import org.compiere.model.GridTab; import org.compiere.model.MMenu; import org.compiere.model.MQuery; @@ -306,7 +306,7 @@ public abstract class AbstractMenuPanel extends Panel implements EventListener userPanel.setHeight("100%"); userPanel.setAlign("right"); userPanel.setStyle("position: absolute; text-align:right;"); - center.setFlex(true); + userPanel.setVflex("1"); + userPanel.setHflex("1"); LayoutUtils.addSclass("desktop-header-right", center); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoAssetPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoAssetPanel.java index 5fafc4d1f9..9f69bd2e19 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoAssetPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoAssetPanel.java @@ -204,7 +204,6 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev Center center = new Center(); layout.appendChild(center); - center.setFlex(true); Div div = new Div(); div.appendChild(contentPanel); if (isLookup()) @@ -214,6 +213,8 @@ public class InfoAssetPanel extends InfoPanel implements ValueChangeListener, Ev contentPanel.setVflex(true); div.setStyle("width :100%; height: 100%"); center.appendChild(div); + div.setVflex("1"); + div.setHflex("1"); South south = new South(); layout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoAssignmentPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoAssignmentPanel.java index 5c047439f1..ceaa0f2b3c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoAssignmentPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoAssignmentPanel.java @@ -237,7 +237,6 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val Center center = new Center(); layout.appendChild(center); - center.setFlex(true); div = new Div(); div.appendChild(contentPanel); if (isLookup()) @@ -247,6 +246,8 @@ public class InfoAssignmentPanel extends InfoPanel implements EventListener, Val contentPanel.setVflex(true); div.setStyle("width :100%; height: 100%"); center.appendChild(div); + div.setVflex("1"); + div.setHflex("1"); South south = new South(); layout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoBPartnerPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoBPartnerPanel.java index cd4d98a2a6..c0b97098a1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoBPartnerPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoBPartnerPanel.java @@ -248,7 +248,6 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl Center center = new Center(); layout.appendChild(center); - center.setFlex(true); Div div = new Div(); div.appendChild(contentPanel); if (isLookup()) @@ -258,6 +257,8 @@ public class InfoBPartnerPanel extends InfoPanel implements EventListener, WTabl contentPanel.setVflex(true); div.setStyle("width :100%; height: 100%"); center.appendChild(div); + div.setVflex("1"); + div.setHflex("1"); South south = new South(); layout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoCashLinePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoCashLinePanel.java index d0a7db84a4..0aa204d54a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoCashLinePanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoCashLinePanel.java @@ -263,7 +263,6 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener, Center center = new Center(); layout.appendChild(center); - center.setFlex(true); Div div = new Div(); div.appendChild(contentPanel); if (isLookup()) @@ -273,6 +272,8 @@ public class InfoCashLinePanel extends InfoPanel implements ValueChangeListener, contentPanel.setVflex(true); div.setStyle("width :100%; height: 100%"); center.appendChild(div); + div.setVflex("1"); + div.setHflex("1"); South south = new South(); layout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java index 70267d1e48..d728aaa795 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoGeneralPanel.java @@ -160,7 +160,6 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener Center center = new Center(); layout.appendChild(center); - center.setFlex(true); Div div = new Div(); div.appendChild(contentPanel); if (isLookup()) @@ -170,6 +169,8 @@ public class InfoGeneralPanel extends InfoPanel implements EventListener contentPanel.setVflex(true); div.setStyle("width :100%; height: 100%"); center.appendChild(div); + div.setVflex("1"); + div.setHflex("1"); South south = new South(); layout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoInOutPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoInOutPanel.java index 69189c670a..30e922af02 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoInOutPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoInOutPanel.java @@ -230,7 +230,6 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev Center center = new Center(); layout.appendChild(center); - center.setFlex(true); Div div = new Div(); div.appendChild(contentPanel); if (isLookup()) @@ -240,6 +239,8 @@ public class InfoInOutPanel extends InfoPanel implements ValueChangeListener, Ev contentPanel.setVflex(true); div.setStyle("width :100%; height: 100%"); center.appendChild(div); + div.setVflex("1"); + div.setHflex("1"); South south = new South(); layout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoInvoicePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoInvoicePanel.java index c0654ce13d..a4d5ca3a2b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoInvoicePanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoInvoicePanel.java @@ -260,7 +260,6 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener Center center = new Center(); layout.appendChild(center); - center.setFlex(true); Div div = new Div(); div.appendChild(contentPanel); if (isLookup()) @@ -270,6 +269,8 @@ public class InfoInvoicePanel extends InfoPanel implements ValueChangeListener contentPanel.setVflex(true); div.setStyle("width :100%; height: 100%"); center.appendChild(div); + div.setVflex("1"); + div.setHflex("1"); South south = new South(); layout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoOrderPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoOrderPanel.java index 6bf586d981..1f843a0820 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoOrderPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoOrderPanel.java @@ -237,7 +237,6 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener Center center = new Center(); layout.appendChild(center); - center.setFlex(true); Div div = new Div(); div.appendChild(contentPanel); if (isLookup()) @@ -247,6 +246,8 @@ public class InfoOrderPanel extends InfoPanel implements ValueChangeListener contentPanel.setVflex(true); div.setStyle("width :100%; height: 100%"); center.appendChild(div); + div.setVflex("1"); + div.setHflex("1"); South south = new South(); layout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPAttributeInstancePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPAttributeInstancePanel.java index c0f776b4d3..f5e390fb67 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPAttributeInstancePanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPAttributeInstancePanel.java @@ -135,9 +135,10 @@ public class InfoPAttributeInstancePanel extends Window implements EventListener Center center = new Center(); center.setAutoscroll(true); - center.setFlex(true); - borderlayout.appendChild(center); + borderlayout.appendChild(center); center.appendChild(m_table); + m_table.setVflex("1"); + m_table.setHflex("1"); South south = new South(); borderlayout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPaymentPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPaymentPanel.java index 9f147efe12..5d56de8eca 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPaymentPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoPaymentPanel.java @@ -245,7 +245,6 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener, Center center = new Center(); layout.appendChild(center); - center.setFlex(true); Div div = new Div(); div.appendChild(contentPanel); if (isLookup()) @@ -255,6 +254,8 @@ public class InfoPaymentPanel extends InfoPanel implements ValueChangeListener, contentPanel.setVflex(true); div.setStyle("width :100%; height: 100%"); center.appendChild(div); + div.setVflex("1"); + div.setHflex("1"); South south = new South(); layout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java index f79aa03333..e88b7150a2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InfoProductPanel.java @@ -501,20 +501,22 @@ public class InfoProductPanel extends InfoPanel implements EventListener Center center = new Center(); //true will conflict with listbox scrolling center.setAutoscroll(false); - center.setFlex(true); - borderlayout.appendChild(center); + borderlayout.appendChild(center); center.appendChild(contentPanel); + contentPanel.setVflex("1"); + contentPanel.setHflex("1"); South south = new South(); int detailHeight = (height * 25 / 100); south.setHeight(detailHeight + "px"); south.setCollapsible(true); south.setSplittable(true); - south.setFlex(true); south.setTitle(Msg.translate(Env.getCtx(), "WarehouseStock")); south.setTooltiptext(Msg.translate(Env.getCtx(), "WarehouseStock")); borderlayout.appendChild(south); tabbedPane.setSclass("info-product-tabbedpane"); south.appendChild(tabbedPane); + tabbedPane.setVflex("1"); + tabbedPane.setHflex("1"); Borderlayout mainPanel = new Borderlayout(); mainPanel.setWidth("100%"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InvoiceHistory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InvoiceHistory.java index 5bfbbc9fe7..5e2b7c1ec8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InvoiceHistory.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/InvoiceHistory.java @@ -190,9 +190,10 @@ public class InvoiceHistory extends Window implements EventListener Center center = new Center(); center.setStyle("border: none"); center.setAutoscroll(true); - center.setFlex(true); - borderlayout.appendChild(center); + borderlayout.appendChild(center); center.appendChild(tabbox); + tabbox.setVflex("1"); + tabbox.setHflex("1"); South south = new South(); south.setStyle("border: none"); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java index 5d2f7f36c1..7cc87033c6 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java @@ -267,9 +267,10 @@ public class WAttachment extends Window implements EventListener Center centerPane = new Center(); centerPane.setAutoscroll(true); - centerPane.setFlex(true); mainPanel.appendChild(centerPane); centerPane.appendChild(previewPanel); + previewPanel.setVflex("1"); + previewPanel.setHflex("1"); South southPane = new South(); mainPanel.appendChild(southPane); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ExportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ExportAction.java index 530c1c59cd..cdbd771e0e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ExportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ExportAction.java @@ -24,16 +24,16 @@ import java.util.Set; import org.adempiere.base.IGridTabExporter; import org.adempiere.base.Service; import org.adempiere.exceptions.AdempiereException; +import org.adempiere.webui.adwindow.AbstractADWindowContent; +import org.adempiere.webui.adwindow.IADTabbox; +import org.adempiere.webui.adwindow.IADTabpanel; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.ConfirmPanel; -import org.adempiere.webui.component.IADTab; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.ListItem; import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Window; -import org.adempiere.webui.panel.AbstractADWindowPanel; -import org.adempiere.webui.panel.IADTabpanel; import org.adempiere.webui.window.FDialog; import org.compiere.model.GridTab; import org.compiere.util.Env; @@ -53,7 +53,7 @@ import org.zkoss.zul.Vbox; */ public class ExportAction implements EventListener { - private AbstractADWindowPanel panel; + private AbstractADWindowContent panel; private Map exporterMap = null; private Map extensionMap = null; @@ -66,7 +66,7 @@ public class ExportAction implements EventListener /** * @param panel */ - public ExportAction(AbstractADWindowPanel panel) + public ExportAction(AbstractADWindowContent panel) { this.panel = panel; } @@ -162,7 +162,7 @@ public class ExportAction implements EventListener boolean currentRowOnly = chkCurrentRow.isSelected(); File file = File.createTempFile("Export", "."+ext); - IADTab adTab = panel.getADTab(); + IADTabbox adTab = panel.getADTab(); int selected = adTab.getSelectedIndex(); int tabLevel = panel.getActiveGridTab().getTabLevel(); Set tables = new HashSet(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java index 4d43f5a1ac..d3c70b7f0f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/action/ReportAction.java @@ -27,6 +27,7 @@ import java.util.logging.Level; import javax.sql.RowSet; import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.adwindow.AbstractADWindowContent; import org.adempiere.webui.apps.WProcessCtl; import org.adempiere.webui.component.Checkbox; import org.adempiere.webui.component.ConfirmPanel; @@ -34,7 +35,6 @@ import org.adempiere.webui.component.Label; import org.adempiere.webui.component.ListItem; import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Window; -import org.adempiere.webui.panel.AbstractADWindowPanel; import org.adempiere.webui.window.FDialog; import org.compiere.model.GridTab; import org.compiere.model.MQuery; @@ -66,7 +66,7 @@ public class ReportAction implements EventListener { private static CLogger log = CLogger.getCLogger(ReportAction.class); - private AbstractADWindowPanel panel; + private AbstractADWindowContent panel; private Window winReport = null; private ConfirmPanel confirmPanel = new ConfirmPanel(true); @@ -78,7 +78,7 @@ public class ReportAction implements EventListener private ArrayList printFormatList = new ArrayList(); - public ReportAction(AbstractADWindowPanel panel) + public ReportAction(AbstractADWindowContent panel) { this.panel = panel; getPrintFormats(panel.getActiveGridTab().getAD_Table_ID()); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java index 4ee5a88d96..dd856cc6bb 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java @@ -57,12 +57,16 @@ public class WindowContainer extends AbstractUIPart tabbox.setSclass("desktop-tabbox"); Tabpanels tabpanels = new Tabpanels(); + tabpanels.setVflex("1"); + tabpanels.setHflex("1"); Tabs tabs = new Tabs(); tabbox.appendChild(tabs); tabbox.appendChild(tabpanels); tabbox.setWidth("100%"); tabbox.setHeight("100%"); + tabbox.setVflex("1"); + tabbox.setHflex("1"); if (parent != null) tabbox.setParent(parent); @@ -135,7 +139,9 @@ public class WindowContainer extends AbstractUIPart } tabpanel.setHeight("100%"); tabpanel.setWidth("100%"); - tabpanel.setZclass("desktop-tabpanel"); + tabpanel.setVflex("1"); + tabpanel.setHflex("1"); + tabpanel.setSclass("desktop-tabpanel"); if (refTab == null) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/session/WebUIServlet.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/session/WebUIServlet.java index d479080ebc..290cb93ed1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/session/WebUIServlet.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/session/WebUIServlet.java @@ -32,12 +32,10 @@ import javax.servlet.http.HttpServletResponse; import org.compiere.Adempiere; import org.compiere.util.CLogger; import org.compiere.util.Ini; -import org.zkoss.util.resource.ClassLocator; import org.zkoss.zk.ui.http.DHtmlLayoutServlet; import org.adempiere.util.ServerContext; import org.adempiere.util.ServerContextURLHandler; -import org.adempiere.webui.util.ZkResourceLocator; /** * @@ -54,8 +52,6 @@ public class WebUIServlet extends DHtmlLayoutServlet public void init(ServletConfig servletConfig) throws ServletException { - ClassLocator.addResourceLocator(new ZkResourceLocator()); - super.init(servletConfig); /** Initialise context for the current thread*/ diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/LogEventInterceptor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/LogEventInterceptor.java new file mode 100644 index 0000000000..54052a64eb --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/LogEventInterceptor.java @@ -0,0 +1,49 @@ +/** + * + */ +package org.adempiere.webui.util; + +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.util.EventInterceptor; + +/** + * @author hengsin + * + */ +public class LogEventInterceptor implements EventInterceptor { + + /* (non-Javadoc) + * @see org.zkoss.zk.ui.util.EventInterceptor#beforeSendEvent(org.zkoss.zk.ui.event.Event) + */ + @Override + public Event beforeSendEvent(Event event) { +// System.out.println("beforeSendEvent, event="+event.getName()+",target="+event.getTarget()); + return event; + } + + /* (non-Javadoc) + * @see org.zkoss.zk.ui.util.EventInterceptor#beforePostEvent(org.zkoss.zk.ui.event.Event) + */ + @Override + public Event beforePostEvent(Event event) { +// System.out.println("beforePostEvent, event="+event.getName()+",target="+event.getTarget()); + return event; + } + + /* (non-Javadoc) + * @see org.zkoss.zk.ui.util.EventInterceptor#beforeProcessEvent(org.zkoss.zk.ui.event.Event) + */ + @Override + public Event beforeProcessEvent(Event event) { + System.out.println("beforeProcessEvent, event="+event.getName()+",target="+event.getTarget()); + return event; + } + + /* (non-Javadoc) + * @see org.zkoss.zk.ui.util.EventInterceptor#afterProcessEvent(org.zkoss.zk.ui.event.Event) + */ + @Override + public void afterProcessEvent(Event event) { +// System.out.println("afterProcessEvent, event="+event.getName()+",target="+event.getTarget()); + } +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/ZkResourceLocator.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/ZkResourceLocator.java deleted file mode 100644 index c95a1e6c66..0000000000 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/util/ZkResourceLocator.java +++ /dev/null @@ -1,45 +0,0 @@ -/****************************************************************************** - * Copyright (C) 2012 Heng Sin Low * - * Copyright (C) 2012 Trek Global * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package org.adempiere.webui.util; - -import java.net.URL; - -import org.adempiere.webui.WebUIActivator; -import org.zkoss.util.resource.IResourceLocator; - -/** - * @author hengsin - * - */ -public class ZkResourceLocator implements IResourceLocator { - - private static ZkResourceLocator INSTANCE; - - public ZkResourceLocator() { - INSTANCE = this; - } - - /* (non-Javadoc) - * @see org.zkoss.util.resource.IResourceLocator#getResource(java.lang.String) - */ - @Override - public URL getResource(String name) { - return WebUIActivator.getBundleContext().getBundle().getEntry(name); - } - - public static boolean isStarted() { - return INSTANCE != null; - } - -} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index b7bac58731..bf24f89a31 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -363,7 +363,8 @@ public class FindWindow extends Window implements EventListener, ValueCha Center center = new Center(); layout.appendChild(center); center.appendChild(contentSimple); - center.setFlex(true); + contentSimple.setVflex("1"); + contentSimple.setHflex("1"); South south = new South(); layout.appendChild(south); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java index fe994989dc..dcb6e255d4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/WAccountDialog.java @@ -22,6 +22,7 @@ import java.sql.SQLException; import java.util.logging.Level; import org.adempiere.util.Callback; +import org.adempiere.webui.adwindow.ADTabpanel; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.Grid; @@ -35,7 +36,6 @@ import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WebEditorFactory; import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeListener; -import org.adempiere.webui.panel.ADTabpanel; import org.adempiere.webui.panel.StatusBarPanel; import org.adempiere.webui.session.SessionManager; import org.compiere.model.DataStatusEvent; diff --git a/org.adempiere.ui.zk/WEB-INF/zk.xml b/org.adempiere.ui.zk/WEB-INF/zk.xml index 2ba6d1227e..be0e3bf04f 100644 --- a/org.adempiere.ui.zk/WEB-INF/zk.xml +++ b/org.adempiere.ui.zk/WEB-INF/zk.xml @@ -12,6 +12,11 @@ + + + [Optional] Monitor i3-log.conf and register a handler for the specified log-base diff --git a/org.zkoss.zk.library/META-INF/MANIFEST.MF b/org.zkoss.zk.library/META-INF/MANIFEST.MF index 69cd65f071..b7b22bf0c4 100644 --- a/org.zkoss.zk.library/META-INF/MANIFEST.MF +++ b/org.zkoss.zk.library/META-INF/MANIFEST.MF @@ -99,6 +99,7 @@ Import-Package: bsh, org.codehaus.groovy.vmplugin.v5, org.osgi.framework;version="1.3.0", org.osgi.service.component;version="1.1.0" +DynamicImport-Package: metainfo.zk Bundle-ClassPath: ., lib/asm.jar, lib/cglib.jar, @@ -221,7 +222,6 @@ Export-Package: Lib, metainfo.tld, metainfo.xel, metainfo.xml, - metainfo.zel, metainfo.zk, net, net.sf.cglib.asm, diff --git a/org.zkoss.zk.library/src/org/zkoss/util/resource/ClassLocator.java b/org.zkoss.zk.library/src/org/zkoss/util/resource/ClassLocator.java index e854f75a05..50a3e90935 100644 --- a/org.zkoss.zk.library/src/org/zkoss/util/resource/ClassLocator.java +++ b/org.zkoss.zk.library/src/org/zkoss/util/resource/ClassLocator.java @@ -53,19 +53,9 @@ import org.zkoss.idom.input.SAXBuilder; public class ClassLocator implements XMLResourcesLocator { private static final Log log = Log.lookup(ClassLocator.class); - private static List resourceLocators = new ArrayList(); - public ClassLocator() { } - public static synchronized void addResourceLocator(IResourceLocator locator) { - resourceLocators.add(locator); - } - - private static synchronized IResourceLocator[] getResourceLocators() { - return resourceLocators.toArray(new IResourceLocator[0]); - } - //XMLResourcesLocator// public Enumeration getResources(String name) throws IOException { List list = null; @@ -95,15 +85,6 @@ public class ClassLocator implements XMLResourcesLocator { final Enumeration en = ClassLoader.getSystemResources(name); list = Collections.list(en); } - IResourceLocator[] locators = ClassLocator.getResourceLocators(); - if (locators != null && locators.length > 0) { - for (IResourceLocator locator : locators) { - URL url = locator.getResource(name); - if (url != null) { - list.add(url); - } - } - } return Collections.enumeration(list); } public List getDependentXMLResources(String name, String elName, @@ -116,11 +97,6 @@ public class ClassLocator implements XMLResourcesLocator { if (old != null) log.warning("Replicate resource: "+xr.name +"\nOverwrite "+old.url+"\nwith "+xr.url); - else { - if (log.infoable()) { - log.info(xr); - } - } //it is possible if zcommon.jar is placed in both //WEB-INF/lib and shared/lib, i.e., appear twice in the class path //We overwrite because the order is the parent class loader first diff --git a/org.zkoss.zk.library/src/org/zkoss/util/resource/IResourceLocator.java b/org.zkoss.zk.library/src/org/zkoss/util/resource/IResourceLocator.java deleted file mode 100644 index 6ec65055f9..0000000000 --- a/org.zkoss.zk.library/src/org/zkoss/util/resource/IResourceLocator.java +++ /dev/null @@ -1,31 +0,0 @@ -/****************************************************************************** - * Copyright (C) 2012 Heng Sin Low * - * Copyright (C) 2012 Trek Global * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package org.zkoss.util.resource; - -import java.net.URL; - -/** - * - * @author hengsin - * - */ -public interface IResourceLocator { - - /** - * @param name - * @return resource url - */ - public URL getResource(String name); - -} From d21fc00b607b7ee8cfb58697a412f69a8290586b Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 9 Oct 2012 18:40:52 +0800 Subject: [PATCH 2/9] IDEMPIERE-369 Master Detail layout improvements --- .../src/org/compiere/model/GridTab.java | 29 +- .../src/org/compiere/model/GridTable.java | 10 +- .../src/org/adempiere/webui/LayoutUtils.java | 21 + .../src/org/adempiere/webui/WRequest.java | 4 +- .../webui/{panel => adwindow}/ADSortTab.java | 28 +- .../webui/{panel => adwindow}/ADTabpanel.java | 191 ++--- .../{panel => adwindow}/ADTreePanel.java | 3 +- .../webui/{window => adwindow}/ADWindow.java | 19 +- .../ADWindowContent.java} | 76 +- .../ADWindowToolbar.java} | 48 +- .../AbstractADTabbox.java} | 15 +- .../AbstractADWindowContent.java} | 764 ++++++++++-------- .../adempiere/webui/adwindow/BreadCrumb.java | 434 ++++++++++ .../webui/adwindow/BreadCrumbLink.java | 39 + .../webui/adwindow/CompositeADTabbox.java | 646 +++++++++++++++ .../adempiere/webui/adwindow/DetailPane.java | 414 ++++++++++ .../GridTabRowRenderer.java | 17 +- .../GridTableListModel.java | 2 +- .../GridPanel.java => adwindow/GridView.java} | 164 +++- .../IADTab.java => adwindow/IADTabbox.java} | 58 +- .../{panel => adwindow}/IADTabpanel.java | 11 +- .../adempiere/webui/adwindow/StatusBar.java | 90 +++ .../webui/component/ADButtonTabList.java | 179 ---- .../webui/component/ADTabListModel.java | 5 +- .../webui/component/CompositeADTab.java | 162 ---- .../component/GridTabListItemRenderer.java | 418 ---------- .../adempiere/webui/component/IADTabList.java | 16 - .../adempiere/webui/component/ListPanel.java | 484 ----------- .../adempiere/webui/component/NumberBox.java | 30 +- .../org/adempiere/webui/editor/WEditor.java | 14 +- .../adempiere/webui/editor/WNumberEditor.java | 19 +- .../webui/editor/WPasswordEditor.java | 5 + .../adempiere/webui/editor/WStringEditor.java | 3 +- .../webui/factory/DefaultEditorFactory.java | 6 +- org.adempiere.ui.zk/images/EditRecord16.png | Bin 0 -> 603 bytes .../images/ErrorIndicator16.png | Bin 0 -> 814 bytes .../images/ErrorIndicator24.png | Bin 0 -> 1213 bytes .../images/InfoIndicator16.png | Bin 0 -> 835 bytes .../images/InfoIndicator24.png | Bin 0 -> 1292 bytes .../theme/default/css/theme.css.dsp | 41 +- 40 files changed, 2494 insertions(+), 1971 deletions(-) rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{panel => adwindow}/ADSortTab.java (94%) rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{panel => adwindow}/ADTabpanel.java (90%) rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{panel => adwindow}/ADTreePanel.java (98%) rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{window => adwindow}/ADWindow.java (86%) rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{panel/ADWindowPanel.java => adwindow/ADWindowContent.java} (74%) rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{component/CWindowToolbar.java => adwindow/ADWindowToolbar.java} (92%) rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{component/AbstractADTab.java => adwindow/AbstractADTabbox.java} (95%) rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{panel/AbstractADWindowPanel.java => adwindow/AbstractADWindowContent.java} (71%) create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumbLink.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/CompositeADTabbox.java create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{component => adwindow}/GridTabRowRenderer.java (97%) rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{component => adwindow}/GridTableListModel.java (95%) rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{component/GridPanel.java => adwindow/GridView.java} (84%) rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{component/IADTab.java => adwindow/IADTabbox.java} (72%) rename org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/{panel => adwindow}/IADTabpanel.java (88%) create mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/StatusBar.java delete mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ADButtonTabList.java delete mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/CompositeADTab.java delete mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridTabListItemRenderer.java delete mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/IADTabList.java delete mode 100644 org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ListPanel.java create mode 100644 org.adempiere.ui.zk/images/EditRecord16.png create mode 100644 org.adempiere.ui.zk/images/ErrorIndicator16.png create mode 100644 org.adempiere.ui.zk/images/ErrorIndicator24.png create mode 100644 org.adempiere.ui.zk/images/InfoIndicator16.png create mode 100644 org.adempiere.ui.zk/images/InfoIndicator24.png diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index 85199c4b98..47d2b210c5 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -1006,11 +1006,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable } fireStateChangeEvent(new StateChangeEvent(this, StateChangeEvent.DATA_SAVE)); - if (retValue) { - // refresh parent tabs - refreshParents(); - } - return retValue; } catch (Exception e) @@ -1059,28 +1054,6 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable return false; } - private void refreshParents() { - if (isDetail()) { - // get parent tab - // the parent tab is the first tab above with level = this_tab_level-1 - int level = m_vo.TabLevel; - for (int i = m_window.getTabIndex(this) - 1; i >= 0; i--) { - GridTab parentTab = m_window.getTab(i); - if (parentTab.m_vo.TabLevel == level-1) { - parentTab.dataRefresh(false); - // search for the next parent - if (parentTab.isDetail()) { - level = parentTab.m_vo.TabLevel; - } else { - break; - } - } - } - // refresh this tab - dataRefresh(false); - } - } - /** * Do we need to Save? * @param rowChange row change @@ -2514,7 +2487,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable * @param fireEvents fire events * @return current row */ - private int setCurrentRow (int newCurrentRow, boolean fireEvents) + public int setCurrentRow (int newCurrentRow, boolean fireEvents) { int oldCurrentRow = m_currentRow; m_currentRow = verifyRow (newCurrentRow); diff --git a/org.adempiere.base/src/org/compiere/model/GridTable.java b/org.adempiere.base/src/org/compiere/model/GridTable.java index 1894cb78f0..cf5258adf3 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTable.java +++ b/org.adempiere.base/src/org/compiere/model/GridTable.java @@ -42,7 +42,6 @@ import javax.swing.event.TableModelListener; import javax.swing.table.AbstractTableModel; import org.adempiere.exceptions.DBException; -import org.adempiere.util.ContextRunnable; import org.adempiere.util.ServerContext; import org.compiere.Adempiere; import org.compiere.util.CLogMgt; @@ -619,13 +618,8 @@ public class GridTable extends AbstractTableModel m_sort = new ArrayList(m_rowCount+10); if (m_rowCount > 0) { - if (m_rowCount < 1000) - m_loader.run(); - else - { - m_loader.setContext(ServerContext.getCurrentInstance()); - m_loaderFuture = Adempiere.getThreadPoolExecutor().submit(m_loader); - } + m_loader.setContext(ServerContext.getCurrentInstance()); + m_loaderFuture = Adempiere.getThreadPoolExecutor().submit(m_loader); } else m_loader.close(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java index ebcfb6a8f1..b2e9ea0f86 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java @@ -103,4 +103,25 @@ public final class LayoutUtils { window.doPopup(); Clients.response("_openPopupWindow_", new AuScript(window, script.toString())); } + + /** + * open popup window relative to the ref component + * @param ref + * @param window + * @param position + */ + public static void openOverlappedWindow(Component ref, Window window, String position) { + if (window.getPage() == null) + window.setPage(ref.getPage()); + StringBuilder script = new StringBuilder(); + script.append("_idempiere_popup_window('#") + .append(ref.getUuid()) + .append("','#") + .append(window.getUuid()) + .append("','") + .append(position) + .append("');"); + window.doOverlapped(); + Clients.response("_openPopupWindow_", new AuScript(window, script.toString())); + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WRequest.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WRequest.java index 84cfa27bf6..1800482da7 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WRequest.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/WRequest.java @@ -18,8 +18,8 @@ import java.sql.PreparedStatement; import java.sql.ResultSet; import java.util.logging.Level; +import org.adempiere.webui.adwindow.ADWindow; import org.adempiere.webui.session.SessionManager; -import org.adempiere.webui.window.ADWindow; import org.compiere.model.GridTab; import org.compiere.model.MAsset; import org.compiere.model.MBPartner; @@ -212,7 +212,7 @@ public class WRequest implements EventListener // New - set Table/Record if (e.getTarget() == m_new) { - GridTab tab = frame.getADWindowPanel().getActiveGridTab(); + GridTab tab = frame.getADWindowContent().getActiveGridTab(); tab.dataNew (false); tab.setValue("AD_Table_ID", new Integer(m_AD_Table_ID)); tab.setValue("Record_ID", new Integer(m_Record_ID)); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADSortTab.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java similarity index 94% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADSortTab.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java index 3173bcdbd7..6701dcc330 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADSortTab.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADSortTab.java @@ -14,7 +14,7 @@ * ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA * * or via info@compiere.org or http://www.compiere.org/license.html * *****************************************************************************/ -package org.adempiere.webui.panel; +package org.adempiere.webui.adwindow; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -100,7 +100,7 @@ public class ADSortTab extends Panel implements IADTabpanel private boolean m_IdentifierTranslated = false; private String m_ParentColumnName = null; - private AbstractADWindowPanel adWindowPanel = null; + private AbstractADWindowContent adWindowPanel = null; // UI variables private Label noLabel = new Label(); @@ -136,6 +136,8 @@ public class ADSortTab extends Panel implements IADTabpanel private GridTab gridTab; private boolean uiCreated; + private boolean active = false; + private boolean isChanged; /** * Dynamic Init @@ -492,12 +494,17 @@ public class ADSortTab extends Panel implements IADTabpanel * @param value */ private void setIsChanged(boolean value) { + isChanged = value; if (adWindowPanel != null) { adWindowPanel.getToolbar().enableSave(value); adWindowPanel.getToolbar().enableIgnore(value); } } + public boolean isChanged() { + return isChanged; + } + /** * @param event */ @@ -612,7 +619,7 @@ public class ADSortTab extends Panel implements IADTabpanel /* (non-Javadoc) * @see org.compiere.grid.APanelTab#registerAPanel(APanel) */ - public void registerAPanel (AbstractADWindowPanel panel) + public void registerAPanel (AbstractADWindowContent panel) { adWindowPanel = panel; } // registerAPanel @@ -834,6 +841,7 @@ public class ADSortTab extends Panel implements IADTabpanel } public void activate(boolean b) { + active = b; if (b && !uiCreated) createUI(); } @@ -902,5 +910,19 @@ public class ADSortTab extends Panel implements IADTabpanel public boolean onEnterKey() { return false; } + + @Override + public boolean isGridView() { + return false; + } + + @Override + public boolean isActive() { + return active; + } + + @Override + public void setDetailPaneMode(boolean detailMode, boolean vflex) { + } } //ADSortTab diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java similarity index 90% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java index 0bb4fe591a..40ace05ad2 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java @@ -15,7 +15,7 @@ * or via info@posterita.org or http://www.posterita.org/ * *****************************************************************************/ -package org.adempiere.webui.panel; +package org.adempiere.webui.adwindow; import java.util.ArrayList; import java.util.HashMap; @@ -31,7 +31,6 @@ import org.adempiere.webui.component.Column; import org.adempiere.webui.component.Columns; import org.adempiere.webui.component.EditorBox; import org.adempiere.webui.component.Grid; -import org.adempiere.webui.component.GridPanel; import org.adempiere.webui.component.Group; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.NumberBox; @@ -72,10 +71,10 @@ import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Center; import org.zkoss.zul.DefaultTreeNode; import org.zkoss.zul.Div; -import org.zkoss.zul.Groupfoot; import org.zkoss.zul.Separator; import org.zkoss.zul.Space; import org.zkoss.zul.Treeitem; +import org.zkoss.zul.Vlayout; import org.zkoss.zul.West; import org.zkoss.zul.impl.XulElement; @@ -114,11 +113,11 @@ DataStatusListener, IADTabpanel @SuppressWarnings("unused") private GridWindow gridWindow; - private AbstractADWindowPanel windowPanel; + private AbstractADWindowContent windowPanel; private int windowNo; - private Grid grid; + private Grid form; private ArrayList editors = new ArrayList(); @@ -126,7 +125,7 @@ DataStatusListener, IADTabpanel private boolean uiCreated = false; - private GridPanel listPanel; + private GridView listPanel; private Map> fieldGroupContents = new HashMap>(); @@ -136,19 +135,18 @@ DataStatusListener, IADTabpanel List allCollapsibleGroups = new ArrayList(); - private Component formComponent = null; + private Component formContainer = null; private ADTreePanel treePanel = null; private GridTabDataBinder dataBinder; - private Map includedTab = new HashMap(); - private Map includedTabFooter = new HashMap(); - private boolean active = false; private Group currentGroup; + private Component detailPane; + public ADTabpanel() { init(); @@ -164,16 +162,47 @@ DataStatusListener, IADTabpanel { LayoutUtils.addSclass("adtab-content", this); - grid = new Grid(); - //have problem moving the following out as css class - grid.setHflex("1"); - grid.setHeight("100%"); - grid.setVflex(true); - grid.setSclass("grid-layout"); + this.setWidth("100%"); + + form = new Grid(); + form.setHflex("1"); + form.setHeight(null); + form.setVflex(false); + form.setSclass("grid-layout"); + form.addEventListener(Events.ON_FOCUS, this); - listPanel = new GridPanel(); + listPanel = new GridView(); listPanel.getListbox().addEventListener(Events.ON_DOUBLE_CLICK, this); } + + public void addDetails(Component component) { + if (formContainer.isVisible()) { + detailPane = component; + if (formContainer instanceof Borderlayout) { + form.getParent().appendChild(detailPane); + } else { + formContainer.appendChild(component); + } + } else { + listPanel.addDetails(component); + } + } + + public Component removeDetails() { + Component details = null; + if (listPanel.isVisible()) { + details = listPanel.removeDetails(); + } else { + if (detailPane != null) { + if (detailPane.getParent() != null) { + details = detailPane; + detailPane.detach(); + } + detailPane = null; + } + } + return details; + } /** * @@ -182,7 +211,7 @@ DataStatusListener, IADTabpanel * @param gridTab * @param gridWindow */ - public void init(AbstractADWindowPanel winPanel, int windowNo, GridTab gridTab, + public void init(AbstractADWindowContent winPanel, int windowNo, GridTab gridTab, GridWindow gridWindow) { this.windowNo = windowNo; @@ -214,12 +243,15 @@ DataStatusListener, IADTabpanel layout.appendChild(west); Center center = new Center(); - center.setFlex(true); - center.appendChild(grid); - center.setSclass("adtab-form"); + Vlayout div = new Vlayout(); + div.appendChild(form); + center.appendChild(div); + div.setVflex("1"); + div.setHflex("1"); + div.setSclass("adtab-form"); layout.appendChild(center); - formComponent = layout; + formContainer = layout; treePanel.getTree().addEventListener(Events.ON_SELECT, this); if (AEnv.isTablet()) @@ -230,16 +262,18 @@ DataStatusListener, IADTabpanel } else { - Div div = new Div(); + Vlayout div = new Vlayout(); div.setSclass("adtab-form"); - div.appendChild(grid); + div.appendChild(form); + div.setVflex("1"); + div.setWidth("100%"); this.appendChild(div); - formComponent = div; + formContainer = div; if (AEnv.isTablet()) { LayoutUtils.addSclass("tablet-scrolling", div); - } + } } this.appendChild(listPanel); listPanel.setVisible(false); @@ -264,7 +298,7 @@ DataStatusListener, IADTabpanel // set size in percentage per column leaving a MARGIN on right Columns columns = new Columns(); - grid.appendChild(columns); + form.appendChild(columns); String numColsS=String.valueOf(numCols); int equalWidth = 98 / numCols; @@ -274,7 +308,7 @@ DataStatusListener, IADTabpanel columns.appendChild(col); } - Rows rows = grid.newRows(); + Rows rows = form.newRows(); GridField fields[] = gridTab.getFields(); Row row = new Row(); int actualxpos = 0; @@ -286,55 +320,6 @@ DataStatusListener, IADTabpanel if (!field.isDisplayed()) continue; - //included tab - if (field.getIncluded_Tab_ID() > 0) - { - // NOT CHANGING INCLUDED TAB AS THIS IS BEING REDESIGNED WITH - // IDEMPIERE-369 Master Detail layout improvements - if (row.getChildren().size() == 2) - { - row.appendChild(createSpacer()); - row.appendChild(createSpacer()); - row.appendChild(createSpacer()); - rows.appendChild(row); - if (rowList != null) - rowList.add(row); - } else if (row.getChildren().size() > 0) - { - rows.appendChild(row); - if (rowList != null) - rowList.add(row); - } - - //end current field group - if (currentGroup != null) { - Groupfoot rowg = new Groupfoot(); - rows.appendChild(rowg); - currentGroup = null; - currentFieldGroup = null; - } - - row = new Row(); - row.setSpans("5"); - row.appendChild(new Separator()); - rows.appendChild(row); - - Group rowg = new Group(); - rowg.setSpans("2,3"); - rows.appendChild(rowg); - includedTab.put(field.getIncluded_Tab_ID(), (Group)rowg); - Groupfoot rowgf = new Groupfoot(); - rows.appendChild(rowgf); - includedTabFooter.put(field.getIncluded_Tab_ID(), (Groupfoot)rowgf); - - row = new Row(); - row.setSpans("5"); - row.appendChild(new Separator()); - rows.appendChild(row); - - row = new Row(); - continue; - } // field group String fieldGroup = field.getFieldGroup(); if (!Util.isEmpty(fieldGroup) && !fieldGroup.equals(currentFieldGroup)) // group changed @@ -569,7 +554,7 @@ DataStatusListener, IADTabpanel } // all components //hide row if all editor within the row is invisible - List rows = grid.getRows().getChildren(); + List rows = form.getRows().getChildren(); for (Component comp : rows) { if (comp instanceof Row) { @@ -743,7 +728,7 @@ DataStatusListener, IADTabpanel listPanel.deactivate(); } else { if (activate) { - formComponent.setVisible(activate); + formContainer.setVisible(activate); setFocusToField(); } } @@ -751,6 +736,9 @@ DataStatusListener, IADTabpanel if (gridTab.getRecord_ID() > 0 && gridTab.isTreeTab() && treePanel != null) { setSelectedNode(gridTab.getRecord_ID()); } + + Event event = new Event("onActivate", this, activate); + Events.sendEvent(event); } /** @@ -790,11 +778,7 @@ DataStatusListener, IADTabpanel { if (event.getTarget() == listPanel.getListbox()) { - if (windowPanel != null) { - windowPanel.onToggle(); - } else { - this.switchRowPresentation(); - } + Events.sendEvent(this, new Event("onToggle", this)); } else if (event.getTarget() == treePanel.getTree()) { Treeitem item = treePanel.getTree().getSelectedItem(); @@ -804,6 +788,8 @@ DataStatusListener, IADTabpanel if (gridTab.getRecord_ID() > 0 && gridTab.isTreeTab() && treePanel != null) { setSelectedNode(gridTab.getRecord_ID()); } + } else { + System.out.println(event.getName() + " " + event.getTarget()); } } @@ -979,19 +965,25 @@ DataStatusListener, IADTabpanel * Toggle between form and grid view */ public void switchRowPresentation() { - if (formComponent.isVisible()) { - formComponent.setVisible(false); + Component details = removeDetails(); + if (formContainer.isVisible()) { + formContainer.setVisible(false); } else { - formComponent.setVisible(true); - formComponent.getParent().invalidate(); + formContainer.setVisible(true); + formContainer.getParent().invalidate(); } - listPanel.setVisible(!formComponent.isVisible()); + listPanel.setVisible(!formContainer.isVisible()); if (listPanel.isVisible()) { listPanel.refresh(gridTab); listPanel.scrollToCurrentRow(); } else { listPanel.deactivate(); } + + if (details != null) + addDetails(details); + + Events.sendEvent(this, new Event("onSwitchView", this)); } class ZoomListener implements EventListener { @@ -1019,14 +1011,14 @@ DataStatusListener, IADTabpanel @Override public void focus() { - if (formComponent.isVisible()) + if (formContainer.isVisible()) this.setFocusToField(); else listPanel.focus(); } public void setFocusToField(String columnName) { - if (formComponent.isVisible()) { + if (formContainer.isVisible()) { boolean found = false; for (WEditor editor : editors) { if (found) @@ -1063,8 +1055,23 @@ DataStatusListener, IADTabpanel * * @return GridPanel */ - public GridPanel getGridView() { + public GridView getGridView() { return listPanel; } + + public boolean isActive() { + return active; + } + + @Override + public void setDetailPaneMode(boolean detailPaneMode, boolean vflex) { + if (detailPaneMode) { + detailPane = null; + this.setVflex("true"); + } else { + this.setVflex(Boolean.toString(vflex)); + } + listPanel.setDetailPaneMode(detailPaneMode, vflex); + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTreePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTreePanel.java similarity index 98% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTreePanel.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTreePanel.java index cfc44e64d5..fb71ce0c9e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTreePanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTreePanel.java @@ -11,11 +11,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * *****************************************************************************/ -package org.adempiere.webui.panel; +package org.adempiere.webui.adwindow; import org.adempiere.webui.component.SimpleTreeModel; import org.adempiere.webui.component.ToolBarButton; +import org.adempiere.webui.panel.TreeSearchPanel; import org.adempiere.webui.util.TreeUtils; import org.compiere.util.Env; import org.compiere.util.Msg; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ADWindow.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindow.java similarity index 86% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ADWindow.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindow.java index ac5de152fa..4b706350c4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/window/ADWindow.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindow.java @@ -15,12 +15,11 @@ * or via info@posterita.org or http://www.posterita.org/ * *****************************************************************************/ -package org.adempiere.webui.window; +package org.adempiere.webui.adwindow; import java.util.Properties; import org.adempiere.webui.desktop.IDesktop; -import org.adempiere.webui.panel.ADWindowPanel; import org.adempiere.webui.part.AbstractUIPart; import org.adempiere.webui.session.SessionManager; import org.compiere.model.MQuery; @@ -34,7 +33,7 @@ import org.zkoss.zk.ui.Component; */ public class ADWindow extends AbstractUIPart { - private ADWindowPanel windowPanel; + private ADWindowContent windowContent; private Properties ctx; private int adWindowId; private String _title; @@ -63,7 +62,7 @@ public class ADWindow extends AbstractUIPart private void init() { - windowPanel = new ADWindowPanel(ctx, windowNo); + windowContent = new ADWindowContent(ctx, windowNo); } public String getTitle() @@ -73,12 +72,12 @@ public class ADWindow extends AbstractUIPart protected Component doCreatePart(Component parent) { - windowPanelComponent = windowPanel.createPart(parent); + windowPanelComponent = windowContent.createPart(parent); windowPanelComponent.setAttribute("ADWindow", this); windowPanelComponent.setAttribute(IDesktop.WINDOWNO_ATTRIBUTE, windowNo); - if (windowPanel.initPanel(adWindowId, query)) + if (windowContent.initPanel(adWindowId, query)) { - _title = windowPanel.getTitle(); + _title = windowContent.getTitle(); return windowPanelComponent; } else @@ -93,9 +92,9 @@ public class ADWindow extends AbstractUIPart } /** - * @return ADWindowPanel + * @return ADWindowContent */ - public ADWindowPanel getADWindowPanel() { - return windowPanel; + public ADWindowContent getADWindowContent() { + return windowContent; } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java similarity index 74% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java index 14b05a7882..e27bb185c5 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowContent.java @@ -21,17 +21,16 @@ * - Idalica Corporation * *****************************************************************************/ -package org.adempiere.webui.panel; +package org.adempiere.webui.adwindow; import java.util.List; import java.util.Properties; import org.adempiere.webui.LayoutUtils; -import org.adempiere.webui.component.CompositeADTab; -import org.adempiere.webui.component.IADTab; import org.adempiere.webui.component.Tabbox; import org.adempiere.webui.component.Tabpanel; import org.adempiere.webui.component.Tabs; +import org.adempiere.webui.panel.ITabOnCloseHandler; import org.adempiere.webui.part.ITabOnSelectHandler; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.util.UserPreference; @@ -48,6 +47,7 @@ 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.East; import org.zkoss.zul.North; import org.zkoss.zul.South; @@ -64,10 +64,10 @@ import org.zkoss.zul.West; * @date Feb 25, 2007 * @version $Revision: 0.10 $ */ -public class ADWindowPanel extends AbstractADWindowPanel +public class ADWindowContent extends AbstractADWindowContent { @SuppressWarnings("unused") - private static final CLogger logger = CLogger.getCLogger(ADWindowPanel.class); + private static final CLogger logger = CLogger.getCLogger(ADWindowContent.class); private Borderlayout layout; @@ -77,15 +77,14 @@ public class ADWindowPanel extends AbstractADWindowPanel private East east; - private Keylistener keyListener; + private Keylistener keyListener; - public ADWindowPanel(Properties ctx, int windowNo) + public ADWindowContent(Properties ctx, int windowNo) { super(ctx, windowNo); } - - protected Component doCreatePart(Component parent) + protected Component doCreatePart(Component parent) { layout = new Borderlayout(); if (parent != null) { @@ -100,8 +99,16 @@ public class ADWindowPanel extends AbstractADWindowPanel n.setParent(layout); n.setCollapsible(false); n.setSclass("adwindow-north"); - toolbar.setParent(n); + Div div = new Div(); + div.setHflex("1"); + div.setVflex("1"); + n.appendChild(div); + toolbar.setParent(div); toolbar.setWindowNo(getWindowNo()); + breadCrumb = new BreadCrumb(getWindowNo()); + breadCrumb.setStyle("background-color: #e9e9e9"); + breadCrumb.setToolbarListener(this); + div.appendChild(breadCrumb); //status bar South s = new South(); @@ -112,50 +119,9 @@ public class ADWindowPanel extends AbstractADWindowPanel LayoutUtils.addSclass("adwindow-status", statusBar); - if (adTab.isUseExternalSelection()) - { - String tabPlacement = SessionManager.getSessionApplication().getUserPreference().getProperty(UserPreference.P_WINDOW_TAB_PLACEMENT); - if (tabPlacement == null || "left".equalsIgnoreCase(tabPlacement)) - { - west = new West(); - layout.appendChild(west); - west.setSplittable(false); - west.setAutoscroll(true); - west.setFlex(true); - LayoutUtils.addSclass("adwindow-nav adwindow-left-nav", west); - adTab.setTabplacement(IADTab.LEFT); - adTab.getTabSelectionComponent().setParent(west); - - if (SessionManager.getSessionApplication().getUserPreference().isPropertyBool(UserPreference.P_WINDOW_TAB_COLLAPSIBLE)) - { - west.setTitle(Msg.getElement(Env.getCtx(), "AD_Tab_ID")); - west.setCollapsible(true); - } - } - else - { - east = new East(); - layout.appendChild(east); - east.setSplittable(false); - east.setAutoscroll(true); - east.setFlex(true); - LayoutUtils.addSclass("adwindow-nav adwindow-right-nav", east); - adTab.setTabplacement(IADTab.RIGHT); - adTab.getTabSelectionComponent().setParent(east); - - if (SessionManager.getSessionApplication().getUserPreference().isPropertyBool(UserPreference.P_WINDOW_TAB_COLLAPSIBLE)) - { - east.setTitle(Msg.getElement(Env.getCtx(), "AD_Tab_ID")); - east.setCollapsible(true); - } - } - LayoutUtils.addSclass("adwindow-nav-content", (HtmlBasedComponent) adTab.getTabSelectionComponent()); - } - contentArea = new Center(); contentArea.setParent(layout); contentArea.setAutoscroll(true); - contentArea.setFlex(true); adTab.createPart(contentArea); if (parent instanceof Tabpanel) { @@ -174,7 +140,7 @@ public class ADWindowPanel extends AbstractADWindowPanel layout.setAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY, new ITabOnSelectHandler() { public void onSelect() { - IADTab adTab = getADTab(); + IADTabbox adTab = getADTab(); if (adTab != null) { IADTabpanel iadTabpanel = adTab.getSelectedTabpanel(); if (iadTabpanel != null && iadTabpanel instanceof ADTabpanel) { @@ -191,9 +157,9 @@ public class ADWindowPanel extends AbstractADWindowPanel return layout; } - protected IADTab createADTab() + protected IADTabbox createADTab() { - CompositeADTab composite = new CompositeADTab(); + CompositeADTabbox composite = new CompositeADTabbox(); return composite; } @@ -240,7 +206,7 @@ public class ADWindowPanel extends AbstractADWindowPanel class TabOnCloseHanlder implements ITabOnCloseHandler { public void onClose(Tabpanel tabPanel) { - if (ADWindowPanel.this.onExit()) { + if (ADWindowContent.this.onExit()) { Tab tab = tabPanel.getLinkedTab(); Tabbox tabbox = (Tabbox) tab.getTabbox(); if (tabbox.getSelectedTab() == tab) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java similarity index 92% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java index 14bd500e44..7d1a47ca06 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADWindowToolbar.java @@ -15,7 +15,7 @@ * or via info@posterita.org or http://www.posterita.org/ * *****************************************************************************/ -package org.adempiere.webui.component; +package org.adempiere.webui.adwindow; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; @@ -28,6 +28,8 @@ import java.util.logging.Level; import org.adempiere.webui.AdempiereIdGenerator; import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.component.FToolbar; +import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.event.ToolbarListener; import org.adempiere.webui.session.SessionManager; import org.compiere.model.MRole; @@ -52,7 +54,7 @@ import org.zkoss.zul.Space; * @author Cristina Ghita, www.arhipac.ro *
  • FR [ 2076330 ] Add new methods in CWindowToolbar class */ -public class CWindowToolbar extends FToolbar implements EventListener +public class ADWindowToolbar extends FToolbar implements EventListener { /** * @@ -61,7 +63,7 @@ public class CWindowToolbar extends FToolbar implements EventListener private static final String BTNPREFIX = "Btn"; - private static CLogger log = CLogger.getCLogger(CWindowToolbar.class); + private static CLogger log = CLogger.getCLogger(ADWindowToolbar.class); private ToolBarButton btnIgnore; @@ -75,8 +77,6 @@ public class CWindowToolbar extends FToolbar implements EventListener private ToolBarButton btnParentRecord, btnDetailRecord; - private ToolBarButton btnFirst, btnPrevious, btnNext, btnLast; - private ToolBarButton btnReport, btnArchive, btnPrint; private ToolBarButton btnZoomAcross, btnActiveWorkflows, btnRequests, btnProductInfo; @@ -114,12 +114,12 @@ public class CWindowToolbar extends FToolbar implements EventListener // public int lastModifiers; // - public CWindowToolbar() + public ADWindowToolbar() { this(0); } - public CWindowToolbar(int windowNo) { + public ADWindowToolbar(int windowNo) { setWindowNo(windowNo); init(); } @@ -145,11 +145,7 @@ public class CWindowToolbar extends FToolbar implements EventListener btnGridToggle = createButton("Toggle", "Multi", "Multi"); addSeparator(); btnParentRecord = createButton("ParentRecord", "Parent", "Parent"); - btnDetailRecord = createButton("DetailRecord", "Detail", "Detail"); - btnFirst = createButton("First", "First", "First"); - btnPrevious = createButton("Previous", "Previous", "Previous"); - btnNext = createButton("Next", "Next", "Next"); - btnLast = createButton("Last", "Last", "Last"); + btnDetailRecord = createButton("DetailRecord", "Detail", "Detail"); addSeparator(); btnReport = createButton("Report", "Report", "Report"); btnArchive = createButton("Archive", "Archive", "Archive"); @@ -259,11 +255,7 @@ public class CWindowToolbar extends FToolbar implements EventListener keyMap.put(KeyEvent.F12, btnPrint); altKeyMap.put(KeyEvent.LEFT, btnParentRecord); - altKeyMap.put(KeyEvent.RIGHT, btnDetailRecord); - altKeyMap.put(KeyEvent.UP, btnPrevious); - altKeyMap.put(KeyEvent.DOWN, btnNext); - altKeyMap.put(KeyEvent.PAGE_UP, btnFirst); - altKeyMap.put(KeyEvent.PAGE_DOWN, btnLast); + altKeyMap.put(KeyEvent.RIGHT, btnDetailRecord); altKeyMap.put(VK_P, btnReport); altKeyMap.put(VK_Z, btnIgnore); @@ -363,15 +355,7 @@ public class CWindowToolbar extends FToolbar implements EventListener } this.event = null; } - - public void enableNavigation(boolean enabled) - { - this.btnFirst.setDisabled(!enabled); - this.btnPrevious.setDisabled(!enabled); - this.btnNext.setDisabled(!enabled); - this.btnLast.setDisabled(!enabled); - } - + public void enableTabNavigation(boolean enabled) { enableTabNavigation(enabled, enabled); @@ -383,18 +367,6 @@ public class CWindowToolbar extends FToolbar implements EventListener this.btnDetailRecord.setDisabled(!enableDetail); } - public void enableFirstNavigation(boolean enabled) - { - this.btnFirst.setDisabled(!enabled); - this.btnPrevious.setDisabled(!enabled); - } - - public void enableLastNavigation(boolean enabled) - { - this.btnLast.setDisabled(!enabled); - this.btnNext.setDisabled(!enabled); - } - public void enableRefresh(boolean enabled) { this.btnRefresh.setDisabled(!enabled); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADTabbox.java similarity index 95% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADTabbox.java index 31e9727607..904b082f9a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADTabbox.java @@ -15,16 +15,13 @@ * or via info@posterita.org or http://www.posterita.org/ * *****************************************************************************/ -package org.adempiere.webui.component; +package org.adempiere.webui.adwindow; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.adempiere.webui.panel.ADTabpanel; -import org.adempiere.webui.panel.AbstractADWindowPanel; import org.adempiere.webui.panel.CustomizeGridViewPanel; -import org.adempiere.webui.panel.IADTabpanel; import org.adempiere.webui.part.AbstractUIPart; import org.compiere.model.DataStatusEvent; import org.compiere.model.GridField; @@ -40,18 +37,18 @@ import org.compiere.util.Evaluator; * @date Feb 25, 2007 * @version $Revision: 0.10 $ */ -public abstract class AbstractADTab extends AbstractUIPart implements IADTab +public abstract class AbstractADTabbox extends AbstractUIPart implements IADTabbox { /** Logger */ - private static CLogger log = CLogger.getCLogger (AbstractADTab.class); + private static CLogger log = CLogger.getCLogger (AbstractADTabbox.class); /** List of dependent Variables */ private ArrayList m_dependents = new ArrayList(); /** Tabs associated to this tab box */ protected List tabPanelList = new ArrayList(); - protected AbstractADWindowPanel adWindowPanel; + protected AbstractADWindowContent adWindowPanel; - public AbstractADTab() + public AbstractADTabbox() { } @@ -327,7 +324,7 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab updateSelectedIndex(oldIndex, newIndex); } - public void setADWindowPanel(AbstractADWindowPanel abstractADWindowPanel) { + public void setADWindowPanel(AbstractADWindowContent abstractADWindowPanel) { this.adWindowPanel = abstractADWindowPanel; } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java similarity index 71% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java index a5d7d12311..be787cf261 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/AbstractADWindowContent.java @@ -15,7 +15,7 @@ * or via info@posterita.org or http://www.posterita.org/ * *****************************************************************************/ -package org.adempiere.webui.panel; +package org.adempiere.webui.adwindow; import static org.compiere.model.SystemIDs.PROCESS_AD_CHANGELOG_REDO; import static org.compiere.model.SystemIDs.PROCESS_AD_CHANGELOG_UNDO; @@ -44,10 +44,8 @@ import org.adempiere.webui.apps.ProcessModalDialog; import org.adempiere.webui.apps.form.WCreateFromFactory; import org.adempiere.webui.apps.form.WCreateFromWindow; import org.adempiere.webui.apps.form.WPayment; -import org.adempiere.webui.component.CWindowToolbar; -import org.adempiere.webui.component.IADTab; -import org.adempiere.webui.component.IADTabList; import org.adempiere.webui.component.Listbox; +import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.Window; import org.adempiere.webui.editor.WButtonEditor; import org.adempiere.webui.event.ActionEvent; @@ -55,6 +53,10 @@ import org.adempiere.webui.event.ActionListener; import org.adempiere.webui.event.DialogEvents; import org.adempiere.webui.event.ToolbarListener; import org.adempiere.webui.exception.ApplicationException; +import org.adempiere.webui.panel.ADForm; +import org.adempiere.webui.panel.InfoPanel; +import org.adempiere.webui.panel.WAttachment; +import org.adempiere.webui.panel.WDocActionPanel; import org.adempiere.webui.panel.action.ExportAction; import org.adempiere.webui.panel.action.ReportAction; import org.adempiere.webui.part.AbstractUIPart; @@ -126,35 +128,31 @@ import org.zkoss.zul.Menupopup; *
  • BF [ 2985892 ] Opening a window using a new record query is not working * https://sourceforge.net/tracker/?func=detail&aid=2985892&group_id=176962&atid=955896 */ -public abstract class AbstractADWindowPanel extends AbstractUIPart implements ToolbarListener, +public abstract class AbstractADWindowContent extends AbstractUIPart implements ToolbarListener, EventListener, DataStatusListener, ActionListener { private static final CLogger logger; static { - logger = CLogger.getCLogger(AbstractADWindowPanel.class); + logger = CLogger.getCLogger(AbstractADWindowContent.class); } private Properties ctx; private GridWindow gridWindow; - protected StatusBarPanel statusBar; + protected StatusBar statusBar; - protected IADTab adTab; + protected IADTabbox adTab; private int curWindowNo; - private GridTab curTab; +// private GridTab curTab; private boolean m_onlyCurrentRows = true; - private IADTabpanel curTabpanel; - - protected CWindowToolbar toolbar; - - private int curTabIndex; + protected ADWindowToolbar toolbar; protected String title; @@ -172,12 +170,14 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private boolean m_queryInitiating; + protected BreadCrumb breadCrumb; + /** * Constructor * @param ctx * @param windowNo */ - public AbstractADWindowPanel(Properties ctx, int windowNo) + public AbstractADWindowContent(Properties ctx, int windowNo) { this.ctx = ctx; this.curWindowNo = windowNo; @@ -195,16 +195,21 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To this.parent = (Component) parent; adTab = createADTab(); - adTab.addSelectionEventListener(this); + adTab.setSelectionEventListener(this); adTab.setADWindowPanel(this); return super.createPart(parent); } + public BreadCrumb getBreadCrumb() + { + return breadCrumb; + } + /** * @return StatusBarPanel */ - public StatusBarPanel getStatusBar() + public StatusBar getStatusBar() { return statusBar; } @@ -212,24 +217,28 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private void initComponents() { /** Initalise toolbar */ - toolbar = new CWindowToolbar(getWindowNo()); + toolbar = new ADWindowToolbar(getWindowNo()); toolbar.addListener(this); - statusBar = new StatusBarPanel(); + statusBar = new StatusBar(); } /** * @return IADTab */ - protected abstract IADTab createADTab(); + protected abstract IADTabbox createADTab(); private void focusToActivePanel() { IADTabpanel adTabPanel = adTab.getSelectedTabpanel(); + focusToTabpanel(adTabPanel); + } + + private void focusToTabpanel(IADTabpanel adTabPanel ) { if (adTabPanel != null && adTabPanel instanceof HtmlBasedComponent) { ((HtmlBasedComponent)adTabPanel).focus(); } } - + /** * @param adWindowId * @param query @@ -300,18 +309,17 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To int tabSize = gridWindow.getTabCount(); + GridTab gridTab = null; for (int tab = 0; tab < tabSize; tab++) { - initTab(query, tab); - if (tab == 0 && curTab == null && m_findCancelled) + gridTab = initTab(query, tab); + if (tab == 0 && gridTab == null && m_findCancelled) return false; } Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName()); - if (curTab != null) - curTab.getTableModel().setChanged(false); - - curTabIndex = 0; + if (gridTab != null) + gridTab.getTableModel().setChanged(false); adTab.setSelectedIndex(0); // all fields context for window is clear at AbstractADTab.prepareContext, set IsSOTrx for window @@ -441,6 +449,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To } private void initQueryOnNew(MQuery result) { + GridTab curTab = adTab.getSelectedGridTab(); if (curTab.isHighVolume() && m_findCreateNew) onNew(); else if (result == null && curTab.getRowCount() == 0 && Env.isAutoNew(ctx, curWindowNo)) @@ -453,7 +462,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To * @param query * @param tabIndex */ - protected void initTab(MQuery query, int tabIndex) { + protected GridTab initTab(MQuery query, int tabIndex) { gridWindow.initTab(tabIndex); final GridTab gTab = gridWindow.getTab(tabIndex); @@ -484,7 +493,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To gTab.setQuery(result); } - if (curTabpanel != null) + if (adTab.getSelectedTabpanel() != null) { initFirstTabpanel(); @@ -494,8 +503,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To }); - curTab = gTab; - curTabIndex = tabIndex; +// curTab = gTab; } if (gTab.isSortTab()) @@ -504,8 +512,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To adTab.addTab(gTab, sortTab); sortTab.registerAPanel(this); if (tabIndex == 0) { - curTabpanel = sortTab; - curTabpanel.createUI(); + sortTab.createUI(); if (!m_queryInitiating) { initFirstTabpanel(); @@ -521,7 +528,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To adTab.addTab(gTab, fTabPanel); if (tabIndex == 0) { fTabPanel.createUI(); - curTabpanel = fTabPanel; if (!m_queryInitiating) { initFirstTabpanel(); @@ -533,11 +539,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To initQueryOnNew(query); } } + + return gTab; } private void initFirstTabpanel() { - curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); - curTabpanel.activate(true); + adTab.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); + adTab.getSelectedTabpanel().activate(true); } /** @@ -649,6 +657,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onDetailRecord() { + /* int maxInd = adTab.getTabCount() - 1; int curInd = adTab.getSelectedIndex(); if (curInd < maxInd) @@ -660,7 +669,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To focusToActivePanel(); } }); - } + }*/ + adTab.onDetailRecord(); } /** @@ -668,16 +678,17 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onParentRecord() { - int curInd = adTab.getSelectedIndex(); - if (curInd > 0) - { - setActiveTab(curInd - 1, new Callback() { - @Override - public void onCallback(Boolean result) { - focusToActivePanel(); - } - }); - } +// int curInd = adTab.getSelectedIndex(); +// if (curInd > 0) +// { +// setActiveTab(curInd - 1, new Callback() { +// @Override +// public void onCallback(Boolean result) { +// focusToActivePanel(); +// } +// }); +// } + adTab.onParentRecord(); } /** @@ -689,7 +700,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To @Override public void onCallback(Boolean result) { if (result) { - curTab.navigate(0); + adTab.getSelectedGridTab().navigate(0); focusToActivePanel(); } } @@ -706,7 +717,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To @Override public void onCallback(Boolean result) { if (result) { - curTab.navigate(curTab.getRowCount() - 1); + adTab.getSelectedGridTab().navigate(adTab.getSelectedGridTab().getRowCount() - 1); focusToActivePanel(); } } @@ -723,7 +734,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To @Override public void onCallback(Boolean result) { if (result) { - curTab.navigateRelative(+1); + adTab.getSelectedGridTab().navigateRelative(+1); focusToActivePanel(); } } @@ -740,7 +751,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To @Override public void onCallback(Boolean result) { if (result) { - curTab.navigateRelative(-1); + adTab.getSelectedGridTab().navigateRelative(-1); focusToActivePanel(); } } @@ -762,7 +773,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To { if (!toolbar.isPersonalLock) return; - if (curTab.getRecord_ID() == -1) // No Key + if (adTab.getSelectedGridTab().getRecord_ID() == -1) // No Key return; if(m_popup == null) @@ -775,10 +786,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To { public void onEvent(Event event) throws Exception { - curTab.lock(Env.getCtx(), curTab.getRecord_ID(), !toolbar.getButton("Lock").isPressed()); - curTab.loadAttachments(); // reload + adTab.getSelectedGridTab().lock(Env.getCtx(), adTab.getSelectedGridTab().getRecord_ID(), !toolbar.getButton("Lock").isPressed()); + adTab.getSelectedGridTab().loadAttachments(); // reload - toolbar.lock(curTab.isLocked()); + toolbar.lock(adTab.getSelectedGridTab().isLocked()); } }); @@ -788,12 +799,12 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To { public void onEvent(Event event) throws Exception { - WRecordAccessDialog recordAccessDialog = new WRecordAccessDialog(null, curTab.getAD_Table_ID(), curTab.getRecord_ID()); + WRecordAccessDialog recordAccessDialog = new WRecordAccessDialog(null, adTab.getSelectedGridTab().getAD_Table_ID(), adTab.getSelectedGridTab().getRecord_ID()); recordAccessDialog.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { @Override public void onEvent(Event event) throws Exception { - toolbar.lock(curTab.isLocked()); + toolbar.lock(adTab.getSelectedGridTab().isLocked()); } }); @@ -813,7 +824,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onAttachment() { - int record_ID = curTab.getRecord_ID(); + int record_ID = adTab.getSelectedGridTab().getRecord_ID(); logger.info("Record_ID=" + record_ID); if (record_ID == -1) // No Key @@ -826,19 +837,19 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To @Override public void onEvent(Event event) throws Exception { - curTab.loadAttachments(); // reload - toolbar.getButton("Attachment").setPressed(curTab.hasAttachment()); + adTab.getSelectedGridTab().loadAttachments(); // reload + toolbar.getButton("Attachment").setPressed(adTab.getSelectedGridTab().hasAttachment()); focusToActivePanel(); } }; // Attachment va = - new WAttachment ( curWindowNo, curTab.getAD_AttachmentID(), - curTab.getAD_Table_ID(), record_ID, null, listener); + new WAttachment ( curWindowNo, adTab.getSelectedGridTab().getAD_AttachmentID(), + adTab.getSelectedGridTab().getAD_Table_ID(), record_ID, null, listener); } public void onChat() { - int recordId = curTab.getRecord_ID(); + int recordId = adTab.getSelectedGridTab().getRecord_ID(); logger.info("Record_ID=" + recordId); if (recordId== -1) // No Key @@ -849,9 +860,9 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To // Find display String infoName = null; String infoDisplay = null; - for (int i = 0; i < curTab.getFieldCount(); i++) + for (int i = 0; i < adTab.getSelectedGridTab().getFieldCount(); i++) { - GridField field = curTab.getField(i); + GridField field = adTab.getSelectedGridTab().getField(i); if (field.isKey()) infoName = field.getHeader(); if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo") ) @@ -862,12 +873,12 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To } String description = infoName + ": " + infoDisplay; - WChat chat = new WChat(curWindowNo, curTab.getCM_ChatID(), curTab.getAD_Table_ID(), recordId, description, null); + WChat chat = new WChat(curWindowNo, adTab.getSelectedGridTab().getCM_ChatID(), adTab.getSelectedGridTab().getAD_Table_ID(), recordId, description, null); chat.addEventListener(DialogEvents.ON_WINDOW_CLOSE, new EventListener() { @Override public void onEvent(Event event) throws Exception { - curTab.loadChats(); - toolbar.getButton("Chat").setPressed(curTab.hasChat()); + adTab.getSelectedGridTab().loadChats(); + toolbar.getButton("Chat").setPressed(adTab.getSelectedGridTab().hasChat()); focusToActivePanel(); } }); @@ -879,10 +890,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onToggle() { - curTabpanel.switchRowPresentation(); + adTab.getSelectedTabpanel().switchRowPresentation(); //Deepak-Enabling customize button IDEMPIERE-364 - if(!(curTabpanel instanceof ADSortTab)) - toolbar.enableCustomize(((ADTabpanel)curTabpanel).isGridView()); + if(!(adTab.getSelectedTabpanel() instanceof ADSortTab)) + toolbar.enableCustomize(((ADTabpanel)adTab.getSelectedTabpanel()).isGridView()); focusToActivePanel(); } @@ -907,34 +918,16 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onEvent(Event event) { - if (Events.ON_SELECT.equals(event.getName())) + if ("onSelectionChanged".equals(event.getName())) { - IADTabList tabList = null; - Component target = event.getTarget(); - if (target instanceof IADTabList) - { - tabList = (IADTabList) target; - } - else - { - target = target.getParent(); - while(target != null) - { - if (target instanceof IADTabList) - { - tabList = (IADTabList) target; - break; - } - target = target.getParent(); - } - } + Object eventData = event.getData(); - if (tabList != null) + if (eventData != null && eventData instanceof Object[] && ((Object[])eventData).length == 2) { - int newTabIndex = tabList.getSelectedIndex(); + Object[] indexes = (Object[]) eventData; + int newTabIndex = (Integer)indexes[1]; - final IADTabList tabListRef = tabList; - final int originalTabIndex = curTabIndex; + final int originalTabIndex = adTab.getSelectedIndex(); setActiveTab(newTabIndex, new Callback() { @Override @@ -942,12 +935,12 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To if (result) { //force sync model - tabListRef.refresh(); + adTab.refresh(); } else { //reset to original - tabListRef.setSelectedIndex(originalTabIndex); + adTab.setSelectedIndex(originalTabIndex); } } @@ -964,7 +957,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private void setActiveTab(final int newTabIndex, final Callback callback) { - final int oldTabIndex = curTabIndex; + final int oldTabIndex = adTab.getSelectedIndex(); if (oldTabIndex == newTabIndex) { @@ -989,23 +982,23 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To } - protected void saveAndNavigate(final Callback callback) { - if (curTab != null) + public void saveAndNavigate(final Callback callback) { + if (adTab != null) { - if (curTab.isSortTab()) + if (adTab.isSortTab()) { onSave(false, true, callback); } - else if (curTab.needSave(true, false)) + else if (adTab.needSave(true, false)) { - if (curTab.needSave(true, true)) + if (adTab.needSave(true, true)) { onSave(false, true, callback); } else { // new record, but nothing changed - curTab.dataIgnore(); + adTab.dataIgnore(); callback.onCallback(true); } } // there is a change @@ -1019,6 +1012,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private void setActiveTab0(int oldTabIndex, int newTabIndex, final Callback callback) { boolean back = false; + IADTabpanel oldTabpanel = adTab.getSelectedTabpanel(); + if (!adTab.updateSelectedIndex(oldTabIndex, newTabIndex)) { FDialog.warn(curWindowNo, "TabSwitchJumpGo", title); @@ -1026,13 +1021,14 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To callback.onCallback(false); } - IADTabpanel oldTabpanel = curTabpanel; + IADTabpanel newTabpanel = adTab.getSelectedTabpanel(); - curTab = newTabpanel.getGridTab(); + boolean activated = newTabpanel.isActive(); if (oldTabpanel != null) oldTabpanel.activate(false); - newTabpanel.activate(true); + if (activated) + newTabpanel.activate(true); back = (newTabIndex < oldTabIndex); if (back && newTabpanel.getTabLevel() > 0) @@ -1053,31 +1049,33 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To } } - if (!back) +// if (!activated) +// { + if (!back) + { + newTabpanel.query(); + } + else + { + newTabpanel.refresh(); + } +// } + + if (adTab.getSelectedTabpanel() instanceof ADSortTab) { - newTabpanel.query(); + ((ADSortTab)adTab.getSelectedTabpanel()).registerAPanel(this); } else { - newTabpanel.refresh(); - } - - curTabIndex = newTabIndex; - curTabpanel = newTabpanel; - - if (curTabpanel instanceof ADSortTab) - { - ((ADSortTab)curTabpanel).registerAPanel(this); - } - else - { - if (curTab.getRowCount() == 0 && Env.isAutoNew(ctx, getWindowNo())) + if (adTab.getSelectedGridTab().getRowCount() == 0 && Env.isAutoNew(ctx, getWindowNo())) { onNew(); } } updateToolbar(); + + breadCrumb.setNavigationToolbarVisibility(!adTab.getSelectedGridTab().isSortTab()); if (callback != null) callback.onCallback(true); @@ -1085,23 +1083,24 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private void updateToolbar() { - toolbar.enableTabNavigation(curTabIndex > 0, - curTabIndex < (adTab.getTabCount() - 1)); +// toolbar.enableTabNavigation(adTab.getSelectedGridTab()Index > 0, +// adTab.getSelectedGridTab()Index < (adTab.getTabCount() - 1)); + toolbar.enableTabNavigation(adTab.getTabCount() > 1, adTab.getTabCount() > 1); - toolbar.getButton("Attachment").setPressed(curTab.hasAttachment()); - toolbar.getButton("Chat").setPressed(curTab.hasChat()); - toolbar.getButton("Find").setPressed(curTab.isQueryActive()); + toolbar.getButton("Attachment").setPressed(adTab.getSelectedGridTab().hasAttachment()); + toolbar.getButton("Chat").setPressed(adTab.getSelectedGridTab().hasChat()); + toolbar.getButton("Find").setPressed(adTab.getSelectedGridTab().isQueryActive()); if (toolbar.isPersonalLock) { - toolbar.lock(curTab.isLocked()); + toolbar.lock(adTab.getSelectedGridTab().isLocked()); } - toolbar.enablePrint(curTab.isPrinted()); + toolbar.enablePrint(adTab.getSelectedGridTab().isPrinted()); //Deepak-Enabling customize button IDEMPIERE-364 - if(!(curTabpanel instanceof ADSortTab)) - toolbar.enableCustomize(((ADTabpanel)curTabpanel).isGridView()); + if(!(adTab.getSelectedTabpanel() instanceof ADSortTab)) + toolbar.enableCustomize(((ADTabpanel)adTab.getSelectedTabpanel()).isGridView()); else toolbar.enableCustomize(false); } @@ -1112,56 +1111,87 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void dataStatusChanged(DataStatusEvent e) { - //ignore non-ui thread event for now. + //ignore non-ui thread event. if (Executions.getCurrent() == null) return; + + boolean detailTab = false; + if (e.getSource() instanceof GridTable) + { + GridTable gridTable = (GridTable) e.getSource(); + if (adTab.getSelectedGridTab() != null && adTab.getSelectedGridTab().getTableModel() != gridTable) { + detailTab = true; + } + } else if (e.getSource() instanceof GridTab) + { + GridTab gridTab = (GridTab)e.getSource(); + if (adTab.getSelectedGridTab() != gridTab) detailTab = true; + } - logger.info(e.getMessage()); - String dbInfo = e.getMessage(); - if (curTab != null && curTab.isQueryActive()) - dbInfo = "[ " + dbInfo + " ]"; - statusBar.setStatusDB(dbInfo, e); + if (!detailTab) + { + logger.info(e.getMessage()); + String dbInfo = e.getMessage(); + if (adTab.getSelectedGridTab() != null && adTab.getSelectedGridTab().isQueryActive()) + dbInfo = "[ " + dbInfo + " ]"; + breadCrumb.setStatusDB(dbInfo, e); + } // Set Message / Info if (e.getAD_Message() != null || e.getInfo() != null) { - StringBuffer sb = new StringBuffer(); - String msg = e.getMessage(); - if (msg != null && msg.length() > 0) - { - sb.append(Msg.getMsg(Env.getCtx(), e.getAD_Message())); - } - String info = e.getInfo(); - if (info != null && info.length() > 0) - { - if (sb.length() > 0 && !sb.toString().trim().endsWith(":")) - sb.append(": "); - sb.append(info); - } - if (sb.length() > 0) - { - int pos = sb.indexOf("\n"); - if (pos != -1 && pos+1 < sb.length()) // replace CR/NL - { - sb.replace(pos, pos+1, " - "); - } - boolean showPopup = e.isError() - || (!GridTab.DEFAULT_STATUS_MESSAGE.equals(e.getAD_Message()) && !GridTable.DATA_REFRESH_MESSAGE.equals(e.getAD_Message())); - statusBar.setStatusLine (sb.toString (), e.isError (), showPopup); - } + if (GridTab.DEFAULT_STATUS_MESSAGE.equals(e.getAD_Message())) + { + if (detailTab) { + adTab.setDetailPaneStatusMessage("", false); + } else { + breadCrumb.setStatusLine ("", false); + } + } + else + { + StringBuffer sb = new StringBuffer(); + String msg = e.getMessage(); + if (msg != null && msg.length() > 0) + { + sb.append(Msg.getMsg(Env.getCtx(), e.getAD_Message())); + } + String info = e.getInfo(); + if (info != null && info.length() > 0) + { + if (sb.length() > 0 && !sb.toString().trim().endsWith(":")) + sb.append(": "); + sb.append(info); + } + if (sb.length() > 0) + { + int pos = sb.indexOf("\n"); + if (pos != -1 && pos+1 < sb.length()) // replace CR/NL + { + sb.replace(pos, pos+1, " - "); + } + if (detailTab) { + adTab.setDetailPaneStatusMessage(sb.toString (), e.isError ()); + } else { + breadCrumb.setStatusLine (sb.toString (), e.isError ()); + } + } + } } + IADTabpanel tabPanel = detailTab ? adTab.getSelectedDetailADTabpanel() + : getADTab().getSelectedTabpanel(); + // Confirm Error - if (e.isError() && !e.isConfirmed()) + if (e.isError() && !e.isConfirmed() && tabPanel instanceof ADTabpanel) { - //focus to error field - ADTabpanel tabPanel = (ADTabpanel) getADTab().getSelectedTabpanel(); - GridField[] fields = curTab.getFields(); + //focus to error field + GridField[] fields = tabPanel.getGridTab().getFields(); for (GridField field : fields) { if (field.isError()) { - tabPanel.setFocusToField(field.getColumnName()); + ((ADTabpanel)tabPanel).setFocusToField(field.getColumnName()); break; } } @@ -1174,39 +1204,40 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To e.setConfirmed(true); // show just once - if MTable.setCurrentRow is involved the status event is re-issued } - // update Navigation - boolean firstRow = e.isFirstRow(); - boolean lastRow = e.isLastRow(); - toolbar.enableFirstNavigation(!firstRow && !curTab.isSortTab()); - toolbar.enableLastNavigation(!lastRow && !curTab.isSortTab()); - - // update Change boolean changed = e.isChanged() || e.isInserting(); - boolChanges = changed; - boolean readOnly = curTab.isReadOnly(); + boolean readOnly = tabPanel.getGridTab().isReadOnly(); boolean insertRecord = !readOnly; - - if (insertRecord) + if (!detailTab) { - insertRecord = curTab.isInsertRecord(); + // update Change + boolChanges = changed; + + if (insertRecord) + { + insertRecord = tabPanel.getGridTab().isInsertRecord(); + } + toolbar.enableNew(!changed && insertRecord && !tabPanel.getGridTab().isSortTab()); + toolbar.enableRefresh(!changed); + toolbar.enableDelete(!changed && !readOnly && !tabPanel.getGridTab().isSortTab()); + // + if (readOnly && adTab.getSelectedGridTab().isAlwaysUpdateField()) + { + readOnly = false; + } } - toolbar.enableNew(!changed && insertRecord && !curTab.isSortTab()); - toolbar.enableRefresh(!changed); - toolbar.enableDelete(!changed && !readOnly && !curTab.isSortTab()); - // - if (readOnly && curTab.isAlwaysUpdateField()) + else { - readOnly = false; + adTab.updateDetailPaneToolbar(changed, readOnly); } - toolbar.enableIgnore(changed && !readOnly); + toolbar.enableIgnore(adTab.needSave(true, false)); if (changed && !readOnly && !toolbar.isSaveEnable() ) { - if (curTab.getRecord_ID() > 0) { - if (curTabIndex == 0) { - MRecentItem.addModifiedField(ctx, curTab.getAD_Table_ID(), - curTab.getRecord_ID(), Env.getAD_User_ID(ctx), - Env.getAD_Role_ID(ctx), curTab.getAD_Window_ID(), - curTab.getAD_Tab_ID()); + if (tabPanel.getGridTab().getRecord_ID() > 0) { + if (adTab.getSelectedIndex() == 0 && !detailTab) { + MRecentItem.addModifiedField(ctx, adTab.getSelectedGridTab().getAD_Table_ID(), + adTab.getSelectedGridTab().getRecord_ID(), Env.getAD_User_ID(ctx), + Env.getAD_Role_ID(ctx), adTab.getSelectedGridTab().getAD_Window_ID(), + adTab.getSelectedGridTab().getAD_Tab_ID()); } else { /* when a detail record is modified add header to recent items */ GridTab mainTab = gridWindow.getTab(0); @@ -1220,38 +1251,46 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To } } - toolbar.enableSave(changed && !readOnly); + toolbar.enableSave(adTab.needSave(true, false)); + if (detailTab) { + ToolBarButton btn = toolbar.getButton("SaveCreate"); + if (btn != null && !btn.isDisabled()) + btn.setDisabled(true); + } // // No Rows - if (e.getTotalRows() == 0 && insertRecord) + if (e.getTotalRows() == 0 && insertRecord && !detailTab) { toolbar.enableNew(true); toolbar.enableDelete(false); } // Transaction info - String trxInfo = curTab.getTrxInfo(); - if (trxInfo != null) + if (!detailTab) { - statusBar.setInfo(trxInfo); + String trxInfo = adTab.getSelectedGridTab().getTrxInfo(); + if (trxInfo != null) + { + statusBar.setInfo(trxInfo); + } } - // Check Attachment - boolean canHaveAttachment = curTab.canHaveAttachment(); // not single _ID column + // Check Attachment + boolean canHaveAttachment = adTab.getSelectedGridTab().canHaveAttachment(); // not single _ID column // if (canHaveAttachment && e.isLoading() && - curTab.getCurrentRow() > e.getLoadedRows()) + adTab.getSelectedGridTab().getCurrentRow() > e.getLoadedRows()) { canHaveAttachment = false; } - if (canHaveAttachment && curTab.getRecord_ID() == -1) // No Key + if (canHaveAttachment && adTab.getSelectedGridTab().getRecord_ID() == -1) // No Key { canHaveAttachment = false; } if (canHaveAttachment) { toolbar.enableAttachment(true); - toolbar.getButton("Attachment").setPressed(curTab.hasAttachment()); + toolbar.getButton("Attachment").setPressed(adTab.getSelectedGridTab().hasAttachment()); } else { @@ -1261,43 +1300,43 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To // Check Chat boolean canHaveChat = true; if (e.isLoading() && - curTab.getCurrentRow() > e.getLoadedRows()) + adTab.getSelectedGridTab().getCurrentRow() > e.getLoadedRows()) { canHaveChat = false; } - if (canHaveChat && curTab.getRecord_ID() == -1) // No Key + if (canHaveChat && adTab.getSelectedGridTab().getRecord_ID() == -1) // No Key { canHaveChat = false; } if (canHaveChat) { toolbar.enableChat(true); - toolbar.getButton("Chat").setPressed(curTab.hasChat()); + toolbar.getButton("Chat").setPressed(adTab.getSelectedGridTab().hasChat()); } else { toolbar.enableChat(false); } - toolbar.getButton("Find").setPressed(curTab.isQueryActive()); + toolbar.getButton("Find").setPressed(adTab.getSelectedGridTab().isQueryActive()); // Elaine 2008/12/05 // Lock Indicator if (toolbar.isPersonalLock) { - toolbar.lock(curTab.isLocked()); + toolbar.lock(adTab.getSelectedGridTab().isLocked()); } // adTab.evaluate(e); - toolbar.enablePrint(curTab.isPrinted()); + toolbar.enablePrint(adTab.getSelectedGridTab().isPrinted()); toolbar.enableReport(true); - toolbar.enableExport(!curTab.isSortTab()); + toolbar.enableExport(!adTab.getSelectedGridTab().isSortTab()); //Deepak-Enabling customize button IDEMPIERE-364 - if(!(curTabpanel instanceof ADSortTab)) - toolbar.enableCustomize(((ADTabpanel)curTabpanel).isGridView()); + if(!(adTab.getSelectedTabpanel() instanceof ADSortTab)) + toolbar.enableCustomize(((ADTabpanel)adTab.getSelectedTabpanel()).isGridView()); toolbar.updateToolBarAndMenuWithRestriction(gridWindow.getAD_Window_ID()); } @@ -1332,16 +1371,16 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To @Override public void onCallback(Boolean result) { - curTab.dataRefreshAll(fireEvent, true); - curTabpanel.dynamicDisplay(0); + adTab.getSelectedGridTab().dataRefreshAll(fireEvent, true); + adTab.getSelectedTabpanel().dynamicDisplay(0); focusToActivePanel(); } }); } else { - curTab.dataRefreshAll(fireEvent, true); - curTabpanel.dynamicDisplay(0); + adTab.getSelectedGridTab().dataRefreshAll(fireEvent, true); + adTab.getSelectedTabpanel().dynamicDisplay(0); focusToActivePanel(); } } @@ -1368,7 +1407,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onNew() { - if (!curTab.isInsertRecord()) + if (!adTab.getSelectedGridTab().isInsertRecord()) { logger.warning("Insert Record disabled for Tab"); return; @@ -1379,16 +1418,16 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To public void onCallback(Boolean result) { if (result) { - newRecord = curTab.dataNew(false); + newRecord = adTab.getSelectedGridTab().dataNew(false); if (newRecord) { - curTabpanel.dynamicDisplay(0); + adTab.getSelectedTabpanel().dynamicDisplay(0); toolbar.enableNew(false); toolbar.enableDelete(false); - toolbar.enableNavigation(false); + breadCrumb.enableNavigation(false); toolbar.enableTabNavigation(false); toolbar.enableIgnore(true); - toolbar.enablePrint(curTab.isPrinted()); + toolbar.enablePrint(adTab.getSelectedGridTab().isPrinted()); toolbar.enableReport(true); } else @@ -1407,22 +1446,22 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onCopy() { - if (!curTab.isInsertRecord()) + if (!adTab.getSelectedGridTab().isInsertRecord()) { logger.warning("Insert Record disabled for Tab"); return; } - newRecord = curTab.dataNew(true); + newRecord = adTab.getSelectedGridTab().dataNew(true); if (newRecord) { - curTabpanel.dynamicDisplay(0); + adTab.getSelectedTabpanel().dynamicDisplay(0); toolbar.enableNew(false); toolbar.enableDelete(false); - toolbar.enableNavigation(false); + breadCrumb.enableNavigation(false); toolbar.enableTabNavigation(false); toolbar.enableIgnore(true); - toolbar.enablePrint(curTab.isPrinted()); + toolbar.enablePrint(adTab.getSelectedGridTab().isPrinted()); toolbar.enableReport(true); } else @@ -1438,7 +1477,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onFind() { - if (curTab == null) + if (adTab.getSelectedGridTab() == null) return; onSave(false, false, new Callback() { @@ -1454,13 +1493,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private void doOnFind() { // Gets Fields from AD_Field_v - GridField[] findFields = curTab.getFields(); - if (findWindow == null || !findWindow.validate(curTab.getWindowNo(), curTab.getName(), - curTab.getAD_Table_ID(), curTab.getTableName(), - curTab.getWhereExtended(), findFields, 1, curTab.getAD_Tab_ID())) { - findWindow = new FindWindow (curTab.getWindowNo(), curTab.getName(), - curTab.getAD_Table_ID(), curTab.getTableName(), - curTab.getWhereExtended(), findFields, 1, curTab.getAD_Tab_ID()); + GridField[] findFields = adTab.getSelectedGridTab().getFields(); + if (findWindow == null || !findWindow.validate(adTab.getSelectedGridTab().getWindowNo(), adTab.getSelectedGridTab().getName(), + adTab.getSelectedGridTab().getAD_Table_ID(), adTab.getSelectedGridTab().getTableName(), + adTab.getSelectedGridTab().getWhereExtended(), findFields, 1, adTab.getSelectedGridTab().getAD_Tab_ID())) { + findWindow = new FindWindow (adTab.getSelectedGridTab().getWindowNo(), adTab.getSelectedGridTab().getName(), + adTab.getSelectedGridTab().getAD_Table_ID(), adTab.getSelectedGridTab().getTableName(), + adTab.getSelectedGridTab().getWhereExtended(), findFields, 1, adTab.getSelectedGridTab().getAD_Tab_ID()); if (!findWindow.initialize()) { if (findWindow.getTotalRecords() == 0) { @@ -1482,18 +1521,18 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To if (query != null) { m_onlyCurrentRows = false; // search history too - curTab.setQuery(query); - curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); // autoSize + adTab.getSelectedGridTab().setQuery(query); + adTab.getSelectedTabpanel().query(m_onlyCurrentRows, m_onlyCurrentDays, MRole.getDefault().getMaxQueryRecords()); // autoSize } if (findWindow.isCreateNew()) onNew(); else - curTab.dataRefresh(false); // Elaine 2008/07/25 + adTab.getSelectedGridTab().dataRefresh(false); // Elaine 2008/07/25 } else { - toolbar.getButton("Find").setPressed(curTab.isQueryActive()); + toolbar.getButton("Find").setPressed(adTab.getSelectedGridTab().isQueryActive()); } focusToActivePanel(); } @@ -1508,19 +1547,23 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onIgnore() { - if (curTab.isSortTab()) + IADTabpanel dirtyTabpanel = adTab.getDirtyADTabpanel(); + if (dirtyTabpanel != null && dirtyTabpanel.getGridTab().isSortTab()) { - curTabpanel.refresh(); + dirtyTabpanel.refresh(); toolbar.enableIgnore(false); } else { - curTab.dataIgnore(); - curTab.dataRefresh(true); // update statusbar & toolbar - curTabpanel.dynamicDisplay(0); + adTab.dataIgnore(); + if (dirtyTabpanel != null) { + dirtyTabpanel.getGridTab().dataRefresh(true); // update statusbar & toolbar + dirtyTabpanel.dynamicDisplay(0); + } toolbar.enableIgnore(false); } - focusToActivePanel(); + if (dirtyTabpanel != null) + focusToTabpanel(dirtyTabpanel); } /** @@ -1528,17 +1571,23 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onSave() { + final IADTabpanel dirtyTabpanel = adTab.getDirtyADTabpanel(); onSave(true, false, new Callback() { @Override public void onCallback(Boolean result) { if (result) { - String statusLine = statusBar.getStatusLine(); - curTab.dataRefreshAll(true, true); - statusBar.setStatusLine(statusLine); + String statusLine = breadCrumb.getStatusLine(); + adTab.getSelectedGridTab().dataRefreshAll(true, true); + breadCrumb.setStatusLine(statusLine); } - focusToActivePanel(); + if (dirtyTabpanel != null) { + onDetailRecord(); + focusToTabpanel(dirtyTabpanel); + } else { + focusToActivePanel(); + } } }); } @@ -1547,29 +1596,40 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To * @param onSaveEvent */ private void onSave(final boolean onSaveEvent, final boolean onNavigationEvent, final Callback callback) - { - final boolean newRecord = (curTab.getRecord_ID() <= 0); + { final boolean wasChanged = toolbar.isSaveEnable(); - if (curTab.isSortTab()) + IADTabpanel dirtyTabpanel = adTab.getDirtyADTabpanel(); + final boolean newRecord = dirtyTabpanel != null ? (dirtyTabpanel.getGridTab().getRecord_ID() <= 0) + : false; + if (dirtyTabpanel != null && dirtyTabpanel instanceof ADSortTab) { + ADSortTab sortTab = (ADSortTab) dirtyTabpanel; if (onNavigationEvent) - ((ADSortTab)curTabpanel).unregisterPanel(); + sortTab.unregisterPanel(); else - ((ADSortTab)curTabpanel).saveData(); + sortTab.saveData(); if (!onNavigationEvent) { - toolbar.enableSave(false); // set explicitly - toolbar.enableIgnore(false); + toolbar.enableSave(sortTab.isChanged()); // set explicitly + toolbar.enableIgnore(sortTab.isChanged()); + } + if (!sortTab.isChanged()) { + if (sortTab == adTab.getSelectedTabpanel()) { + breadCrumb.setStatusLine(Msg.getMsg(Env.getCtx(), "Saved")); + } else { + adTab.setDetailPaneStatusMessage(Msg.getMsg(Env.getCtx(), "Saved"), false); + } } if (callback != null) callback.onCallback(true); } else - { - if ((curTab.getCommitWarning() != null && curTab.getCommitWarning().trim().length() > 0) || + { + if ((dirtyTabpanel != null && dirtyTabpanel.getGridTab().getCommitWarning() != null + && dirtyTabpanel.getGridTab().getCommitWarning().trim().length() > 0) || (!Env.isAutoCommit(ctx, curWindowNo) && onNavigationEvent)) { - FDialog.ask(curWindowNo, this.getComponent(), "SaveChanges?", curTab.getCommitWarning(), new Callback() { + FDialog.ask(curWindowNo, this.getComponent(), "SaveChanges?", dirtyTabpanel.getGridTab().getCommitWarning(), new Callback() { @Override public void onCallback(Boolean result) @@ -1595,7 +1655,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private void onSave0(boolean onSaveEvent, boolean navigationEvent, boolean newRecord, boolean wasChanged, Callback callback) { - boolean retValue = curTab.dataSave(onSaveEvent); + IADTabpanel dirtyTabpanel = adTab.getDirtyADTabpanel(); + boolean retValue = adTab.dataSave(onSaveEvent); if (!retValue) { @@ -1603,24 +1664,24 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To if (callback != null) callback.onCallback(false); return; - } else if (!onSaveEvent) //need manual refresh + } else if (!onSaveEvent && dirtyTabpanel != null) //need manual refresh { - curTab.setCurrentRow(curTab.getCurrentRow()); + dirtyTabpanel.getGridTab().setCurrentRow(dirtyTabpanel.getGridTab().getCurrentRow()); } - if (!navigationEvent) { - curTabpanel.dynamicDisplay(0); - curTabpanel.afterSave(onSaveEvent); + if (!navigationEvent && dirtyTabpanel != null) { + dirtyTabpanel.dynamicDisplay(0); + dirtyTabpanel.afterSave(onSaveEvent); } if (wasChanged) { if (newRecord) { - if (curTab.getRecord_ID() > 0) { - if (curTabIndex == 0) { - MRecentItem.addModifiedField(ctx, curTab.getAD_Table_ID(), - curTab.getRecord_ID(), Env.getAD_User_ID(ctx), - Env.getAD_Role_ID(ctx), curTab.getAD_Window_ID(), - curTab.getAD_Tab_ID()); + if (adTab.getSelectedGridTab().getRecord_ID() > 0) { + if (adTab.getSelectedIndex() == 0) { + MRecentItem.addModifiedField(ctx, adTab.getSelectedGridTab().getAD_Table_ID(), + adTab.getSelectedGridTab().getRecord_ID(), Env.getAD_User_ID(ctx), + Env.getAD_Role_ID(ctx), adTab.getSelectedGridTab().getAD_Window_ID(), + adTab.getSelectedGridTab().getAD_Tab_ID()); } else { /* when a detail record is modified add header to recent items */ GridTab mainTab = gridWindow.getTab(0); @@ -1633,9 +1694,9 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To } } } else { - if (curTabIndex == 0) { - MRecentItem.touchUpdatedRecord(ctx, curTab.getAD_Table_ID(), - curTab.getRecord_ID(), Env.getAD_User_ID(ctx)); + if (adTab.getSelectedIndex() == 0) { + MRecentItem.touchUpdatedRecord(ctx, adTab.getSelectedGridTab().getAD_Table_ID(), + adTab.getSelectedGridTab().getRecord_ID(), Env.getAD_User_ID(ctx)); } else { GridTab mainTab = gridWindow.getTab(0); if (mainTab != null) { @@ -1654,7 +1715,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To String msg = CLogger.retrieveErrorString(null); if (msg != null) { - statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), msg), true, true); + breadCrumb.setStatusLine(Msg.getMsg(Env.getCtx(), msg), true); } //other error will be catch in the dataStatusChanged event } @@ -1671,7 +1732,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To { if(result) { - curTab.dataRefreshAll(true, true); + adTab.getSelectedGridTab().dataRefreshAll(true, true); onNew(); } } @@ -1683,7 +1744,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onDelete() { - if (curTab.isReadOnly()) + if (adTab.getSelectedGridTab().isReadOnly()) { return; } @@ -1696,9 +1757,9 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To if (result) { //error will be catch in the dataStatusChanged event - curTab.dataDelete(); + adTab.getSelectedGridTab().dataDelete(); - curTabpanel.dynamicDisplay(0); + adTab.getSelectedTabpanel().dynamicDisplay(0); focusToActivePanel(); } } @@ -1711,7 +1772,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onDeleteSelection() { - if (curTab.isReadOnly()) + if (adTab.getSelectedGridTab().isReadOnly()) { return; } @@ -1729,18 +1790,18 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To // Display the first 5 fields data exclude Organization, Client and YesNo field data Vector columnNames = new Vector(); - GridField[] fields = curTab.getFields(); - if(curTab.getField("DocumentNo")!=null){ - columnNames.add(curTab.getField("DocumentNo").getColumnName()); + GridField[] fields = adTab.getSelectedGridTab().getFields(); + if(adTab.getSelectedGridTab().getField("DocumentNo")!=null){ + columnNames.add(adTab.getSelectedGridTab().getField("DocumentNo").getColumnName()); } - if(curTab.getField("Line")!=null){ - columnNames.add(curTab.getField("Line").getColumnName()); + if(adTab.getSelectedGridTab().getField("Line")!=null){ + columnNames.add(adTab.getSelectedGridTab().getField("Line").getColumnName()); } - if(curTab.getField("Value")!=null){ - columnNames.add(curTab.getField("Value").getColumnName()); + if(adTab.getSelectedGridTab().getField("Value")!=null){ + columnNames.add(adTab.getSelectedGridTab().getField("Value").getColumnName()); } - if(curTab.getField("Name")!=null){ - columnNames.add(curTab.getField("Name").getColumnName()); + if(adTab.getSelectedGridTab().getField("Name")!=null){ + columnNames.add(adTab.getSelectedGridTab().getField("Name").getColumnName()); } for(int i = 0; i < fields.length; i++) { @@ -1756,40 +1817,40 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To } Vector data = new Vector(); - int noOfRows = curTab.getRowCount(); + int noOfRows = adTab.getSelectedGridTab().getRowCount(); for(int i=0; i parentColumnNames = curTab.getParentColumnNames(); + ArrayList parentColumnNames = adTab.getSelectedGridTab().getParentColumnNames(); for (Iterator iter = parentColumnNames.iterator(); iter.hasNext();) { String columnName = iter.next(); - GridField field = curTab.getField(columnName); + GridField field = adTab.getSelectedGridTab().getField(columnName); if(field.isLookup()){ Lookup lookup = field.getLookup(); if (lookup != null){ - displayValue = displayValue.append(lookup.getDisplay(curTab.getValue(i,columnName))).append(" | "); + displayValue = displayValue.append(lookup.getDisplay(adTab.getSelectedGridTab().getValue(i,columnName))).append(" | "); } else { - displayValue = displayValue.append(curTab.getValue(i,columnName)).append(" | "); + displayValue = displayValue.append(adTab.getSelectedGridTab().getValue(i,columnName)).append(" | "); } } else { - displayValue = displayValue.append(curTab.getValue(i,columnName)).append(" | "); + displayValue = displayValue.append(adTab.getSelectedGridTab().getValue(i,columnName)).append(" | "); } } } else { - displayValue = displayValue.append(curTab.getValue(i,curTab.getKeyColumnName())); + displayValue = displayValue.append(adTab.getSelectedGridTab().getValue(i,adTab.getSelectedGridTab().getKeyColumnName())); } int count = 0; for(int j=0; j < columnNames.size() && count < 5; j++) { - Object value = curTab.getValue(i, columnNames.get(j)); + Object value = adTab.getSelectedGridTab().getValue(i, columnNames.get(j)); if(value == null) continue; // skip when value is null String text = value.toString().trim(); if(text.length() == 0) continue; // skip when value is empty - GridField field = curTab.getField(columnNames.get(j)); + GridField field = adTab.getSelectedGridTab().getField(columnNames.get(j)); if(field != null) { if (field.isLookup()) @@ -1859,13 +1920,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To int offset = 0; for (int i = 0; i < indices.length; i++) { - curTab.navigate(indices[i]-offset); - if (curTab.dataDelete()) + adTab.getSelectedGridTab().navigate(indices[i]-offset); + if (adTab.getSelectedGridTab().dataDelete()) { offset++; } } - curTabpanel.dynamicDisplay(0); + adTab.getSelectedTabpanel().dynamicDisplay(0); messagePanel.dispose(); } else { @@ -1908,7 +1969,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ public void onPrint() { //Get process defined for this tab - final int AD_Process_ID = curTab.getAD_Process_ID(); + final int AD_Process_ID = adTab.getSelectedGridTab().getAD_Process_ID(); //log.info("ID=" + AD_Process_ID); // No report defined @@ -1923,13 +1984,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To @Override public void onCallback(Boolean result) { if (result) { - int table_ID = curTab.getAD_Table_ID(); - int record_ID = curTab.getRecord_ID(); + int table_ID = adTab.getSelectedGridTab().getAD_Table_ID(); + int record_ID = adTab.getSelectedGridTab().getRecord_ID(); - ProcessModalDialog dialog = new ProcessModalDialog(AbstractADWindowPanel.this, getWindowNo(), AD_Process_ID,table_ID, record_ID, true); + ProcessModalDialog dialog = new ProcessModalDialog(AbstractADWindowContent.this, getWindowNo(), AD_Process_ID,table_ID, record_ID, true); if (dialog.isValid()) { dialog.setPosition("center"); - dialog.setPage(AbstractADWindowPanel.this.getComponent().getPage()); + dialog.setPage(AbstractADWindowContent.this.getComponent().getPage()); dialog.doHighlighted(); } } @@ -1942,7 +2003,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To * @see ToolbarListener#onReport() */ public void onReport() { - if (!MRole.getDefault().isCanReport(curTab.getAD_Table_ID())) + if (!MRole.getDefault().isCanReport(adTab.getSelectedGridTab().getAD_Table_ID())) { FDialog.error(curWindowNo, parent, "AccessCannotReport"); return; @@ -1971,17 +2032,17 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To public void onZoomAcross() { if (toolbar.getEvent() != null) { - int record_ID = curTab.getRecord_ID(); + int record_ID = adTab.getSelectedGridTab().getRecord_ID(); if (record_ID <= 0) return; // Query MQuery query = new MQuery(); // Current row - String link = curTab.getKeyColumnName(); + String link = adTab.getSelectedGridTab().getKeyColumnName(); // Link for detail records if (link.length() == 0) - link = curTab.getLinkColumnName(); + link = adTab.getSelectedGridTab().getLinkColumnName(); if (link.length() != 0) { if (link.endsWith("_ID")) @@ -1991,8 +2052,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To query.addRestriction(link, MQuery.EQUAL, Env.getContext(ctx, curWindowNo, link)); } - new WZoomAcross(toolbar.getEvent().getTarget(), curTab - .getTableName(), curTab.getAD_Window_ID(), query); + new WZoomAcross(toolbar.getEvent().getTarget(), adTab.getSelectedGridTab() + .getTableName(), adTab.getSelectedGridTab().getAD_Window_ID(), query); } } @@ -2003,10 +2064,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To public void onActiveWorkflows() { if (toolbar.getEvent() != null) { - if (curTab.getRecord_ID() <= 0) + if (adTab.getSelectedGridTab().getRecord_ID() <= 0) return; else - AEnv.startWorkflowProcess(curTab.getAD_Table_ID(), curTab.getRecord_ID()); + AEnv.startWorkflowProcess(adTab.getSelectedGridTab().getAD_Table_ID(), adTab.getSelectedGridTab().getRecord_ID()); } } // @@ -2019,15 +2080,15 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To { if (toolbar.getEvent() != null) { - if (curTab.getRecord_ID() <= 0) + if (adTab.getSelectedGridTab().getRecord_ID() <= 0) return; int C_BPartner_ID = 0; - Object bpartner = curTab.getValue("C_BPartner_ID"); + Object bpartner = adTab.getSelectedGridTab().getValue("C_BPartner_ID"); if(bpartner != null) C_BPartner_ID = Integer.valueOf(bpartner.toString()); - new WRequest(toolbar.getEvent().getTarget(), curTab.getAD_Table_ID(), curTab.getRecord_ID(), C_BPartner_ID); + new WRequest(toolbar.getEvent().getTarget(), adTab.getSelectedGridTab().getAD_Table_ID(), adTab.getSelectedGridTab().getRecord_ID(), C_BPartner_ID); } } // @@ -2051,10 +2112,10 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To { if (toolbar.getEvent() != null) { - if (curTab.getRecord_ID() <= 0) + if (adTab.getSelectedGridTab().getRecord_ID() <= 0) return; - new WArchive(toolbar.getEvent().getTarget(), curTab.getAD_Table_ID(), curTab.getRecord_ID()); + new WArchive(toolbar.getEvent().getTarget(), adTab.getSelectedGridTab().getAD_Table_ID(), adTab.getSelectedGridTab().getRecord_ID()); } } @@ -2072,7 +2133,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ private void actionButton (final WButtonEditor wButton) { - if (curTab.hasChangedCurrentTabAndParents()) { + if (adTab.getSelectedGridTab().hasChangedCurrentTabAndParents()) { String msg = CLogger.retrieveErrorString("Please ReQuery Window"); FDialog.error(curWindowNo, parent, null, msg); return; @@ -2094,7 +2155,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To // save first --------------- - if (curTab.needSave(true, false)) + if (adTab.needSave(true, false)) { onSave(false, false, new Callback() { @Override @@ -2118,16 +2179,17 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ private void actionButton0 (String col, final WButtonEditor wButton) { + final IADTabpanel adtabPanel = findADTabpanel(wButton); boolean startWOasking = false; - final int table_ID = curTab.getAD_Table_ID(); + final int table_ID = adtabPanel.getGridTab().getAD_Table_ID(); // Record_ID - int record_ID = curTab.getRecord_ID(); + int record_ID = adtabPanel.getGridTab().getRecord_ID(); // Record_ID - Language Handling - if (record_ID == -1 && curTab.getKeyColumnName().equals("AD_Language")) + if (record_ID == -1 && adtabPanel.getGridTab().getKeyColumnName().equals("AD_Language")) record_ID = Env.getContextAsInt (ctx, curWindowNo, "AD_Language_ID"); // Record_ID - Change Log ID @@ -2135,13 +2197,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To if (record_ID == -1 && (wButton.getProcess_ID() == PROCESS_AD_CHANGELOG_UNDO || wButton.getProcess_ID() == PROCESS_AD_CHANGELOG_REDO)) { - Integer id = (Integer)curTab.getValue("AD_ChangeLog_ID"); + Integer id = (Integer)adtabPanel.getGridTab().getValue("AD_ChangeLog_ID"); record_ID = id.intValue(); } // Ensure it's saved - if (record_ID == -1 && curTab.getKeyColumnName().endsWith("_ID")) + if (record_ID == -1 && adtabPanel.getGridTab().getKeyColumnName().endsWith("_ID")) { FDialog.error(curWindowNo, parent, "SaveErrorRowNotFound"); return; @@ -2152,7 +2214,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To // Pop up Payment Rules if (col.equals("PaymentRule")) { - final WPayment vp = new WPayment(curWindowNo, curTab, wButton); + final WPayment vp = new WPayment(curWindowNo, adtabPanel.getGridTab(), wButton); if (vp.isInitOK()) // may not be allowed { vp.setAttribute(Window.MODE_KEY, Window.MODE_HIGHLIGHTED); @@ -2181,7 +2243,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To else if (col.equals("DocAction")) { - final WDocActionPanel win = new WDocActionPanel(curTab); + final WDocActionPanel win = new WDocActionPanel(adtabPanel.getGridTab()); if (win.getNumberOfOptions() == 0) { logger.info("DocAction - No Options"); @@ -2211,7 +2273,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To else if (col.equals("CreateFrom")) { - ICreateFrom cf = WCreateFromFactory.create(curTab); + ICreateFrom cf = WCreateFromFactory.create(adtabPanel.getGridTab()); if(cf != null) { @@ -2223,7 +2285,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To @Override public void onEvent(Event event) throws Exception { if (!window.isCancel()) { - curTab.dataRefresh(); + adtabPanel.getGridTab().dataRefresh(); } } }); @@ -2264,12 +2326,12 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To int recordId = Env.getContextAsInt(ctx, curWindowNo, "Record_ID", true); if ( tableId == 0 || recordId == 0 ) { - tableId = curTab.getAD_Table_ID(); - recordId = curTab.getRecord_ID(); + tableId = adtabPanel.getGridTab().getAD_Table_ID(); + recordId = adtabPanel.getGridTab().getRecord_ID(); } // Check Post Status - final Object ps = curTab.getValue("Posted"); + final Object ps = adtabPanel.getGridTab().getValue("Posted"); if (ps != null && ps.equals("Y")) { @@ -2293,7 +2355,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To tableIdRef, recordIdRef, force); if (error != null) - statusBar.setStatusLine(error, true, true); + breadCrumb.setStatusLine(error, true); onRefresh(false, false); } @@ -2327,7 +2389,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To // Save item changed - if (curTab.needSave(true, false)) + if (adTab.needSave(true, false)) { onSave(false, false, new Callback() { @@ -2395,7 +2457,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To String error = processButtonCallout((WButtonEditor)event.getSource()); if (error != null && error.trim().length() > 0) { - statusBar.setStatusLine(error, true); + breadCrumb.setStatusLine(error, true); return; } actionButton((WButtonEditor)event.getSource()); @@ -2420,15 +2482,33 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ private String processButtonCallout (WButtonEditor button) { - GridField field = curTab.getField(button.getColumnName()); - return curTab.processCallout(field); + IADTabpanel adtab = findADTabpanel(button); + if (adtab != null) { + GridField field = adtab.getGridTab().getField(button.getColumnName()); + return adtab.getGridTab().processCallout(field); + } else { + return ""; + } } // processButtonCallout + public IADTabpanel findADTabpanel(WButtonEditor button) { + IADTabpanel adtab = null; + Component c = button.getComponent(); + while (c != null) { + if (c instanceof IADTabpanel) { + adtab = (IADTabpanel) c; + break; + } + c = c.getParent(); + } + return adtab; + } + /** * * @return IADTab */ - public IADTab getADTab() { + public IADTabbox getADTab() { return adTab; } @@ -2443,7 +2523,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To */ private void onModalClose(ProcessInfo pi) { boolean notPrint = pi != null - && pi.getAD_Process_ID() != curTab.getAD_Process_ID() + && pi.getAD_Process_ID() != adTab.getSelectedGridTab().getAD_Process_ID() && pi.isReportingProcess() == false; // // Process Result @@ -2485,7 +2565,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To String summary = pi.getSummary(); if (summary != null && summary.indexOf('@') != -1) pi.setSummary(Msg.parseTranslation(Env.getCtx(), summary)); - statusBar.setStatusLine(pi.getSummary(), pi.isError(), true); + breadCrumb.setStatusLine(pi.getSummary(), pi.isError()); // Get Log Info ProcessInfoUtil.setLogFromDB(pi); String logInfo = pi.getLogInfo(); @@ -2498,7 +2578,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To * * @return toolbar instance */ - public CWindowToolbar getToolbar() { + public ADWindowToolbar getToolbar() { return toolbar; } @@ -2506,7 +2586,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To * @return active grid tab */ public GridTab getActiveGridTab() { - return curTab; + return adTab.getSelectedGridTab(); } /** @@ -2533,7 +2613,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To gridFieldIds.add(fields[i].getAD_Field_ID()); } - if (CustomizeGridViewDialog.showCustomize(0, curTab.getAD_Tab_ID(), columnsWidth,gridFieldIds)) { + if (CustomizeGridViewDialog.showCustomize(0, adTab.getSelectedGridTab().getAD_Tab_ID(), columnsWidth,gridFieldIds)) { if (tabPanel.getGridView() != null) { tabPanel.getGridView().reInit(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java new file mode 100644 index 0000000000..017f07cd69 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumb.java @@ -0,0 +1,434 @@ +/****************************************************************************** + * Copyright (C) 2012 Heng Sin Low * + * Copyright (C) 2012 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui.adwindow; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.adempiere.webui.AdempiereIdGenerator; +import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.component.Label; +import org.adempiere.webui.component.Menupopup; +import org.adempiere.webui.component.ToolBar; +import org.adempiere.webui.component.ToolBarButton; +import org.adempiere.webui.component.Window; +import org.adempiere.webui.event.ToolbarListener; +import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.window.WRecordInfo; +import org.compiere.model.DataStatusEvent; +import org.compiere.model.MRole; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.zkoss.zhtml.Text; +import org.zkoss.zk.ui.Execution; +import org.zkoss.zk.ui.Executions; +import org.zkoss.zk.ui.Page; +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.zk.ui.event.MouseEvent; +import org.zkoss.zk.ui.util.Clients; +import org.zkoss.zul.Caption; +import org.zkoss.zul.Div; +import org.zkoss.zul.Hbox; +import org.zkoss.zul.Hlayout; +import org.zkoss.zul.Image; +import org.zkoss.zul.Menuitem; +import org.zkoss.zul.Space; + +/** + * @author hengsin + * + */ +public class BreadCrumb extends Div implements EventListener{ + + private static final String INFO_INDICATOR_IMAGE = "/images/InfoIndicator16.png"; + + private static final String ERROR_INDICATOR_IMAGE = "/images/ErrorIndicator16.png"; + + /** + * generated serial id + */ + private static final long serialVersionUID = 929253935475618911L; + + private static final String BTNPREFIX = "Btn"; + + private Hbox layout; + + private ToolBarButton btnFirst, btnPrevious, btnNext, btnLast, btnRecordInfo; + + private LinkedHashMap links; + + private int windowNo; + + private HashMap buttons = new HashMap(); + private Map altKeyMap = new HashMap(); + + private DataStatusEvent m_dse; + + private String m_text; + + private boolean m_statusError; + + private String m_statusText; + + private Window msgPopup; + + private Div msgPopupCnt; + + private ToolbarListener toolbarListener; + + private Hlayout toolbarContainer; + + private Hbox messageContainer; + + private Caption msgPopupCaption; + + /** + * + */ + public BreadCrumb(int windowNo) { + this.windowNo = windowNo; + layout = new Hbox(); + layout.setPack("start"); + layout.setAlign("center"); + this.appendChild(layout); + layout.setHeight("100%"); + layout.setStyle("float: left"); + + this.setVisible(false); + this.setSclass("adwindow-breadcrumb"); + + toolbarContainer = new Hlayout(); + layout.appendChild(toolbarContainer); + + ToolBar toolbar = new ToolBar(); + toolbarContainer.appendChild(toolbar); + btnFirst = createButton("First", "First", "First"); + toolbar.appendChild(btnFirst); + btnPrevious = createButton("Previous", "Previous", "Previous"); + toolbar.appendChild(btnPrevious); + btnRecordInfo = new ToolBarButton(); + btnRecordInfo.setLabel(""); + btnRecordInfo.setStyle("font-size: 12px"); + btnRecordInfo.setTooltiptext("Record Info"); + btnRecordInfo.addEventListener(Events.ON_CLICK, this); + toolbar.appendChild(btnRecordInfo); + btnNext = createButton("Next", "Next", "Next"); + toolbar.appendChild(btnNext); + btnLast = createButton("Last", "Last", "Last"); + toolbar.appendChild(btnLast); + + messageContainer = new Hbox(); + messageContainer.setStyle("float: right; height: 30px;"); + messageContainer.setAlign("center"); + appendChild(messageContainer); + + altKeyMap.put(KeyEvent.UP, btnPrevious); + altKeyMap.put(KeyEvent.DOWN, btnNext); + altKeyMap.put(KeyEvent.PAGE_UP, btnFirst); + altKeyMap.put(KeyEvent.PAGE_DOWN, btnLast); + + createPopup(); + + toolbar.setStyle("background-image: none; background-color: transparent; border: none;"); + } + + public void setToolbarListener(ToolbarListener listener) { + this.toolbarListener = listener; + } + + public void addPath(String label, String id, boolean clickable) { + if (clickable) { + BreadCrumbLink a = new BreadCrumbLink(); + a.setLabel(label); + a.setPathId(id); + a.addEventListener(Events.ON_CLICK, this); + if (layout.getChildren().size() > 1) { + Label symbol = new Label(); + symbol.setValue(" > "); + layout.insertBefore(symbol, toolbarContainer); + } + layout.insertBefore(a, toolbarContainer); + } else { + Label pathLabel = new Label(); + pathLabel.setValue(label); + if (layout.getChildren().size() > 1) { + Label symbol = new Label(); + symbol.setValue(" > "); + layout.insertBefore(symbol, toolbarContainer); + } + pathLabel.setStyle("font-weight: bold"); + layout.insertBefore(pathLabel, toolbarContainer); + } + } + + public void addLinks(LinkedHashMap links) { + this.links = links; + final Label pathLabel = (Label) layout.getChildren().get(layout.getChildren().size()-2); + pathLabel.setStyle("cursor: pointer; font-weight: bold"); + pathLabel.addEventListener(Events.ON_CLICK, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + Menupopup popup = new Menupopup(); + for(Map.Entryentry : BreadCrumb.this.links.entrySet()) { + final Menuitem item = new Menuitem(); + item.setLabel(entry.getValue()); + item.setValue(entry.getKey()); + item.addEventListener(Events.ON_CLICK, BreadCrumb.this); + popup.appendChild(item); + } + popup.setPage(pathLabel.getPage()); + popup.open(pathLabel); + } + }); + } + + @Override + public void onEvent(Event event) throws Exception { + if (event.getTarget() == btnRecordInfo) { + if (m_dse == null + || m_dse.CreatedBy == null + || !MRole.getDefault().isShowPreference()) + return; + + String title = Msg.getMsg(Env.getCtx(), "Who") + m_text; + new WRecordInfo (title, m_dse); + } else if (event.getTarget().getParent() == messageContainer) { + showPopup(); + } else if (event.getTarget() == btnFirst) { + if (toolbarListener != null) + toolbarListener.onFirst(); + } else if (event.getTarget() == btnPrevious) { + if (toolbarListener != null) + toolbarListener.onPrevious(); + } else if (event.getTarget() == btnNext) { + if (toolbarListener != null) + toolbarListener.onNext(); + } else if (event.getTarget() == btnLast) { + if (toolbarListener != null) + toolbarListener.onLast(); + } else { + MouseEvent me = (MouseEvent) event; + Events.sendEvent(this, me); + } + } + + public void reset() { + layout.getChildren().clear(); + layout.appendChild(toolbarContainer); + this.links = null; + } + + private void enableFirstNavigation(boolean enabled) + { + this.btnFirst.setDisabled(!enabled); + this.btnPrevious.setDisabled(!enabled); + } + + private void enableLastNavigation(boolean enabled) + { + this.btnLast.setDisabled(!enabled); + this.btnNext.setDisabled(!enabled); + } + + public void enableNavigation(boolean enabled) + { + this.btnFirst.setDisabled(!enabled); + this.btnPrevious.setDisabled(!enabled); + this.btnNext.setDisabled(!enabled); + this.btnLast.setDisabled(!enabled); + } + + private ToolBarButton createButton(String name, String image, String tooltip) + { + ToolBarButton btn = new ToolBarButton(""); + btn.setName(BTNPREFIX+name); + if (windowNo > 0) + btn.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unq" + btn.getName() + "_" + windowNo); + else + btn.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, btn.getName()); + btn.setImage("/images/"+image + "24.png"); + btn.setTooltiptext(Msg.getMsg(Env.getCtx(),tooltip)); + btn.setSclass("toolbar-button"); + + buttons.put(name, btn); + this.appendChild(btn); + //make toolbar button last to receive focus + btn.setTabindex(0); + btn.addEventListener(Events.ON_CLICK, this); + btn.setDisabled(true); + + return btn; + } + + /** + * @param text + */ + public void setStatusDB (String text) + { + setStatusDB(text, null); + } + + /** + * @param text + * @param dse + */ + public void setStatusDB (String text, DataStatusEvent dse) + { + if (text == null || text.length() == 0) + { + btnRecordInfo.setLabel(""); + } + else + { + btnRecordInfo.setLabel(text); + } + + m_text = text; + m_dse = dse; + if (m_dse != null) { + enableFirstNavigation(m_dse.getCurrentRow() > 0); + enableLastNavigation(m_dse.getTotalRows() > m_dse.getCurrentRow()+1); + } + } + + /** + * @param text + */ + public void setStatusLine (String text) + { + setStatusLine(text, false); + } + + /** + * @param text + * @param error + */ + public void setStatusLine (String text, boolean error) + { + Execution execution = Executions.getCurrent(); + if (execution != null) { + String key = this.getClass().getName()+"."+getUuid(); + Object o = execution.getAttribute(key); + if (o != null) { + if (text == null || text.trim().length() == 0) + return; + } else { + execution.setAttribute(key, Boolean.TRUE); + } + } + + m_statusText = text; + m_statusError = error; + + messageContainer.getChildren().clear(); + + if (text == null || text.trim().length() == 0 ) + return; + + Image image = null; + if (error) + image = new Image(ERROR_INDICATOR_IMAGE); + else + image = new Image(INFO_INDICATOR_IMAGE); + + image.setAttribute("org.zkoss.zul.image.preload", Boolean.TRUE); + messageContainer.appendChild(image); + String labelText = buildLabelText(m_statusText); + if (error) { + Clients.showNotification(labelText, "error", image, "overlap_start", 3500, true); + } + Label label = new Label(labelText); + messageContainer.appendChild(label); + if (labelText.length() != m_statusText.length()) { + image.addEventListener(Events.ON_CLICK, this); + image.setStyle("cursor: pointer"); + label.addEventListener(Events.ON_CLICK, this); + label.setStyle("cursor: pointer"); + + label = new Label(" ..."); + label.setStyle("cursor: pointer"); + messageContainer.appendChild(label); + label.addEventListener(Events.ON_CLICK, this); + } + messageContainer.appendChild(new Space()); + + createPopupContent(); + } + + private String buildLabelText(String statusText) { + if (statusText == null) + return ""; + if (statusText.length() <= 80) + return statusText; + + int index = statusText.indexOf(" - java.lang.Exception"); + if (index > 0) + return statusText.substring(0, index); + return statusText.substring(0, 80); + } + + protected void createPopupContent() { + Text t = new Text(m_statusText); + msgPopupCnt.getChildren().clear(); + msgPopupCnt.appendChild(t); + } + + /** + * + * @return current status line text + */ + public String getStatusLine() { + return m_statusText; + } + + private void createPopup() { + msgPopupCnt = new Div(); + msgPopupCnt.setVflex("1"); + + + msgPopup = new Window(); + msgPopup.setBorder(true); + msgPopup.setClosable(true); + msgPopup.setSizable(true); + msgPopup.setContentStyle("overflow: auto"); + msgPopup.setWidth("500px"); + msgPopup.appendChild(msgPopupCnt); + msgPopup.setPage(SessionManager.getAppDesktop().getComponent().getPage()); + msgPopup.setShadow(true); + msgPopupCaption = new Caption(); + msgPopup.appendChild(msgPopupCaption); + } + + private void showPopup() { + msgPopupCaption.setImage(m_statusError ? ERROR_INDICATOR_IMAGE : INFO_INDICATOR_IMAGE); + LayoutUtils.openOverlappedWindow(messageContainer, msgPopup, "overlap_end"); + } + + @Override + public void onPageDetached(Page page) { + super.onPageDetached(page); + if (msgPopup != null) + msgPopup.detach(); + } + + public void setNavigationToolbarVisibility(boolean visible) { + toolbarContainer.setVisible(visible); + } + + +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumbLink.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumbLink.java new file mode 100644 index 0000000000..e1ce423868 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/BreadCrumbLink.java @@ -0,0 +1,39 @@ +/****************************************************************************** + * Copyright (C) 2012 Heng Sin Low * + * Copyright (C) 2012 Trek Global * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + *****************************************************************************/ +package org.adempiere.webui.adwindow; + +import org.zkoss.zul.A; + +/** + * @author hengsin + * + */ +public class BreadCrumbLink extends A { + + /** + * generated serial id + */ + private static final long serialVersionUID = 170361731431877695L; + + private String pathId; + + public String getPathId() { + return pathId; + } + + public void setPathId(String pathId) { + this.pathId = pathId; + } + +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/CompositeADTabbox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/CompositeADTabbox.java new file mode 100644 index 0000000000..69e260c55f --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/CompositeADTabbox.java @@ -0,0 +1,646 @@ +/****************************************************************************** + * Product: Posterita Ajax UI * + * Copyright (C) 2007 Posterita Ltd. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius * + * or via info@posterita.org or http://www.posterita.org/ * + *****************************************************************************/ + +package org.adempiere.webui.adwindow; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedHashMap; +import java.util.List; + +import org.adempiere.util.Callback; +import org.adempiere.webui.component.ADTabListModel; +import org.adempiere.webui.component.ADTabListModel.ADTabLabel; +import org.adempiere.webui.window.FDialog; +import org.compiere.model.DataStatusEvent; +import org.compiere.model.DataStatusListener; +import org.compiere.model.GridField; +import org.compiere.model.GridTab; +import org.compiere.util.CLogger; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.Execution; +import org.zkoss.zk.ui.Executions; +import org.zkoss.zk.ui.HtmlBasedComponent; +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.util.Clients; +import org.zkoss.zul.Menuitem; +import org.zkoss.zul.Vlayout; + +/** + * + * @author Ashley G Ramdass + * @author Low Heng Sin + * @date Feb 25, 2007 + * @version $Revision: 0.10 $ + */ +public class CompositeADTabbox extends AbstractADTabbox +{ + private static final String ON_TOGGLE_EVENT = "onToggle"; + + private static final String ON_SWITCH_VIEW_EVENT = "onSwitchView"; + + private static final String ON_ACTIVATE_EVENT = "onActivate"; + + private static final String ON_SELECTION_CHANGED_EVENT = "onSelectionChanged"; + + public static final String ADTAB_INDEX_ATTRIBUTE = "adtab.index"; + + /** Logger */ + @SuppressWarnings("unused") + private static CLogger log = CLogger.getCLogger (CompositeADTabbox.class); + + private List tabLabelList = new ArrayList(); + + private List tabPanelList = new ArrayList(); + + private Vlayout layout; + + protected DetailPane detailPane; + + private EventListener selectionListener; + + private IADTabpanel headerTab; + + private int selectedIndex = 0; + + public CompositeADTabbox() + { + detailPane = new DetailPane(); + detailPane.setEventListener(new EventListener() { + + @Override + public void onEvent(Event event) throws Exception { + if (DetailPane.ON_EDIT_EVENT.equals(event.getName())) { + final int row = detailPane.getSelectedADTabpanel() != null + ? detailPane.getSelectedADTabpanel().getGridTab().getCurrentRow() + : 0; + adWindowPanel.saveAndNavigate(new Callback() { + @Override + public void onCallback(Boolean result) { + if (result) + onEditDetail(row); + } + }); + } + else if (DetailPane.ON_NEW_EVENT.equals(event.getName())) { + final int row = detailPane.getSelectedADTabpanel() != null + ? detailPane.getSelectedADTabpanel().getGridTab().getCurrentRow() + : 0; + adWindowPanel.saveAndNavigate(new Callback() { + @Override + public void onCallback(Boolean result) { + if (result) { + onEditDetail(row); + adWindowPanel.onNew(); + } + } + }); + } + else if (DetailPane.ON_DELETE_EVENT.equals(event.getName())) { + final IADTabpanel tabPanel = detailPane.getSelectedADTabpanel(); + if (tabPanel != null && tabPanel.getGridTab().getRowCount() > 0 + && tabPanel.getGridTab().getCurrentRow() >= 0) { + FDialog.ask(tabPanel.getGridTab().getWindowNo(), null, "DeleteRecord?", new Callback() { + + @Override + public void onCallback(Boolean result) { + if (!result) return; + if (!tabPanel.getGridTab().dataDelete()) { + showLastError(); + } else { + adWindowPanel.onRefresh(false); + } + } + }); + } + } + } + }); + } + + protected void onEditDetail(int row) { + int oldIndex = selectedIndex; + IADTabpanel selectedPanel = detailPane.getSelectedADTabpanel(); + int newIndex = (Integer)selectedPanel.getAttribute(ADTAB_INDEX_ATTRIBUTE); + + Event selectionChanged = new Event(ON_SELECTION_CHANGED_EVENT, layout, new Object[]{oldIndex, newIndex}); + try { + selectionListener.onEvent(selectionChanged); + } catch (Exception e) { + throw new RuntimeException(e); + } + + headerTab.setDetailPaneMode(false, true); + if (headerTab.isGridView()) { + headerTab.switchRowPresentation(); + } + headerTab.getGridTab().setCurrentRow(row, true); + } + + protected Component doCreatePart(Component parent) + { + layout = new Vlayout(); + layout.setHeight("100%"); + layout.setWidth("100%"); + layout.setStyle("position: relative"); + if (parent != null) { + layout.setParent(parent); + } else { + layout.setPage(page); + } + + BreadCrumb breadCrumb = getBreadCrumb(); + breadCrumb.addEventListener(Events.ON_CLICK, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + int oldIndex = selectedIndex; + if (event.getTarget() instanceof BreadCrumbLink) { + BreadCrumbLink link = (BreadCrumbLink) event.getTarget(); + int newIndex = Integer.parseInt(link.getPathId()); + + Event selectionChanged = new Event(ON_SELECTION_CHANGED_EVENT, layout, new Object[]{oldIndex, newIndex}); + selectionListener.onEvent(selectionChanged); + } else if (event.getTarget() instanceof Menuitem) { + Menuitem item = (Menuitem) event.getTarget(); + int newIndex = Integer.parseInt(item.getValue()); + + Event selectionChanged = new Event(ON_SELECTION_CHANGED_EVENT, layout, new Object[]{oldIndex, newIndex}); + selectionListener.onEvent(selectionChanged); + } + } + }); + + return layout; + } + + @Override + protected void doAddTab(GridTab gTab, IADTabpanel tabPanel) { + ADTabListModel.ADTabLabel tabLabel = new ADTabListModel.ADTabLabel(gTab.getName(), gTab.getTabLevel(),gTab.getDescription(), + gTab.getWindowNo(),gTab.getAD_Tab_ID()); + tabLabelList.add(tabLabel); + tabPanelList.add(tabPanel); + + tabPanel.setAttribute(ADTAB_INDEX_ATTRIBUTE, tabPanelList.size()-1); + + tabPanel.addEventListener(ON_ACTIVATE_EVENT, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + Boolean b = (Boolean) event.getData(); + if (b != null && !b.booleanValue()) + return; + + IADTabpanel tabPanel = (IADTabpanel) event.getTarget(); + if (tabPanel == headerTab) { + if (b != null && b.booleanValue()) { + activateDetailADTabpanel(); + } + if (selectedIndex > 0 && tabPanel.isGridView()) { + tabPanel.switchRowPresentation(); + } + } else { + onActivateDetail(tabPanel); + } + } + }); + + tabPanel.addEventListener(DetailPane.ON_ACTIVATE_DETAIL_EVENT, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + final IADTabpanel tabPanel = (IADTabpanel) event.getTarget(); + int oldIndex = (Integer) event.getData(); + if (oldIndex != detailPane.getSelectedIndex()) { + IADTabpanel prevTabPanel = detailPane.getADTabpanel(oldIndex); + if (prevTabPanel != null && prevTabPanel.getGridTab().needSave(true, true)) { + final int newIndex = detailPane.getSelectedIndex(); + detailPane.setSelectedIndex(oldIndex); + adWindowPanel.saveAndNavigate(new Callback() { + @Override + public void onCallback(Boolean result) { + if (result) { + detailPane.setSelectedIndex(newIndex); + onActivateDetail(tabPanel); + } + } + }); + } else { + onActivateDetail(tabPanel); + } + } else { + onActivateDetail(tabPanel); + } + } + }); + + tabPanel.addEventListener(ON_SWITCH_VIEW_EVENT, new EventListener() { + + @Override + public void onEvent(Event event) throws Exception { + IADTabpanel tabPanel = (IADTabpanel) event.getTarget(); + if (tabPanel == headerTab) { + IADTabpanel detailPanel = getSelectedDetailADTabpanel(); + if (detailPanel != null) { + detailPanel.setDetailPaneMode(true, headerTab.isGridView()); + } + detailPane.setVflex(Boolean.toString(headerTab.isGridView())); + layout.invalidate(); + } + } + }); + + tabPanel.addEventListener(ON_TOGGLE_EVENT, new EventListener() { + + @Override + public void onEvent(Event event) throws Exception { + IADTabpanel tabPanel = (IADTabpanel) event.getTarget(); + if (tabPanel == headerTab) { + adWindowPanel.onToggle(); + } else { + detailPane.onEdit(); + } + + } + }); + + if (layout.getChildren().isEmpty()) { + layout.appendChild(tabPanel); + headerTab = tabPanel; + updateBreadCrumb(); + } else if (tabLabel.tabLevel <= 1) { + boolean activate = false; + if (detailPane.getParent() == null) { + ADTabpanel adtabpanel = (ADTabpanel) headerTab; + adtabpanel.addDetails(detailPane); + activate = true; + } else + tabPanel.setVisible(false); + detailPane.setHflex("1"); + detailPane.setStyle("min-height: 200px; overflow-y: visible;"); + detailPane.addADTabpanel(tabPanel, tabLabel); + tabPanel.setDetailPaneMode(true, headerTab.isGridView()); + detailPane.setVflex(Boolean.toString(headerTab.isGridView())); + if (activate) + activateDetailADTabpanel(); + } else { + detailPane.addADTabpanel(tabPanel, tabLabel, false); + tabPanel.setDetailPaneMode(true, headerTab.isGridView()); + detailPane.setVflex(Boolean.toString(headerTab.isGridView())); + } + HtmlBasedComponent htmlComponent = (HtmlBasedComponent) tabPanel; + htmlComponent.setVflex("1"); + htmlComponent.setWidth("100%"); + + tabPanel.getGridTab().addDataStatusListener(new SyncDataStatusListener(tabPanel)); + } + + protected void activateDetailADTabpanel() { + if (detailPane != null && detailPane.getParent() != null) { + IADTabpanel tabPanel = detailPane.getSelectedADTabpanel(); + tabPanel.activate(true); + if (!tabPanel.isGridView()) { + tabPanel.switchRowPresentation(); + } + } + } + + /** + * Evaluate Tab Logic + * @param e event + */ + public void evaluate (DataStatusEvent e) + { + super.evaluate(e); + + } // evaluate + + @Override + protected void updateTabState() { + detailPane.refresh(); + } + + /** + * Return the selected Tab Panel + */ + public IADTabpanel getSelectedTabpanel() + { + return tabPanelList.isEmpty() ? null : tabPanelList.get(selectedIndex); + } + + public int getSelectedIndex() { + return selectedIndex; + } + + public void setSelectionEventListener(EventListener listener) { + selectionListener = listener; + } + + @Override + protected void doTabSelectionChanged(int oldIndex, int newIndex) { + selectedIndex = newIndex; + IADTabpanel oldTabpanel = oldIndex >= 0 ? tabPanelList.get(oldIndex) : null; + IADTabpanel newTabpanel = tabPanelList.get(newIndex); + if (oldTabpanel != null) { + oldTabpanel.setVisible(false); + } + newTabpanel.createUI(); + newTabpanel.setVisible(true); + + headerTab = newTabpanel; + layout.getChildren().clear(); + layout.appendChild(headerTab); + + detailPane.detach(); + detailPane.reset(); + + int currentLevel = headerTab.getTabLevel(); + for (int i = selectedIndex + 1; i< tabPanelList.size(); i++) { + IADTabpanel tabPanel = tabPanelList.get(i); + int tabLevel = tabPanel.getTabLevel(); + ADTabListModel.ADTabLabel tabLabel = tabLabelList.get(i); + if ((tabLevel - currentLevel) == 1 || (tabLevel == 0 && currentLevel == 0)) { + if (tabPanel.isActive() && !tabPanel.isGridView()) { + tabPanel.switchRowPresentation(); + } + if (tabPanel.getParent() != null) tabPanel.detach(); + detailPane.addADTabpanel(tabPanel, tabLabel); + tabPanel.setDetailPaneMode(true, headerTab.isGridView()); + } else if (tabLevel > currentLevel ){ + detailPane.addADTabpanel(tabPanel, tabLabel, false); + tabPanel.setDetailPaneMode(true, headerTab.isGridView()); + } + } + + if (detailPane.getTabcount() > 0 && !headerTab.getGridTab().isSortTab()) { + ADTabpanel adtabpanel = (ADTabpanel) headerTab; + adtabpanel.addDetails(detailPane); + detailPane.setVflex(Boolean.toString(headerTab.isGridView())); + detailPane.setSelectedIndex(0); + } + + updateBreadCrumb(); + } + + private void updateBreadCrumb() { + BreadCrumb breadCrumb = getBreadCrumb(); + breadCrumb.reset(); + + if (selectedIndex > 0) { + List parents = new ArrayList(); + List parentIndex = new ArrayList(); + int currentLevel = headerTab.getTabLevel(); + for(int i = selectedIndex - 1; i >= 0; i--) { + ADTabLabel tabLabel = tabLabelList.get(i); + if (tabLabel.tabLevel == currentLevel-1) { + parents.add(tabLabel); + parentIndex.add(i); + currentLevel = tabLabel.tabLevel; + } + } + Collections.reverse(parents); + Collections.reverse(parentIndex); + for(ADTabLabel tabLabel : parents) { + int index = parentIndex.remove(0); + breadCrumb.addPath(tabLabel.label, Integer.toString(index), true); + } + } + ADTabLabel tabLabel = tabLabelList.get(selectedIndex); + breadCrumb.addPath(tabLabel.label, Integer.toString(selectedIndex), false); + breadCrumb.setVisible(true); + + LinkedHashMap links = new LinkedHashMap(); + int parentIndex = 0; + if (headerTab.getTabLevel() > 1) { + for(int i = selectedIndex - 1; i > 0; i--) { + tabLabel = tabLabelList.get(i); + if (tabLabel.tabLevel == (headerTab.getTabLevel()-1)) { + parentIndex = i; + break; + } + } + } + for(int i = parentIndex+1; i < tabLabelList.size(); i++) { + if (i == selectedIndex) continue; + + tabLabel = tabLabelList.get(i); + if (tabLabel.tabLevel == headerTab.getTabLevel()) { + links.put(Integer.toString(i), tabLabel.label); + } else if (tabLabel.tabLevel < headerTab.getTabLevel()) { + break; + } + } + + if (!links.isEmpty()) { + breadCrumb.addLinks(links); + } + } + + protected BreadCrumb getBreadCrumb() { + ADWindowContent window = (ADWindowContent) adWindowPanel; + BreadCrumb breadCrumb = window.getBreadCrumb(); + return breadCrumb; + } + + public Component getComponent() { + return layout; + } + + @Override + public IADTabpanel findADTabpanel(GridTab gTab) { + for (IADTabpanel tabpanel : tabPanelList) { + if (tabpanel.getGridTab() == gTab) { + return tabpanel; + } + } + return null; + } + + public void refresh() { + } + + class SyncDataStatusListener implements DataStatusListener { + + private IADTabpanel tabPanel; + + SyncDataStatusListener(IADTabpanel tabpanel) { + this.tabPanel = tabpanel; + } + + @Override + public void dataStatusChanged(DataStatusEvent e) { + Execution execution = Executions.getCurrent(); + if (execution == null) return; + + if (tabPanel == headerTab && detailPane.getPage() != null && e.getChangedColumn() == -1) { + ArrayList parentColumnNames = new ArrayList(); + GridField[] parentFields = headerTab.getGridTab().getFields(); + for (GridField parentField : parentFields) { + parentColumnNames.add(parentField.getColumnName()); + } + + IADTabpanel detailTab = detailPane.getSelectedADTabpanel(); + + //check data action + String uuid = (String) execution.getAttribute(CompositeADTabbox.class.getName()+".dataAction"); + if (uuid != null && uuid.equals(detailTab.getUuid())) { + //refresh current row + detailTab.getGridTab().dataRefresh(false); + //keep focus + onDetailRecord(); + + return; + } + + GridTab tab = detailTab.getGridTab(); + GridField[] fields = tab.getFields(); + for (GridField field : fields) + { + if (!parentColumnNames.contains(field.getColumnName())) + Env.setContext(Env.getCtx(), field.getWindowNo(), field.getColumnName(), ""); + } + detailTab.query(false, 0, 0); + detailTab.activate(true); + detailTab.setDetailPaneMode(true, headerTab.isGridView()); + detailPane.setVflex(Boolean.toString(headerTab.isGridView())); + } + } + + } + + @Override + public void onDetailRecord() { + if (detailPane != null && detailPane.getParent() != null) { + Clients.scrollIntoView(detailPane); + detailPane.focus(); + } + } + + @Override + public void onParentRecord() { + Clients.scrollIntoView(headerTab); + ((HtmlBasedComponent)headerTab).focus(); + } + + @Override + public boolean isSortTab() { + return headerTab != null ? headerTab.getGridTab().isSortTab() : false; + } + + @Override + public IADTabpanel getSelectedDetailADTabpanel() { + if (detailPane != null && detailPane.getParent() != null) { + return detailPane.getSelectedADTabpanel(); + } + return null; + } + + @Override + public boolean needSave(boolean rowChange, boolean onlyRealChange) { + boolean b = headerTab.getGridTab().needSave(rowChange, onlyRealChange); + if (b) + return b; + + IADTabpanel detailPanel = getSelectedDetailADTabpanel(); + if (detailPanel != null) { + b = detailPanel.getGridTab().needSave(rowChange, onlyRealChange); + } + + return b; + } + + @Override + public void dataIgnore() { + IADTabpanel detailPanel = getSelectedDetailADTabpanel(); + if (detailPanel != null) { + detailPanel.getGridTab().dataIgnore(); + } + headerTab.getGridTab().dataIgnore(); + } + + @Override + public GridTab getSelectedGridTab() { + IADTabpanel tabpanel = getSelectedTabpanel(); + return tabpanel == null ? null : tabpanel.getGridTab(); + } + + @Override + public boolean dataSave(boolean onSaveEvent) { + IADTabpanel detail = getSelectedDetailADTabpanel(); + if (detail != null && detail.getGridTab().needSave(true, true)) { + Execution execution = Executions.getCurrent(); + if (execution != null) { + execution.setAttribute(getClass().getName()+".dataAction", detail.getUuid()); + } + return detail.getGridTab().dataSave(onSaveEvent); + } + return headerTab.getGridTab().dataSave(onSaveEvent); + } + + @Override + public void setDetailPaneStatusMessage(String status, boolean error) { + detailPane.setStatusMessage(status, error); + } + + @Override + public IADTabpanel getDirtyADTabpanel() { + IADTabpanel detail = getSelectedDetailADTabpanel(); + if (detail != null && detail.getGridTab().needSave(true, true)) { + return detail; + } else if (detail != null && detail instanceof ADSortTab && ((ADSortTab)detail).isChanged()) { + return detail; + } else if (headerTab.getGridTab().needSave(true, true)) { + return headerTab; + } else if (headerTab instanceof ADSortTab && ((ADSortTab)headerTab).isChanged()) { + return headerTab; + } + + return null; + } + + protected void onActivateDetail(IADTabpanel tabPanel) { + tabPanel.createUI(); + tabPanel.query(false, 0, 0); + if (!tabPanel.isVisible()) + tabPanel.setVisible(true); + if (!tabPanel.isGridView()) { + tabPanel.switchRowPresentation(); + } + tabPanel.setDetailPaneMode(true, headerTab.isGridView()); + detailPane.setVflex(Boolean.toString(headerTab.isGridView())); + if (tabPanel instanceof ADSortTab) { + detailPane.invalidate(); + detailPane.updateToolbar(false, true); + onDetailRecord(); + } + } + + private void showLastError() { + String msg = CLogger.retrieveErrorString(null); + if (msg != null) + { + detailPane.setStatusMessage(Msg.getMsg(Env.getCtx(), msg), true); + } + //other error will be catch in the dataStatusChanged event + } + + @Override + public void updateDetailPaneToolbar(boolean changed, boolean readOnly) { + detailPane.updateToolbar(changed, readOnly); + } +} 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 new file mode 100644 index 0000000000..56553a1180 --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/DetailPane.java @@ -0,0 +1,414 @@ +/** + * + */ +package org.adempiere.webui.adwindow; + +import java.util.HashMap; +import java.util.Map; + +import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.component.Label; +import org.adempiere.webui.component.Panel; +import org.adempiere.webui.component.Tab; +import org.adempiere.webui.component.Tabbox; +import org.adempiere.webui.component.Tabpanel; +import org.adempiere.webui.component.ToolBar; +import org.adempiere.webui.component.ToolBarButton; +import org.adempiere.webui.component.Window; +import org.adempiere.webui.component.ADTabListModel.ADTabLabel; +import org.adempiere.webui.session.SessionManager; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.Util; +import org.zkoss.zhtml.Text; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.Execution; +import org.zkoss.zk.ui.Executions; +import org.zkoss.zk.ui.Page; +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.util.Clients; +import org.zkoss.zul.Caption; +import org.zkoss.zul.Div; +import org.zkoss.zul.Hbox; +import org.zkoss.zul.Image; +import org.zkoss.zul.Space; +import org.zkoss.zul.Tabpanels; +import org.zkoss.zul.Tabs; +import org.zkoss.zul.Toolbar; + +/** + * @author hengsin + * + */ +public class DetailPane extends Panel implements EventListener { + + private static final String STATUS_TEXT_ATTRIBUTE = "status.text"; + + private static final String STATUS_ERROR_ATTRIBUTE = "status.error"; + + private static final String TABBOX_STYLE = "min-height: 200px; overflow-y: visible; width: 99%; margin: auto;"; + private static final String DELETE_IMAGE = "/images/Delete16.png"; + private static final String EDIT_IMAGE = "/images/EditRecord16.png"; + private static final String NEW_IMAGE = "/images/New16.png"; + private static final String STYLE = "min-height: 200px; width: 100%; overflow-y: visible;"; + + /** + * generated serial id + */ + private static final long serialVersionUID = -7914602940626352282L; + + private static final String INFO_INDICATOR_IMAGE = "/images/InfoIndicator16.png"; + + private static final String ERROR_INDICATOR_IMAGE = "/images/ErrorIndicator16.png"; + + private Tabbox tabbox; + + private EventListener eventListener; + + private Map messageContainers = new HashMap(); + + private Div msgPopupCnt; + + private Window msgPopup; + + private Caption msgPopupCaption; + + private int prevSelectedIndex = 0; + + public static final String ON_ACTIVATE_DETAIL_EVENT = "onActivateDetail"; + + public static final String ON_DELETE_EVENT = "onDelete"; + + public static final String ON_NEW_EVENT = "onNew"; + + public static final String ON_EDIT_EVENT = "onEdit"; + + public DetailPane() { + tabbox = new Tabbox(); + tabbox.setParent(this); + tabbox.addEventListener(Events.ON_SELECT, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + int index = tabbox.getSelectedIndex(); + IADTabpanel tabPanel = (IADTabpanel) tabbox.getTabpanel(index).getChildren().get(1); + Event activateEvent = new Event(ON_ACTIVATE_DETAIL_EVENT, tabPanel, prevSelectedIndex); + Events.sendEvent(activateEvent); + } + }); + tabbox.setStyle(TABBOX_STYLE); + + createPopup(); + + this.setStyle(STYLE); + + //TODO: this probably not needed + this.setHflex("true"); + } + + public int getSelectedIndex() { + return tabbox.getSelectedIndex(); + } + + public void setSelectedIndex(int curTabIndex) { + tabbox.setSelectedIndex(curTabIndex); + prevSelectedIndex = curTabIndex; + } + + public int getTabcount() { + int count = 0; + Tabs tabs = tabbox.getTabs(); + if (tabs != null) + count = tabs.getChildren().size(); + return count; + } + + public void undoLastTabSelection() { + tabbox.setSelectedIndex(prevSelectedIndex); + } + + public void refresh() { + tabbox.invalidate(); + } + + public void addADTabpanel(IADTabpanel tabPanel, ADTabLabel tabLabel) { + addADTabpanel(tabPanel, tabLabel, true); + } + + public void addADTabpanel(IADTabpanel tabPanel, ADTabLabel tabLabel, boolean enabled) { + Tabs tabs = tabbox.getTabs(); + if (tabs == null) { + tabs = new Tabs(); + tabbox.appendChild(tabs); + } + Tab tab = new Tab(); + tabs.appendChild(tab); + tab.setLabel(tabLabel.label); + if (!enabled) { + tab.setDisabled(true); + } + + Tabpanels tabpanels = tabbox.getTabpanels(); + if (tabpanels == null) { + tabpanels = new Tabpanels(); + //TODO: is this style needed ? + tabpanels.setStyle("min-height: 200px; overflow-y: visible;"); + tabpanels.setWidth("100%"); + tabbox.appendChild(tabpanels); + } + Tabpanel tp = new Tabpanel(); + //TODO: is this style needed + tp.setStyle("min-height: 180px; overflow-y: visible; width: 99%; margin: auto;"); + tabpanels.appendChild(tp); + tp.setStyle("background-color: #fff"); + ToolBar toolbar = new ToolBar(); + tp.appendChild(toolbar); + ToolBarButton button = new ToolBarButton(); + + button = new ToolBarButton(); + button.setImage(NEW_IMAGE); + toolbar.appendChild(button); + button.addEventListener(Events.ON_CLICK, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + Event openEvent = new Event(ON_NEW_EVENT, DetailPane.this); + eventListener.onEvent(openEvent); + } + }); + button.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New"))); + + button = new ToolBarButton(); + button.setImage(EDIT_IMAGE); + toolbar.appendChild(button); + button.addEventListener(Events.ON_CLICK, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + onEdit(); + } + }); + button.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "EditRecord"))); + + button = new ToolBarButton(); + button.setImage(DELETE_IMAGE); + toolbar.appendChild(button); + button.addEventListener(Events.ON_CLICK, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + Event openEvent = new Event(ON_DELETE_EVENT, DetailPane.this); + eventListener.onEvent(openEvent); + } + }); + button.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Delete"))); + + Hbox messageContainer = new Hbox(); + messageContainer.setPack("end"); + messageContainer.setHflex("1"); + messageContainer.setStyle("float: right"); + + toolbar.appendChild(messageContainer); + toolbar.setSclass("adtab-detail-toolbar"); + toolbar.setVflex("0"); + messageContainers.put(tabLabel.AD_Tab_ID, messageContainer); + tabPanel.setAttribute("AD_Tab_ID", tabLabel.AD_Tab_ID); + + tp.appendChild(tabPanel); + } + + public void setEventListener(EventListener listener) { + eventListener = listener; + } + + public void reset() { + if (tabbox.getTabs() != null) { + tabbox.getTabs().getChildren().clear(); + } + if (tabbox.getTabpanels() != null) { + tabbox.getTabpanels().getChildren().clear(); + } + + } + + public IADTabpanel getADTabpanel(int index) { + if (index < 0 || index >= tabbox.getTabpanels().getChildren().size()) + return null; + + org.zkoss.zul.Tabpanel tabPanel = tabbox.getTabpanel(index); + for(Component c : tabPanel.getChildren()) { + if (c instanceof IADTabpanel) + return (IADTabpanel)c; + } + return null; + } + + public IADTabpanel getSelectedADTabpanel() { + org.zkoss.zul.Tabpanel selectedPanel = tabbox.getSelectedPanel(); + if (selectedPanel != null) { + for(Component c : selectedPanel.getChildren()) { + if (c instanceof IADTabpanel) + return (IADTabpanel)c; + } + } + return null; + } + + public void setStatusMessage(String status, boolean error) { + IADTabpanel tabPanel = getSelectedADTabpanel(); + Hbox messageContainer = messageContainers.get(tabPanel.getAttribute("AD_Tab_ID")); + + Execution execution = Executions.getCurrent(); + if (execution != null) { + String key = this.getClass().getName()+"."+messageContainer.getUuid(); + Object o = execution.getAttribute(key); + if (o != null) { + if (status == null || status.trim().length() == 0) + return; + } else { + execution.setAttribute(key, Boolean.TRUE); + } + } + + messageContainer.getChildren().clear(); + messageContainer.setAttribute(STATUS_ERROR_ATTRIBUTE, error); + messageContainer.setAttribute(STATUS_TEXT_ATTRIBUTE, status); + + if (status == null || status.trim().length() == 0) + return; + + Image image = null; + if (error) + image = new Image(ERROR_INDICATOR_IMAGE); + else + image = new Image(INFO_INDICATOR_IMAGE); + + image.setAttribute("org.zkoss.zul.image.preload", Boolean.TRUE); + messageContainer.appendChild(image); + String labelText = buildLabelText(status); + if (error) { + Clients.showNotification(labelText, "error", image, "overlap_start", 3500, true); + } + Label label = new Label(labelText); + messageContainer.appendChild(label); + if (labelText.length() != status.length()) { + image.addEventListener(Events.ON_CLICK, this); + image.setStyle("cursor: pointer"); + label.addEventListener(Events.ON_CLICK, this); + label.setStyle("cursor: pointer"); + + label = new Label(" ..."); + label.setStyle("cursor: pointer"); + messageContainer.appendChild(label); + label.addEventListener(Events.ON_CLICK, this); + } + + messageContainer.appendChild(new Space()); + } + + private String buildLabelText(String statusText) { + if (statusText == null) + return ""; + if (statusText.length() <= 80) + return statusText; + + int index = statusText.indexOf(" - java.lang.Exception"); + if (index > 0) + return statusText.substring(0, index); + return statusText.substring(0, 80); + } + + @Override + public void onEvent(Event event) throws Exception { + Component messageContainer = event.getTarget().getParent(); + Boolean error = (Boolean) messageContainer.getAttribute(STATUS_ERROR_ATTRIBUTE); + String status = (String) messageContainer.getAttribute(STATUS_TEXT_ATTRIBUTE); + + createPopupContent(status); + showPopup(error, messageContainer); + } + + protected void createPopupContent(String status) { + Text t = new Text(status); + msgPopupCnt.getChildren().clear(); + msgPopupCnt.appendChild(t); + } + + private void showPopup(boolean error, Component messageContainer) { + msgPopupCaption.setImage(error ? ERROR_INDICATOR_IMAGE : INFO_INDICATOR_IMAGE); + LayoutUtils.openOverlappedWindow(messageContainer, msgPopup, "overlap_end"); + } + + private void createPopup() { + msgPopupCnt = new Div(); + msgPopupCnt.setVflex("1"); + + + msgPopup = new Window(); + msgPopup.setBorder(true); + msgPopup.setClosable(true); + msgPopup.setSizable(true); + msgPopup.setContentStyle("overflow: auto"); + msgPopup.setWidth("500px"); + msgPopup.appendChild(msgPopupCnt); + msgPopup.setPage(SessionManager.getAppDesktop().getComponent().getPage()); + msgPopup.setShadow(true); + msgPopupCaption = new Caption(); + msgPopup.appendChild(msgPopupCaption); + } + + @Override + public void onPageDetached(Page page) { + super.onPageDetached(page); + if (msgPopup != null) + msgPopup.detach(); + } + + /* (non-Javadoc) + * @see org.zkoss.zk.ui.HtmlBasedComponent#setVflex(java.lang.String) + */ + @Override + public void setVflex(String flex) { + super.setVflex(flex); + tabbox.setVflex(flex); + } + + public void updateToolbar(boolean changed, boolean readOnly) { + int index = getSelectedIndex(); + if (index < 0 || index >= getTabcount()) return; + + Tabpanel tabpanel = tabbox.getTabpanel(index); + Toolbar toolbar = (Toolbar) tabpanel.getFirstChild(); + + IADTabpanel adtab = getADTabpanel(index); + if (adtab.getGridTab().isSortTab()) + readOnly = true; + + boolean insertRecord = !readOnly; + if (insertRecord) + { + insertRecord = adtab.getGridTab().isInsertRecord(); + } + boolean enableNew = !changed && insertRecord && !adtab.getGridTab().isSortTab(); + boolean enableDelete = !changed && !readOnly && !adtab.getGridTab().isSortTab(); + int newBtn = 0; + int deleteBtn = 0; + for(Component c : toolbar.getChildren()) { + if (c instanceof ToolBarButton) { + ToolBarButton btn = (ToolBarButton) c; + if (NEW_IMAGE.equals(btn.getImage())) { + btn.setDisabled(!enableNew); + newBtn++; + } else if (DELETE_IMAGE.equals(btn.getImage())) { + btn.setDisabled(!enableDelete); + deleteBtn++; + } + if (newBtn > 0 && deleteBtn > 0) + break; + } + } + } + + public void onEdit() throws Exception { + Event openEvent = new Event(ON_EDIT_EVENT, DetailPane.this); + eventListener.onEvent(openEvent); + } +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTabRowRenderer.java similarity index 97% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTabRowRenderer.java index b41caae61b..95f4d3bf01 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTabRowRenderer.java @@ -10,7 +10,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * *****************************************************************************/ -package org.adempiere.webui.component; +package org.adempiere.webui.adwindow; import java.sql.Timestamp; import java.text.SimpleDateFormat; @@ -23,6 +23,9 @@ import java.util.Map.Entry; import org.adempiere.util.GridRowCtx; import org.adempiere.webui.apps.AEnv; +import org.adempiere.webui.component.Checkbox; +import org.adempiere.webui.component.EditorBox; +import org.adempiere.webui.component.NumberBox; import org.adempiere.webui.editor.WButtonEditor; import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditorPopupMenu; @@ -30,10 +33,8 @@ import org.adempiere.webui.editor.WebEditorFactory; import org.adempiere.webui.event.ActionEvent; import org.adempiere.webui.event.ActionListener; import org.adempiere.webui.event.ContextMenuListener; -import org.adempiere.webui.panel.AbstractADWindowPanel; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.util.GridTabDataBinder; -import org.adempiere.webui.window.ADWindow; import org.compiere.model.GridField; import org.compiere.model.GridTab; import org.compiere.util.DisplayType; @@ -80,12 +81,12 @@ public class GridTabRowRenderer implements RowRenderer, RowRendererExt private RowListener rowListener; private Grid grid = null; - private GridPanel gridPanel = null; + private GridView gridPanel = null; private Row currentRow; private Object[] currentValues; private boolean editing = false; private int currentRowIndex = -1; - private AbstractADWindowPanel m_windowPanel; + private AbstractADWindowContent m_windowPanel; /** * @@ -122,7 +123,7 @@ public class GridTabRowRenderer implements RowRenderer, RowRendererExt Object window = SessionManager.getAppDesktop().findWindow(windowNo); if (window != null && window instanceof ADWindow) { - AbstractADWindowPanel windowPanel = ((ADWindow)window).getADWindowPanel(); + AbstractADWindowContent windowPanel = ((ADWindow)window).getADWindowContent(); ((WButtonEditor)editor).addActionListener(windowPanel); } } @@ -625,7 +626,7 @@ public class GridTabRowRenderer implements RowRenderer, RowRendererExt * * @param gridPanel */ - public void setGridPanel(GridPanel gridPanel) { + public void setGridPanel(GridView gridPanel) { this.gridPanel = gridPanel; } @@ -664,7 +665,7 @@ public class GridTabRowRenderer implements RowRenderer, RowRendererExt /** * @param windowPanel */ - public void setADWindowPanel(AbstractADWindowPanel windowPanel) { + public void setADWindowPanel(AbstractADWindowContent windowPanel) { this.m_windowPanel = windowPanel; } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridTableListModel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTableListModel.java similarity index 95% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridTableListModel.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTableListModel.java index c9dcc14cb4..0aba293355 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridTableListModel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridTableListModel.java @@ -10,7 +10,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * *****************************************************************************/ -package org.adempiere.webui.component; +package org.adempiere.webui.adwindow; import java.util.Comparator; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridView.java similarity index 84% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridPanel.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridView.java index 3185093d0f..f390e76f0b 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/GridView.java @@ -10,7 +10,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * *****************************************************************************/ -package org.adempiere.webui.component; +package org.adempiere.webui.adwindow; import java.util.ArrayList; import java.util.Collections; @@ -22,11 +22,14 @@ import java.util.Map; import javax.swing.table.AbstractTableModel; import org.adempiere.model.MTabCustomization; -import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.apps.AEnv; +import org.adempiere.webui.component.Borderlayout; +import org.adempiere.webui.component.Columns; +import org.adempiere.webui.component.EditorBox; +import org.adempiere.webui.component.Grid; +import org.adempiere.webui.component.NumberBox; import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.event.TouchEventHelper; -import org.adempiere.webui.panel.AbstractADWindowPanel; import org.adempiere.webui.util.SortComparator; import org.compiere.model.GridField; import org.compiere.model.GridTab; @@ -34,6 +37,8 @@ import org.compiere.model.GridTable; import org.compiere.model.MSysConfig; import org.compiere.util.DisplayType; import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.Util; import org.zkoss.zk.au.out.AuFocus; import org.zkoss.zk.au.out.AuScript; import org.zkoss.zk.ui.AbstractComponent; @@ -42,14 +47,14 @@ 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.util.Clients; -import org.zkoss.zul.Borderlayout; import org.zkoss.zul.Center; import org.zkoss.zul.Frozen; -import org.zkoss.zul.South; import org.zkoss.zul.Column; import org.zkoss.zul.Div; +import org.zkoss.zul.North; import org.zkoss.zul.Paging; import org.zkoss.zul.Row; +import org.zkoss.zul.Vbox; import org.zkoss.zul.event.ZulEvents; /** @@ -57,8 +62,12 @@ import org.zkoss.zul.event.ZulEvents; * @author Low Heng Sin * */ -public class GridPanel extends Borderlayout implements EventListener +public class GridView extends Vbox implements EventListener { + private static final int DEFAULT_DETAIL_PAGE_SIZE = 10; + + private static final int DEFAULT_PAGE_SIZE = 50; + /** * generated serial version ID */ @@ -74,7 +83,7 @@ public class GridPanel extends Borderlayout implements EventListener private Grid listbox = null; - private int pageSize = 100; + private int pageSize = DEFAULT_PAGE_SIZE; private GridField[] gridField; private AbstractTableModel tableModel; @@ -93,19 +102,23 @@ public class GridPanel extends Borderlayout implements EventListener private GridTabRowRenderer renderer; - private South south; + private Div gridFooter; private boolean modeless = true; private String columnOnClick; - private AbstractADWindowPanel windowPanel; + private AbstractADWindowContent windowPanel; private boolean refreshing; private Map columnWidthMap; - public GridPanel() + private Component detail; + + private Borderlayout borderLayout; + + public GridView() { this(0); } @@ -113,14 +126,29 @@ public class GridPanel extends Borderlayout implements EventListener /** * @param windowNo */ - public GridPanel(int windowNo) + public GridView(int windowNo) { this.windowNo = windowNo; - listbox = new Grid(); - listbox.addEventListener(ZulEvents.ON_AFTER_RENDER, this); - south = new South(); - this.appendChild(south); + createListbox(); + this.setHflex("1"); + + gridFooter = new Div(); + gridFooter.setHflex("1"); + gridFooter.setVflex("0"); + + borderLayout = new Borderlayout(); + borderLayout.setStyle("position: absolute; height: 100%; width: 100%;"); + appendChild(borderLayout); + Center center = new Center(); + borderLayout.appendChild(center); + North north = new North(); + north.setVflex("min"); + borderLayout.appendChild(north); + + borderLayout.appendCenter(listbox); + borderLayout.appendNorth(gridFooter); + //default paging size if (AEnv.isTablet()) { @@ -129,7 +157,7 @@ public class GridPanel extends Borderlayout implements EventListener } else { - pageSize = MSysConfig.getIntValue(MSysConfig.ZK_PAGING_SIZE, 100); + pageSize = MSysConfig.getIntValue(MSysConfig.ZK_PAGING_SIZE, 50); } //default true for better UI experience @@ -137,6 +165,51 @@ public class GridPanel extends Borderlayout implements EventListener } + protected void createListbox() { + listbox = new Grid(); + listbox.setEmptyMessage(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "FindZeroRecords"))); + listbox.addEventListener(ZulEvents.ON_AFTER_RENDER, this); + listbox.setSizedByContent(true); + listbox.setVflex("1"); + listbox.setHflex("1"); + } + + public void setDetailPaneMode(boolean detailPaneMode, boolean vflex) { + if (detailPaneMode) { + pageSize = DEFAULT_DETAIL_PAGE_SIZE; + updatePaging(); + if (borderLayout.getParent() != null) { + listbox.detach(); + gridFooter.detach(); + borderLayout.detach(); + appendChild(listbox); + appendChild(gridFooter); + } + //false work for header form, true work for header grid + listbox.setVflex(vflex); + this.setVflex(Boolean.toString(vflex)); + } else { + pageSize = MSysConfig.getIntValue(MSysConfig.ZK_PAGING_SIZE, 50); + updatePaging(); + if (borderLayout.getParent() == null) { + listbox.detach(); + gridFooter.detach(); + appendChild(borderLayout); + borderLayout.appendCenter(listbox); + borderLayout.appendNorth(gridFooter); + } + listbox.setVflex("true"); + this.setVflex("true"); + } + } + + private void updatePaging() { + if (paging != null && paging.getPageSize() != pageSize) { + paging.setPageSize(pageSize); + updateModel(); + } + } + /** * * @param gridTab @@ -260,6 +333,10 @@ public class GridPanel extends Borderlayout implements EventListener if (pageSize > 0) { if (paging.getTotalSize() != gridTab.getRowCount()) paging.setTotalSize(gridTab.getRowCount()); + if (paging.getPageCount() > 1 && !gridFooter.isVisible()) { + gridFooter.setVisible(true); + borderLayout.invalidate(); + } int pgIndex = rowIndex >= 0 ? rowIndex % pageSize : 0; int pgNo = rowIndex >= 0 ? (rowIndex - pgIndex) / pageSize : 0; if (listModel.getPage() != pgNo) { @@ -282,6 +359,11 @@ public class GridPanel extends Borderlayout implements EventListener if (paging.getActivePage() != pgNo) { paging.setActivePage(pgNo); } + if (paging.getPageCount() == 1) { + gridFooter.setVisible(false); + } else { + gridFooter.setVisible(true); + } if (rowIndex >= 0 && pgIndex >= 0) { Events.echoEvent("onPostSelectedRowChanged", this, null); } @@ -389,36 +471,29 @@ public class GridPanel extends Borderlayout implements EventListener private void render() { - LayoutUtils.addSclass("adtab-grid-panel", this); - - listbox.setVflex(true); - //true might looks better, false for better performance - listbox.setSizedByContent(false); listbox.addEventListener(Events.ON_CLICK, this); updateModel(); - Center center = new Center(); - center.appendChild(listbox); - if (AEnv.isTablet()) { - LayoutUtils.addSclass("tablet-scrolling", center); - } - this.appendChild(center); - if (pageSize > 0) { paging = new Paging(); paging.setPageSize(pageSize); paging.setTotalSize(tableModel.getRowCount()); paging.setDetailed(true); - south.appendChild(paging); - south.setSclass("adtab-grid-south"); + gridFooter.appendChild(paging); + gridFooter.setSclass("adtab-grid-south"); paging.addEventListener(ZulEvents.ON_PAGING, this); renderer.setPaging(paging); + if (paging.getPageCount() == 1) { + gridFooter.setVisible(false); + } else { + gridFooter.setVisible(true); + } } else { - south.setVisible(false); + gridFooter.setVisible(false); } if (AEnv.isTablet()) { @@ -531,8 +606,6 @@ public class GridPanel extends Borderlayout implements EventListener if (!isRowRendered(row, pgIndex)) { listbox.renderRow(row); } else { -// Row old = renderer.getCurrentRow(); -// int oldIndex = renderer.getCurrentRowIndex(); renderer.setCurrentRow(row); //remark: following 3 line cause the previously selected row being render twice // if (old != null && old != row && oldIndex >= 0 && oldIndex != gridTab.getCurrentRow()) @@ -556,8 +629,6 @@ public class GridPanel extends Borderlayout implements EventListener if (!isRowRendered(row, rowIndex)) { listbox.renderRow(row); } else { -// Row old = renderer.getCurrentRow(); -// int oldIndex = renderer.getCurrentRowIndex(); renderer.setCurrentRow(row); //remark: following 3 line cause the previously selected row being render twice // if (old != null && old != row && oldIndex >= 0 && oldIndex != gridTab.getCurrentRow()) @@ -758,7 +829,7 @@ public class GridPanel extends Borderlayout implements EventListener /** * @param winPanel */ - public void setADWindowPanel(AbstractADWindowPanel winPanel) { + public void setADWindowPanel(AbstractADWindowContent winPanel) { windowPanel = winPanel; if (renderer != null) renderer.setADWindowPanel(windowPanel); @@ -782,4 +853,25 @@ public class GridPanel extends Borderlayout implements EventListener public GridField[] getFields() { return gridField; } + + public void addDetails(Component component) { + detail = component; + borderLayout.appendSouth(detail); + borderLayout.getSouth().setCollapsible(true); + borderLayout.getSouth().setTitle(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Detail"))); + borderLayout.getSouth().setOpen(false); + borderLayout.getSouth().setHeight("250px"); + } + + public Component removeDetails() { + Component details = null; + if (detail != null) { + if (detail.getParent() != null) { + detail.detach(); + details = detail; + } + detail = null; + } + return details; + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/IADTab.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/IADTabbox.java similarity index 72% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/IADTab.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/IADTabbox.java index c40255e03d..71c938432f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/IADTab.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/IADTabbox.java @@ -10,14 +10,12 @@ * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * *****************************************************************************/ -package org.adempiere.webui.component; +package org.adempiere.webui.adwindow; -import org.adempiere.webui.panel.AbstractADWindowPanel; -import org.adempiere.webui.panel.IADTabpanel; import org.adempiere.webui.part.UIPart; import org.compiere.model.DataStatusEvent; import org.compiere.model.GridTab; -import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; /** @@ -25,7 +23,7 @@ import org.zkoss.zk.ui.event.EventListener; * @author Low Heng Sin * */ -public interface IADTab extends UIPart { +public interface IADTabbox extends UIPart { /** * @@ -91,17 +89,7 @@ public interface IADTab extends UIPart { * * @param listener */ - public void addSelectionEventListener(EventListener listener); - - /** - * @return tab selection component - */ - public Component getTabSelectionComponent(); - - /** - * @return boolean - */ - public boolean isUseExternalSelection(); + public void setSelectionEventListener(EventListener listener); /** * @param index @@ -109,18 +97,6 @@ public interface IADTab extends UIPart { */ public IADTabpanel getADTabpanel(int index); - /** - * constant for tab placement - */ - public final int LEFT = 0; - public final int RIGHT = 1; - - /** - * Set tab placement ( left or right ) - * @param tabPlacement - */ - public void setTabplacement(int tabPlacement); - /** * @param gTab * @return IADTabpanel or null if not found @@ -131,5 +107,29 @@ public interface IADTab extends UIPart { * * @param abstractADWindowPanel */ - public void setADWindowPanel(AbstractADWindowPanel abstractADWindowPanel); + public void setADWindowPanel(AbstractADWindowContent abstractADWindowPanel); + + public void onDetailRecord(); + + public void onParentRecord(); + + public boolean isSortTab(); + + public boolean needSave(boolean rowChange, boolean onlyRealChange); + + public void dataIgnore(); + + public GridTab getSelectedGridTab(); + + public boolean dataSave(boolean onSaveEvent); + + public void refresh(); + + public void setDetailPaneStatusMessage(String status, boolean error); + + IADTabpanel getSelectedDetailADTabpanel(); + + IADTabpanel getDirtyADTabpanel(); + + public void updateDetailPaneToolbar(boolean changed, boolean readOnly); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/IADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/IADTabpanel.java similarity index 88% rename from org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/IADTabpanel.java rename to org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/IADTabpanel.java index 655b0b8c8c..c44f2633a1 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/IADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/IADTabpanel.java @@ -10,7 +10,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * *****************************************************************************/ -package org.adempiere.webui.panel; +package org.adempiere.webui.adwindow; import org.compiere.model.GridTab; import org.compiere.util.Evaluatee; @@ -101,4 +101,13 @@ public interface IADTabpanel extends Component, Evaluatee { * @return true if the event is process */ public boolean onEnterKey(); + + /** + * @return boolean + */ + public boolean isGridView(); + + public boolean isActive(); + + public void setDetailPaneMode(boolean detailMode, boolean vflex); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/StatusBar.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/StatusBar.java new file mode 100644 index 0000000000..1829958c3c --- /dev/null +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/StatusBar.java @@ -0,0 +1,90 @@ +/****************************************************************************** +. * Product: Posterita Ajax UI * + * Copyright (C) 2007 Posterita Ltd. All Rights Reserved. * + * This program is free software; you can redistribute it and/or modify it * + * under the terms version 2 of the GNU General Public License as published * + * by the Free Software Foundation. This program is distributed in the hope * + * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * + * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * See the GNU General Public License for more details. * + * You should have received a copy of the GNU General Public License along * + * with this program; if not, write to the Free Software Foundation, Inc., * + * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * + * For the text or an alternative of this public license, you may reach us * + * Posterita Ltd., 3, Draper Avenue, Quatre Bornes, Mauritius * + * or via info@posterita.org or http://www.posterita.org/ * + *****************************************************************************/ + +package org.adempiere.webui.adwindow; + +import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.component.Label; +import org.adempiere.webui.component.Panel; +import org.zkoss.zul.Cell; +import org.zkoss.zul.Div; +import org.zkoss.zul.Hbox; +import org.zkoss.zul.Vbox; + +/** + * This class is based on org.compiere.apps.StatusBar written by Jorg Janke. + * @author Jorg Janke + * + * @author Ashley G Ramdass + * @date Mar 12, 2007 + * @version $Revision: 0.10 $ + */ +public class StatusBar extends Panel +{ + /** + * + */ + private static final long serialVersionUID = -3262889055635240201L; + + private Label infoLine; + + private Div west; + + public StatusBar() + { + super(); + init(); + } + + private void init() + { + Hbox hbox = new Hbox(); + hbox.setWidth("100%"); + hbox.setHeight("100%"); + hbox.setHflex("1"); + hbox.setPack("center"); + Cell leftCell = new Cell(); + hbox.appendChild(leftCell); + leftCell.setWidth("100%"); + + infoLine = new Label(); + + west = new Div(); + west.setStyle("text-align: left; "); + west.appendChild(infoLine); + Vbox vbox = new Vbox(); + vbox.setPack("center"); + LayoutUtils.addSclass("status", vbox); + vbox.appendChild(west); + leftCell.appendChild(vbox); + + this.appendChild(hbox); + + } + + /** + * Set Info Line + * @param text text + */ + public void setInfo (String text) + { + infoLine.setValue(text != null ? text : ""); + infoLine.setTooltiptext(text); + infoLine.setStyle("font-weight: bold;"); + } // setInfo + +} diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ADButtonTabList.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ADButtonTabList.java deleted file mode 100644 index 8eee630b9e..0000000000 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/ADButtonTabList.java +++ /dev/null @@ -1,179 +0,0 @@ -/****************************************************************************** - * Copyright (C) 2008 Low Heng Sin * - * Copyright (C) 2009 Idalica Corporation * - * This program is free software; you can redistribute it and/or modify it * - * under the terms version 2 of the GNU General Public License as published * - * by the Free Software Foundation. This program is distributed in the hope * - * that it will be useful, but WITHOUT ANY WARRANTY; without even the implied * - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along * - * with this program; if not, write to the Free Software Foundation, Inc., * - * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. * - *****************************************************************************/ -package org.adempiere.webui.component; - -import java.util.ArrayList; -import java.util.List; - -import org.adempiere.webui.AdempiereIdGenerator; -import org.adempiere.webui.component.ADTabListModel.ADTabLabel; -import org.zkoss.zhtml.Button; -import org.zkoss.zhtml.Text; -import org.zkoss.zk.ui.Component; -import org.zkoss.zk.ui.event.Event; -import org.zkoss.zk.ui.event.EventListener; -import org.zkoss.zk.ui.event.Events; - -/** - * - * @author Low Heng Sin - * - */ -public class ADButtonTabList extends Panel implements IADTabList, EventListener { - - /** - * - */ - private static final long serialVersionUID = -9203013067784673646L; - private List listItems = new ArrayList(); - private List listeners = new ArrayList(); - private IADTab tabbox; - private int selectedIndex = 0; - private int tabPlacement = IADTab.LEFT; - - public ADButtonTabList() { - this.setStyle("margin:0;padding:0"); - } - - /** - * Set tab placement ( left or right ) - * @param tabPlacement - */ - public void setTabplacement(int tabPlacement) { - if (tabPlacement != IADTab.LEFT && tabPlacement != IADTab.RIGHT) - return; - else if (tabPlacement == this.tabPlacement) - return; - else { - this.tabPlacement = tabPlacement; - this.invalidate(); - } - } - - public synchronized void refresh() { - List childs = getChildren(); - int childCount = childs.size(); - for (int c = childCount - 1; c >=0; c--) { - removeChild((Component) childs.get(c)); - } - Object[] items = listItems.toArray(); - int tabWidth = 100; - List