From 04cc7208f94f77c616dde6cf931a382fa035820b Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 9 Jul 2008 13:07:13 +0000 Subject: [PATCH] * Upgrade to ZK 3.0.6 * New login dialog. * New desktop layout ( tested only on FF3 and IE 7 ). * Support for Attachment. * Support for Field Group. * Modification to form layout to align closer to swing client. * Support for hierarchical tab. * Added role info dialog. * Added about dialog, Posterita highlighted as the initial contributor. * Support for grid toggle for each tab. No editable grid support for now but you can double click on grid row to switch to single row edit mode. --- extension/posterita/webui/.classpath | 19 +- extension/posterita/webui/.project | 1 + .../org/adempiere/webui/AdempiereWebUI.java | 89 +- .../src/org/adempiere/webui/Desktop.java | 189 +- .../src/org/adempiere/webui/IDesktop.java | 29 + .../src/org/adempiere/webui/IWebClient.java | 11 + .../src/org/adempiere/webui/LayoutUtils.java | 36 + .../src/org/adempiere/webui/WLogin.java | 54 +- .../org/adempiere/webui/acct/WAcctViewer.java | 7 +- .../src/org/adempiere/webui/apps/AEnv.java | 5 +- .../webui/apps/form/WAllocation.java | 12 +- .../webui/apps/form/WTrxMaterial.java | 14 +- .../webui/component/ADButtonTabList.java | 98 + .../webui/component/ADTabListModel.java | 68 + .../{FTabbox.java => AbstractADTab.java} | 187 +- .../webui/component/CWindowToolbar.java | 160 +- .../webui/component/CompositeADTab.java | 151 + .../adempiere/webui/component/FTabpanels.java | 49 - .../adempiere/webui/component/GridPanel.java | 245 +- .../webui/component/GridTableListModel.java | 154 + .../org/adempiere/webui/component/IADTab.java | 41 + .../adempiere/webui/component/IADTabList.java | 16 + .../adempiere/webui/component/Messagebox.java | 13 +- .../org/adempiere/webui/component/Tab.java | 6 + .../org/adempiere/webui/component/Tabbox.java | 18 + .../adempiere/webui/component/Tabpanel.java | 45 + .../webui/component/ToolBarButton.java | 26 + .../webui/constants/Constraints.java | 40 - .../webui/constants/EventConstants.java | 34 - .../org/adempiere/webui/editor/WEditor.java | 1 - .../webui/event/ToolbarListener.java | 2 - .../src/org/adempiere/webui/panel/ADForm.java | 5 + .../org/adempiere/webui/panel/ADTabpanel.java | 267 +- .../adempiere/webui/panel/ADWindowPanel.java | 1148 +------- .../webui/panel/AbstractADWindowPanel.java | 1182 ++++++++ .../adempiere/webui/panel/HeaderPanel.java | 83 +- .../webui/panel/ITabOnCloseHandler.java | 7 + .../org/adempiere/webui/panel/LoginPanel.java | 14 + .../org/adempiere/webui/panel/MenuPanel.java | 60 +- .../org/adempiere/webui/panel/RolePanel.java | 15 + .../org/adempiere/webui/panel/SidePanel.java | 70 +- .../adempiere/webui/panel/SideUserPanel.java | 59 - .../org/adempiere/webui/panel/UserPanel.java | 109 +- .../adempiere/webui/panel/WAttachment.java | 217 +- .../webui/panel/WDocActionPanel.java | 3 +- .../adempiere/webui/part/AbstractUIPart.java | 28 + .../MainPanel.java => part/MultiTabPart.java} | 82 +- .../src/org/adempiere/webui/part/UIPart.java | 11 + .../adempiere/webui/part/WindowContainer.java | 141 + .../webui/session/SessionContextListener.java | 2 +- .../webui/session/SessionManager.java | 14 +- .../org/adempiere/webui/window/ADWindow.java | 56 +- .../adempiere/webui/window/AboutWindow.java | 94 + .../adempiere/webui/window/FindWindow.java | 15 +- .../adempiere/webui/window/LoginWindow.java | 8 +- .../src/org/zkoss/zk/ui/Executions.java | 558 ---- .../org/zkoss/zk/ui/sys/ExecutionsCtrl.java | 53 - .../webui/WEB-INF/tld/web/core.dsp.tld | 61 +- .../webui/WEB-INF/tld/web/html.dsp.tld | 1 + .../webui/WEB-INF/tld/zk/core.dsp.tld | 86 +- .../webui/WEB-INF/tld/zul/core.dsp.tld | 54 +- extension/posterita/webui/WEB-INF/xsd/zul.xsd | 2477 +++++++++++++++++ extension/posterita/webui/WEB-INF/zk.xml | 9 +- extension/posterita/webui/build.xml | 2 +- extension/posterita/webui/css/default.css.dsp | 220 ++ .../posterita/webui/images/gradient-bg.gif | Bin 0 -> 1472 bytes .../posterita/webui/images/ns-collapse.gif | Bin 0 -> 842 bytes .../posterita/webui/images/ns-expand.gif | Bin 0 -> 843 bytes extension/posterita/webui/index.zul | 7 +- extension/posterita/webui/js/layout.js | 14 + 70 files changed, 6215 insertions(+), 2837 deletions(-) create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/IDesktop.java create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/IWebClient.java create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/LayoutUtils.java create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/ADButtonTabList.java create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/ADTabListModel.java rename extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/{FTabbox.java => AbstractADTab.java} (60%) create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/CompositeADTab.java delete mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/FTabpanels.java create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/GridTableListModel.java create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/IADTab.java create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/IADTabList.java delete mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/constants/Constraints.java delete mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/constants/EventConstants.java create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java delete mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SideUserPanel.java create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/AbstractUIPart.java rename extension/posterita/webui/WEB-INF/src/org/adempiere/webui/{panel/MainPanel.java => part/MultiTabPart.java} (63%) create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/UIPart.java create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java create mode 100644 extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java delete mode 100644 extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/Executions.java delete mode 100644 extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/sys/ExecutionsCtrl.java create mode 100644 extension/posterita/webui/WEB-INF/xsd/zul.xsd create mode 100644 extension/posterita/webui/css/default.css.dsp create mode 100644 extension/posterita/webui/images/gradient-bg.gif create mode 100644 extension/posterita/webui/images/ns-collapse.gif create mode 100644 extension/posterita/webui/images/ns-expand.gif create mode 100644 extension/posterita/webui/js/layout.js diff --git a/extension/posterita/webui/.classpath b/extension/posterita/webui/.classpath index 0cee7295dd..97568bcd9c 100644 --- a/extension/posterita/webui/.classpath +++ b/extension/posterita/webui/.classpath @@ -4,14 +4,21 @@ - - - - - + + + - + + + + + + + + + + diff --git a/extension/posterita/webui/.project b/extension/posterita/webui/.project index fb18fa5cd5..666f6004c4 100644 --- a/extension/posterita/webui/.project +++ b/extension/posterita/webui/.project @@ -13,5 +13,6 @@ org.eclipse.jdt.core.javanature + com.sysdeo.eclipse.tomcat.tomcatnature diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java index 05664f566f..153ecc2048 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/AdempiereWebUI.java @@ -26,11 +26,16 @@ import org.compiere.model.MSession; import org.compiere.util.Env; import org.compiere.util.Language; import org.zkoss.zk.ui.Executions; +import org.zkoss.zk.ui.Page; import org.zkoss.zk.ui.Session; import org.zkoss.zk.ui.event.ClientInfoEvent; 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.impl.ExecutionCarryOver; +import org.zkoss.zk.ui.sys.ExecutionCtrl; +import org.zkoss.zk.ui.sys.ExecutionsCtrl; +import org.zkoss.zk.ui.sys.Visualizer; import org.zkoss.zul.Window; /** @@ -39,7 +44,7 @@ import org.zkoss.zul.Window; * @date Feb 25, 2007 * @version $Revision: 0.10 $ */ -public class AdempiereWebUI extends Window implements EventListener +public class AdempiereWebUI extends Window implements EventListener, IWebClient { private static final long serialVersionUID = 1L; @@ -58,7 +63,9 @@ public class AdempiereWebUI extends Window implements EventListener public AdempiereWebUI() { this.addEventListener(Events.ON_CLIENT_INFO, this); + this.setVisible(false); } + public void onCreate() { this.getPage().setTitle(APP_NAME); @@ -69,12 +76,12 @@ public class AdempiereWebUI extends Window implements EventListener if (!SessionManager.isUserLoggedIn(ctx)) { loginDesktop = new WLogin(this); - this.appendChild(loginDesktop); + loginDesktop.createPart(this.getPage()); } else { loginCompleted(); - } + } } public void onOk() @@ -85,40 +92,77 @@ public class AdempiereWebUI extends Window implements EventListener { } + /* (non-Javadoc) + * @see org.adempiere.webui.IWebClient#loginCompleted() + */ public void loginCompleted() { - loginDesktop = null; - this.getChildren().clear(); - + if (loginDesktop != null) + { + loginDesktop.detach(); + loginDesktop = null; + } + Properties ctx = Env.getCtx(); String langLogin = Env.getContext(ctx, Env.LANGUAGE); if (langLogin == null || langLogin.length() <= 0) { langLogin = langSession; Env.setContext(ctx, Env.LANGUAGE, langSession); } + // Validate language Language language = Language.getLanguage(langLogin); Env.verifyLanguage(ctx, language); - Env.setContext(ctx, Env.LANGUAGE, language.getAD_Language()); //Bug - - - appDesktop = new Desktop(); - appDesktop.setParent(this); - appDesktop.setClientInfo(clientInfo); - - this.setWidth("100%"); - this.setHeight("100%"); - this.appendChild(appDesktop); - + Env.setContext(ctx, Env.LANGUAGE, language.getAD_Language()); //Bug // Create adempiere Session - user id in ctx Session currSess = Executions.getCurrent().getDesktop().getSession(); HttpSession httpSess = (HttpSession) currSess.getNativeSession(); - MSession.get (ctx, currSess.getClientAddr(), - currSess.getClientHost(), httpSess.getId() ); + MSession.get (ctx, currSess.getRemoteAddr(), + currSess.getRemoteHost(), httpSess.getId() ); + + IDesktop d = (IDesktop) currSess.getAttribute("application.desktop"); + if (d != null && d instanceof Desktop) + { + ExecutionCarryOver eco = (ExecutionCarryOver) currSess.getAttribute("execution.carryover"); + if (eco != null) { + appDesktop = (Desktop) d; + + ExecutionCarryOver current = new ExecutionCarryOver(this.getPage().getDesktop()); + ExecutionCtrl ctrl = ExecutionsCtrl.getCurrentCtrl(); + Visualizer vi = ctrl.getVisualizer(); + eco.carryOver(); + ctrl = ExecutionsCtrl.getCurrentCtrl(); + ctrl.setVisualizer(vi); + + appDesktop.getComponent().detach(); + + eco.cleanup(); + + current.carryOver(); + + appDesktop.getComponent().setPage(this.getPage()); + + currSess.setAttribute("execution.carryover", current); + + } + } + + if (appDesktop == null) + { + appDesktop = new Desktop(); + appDesktop.setClientInfo(clientInfo); + appDesktop.createPart(this.getPage()); + currSess.setAttribute("application.desktop", appDesktop); + ExecutionCarryOver eco = new ExecutionCarryOver(this.getPage().getDesktop()); + currSess.setAttribute("execution.carryover", eco); + } } + /* (non-Javadoc) + * @see org.adempiere.webui.IWebClient#logout() + */ public void logout() { MSession mSession = MSession.get(Env.getCtx(), false); @@ -128,17 +172,20 @@ public class AdempiereWebUI extends Window implements EventListener SessionManager.clearSession(); super.getChildren().clear(); - loginDesktop = new WLogin(this); - super.appendChild(loginDesktop); + Page page = this.getPage(); + page.removeComponents(); + Executions.sendRedirect("index.zul"); } public Desktop getAppDeskop() { return appDesktop; } + public boolean isAsap() { return true; } + public void onEvent(Event event) { if (event instanceof ClientInfoEvent) { ClientInfoEvent c = (ClientInfoEvent)event; diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/Desktop.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/Desktop.java index 6988d4823c..1d641e2594 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/Desktop.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/Desktop.java @@ -17,98 +17,116 @@ package org.adempiere.webui; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import org.adempiere.webui.apps.ProcessDialog; -import org.adempiere.webui.component.VerticalBox; +import org.adempiere.webui.component.Tabpanel; import org.adempiere.webui.component.Window; import org.adempiere.webui.event.MenuListener; import org.adempiere.webui.exception.ApplicationException; import org.adempiere.webui.panel.ADForm; -import org.adempiere.webui.panel.FooterPanel; import org.adempiere.webui.panel.HeaderPanel; -import org.adempiere.webui.panel.MainPanel; import org.adempiere.webui.panel.SidePanel; +import org.adempiere.webui.part.AbstractUIPart; +import org.adempiere.webui.part.WindowContainer; import org.adempiere.webui.window.ADWindow; import org.compiere.model.MClient; import org.compiere.model.MMenu; import org.compiere.model.MQuery; -import org.compiere.model.MSysConfig; -import org.compiere.util.CCache; import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.WebDoc; import org.zkoss.util.media.AMedia; -import org.zkoss.zul.Hbox; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.Page; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.North; +import org.zkoss.zkex.zul.West; import org.zkoss.zul.Iframe; +import org.zkoss.zul.Label; /** * * @author Ashley G Ramdass + * @author Low Heng Sin * @date Mar 2, 2007 * @version $Revision: 0.10 $ */ -public class Desktop extends Window implements MenuListener +public class Desktop extends AbstractUIPart implements MenuListener, Serializable, IDesktop { + private static final long serialVersionUID = 9056511175189603883L; private static final CLogger logger = CLogger.getCLogger(Desktop.class); - private HeaderPanel pnlHead; + private transient ClientInfo clientInfo; - private SidePanel pnlSide; + private List windows; + + private Center windowArea; - private MainPanel pnlMain; + private Borderlayout layout; - private FooterPanel pnlFooter; - - private ClientInfo clientInfo; - - private List windows; - - private CCache windowCache; + private WindowContainer windowContainer; public Desktop() { - windows = new ArrayList(); - windowCache = new CCache("ZKWindowCache", 20); - windowCache.setExpireMinutes(10); // Remove the cached window after 10 mins - init(); + windows = new ArrayList(); } - - private void init() + + protected Component doCreatePart(Component parent) { - pnlSide = new SidePanel(); - pnlMain = new MainPanel(); - pnlFooter = new FooterPanel(); - pnlHead = new HeaderPanel(); + SidePanel pnlSide = new SidePanel(); + HeaderPanel pnlHead = new HeaderPanel(); pnlSide.getMenuPanel().addMenuListener(this); - VerticalBox verticalBox = new VerticalBox(); - verticalBox.setWidth("1200px"); + layout = new Borderlayout(); + if (parent != null) + layout.setParent(parent); + else + layout.setPage(page); - Hbox hbox = new Hbox(); + North n = new North(); + layout.appendChild(n); + n.setCollapsible(false); + pnlHead.setParent(n); - hbox.setWidth("1200px"); - hbox.setWidths("300px, 900px"); - hbox.appendChild(pnlSide); - hbox.appendChild(pnlMain); + West w = new West(); + layout.appendChild(w); + w.setWidth("300px"); + w.setCollapsible(true); + w.setSplittable(true); +// w.setAutoscroll(true); + pnlSide.setParent(w); + + windowArea = new Center(); + windowArea.setParent(layout); + windowArea.setFlex(true); +// windowArea.setAutoscroll(true); + windowContainer = new WindowContainer(); + windowContainer.createPart(windowArea); - String homeURL = MSysConfig.getValue("WEBUI_HOMEURL", "http://www.adempiere.com/"); - showURL(homeURL, "Home", false); + createHomeTab(); - verticalBox.appendChild(pnlHead); - verticalBox.appendChild(hbox); - - //this.setBorder("normal"); - this.setStyle("background-color: #FAFAFA"); - //this.setWidth("100%"); - //this.setHeight("100%"); - this.appendChild(verticalBox); + return layout; } + + private void createHomeTab() { + //TODO: dashboard + Tabpanel homeTab = new Tabpanel(); + windowContainer.addWindow(homeTab, "Home", false); + Label t = new Label(); + t.setValue("My Home!"); + t.setParent(homeTab); + + //register as 0 + registerWindow(homeTab); + } /** * Retrieves the Client website url @@ -118,8 +136,6 @@ public class Desktop extends Window implements MenuListener { MClient client = MClient.get(Env.getCtx()); String defaultUrl = "http://www.adempiere.com"; - - /* [ 1983672 ] Column AD_Client.WebSiteURL doesn't exist String url = (String)client.get_Value("WebSiteURL"); if (url == null) @@ -131,8 +147,6 @@ public class Desktop extends Window implements MenuListener logger.log(Level.SEVERE, "Website URL provided for the client is not valid!!!"); url = defaultUrl; } - */ - String url = defaultUrl; return url; } @@ -158,20 +172,18 @@ public class Desktop extends Window implements MenuListener if(menu.getAction().equals(MMenu.ACTION_Window)) { Integer wMenuId = Integer.valueOf(menu.getAD_Window_ID()); - ADWindow wndMain = windowCache.get(wMenuId); - if (wndMain == null) - { - wndMain = new ADWindow(Env.getCtx(), menu.getAD_Window_ID()); - windowCache.put(wMenuId, wndMain); - } - pnlMain.addWindow(wndMain, wndMain.getTitle(), true); + ADWindow adWindow = new ADWindow(Env.getCtx(), menu.getAD_Window_ID()); + + Tabpanel tabPanel = new Tabpanel(); + adWindow.createPart(tabPanel); + windowContainer.addWindow(tabPanel, adWindow.getTitle(), true); } else if(menu.getAction().equals(MMenu.ACTION_Process) || menu.getAction().equals(MMenu.ACTION_Report)) { ProcessDialog pd = new ProcessDialog (menu.getAD_Process_ID(), menu.isSOTrx()); if (pd.isValid()) { - pd.setPage(this.getPage()); + pd.setPage(page); pd.setClosable(true); pd.setWidth("500px"); try { @@ -185,7 +197,10 @@ public class Desktop extends Window implements MenuListener else if(menu.getAction().equals(MMenu.ACTION_Form)) { Window form = ADForm.openForm(menu.getAD_Form_ID()); - pnlMain.addWindow(form, form.getTitle(), true); + + Tabpanel tabPanel = new Tabpanel(); + form.setParent(tabPanel); + windowContainer.addWindow(tabPanel, form.getTitle(), true); } else { @@ -193,7 +208,7 @@ public class Desktop extends Window implements MenuListener } } - public void showURL(String url, boolean closeable) + public void showURL(String url, boolean closeable) { showURL(url, url, closeable); } @@ -217,31 +232,40 @@ public class Desktop extends Window implements MenuListener private void addWin(Iframe fr, String title, boolean closeable) { fr.setWidth("100%"); - fr.setHeight("650px"); - Window wndUrl = new Window(); - //wndUrl.setHeight("650px"); - //wndUrl.setWidth("800px"); - wndUrl.appendChild(fr); - pnlMain.addWindow(wndUrl, title, closeable); + fr.setHeight("100%"); + fr.setStyle("padding: 0; margin: 0; border: none; position: absolute"); + Window window = new Window(); + window.setWidth("100%"); + window.setHeight("100%"); + window.setStyle("padding: 0; margin: 0; border: none"); + window.appendChild(fr); + window.setStyle("position: absolute"); + + Tabpanel tabPanel = new Tabpanel(); + window.setParent(tabPanel); + windowContainer.addWindow(tabPanel, title, closeable); } public void showZoomWindow(int AD_Window_ID, MQuery query) { ADWindow wnd = new ADWindow(Env.getCtx(), AD_Window_ID, query); - Window window = new Window(); - - window.appendChild(wnd); - window.setBorder("normal"); - pnlMain.addWindow(window,wnd.getTitle(),true); - + + Tabpanel tabPanel = new Tabpanel(); + wnd.createPart(tabPanel); + windowContainer.addWindow(tabPanel, wnd.getTitle(), false); } - public void showWindow(Window win) + public void showWindow(Window win) + { + String pos = win.getPosition(); + this.showWindow(win, pos); + } + + public void showWindow(Window win, String pos) { - win.setPage(this.getPage()); + win.setPage(page); Object objMode = win.getAttribute("mode"); - String pos = win.getPosition(); String mode = "modal"; @@ -271,7 +295,7 @@ public class Desktop extends Window implements MenuListener showHighlighted(win, pos); } - win.setVisible(true); +// win.setVisible(true); } public void showModal(Window win) @@ -335,7 +359,7 @@ public class Desktop extends Window implements MenuListener this.clientInfo = clientInfo; } - public int registerWindow(Window win) { + public int registerWindow(Object win) { int retValue = windows.size(); windows.add(win); return retValue; @@ -347,7 +371,7 @@ public class Desktop extends Window implements MenuListener } - public Window findWindow(int WindowNo) { + public Object findWindow(int WindowNo) { if (WindowNo < windows.size()) return windows.get(WindowNo); else @@ -356,6 +380,17 @@ public class Desktop extends Window implements MenuListener public void removeWindow() { - pnlMain.removeWindow(); + windowContainer.removeWindow(); + } + + public void setPage(Page page) { + if (this.page != page) { + layout.setPage(page); + this.page = page; + } + } + + public Component getComponent() { + return layout; } } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/IDesktop.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/IDesktop.java new file mode 100644 index 0000000000..5f9da4f603 --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/IDesktop.java @@ -0,0 +1,29 @@ +package org.adempiere.webui; + +import org.adempiere.webui.component.Window; +import org.compiere.model.MQuery; +import org.compiere.util.WebDoc; + +public interface IDesktop { + + public ClientInfo getClientInfo(); + + public void onMenuSelected(int nodeId); + + public int registerWindow(Object window); + + public void removeWindow(); + + public void showURL(String url, boolean closeable); + + public void showURL(WebDoc doc, String string, boolean closeable); + + public void showWindow(Window win); + + public void showWindow(Window win, String position); + + public void showZoomWindow(int window_ID, MQuery query); + + public void unregisterWindow(int windowNo); + +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/IWebClient.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/IWebClient.java new file mode 100644 index 0000000000..2ae7f7499b --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/IWebClient.java @@ -0,0 +1,11 @@ +package org.adempiere.webui; + +public interface IWebClient { + + public void loginCompleted(); + + public void logout(); + + public IDesktop getAppDeskop(); + +} \ No newline at end of file diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/LayoutUtils.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/LayoutUtils.java new file mode 100644 index 0000000000..40e413984e --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/LayoutUtils.java @@ -0,0 +1,36 @@ +package org.adempiere.webui; + +import org.zkoss.zk.au.out.AuScript; +import org.zkoss.zk.ui.HtmlBasedComponent; +import org.zkoss.zk.ui.util.Clients; +import org.zkoss.zkex.zul.Borderlayout; + +public final class LayoutUtils { + + /** + * @param layout + */ + public static void sendDeferLayoutEvent(Borderlayout layout, int timeout) { + StringBuffer content = new StringBuffer(); + content.append("ad_deferRenderBorderLayout('") + .append(layout.getUuid()) + .append("',").append(timeout).append(");"); + + AuScript as = new AuScript(null, content.toString()); + Clients.response("deferRenderBorderLayout", as); + } + + public static void addSclass(String cls, HtmlBasedComponent target) { + final String sclass = target.getSclass(); + if (!hasSclass(cls, target)) + target.setSclass(sclass == null ? cls : sclass + " " + cls); + } + + public static boolean hasSclass(String cls, HtmlBasedComponent target) { + String sclass = target.getSclass(); + if (sclass == null) + sclass = ""; + return cls == null + || ((" " + sclass + " ").indexOf(" " + cls + " ") > -1); + } +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/WLogin.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/WLogin.java index d052062841..78256d6b0d 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/WLogin.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/WLogin.java @@ -17,31 +17,65 @@ package org.adempiere.webui; -import org.adempiere.webui.component.Window; +import org.adempiere.webui.part.AbstractUIPart; import org.adempiere.webui.window.LoginWindow; +import org.zkoss.zk.ui.Component; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zul.Vbox; /** * * @author Ashley G Ramdass + * @author Low Heng Sin * @date Mar 3, 2007 * @version $Revision: 0.10 $ */ -public class WLogin extends Window +public class WLogin extends AbstractUIPart { private static final long serialVersionUID = 1L; - private AdempiereWebUI novita; - private LoginWindow loginWindow; + private IWebClient app; + private Borderlayout layout; - public WLogin(AdempiereWebUI novita) + public WLogin(IWebClient app) { - this.novita = novita; - init(); + this.app = app; } - private void init() + protected Component doCreatePart(Component parent) { - loginWindow = new LoginWindow(novita); - this.appendChild(loginWindow); + layout = new Borderlayout(); + if (parent != null) + layout.setParent(parent); + else + layout.setPage(page); + Center c = new Center(); + c.setParent(layout); + c.setBorder("none"); + c.setFlex(true); + c.setAutoscroll(true); + + Vbox vb = new Vbox(); + vb.setParent(c); + vb.setHeight("100%"); + vb.setWidth("100%"); + vb.setPack("center"); + vb.setAlign("center"); + LayoutUtils.addSclass("login", vb); + + LoginWindow loginWindow = new LoginWindow(app); + loginWindow.setParent(vb); + + return layout; } + + public void detach() { + layout.detach(); + layout = null; + } + + public Component getComponent() { + return layout; + } } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/acct/WAcctViewer.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/acct/WAcctViewer.java index 3f2ac0b606..d12cf1a36c 100755 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/acct/WAcctViewer.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/acct/WAcctViewer.java @@ -61,6 +61,7 @@ import org.zkoss.zul.Hbox; import org.zkoss.zul.Listcell; import org.zkoss.zul.Listhead; import org.zkoss.zul.Listheader; +import org.zkoss.zul.Listitem; import org.zkoss.zul.Separator; /** @@ -666,7 +667,7 @@ public class WAcctViewer extends Window implements EventListener private void actionAcctSchema() { - ListItem listitem = selAcctSchema.getSelectedItem(); + Listitem listitem = selAcctSchema.getSelectedItem(); KeyNamePair kp = null; @@ -765,7 +766,7 @@ public class WAcctViewer extends Window implements EventListener // Save Selection Choices - ListItem listitem = selAcctSchema.getSelectedItem(); + Listitem listitem = selAcctSchema.getSelectedItem(); KeyNamePair kp = null; @@ -973,7 +974,7 @@ public class WAcctViewer extends Window implements EventListener private void actionTable() { - ListItem listitem = selTable.getSelectedItem(); + Listitem listitem = selTable.getSelectedItem(); ValueNamePair vp = null; if (listitem != null) diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/apps/AEnv.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/apps/AEnv.java index 8f34147b72..1ba1d46526 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/apps/AEnv.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/apps/AEnv.java @@ -52,10 +52,7 @@ public final class AEnv */ public static void showCenterScreen(Window window) { - /* positionCenterScreen(window); - window.setVisible(true); - window.toFront(); - */ + SessionManager.getAppDesktop().showWindow(window, "center"); } // showCenterScreen /** diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java index 81ce82961d..5be0ef794c 100755 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/apps/form/WAllocation.java @@ -278,7 +278,7 @@ public class WAllocation extends ADForm implements EventListener, Hbox hbox = new Hbox(); // Put the table label at the top of this panel - hbox.setWidth("98%"); + hbox.setWidth("100%"); m_lblPayment.setValue(Msg.translate(Env.getCtx(), "C_Payment_ID")); hbox.setStyle("text-align:left"); hbox.appendChild(m_lblPayment); @@ -292,7 +292,7 @@ public class WAllocation extends ADForm implements EventListener, // Put the selected payment information just below the table and // right-align it hbox = new Hbox(); - hbox.setWidth("98%"); + hbox.setWidth("100%"); m_lblPaymentInfo.setValue("."); hbox.setStyle("text-align:right"); hbox.appendChild(m_lblPaymentInfo); @@ -312,7 +312,7 @@ public class WAllocation extends ADForm implements EventListener, Hbox hbox = new Hbox(); // Put the table label at the top of this panel - hbox.setWidth("98%"); + hbox.setWidth("100%"); m_lblInvoice.setValue(Msg.translate(Env.getCtx(), "C_Invoice_ID")); hbox.setStyle("text-align:left"); hbox.appendChild(m_lblInvoice); @@ -326,7 +326,7 @@ public class WAllocation extends ADForm implements EventListener, // Put the selected invoice information just below the table and // right-align it hbox = new Hbox(); - hbox.setWidth("98%"); + hbox.setWidth("100%"); m_lblInvoiceInfo.setValue("."); hbox.setStyle("text-align:right"); hbox.appendChild(m_lblInvoiceInfo); @@ -346,7 +346,7 @@ public class WAllocation extends ADForm implements EventListener, Vbox vbox = new Vbox(); Separator separator = new Separator(); - vbox.setWidth("98%"); + vbox.setWidth("100%"); vbox.setHeight("200px"); vbox.setHeights("45%,5%,45%"); @@ -501,7 +501,7 @@ public class WAllocation extends ADForm implements EventListener, this.appendChild(m_statusBar); - this.setWidth("850px"); +// this.setWidth("850px"); calculate(); diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/apps/form/WTrxMaterial.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/apps/form/WTrxMaterial.java index b6a74129c3..3406f20f74 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/apps/form/WTrxMaterial.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/apps/form/WTrxMaterial.java @@ -34,10 +34,15 @@ import java.util.logging.Level; import javax.swing.table.AbstractTableModel; import org.adempiere.webui.apps.AEnv; +import org.adempiere.webui.component.Column; +import org.adempiere.webui.component.Columns; import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.Datebox; +import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Panel; +import org.adempiere.webui.component.Row; +import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.VerticalBox; import org.adempiere.webui.component.WStatusBar; import org.adempiere.webui.editor.WEditor; @@ -62,11 +67,6 @@ import org.compiere.util.DisplayType; import org.compiere.util.Env; import org.compiere.util.Msg; import org.compiere.util.NamePair; -import org.zkforge.yuiext.grid.Column; -import org.zkforge.yuiext.grid.Columns; -import org.zkforge.yuiext.grid.Grid; -import org.zkforge.yuiext.grid.Row; -import org.zkforge.yuiext.grid.Rows; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; @@ -337,7 +337,7 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi for (int j = 0; j < tableModel.getColumnCount(); j++) { - org.zkforge.yuiext.grid.Label lab = new org.zkforge.yuiext.grid.Label(); + Label lab = new Label(); Label label = new Label(""); @@ -380,7 +380,7 @@ public class WTrxMaterial extends ADForm implements EventListener, ValueChangeLi label.setValue("Missing Class"); } - lab = new org.zkforge.yuiext.grid.Label(label.getValue()); + lab = new Label(label.getValue()); row.appendChild(lab); } rows.appendChild(row); diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/ADButtonTabList.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/ADButtonTabList.java new file mode 100644 index 0000000000..d05ed91743 --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/ADButtonTabList.java @@ -0,0 +1,98 @@ +package org.adempiere.webui.component; + +import java.util.ArrayList; +import java.util.List; + +import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.component.ADTabListModel.ADTabLabel; +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 List listItems = new ArrayList(); + private List listeners = new ArrayList(); + private IADTab tabbox; + private int selectedIndex = 0; + + public ADButtonTabList() { + this.setStyle("margin:0;padding:0"); + } + + public void refresh() { + this.getChildren().clear(); + int i = 0; + for (ADTabLabel tabLabel : listItems) { + Button button = new Button(); + button.setLabel(tabLabel.label); + int s = tabbox.getSelectedIndex(); + + if ( s == i) + LayoutUtils.addSclass("adwindow-navbtn-sel", button); + else { + if (!tabbox.canNavigateTo(s, i)) { + button.setDisabled(true); + LayoutUtils.addSclass("adwindow-navbtn-dis", button); + } else { + LayoutUtils.addSclass("adwindow-navbtn-uns", button); + } + } + + String style = "margin-left:" + (tabLabel.tabLevel*15+5) + "px"; + button.setStyle(style); + + button.setParent(this); + button.setWidth((195 - tabLabel.tabLevel*15)+"px"); + button.addEventListener(Events.ON_CLICK, this); + i++; + } + } + + public int getSelectedIndex() { + return selectedIndex; + } + + public void setSelectedIndex(int index) { + this.selectedIndex = index; + } + + public void setItems(List listItems) { + this.listItems = listItems; + refresh(); + } + + public void setADTab(IADTab adTab) { + this.tabbox = adTab; + } + + public void addSelectionEventListener(EventListener listener) { + listeners.add(listener); + } + + public boolean removeSelectionEventListener(EventListener listener) { + return listeners.remove(listener); + } + + public void onEvent(Event event) throws Exception { + Event selectEvent = new Event(Events.ON_SELECT, this); + Button button = (Button) event.getTarget(); + int i = 0; + for (ADTabLabel tabLabel : listItems) { + if (tabLabel.label.equals(button.getLabel())) { + break; + } + i++; + } + + selectedIndex = i; + for (EventListener listener : listeners) { + listener.onEvent(selectEvent); + } + } +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/ADTabListModel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/ADTabListModel.java new file mode 100644 index 0000000000..33354cffcc --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/ADTabListModel.java @@ -0,0 +1,68 @@ +package org.adempiere.webui.component; + +import java.util.List; + +import org.zkoss.zul.AbstractListModel; +import org.zkoss.zul.Listbox; +import org.zkoss.zul.Listcell; +import org.zkoss.zul.Listitem; +import org.zkoss.zul.ListitemRenderer; +import org.zkoss.zul.ListitemRendererExt; + +public class ADTabListModel extends AbstractListModel implements ListitemRenderer, ListitemRendererExt { + + List listItems = null; + private IADTab tabbox; + + public ADTabListModel(List listItems, IADTab tabbox) { + this.listItems = listItems; + this.tabbox = tabbox; + } + + public Object getElementAt(int index) { + ADTabLabel item = index < listItems.size() ? listItems.get(index) : null; + return item; + } + + public int getSize() { + return listItems.size(); + } + + public static class ADTabLabel { + public String label; + public int tabLevel; + + public ADTabLabel(String label, int tabLevel) { + this.label = label; + this.tabLevel = tabLevel; + } + } + + public void render(Listitem item, Object data) throws Exception { + ADTabLabel tabLabel = (ADTabLabel)data; + Listcell cell = new Listcell(tabLabel.label, null); + if (tabLabel.tabLevel > 0) { + cell.setStyle("padding-left:" + (tabLabel.tabLevel*15+5) + "px"); + } + cell.setParent(item); + int i = listItems.indexOf(tabLabel); + int s = tabbox.getSelectedIndex(); + if (!tabbox.canNavigateTo(s, i)) + cell.setVisible(false); + } + + public int getControls() { + return DETACH_ON_RENDER; + } + + public Listcell newListcell(Listitem item) { + return null; + } + + public Listitem newListitem(Listbox listbox) { + ListItem item = new ListItem(); + item.applyProperties(); + return item; + } + +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/FTabbox.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java similarity index 60% rename from extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/FTabbox.java rename to extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java index 607c6ee990..65143a7df6 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/FTabbox.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java @@ -18,65 +18,48 @@ package org.adempiere.webui.component; import java.util.ArrayList; +import java.util.List; import org.adempiere.webui.panel.ADTabpanel; -import org.compiere.grid.VTabbedPane; +import org.adempiere.webui.part.AbstractUIPart; import org.compiere.model.DataStatusEvent; import org.compiere.model.GridTab; import org.compiere.util.CLogger; import org.compiere.util.Evaluator; -import org.zkoss.zul.Tab; -import org.zkoss.zul.Tabpanels; -import org.zkoss.zul.Tabs; /** * * @author Ashley G Ramdass + * @author Low Heng Sin * @date Feb 25, 2007 * @version $Revision: 0.10 $ */ -public class FTabbox extends Tabbox +public abstract class AbstractADTab extends AbstractUIPart implements IADTab { private static final long serialVersionUID = 1L; /** Logger */ - private static CLogger log = CLogger.getCLogger (VTabbedPane.class); + private static CLogger log = CLogger.getCLogger (AbstractADTab.class); /** List of dependent Variables */ private ArrayList m_dependents = new ArrayList(); - /** Tab Panels for this tab box */ - private FTabpanels tabpanels; + /** Tabs associated to this tab box */ - private Tabs tabs; + protected List tabPanelList = new ArrayList(); - public FTabbox() + public AbstractADTab() { - super(); - init(); } - private void init() - { - tabpanels = new FTabpanels(); - tabs = new Tabs(); - //this.setSclass("lite"); - this.appendChild(tabs); - this.appendChild(tabpanels); - this.setOrient("vertical"); - }// init - /** * Add Tab * @param tabName name * @param gTab grid tab model * @param tabElement GridController or VSortTab */ - public void addTab(GridTab gTab, Tabpanel tabPanel) + public void addTab(GridTab gTab, ADTabpanel tabPanel) { - Tab tab = new Tab(gTab.getName()); - tabPanel.setEnabled(gTab.isDisplayed()); - tabs.appendChild(tab); - tabpanels.appendChild(tabPanel); - ArrayList dependents = gTab.getDependentOn(); + tabPanelList.add(tabPanel); + ArrayList dependents = gTab.getDependentOn(); for (int i = 0; i < dependents.size(); i++) { String name = dependents.get(i); @@ -85,28 +68,27 @@ public class FTabbox extends Tabbox m_dependents.add(name); } } + + doAddTab(gTab, tabPanel); }// addTab - /** + protected abstract void doAddTab(GridTab tab, ADTabpanel tabPanel); + + /** * @param index of tab panel * @return */ public boolean isEnabledAt(int index) { - Tabpanel tabpanel = tabpanels.getTabpanel(index); - if (tabpanel == null) - { - return false; - } - return tabpanel.isEnabled(); + return true; }// isEnabledAt - private boolean isDisplay(ADTabpanel tabpanel) + private boolean isDisplay(ADTabpanel newTab) { - String logic = tabpanel.getDisplayLogic(); + String logic = newTab.getDisplayLogic(); if (logic != null && logic.length() > 0) { - boolean display = Evaluator.evaluateLogic(tabpanel, logic); + boolean display = Evaluator.evaluateLogic(newTab, logic); if (!display) { log.info("Not displayed - " + logic); @@ -124,13 +106,10 @@ public class FTabbox extends Tabbox */ public boolean updateSelectedIndex(int oldIndex, int newIndex) { - Tabpanel tabpanel = tabpanels.getTabpanel(newIndex); + ADTabpanel newTab = tabPanelList.get(newIndex); - ADTabpanel newTab = (ADTabpanel)tabpanel; - - if (tabpanel == null || !isDisplay(newTab)) + if (!isDisplay(newTab)) { - super.setSelectedIndex(oldIndex); return false; } @@ -138,16 +117,39 @@ public class FTabbox extends Tabbox if (newIndex != oldIndex) { - ADTabpanel oldTabpanel = tabpanels.getTabpanel(oldIndex); + canJump = canNavigateTo(oldIndex, newIndex); + if (canJump) + { + doTabSelectionChanged(oldIndex, newIndex); + } + } + + return canJump; + } + + protected abstract void doTabSelectionChanged(int oldIndex, int newIndex); + + public boolean canNavigateTo(int fromIndex, int toIndex) { + ADTabpanel newTab = tabPanelList.get(toIndex); + if (!isDisplay(newTab)) + { + return false; + } + + boolean canJump = true; + + if (toIndex != fromIndex) + { + ADTabpanel oldTabpanel = fromIndex >= 0 ? tabPanelList.get(fromIndex) : null; if (oldTabpanel != null) { ADTabpanel oldTab = oldTabpanel; if (newTab.getTabLevel() > oldTab.getTabLevel()) { int currentLevel = newTab.getTabLevel(); - for (int i = newIndex - 1; i >= 0; i--) + for (int i = toIndex - 1; i >= 0; i--) { - ADTabpanel tabPanel = tabpanels.getTabpanel(i); + ADTabpanel tabPanel = tabPanelList.get(i); if (tabPanel.getTabLevel() < currentLevel) { if (!tabPanel.isCurrent()) @@ -159,30 +161,48 @@ public class FTabbox extends Tabbox } } } - } - else - { - canJump = false; - } - } - if (canJump) - { - super.setSelectedIndex(newIndex); - } - else - { - super.setSelectedIndex (oldIndex); - } + } + } return canJump; } + /** + * + * @return full path + */ + public String getPath() { + StringBuffer path = new StringBuffer(); + int s = this.getSelectedIndex(); + if (s <= 0 ) s = 0; + ADTabpanel p = tabPanelList.get(s); + for (int i = 0; i <= s; i++) { + String n = null; + if (i == s) + n = p.getTitle(); + else { + ADTabpanel t = tabPanelList.get(i); + if (t.getTabLevel() < p.getTabLevel()) + n = t.getTitle(); + } + if (n != null) { + if (path.length() > 0) { + path.append(" > "); + } + path.append(n); + } + } + + return path.toString(); + } + /** * Evaluate Tab Logic * @param e event */ public void evaluate (DataStatusEvent e) { - boolean process = e == null; + + boolean process = (e == null); String columnName = null; if (!process) { @@ -195,37 +215,26 @@ public class FTabbox extends Tabbox if (process) { - log.config(columnName == null ? "" : columnName); - for (int i = 0; i < this.getTabCount(); i++) - { - ADTabpanel tabPanel = tabpanels.getTabpanel(i); - String logic = tabPanel.getDisplayLogic(); - boolean display = true; - if (logic != null && logic.length() > 0) - { - display = Evaluator.evaluateLogic(tabPanel, logic); - } - tabPanel.setEnabled(display); - - } + updateTabState(); } } // evaluate - /** + protected abstract void updateTabState(); + + /** * @return the number of tab panels present */ public int getTabCount() { - return tabpanels.getChildren().size(); + return tabPanelList.size(); } public ADTabpanel getTabpanel(int index) { try { - Tabpanels tabpanels = this.getTabpanels(); - ADTabpanel tabPanel = (ADTabpanel)tabpanels.getChildren().get(index); + ADTabpanel tabPanel = tabPanelList.get(index); return tabPanel; } catch (Exception ex) @@ -234,24 +243,8 @@ public class FTabbox extends Tabbox } } - /** - * Return the selected Tab Panel - */ - public ADTabpanel getSelectedTabpanel() - { - return getTabpanel(this.getSelectedIndex()); - } - - /** - * @return whether all events should be reported as they occur. - */ - public boolean isAsap() - { - return true; - } - - public boolean containsTab(Tab tab) - { - return tabs.getChildren().contains(tab); + public void setSelectedIndex(int newIndex) { + int oldIndex = getSelectedIndex(); + updateSelectedIndex(oldIndex, newIndex); } } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java index 381d116721..f6041eca7f 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java @@ -23,7 +23,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.logging.Level; -import org.adempiere.webui.constants.EventConstants; +import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.event.ToolbarListener; import org.compiere.util.CLogger; import org.zkoss.zk.ui.Component; @@ -46,24 +46,24 @@ public class CWindowToolbar extends FToolbar implements EventListener private static CLogger log = CLogger.getCLogger(CWindowToolbar.class); - private Button btnIgnore; + private ToolBarButton btnIgnore; - private Button btnHelp, btnNew, btnDelete, btnSave; + private ToolBarButton btnHelp, btnNew, btnDelete, btnSave; - private Button btnRefresh, btnFind, btnAttachment; + private ToolBarButton btnRefresh, btnFind, btnAttachment; - private Button btnGridToggle; + private ToolBarButton btnGridToggle; - private Button btnHistoryRecords, btnMenu, btnParentRecord, btnDetailRecord; + private ToolBarButton btnHistoryRecords, btnMenu, btnParentRecord, btnDetailRecord; - private Button btnFirst, btnPrevious, btnNext, btnLast; + private ToolBarButton btnFirst, btnPrevious, btnNext, btnLast; - private Button btnReport, btnArchive, btnPrint; + private ToolBarButton btnReport, btnArchive, btnPrint; - private Button btnZoomAcross, btnActiveWorkflows, btnRequests, btnProductInfo; - - private Button btnExit; + private ToolBarButton btnZoomAcross, btnActiveWorkflows, btnRequests, btnProductInfo; +// private ToolBarButton btnExit; + private ArrayList listeners = new ArrayList(); public CWindowToolbar() @@ -73,117 +73,119 @@ public class CWindowToolbar extends FToolbar implements EventListener private void init() { - btnIgnore = new Button(""); + LayoutUtils.addSclass("adwindow-toolbar", this); + + btnIgnore = new ToolBarButton(); btnIgnore.setName("btnIgnore"); btnIgnore.setImage("/images/Ignore16.gif"); btnIgnore.setTooltiptext("Ignore Changes"); // -- - btnHelp = new Button(""); + btnHelp = new ToolBarButton(""); btnHelp.setName("btnHelp"); btnHelp.setImage("/images/Help24.gif"); btnHelp.setTooltiptext("Help"); - btnNew = new Button(""); + btnNew = new ToolBarButton(""); btnNew.setName("btnNew"); btnNew.setImage("/images/New24.gif"); btnNew.setTooltiptext("New Record"); - btnDelete = new Button(""); + btnDelete = new ToolBarButton(""); btnDelete.setName("btnDelete"); btnDelete.setImage("/images/Delete24.gif"); btnDelete.setTooltiptext("Delete current record"); - btnSave = new Button(""); + btnSave = new ToolBarButton(""); btnSave.setName("btnSave"); btnSave.setImage("/images/Save24.gif"); btnSave.setTooltiptext("Save changes"); // -- - btnRefresh = new Button(""); + btnRefresh = new ToolBarButton(""); btnRefresh.setName("btnRefresh"); btnRefresh.setImage("/images/Refresh24.gif"); btnRefresh.setTooltiptext("Refresh Data"); - btnFind = new Button(""); + btnFind = new ToolBarButton(""); btnFind.setName("btnFind"); btnFind.setImage("/images/Find24.gif"); btnFind.setTooltiptext("Find Records"); - btnAttachment = new Button(""); + btnAttachment = new ToolBarButton(""); btnAttachment.setName("btnAttachment"); btnAttachment.setImage("/images/Attachment24.gif"); btnAttachment.setTooltiptext("Attachments"); // -- - btnGridToggle = new Button(""); + btnGridToggle = new ToolBarButton(""); btnGridToggle.setName("btnGridToggle"); btnGridToggle.setImage("/images/ZoomAcross24.gif"); btnGridToggle.setTooltiptext("Grid Toggle"); - btnHistoryRecords = new Button(""); + btnHistoryRecords = new ToolBarButton(""); btnHistoryRecords.setName("btnHistoryRecords"); btnHistoryRecords.setImage("/images/HistoryX24.gif"); btnHistoryRecords.setTooltiptext("History Records"); - btnMenu = new Button(""); + btnMenu = new ToolBarButton(""); btnMenu.setName("btnHome"); btnMenu.setImage("/images/Home24.gif"); btnMenu.setTooltiptext("Home"); - btnParentRecord = new Button(""); + btnParentRecord = new ToolBarButton(""); btnParentRecord.setName("btnParentRecord"); btnParentRecord.setImage("/images/Parent24.gif"); - btnDetailRecord = new Button(""); + btnDetailRecord = new ToolBarButton(""); btnDetailRecord.setName("btnDetailRecord"); btnDetailRecord.setImage("/images/Detail24.gif"); // -- - btnFirst = new Button(""); + btnFirst = new ToolBarButton(""); btnFirst.setName("btnFirst"); btnFirst.setImage("/images/First24.gif"); - btnPrevious = new Button(""); + btnPrevious = new ToolBarButton(""); btnPrevious.setName("btnPrevious"); btnPrevious.setImage("/images/Previous24.gif"); - btnNext = new Button(""); + btnNext = new ToolBarButton(""); btnNext.setName("btnNext"); btnNext.setImage("/images/Next24.gif"); - btnLast = new Button(""); + btnLast = new ToolBarButton(""); btnLast.setName("btnLast"); btnLast.setImage("/images/Last24.gif"); // -- - btnReport = new Button(""); + btnReport = new ToolBarButton(""); btnReport.setName("btnReport"); btnReport.setImage("/images/Report24.gif"); - btnArchive = new Button(""); + btnArchive = new ToolBarButton(""); btnArchive.setName("btnArchive"); btnArchive.setImage("/images/Archive24.gif"); - btnPrint = new Button(""); + btnPrint = new ToolBarButton(""); btnPrint.setName("btnPrint"); btnPrint.setImage("/images/Print24.gif"); // -- - btnZoomAcross = new Button(""); + btnZoomAcross = new ToolBarButton(""); btnZoomAcross.setName("btnZoomAcross"); btnZoomAcross.setImage("/images/ZoomAcross24.gif"); - btnActiveWorkflows = new Button(""); + btnActiveWorkflows = new ToolBarButton(""); btnActiveWorkflows.setName("btnActiveWorkflows"); btnActiveWorkflows.setImage("/images/WorkFlow24.gif"); - btnRequests = new Button(""); + btnRequests = new ToolBarButton(""); btnRequests.setName("btnRequests"); btnRequests.setImage("/images/Request24.gif"); - btnProductInfo = new Button(""); + btnProductInfo = new ToolBarButton(""); btnProductInfo.setName("btnProductInfo"); btnProductInfo.setImage("/images/Product24.gif"); - btnExit = new Button(""); - btnExit.setName("btnExit"); - btnExit.setImage("/images/End24.gif"); +// btnExit = new ToolBarButton(""); +// btnExit.setName("btnExit"); +// btnExit.setImage("/images/End24.gif"); this.appendChild(btnIgnore); addSeparator(); @@ -216,26 +218,26 @@ public class CWindowToolbar extends FToolbar implements EventListener this.appendChild(btnActiveWorkflows); this.appendChild(btnRequests); this.appendChild(btnProductInfo); - addSeparator(); - this.appendChild(btnExit); +// addSeparator(); +// this.appendChild(btnExit); for (Object obj : this.getChildren()) { - if (obj instanceof Button) + if (obj instanceof ToolBarButton) { - ((Button)obj).setWidth(BUTTON_WIDTH); - ((Button)obj).addEventListener(Events.ON_CLICK, this); - ((Button)obj).setEnabled(false); + ((ToolBarButton)obj).setWidth(BUTTON_WIDTH); + ((ToolBarButton)obj).addEventListener(Events.ON_CLICK, this); + ((ToolBarButton)obj).setDisabled(true); } } // Help and Exit should always be enabled - btnHelp.setEnabled(true); - btnExit.setEnabled(true); + btnHelp.setDisabled(false); +// btnExit.setDisabled(false); // Testing Purposes - btnGridToggle.setEnabled(true); + btnGridToggle.setDisabled(false); } protected void addSeparator() @@ -263,11 +265,11 @@ public class CWindowToolbar extends FToolbar implements EventListener Component eventComp = event.getTarget(); Iterator listenerIter = listeners.iterator(); - if(eventName.equals(EventConstants.ONCLICK)) + if(eventName.equals(Events.ON_CLICK)) { - if(eventComp instanceof Button) + if(eventComp instanceof ToolBarButton) { - Button cComponent = (Button) eventComp; + ToolBarButton cComponent = (ToolBarButton) eventComp; String compName = cComponent.getName(); String methodName = "on" + compName.substring(3); while(listenerIter.hasNext()) @@ -305,15 +307,15 @@ public class CWindowToolbar extends FToolbar implements EventListener public void enableHistoryRecords(boolean enabled) { - this.btnHistoryRecords.setEnabled(enabled); + this.btnHistoryRecords.setDisabled(!enabled); } - public void enableNavigation(boolean enabledd) + public void enableNavigation(boolean enabled) { - this.btnFirst.setEnabled(enabledd); - this.btnPrevious.setEnabled(enabledd); - this.btnNext.setEnabled(enabledd); - this.btnLast.setEnabled(enabledd); + this.btnFirst.setDisabled(!enabled); + this.btnPrevious.setDisabled(!enabled); + this.btnNext.setDisabled(!enabled); + this.btnLast.setDisabled(!enabled); } public void enableTabNavigation(boolean enabled) @@ -323,25 +325,25 @@ public class CWindowToolbar extends FToolbar implements EventListener public void enableTabNavigation(boolean enableParent, boolean enableDetail) { - this.btnParentRecord.setEnabled(enableParent); - this.btnDetailRecord.setEnabled(enableDetail); + this.btnParentRecord.setDisabled(!enableParent); + this.btnDetailRecord.setDisabled(!enableDetail); } public void enableFirstNavigation(boolean enabled) { - this.btnFirst.setEnabled(enabled); - this.btnPrevious.setEnabled(enabled); + this.btnFirst.setDisabled(!enabled); + this.btnPrevious.setDisabled(!enabled); } public void enableLastNavigation(boolean enabled) { - this.btnLast.setEnabled(enabled); - this.btnNext.setEnabled(enabled); + this.btnLast.setDisabled(!enabled); + this.btnNext.setDisabled(!enabled); } public void enabledNew(boolean enabled) { - this.btnNew.setEnabled(enabled); + this.btnNew.setDisabled(!enabled); } /* public void enableEdit(boolean enabled) @@ -351,22 +353,22 @@ public class CWindowToolbar extends FToolbar implements EventListener public void enableRefresh(boolean enabled) { - this.btnRefresh.setEnabled(enabled); + this.btnRefresh.setDisabled(!enabled); } public void enableSave(boolean enabled) { - this.btnSave.setEnabled(enabled); + this.btnSave.setDisabled(!enabled); } - public void enableExit(boolean enabled) - { - this.btnExit.setEnabled(enabled); - } +// public void enableExit(boolean enabled) +// { +// this.btnExit.setDisabled(!enabled); +// } public void enableDelete(boolean enabled) { - this.btnDelete.setEnabled(enabled); + this.btnDelete.setDisabled(!enabled); } public void enableDeleteSelection(boolean enabled) @@ -376,33 +378,33 @@ public class CWindowToolbar extends FToolbar implements EventListener public void enableChanges(boolean enabled) { - this.btnNew.setEnabled(enabled); - this.btnIgnore.setEnabled(enabled); + this.btnNew.setDisabled(!enabled); + this.btnIgnore.setDisabled(!enabled); } public void enableIgnore(boolean enabled) { - this.btnIgnore.setEnabled(enabled); + this.btnIgnore.setDisabled(!enabled); } public void enableNew(boolean enabled) { - this.btnNew.setEnabled(enabled); + this.btnNew.setDisabled(!enabled); } public void enableAttachment(boolean enabled) { - this.btnAttachment.setEnabled(enabled); + this.btnAttachment.setDisabled(!enabled); } public void enablePrint(boolean enabled) { - this.btnPrint.setEnabled(enabled); + this.btnPrint.setDisabled(!enabled); } public void enableReport(boolean enabled) { - this.btnReport.setEnabled(enabled); + this.btnReport.setDisabled(!enabled); } public void enableCopy(boolean enabled) @@ -411,13 +413,13 @@ public class CWindowToolbar extends FToolbar implements EventListener public void enableFind(boolean enabled) { - this.btnFind.setEnabled(enabled); + this.btnFind.setDisabled(!enabled); } public void enableGridToggle(boolean enabled) { - btnGridToggle.setEnabled(enabled); + btnGridToggle.setDisabled(!enabled); } public boolean isAsap() diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/CompositeADTab.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/CompositeADTab.java new file mode 100644 index 0000000000..805ee85e46 --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/CompositeADTab.java @@ -0,0 +1,151 @@ +/****************************************************************************** + * 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.component; + +import java.util.ArrayList; +import java.util.List; + +import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.panel.ADTabpanel; +import org.compiere.model.DataStatusEvent; +import org.compiere.model.GridTab; +import org.compiere.util.CLogger; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zul.Div; + +/** + * + * @author Ashley G Ramdass + * @author Low Heng Sin + * @date Feb 25, 2007 + * @version $Revision: 0.10 $ + */ +public class CompositeADTab extends AbstractADTab +{ + private static final long serialVersionUID = 1L; + + /** Logger */ + private static CLogger log = CLogger.getCLogger (CompositeADTab.class); + + private List tabLabelList = new ArrayList(); + + private Div div; + + protected ADButtonTabList tabList; + + public CompositeADTab() + { + tabList = new ADButtonTabList(); + tabList.setADTab(this); + } + + protected Component doCreatePart(Component parent) + { + div = new Div(); + if (parent != null) { + div.setParent(parent); + LayoutUtils.addSclass("adtab-body", div); + } else { + div.setPage(page); + } + + return div; + } + + public Component getRootComponent() { + return div; + } + + + @Override + protected void doAddTab(GridTab gTab, ADTabpanel tabPanel) { + tabPanel.setParent(div); + tabPanel.setVisible(false); + + ADTabListModel.ADTabLabel tabLabel = new ADTabListModel.ADTabLabel(gTab.getName(), gTab.getTabLevel()); + tabLabelList.add(tabLabel); + } + + /** + * Evaluate Tab Logic + * @param e event + */ + public void evaluate (DataStatusEvent e) + { + tabList.setItems(tabLabelList); + + super.evaluate(e); + + } // evaluate + + @Override + protected void updateTabState() { + tabList.refresh(); + } + + /** + * Return the selected Tab Panel + */ + public ADTabpanel getSelectedTabpanel() + { + for(int i = 0; i < tabPanelList.size(); i++) { + if (tabPanelList.get(i).isVisible()) + return tabPanelList.get(i); + } + return null; + } + + public int getSelectedIndex() { + for(int i = 0; i < tabPanelList.size(); i++) { + if (tabPanelList.get(i).isVisible()) + return i; + } + return -1; + } + + public void addSelectionEventListener(EventListener listener) { + tabList.addSelectionEventListener(listener); + } + + public Component getTabSelectionComponent() { + return tabList; + } + + @Override + protected void doTabSelectionChanged(int oldIndex, int newIndex) { + ADTabpanel oldTabpanel = oldIndex >= 0 ? tabPanelList.get(oldIndex) : null; + ADTabpanel newTabpanel = tabPanelList.get(newIndex); + if (oldTabpanel != null) { + oldTabpanel.setVisible(false); + } + newTabpanel.createUI(); + newTabpanel.setVisible(true); + + if (tabList.getSelectedIndex() != newIndex) + tabList.setSelectedIndex(newIndex); + } + + public boolean isUseExternalSelection() { + return true; + } + + public Component getComponent() { + return div; + } +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/FTabpanels.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/FTabpanels.java deleted file mode 100644 index 3b87a100b1..0000000000 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/FTabpanels.java +++ /dev/null @@ -1,49 +0,0 @@ -/****************************************************************************** - * 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.component; - -import org.adempiere.webui.panel.ADTabpanel; - -/** - * - * @author Ashley G Ramdass - * @date Feb 25, 2007 - * @version $Revision: 0.10 $ - */ -public class FTabpanels extends Tabpanels -{ - private static final long serialVersionUID = 1L; - - public boolean appendChild(Tabpanel tabPanel) - { - return super.appendChild(tabPanel); - } - - public ADTabpanel getTabpanel(int index) - { - try - { - ADTabpanel tabPanel = (ADTabpanel)this.getChildren().get(index); - return tabPanel; - } - catch (Exception ex) - { - return null; - } - } -} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/GridPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/GridPanel.java index e8a2dd7fd9..7358e5217f 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/GridPanel.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/GridPanel.java @@ -17,42 +17,28 @@ package org.adempiere.webui.component; -import java.sql.Timestamp; -import java.text.SimpleDateFormat; + +import java.util.HashMap; +import java.util.Map; import javax.swing.table.AbstractTableModel; -import org.adempiere.webui.panel.ADWindowPanel; +import org.adempiere.webui.LayoutUtils; import org.compiere.model.GridField; import org.compiere.model.GridTab; import org.compiere.model.GridTable; -import org.compiere.model.MLookup; -import org.compiere.model.MLookupFactory; -import org.compiere.util.DisplayType; -import org.compiere.util.Env; -import org.compiere.util.NamePair; -import org.zkforge.yuiext.grid.Column; -import org.zkforge.yuiext.grid.Columns; -import org.zkforge.yuiext.grid.Grid; -import org.zkforge.yuiext.grid.Label; -import org.zkforge.yuiext.grid.Row; -import org.zkforge.yuiext.grid.Rows; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; -import org.zkoss.zul.Separator; +import org.zkoss.zul.ListitemRenderer; -public class GridPanel extends Panel implements EventListener +public class GridPanel extends Div implements EventListener { private static final long serialVersionUID = 1L; - private Grid grid = new Grid(); - private Rows rows = new Rows(); - private Row row = new Row(); - private Columns columns = new Columns(); - private Column column = new Column(); - private Label label = new Label(); + private Listbox listbox = null; private int pageSize = 10; private long numPages; @@ -66,26 +52,32 @@ public class GridPanel extends Panel implements EventListener private Button[] buttons; private Hbox boxButtons = new Hbox(); - private ADWindowPanel windowPanel; private int windowNo; private GridTab gridTab; private int pageId = 0; + + private ListHead listHead; + + private boolean init; public GridPanel() { super(); + listbox = new Listbox(); } - public GridPanel(int windowNo, ADWindowPanel windowPanel) + public GridPanel(int windowNo) { this.windowNo = windowNo; - this.windowPanel = windowPanel; + listbox = new Listbox(); } public void init(GridTab gridTab) { + if (init) return; + this.gridTab = gridTab; tableModel = gridTab.getTableModel(); @@ -94,10 +86,34 @@ public class GridPanel extends Panel implements EventListener gridField = ((GridTable)tableModel).getFields(); - loadButtons(); - loadGridHeader(); - loadRecords(0, pageSize); - loadDisplay(); + setupColumns(); + render(); + + listbox.setSelectedIndex(gridTab.getCurrentRow()); + + this.init = true; + } + + public boolean isInit() { + return init; + } + + public void activate(GridTab gridTab) { + if (isInit()) + refresh(gridTab); + else + init(gridTab); + } + + public void refresh(GridTab gridTab) { + this.gridTab = gridTab; + tableModel = gridTab.getTableModel(); + numRows = tableModel.getRowCount(); + gridField = ((GridTable)tableModel).getFields(); + + updateModel(); + + listbox.setSelectedIndex(gridTab.getCurrentRow()); } public void setPageSize(int pageSize) @@ -118,154 +134,73 @@ public class GridPanel extends Panel implements EventListener this.setVisible(false); } - private void loadGridHeader() - { - if (grid.getColumns() != null) - return; + private void setupColumns() + { + if (init) return; - columns = new Columns(); + ListHead header = new ListHead(); + header.setSizable(true); + Map colnames = new HashMap(); + int index = 0; for (int i = 0; i < numColumns; i++) { if (gridField[i].isDisplayed()) { - column = new Column(gridField[i].getHeader()); - columns.appendChild(column); + colnames.put(index, gridField[i].getHeader()); + index++; + ListHeader colHeader = new ListHeader(); + colHeader.setSort("auto"); + colHeader.setLabel(gridField[i].getHeader()); + int l = gridField[i].getDisplayLength() * 10; + if (l > 300) + l = 300; + else if ( l < 100) + l = 100; + colHeader.setWidth(Integer.toString(l) + "px"); + header.appendChild(colHeader); } - } - - grid.appendChild(columns); + } + listbox.appendChild(header); } - private void loadButtons() + private void render() { - double pages = (double)numRows / (double)pageSize; - pages = Math.ceil(pages); - numPages = Math.round(pages); + LayoutUtils.addSclass("adtab-grid-panel", this); - if (numPages == 1) - return; + listbox.setVflex(true); + listbox.addEventListener(Events.ON_SELECT, this); - buttons = new Button[(int)numPages]; + LayoutUtils.addSclass("adtab-grid", listbox); - if (boxButtons.getChildren() != null) - boxButtons.getChildren().clear(); - - for (int i = 0; i < buttons.length; i++) - { - Integer count = i; - buttons[i] = new Button(); - buttons[i].setId(count.toString()); - buttons[i].addEventListener(Events.ON_CLICK, this); - buttons[i].setLabel(count.toString()); - boxButtons.appendChild(buttons[i]); - } + updateModel(); + + this.appendChild(listbox); } - - private String getCell(Object obj, int columnIndex) - { - if (obj == null) - return ""; - - if (tableModel.getColumnClass(columnIndex).equals(Integer.class)) - { - if (gridField[columnIndex].isLookup()) - { - MLookup lookup = MLookupFactory.get( - Env.getCtx(), windowNo, 0, gridField[columnIndex].getAD_Column_ID(), - gridField[columnIndex].getDisplayType()); - - NamePair namepair = lookup.get(obj); - - if (namepair != null) - return namepair.getName(); - else - return ""; - } - else - return "Lookup"; - } - else if (tableModel.getColumnClass(columnIndex).equals(Timestamp.class)) - { - SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date); - return dateFormat.format((Timestamp)obj); - } - else - return obj.toString(); - } - - private void loadRecords(int start, int end) - { - if (grid.getRows() != null) - grid.getRows().getChildren().clear(); - if (rows.getChildren() != null) - rows.getChildren().clear(); - - if (end > numRows) - end = numRows; - - for (int i = start; i < end; i++) - { - row = new Row(); - - for (int j = 0; j < numColumns; j++) - { - if (!gridField[j].isDisplayed()) - break; - - label = new Label(getCell(tableModel.getValueAt(i, j), j)); - row.appendChild(label); - } - - rows.appendChild(row); - } - - if (grid.getRows() == null) - grid.appendChild(rows); + private void updateModel() { + GridTableListModel listModel = new GridTableListModel((GridTable)tableModel, windowNo); + listbox.setItemRenderer(listModel); + listbox.setModel(listModel); } - private void loadDisplay() - { - this.setWidth("800px"); - //this.setHeight("1000px"); - - grid.setWidth("100%"); - grid.setHeight("800px"); - grid.addEventListener(Events.ON_SELECT, this); - - boxButtons.setWidth("60%"); - - this.appendChild(grid); - this.appendChild(new Separator()); - this.appendChild(boxButtons); + public void deactivate() { + ListitemRenderer lr = null; + listbox.setItemRenderer(lr); + listbox.setModel(null); } public void onEvent(Event event) throws Exception - { + { if (event == null) - return; - - if (event.getTarget() instanceof Button) + return; + else if (event.getTarget() == listbox) { - Button btn = (Button)event.getTarget(); - - pageId = new Integer(btn.getId()); - - int start = pageId * pageSize; - - int end = start + pageSize; - - loadRecords(start, end); - } - else if (event.getTarget() == grid) - { - int keyRecordId = grid.getSelectedIndex() + (pageId * pageSize); - - gridTab.navigate(keyRecordId); - - this.setVisible(false); - windowPanel.showTabbox(true); + gridTab.navigate(listbox.getSelectedIndex()); } } + + public Listbox getListbox() { + return listbox; + } } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/GridTableListModel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/GridTableListModel.java new file mode 100644 index 0000000000..18cdb843a3 --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/GridTableListModel.java @@ -0,0 +1,154 @@ +package org.adempiere.webui.component; + +import java.sql.Timestamp; +import java.text.SimpleDateFormat; + +import org.compiere.model.DataStatusEvent; +import org.compiere.model.DataStatusListener; +import org.compiere.model.GridField; +import org.compiere.model.GridTable; +import org.compiere.model.MLookup; +import org.compiere.model.MLookupFactory; +import org.compiere.util.DisplayType; +import org.compiere.util.Env; +import org.compiere.util.NamePair; +import org.zkoss.zk.ui.Executions; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.AbstractListModel; +import org.zkoss.zul.Listbox; +import org.zkoss.zul.Listcell; +import org.zkoss.zul.Listitem; +import org.zkoss.zul.ListitemRenderer; +import org.zkoss.zul.ListitemRendererExt; +import org.zkoss.zul.event.ListDataEvent; + +public class GridTableListModel extends AbstractListModel implements ListitemRenderer, ListitemRendererExt, DataStatusListener { + + private GridTable tableModel; + private GridField[] gridField; + private int windowNo; + + public GridTableListModel(GridTable tableModel, int windowNo) { + this.tableModel = tableModel; + this.windowNo = windowNo; + gridField = tableModel.getFields(); + tableModel.addDataStatusListener(this); + } + + public Object getElementAt(int rowIndex) { + int columnCount = tableModel.getColumnCount(); + Object[] values = new Object[columnCount]; + if (rowIndex < tableModel.getRowCount()) { + for (int i = 0; i < columnCount; i++) { + values[i] = tableModel.getValueAt(rowIndex, i); + } + } + + return values; + } + + public int getSize() { + return tableModel.getRowCount(); + } + + public void render(Listitem listitem, Object data) throws Exception { + Object[] values = (Object[])data; + int columnCount = tableModel.getColumnCount(); + for (int i = 0; i < columnCount; i++) { + if (!gridField[i].isDisplayed()) { + continue; + } + Listcell cell = null; + if (gridField[i].getDisplayType() == DisplayType.YesNo) { + cell = new Listcell("", null); + cell.setParent(listitem); + cell.setStyle("text-align:center"); + Checkbox checkBox = new Checkbox(); + if (values[i] != null && "true".equalsIgnoreCase(values[i].toString())) + checkBox.setChecked(true); + else + checkBox.setChecked(false); + checkBox.setDisabled(true); + checkBox.setParent(cell); + } else { + cell = new Listcell(getCell(values[i], i), null); + cell.setParent(listitem); + } + CellListener listener = new CellListener((Listbox) listitem.getParent()); + cell.addEventListener(Events.ON_DOUBLE_CLICK, listener); + } + } + + class CellListener implements EventListener { + + private Listbox _listbox; + + public CellListener(Listbox listbox) { + _listbox = listbox; + } + + public void onEvent(Event event) throws Exception { + if (Events.ON_DOUBLE_CLICK.equals(event.getName())) { + Event evt = new Event(Events.ON_DOUBLE_CLICK, _listbox); + Events.sendEvent(_listbox, evt); + } + } + + } + + private String getCell(Object obj, int columnIndex) + { + if (obj == null) + return ""; + + if (tableModel.getColumnClass(columnIndex).equals(Integer.class)) + { + if (gridField[columnIndex].isLookup()) + { + MLookup lookup = MLookupFactory.get( + Env.getCtx(), windowNo, 0, gridField[columnIndex].getAD_Column_ID(), + gridField[columnIndex].getDisplayType()); + + NamePair namepair = lookup.get(obj); + + if (namepair != null) + return namepair.getName(); + else + return ""; + } + else + return "Lookup"; + } + else if (tableModel.getColumnClass(columnIndex).equals(Timestamp.class)) + { + SimpleDateFormat dateFormat = DisplayType.getDateFormat(DisplayType.Date); + return dateFormat.format((Timestamp)obj); + } + else + return obj.toString(); + } + + public int getControls() { + return DETACH_ON_RENDER; + } + + public Listcell newListcell(Listitem item) { + return null; + } + + public Listitem newListitem(Listbox listbox) { + ListItem item = new ListItem(); + item.applyProperties(); + return item; + } + + public void dataStatusChanged(DataStatusEvent e) { + if (Executions.getCurrent() != null) { + fireEvent(ListDataEvent.CONTENTS_CHANGED, -1, -1); + } + + } + +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/IADTab.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/IADTab.java new file mode 100644 index 0000000000..53050bfcd9 --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/IADTab.java @@ -0,0 +1,41 @@ +package org.adempiere.webui.component; + +import org.adempiere.webui.panel.ADTabpanel; +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.EventListener; + +/** + * + * @author Low Heng Sin + * + */ +public interface IADTab extends UIPart { + + public int getSelectedIndex(); + + public boolean canNavigateTo(int fromIndex, int toIndex); + + public void addTab(GridTab tab, ADTabpanel tabPanel); + + public void setSelectedIndex(int i); + + public int getTabCount(); + + public void evaluate(DataStatusEvent e); + + public boolean updateSelectedIndex(int oldTabIndex, int newTabIndex); + + public ADTabpanel getSelectedTabpanel(); + + public String getPath(); + + public void addSelectionEventListener( + EventListener listener); + + public Component getTabSelectionComponent(); + + public boolean isUseExternalSelection(); +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/IADTabList.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/IADTabList.java new file mode 100644 index 0000000000..c0d0c84409 --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/IADTabList.java @@ -0,0 +1,16 @@ +package org.adempiere.webui.component; + +/** + * + * @author Low Heng Sin + * + */ +public interface IADTabList { + + int getSelectedIndex(); + + void setSelectedIndex(int curTabIndex); + + void refresh(); + +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Messagebox.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Messagebox.java index 04a635c490..6fde70cefd 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Messagebox.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Messagebox.java @@ -18,6 +18,7 @@ package org.adempiere.webui.component; import org.adempiere.webui.apps.AEnv; +import org.zkoss.zhtml.Text; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; @@ -39,7 +40,8 @@ public class Messagebox extends Window implements EventListener private String msg = new String(""); private String imgSrc = new String(""); - private Label lblMsg = new Label(); +// private Label lblMsg = new Label(); + private Text lblMsg = new Text(); private Button btnOk = new Button(); private Button btnCancel = new Button(); @@ -216,12 +218,19 @@ public class Messagebox extends Window implements EventListener this.setPosition("center"); this.setClosable(true); this.setAttribute("mode", "modal"); + this.setSizable(true); } else + { + this.setTitle(title); this.setAttribute("mode", "overlapped"); + this.setWidth("500px"); + this.setClosable(true); + this.setSizable(true); + } this.setVisible(true); - AEnv.showWindow(this); + AEnv.showCenterScreen(this); return returnValue; } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Tab.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Tab.java index 5bf22781c7..8a767d0930 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Tab.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Tab.java @@ -37,4 +37,10 @@ public class Tab extends org.zkoss.zul.Tab } + @Override + public void onClose() { + Tabpanel tp = (Tabpanel) getLinkedPanel(); + tp.onClose(); + } + } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Tabbox.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Tabbox.java index 5cb8fd54e1..a60364d750 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Tabbox.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Tabbox.java @@ -17,6 +17,9 @@ package org.adempiere.webui.component; +import org.adempiere.webui.LayoutUtils; +import org.zkoss.zk.ui.Component; +import org.zkoss.zkex.zul.Borderlayout; import org.zkoss.zul.Tabpanels; /** @@ -47,4 +50,19 @@ public class Tabbox extends org.zkoss.zul.Tabbox { return getTabpanel(this.getSelectedIndex()); } + + /* + public void onEcho() + { + Tabpanel tp = (Tabpanel) this.getSelectedPanel(); + Component child = tp.getFirstChild(); + if (!child.isVisible()) + { + child.setVisible(true); + if (child instanceof Borderlayout) + { + LayoutUtils.sendDeferLayoutEvent((Borderlayout) child, true); + } + } + }*/ } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java index 254d4e434e..c136cd1919 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/Tabpanel.java @@ -17,6 +17,11 @@ package org.adempiere.webui.component; +import java.util.List; + +import org.adempiere.webui.panel.ITabOnCloseHandler; +import org.zkoss.zul.Tab; + /** * * @author Ashley G Ramdass @@ -27,8 +32,12 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel { private static final long serialVersionUID = 1L; + private ITabOnCloseHandler onCloseHandler = null; + private boolean enabled; + private int tabLevel; + public boolean isEnabled() { return enabled; @@ -38,4 +47,40 @@ public class Tabpanel extends org.zkoss.zul.Tabpanel { this.enabled = enabled; } + + public int getTabLevel() + { + return tabLevel; + } + + public void setTabLevel(int l) + { + tabLevel = l; + } + + public void onClose() { + if (onCloseHandler != null) + onCloseHandler.onClose(this); + else { + Tab tab = this.getLinkedTab(); + Tabbox tabbox = (Tabbox) tab.getTabbox(); + if (tabbox.getSelectedTab() == tab) { + Tabs tabs = (Tabs) tabbox.getTabs(); + List childs = tabs.getChildren(); + for(int i = 0; i < childs.size(); i++) { + if (childs.get(i) == tab) { + if (i > 0) + tabbox.setSelectedIndex((i-1)); + break; + } + } + } + this.detach(); + tab.detach(); + } + } + + public void setOnCloseHandler(ITabOnCloseHandler handler) { + this.onCloseHandler = handler; + } } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/ToolBarButton.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/ToolBarButton.java index 3965d57cee..0bae06571a 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/ToolBarButton.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/component/ToolBarButton.java @@ -26,4 +26,30 @@ public class ToolBarButton extends org.zkoss.zul.Toolbarbutton private static final long serialVersionUID = 0L; + private String name; + + public ToolBarButton() {} + + @Override + public void setDisabled(boolean disabled) { + super.setDisabled(disabled); + if (disabled) { + this.setSclass("disableFilter"); + } else { + this.setSclass(""); + } + } + + public ToolBarButton(String name) { + super(); + this.name = name; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/constants/Constraints.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/constants/Constraints.java deleted file mode 100644 index 7a1121ec8d..0000000000 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/constants/Constraints.java +++ /dev/null @@ -1,40 +0,0 @@ -/****************************************************************************** - * 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.constants; - -import org.zkoss.zul.Constraint; -import org.zkoss.zul.SimpleConstraint; - -/** - * - * @author Ashley G Ramdass - * @date Feb 18, 2007 - * @version $Revision: 0.10 $ - */ -public class Constraints -{ - public static final Constraint MANDATORY; - - public static final Constraint NO_CONSTRAINT; - - static - { - MANDATORY = new SimpleConstraint(SimpleConstraint.NO_EMPTY); - NO_CONSTRAINT = (Constraint)null; - } -} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/constants/EventConstants.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/constants/EventConstants.java deleted file mode 100644 index ed726b32f4..0000000000 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/constants/EventConstants.java +++ /dev/null @@ -1,34 +0,0 @@ -/****************************************************************************** - * 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.constants; - -/** - * - * @author Ashley G Ramdass - * @date Feb 18, 2007 - * @version $Revision: 0.10 $ - */ -public class EventConstants -{ - public static final String ONCLICK = "onClick"; - - public static final String ONCHANGE = "onChange"; - - public static final String ONSELECT = "onSelect"; - -} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/editor/WEditor.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/editor/WEditor.java index 81c33c8829..0c29a9549c 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/editor/WEditor.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/editor/WEditor.java @@ -148,7 +148,6 @@ public abstract class WEditor implements EventListener, PropertyChangeListener label.setValue(strLabel); label.setTooltiptext(description); - this.setMandatory (mandatory); if (readOnly || !updateable) diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/event/ToolbarListener.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/event/ToolbarListener.java index 92d2082a21..9108d29414 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/event/ToolbarListener.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/event/ToolbarListener.java @@ -45,8 +45,6 @@ public interface ToolbarListener public void onRefresh(); - public void onExit(); - public void onPrint(); public void onReport(); diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADForm.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADForm.java index bdfbfddff8..a3460a477a 100755 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADForm.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADForm.java @@ -65,6 +65,11 @@ public abstract class ADForm extends Window implements EventListener protected ADForm() { m_windowNo = SessionManager.getAppDesktop().registerWindow(this); + + this.setWidth("100%"); + this.setHeight("95%"); + this.setStyle("position:absolute"); + this.setContentSclass("adform-content"); } protected int getWindowNo() diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java index a1f0e57ae7..d21bae2943 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java @@ -18,12 +18,18 @@ package org.adempiere.webui.panel; import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.component.Grid; +import org.adempiere.webui.component.GridPanel; import org.adempiere.webui.component.Label; +import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Rows; -import org.adempiere.webui.component.Tabpanel; +import org.adempiere.webui.component.ToolBar; import org.adempiere.webui.editor.WButtonEditor; import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditorPopupMenu; @@ -39,12 +45,21 @@ import org.compiere.model.GridTab; import org.compiere.model.GridTable; import org.compiere.model.GridWindow; import org.compiere.model.MLookup; +import org.compiere.model.X_AD_FieldGroup; import org.compiere.util.CLogger; import org.compiere.util.Env; import org.compiere.util.Evaluatee; +import org.zkoss.zhtml.Span; +import org.zkoss.zhtml.Text; +import org.zkoss.zk.ui.Component; +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.zul.Image; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.Div; +import org.zkoss.zul.Separator; +import org.zkoss.zul.Toolbarbutton; /** * @@ -58,7 +73,7 @@ import org.zkoss.zul.Image; * @version $Revision: 0.10 $ * */ -public class ADTabpanel extends Tabpanel implements Evaluatee, EventListener, +public class ADTabpanel extends Div implements Evaluatee, EventListener, DataStatusListener, ValueChangeListener { @@ -69,13 +84,11 @@ DataStatusListener, ValueChangeListener logger = CLogger.getCLogger(ADTabpanel.class); } - private Image panelImage; - private GridTab gridTab; private GridWindow gridWindow; - private ADWindowPanel windowPanel; + private AbstractADWindowPanel windowPanel; private int windowNo; @@ -84,30 +97,43 @@ DataStatusListener, ValueChangeListener private ArrayList editors = new ArrayList(); private boolean editing; + + private boolean uiCreated = false; + + private GridPanel listPanel; + + private Map> fieldGroups = new HashMap>(); - public ADTabpanel() - { + private ArrayList rowList; + + public ADTabpanel() + { init(); } private void init() { initComponents(); -// this.appendChild(panelImage); -// this.appendChild(grid); } private void initComponents() { + LayoutUtils.addSclass("adtab-content", this); + grid = new Grid(); - grid.setWidth("750px"); + //have problem moving the following out as css class + grid.setWidth("99%"); + grid.setHeight("100%"); + grid.setStyle("margin:0; padding:0; position: absolute"); + grid.setSclass("grid-no-striped"); + grid.setOddRowSclass("even"); - panelImage = new Image(); -// panelImage.setSrc("/images/loading.png"); + listPanel = new GridPanel(); + listPanel.getListbox().addEventListener(Events.ON_DOUBLE_CLICK, this); } - public void init(ADWindowPanel winPanel, int windowNo, GridTab gridTab, + public void init(AbstractADWindowPanel winPanel, int windowNo, GridTab gridTab, GridWindow gridWindow) { this.windowNo = windowNo; @@ -115,29 +141,120 @@ DataStatusListener, ValueChangeListener this.gridTab = gridTab; this.windowPanel = winPanel; gridTab.addDataStatusListener(this); - initGrid(); } - private void initGrid() + public void createUI() { + if (uiCreated) return; + Rows rows = new Rows(); GridField fields[] = gridTab.getFields(); Row row = new Row(); + + String currentFieldGroup = null; for (int i = 0; i < fields.length; i++) { GridField field = fields[i]; if (field.isDisplayed()) { + String fieldGroup = field.getFieldGroup(); + if (fieldGroup != null && fieldGroup.trim().length() > 0) + { + if (!fieldGroup.equals(currentFieldGroup)) + { + currentFieldGroup = fieldGroup; + if (row.getChildren().size() == 2) + { + row.appendChild(createSpacer()); + row.appendChild(createSpacer()); + row.appendChild(createSpacer()); + rows.appendChild(row); + if (rowList != null) + rowList.add(row); + row = new Row(); + } else if (row.getChildren().size() > 0) + { + rows.appendChild(row); + if (rowList != null) + rowList.add(row); + row = new Row(); + } + + row.setSpans("5"); + row.appendChild(new Separator()); + rows.appendChild(row); + + if (X_AD_FieldGroup.FIELDGROUPTYPE_Collapse.equals(field.getFieldGroupType()) || + X_AD_FieldGroup.FIELDGROUPTYPE_Tab.equals(field.getFieldGroupType())) + { + rowList = new ArrayList(); + fieldGroups.put(fieldGroup, rowList); + } + else + { + rowList = null; + } + row = new Row(); + row.setSpans("4"); + if (rowList == null) + { + Label groupLabel = new Label(fieldGroup); + row.appendChild(groupLabel); + row.appendChild(createSpacer()); + rows.appendChild(row); + } + else + { + ToolBar toolbar = new ToolBar(); + Toolbarbutton button = new Toolbarbutton(fieldGroup, "images/ns-collapse.gif"); + button.addEventListener(Events.ON_CLICK, this); + button.setParent(toolbar); + row.appendChild(toolbar); + row.appendChild(createSpacer()); + rows.appendChild(row); + } + + if (rowList == null) { + row = new Row(); + row.setSpans("4"); + Separator separator = new Separator(); + separator.setBar(true); + row.appendChild(separator); + row.appendChild(createSpacer()); + rows.appendChild(row); + } + + row = new Row(); + } + } + if (!field.isSameLine()) { - if (row.getChildren().size() == 2) - { - row.appendChild(new Label(" ")); - row.appendChild(new Label(" ")); - } - rows.appendChild(row); - row = new Row(); + if(row.getChildren().size() > 0) + { + if (row.getChildren().size() == 2) + { + row.appendChild(createSpacer()); + row.appendChild(createSpacer()); + row.appendChild(createSpacer()); + } + { + row.appendChild(createSpacer()); + } + rows.appendChild(row); + if (rowList != null) + rowList.add(row); + row = new Row(); + } } + else if (row.getChildren().size() == 4) + { + row.appendChild(createSpacer()); + rows.appendChild(row); + if (rowList != null) + rowList.add(row); + row = new Row(); + } WEditor comp = WebEditorFactory.getEditor(field, false); @@ -146,8 +263,19 @@ DataStatusListener, ValueChangeListener comp.setGridTab(this.getGridTab()); field.addPropertyChangeListener(comp); editors.add(comp); - row.appendChild(comp.getLabel()); + Div div = new Div(); + div.setAlign("right"); + div.appendChild(comp.getLabel()); + row.appendChild(div); row.appendChild(comp.getComponent()); + if (field.isLongField()) { + row.setSpans("1,3,1"); + row.appendChild(createSpacer()); + rows.appendChild(row); + if (rowList != null) + rowList.add(row); + row = new Row(); + } if (comp instanceof WButtonEditor) { @@ -158,6 +286,10 @@ DataStatusListener, ValueChangeListener comp.addValueChangeListner(this); } + if (comp.getComponent() instanceof HtmlBasedComponent) { + ((HtmlBasedComponent)comp.getComponent()).setWidth("100%"); + } + WEditorPopupMenu popupMenu = comp.getPopupMenu(); if (popupMenu != null) @@ -172,14 +304,26 @@ DataStatusListener, ValueChangeListener { if (row.getChildren().size() == 2) { - row.appendChild(new Label(" ")); - row.appendChild(new Label(" ")); + row.appendChild(createSpacer()); + row.appendChild(createSpacer()); + row.appendChild(createSpacer()); } rows.appendChild(row); + if (rowList != null) + rowList.add(row); } grid.appendChild(rows); + uiCreated = true; } + + private Component createSpacer() { + Span span = new Span(); + Text text = new Text("     "); + text.setParent(span); + span.setStyle("width: 100%"); + return span; + } public void dynamicDisplay (int col) { @@ -319,7 +463,21 @@ DataStatusListener, ValueChangeListener this.appendChild(grid); } - grid.setVisible(activate); + if (!this.getChildren().contains(listPanel)) + { + this.appendChild(listPanel); + listPanel.setVisible(false); + } + + if (listPanel.isVisible()) { + if (activate) + listPanel.activate(gridTab); + else + listPanel.deactivate(); + } else { + if (activate) + grid.setVisible(activate); + } } public boolean isEditing() @@ -343,31 +501,32 @@ DataStatusListener, ValueChangeListener public void onEvent(Event event) { -/* if (event == null) - return; - - if (event.getTarget() == listView) - { - keyRecordId = listView.getSelectedIndex(); - - //Object value = gridTab.getValue(keyRecordId, keyColumnName); - - //MQuery mquery = MQuery.getEqualQuery(keyColumnName, value); - } - else if (confirmPanel.getButton("Ok").equals(event.getTarget())) - { - gridTab.navigate(keyRecordId); - gridView.setVisible(false); - } - else if (confirmPanel.getButton("Cancel").equals(event.getTarget())) - { - gridView.setVisible(false); - windowPanel.showTabbox(true); - }*/ + if (event.getTarget() instanceof Toolbarbutton) + { + Toolbarbutton button = (Toolbarbutton) event.getTarget(); + List list = fieldGroups.get(button.getLabel()); + if (list.get(0).isVisible()) { + for (Row row : list) { + row.setVisible(false); + } + button.setImage("images/ns-expand.gif"); + } else { + for (Row row : list) { + row.setVisible(true); + } + button.setImage("images/ns-collapse.gif"); + } + } else if (event.getTarget() instanceof Listbox) + { + this.switchRowPresentation(); + } } public void dataStatusChanged(DataStatusEvent e) { + //TODO: ignore non-ui thread event for now + if (Executions.getCurrent() == null) return; + int col = e.getChangedColumn(); logger.config("(" + gridTab + ") Col=" + col + ": " + e.toString()); @@ -453,4 +612,16 @@ DataStatusListener, ValueChangeListener } } // ValueChange + + public void switchRowPresentation() { + if (grid.isVisible()) { + grid.setVisible(false); + } else { + grid.setVisible(true); + } + listPanel.setVisible(!grid.isVisible()); + if (listPanel.isVisible()) { + listPanel.activate(gridTab); + } + } } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java index bb3767a25d..4665c2972c 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java @@ -17,44 +17,24 @@ package org.adempiere.webui.panel; +import java.util.List; import java.util.Properties; -import org.adempiere.webui.apps.AEnv; -import org.adempiere.webui.apps.ProcessModalDialog; -import org.adempiere.webui.apps.WReport; -import org.adempiere.webui.apps.form.WCreateFrom; -import org.adempiere.webui.apps.form.WPayment; -import org.adempiere.webui.component.CWindowToolbar; -import org.adempiere.webui.component.FTabbox; -import org.adempiere.webui.component.GridPanel; -import org.adempiere.webui.editor.WButtonEditor; -import org.adempiere.webui.event.ActionEvent; -import org.adempiere.webui.event.ActionListener; -import org.adempiere.webui.event.ToolbarListener; -import org.adempiere.webui.exception.ApplicationException; -import org.adempiere.webui.session.SessionManager; -import org.adempiere.webui.window.FDialog; -import org.adempiere.webui.window.FindWindow; -import org.compiere.model.DataStatusEvent; -import org.compiere.model.DataStatusListener; -import org.compiere.model.GridField; -import org.compiere.model.GridTab; -import org.compiere.model.GridWindow; -import org.compiere.model.GridWindowVO; -import org.compiere.model.GridWorkbench; -import org.compiere.model.MQuery; -import org.compiere.model.MRole; -import org.compiere.process.DocAction; +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.compiere.util.CLogger; -import org.compiere.util.DB; -import org.compiere.util.Env; -import org.compiere.util.Msg; -import org.compiere.util.WebDoc; -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.Component; +import org.zkoss.zk.ui.HtmlBasedComponent; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.North; +import org.zkoss.zkex.zul.South; +import org.zkoss.zkex.zul.West; import org.zkoss.zul.Tab; -import org.zkoss.zul.Vbox; /** * @@ -62,11 +42,11 @@ import org.zkoss.zul.Vbox; * @author Jorg Janke * * @author Ashley G Ramdass + * @author Low Heng Sin * @date Feb 25, 2007 * @version $Revision: 0.10 $ */ -public class ADWindowPanel extends Vbox implements ToolbarListener, - EventListener, DataStatusListener, ActionListener +public class ADWindowPanel extends AbstractADWindowPanel { private static final long serialVersionUID = 1L; @@ -77,1056 +57,94 @@ public class ADWindowPanel extends Vbox implements ToolbarListener, logger = CLogger.getCLogger(ADWindowPanel.class); } - private Properties ctx; + private Borderlayout layout; - private GridWindow gridWindow; - - private StatusBarPanel statusBar; - - private FTabbox tabbox; - - private GridWorkbench workbench; - - private int curWindowNo; - - private GridTab curTab; - - private boolean m_onlyCurrentRows; - - private ADTabpanel curTabpanel; - - private CWindowToolbar toolbar; - - private int curTabIndex; - - private String title; - - private boolean newRecord; - - private boolean boolChanges = false; - - private GridPanel gridPanel; - - private boolean viewed = false; - - private boolean changesOccured = false; - - private int m_onlyCurrentDays = 0; - - public ADWindowPanel() - { - - } - + private Center contentArea; + public ADWindowPanel(Properties ctx, int windowNo) { - this.ctx = ctx; - this.curWindowNo = windowNo; - - init(); + super(ctx, windowNo); } - public void showTabbox(boolean visible) - { - if (visible) - tabbox.setVisible(true); - else - tabbox.setVisible(false); - } - - private void init() - { - initComponents(); - - Vbox vbox = new Vbox(); - vbox.appendChild(toolbar); - vbox.appendChild(tabbox); - vbox.appendChild(statusBar); - vbox.appendChild(gridPanel); - this.appendChild(vbox); - tabbox.addEventListener(Events.ON_SELECT, this); - } - - public StatusBarPanel getStatusBar() - { - return statusBar; - } - - private void initComponents() - { - /** Initalise toolbar */ - toolbar = new CWindowToolbar(); - toolbar.addListener(this); - - statusBar = new StatusBarPanel(); - - tabbox = new FTabbox(); - - gridPanel = new GridPanel(curWindowNo, this); - gridPanel.showGrid(false); - } - - public boolean initPanel(int adWindowId, MQuery query) - { - // Set AutoCommit for this Window - Env.setAutoCommit(ctx, curWindowNo, Env.isAutoCommit(ctx)); - boolean autoNew = Env.isAutoNew(ctx); - Env.setAutoNew(ctx, curWindowNo, autoNew); - - GridWindowVO gWindowVO = AEnv.getMWindowVO(curWindowNo, adWindowId, 0); - if (gWindowVO == null) - { - throw new ApplicationException(Msg.getMsg(ctx, - "AccessTableNoView") - + "(No Window Model Info)"); - } - gridWindow = new GridWindow(gWindowVO); - title = gridWindow.getName(); - // Set SO/AutoNew for Window - Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx()); - if (!autoNew && gridWindow.isTransaction()) - { - Env.setAutoNew(ctx, curWindowNo, true); - } - - /** - * Window Tabs - */ - int tabSize = gridWindow.getTabCount(); - for (int tab = 0; tab < tabSize; tab++) - { - gridWindow.initTab(tab); - - GridTab gTab = gridWindow.getTab(tab); - Env.setContext(ctx, curWindowNo, tab, "TabLevel", Integer - .toString(gTab.getTabLevel())); - - ADTabpanel fTabPanel = new ADTabpanel(); - fTabPanel.init(this, curWindowNo, gTab, gridWindow); - gTab.addDataStatusListener(this); - tabbox.addTab(gTab, fTabPanel); - - // Query first tab - if (tab == 0) - { - query = initialQuery(query, gTab); - if (query != null && query.getRecordCount() <= 1) - { - // goSingleRow = true; - } - // Set initial Query on first tab - if (query != null) - { - m_onlyCurrentRows = false; - gTab.setQuery(query); - } - curTab = gTab; - curTabpanel = fTabPanel; - curTabIndex = tab; - } - } - - Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName()); - curTab.getTableModel().setChanged(false); - curTabIndex = 0; - curTabpanel.query(); - curTabpanel.activate(true); - - if (tabbox.getTabCount() > 0) - { - tabbox.setSelectedIndex(0); - } - toolbar.enableTabNavigation(tabbox.getTabCount() > 1); - toolbar.enableFind(true); - tabbox.evaluate(null); - this.appendChild(tabbox); - - if (gridWindow.isTransaction()) - { - toolbar.enableHistoryRecords(true); - history(1); + protected Component doCreatePart(Component parent) + { + layout = new Borderlayout(); + if (layout != null) { + layout.setParent(parent); + layout.setStyle("position:absolute"); + layout.setHeight("100%"); + layout.setWidth("100%"); + } else { + layout.setPage(page); } - return true; - } - - /** - * Initial Query - * - * @param query - * initial query - * @param mTab - * tab - * @return query or null - */ - private MQuery initialQuery(MQuery query, GridTab mTab) - { - // We have a (Zoom) query - if (query != null && query.isActive() && query.getRecordCount() < 10) - return query; - // - StringBuffer where = new StringBuffer(); - // Query automatically if high volume and no query - boolean require = mTab.isHighVolume(); - if (!require && !m_onlyCurrentRows) // No Trx Window - { - String wh1 = mTab.getWhereExtended(); - if (wh1 == null || wh1.length() == 0) - wh1 = mTab.getWhereClause(); - if (wh1 != null && wh1.length() > 0) - where.append(wh1); - // - if (query != null) - { - String wh2 = query.getWhereClause(); - if (wh2.length() > 0) - { - if (where.length() > 0) - where.append(" AND "); - where.append(wh2); - } - } - // - StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM ") - .append(mTab.getTableName()); - if (where.length() > 0) - sql.append(" WHERE ").append(where); - // Does not consider security - int no = DB.getSQLValue(null, sql.toString()); - // - require = MRole.getDefault().isQueryRequire(no); - } - // Show Query - if (require) - { - GridField[] findFields = mTab.getFields(); - FindWindow find = new FindWindow(curWindowNo, - mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(), - where.toString(), findFields, 10); // no query below 10 - if (find.getTitle() != null && find.getTitle().length() > 0) { - // Title is not set when the number of rows is below the minRecords parameter (10) - find.setVisible(true); - AEnv.showWindow(find); - query = find.getQuery(); - find = null; - } - } - return query; - } // initialQuery - - public String getTitle() - { - return title; - } - - public void onDetailRecord() - { - int maxInd = tabbox.getTabs().getChildren().size() - 1; - int curInd = tabbox.getSelectedIndex(); - if (curInd < maxInd) - { - tabbox.setSelectedIndex(curInd + 1); - } - } - - public void onParentRecord() - { - int curInd = tabbox.getSelectedIndex(); - if (curInd > 0) - { - tabbox.setSelectedIndex(curInd - 1); - } - } - - public void onFirst() - { - curTab.navigate(0); - } - - public void onLast() - { - curTab.navigate(curTab.getRowCount() - 1); - } - - public void onNext() - { - curTab.navigateRelative(+1); - } - - public void onPrevious() - { - curTab.navigateRelative(-1); - } - - public void onHistoryRecords() - { - logger.info(""); - - if (gridWindow.isTransaction()) - { - if (curTab.needSave(true, true)/* && !onSave(false)*/) - return; - - WOnlyCurrentDays ocd = new WOnlyCurrentDays(); - m_onlyCurrentDays = ocd.getCurrentDays(); - - history(m_onlyCurrentDays); - } - } - - private void history(int onlyCurrentDays) - { - if (onlyCurrentDays == 1) // Day - { - m_onlyCurrentRows = true; - onlyCurrentDays = 0; // no Created restriction - } - else - m_onlyCurrentRows = false; - - curTab.setQuery(null); // reset previous queries - MRole role = MRole.getDefault(); - int maxRows = role.getMaxQueryRecords(); - - logger.config("OnlyCurrent=" + m_onlyCurrentRows - + ", Days=" + m_onlyCurrentDays - + ", MaxRows=" + maxRows); - - curTab.query(m_onlyCurrentRows, onlyCurrentDays, maxRows); - - } - - public void onAttachment() - { -/* int record_ID = curTab.getRecord_ID(); - logger.info("Record_ID=" + record_ID); - - if (record_ID == -1) // No Key - { - //aAttachment.setEnabled(false); - return; - } - - // Attachment va = - new WAttachment ( curWindowNo, curTab.getAD_AttachmentID(), - curTab.getAD_Table_ID(), record_ID, null); - - curTab.loadAttachments(); // reload - //aAttachment.setPressed(m_curTab.hasAttachment()); -*/ } - - public void onGridToggle() - { - //curTabpanel.switchRowPresentation(); - - if (!viewed) - { - gridPanel.init(curTab); - viewed = true; - } - - if (changesOccured) - { - changesOccured = false; - gridPanel.clear(); - gridPanel.init(curTab); - } - - if (tabbox.isVisible()) - { - tabbox.setVisible(false); - gridPanel.showGrid(true); - } - else - { - tabbox.setVisible(true); - gridPanel.showGrid(false); - } - - } - - public void onExit() - { - String message = "Please save changes before closing"; - - if (!boolChanges) - { - SessionManager.getAppDesktop().removeWindow(); - } - else - FDialog.info(this.curWindowNo, this, message); - } - - public boolean isAsap() - { - return true; - } - - private void find() - { - MQuery mquery = new MQuery(curTab.getAD_Table_ID()); - - } - - public void onEvent(Event event) - { - if (event.getTarget() instanceof Tab && tabbox.containsTab((Tab)event.getTarget())) - { - - boolean back = false; - - int oldTabIndex = curTabIndex; - int newTabIndex = tabbox.getSelectedIndex(); - - if (oldTabIndex == newTabIndex) - { - return; - } - - if (curTabpanel.isEditing()) - { - FDialog.warn(curWindowNo, "Please save your changes before " + - "switching tabs!!!", title); - tabbox.setSelectedIndex(curTabIndex); - return; - } - - if (!tabbox.updateSelectedIndex(oldTabIndex, newTabIndex)) - { - FDialog.warn(curWindowNo, "TabSwitchJumpGo", title); - return; - } - - back = (newTabIndex < oldTabIndex); - - ADTabpanel oldTabpanel = curTabpanel; - ADTabpanel newTabpanel = tabbox.getSelectedTabpanel(); - curTab = newTabpanel.getGridTab(); - - if (!back) - { - newTabpanel.query(); - } - else - { - newTabpanel.refresh(); - } - - oldTabpanel.activate(false); - newTabpanel.activate(true); - curTabIndex = newTabIndex; - curTabpanel = newTabpanel; - - toolbar.enableChanges(curTab.isReadOnly()); - toolbar.enabledNew(curTab.isInsertRecord()); - - toolbar.enableTabNavigation(curTabIndex > 0, - curTabIndex < (tabbox.getTabCount() - 1)); - } - } - - public void dataStatusChanged(DataStatusEvent e) - { - /* // update Navigation - boolean firstRow = e.isFirstRow(); - boolean lastRow = e.isLastRow(); - toolbar.enableFirstNavigation(!firstRow); - toolbar.enableLastNavigation(!lastRow); - - // update Change - boolean changed = e.isChanged() || e.isInserting(); - boolean readOnly = curTab.isReadOnly(); - boolean insertRecord = !readOnly; - if (insertRecord) - { - insertRecord = curTab.isInsertRecord(); - } - - toolbar.enabledNew(!changed && insertRecord); - toolbar.enableRefresh(!changed); - toolbar.enableDelete(!changed && !readOnly); - - if (readOnly && curTab.isAlwaysUpdateField()) - { - readOnly = false; - } - - lblRecords.setValue(e.getMessage()); - tabbox.evaluate(e);*/ + North n = new North(); + n.setParent(layout); + n.setCollapsible(false); + n.setHeight("30px"); + toolbar.setHeight("30px"); + toolbar.setParent(n); - logger.info(e.getMessage()); - String dbInfo = e.getMessage(); - if (curTab != null && curTab.isQueryActive()) - dbInfo = "[ " + dbInfo + " ]"; - statusBar.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) // replace CR/NL - sb.replace(pos, pos+1, " - "); - statusBar.setStatusLine (sb.toString (), e.isError ()); - } - } - - // Confirm Error - if (e.isError() && !e.isConfirmed()) - { - FDialog.error(curWindowNo, this, e.getAD_Message(), e.getInfo()); - e.setConfirmed(true); // show just once - if MTable.setCurrentRow is involved the status event is re-issued - } - // Confirm Warning - else if (e.isWarning() && !e.isConfirmed()) - { - FDialog.warn(curWindowNo, this, e.getAD_Message(), e.getInfo()); - 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); - toolbar.enableLastNavigation(!lastRow); - - // update Change - boolean changed = e.isChanged() || e.isInserting(); - boolChanges = changed; - boolean readOnly = curTab.isReadOnly(); - boolean insertRecord = !readOnly; + contentArea = new Center(); + contentArea.setParent(layout); + contentArea.setAutoscroll(true); + contentArea.setFlex(true); + adTab.createPart(contentArea); - if (insertRecord) - { - insertRecord = curTab.isInsertRecord(); - } - toolbar.enabledNew(!changed && insertRecord); - toolbar.enableCopy(!changed && insertRecord); - toolbar.enableRefresh(!changed); - toolbar.enableDelete(!changed && !readOnly); - // - if (readOnly && curTab.isAlwaysUpdateField()) - { - readOnly = false; - } - toolbar.enableIgnore(changed && !readOnly); - toolbar.enableSave(changed && !readOnly); + South s = new South(); + layout.appendChild(s); + s.setCollapsible(false); + statusBar.setParent(s); + LayoutUtils.addSclass("adwindow-status", statusBar); - // - // No Rows - if (e.getTotalRows() == 0 && insertRecord) + if (adTab.isUseExternalSelection()) { - toolbar.enabledNew(true); - toolbar.enableDelete(false); - toolbar.enableDeleteSelection(false); - } - else - { - toolbar.enableDeleteSelection(true); - } - - // Single-Multi -// aMulti.setPressed(!m_curGC.isSingleRow()); - - // History (on first Tab only) - if (isFirstTab()) - { -// aHistory.setPressed(!curTab.isOnlyCurrentRows()); - } - - // Transaction info - String trxInfo = curTab.getTrxInfo(); - if (trxInfo != null) - { -// statusBar.setInfo(trxInfo); - } - - // Check Attachment - boolean canHaveAttachment = curTab.canHaveAttachment(); // not single _ID column - // - if (canHaveAttachment && e.isLoading() && - curTab.getCurrentRow() > e.getLoadedRows()) - { - canHaveAttachment = false; - } - if (canHaveAttachment && curTab.getRecord_ID() == -1) // No Key - { - canHaveAttachment = false; - } - if (canHaveAttachment) - { - toolbar.enableAttachment(true); - /*aAttachment.setPressed(m_curTab.hasAttachment()); - aChat.setEnabled(true); - aChat.setPressed(m_curTab.hasChat());*/ - } - else - { - toolbar.enableAttachment(false); -// aChat.setEnabled(false); - } - // Lock Indicator - /* if (m_isPersonalLock) - { - aLock.setPressed(m_curTab.isLocked()); - }*/ - - tabbox.evaluate(e); - - - toolbar.enablePrint(true); - toolbar.enableReport(true); - } - - public boolean isFirstTab() - { - int selTabIndex = tabbox.getSelectedIndex(); - return (selTabIndex == 0); - } - - public void onRefresh() - { - curTab.dataRefreshAll(); - curTabpanel.dynamicDisplay(0); - } - - public void onHelp() - { - WebDoc doc = gridWindow.getHelpDoc(true); - SessionManager.getAppDesktop().showURL(doc, "Help", true); - } - - public void onNew() - { - if (!curTab.isInsertRecord()) - { - logger.warning("Insert Record disabled for Tab"); - return; + West w = new West(); + layout.appendChild(w); + w.setSplittable(false); + w.setAutoscroll(true); + LayoutUtils.addSclass("adwindow-nav", w); + adTab.getTabSelectionComponent().setParent(w); + LayoutUtils.addSclass("adwindow-nav-content", (HtmlBasedComponent) adTab.getTabSelectionComponent()); } - newRecord = curTab.dataNew (false); - if (newRecord) - { - - curTabpanel.editRecord(true); - curTabpanel.dynamicDisplay(0); - toolbar.enableChanges(false); - toolbar.enableDelete(false); - toolbar.enableNavigation(false); - toolbar.enableTabNavigation(false); - toolbar.enableIgnore(true); - toolbar.enablePrint(true); - toolbar.enableReport(true); + if (parent instanceof Tabpanel) { + TabOnCloseHanlder handler = new TabOnCloseHanlder(); + ((Tabpanel)parent).setOnCloseHandler(handler); } - else - { - logger.severe("Could not create new record"); - } - - } - - public void onFind() - { - if (curTab == null) - return; - - // Gets Fields from AD_Field_v - GridField[] findFields = GridField.createFields(ctx, curTab.getWindowNo(), 0,curTab.getAD_Tab_ID()); - FindWindow find = new FindWindow (curTab.getWindowNo(), curTab.getName(), - curTab.getAD_Table_ID(), curTab.getTableName(), - curTab.getWhereExtended(), findFields, 1); - AEnv.showWindow(find); - MQuery query = find.getQuery(); - - find = null; - - // Confirmed query - if (query != null) - { - m_onlyCurrentRows = false; // search history too - curTab.setQuery(query); - curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, 0); // autoSize - } - } - - public void onIgnore() - { - curTab.dataIgnore(); - curTab.dataRefresh(); - curTabpanel.dynamicDisplay(0); - curTabpanel.editRecord(false); - toolbar.enableIgnore(false); - } - - public void onEdit() - { - curTabpanel.editRecord(true); - toolbar.enableIgnore(true); - toolbar.enabledNew(false); - toolbar.enableDelete(false); - toolbar.enableNavigation(false); - toolbar.enableTabNavigation(false); - toolbar.enablePrint(true); - toolbar.enableReport(true); - } - - public void onSave() - { - changesOccured = true; - - boolean retValue = curTab.dataSave(true); - - if (!retValue) - { - FDialog.error(curWindowNo, this, "SaveIgnored"); - statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "SaveIgnored"), true); - } - curTabpanel.dynamicDisplay(0); - } - - public void onDelete() - { - if (curTab.isReadOnly()) - { - return; - } - - if (FDialog.ask(curWindowNo, this, "DeleteRecord?")) - { - if (!curTab.dataDelete()) - { - FDialog.error(curWindowNo, "Could not delete record", "Error"); - } - } - curTabpanel.dynamicDisplay(0); + return layout; } - public void onPrint() { - //Get process defined for this tab - int AD_Process_ID = curTab.getAD_Process_ID(); - //log.info("ID=" + AD_Process_ID); + protected IADTab createADTab() + { + CompositeADTab composite = new CompositeADTab(); + return composite; + } - // No report defined - if (AD_Process_ID == 0) - { - onReport(); - - return; - } - - //TODO: cmd_save(false) -> onSave ? - //onSave(); - // - int table_ID = curTab.getAD_Table_ID(); - int record_ID = curTab.getRecord_ID(); - - ProcessModalDialog dialog = new ProcessModalDialog(null,this.getTitle(),null,0, - AD_Process_ID,table_ID, record_ID, true); - if (dialog.isValid()) { - dialog.setPosition("center"); - try { - dialog.doModal(); - } - catch (InterruptedException e) { - - e.printStackTrace(); - } - } + public Component getComponent() { + return layout; } - - public void onReport() { - if (!MRole.getDefault().isCanReport(curTab.getAD_Table_ID())) - { - FDialog.error(curWindowNo, this, "AccessCannotReport"); - return; - } + + class TabOnCloseHanlder implements ITabOnCloseHandler { - //TODO: cmd_save(false); -> onSave ? - - // Query - MQuery query = new MQuery(curTab.getTableName()); - // Link for detail records - String queryColumn = curTab.getLinkColumnName(); - // Current row otherwise - if (queryColumn.length() == 0) - queryColumn = curTab.getKeyColumnName(); - // Find display - String infoName = null; - String infoDisplay = null; - for (int i = 0; i < curTab.getFieldCount(); i++) - { - GridField field = curTab.getField(i); - if (field.isKey()) - infoName = field.getHeader(); - if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo") ) - && field.getValue() != null) - infoDisplay = field.getValue().toString(); - if (infoName != null && infoDisplay != null) - break; - } - if (queryColumn.length() != 0) - { - if (queryColumn.endsWith("_ID")) - query.addRestriction(queryColumn, MQuery.EQUAL, - new Integer(Env.getContextAsInt(ctx, curWindowNo, queryColumn)), - infoName, infoDisplay); - else - query.addRestriction(queryColumn, MQuery.EQUAL, - Env.getContext(ctx, curWindowNo, queryColumn), - infoName, infoDisplay); - } - - new WReport (curTab.getAD_Table_ID(), query, null, curWindowNo); - - } - - /************************************************************************** - * Start Button Process - * @param vButton button - */ - private void actionButton (WButtonEditor wButton) - { - logger.info(wButton.toString()); - - boolean startWOasking = false; - boolean batch = false; - String col = wButton.getColumnName(); - - // Zoom - - if (col.equals("Record_ID")) - { - int AD_Table_ID = Env.getContextAsInt (ctx, curWindowNo, "AD_Table_ID"); - int Record_ID = Env.getContextAsInt (ctx, curWindowNo, "Record_ID"); - AEnv.zoom(AD_Table_ID, Record_ID); - return; - } // Zoom - - // save first --------------- - - if (curTab.needSave(true, false)) - onSave(); - - int table_ID = curTab.getAD_Table_ID(); - - // Record_ID - - int record_ID = curTab.getRecord_ID(); - - // Record_ID - Language Handling - - if (record_ID == -1 && curTab.getKeyColumnName().equals("AD_Language")) - record_ID = Env.getContextAsInt (ctx, curWindowNo, "AD_Language_ID"); - - // Record_ID - Change Log ID - - if (record_ID == -1 - && (wButton.getProcess_ID() == 306 || wButton.getProcess_ID() == 307)) - { - Integer id = (Integer)curTab.getValue("AD_ChangeLog_ID"); - record_ID = id.intValue(); - } - - // Ensure it's saved - - if (record_ID == -1 && curTab.getKeyColumnName().endsWith("_ID")) - { - FDialog.error(curWindowNo, this, "SaveErrorRowNotFound"); - return; - } - - // Pop up Payment Rules - - if (col.equals("PaymentRule")) - { - WPayment vp = new WPayment(curWindowNo, curTab, wButton); - - - if (vp.isInitOK()) // may not be allowed - { - vp.setVisible(true); - AEnv.showWindow(vp); - } - //vp.dispose(); - - if (vp.needSave()) - { - onSave(); - onRefresh(); - } - } // PaymentRule - - // Pop up Document Action (Workflow) - - else if (col.equals("DocAction")) - { - WDocActionPanel win = new WDocActionPanel(curTab); - //if (win.getNumberOfOptions() == 0) - //{ - // vda.dispose (); - // log.info("DocAction - No Options"); - // return; - //} - //else - { - win.setVisible(true); - AEnv.showWindow(win); - - if (!win.isStartProcess()) - return; - - //batch = win.isBatch(); - startWOasking = true; - //vda.dispose(); - } } // DocAction - - // Pop up Create From - - else if (col.equals("CreateFrom")) - { - // curWindowNo - WCreateFrom wcf = WCreateFrom.create(curTab); - - if (wcf != null) - { - if (wcf.isInitOK()) - { - wcf.setVisible(true); - curTab.dataRefresh(); + public void onClose(Tabpanel tabPanel) { + if (ADWindowPanel.this.onExit()) { + Tab tab = tabPanel.getLinkedTab(); + Tabbox tabbox = (Tabbox) tab.getTabbox(); + if (tabbox.getSelectedTab() == tab) { + Tabs tabs = (Tabs) tabbox.getTabs(); + List childs = tabs.getChildren(); + for(int i = 0; i < childs.size(); i++) { + if (childs.get(i) == tab) { + if (i > 0) + tabbox.setSelectedIndex((i-1)); + break; + } + } } - return; + tabPanel.detach(); + tab.detach(); } - // else may start process - } // CreateFrom - - // Posting ----- - - else if (col.equals("Posted") && MRole.getDefault().isShowAcct()) - { - // Check Doc Status - - String processed = Env.getContext(ctx, curWindowNo, "Processed"); - - if (!processed.equals("Y")) - { - String docStatus = Env.getContext(ctx, curWindowNo, "DocStatus"); - - if (DocAction.STATUS_Completed.equals(docStatus) - || DocAction.STATUS_Closed.equals(docStatus) - || DocAction.STATUS_Reversed.equals(docStatus) - || DocAction.STATUS_Voided.equals(docStatus)) - ; - else - { - FDialog.error(curWindowNo, this, "PostDocNotComplete"); - return; - } - } - - // Check Post Status - Object ps = curTab.getValue("Posted"); - - if (ps != null && ps.equals("Y")) - { - new org.adempiere.webui.acct.WAcctViewer(Env.getContextAsInt (ctx, curWindowNo, "AD_Client_ID"), - curTab.getAD_Table_ID(), curTab.getRecord_ID()); - } - else - { - if (FDialog.ask(curWindowNo, this, "PostImmediate?")) - { - boolean force = ps != null && !ps.equals ("N"); // force when problems - - String error = AEnv.postImmediate (curWindowNo, Env.getAD_Client_ID(ctx), - curTab.getAD_Table_ID(), curTab.getRecord_ID(), force); - - curTab.dataRefresh(); - - if (error != null) - FDialog.error(curWindowNo, this, "PostingError-N", error); - } - } - return; - } // Posted - - /** - * Start Process ---- - */ - - logger.config("Process_ID=" + wButton.getProcess_ID() + ", Record_ID=" + record_ID); - - if (wButton.getProcess_ID() == 0) - return; - - // Save item changed - - if (curTab.needSave(true, false)) - this.onSave(); - - // hengsin - [ 1639242 ] Inconsistent appearance of Process/Report Dialog - // globalqss - Add support for Don't ShowHelp option in Process - // this code must be changed if integrated the parameters and help in only one window - /* - MProcess pr = new MProcess(m_ctx, vButton.getProcess_ID(), null); - if (pr.getShowHelp() != null && pr.getShowHelp().equals("N")) { - startWOasking = true; } - // end globalqss - - // Ask user to start process, if Description and Help is not empty - - if (!startWOasking && !(vButton.getDescription().equals("") && vButton.getHelp().equals(""))) - if (!ADialog.ask(m_curWindowNo, this, "StartProcess?", - // "" + vButton.getText() + "
" + - vButton.getDescription() + "\n" + vButton.getHelp())) - return; - // - String title = vButton.getDescription(); - if (title == null || title.length() == 0) - title = vButton.getName(); - ProcessInfo pi = new ProcessInfo (title, vButton.getProcess_ID(), table_ID, record_ID); - pi.setAD_User_ID (Env.getAD_User_ID(m_ctx)); - pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx)); - pi.setIsBatch(batch); - - // Trx trx = Trx.get(Trx.createTrxName("AppsPanel"), true); - ProcessCtl.process(this, m_curWindowNo, pi, null); // calls lockUI, unlockUI - */ - - ProcessModalDialog dialog = new ProcessModalDialog(null, - Env.getHeader(ctx, curWindowNo), null, curWindowNo, - wButton.getProcess_ID(), table_ID, record_ID, startWOasking); - - if (dialog.isValid()) - { - dialog.setWidth("500px"); - dialog.setVisible(true); - dialog.setPosition("center"); - AEnv.showWindow(dialog); - } - curTab.dataRefresh(); - curTabpanel.dynamicDisplay(0); - } // actionButton - - public void actionPerformed(ActionEvent event) - { - if (event.getSource() instanceof WButtonEditor) - { - actionButton((WButtonEditor)event.getSource()); - } } } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java new file mode 100644 index 0000000000..fdf957a55d --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java @@ -0,0 +1,1182 @@ +/****************************************************************************** + * 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.panel; + +import java.util.Properties; + +import org.adempiere.webui.apps.AEnv; +import org.adempiere.webui.apps.ProcessModalDialog; +import org.adempiere.webui.apps.WReport; +import org.adempiere.webui.apps.form.WCreateFrom; +import org.adempiere.webui.apps.form.WPayment; +import org.adempiere.webui.component.CWindowToolbar; +import org.adempiere.webui.component.IADTabList; +import org.adempiere.webui.component.IADTab; +import org.adempiere.webui.editor.WButtonEditor; +import org.adempiere.webui.event.ActionEvent; +import org.adempiere.webui.event.ActionListener; +import org.adempiere.webui.event.ToolbarListener; +import org.adempiere.webui.exception.ApplicationException; +import org.adempiere.webui.panel.StatusBarPanel; +import org.adempiere.webui.panel.WDocActionPanel; +import org.adempiere.webui.panel.WOnlyCurrentDays; +import org.adempiere.webui.part.AbstractUIPart; +import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.window.FDialog; +import org.adempiere.webui.window.FindWindow; +import org.compiere.model.DataStatusEvent; +import org.compiere.model.DataStatusListener; +import org.compiere.model.GridField; +import org.compiere.model.GridTab; +import org.compiere.model.GridWindow; +import org.compiere.model.GridWindowVO; +import org.compiere.model.MQuery; +import org.compiere.model.MRole; +import org.compiere.process.DocAction; +import org.compiere.util.CLogger; +import org.compiere.util.DB; +import org.compiere.util.Env; +import org.compiere.util.Msg; +import org.compiere.util.WebDoc; +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.Executions; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; + +/** + * + * This class is based on org.compiere.apps.APanel written by Jorg Janke. + * @author Jorg Janke + * + * @author Ashley G Ramdass + * @author Low Heng Sin + * @date Feb 25, 2007 + * @version $Revision: 0.10 $ + */ +public abstract class AbstractADWindowPanel extends AbstractUIPart implements ToolbarListener, + EventListener, DataStatusListener, ActionListener +{ + private static final long serialVersionUID = 1L; + + private static final CLogger logger; + + static + { + logger = CLogger.getCLogger(AbstractADWindowPanel.class); + } + + private Properties ctx; + + private GridWindow gridWindow; + + protected StatusBarPanel statusBar; + + protected IADTab adTab; + + private int curWindowNo; + + private GridTab curTab; + + private boolean m_onlyCurrentRows = true; + + private ADTabpanel curTabpanel; + + protected CWindowToolbar toolbar; + + private int curTabIndex; + + protected String title; + + private boolean newRecord; + + private boolean boolChanges = false; + + private boolean viewed = false; + + private boolean changesOccured = false; + + private int m_onlyCurrentDays = 0; + + private Component parent; + + public AbstractADWindowPanel(Properties ctx, int windowNo) + { + this.ctx = ctx; + this.curWindowNo = windowNo; + + initComponents(); + } + + public Component createPart(Object parent) + { + if (parent instanceof Component) + this.parent = (Component) parent; + + adTab = createADTab(); + adTab.addSelectionEventListener(this); + + return super.createPart(parent); + } + + public StatusBarPanel getStatusBar() + { + return statusBar; + } + + private void initComponents() + { + /** Initalise toolbar */ + toolbar = new CWindowToolbar(); + toolbar.addListener(this); + toolbar.setWidth("100%"); + + statusBar = new StatusBarPanel(); + } + + protected abstract IADTab createADTab(); + + public boolean initPanel(int adWindowId, MQuery query) + { + // Set AutoCommit for this Window + Env.setAutoCommit(ctx, curWindowNo, Env.isAutoCommit(ctx)); + boolean autoNew = Env.isAutoNew(ctx); + Env.setAutoNew(ctx, curWindowNo, autoNew); + + GridWindowVO gWindowVO = AEnv.getMWindowVO(curWindowNo, adWindowId, 0); + if (gWindowVO == null) + { + throw new ApplicationException(Msg.getMsg(ctx, + "AccessTableNoView") + + "(No Window Model Info)"); + } + gridWindow = new GridWindow(gWindowVO); + title = gridWindow.getName(); + + // Set SO/AutoNew for Window + Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx()); + if (!autoNew && gridWindow.isTransaction()) + { + Env.setAutoNew(ctx, curWindowNo, true); + } + + m_onlyCurrentRows = gridWindow.isTransaction(); + + /** + * Window Tabs + */ + int tabSize = gridWindow.getTabCount(); + + for (int tab = 0; tab < tabSize; tab++) + { + gridWindow.initTab(tab); + + GridTab gTab = gridWindow.getTab(tab); + Env.setContext(ctx, curWindowNo, tab, "TabLevel", Integer + .toString(gTab.getTabLevel())); + + ADTabpanel fTabPanel = new ADTabpanel(); + fTabPanel.init(this, curWindowNo, gTab, gridWindow); + if (tab == 0) + fTabPanel.createUI(); + + gTab.addDataStatusListener(this); + + adTab.addTab(gTab, fTabPanel); + + // Query first tab + if (tab == 0) + { + query = initialQuery(query, gTab); + if (query != null && query.getRecordCount() <= 1) + { + // goSingleRow = true; + } + // Set initial Query on first tab + if (query != null) + { + m_onlyCurrentRows = false; + gTab.setQuery(query); + } + curTab = gTab; + curTabpanel = fTabPanel; + curTabIndex = tab; + } + } + +// ADTabListModel model = new ADTabListModel(tabLabelList, tabbox); +// tabList.setItemRenderer(model); +// tabList.setModel(model); +// tabList.setSelectedIndex(0); + + Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName()); + curTab.getTableModel().setChanged(false); + curTabIndex = 0; + curTabpanel.query(); + curTabpanel.activate(true); + + //if (tabbox.getTabCount() > 0) + //{ + adTab.setSelectedIndex(0); + //} + toolbar.enableTabNavigation(adTab.getTabCount() > 1); + toolbar.enableFind(true); + adTab.evaluate(null); + + //force sync model +// tabList.setModel(tabList.getModel()); + + if (gridWindow.isTransaction()) + { + toolbar.enableHistoryRecords(true); + history(1); + } + + updateToolbar(); + + return true; + } + + /** + * Initial Query + * + * @param query + * initial query + * @param mTab + * tab + * @return query or null + */ + private MQuery initialQuery(MQuery query, GridTab mTab) + { + // We have a (Zoom) query + if (query != null && query.isActive() && query.getRecordCount() < 10) + return query; + // + StringBuffer where = new StringBuffer(); + // Query automatically if high volume and no query + boolean require = mTab.isHighVolume(); + if (!require && !m_onlyCurrentRows) // No Trx Window + { + String wh1 = mTab.getWhereExtended(); + if (wh1 == null || wh1.length() == 0) + wh1 = mTab.getWhereClause(); + if (wh1 != null && wh1.length() > 0) + where.append(wh1); + // + if (query != null) + { + String wh2 = query.getWhereClause(); + if (wh2.length() > 0) + { + if (where.length() > 0) + where.append(" AND "); + where.append(wh2); + } + } + // + StringBuffer sql = new StringBuffer("SELECT COUNT(*) FROM ") + .append(mTab.getTableName()); + if (where.length() > 0) + sql.append(" WHERE ").append(where); + // Does not consider security + int no = DB.getSQLValue(null, sql.toString()); + // + require = MRole.getDefault().isQueryRequire(no); + } + // Show Query + if (require) + { + GridField[] findFields = mTab.getFields(); + FindWindow find = new FindWindow(curWindowNo, + mTab.getName(), mTab.getAD_Table_ID(), mTab.getTableName(), + where.toString(), findFields, 10); // no query below 10 + if (find.getTitle() != null && find.getTitle().length() > 0) { + // Title is not set when the number of rows is below the minRecords parameter (10) + find.setVisible(true); + AEnv.showWindow(find); + query = find.getQuery(); + find = null; + } + } + return query; + } // initialQuery + + public String getTitle() + { + return title; + } + + public void onDetailRecord() + { + int maxInd = adTab.getTabCount() - 1; + int curInd = adTab.getSelectedIndex(); + if (curInd < maxInd) + { + setActiveTab(curInd + 1); + } + } + + public void onParentRecord() + { + int curInd = adTab.getSelectedIndex(); + if (curInd > 0) + { + setActiveTab(curInd - 1); + } + } + + public void onFirst() + { + curTab.navigate(0); + } + + public void onLast() + { + curTab.navigate(curTab.getRowCount() - 1); + } + + public void onNext() + { + curTab.navigateRelative(+1); + } + + public void onPrevious() + { + curTab.navigateRelative(-1); + } + + public void onHistoryRecords() + { + logger.info(""); + + if (gridWindow.isTransaction()) + { + if (curTab.needSave(true, true)/* && !onSave(false)*/) + return; + + WOnlyCurrentDays ocd = new WOnlyCurrentDays(); + m_onlyCurrentDays = ocd.getCurrentDays(); + + history(m_onlyCurrentDays); + } + } + + private void history(int onlyCurrentDays) + { + if (onlyCurrentDays == 1) // Day + { + m_onlyCurrentRows = true; + onlyCurrentDays = 0; // no Created restriction + } + else + m_onlyCurrentRows = false; + + curTab.setQuery(null); // reset previous queries + MRole role = MRole.getDefault(); + int maxRows = role.getMaxQueryRecords(); + + logger.config("OnlyCurrent=" + m_onlyCurrentRows + + ", Days=" + m_onlyCurrentDays + + ", MaxRows=" + maxRows); + + curTab.query(m_onlyCurrentRows, onlyCurrentDays, maxRows); + + } + + public void onAttachment() + { + int record_ID = curTab.getRecord_ID(); + logger.info("Record_ID=" + record_ID); + + if (record_ID == -1) // No Key + { + //aAttachment.setEnabled(false); + return; + } + + // Attachment va = + new WAttachment ( curWindowNo, curTab.getAD_AttachmentID(), + curTab.getAD_Table_ID(), record_ID, null); + + curTab.loadAttachments(); // reload + //aAttachment.setPressed(m_curTab.hasAttachment()); + } + + public void onGridToggle() + { + curTabpanel.switchRowPresentation(); + + /* + if (!viewed) + { + viewed = true; + } + + if (changesOccured) + { + changesOccured = false; + } + + if (tabbox.isVisible()) + { + tabbox.setVisible(false); + } + else + { + tabbox.setVisible(true); + } + */ + } + + public boolean onExit() + { + String message = "Please save changes before closing"; + + if (!boolChanges) + { + return true; + } + else + FDialog.info(this.curWindowNo, null, message); + + return false; + } + + public boolean isAsap() + { + return true; + } + + private void find() + { + MQuery mquery = new MQuery(curTab.getAD_Table_ID()); + + } + + public void onEvent(Event event) + { + if (!Events.ON_SELECT.equals(event.getName())) + return; + + 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(); + } + } + + if (tabList != null) + { + int newTabIndex = tabList.getSelectedIndex(); + + if (setActiveTab(newTabIndex)) + { + //force sync model + tabList.refresh(); + } + else + { + //reset to original + tabList.setSelectedIndex(curTabIndex); + } + } + } + + private boolean setActiveTab(int newTabIndex) { + boolean back = false; + + int oldTabIndex = curTabIndex; + + if (oldTabIndex == newTabIndex) + { + return true; + } + + if (curTabpanel.isEditing()) + { + FDialog.warn(curWindowNo, "Please save your changes before " + + "switching tabs!!!", title); + return false; + } + + if (!adTab.updateSelectedIndex(oldTabIndex, newTabIndex)) + { + FDialog.warn(curWindowNo, "TabSwitchJumpGo", title); + return false; + } + + back = (newTabIndex < oldTabIndex); + + ADTabpanel oldTabpanel = curTabpanel; + ADTabpanel newTabpanel = adTab.getSelectedTabpanel(); + curTab = newTabpanel.getGridTab(); + + if (oldTabpanel != null) + oldTabpanel.activate(false); + newTabpanel.activate(true); + + if (!back) + { + newTabpanel.query(); + } + else + { + newTabpanel.refresh(); + } + + curTabIndex = newTabIndex; + curTabpanel = newTabpanel; + + updateToolbar(); + + return true; + } + + private void updateToolbar() { + toolbar.enableChanges(curTab.isReadOnly()); + toolbar.enabledNew(curTab.isInsertRecord()); + + toolbar.enableTabNavigation(curTabIndex > 0, + curTabIndex < (adTab.getTabCount() - 1)); + } + + public void dataStatusChanged(DataStatusEvent e) + { + //TODO: ignore non-ui thread event for now. + if (Executions.getCurrent() == null) + return; + + /* // update Navigation + boolean firstRow = e.isFirstRow(); + boolean lastRow = e.isLastRow(); + toolbar.enableFirstNavigation(!firstRow); + toolbar.enableLastNavigation(!lastRow); + + // update Change + boolean changed = e.isChanged() || e.isInserting(); + boolean readOnly = curTab.isReadOnly(); + boolean insertRecord = !readOnly; + if (insertRecord) + { + insertRecord = curTab.isInsertRecord(); + } + + toolbar.enabledNew(!changed && insertRecord); + toolbar.enableRefresh(!changed); + toolbar.enableDelete(!changed && !readOnly); + + if (readOnly && curTab.isAlwaysUpdateField()) + { + readOnly = false; + } + + lblRecords.setValue(e.getMessage()); + tabbox.evaluate(e);*/ + + logger.info(e.getMessage()); + String dbInfo = e.getMessage(); + if (curTab != null && curTab.isQueryActive()) + dbInfo = "[ " + dbInfo + " ]"; + statusBar.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) // replace CR/NL + sb.replace(pos, pos+1, " - "); + statusBar.setStatusLine (sb.toString (), e.isError ()); + } + } + + // Confirm Error + if (e.isError() && !e.isConfirmed()) + { + FDialog.error(curWindowNo, null, e.getAD_Message(), e.getInfo()); + e.setConfirmed(true); // show just once - if MTable.setCurrentRow is involved the status event is re-issued + } + // Confirm Warning + else if (e.isWarning() && !e.isConfirmed()) + { + FDialog.warn(curWindowNo, null, e.getAD_Message(), e.getInfo()); + 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); + toolbar.enableLastNavigation(!lastRow); + + // update Change + boolean changed = e.isChanged() || e.isInserting(); + boolChanges = changed; + boolean readOnly = curTab.isReadOnly(); + boolean insertRecord = !readOnly; + + if (insertRecord) + { + insertRecord = curTab.isInsertRecord(); + } + toolbar.enabledNew(!changed && insertRecord); + toolbar.enableCopy(!changed && insertRecord); + toolbar.enableRefresh(!changed); + toolbar.enableDelete(!changed && !readOnly); + // + if (readOnly && curTab.isAlwaysUpdateField()) + { + readOnly = false; + } + toolbar.enableIgnore(changed && !readOnly); + toolbar.enableSave(changed && !readOnly); + + // + // No Rows + if (e.getTotalRows() == 0 && insertRecord) + { + toolbar.enabledNew(true); + toolbar.enableDelete(false); + toolbar.enableDeleteSelection(false); + } + else + { + toolbar.enableDeleteSelection(true); + } + + // Single-Multi +// aMulti.setPressed(!m_curGC.isSingleRow()); + + // History (on first Tab only) + if (isFirstTab()) + { +// aHistory.setPressed(!curTab.isOnlyCurrentRows()); + } + + // Transaction info + String trxInfo = curTab.getTrxInfo(); + if (trxInfo != null) + { +// statusBar.setInfo(trxInfo); + } + + // Check Attachment + boolean canHaveAttachment = curTab.canHaveAttachment(); // not single _ID column + // + if (canHaveAttachment && e.isLoading() && + curTab.getCurrentRow() > e.getLoadedRows()) + { + canHaveAttachment = false; + } + if (canHaveAttachment && curTab.getRecord_ID() == -1) // No Key + { + canHaveAttachment = false; + } + if (canHaveAttachment) + { + toolbar.enableAttachment(true); + /*aAttachment.setPressed(m_curTab.hasAttachment()); + aChat.setEnabled(true); + aChat.setPressed(m_curTab.hasChat());*/ + } + else + { + toolbar.enableAttachment(false); +// aChat.setEnabled(false); + } + // Lock Indicator + /* if (m_isPersonalLock) + { + aLock.setPressed(m_curTab.isLocked()); + }*/ + + adTab.evaluate(e); + + toolbar.enablePrint(true); + toolbar.enableReport(true); + } + + public boolean isFirstTab() + { + int selTabIndex = adTab.getSelectedIndex(); + return (selTabIndex == 0); + } + + public void onRefresh() + { + curTab.dataRefreshAll(); + curTabpanel.dynamicDisplay(0); + } + + public void onHelp() + { + WebDoc doc = gridWindow.getHelpDoc(true); + SessionManager.getAppDesktop().showURL(doc, "Help", true); + } + + public void onNew() + { + if (!curTab.isInsertRecord()) + { + logger.warning("Insert Record disabled for Tab"); + return; + } + + newRecord = curTab.dataNew (false); + if (newRecord) + { + + curTabpanel.editRecord(true); + curTabpanel.dynamicDisplay(0); + toolbar.enableChanges(false); + toolbar.enableDelete(false); + toolbar.enableNavigation(false); + toolbar.enableTabNavigation(false); + toolbar.enableIgnore(true); + toolbar.enablePrint(true); + toolbar.enableReport(true); + } + else + { + logger.severe("Could not create new record"); + } + + } + + public void onFind() + { + if (curTab == null) + return; + + // Gets Fields from AD_Field_v + GridField[] findFields = GridField.createFields(ctx, curTab.getWindowNo(), 0,curTab.getAD_Tab_ID()); + FindWindow find = new FindWindow (curTab.getWindowNo(), curTab.getName(), + curTab.getAD_Table_ID(), curTab.getTableName(), + curTab.getWhereExtended(), findFields, 1); + AEnv.showWindow(find); + MQuery query = find.getQuery(); + + find = null; + + // Confirmed query + if (query != null) + { + m_onlyCurrentRows = false; // search history too + curTab.setQuery(query); + curTabpanel.query(m_onlyCurrentRows, m_onlyCurrentDays, 0); // autoSize + } + } + + public void onIgnore() + { + curTab.dataIgnore(); + curTab.dataRefresh(); + curTabpanel.dynamicDisplay(0); + curTabpanel.editRecord(false); + toolbar.enableIgnore(false); + } + + public void onEdit() + { + curTabpanel.editRecord(true); + toolbar.enableIgnore(true); + toolbar.enabledNew(false); + toolbar.enableDelete(false); + toolbar.enableNavigation(false); + toolbar.enableTabNavigation(false); + toolbar.enablePrint(true); + toolbar.enableReport(true); + } + + public void onSave() + { + changesOccured = true; + + boolean retValue = curTab.dataSave(true); + + if (!retValue) + { + FDialog.error(curWindowNo, parent, "SaveIgnored"); + statusBar.setStatusLine(Msg.getMsg(Env.getCtx(), "SaveIgnored"), true); + } + curTabpanel.dynamicDisplay(0); + } + + public void onDelete() + { + if (curTab.isReadOnly()) + { + return; + } + + if (FDialog.ask(curWindowNo, null, "DeleteRecord?")) + { + if (!curTab.dataDelete()) + { + FDialog.error(curWindowNo, "Could not delete record", "Error"); + } + } + curTabpanel.dynamicDisplay(0); + } + + public void onPrint() { + //Get process defined for this tab + int AD_Process_ID = curTab.getAD_Process_ID(); + //log.info("ID=" + AD_Process_ID); + + // No report defined + if (AD_Process_ID == 0) + { + onReport(); + + return; + } + + //TODO: cmd_save(false) -> onSave ? + //onSave(); + // + int table_ID = curTab.getAD_Table_ID(); + int record_ID = curTab.getRecord_ID(); + + ProcessModalDialog dialog = new ProcessModalDialog(null,this.getTitle(),null,0, + AD_Process_ID,table_ID, record_ID, true); + if (dialog.isValid()) { + dialog.setPosition("center"); + try { + dialog.doModal(); + } + catch (InterruptedException e) { + + e.printStackTrace(); + } + } + } + + public void onReport() { + if (!MRole.getDefault().isCanReport(curTab.getAD_Table_ID())) + { + FDialog.error(curWindowNo, parent, "AccessCannotReport"); + return; + } + + //TODO: cmd_save(false); -> onSave ? + + // Query + MQuery query = new MQuery(curTab.getTableName()); + // Link for detail records + String queryColumn = curTab.getLinkColumnName(); + // Current row otherwise + if (queryColumn.length() == 0) + queryColumn = curTab.getKeyColumnName(); + // Find display + String infoName = null; + String infoDisplay = null; + for (int i = 0; i < curTab.getFieldCount(); i++) + { + GridField field = curTab.getField(i); + if (field.isKey()) + infoName = field.getHeader(); + if ((field.getColumnName().equals("Name") || field.getColumnName().equals("DocumentNo") ) + && field.getValue() != null) + infoDisplay = field.getValue().toString(); + if (infoName != null && infoDisplay != null) + break; + } + if (queryColumn.length() != 0) + { + if (queryColumn.endsWith("_ID")) + query.addRestriction(queryColumn, MQuery.EQUAL, + new Integer(Env.getContextAsInt(ctx, curWindowNo, queryColumn)), + infoName, infoDisplay); + else + query.addRestriction(queryColumn, MQuery.EQUAL, + Env.getContext(ctx, curWindowNo, queryColumn), + infoName, infoDisplay); + } + + new WReport (curTab.getAD_Table_ID(), query, null, curWindowNo); + + } + + /************************************************************************** + * Start Button Process + * @param vButton button + */ + private void actionButton (WButtonEditor wButton) + { + logger.info(wButton.toString()); + + boolean startWOasking = false; + boolean batch = false; + String col = wButton.getColumnName(); + + // Zoom + + if (col.equals("Record_ID")) + { + int AD_Table_ID = Env.getContextAsInt (ctx, curWindowNo, "AD_Table_ID"); + int Record_ID = Env.getContextAsInt (ctx, curWindowNo, "Record_ID"); + AEnv.zoom(AD_Table_ID, Record_ID); + return; + } // Zoom + + // save first --------------- + + if (curTab.needSave(true, false)) + onSave(); + + int table_ID = curTab.getAD_Table_ID(); + + // Record_ID + + int record_ID = curTab.getRecord_ID(); + + // Record_ID - Language Handling + + if (record_ID == -1 && curTab.getKeyColumnName().equals("AD_Language")) + record_ID = Env.getContextAsInt (ctx, curWindowNo, "AD_Language_ID"); + + // Record_ID - Change Log ID + + if (record_ID == -1 + && (wButton.getProcess_ID() == 306 || wButton.getProcess_ID() == 307)) + { + Integer id = (Integer)curTab.getValue("AD_ChangeLog_ID"); + record_ID = id.intValue(); + } + + // Ensure it's saved + + if (record_ID == -1 && curTab.getKeyColumnName().endsWith("_ID")) + { + FDialog.error(curWindowNo, parent, "SaveErrorRowNotFound"); + return; + } + + // Pop up Payment Rules + + if (col.equals("PaymentRule")) + { + WPayment vp = new WPayment(curWindowNo, curTab, wButton); + + + if (vp.isInitOK()) // may not be allowed + { + vp.setVisible(true); + AEnv.showWindow(vp); + } + //vp.dispose(); + + if (vp.needSave()) + { + onSave(); + onRefresh(); + } + } // PaymentRule + + // Pop up Document Action (Workflow) + + else if (col.equals("DocAction")) + { + WDocActionPanel win = new WDocActionPanel(curTab); + //if (win.getNumberOfOptions() == 0) + //{ + // vda.dispose (); + // log.info("DocAction - No Options"); + // return; + //} + //else + { + win.setVisible(true); + AEnv.showWindow(win); + + if (!win.isStartProcess()) + return; + + //batch = win.isBatch(); + startWOasking = true; + //vda.dispose(); + } } // DocAction + + // Pop up Create From + + else if (col.equals("CreateFrom")) + { + // curWindowNo + WCreateFrom wcf = WCreateFrom.create(curTab); + + if (wcf != null) + { + if (wcf.isInitOK()) + { + wcf.setVisible(true); + curTab.dataRefresh(); + } + return; + } + // else may start process + } // CreateFrom + + // Posting ----- + + else if (col.equals("Posted") && MRole.getDefault().isShowAcct()) + { + // Check Doc Status + + String processed = Env.getContext(ctx, curWindowNo, "Processed"); + + if (!processed.equals("Y")) + { + String docStatus = Env.getContext(ctx, curWindowNo, "DocStatus"); + + if (DocAction.STATUS_Completed.equals(docStatus) + || DocAction.STATUS_Closed.equals(docStatus) + || DocAction.STATUS_Reversed.equals(docStatus) + || DocAction.STATUS_Voided.equals(docStatus)) + ; + else + { + FDialog.error(curWindowNo, parent, "PostDocNotComplete"); + return; + } + } + + // Check Post Status + Object ps = curTab.getValue("Posted"); + + if (ps != null && ps.equals("Y")) + { + new org.adempiere.webui.acct.WAcctViewer(Env.getContextAsInt (ctx, curWindowNo, "AD_Client_ID"), + curTab.getAD_Table_ID(), curTab.getRecord_ID()); + } + else + { + if (FDialog.ask(curWindowNo, null, "PostImmediate?")) + { + boolean force = ps != null && !ps.equals ("N"); // force when problems + + String error = AEnv.postImmediate (curWindowNo, Env.getAD_Client_ID(ctx), + curTab.getAD_Table_ID(), curTab.getRecord_ID(), force); + + curTab.dataRefresh(); + + if (error != null) + FDialog.error(curWindowNo, null, "PostingError-N", error); + } + } + return; + } // Posted + + /** + * Start Process ---- + */ + + logger.config("Process_ID=" + wButton.getProcess_ID() + ", Record_ID=" + record_ID); + + if (wButton.getProcess_ID() == 0) + return; + + // Save item changed + + if (curTab.needSave(true, false)) + this.onSave(); + + // hengsin - [ 1639242 ] Inconsistent appearance of Process/Report Dialog + // globalqss - Add support for Don't ShowHelp option in Process + // this code must be changed if integrated the parameters and help in only one window + /* + MProcess pr = new MProcess(m_ctx, vButton.getProcess_ID(), null); + if (pr.getShowHelp() != null && pr.getShowHelp().equals("N")) { + startWOasking = true; + } + // end globalqss + + // Ask user to start process, if Description and Help is not empty + + if (!startWOasking && !(vButton.getDescription().equals("") && vButton.getHelp().equals(""))) + if (!ADialog.ask(m_curWindowNo, this, "StartProcess?", + // "" + vButton.getText() + "
" + + vButton.getDescription() + "\n" + vButton.getHelp())) + return; + // + String title = vButton.getDescription(); + if (title == null || title.length() == 0) + title = vButton.getName(); + ProcessInfo pi = new ProcessInfo (title, vButton.getProcess_ID(), table_ID, record_ID); + pi.setAD_User_ID (Env.getAD_User_ID(m_ctx)); + pi.setAD_Client_ID (Env.getAD_Client_ID(m_ctx)); + pi.setIsBatch(batch); + + // Trx trx = Trx.get(Trx.createTrxName("AppsPanel"), true); + ProcessCtl.process(this, m_curWindowNo, pi, null); // calls lockUI, unlockUI + */ + + ProcessModalDialog dialog = new ProcessModalDialog(null, + Env.getHeader(ctx, curWindowNo), null, curWindowNo, + wButton.getProcess_ID(), table_ID, record_ID, startWOasking); + + if (dialog.isValid()) + { + dialog.setWidth("500px"); + dialog.setVisible(true); + dialog.setPosition("center"); + AEnv.showWindow(dialog); + } + curTab.dataRefresh(); + curTabpanel.dynamicDisplay(0); + } // actionButton + + public void actionPerformed(ActionEvent event) + { + if (event.getSource() instanceof WButtonEditor) + { + actionButton((WButtonEditor)event.getSource()); + } + } + + public IADTab getADTab() { + return adTab; + } +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java index 7132cba05c..c71dbe9d2a 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java @@ -17,22 +17,26 @@ package org.adempiere.webui.panel; +import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.component.Panel; -import org.adempiere.webui.session.SessionManager; +import org.adempiere.webui.window.AboutWindow; import org.compiere.model.MSysConfig; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; -import org.zkoss.zul.Hbox; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.East; +import org.zkoss.zkex.zul.West; import org.zkoss.zul.Image; -import org.zkoss.zul.Label; -import org.zkoss.zul.Separator; +import org.zkoss.zul.Vbox; /** * * @author Ashley G Ramdass + * @author Low Heng Sin * @date Mar 2, 2007 - * @version $Revision: 0.10 $ + * @date July 7, 2007 + * @version $Revision: 0.20 $ */ public class HeaderPanel extends Panel implements EventListener @@ -40,7 +44,6 @@ public class HeaderPanel extends Panel implements EventListener private static final long serialVersionUID = -4293371180738797244L; private Image image = new Image(); - private SideUserPanel pnlSideUser; public HeaderPanel() { @@ -50,44 +53,52 @@ public class HeaderPanel extends Panel implements EventListener private void init() { - pnlSideUser = new SideUserPanel(); + this.setSclass("header"); - Hbox hbox = new Hbox(); - hbox.setWidth("100%"); - hbox.setWidths("300px, 550px, 350px"); - - Panel right = new Panel(); - right.setWidth("100%"); - right.setStyle("text-align:right"); - - Panel left = new Panel(); - left.setWidth("100%"); - left.setStyle("text-align:center"); + UserPanel userPanel = new UserPanel(); - right.appendChild(pnlSideUser); - - String homeURL = MSysConfig.getValue("WEBUI_LOGOURL", "/images/logo_ad.png"); - image.setSrc(homeURL); + String logoURL = MSysConfig.getValue("WEBUI_LOGOURL", "/images/AD10030.png"); + image.setSrc(logoURL); image.addEventListener(Events.ON_CLICK, this); - left.appendChild(image); + image.setStyle("cursor: pointer;"); + + Borderlayout layout = new Borderlayout(); + LayoutUtils.addSclass("header", layout); + layout.setParent(this); + West west = new West(); + west.setParent(layout); - hbox.appendChild(left); - hbox.appendChild(new Label("")); - hbox.appendChild(right); + Vbox vb = new Vbox(); + vb.setParent(west); + vb.setHeight("100%"); + vb.setWidth("100%"); + vb.setPack("center"); + vb.setAlign("left"); + + image.setParent(vb); + + LayoutUtils.addSclass("header-left", west); + //the following doesn't work when declare as part of the header-left style + west.setStyle("background-color: transparent; border: none;"); - this.setWidth("100%"); - this.appendChild(new Separator()); - this.appendChild(hbox); - this.appendChild(new Separator()); + East east = new East(); + east.setParent(layout); + userPanel.setParent(east); + userPanel.setHeight("100%"); + east.setFlex(true); + LayoutUtils.addSclass("header-right", east); + //the following doesn't work when declare as part of the header-right style + east.setStyle("background-color: transparent; border: none;"); } public void onEvent(Event event) throws Exception { - if (event == null) - return; - - if (event.getTarget() == image){ - String homeURL = MSysConfig.getValue("WEBUI_HOMEURL", "http://www.adempiere.com/"); - SessionManager.getAppDesktop().showURL(homeURL, true); + if (Events.ON_CLICK.equals(event.getName())) { + AboutWindow w = new AboutWindow(); + w.setPage(this.getPage()); + w.setPosition("center"); + w.setTitle("About ADempiere"); + w.setClosable(true); + w.doModal(); } } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java new file mode 100644 index 0000000000..e626018fdf --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/ITabOnCloseHandler.java @@ -0,0 +1,7 @@ +package org.adempiere.webui.panel; + +import org.adempiere.webui.component.Tabpanel; + +public interface ITabOnCloseHandler { + public void onClose(Tabpanel tabPanel); +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java index d8092e56bd..ca09cf45d0 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java @@ -33,11 +33,14 @@ import org.compiere.util.KeyNamePair; import org.compiere.util.Language; import org.compiere.util.Login; import org.compiere.util.ValueNamePair; +import org.zkoss.zk.au.out.AuFocus; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.WrongValueException; 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.Image; import org.zkoss.zul.Listbox; import org.zkoss.zul.Listitem; @@ -71,13 +74,23 @@ public class LoginPanel extends Window implements EventListener initComponents(); init(); this.setId("loginPanel"); + + AuFocus auf = new AuFocus(txtUserId); + Clients.response(auf); } private void init() { Grid grid = new Grid(); + //grid.setSclass("grid-no-striped"); + grid.setOddRowSclass("even"); grid.setId("grdLogin"); Rows rows = new Rows(); + Row logo = new Row(); + logo.setSpans("2"); + Image image = new Image(); + image.setSrc("images/Logo.gif"); + logo.appendChild(image); Row rowUser = new Row(); rowUser.setId("rowUser"); Row rowPassword = new Row(); @@ -105,6 +118,7 @@ public class LoginPanel extends Window implements EventListener //pnlButtons.appendChild(btnCancel); rowButtons.appendChild(pnlButtons); + rows.appendChild(logo); rows.appendChild(rowUser); rows.appendChild(rowPassword); rows.appendChild(rowLanguage); diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java index 005ac4aa17..ca7faafe45 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MenuPanel.java @@ -21,10 +21,8 @@ import java.util.ArrayList; import java.util.Enumeration; import java.util.Properties; -import org.adempiere.webui.AdempiereWebUI; +import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.component.Panel; -import org.adempiere.webui.component.Window; -import org.adempiere.webui.constants.EventConstants; import org.adempiere.webui.event.MenuListener; import org.adempiere.webui.exception.ApplicationException; import org.adempiere.webui.session.SessionManager; @@ -35,7 +33,10 @@ import org.compiere.util.Env; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; -import org.zkoss.zul.Separator; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.South; import org.zkoss.zul.Tree; import org.zkoss.zul.Treechildren; import org.zkoss.zul.Treecol; @@ -48,7 +49,7 @@ import org.zkoss.zul.Treeitem; * @date Feb 25, 2007 * @version $Revision: 0.10 $ */ -public class MenuPanel extends Window implements EventListener +public class MenuPanel extends Panel implements EventListener { private static final long serialVersionUID = 1L; @@ -77,31 +78,47 @@ public class MenuPanel extends Window implements EventListener private void init() { + this.setWidth("100%"); + this.setHeight("100%"); + this.setStyle("position:absolute;border:0;padding:0;margin:0"); + menuTree = new Tree(); menuTree.setMultiple(false); menuTree.setId("mnuMain"); - menuTree.addEventListener(EventConstants.ONSELECT, this); - menuTree.setWidth("250px"); - menuTree.setHeight("550px"); - menuTree.setVflex(true); + menuTree.addEventListener(Events.ON_SELECT, this); + menuTree.setWidth("100%"); + menuTree.setHeight("100%"); + menuTree.setVflex(false); menuTree.setPageSize(-1); // Due to bug in the new paging functionality - Panel menuPanel = new Panel(); + menuTree.setStyle("border:0"); + + Borderlayout layout = new Borderlayout(); + layout.setParent(this); + layout.setStyle("position:absolute"); + layout.setWidth("100%"); + layout.setHeight("100%"); + + South south = new South(); + south.setParent(layout); + pnlSearch = new MenuSearchPanel(this); - menuPanel.appendChild(new Separator()); - menuPanel.appendChild(pnlSearch); - menuPanel.appendChild(new Separator()); - menuPanel.appendChild(new Separator()); - menuPanel.appendChild(new Separator()); - menuPanel.appendChild(menuTree); - this.appendChild(menuPanel); + pnlSearch.setParent(south); + LayoutUtils.addSclass("menu-search", pnlSearch); + + Center center = new Center(); + center.setFlex(true); + center.setAutoscroll(true); + center.setParent(layout); + + menuTree.setParent(center); } private void initMenu(MTreeNode rootNode) { Treecols treeCols = new Treecols(); Treecol treeCol = new Treecol(); - treeCol.setLabel(AdempiereWebUI.UID); + treeCol.setLabel("Menu"); Treechildren rootTreeChildren = new Treechildren(); generateMenu(rootTreeChildren, rootNode); @@ -183,7 +200,7 @@ public class MenuPanel extends Window implements EventListener Component comp = event.getTarget(); String eventName = event.getName(); - if(eventName.equals(EventConstants.ONSELECT)) + if(eventName.equals(Events.ON_SELECT)) { if(comp.equals(menuTree)) { @@ -217,11 +234,6 @@ public class MenuPanel extends Window implements EventListener } } - public void setWidth(String width) - { - menuTree.setWidth(width); - } - public boolean isAsap() { return true; diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java index b2cb4bdc64..9145c10c29 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java @@ -25,12 +25,15 @@ import org.adempiere.webui.exception.ApplicationException; import org.adempiere.webui.window.LoginWindow; import org.compiere.util.KeyNamePair; import org.compiere.util.Login; +import org.zkoss.zk.au.out.AuFocus; 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.Button; import org.zkoss.zul.Div; import org.zkoss.zul.Grid; +import org.zkoss.zul.Image; import org.zkoss.zul.Label; import org.zkoss.zul.Listbox; import org.zkoss.zul.Listitem; @@ -69,13 +72,24 @@ public class RolePanel extends Window implements EventListener initComponents(); init(); this.setId("rolePanel"); + + AuFocus auf = new AuFocus(lstRole); + Clients.response(auf); } private void init() { Grid grid = new Grid(); grid.setId("grdChooseRole"); + grid.setOddRowSclass("even"); Rows rows = new Rows(); + + Row logo = new Row(); + logo.setSpans("2"); + Image image = new Image(); + image.setSrc("images/Logo.gif"); + logo.appendChild(image); + Row rowRole = new Row(); Row rowClient = new Row(); Row rowOrg = new Row(); @@ -105,6 +119,7 @@ public class RolePanel extends Window implements EventListener rowButtons.setSpans("2"); rowButtons.appendChild(pnlButtons); + rows.appendChild(logo); rows.appendChild(rowRole); rows.appendChild(rowClient); rows.appendChild(rowOrg); diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SidePanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SidePanel.java index 049ec65709..c0bf53ac5b 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SidePanel.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SidePanel.java @@ -18,9 +18,6 @@ package org.adempiere.webui.panel; import org.adempiere.webui.component.Panel; -import org.adempiere.webui.component.VerticalBox; -import org.zkoss.zk.ui.event.Event; -import org.zkoss.zk.ui.event.EventListener; /** * @@ -28,24 +25,11 @@ import org.zkoss.zk.ui.event.EventListener; * @date Mar 2, 2007 * @version $Revision: 0.10 $ */ -public class SidePanel extends Panel implements EventListener +public class SidePanel extends Panel { private static final long serialVersionUID = 1L; - private RequestNoticePanel pnlRequestNotice; private MenuPanel pnlMenu; - //private SideUserPanel pnlSideUser; - //private HeaderPanel pnlHead; - -/* private Tabs tabs = new Tabs(); - private Tab tabUser = new Tab(); - private Tab tabSearch = new Tab(); - private Tab tabMenu = new Tab(); - - private Tabpanels tabpanels = new Tabpanels(); - - private Tabbox tabbox = new Tabbox(); -*/ public SidePanel() { init(); @@ -53,60 +37,16 @@ public class SidePanel extends Panel implements EventListener private void init() { - pnlRequestNotice = new RequestNoticePanel(); pnlMenu = new MenuPanel(); - //pnlSideUser = new SideUserPanel(); - //pnlHead = new HeaderPanel(); -/* tabUser.setLabel("Logout"); - tabSearch.setLabel("Search"); - tabMenu.setLabel("Menu"); - - tabs.appendChild(tabUser); - tabs.appendChild(tabSearch); - tabs.appendChild(tabMenu); - - Tabpanel tabPanelMenu = new Tabpanel(); - tabPanelMenu.appendChild(new Separator()); - tabPanelMenu.appendChild(pnlMenu.getSearchPanel()); - tabPanelMenu.appendChild(new Separator()); - - tabpanels.appendChild(pnlSideUser); - tabpanels.appendChild(tabPanelMenu); - tabpanels.appendChild(pnlMenu); - - tabbox.setWidth("300px"); - tabbox.setOrient("horizontal"); - tabbox.setMold("accordion"); - tabbox.appendChild(tabs); - tabbox.appendChild(tabpanels);*/ - - VerticalBox mainBox = new VerticalBox(); - //mainBox.appendChild(pnlHead); - //mainBox.appendChild(pnlSideUser); - - //Iframe menuFrame = new Iframe("/zul/menu.zul"); - //menuFrame.setWidth("300px"); - //menuFrame.setHeight("650px"); - - //mainBox.appendChild(menuFrame); - mainBox.appendChild(pnlMenu); - - Panel pan = new Panel(); - pan.setAlign("center"); - pan.appendChild(mainBox); - - this.setWidth("300px"); - this.appendChild(pan); + this.setWidth("100%"); + this.setHeight("100%"); + this.setStyle("position:absolute"); + this.appendChild(pnlMenu); } public MenuPanel getMenuPanel() { return pnlMenu; } - - public void onEvent(Event event) throws Exception - { - - } } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SideUserPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SideUserPanel.java deleted file mode 100644 index 8bb8e11f33..0000000000 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/SideUserPanel.java +++ /dev/null @@ -1,59 +0,0 @@ -/****************************************************************************** - * 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.panel; - -import org.adempiere.webui.component.Panel; -import org.zkoss.zul.Hbox; -import org.zkoss.zul.Separator; - -/** - * - * @author Ashley G Ramdass - * @date Mar 2, 2007 - * @version $Revision: 0.10 $ - */ -public class SideUserPanel extends Panel -{ - private static final long serialVersionUID = 1L; - - //private Hbox hBox; - - private UserPanel pnlUser; - //private LogoutPanel pnlLogout; - - public SideUserPanel() - { - super(); - init(); - } - - private void init() - { - //hBox = new Hbox(); - pnlUser = new UserPanel(); - //pnlLogout = new LogoutPanel(); - - //hBox.appendChild(pnlUser); - //hBox.appendChild(pnlLogout); - - this.setWidth("100%"); - this.appendChild(new Separator()); - this.appendChild(pnlUser); - this.appendChild(new Separator()); - } -} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java index ec6daa2bba..78fda30b82 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java @@ -21,11 +21,11 @@ import java.util.Properties; import org.adempiere.webui.component.Grid; import org.adempiere.webui.component.Label; -import org.adempiere.webui.component.Panel; -import org.adempiere.webui.component.Row; -import org.adempiere.webui.component.Rows; +import org.adempiere.webui.component.Messagebox; +import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.session.SessionManager; import org.compiere.model.MClient; +import org.compiere.model.MOrg; import org.compiere.model.MRole; import org.compiere.model.MUser; import org.compiere.util.Env; @@ -33,6 +33,8 @@ import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Hbox; +import org.zkoss.zul.Separator; +import org.zkoss.zul.Vbox; /** * @@ -40,16 +42,15 @@ import org.zkoss.zul.Hbox; * @date Feb 25, 2007 * @version $Revision: 0.10 $ */ -public class UserPanel extends Hbox implements EventListener +public class UserPanel extends Vbox implements EventListener { private static final long serialVersionUID = 1L; private Properties ctx; private Grid grid; - private Label lblPrefix = new Label("You are logged in as: "); - private Label lblSeparator = new Label(" | "); - private Label lblLogout = new Label("logoff"); + private ToolBarButton logout = new ToolBarButton(); + private ToolBarButton role = new ToolBarButton(); private Label lblUserNameValue = new Label(); @@ -61,58 +62,32 @@ public class UserPanel extends Hbox implements EventListener private void init() { - lblLogout.setStyle("cursor: hand;"); + this.setStyle("text-align:right"); - lblPrefix.setStyle("font-style: bold;"); - - lblUserNameValue.setValue(getUserName()); - - lblLogout.addEventListener(Events.ON_CLICK, this); - - //this.setWidth("200px"); - - this.appendChild(lblPrefix); + lblUserNameValue.setValue(getUserName() + "@" + getClientName() + "." + getOrgName()); + lblUserNameValue.setStyle("text-align:right"); + lblUserNameValue.setSclass("headerFont"); this.appendChild(lblUserNameValue); - this.appendChild(lblSeparator); - this.appendChild(lblLogout); + + Hbox hbox = new Hbox(); -/* grid = new Grid(); - grid.setWidth("200px"); - - Rows rows = new Rows(); - - Label lblUserName = new Label(); - Label lblUserNameValue = new Label(); - lblUserName.setValue("User Name"); - lblUserNameValue.setValue(getUserName()); - - Row row = new Row(); - row.appendChild(lblUserName); - row.appendChild(lblUserNameValue); - rows.appendChild(row); - - Label lblRole = new Label(); - Label lblRoleValue = new Label(); - lblRole.setValue("Role"); - lblRoleValue.setValue(getRoleName()); - - row = new Row(); - row.appendChild(lblRole); - row.appendChild(lblRoleValue); - rows.appendChild(row); - - Label lblClient = new Label(); - Label lblClientValue = new Label(); - lblRole.setValue("Client"); - lblRoleValue.setValue(getClientName()); - - row = new Row(); - row.appendChild(lblClient); - row.appendChild(lblClientValue); - rows.appendChild(row); - - grid.appendChild(rows); - this.appendChild(grid);*/ + role.setLabel(this.getRoleName()); + role.addEventListener(Events.ON_CLICK, this); + role.setStyle("text-align:right"); + role.setSclass("headerFont"); + role.setParent(hbox); + + Separator sep = new Separator("vertical"); + sep.setBar(true); + sep.setParent(hbox); + + logout.setLabel("Logout"); + logout.addEventListener(Events.ON_CLICK, this); + logout.setStyle("text-align:right"); + logout.setSclass("headerFont"); + logout.setParent(hbox); + + this.appendChild(hbox); } private String getUserName() @@ -132,15 +107,35 @@ public class UserPanel extends Hbox implements EventListener MClient client = MClient.get(ctx); return client.getName(); } + + private String getOrgName() + { + int orgId = Env.getAD_Org_ID(ctx); + if (orgId > 0) + { + MOrg org = MOrg.get(ctx, orgId); + return org.getName(); + } + else + { + return "*"; + } + } public void onEvent(Event event) throws Exception { if (event == null) return; - if (lblLogout == event.getTarget()) + if (logout == event.getTarget()) { SessionManager.logoutSession(); } + else if (role == event.getTarget()) + { + String roleInfo = MRole.getDefault().toStringX(Env.getCtx()); + roleInfo = roleInfo.replace(Env.NL, "
"); + Messagebox.showDialog(roleInfo, "Role Info", Messagebox.OK, Messagebox.INFORMATION); + } } } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java index 094698b56d..5df1000db7 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WAttachment.java @@ -27,7 +27,6 @@ import org.adempiere.webui.component.ListItem; import org.adempiere.webui.component.Listbox; import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Textbox; -import org.adempiere.webui.component.VerticalBox; import org.adempiere.webui.component.Window; import org.adempiere.webui.window.FDialog; import org.compiere.model.MAttachment; @@ -40,13 +39,16 @@ import org.zkoss.util.media.Media; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; +import org.zkoss.zkex.zul.Borderlayout; +import org.zkoss.zkex.zul.Center; +import org.zkoss.zkex.zul.North; +import org.zkoss.zkex.zul.South; +import org.zkoss.zkex.zul.West; import org.zkoss.zul.Filedownload; import org.zkoss.zul.Fileupload; import org.zkoss.zul.Hbox; import org.zkoss.zul.Iframe; import org.zkoss.zul.Image; -import org.zkoss.zul.Separator; -import org.zkoss.zul.Splitter; public class WAttachment extends Window implements EventListener { @@ -63,15 +65,12 @@ public class WAttachment extends Window implements EventListener /** Change */ private boolean m_change = false; - private Iframe pdfViewer = new Iframe(); + private Iframe preview = new Iframe(); private Textbox text = new Textbox(); - private Textbox info = new Textbox(); private Listbox cbContent = new Listbox(); - private Image gifPanel = new Image(); - private Button bDelete = new Button(); private Button bOpen = new Button(); private Button bSave = new Button(); @@ -82,12 +81,9 @@ public class WAttachment extends Window implements EventListener private Panel graphPanel = new Panel(); - private VerticalBox mainPanel = new VerticalBox(); + private Borderlayout mainPanel = new Borderlayout(); - private Panel northPanel = new Panel(); - - private Hbox toolBar = new Hbox(); - private Hbox centerPane = new Hbox(); + private Hbox toolBar = new Hbox(); private Hbox confirmPanel = new Hbox(); @@ -166,8 +162,13 @@ public class WAttachment extends Window implements EventListener this.setClosable(true); this.setBorder("normal"); this.appendChild(mainPanel); + mainPanel.setHeight("100%"); + mainPanel.setWidth("100%"); - northPanel.appendChild(toolBar); + + North northPanel = new North(); + northPanel.setCollapsible(false); + northPanel.setSplittable(false); cbContent.setMold("select"); cbContent.setRows(0); @@ -180,7 +181,8 @@ public class WAttachment extends Window implements EventListener toolBar.appendChild(cbContent); mainPanel.appendChild(northPanel); - mainPanel.appendChild(new Separator()); + northPanel.appendChild(toolBar); + bOpen.setEnabled(false); bOpen.setSrc("/images/Editor24.gif"); @@ -200,29 +202,27 @@ public class WAttachment extends Window implements EventListener bDelete.setTooltiptext(Msg.getMsg(Env.getCtx(), "Delete")); bDelete.addEventListener(Events.ON_CLICK, this); - //Dimension size = cbContent.getPreferredSize(); - //size.width = 200; - //cbContent.setPreferredSize(size); - // cbContent.setToolTipText(text); - //cbContent.addEventListener(Events.ON_SELECT,this); - //cbContent.setLightWeightPopupEnabled(false); // Acrobat Panel is heavy - - //text.setBackground(AdempierePLAF.getInfoBackground()); - //text.setPreferredSize(new Dimension(200, 200)); - - info.setText("-"); - info.setEnabled(false); - graphPanel.appendChild(info); + graphPanel.appendChild(preview); + preview.setHeight("100%"); + preview.setWidth("100%"); + Center centerPane = new Center(); + centerPane.setAutoscroll(true); + centerPane.setFlex(true); mainPanel.appendChild(centerPane); - mainPanel.appendChild(new Separator()); - centerPane.appendChild(graphPanel); - centerPane.appendChild(new Splitter()); - centerPane.appendChild(text); - //centerPane.setResizeWeight(.75); // more to graph - mainPanel.appendChild(confirmPanel); + West westPane = new West(); + westPane.setWidth("20%"); + westPane.setSplittable(true); + westPane.setCollapsible(true); + mainPanel.appendChild(westPane); + westPane.appendChild(text); + + South southPane = new South(); + mainPanel.appendChild(southPane); + southPane.appendChild(confirmPanel); + southPane.setHeight("30px"); bCancel.setImage("/images/Cancel24.gif"); bCancel.addEventListener(Events.ON_CLICK, this); @@ -244,7 +244,7 @@ public class WAttachment extends Window implements EventListener public void dispose () { - pdfViewer = null; + preview = null; this.detach(); } // dispose @@ -273,9 +273,11 @@ public class WAttachment extends Window implements EventListener cbContent.appendItem(m_attachment.getEntryName(i), m_attachment.getEntryName(i)); if (size > 0) - cbContent.setSelectedIndex(0); - else - displayData(0); + { + cbContent.setSelectedIndex(0); + } + displayData(0); + } // loadAttachment /** @@ -288,10 +290,8 @@ public class WAttachment extends Window implements EventListener MAttachmentEntry entry = m_attachment.getEntry(index); log.config("Index=" + index + " - " + entry); - // Reset UI - - gifPanel.setSrc(null); - graphPanel.getChildren().clear(); + // Reset UI + preview.setVisible(false); bDelete.setEnabled(false); bOpen.setEnabled(false); @@ -299,13 +299,7 @@ public class WAttachment extends Window implements EventListener Dimension size = null; - // no attachment - - if (entry == null || entry.getData() == null) - { - info.setText("-"); - } - else + if (entry != null && entry.getData() != null) { bOpen.setEnabled(true); bSave.setEnabled(true); @@ -313,72 +307,17 @@ public class WAttachment extends Window implements EventListener log.config(entry.toStringX()); - info.setText(entry.toStringX()); - - if (entry.isPDF() && pdfViewer != null) + try { - try - { - AMedia media = new AMedia(entry.getName(), "pdf", "application/pdf", entry.getData()); - pdfViewer.setContent(media); -/* pdfViewer.loadPDF(entry.getInputStream()); - pdfViewer.setScale(50); - size = pdfViewer.getPreferredSize();*/ - - // size.width = Math.min(size.width, 400); - // size.height = Math.min(size.height, 400); - - info.setVisible(false); - pdfViewer.setVisible(true); - graphPanel.appendChild(pdfViewer); - } - catch (Exception e) - { - log.log(Level.SEVERE, "(pdf)", e); - } + AMedia media = new AMedia(entry.getName(), null, entry.getContentType(), entry.getData()); + preview.setContent(media); + preview.setVisible(true); } - else if (entry.isGraphic()) + catch (Exception e) { - // Can we display it - - - -/* Image image = Toolkit.getDefaultToolkit().createImage(entry.getData()); - - if (image != null) - { - gifPanel.setImage(image); - size = gifPanel.getPreferredSize(); - - if (size.width == -1 && size.height == -1) - { - log.log(Level.SEVERE, "Invalid Image"); - } - else - { - // size.width += 40; - // size.height += 40; - graphPanel.add(gifScroll, BorderLayout.CENTER); - } - } - else - log.log(Level.SEVERE, "Could not create image");*/ + log.log(Level.SEVERE, "(pdf)", e); } - } - - if (graphPanel.getChildren().size() == 0) - { - graphPanel.appendChild(info); - } - - log.config("Size=" + size); - - // graphPanel.setPreferredSize(size); - // centerPane.setDividerLocation(size.width+30); - // size.width += 100; - // size.height += 100; - // centerPane.setPreferredSize(size); - // pack(); + } } // displayData /** @@ -499,7 +438,8 @@ public class WAttachment extends Window implements EventListener if (media != null) { - pdfViewer.setContent(media); +// pdfViewer.setContent(media); + ; } else return; @@ -510,16 +450,8 @@ public class WAttachment extends Window implements EventListener e.printStackTrace(); } - //JFileChooser chooser = new JFileChooser(); - //chooser.setDialogType(JFileChooser.OPEN_DIALOG); - //chooser.setDialogTitle(Msg.getMsg(Env.getCtx(), "AttachmentNew")); - //int returnVal = chooser.showOpenDialog(this); - //if (returnVal != JFileChooser.APPROVE_OPTION) - // return; - String fileName = media.getName(); log.config(fileName); - File file = new File(fileName); int cnt = m_attachment.getEntryCount(); //update @@ -528,18 +460,16 @@ public class WAttachment extends Window implements EventListener { if (m_attachment.getEntryName(i).equals(fileName)) { - //if (m_attachment.) - { - cbContent.setSelectedIndex(i); - m_change = true; - } + m_attachment.updateEntry(i, media.getByteData()); + cbContent.setSelectedIndex(i); + m_change = true; return; } } //new - if (m_attachment.addEntry(file)) + if (m_attachment.addEntry(fileName, media.getByteData())) { //MAttachmentEntry attachmentEntry = new MAttachmentEntry(media.getName(), media.getByteData()); @@ -595,30 +525,19 @@ public class WAttachment extends Window implements EventListener if (m_attachment.getEntryCount() < index) return; -/* String fileName = getFileName(index); - String ext = fileName.substring (fileName.lastIndexOf('.')); - log.config( "Ext=" + ext);*/ - - ListItem listitem = cbContent.getSelectedItem(); - Media media = (Media)listitem.getValue(); - - Filedownload.save(media); - -/* JFileChooser chooser = new JFileChooser(); - chooser.setDialogType(JFileChooser.SAVE_DIALOG); - chooser.setDialogTitle(Msg.getMsg(Env.getCtx(), "AttachmentSave")); - File f = new File(fileName); - chooser.setSelectedFile(f); - // Show dialog - int returnVal = chooser.showSaveDialog(this); - if (returnVal != JFileChooser.APPROVE_OPTION) - return; - File saveFile = chooser.getSelectedFile(); - if (saveFile == null) - return;*/ - - /*log.config("Save to " + saveFile.getAbsolutePath()); - m_attachment.getEntryFile(index, saveFile);*/ + MAttachmentEntry entry = m_attachment.getEntry(index); + if (entry != null && entry.getData() != null) + { + try + { + AMedia media = new AMedia(entry.getName(), null, entry.getContentType(), entry.getData()); + Filedownload.save(media); + } + catch (Exception e) + { + log.log(Level.SEVERE, "(pdf)", e); + } + } } // saveAttachmentToFile /** diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java index be977cfc4d..a895dcc499 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/WDocActionPanel.java @@ -26,7 +26,6 @@ import org.adempiere.webui.component.Panel; import org.adempiere.webui.component.Row; import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Window; -import org.adempiere.webui.constants.EventConstants; import org.adempiere.webui.window.FDialog; import org.compiere.model.GridTab; import org.compiere.process.DocumentEngine; @@ -208,7 +207,7 @@ public class WDocActionPanel extends Window implements EventListener lstDocAction.setRows(0); lstDocAction.setMold("select"); lstDocAction.setWidth("100px"); - lstDocAction.addEventListener(EventConstants.ONSELECT, this); + lstDocAction.addEventListener(Events.ON_SELECT, this); confirmPanel = new ConfirmPanel(true); confirmPanel.addComponentsLeft(confirmPanel.createButton("Process")); diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/AbstractUIPart.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/AbstractUIPart.java new file mode 100644 index 0000000000..7a0672272b --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/AbstractUIPart.java @@ -0,0 +1,28 @@ +package org.adempiere.webui.part; + +import org.zkoss.zk.ui.Component; +import org.zkoss.zk.ui.Page; + +public abstract class AbstractUIPart implements UIPart { + + protected Page page = null; + + public Component createPart(Object parent) { + if (parent == null) + throw new IllegalArgumentException("Null parent."); + + Component component = null; + if (parent instanceof Page) { + page = (Page)parent; + } else if (parent instanceof Component) { + component = (Component)parent; + } else { + throw new IllegalArgumentException("Parent must of class Page or Component."); + } + + return doCreatePart(component); + } + + protected abstract Component doCreatePart(Component parent); + +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MainPanel.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/MultiTabPart.java similarity index 63% rename from extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MainPanel.java rename to extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/MultiTabPart.java index a8169e51da..c0dcf3116d 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/panel/MainPanel.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/MultiTabPart.java @@ -15,14 +15,13 @@ * or via info@posterita.org or http://www.posterita.org/ * *****************************************************************************/ -package org.adempiere.webui.panel; +package org.adempiere.webui.part; import org.adempiere.webui.component.Tab; import org.adempiere.webui.component.Tabbox; import org.adempiere.webui.component.Tabpanel; import org.adempiere.webui.component.Tabpanels; import org.adempiere.webui.component.Tabs; -import org.adempiere.webui.component.Window; import org.zkoss.zk.ui.Component; /** @@ -31,73 +30,72 @@ import org.zkoss.zk.ui.Component; * @date Mar 3, 2007 * @version $Revision: 0.10 $ */ -public class MainPanel extends Window +public class MultiTabPart extends AbstractUIPart { private static final long serialVersionUID = 1L; - + private Tabbox tabbox; - private Tabpanels tabpanels; - - private Tabs tabs; - - public MainPanel() + public MultiTabPart() { - - init(); } - - private void init() + + protected Component doCreatePart(Component parent) { tabbox = new Tabbox(); - tabpanels = new Tabpanels(); - tabs = new Tabs(); + tabbox.setSclass("lite"); + + Tabpanels tabpanels = new Tabpanels(); + Tabs tabs = new Tabs(); tabbox.appendChild(tabs); tabbox.appendChild(tabpanels); - tabbox.setWidth("100%"); - tabbox.setHeight("100%"); - - this.setWidth("100%"); - this.appendChild(tabbox); - //this.setBorder("normal"); + + if (parent != null) + tabbox.setParent(parent); + else + tabbox.setPage(page); + + return tabbox; } - public void addWindow(Component comp, String title, boolean closeable) + public void addTab(Component comp, String title, boolean closeable) { - addWindow(comp, title, closeable, true); + addTab(comp, title, closeable, true); } - public void addWindow(Component comp, String title, boolean closeable, boolean enable) + public void addTab(Component comp, String title, boolean closeable, boolean enable) { Tab tab = new Tab(); tab.setLabel(title); tab.setClosable(closeable); - Tabpanel tabpanel = new Tabpanel(); - tabpanel.appendChild(comp); + Tabpanel tabpanel = null; + if (comp instanceof Tabpanel) { + tabpanel = (Tabpanel) comp; + } else { + tabpanel = new Tabpanel(); + tabpanel.appendChild(comp); + } + + tabbox.getTabs().appendChild(tab); + tabbox.getTabpanels().appendChild(tabpanel); - tabs.appendChild(tab); - tabpanels.appendChild(tabpanel); - tabpanels.setHeight("100%"); - - setSelectedTab(enable, tab); - } - - public void setSelectedTab(boolean enable, Tab tab) - { if (enable) - { - tabbox.setSelectedTab(tab); - } + setSelectedTab(tab); } - public void removeWindow() + public void setSelectedTab(Tab tab) + { + tabbox.setSelectedTab(tab); + } + + public void removeTab() { tabbox.getSelectedTab().onClose(); } - + public Component getComponent() { + return tabbox; + } } - - diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/UIPart.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/UIPart.java new file mode 100644 index 0000000000..c028b9ae0c --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/UIPart.java @@ -0,0 +1,11 @@ +package org.adempiere.webui.part; + +import org.zkoss.zk.ui.Component; + +public interface UIPart { + + public Component createPart(Object parent); + + public Component getComponent(); + +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java new file mode 100644 index 0000000000..f27746c49c --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/part/WindowContainer.java @@ -0,0 +1,141 @@ +/****************************************************************************** + * 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.part; + +import org.adempiere.webui.LayoutUtils; +import org.adempiere.webui.component.Tab; +import org.adempiere.webui.component.Tabbox; +import org.adempiere.webui.component.Tabpanel; +import org.adempiere.webui.component.Tabpanels; +import org.adempiere.webui.component.Tabs; +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; +import org.zkoss.zkex.zul.Borderlayout; + +/** + * + * @author Ashley G Ramdass + * @date Mar 3, 2007 + * @version $Revision: 0.10 $ + */ +public class WindowContainer extends AbstractUIPart implements EventListener +{ + private static final long serialVersionUID = 1L; + + private Tabbox tabbox; + + public WindowContainer() + { + } + + public static WindowContainer createFrom(Tabbox tb) + { + WindowContainer wc = new WindowContainer(); + wc.tabbox = tb; + + return wc; + } + + protected Component doCreatePart(Component parent) + { + tabbox = new Tabbox(); + tabbox.setSclass("desktop-tb"); + + Tabpanels tabpanels = new Tabpanels(); + Tabs tabs = new Tabs(); + + tabbox.appendChild(tabs); + tabbox.appendChild(tabpanels); + tabbox.setWidth("100%"); + tabbox.setHeight("100%"); + + tabbox.addEventListener(Events.ON_SELECT, this); + + if (parent != null) + tabbox.setParent(parent); + else + tabbox.setPage(page); + + return tabbox; + } + + public void addWindow(Component comp, String title, boolean closeable) + { + addWindow(comp, title, closeable, true); + } + + public void addWindow(Component comp, String title, boolean closeable, boolean enable) + { + Tab tab = new Tab(); + tab.setLabel(title); + tab.setClosable(closeable); +// tab.setHeight("20px"); + + Tabpanel tabpanel = null; + if (comp instanceof Tabpanel) { + tabpanel = (Tabpanel) comp; + } else { + tabpanel = new Tabpanel(); + tabpanel.appendChild(comp); + } + tabpanel.setHeight("100%"); + tabpanel.setWidth("100%"); + tabpanel.setSclass("desktop-tabpanel"); + tabpanel.setStyle("position: absolute;"); + + tabbox.getTabs().appendChild(tab); + tabbox.getTabpanels().appendChild(tabpanel); + + if (enable) + setSelectedTab(tab); + + deferLayout(); + } + + public void setSelectedTab(Tab tab) + { + tabbox.setSelectedTab(tab); + } + + public void removeWindow() + { + tabbox.getSelectedTab().onClose(); + } + + public Tab getSelectedTab() { + return (Tab) tabbox.getSelectedTab(); + } + + public void onEvent(Event event) throws Exception { + if (Events.ON_SELECT.equals(event.getName())) + deferLayout(); + } + + private void deferLayout() { + Tabpanel panel = (Tabpanel) tabbox.getSelectedPanel(); + if (panel.getFirstChild() instanceof Borderlayout) { + LayoutUtils.sendDeferLayoutEvent((Borderlayout) panel.getChildren().get(0), 350); + } + } + + public Component getComponent() { + return tabbox; + } +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionContextListener.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionContextListener.java index 39ea250453..9488588801 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionContextListener.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionContextListener.java @@ -19,7 +19,6 @@ package org.adempiere.webui.session; import java.util.List; -import org.zkoss.lang.ThreadLocals; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.Execution; import org.zkoss.zk.ui.Executions; @@ -28,6 +27,7 @@ import org.zkoss.zk.ui.event.EventThreadInit; import org.zkoss.zk.ui.event.EventThreadResume; import org.zkoss.zk.ui.util.ExecutionCleanup; import org.zkoss.zk.ui.util.ExecutionInit; +import org.zkoss.zkplus.util.ThreadLocals; /** * diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionManager.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionManager.java index d22557d6cb..6a247aa9a2 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionManager.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/session/SessionManager.java @@ -19,8 +19,8 @@ package org.adempiere.webui.session; import java.util.Properties; -import org.adempiere.webui.AdempiereWebUI; -import org.adempiere.webui.Desktop; +import org.adempiere.webui.IDesktop; +import org.adempiere.webui.IWebClient; import org.compiere.util.Env; import org.zkoss.zk.ui.Executions; import org.zkoss.zk.ui.Session; @@ -51,27 +51,29 @@ public class SessionManager return Executions.getCurrent().getDesktop().getSession(); } - public static void setSessionApplication(AdempiereWebUI app) + public static void setSessionApplication(IWebClient app) { Session session = getSession(); session.setAttribute(SESSION_APPLICATION, app); } - public static Desktop getAppDesktop() + public static IDesktop getAppDesktop() { return getSessionApplication().getAppDeskop(); } - public static AdempiereWebUI getSessionApplication() + public static IWebClient getSessionApplication() { Session session = getSession(); - AdempiereWebUI app = (AdempiereWebUI)session.getAttribute(SESSION_APPLICATION); + IWebClient app = (IWebClient)session.getAttribute(SESSION_APPLICATION); return app; } public static void clearSession() { Env.getCtx().clear(); + Session session = getSession(); + session.invalidate(); } public static void logoutSession() diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/ADWindow.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/ADWindow.java index 4df87894e7..22bc314cea 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/ADWindow.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/ADWindow.java @@ -19,12 +19,11 @@ package org.adempiere.webui.window; import java.util.Properties; -import org.adempiere.webui.component.Window; import org.adempiere.webui.panel.ADWindowPanel; +import org.adempiere.webui.part.AbstractUIPart; import org.adempiere.webui.session.SessionManager; import org.compiere.model.MQuery; -import org.zkoss.zk.ui.event.Event; -import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.Component; /** * @@ -32,7 +31,7 @@ import org.zkoss.zk.ui.event.EventListener; * @date Feb 25, 2007 * @version $Revision: 0.10 $ */ -public class ADWindow extends Window implements EventListener +public class ADWindow extends AbstractUIPart { private static final long serialVersionUID = 1L; @@ -41,6 +40,10 @@ public class ADWindow extends Window implements EventListener private int adWindowId; private String _title; private int windowNo; + + private MQuery query; + + private Component windowPanelComponent; public ADWindow(Properties ctx, int adWindowId) { @@ -55,43 +58,30 @@ public class ADWindow extends Window implements EventListener this.ctx = ctx; this.adWindowId = adWindowId; windowNo = SessionManager.getAppDesktop().registerWindow(this); - init(query); + this.query = query; + init(); } - private void init(MQuery query) + private void init() { - windowPanel = new ADWindowPanel(ctx, windowNo); - windowPanel.initPanel(adWindowId, query); - - this.appendChild(windowPanel); - this.setWidth("850px"); - _title = windowPanel.getTitle(); + windowPanel = new ADWindowPanel(ctx, windowNo); } public String getTitle() { return _title; } - - public boolean isAsap() - { - return false; - } - - public void onEvent(Event event) - { - /* if (restoreButton.equals(event.getTarget())) - { - String mode = this.getMode(); - if (ADWindow.MODE_EMBEDDED.equals(mode)) - { - this.doOverlapped(); - } - else - { - this.doEmbedded(); - } - }*/ - } + protected Component doCreatePart(Component parent) + { + windowPanelComponent = windowPanel.createPart(parent); + windowPanel.initPanel(adWindowId, query); + _title = windowPanel.getTitle(); + + return windowPanelComponent; + } + + public Component getComponent() { + return windowPanelComponent; + } } diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java new file mode 100644 index 0000000000..9c04499ac9 --- /dev/null +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/AboutWindow.java @@ -0,0 +1,94 @@ +package org.adempiere.webui.window; + +import org.adempiere.webui.component.Button; +import org.adempiere.webui.component.ToolBarButton; +import org.adempiere.webui.component.Window; +import org.compiere.Adempiere; +import org.zkoss.zhtml.Text; +import org.zkoss.zk.ui.event.Event; +import org.zkoss.zk.ui.event.EventListener; +import org.zkoss.zk.ui.event.Events; +import org.zkoss.zul.Separator; + +public class AboutWindow extends Window implements EventListener { + + public AboutWindow() { + super(); + init(); + } + + private void init() { + Text text = new Text("ADempiere ERP & CRM"); + text.setParent(this); + Separator separator = new Separator(); + separator.setParent(this); + + text = new Text(Adempiere.MAIN_VERSION + "
"); + text.setParent(this); + text = new Text(Adempiere.DB_VERSION +"
"); + text.setParent(this); + + separator = new Separator(); + separator.setParent(this); + ToolBarButton link = new ToolBarButton(); + link.setLabel("Sourceforge.net Project Site"); + link.setHref("http://www.sourceforge.net/projects/adempiere"); + link.setTarget("_blank"); + link.setParent(this); + + separator = new Separator(); + separator.setParent(this); + link = new ToolBarButton(); + link.setLabel("ADempiere Wiki"); + link.setHref("http://www.adempiere.com/wiki/index.php"); + link.setTarget("_blank"); + link.setParent(this); + + separator = new Separator(); + separator.setParent(this); + link = new ToolBarButton(); + link.setLabel("ADempiere Bazaar"); + link.setHref("http://www.adempiere.org"); + link.setTarget("_blank"); + link.setParent(this); + + separator = new Separator(); + separator.setParent(this); + link = new ToolBarButton(); + link.setLabel("ADempiere.com"); + link.setHref("http://www.adempiere.com"); + link.setTarget("_blank"); + link.setParent(this); + + separator = new Separator(); + separator.setBar(true); + separator.setHeight("20px"); + separator.setParent(this); + + text = new Text("Initial code contributed by: "); + text.setParent(this); + link = new ToolBarButton(); + link.setLabel("Posterita"); + link.setHref("http://www.posterita.org"); + link.setTarget("_blank"); + link.setParent(this); + separator = new Separator(); + separator.setParent(this); + + separator = new Separator(); + separator.setParent(this); + + Button btnOk = new Button(); + btnOk.setLabel("OK"); + btnOk.setImage("/images/Ok24.gif"); + btnOk.addEventListener(Events.ON_CLICK, this); + btnOk.setParent(this); + + this.setBorder("normal"); + } + + public void onEvent(Event event) throws Exception { + this.detach(); + } + +} diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java index db35cee3b7..be0911e8da 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/FindWindow.java @@ -50,7 +50,7 @@ import org.adempiere.webui.editor.WTableDirEditor; import org.adempiere.webui.editor.WebEditorFactory; import org.adempiere.webui.event.ValueChangeEvent; import org.adempiere.webui.event.ValueChangeListener; -import org.adempiere.webui.panel.MainPanel; +import org.adempiere.webui.part.MultiTabPart; import org.compiere.model.GridField; import org.compiere.model.MProduct; import org.compiere.model.MQuery; @@ -81,7 +81,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe { private static final long serialVersionUID = 1L; /** Main Window for the Lookup Panel */ - private MainPanel winMain; + private MultiTabPart winMain; /** Simple Window Tab */ private Window winLookupRecord; /** Advanced Window Tab */ @@ -174,8 +174,7 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe if (m_total < minRecords) { return; - } - this.appendChild(winMain); + } this.setBorder("normal"); this.setWidth("550px"); this.setTitle("Lookup Record: "+ title); @@ -366,12 +365,12 @@ public class FindWindow extends Window implements EventListener,ValueChangeListe **/ private void initPanel() { - winMain = new MainPanel(); - winMain.setWidth("100%"); + winMain = new MultiTabPart(); + winMain.createPart(this); winAdvanced = new Window(); winLookupRecord = new Window(); - winMain.addWindow(winLookupRecord, "Lookup Record",false, true); - winMain.addWindow(winAdvanced, "Advanced", false, false); + winMain.addTab(winLookupRecord, "Lookup Record",false, true); + winMain.addTab(winAdvanced, "Advanced", false, false); initSimple(); initAdvanced(); diff --git a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java index ff2597e9ea..cac75fda53 100644 --- a/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java +++ b/extension/posterita/webui/WEB-INF/src/org/adempiere/webui/window/LoginWindow.java @@ -19,7 +19,7 @@ package org.adempiere.webui.window; import java.util.Properties; -import org.adempiere.webui.AdempiereWebUI; +import org.adempiere.webui.IWebClient; import org.adempiere.webui.component.FWindow; import org.adempiere.webui.panel.LoginPanel; import org.adempiere.webui.panel.RolePanel; @@ -40,12 +40,12 @@ public class LoginWindow extends FWindow implements EventListener { private static final long serialVersionUID = 1L; - private AdempiereWebUI app; + private IWebClient app; private Properties ctx; private LoginPanel pnlLogin; private RolePanel pnlRole; - public LoginWindow(AdempiereWebUI app) + public LoginWindow(IWebClient app) { this.ctx = Env.getCtx(); this.app = app; @@ -58,7 +58,7 @@ public class LoginWindow extends FWindow implements EventListener private void init() { this.appendChild(pnlLogin); - this.setWidth("300px"); + this.setWidth("500px"); } diff --git a/extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/Executions.java b/extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/Executions.java deleted file mode 100644 index e49f8cf496..0000000000 --- a/extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/Executions.java +++ /dev/null @@ -1,558 +0,0 @@ -/* Executions.java - -{{IS_NOTE - Purpose: - - Description: - - History: - Fri Jun 3 17:55:08 2005, Created by tomyeh -}}IS_NOTE - -Copyright (C) 2005 Potix Corporation. All Rights Reserved. - -{{IS_RIGHT - This program is distributed under GPL Version 2.0 in the hope that - it will be useful, but WITHOUT ANY WARRANTY. -}}IS_RIGHT -*/ -package org.zkoss.zk.ui; - -import java.util.Map; -import java.io.Reader; -import java.io.Writer; -import java.io.IOException; - -import org.zkoss.idom.Document; -import org.zkoss.zk.ui.metainfo.PageDefinition; -import org.zkoss.zk.ui.metainfo.LanguageDefinition; -import org.zkoss.zk.xel.Evaluator; -import org.zkoss.zk.ui.sys.UiEngine; -import org.zkoss.zk.ui.sys.WebAppCtrl; -import org.zkoss.zk.ui.sys.DesktopCtrl; -import org.zkoss.zk.ui.sys.ServerPush; - -/** - * Utilities to access {@link Execution}. - * - * @author tomyeh - */ -public class Executions { - /** Stores the current {@link Execution}. */ - protected static final InheritableThreadLocal _exec = new InheritableThreadLocal(); - - /** Returns the current execution. - */ - public static final Execution getCurrent() { - return (Execution)_exec.get(); - } - - /** Returns the evaluator of the current execution. - * It is usually used to parse the expression into {@link org.zkoss.xel.Expression} - * or used with {@link org.zkoss.zk.xel.ExValue}. - * for performance improvement. - * - * @param page the page that this evaluator is associated. - * If null, the current page and then the first page is assumed. - * @param expfcls the implementation of {@link org.zkoss.xel.ExpressionFactory}, - * or null to use the default ({@link org.zkoss.zk.ui.util.Configuration#getExpressionFactoryClass}. - * @since 3.0.0 - */ - public static final Evaluator getEvaluator(Page page, Class expfcls) { - return getCurrent().getEvaluator(page, expfcls); - } - /** Returns the evaluator of the current execution. - * It is a shortcut of getEvaluator(comp != null ? comp.getPage(): null) - * - * @param comp the component to retrieve the page for the evaluator - * @param expfcls the implementation of {@link org.zkoss.xel.ExpressionFactory}, - * or null to use the default ({@link org.zkoss.zk.ui.util.Configuration#getExpressionFactoryClass}. - * @since 3.0.0 - */ - public static final Evaluator getEvaluator(Component comp, Class expfcls) { - return getCurrent().getEvaluator(comp, expfcls); - } - - /** Evluates the specified expression by use of the current context - * ({@link #getCurrent}). - * - *

The function mapper is retrieved from component's page's function - * mapper ({@link Page#getFunctionMapper}). - * If null, the current page, if any, is used to retrieve - * the mapper. - * - *

For better performance, you can use the instance returned by - *{@link #getEvaluator} to parse and cached the parsed expression. - * {@link org.zkoss.zk.xel.ExValue} is a utility class to simply - * the task. - * - * @param comp as the self variable (ignored if null) - */ - public static final Object evaluate(Component comp, - String expr, Class expectedType) { - return getCurrent().evaluate(comp, expr, expectedType); - } - /** Evluates the specified expression with the resolver of the current - * execution ({@link #getCurrent}). - * - *

The function mapper is retrieved from page's function - * mapper ({@link Page#getFunctionMapper}). - * If null, the current page, if any, is used to retrieve - * the mapper. - * - *

For better performance, you can use the instance returned by - *{@link #getEvaluator} to parse and cached the parsed expression. - * {@link org.zkoss.zk.xel.ExValue} is a utility class to simply - * the task. - * - * @param page used as the self variable and to retrieve the function - * mapper if funmap is not defined. Ignored if null. - */ - public static final Object evaluate(Page page, - String expr, Class expectedType) { - return getCurrent().evaluate(page, expr, expectedType); - } - - /** Encodes an URL. - * - *

It resolves "*" contained in URI, if any, to the proper Locale, - * and the browser code. - * Refer to {@link org.zkoss.web.servlet.Servlets#locate(ServletContext, ServletRequest, String, Locator)} - * for details. - */ - public static final String encodeURL(String uri) { - return getCurrent().encodeURL(uri); - } - - /** Creates components from a page file specified by an URI. - * Shortcut to {@link Execution#createComponents(String, Component, Map)}. - * - * @param parent the parent component, or null if you want it to be - * a root component. If parent is null, the page is assumed to be - * the current page, which is determined by the execution context. - * @param arg a map of parameters that is accessible by the arg variable - * in EL, or by {@link Execution#getArg}. - * Ignored if null. - * @see #createComponents(PageDefinition, Component, Map) - */ - public static final Component createComponents( - String uri, Component parent, Map arg) { - return getCurrent().createComponents(uri, parent, arg); - } - /** Creates components based on the specified page definition. - * Shortcut to {@link Execution#createComponents(PageDefinition, Component, Map)}. - * - * @param pagedef the page definition to use. It cannot be null. - * @param parent the parent component, or null if you want it to be - * a root component. If parent is null, the page is assumed to be - * the current page, which is determined by the execution context. - * @param arg a map of parameters that is accessible by the arg variable - * in EL, or by {@link Execution#getArg}. - * Ignored if null. - * @return the first component being created. - * @see #createComponents(String, Component, Map) - */ - public static final Component createComponents(PageDefinition pagedef, - Component parent, Map arg) { - return getCurrent().createComponents(pagedef, parent, arg); - } - - /** Creates components from the raw content specified by a string. - * Shortcut to {@link Execution#createComponentsDirectly(String, String, Component, Map)}. - * - * @param content the raw content of the page. It must be a XML and - * compliant to the page format (such as ZUL). - * @param extension the default extension if the content doesn't specify - * an language. In other words, if - * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} - * is called. - * If extension is null and the content doesn't specify a language, - * the language called "xul/html" is assumed. - * @param parent the parent component, or null if you want it to be - * a root component. If parent is null, the page is assumed to be - * the current page, which is determined by the execution context. - * @param arg a map of parameters that is accessible by the arg variable - * in EL, or by {@link Execution#getArg}. - * Ignored if null. - * @see #createComponents(PageDefinition, Component, Map) - * @see #createComponents(String, Component, Map) - * @see #createComponentsDirectly(Document, String, Component, Map) - * @see #createComponentsDirectly(Reader, String, Component, Map) - */ - public static final Component createComponentsDirectly(String content, - String extension, Component parent, Map arg) { - return getCurrent().createComponentsDirectly(content, extension, parent, arg); - } - /** Creates components from the raw content specified by a DOM tree. - * Shortcut to {@link Execution#createComponentsDirectly(Document, String, Component, Map)}. - * - * @param content the raw content in DOM. - * @param extension the default extension if the content doesn't specify - * an language. In other words, if - * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} - * is called. - * If extension is null and the content doesn't specify a language, - * the language called "xul/html" is assumed. - * @param parent the parent component, or null if you want it to be - * a root component. If parent is null, the page is assumed to be - * the current page, which is determined by the execution context. - * @param arg a map of parameters that is accessible by the arg variable - * in EL, or by {@link Execution#getArg}. - * Ignored if null. - * @see #createComponents(PageDefinition, Component, Map) - * @see #createComponents(String, Component, Map) - * @see #createComponentsDirectly(String, String, Component, Map) - * @see #createComponentsDirectly(Reader, String, Component, Map) - */ - public static final Component createComponentsDirectly(Document content, - String extension, Component parent, Map arg) { - return getCurrent().createComponentsDirectly(content, extension, parent, arg); - } - /** Creates components from the raw content read from the specified reader. - * Shortcut to {@link Execution#createComponentsDirectly(Reader, String, Component, Map)}. - * - *

The raw content is loader and parsed to a page defintion by use of - * {@link Execution#getPageDefinitionDirectly(Reader, String)}, and then - * invokes {@link #createComponents(PageDefinition,Component,Map)} - * to create components. - * - * @param reader the reader to retrieve the raw content. - * @param extension the default extension if the content doesn't specify - * an language. In other words, if - * the content doesn't specify an language, {@link LanguageDefinition#getByExtension} - * is called. - * If extension is null and the content doesn't specify a language, - * the language called "xul/html" is assumed. - * @param parent the parent component, or null if you want it to be - * a root component. If parent is null, the page is assumed to be - * the current page, which is determined by the execution context. - * @param arg a map of parameters that is accessible by the arg variable - * in EL, or by {@link Execution#getArg}. - * Ignored if null. - * @see #createComponents(PageDefinition, Component, Map) - * @see #createComponents(String, Component, Map) - * @see #createComponentsDirectly(Document, String, Component, Map) - * @see #createComponentsDirectly(String, String, Component, Map) - */ - public static Component createComponentsDirectly(Reader reader, - String extension, Component parent, Map arg) - throws IOException { - return getCurrent().createComponentsDirectly(reader, extension, parent, arg); - } - - /** Sends a temporary redirect response to the client using the specified - * redirect location URL by use of the current execution, - * {@link #getCurrent}. - * - *

After calling this method, the caller shall end the processing - * immediately (by returning). All pending requests and events will - * be dropped. - * - * @param uri the URI to redirect to, or null to reload the same page - * @see Execution#sendRedirect - */ - public static void sendRedirect(String uri) { - getCurrent().sendRedirect(uri); - } - - /** A shortcut of Executions.getCurrent().include(page). - * - * @see Execution#include(Writer,String,Map,int) - * @see Execution#include(String) - */ - public static void include(String page) - throws IOException { - getCurrent().include(page); - } - /** A shortcut of Executions.getCurrent().forward(page). - * - * @see Execution#forward(Writer,String,Map,int) - * @see Execution#forward(String) - */ - public static void forward(String page) - throws IOException { - getCurrent().forward(page); - } - - //-- wait/notify --// - /** Suspends the current processing of an event and wait until the - * other thread invokes {@link #notify(Object)}, {@link #notifyAll(Object)}, - * {@link #notify(Desktop, Object)} or {@link #notifyAll(Desktop, Object)} - * for the specified object. - * - *

It can only be called when the current thread is processing an event. - * And, when called, the current processing is suspended and ZK continues - * to process the next event and finally render the result. - * - *

It is typical use to implement a modal dialog where it won't return - * until the modal dialog ends. - * - * @param mutex any non-null object to identify what to notify. - * It must be same object passed to {@link #notify(Desktop, Object)}. - * If there is racing issue, you have to enclose it with - * synchronized (though it is optional). - * @exception UiException if it is called not during event processing. - * @exception SuspendNotAllowedException if there are too many suspended - * exceptions. - * Deployers can control the maximal allowed number of suspended exceptions - * by specifying max-suspended-thread in zk.xml, - * or invoking {@link org.zkoss.zk.ui.util.Configuration#setMaxSuspendedThreads}. - */ - public static final void wait(Object mutex) - throws InterruptedException, SuspendNotAllowedException { - getUiEngine().wait(mutex); - } - /** Wakes up a single event processing thread that is waiting on the - * specified object. - * - *

Unlike {@link #notify(Desktop, Object)}, this method can be invoked only - * in the event listener that processing the same desktop. - * In addition, this method can be called under the event listener. - * - *

Use {@link #notify(Desktop, Object)} if you want to notify in other - * thread, such as a working thread. - * - * @param mutex any non-null object to identify what to notify. - * It must be same object passed to {@link #wait}. - * If there is racing issue, you have to enclose it with - * synchronized (though it is optional). - * @see #notify(Desktop, Object) - * @see #notifyAll(Object) - * @exception UiException if it is called not during event processing. - */ - public static final void notify(Object mutex) { - getUiEngine().notify(mutex); - } - /** Wakes up all event processing thread that are waiting on the - * specified object. - * - *

Unlike {@link #notify(Desktop, Object)}, this method can be invoked only - * in the event listener that processing the same desktop. - * In addition, this method can be called under the event listener. - * - *

Use {@link #notifyAll(Desktop, Object)} if you want to notify in other - * thread, such as a working thread. - * - * @param mutex any non-null object to identify what to notify. - * It must be same object passed to {@link #wait}. - * If there is racing issue, you have to enclose it with - * synchronized (though it is optional). - * @see #notify(Desktop, Object) - * @see #notifyAll(Object) - * @exception UiException if it is called not during event processing. - */ - public static final void notifyAll(Object mutex) { - getUiEngine().notifyAll(mutex); - } - /** Wakes up a single event processing thread for the specified desktop - * that is waiting on the specified object. - * - *

Unlike {@link #notify(Object)}, this method can be called any time. - * It is designed to let working threads resume an event processing - * thread. - * - *

Notice: if this method is NOT called in an event processing thread, - * the resumed thread won't execute until the next request is received. - * To enforce it happen, you might use the timer component (found in ZUL). - * - *

Notice: to resolve racing issue, you usually need to follow - * this pattern. - *


-//Event Handling Thread
-synchronized (mutex) {
-	final WorkingThread worker = new WorkingThread(desktop);
-	synchronized (mutex) {
-		worker.start();
-		Executions.wait(mutex);
-	}
-	....
-}
-//Working Thread
-public void run() {
-	....
-	synchronized (mutex) {
-		Executions.notify(desktop, mutex);
-	}
-}
-	 
- * - * @param desktop the desktop which the suspended thread is processing. - * It must be the same desktop of the suspended thread. - * @param mutex any non-null object to identify what to notify. - * It must be same object passed to {@link #wait}. - * If there is racing issue, you have to enclose it with - * synchronized (though it is optional). - * @see #notify(Object) - * @see #notifyAll(Desktop, Object) - */ - public static final void notify(Desktop desktop, Object mutex) { - getUiEngine(desktop).notify(desktop, mutex); - } - /** Wakes up all event processing theads for the specified desktop - * that are waiting on the specified object. - * - *

Unlike {@link #notifyAll(Object)}, this method can be called any time. - * It is designed to let working threads resume an event processing - * thread. - * - *

Notice: if this method is NOT called in an event processing thread, - * the resumed thread won't execute until the next request is received. - * To enforce it happen, you might use the timer component (found in ZUL). - * - *

Notice: to resolve racing issue, you usually need to follow - * this pattern. - *


-//Event Handling Thread
-synchronized (mutex) {
-	final WorkingThread worker = new WorkingThread(desktop);
-	synchronized (mutex) {
-		worker.start();
-		Executions.wait(mutex);
-	}
-	....
-}
-//Working Thread
-public void run() {
-	....
-	synchronized (mutex) {
-		Executions.notifyAll(desktop, mutex);
-	}
-}
-	 
- * - * @param desktop the desktop which the suspended thread is processing. - * It must be the same desktop of the suspended thread. - * @param mutex any non-null object to identify what to notify. - * It must be same object passed to {@link #wait}. - * If there is racing issue, you have to enclose it with - * synchronized (though it is optional). - * @see #notify(Object) - * @see #notifyAll(Desktop, Object) - */ - public static final void notifyAll(Desktop desktop, Object mutex) { - getUiEngine(desktop).notifyAll(desktop, mutex); - } - - /** Activates a server-push thread. - * It causes the current thread to wait until the desktop is available - * to access, the desktop no longer exists, - * or some other thread interrupts this thread. - * - *

A server-push thread is a working thread that manipulates a desktop - * independent of event listeners. It can manipulate the components - * of the desktop as long as it is activated. - * - *

Due to the overhead of using server-push threads, the server-push - * feature is disabled by default. To use it, you have to enable - * it first with {@link Desktop#enableServerPush}. - * Once enabled, you can use as many as sevrer-push threads you like - * (for the desktop with the server-push feature enabled). - * - *

Before a server-push thread can access the components of the - * desktop it belongs, you have to activate it first. - * To activate a server-push thread, you have to invoke {@link #activate}. - * Once it returns, the server-push thread is activated and it, like - * event listeners, can manipulate the components of the corresponding - * desktop directly. - * - *

A typical use pattern: - * - *

class MyWorkingThread extends Thread {
-	 *  public void run() {
-	 *    while (anything_to_publish) {
-	 *       //prepare something to publish
-	 *       //you can create new components and manipulate them before
-	 *       //activation, as long as they are not attached to the desktop
-	 *
-	 *       Executions.activate(desktop);
-	 *       try {
-	 *         try {
-	 *           //activated
-	 *           //manipulate the components that are attached the desktop
-	 *         } finally {
-	 *           Executions.deactivate(desktop)
-	 *         }
-	 *       } catch (DesktopUnavailableException ex) {
-	 *         //clean up (since desktop is dead)
-	*       }
-	 *   }
-	 * }
-	 *}
- * - *

Note: the access of components is sequentialized. That is, - * at most one server-push thread is activated. All others, including - * the event listeners, have to wait util it is deactivated - * (i.e., until {@link #deactivate} is called). - * Thus, it is better to minimize the time remaining activated. - * A typical practice is to create new components and manipulate them - * before activated. Then, you have to only attach them after activated. - * - *

 Tree tree = new Tree();
-	 * new Treechildren().setParent(tree); //initialize the tree
-	 * Exections.activate(desktop);
-	 * try {
-	 *   tree.setPage(page); //assume page is a page of desktop
-	 *
- * - *

Note: you don't need to invoke this method in the event listener - * since it is already activated when an event listen starts execution. - * - * @exception InterruptedException if it is interrupted by other thread - * @exception DesktopUnavailableException if the desktop is removed - * (when activating). - * @since 3.0.0 - */ - public static final void activate(Desktop desktop) - throws InterruptedException, DesktopUnavailableException { - activate(desktop, 0); - } - /** Activates a server-push thread with, or until a certain amount of - * real time has elapsed. - * It causes the current thread to wait until the desktop is available - * to access, the desktop no longer exists, - * some other thread interrupts this thread, - * or a certain amount of real time has elapsed. - * - * @param timeout the maximum time to wait in milliseconds. - * Ingored (i.e., never timeout) if non-positive. - * @return whether it is activated or it is timeout. - * The only reason it returns false is timeout. - * @exception InterruptedException if it is interrupted by other thread - * @exception DesktopUnavailableException if the desktop is removed - * (when activating). - * @exception IllegalStateException if the server push is not - * enabled for this desktop yet ({@link Desktop#enableServerPush}). - * @since 3.0.0 - * @see #activate(Desktop) - */ - public static final boolean activate(Desktop desktop, long timeout) - throws InterruptedException, DesktopUnavailableException { - final ServerPush spush = ((DesktopCtrl)desktop).getServerPush(); - if (spush == null) - if (desktop.isAlive()) - throw new IllegalStateException("Before activation, the server push must be enabled for "+desktop); - else - throw new DesktopUnavailableException("Stopped"); - return spush.activate(timeout); - } - /** Deactivates a server-push thread. - * @since 3.0.0 - */ - public static final void deactivate(Desktop desktop) { - final ServerPush spush = ((DesktopCtrl)desktop).getServerPush(); - if (spush != null) - spush.deactivate(); - } - - private static final UiEngine getUiEngine(Desktop desktop) { - if (desktop == null) - throw new IllegalArgumentException("desktop cannot be null"); - return ((WebAppCtrl)desktop.getWebApp()).getUiEngine(); - } - private static final UiEngine getUiEngine() { - final Execution exec = getCurrent(); - if (exec == null) - throw new IllegalStateException("This method can be called only under an event listener"); - return ((WebAppCtrl)exec.getDesktop().getWebApp()).getUiEngine(); - } -} \ No newline at end of file diff --git a/extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/sys/ExecutionsCtrl.java b/extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/sys/ExecutionsCtrl.java deleted file mode 100644 index b6242d2ea4..0000000000 --- a/extension/posterita/webui/WEB-INF/src/org/zkoss/zk/ui/sys/ExecutionsCtrl.java +++ /dev/null @@ -1,53 +0,0 @@ -/* ExecutionsCtrl.java - -{{IS_NOTE - Purpose: - - Description: - - History: - Mon Jun 6 12:20:51 2005, Created by tomyeh -}}IS_NOTE - -Copyright (C) 2005 Potix Corporation. All Rights Reserved. - -{{IS_RIGHT - This program is distributed under GPL Version 2.0 in the hope that - it will be useful, but WITHOUT ANY WARRANTY. -}}IS_RIGHT -*/ -package org.zkoss.zk.ui.sys; - -import org.zkoss.zk.ui.Execution; -import org.zkoss.zk.ui.Executions; - -/** - * Additional utilities for {@link Execution}. - * - * @author tomyeh - */ -public class ExecutionsCtrl extends Executions { - protected ExecutionsCtrl() {} //prevent from instantiation - - /** Sets the execution for the current thread. - * Called only internally. - * - *

Note: you have to clean up the current execution - * with try/finally: - *


-	 * setCurrent(exec);
-	 * try {
-	 * ...
-	 * finally {
-	 *   setCurrent(null);
-	 * }
-	 */
-	public static final void setCurrent(Execution exec) {
-		_exec.set(exec);
-	}
-	/** Returns the current {@link ExecutionCtrl}.
-	 */
-	public static final ExecutionCtrl getCurrentCtrl() {
-		return (ExecutionCtrl)getCurrent();
-	}
-}
\ No newline at end of file
diff --git a/extension/posterita/webui/WEB-INF/tld/web/core.dsp.tld b/extension/posterita/webui/WEB-INF/tld/web/core.dsp.tld
index acd18c4663..82fc94735e 100755
--- a/extension/posterita/webui/WEB-INF/tld/web/core.dsp.tld
+++ b/extension/posterita/webui/WEB-INF/tld/web/core.dsp.tld
@@ -12,6 +12,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 -->
 
 
+	http://www.zkoss.org/dsp/web/core
 	
 	Core methods and tags for zweb in DSP
 	
@@ -91,12 +92,24 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 		org.zkoss.web.servlet.dsp.action.When
 	
 
+	
+	
+	
+	
+		ServletFns
+		org.zkoss.web.fn.ServletFns
+	
+	
+		Labels
+		org.zkoss.util.resource.Labels
+	
+
 	
 	
 	
 	
 		boolean
-		org.zkoss.el.fn.CommonFns
+		org.zkoss.xel.fn.CommonFns
 		boolean toBoolean(java.lang.Object)
 		
 		Converts the specified object to a boolean.
@@ -104,7 +117,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	
 	
 		number
-		org.zkoss.el.fn.CommonFns
+		org.zkoss.xel.fn.CommonFns
 		java.lang.Number toNumber(java.lang.Object)
 		
 		Converts the specified object to a number.
@@ -112,7 +125,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	
 	
 		int
-		org.zkoss.el.fn.CommonFns
+		org.zkoss.xel.fn.CommonFns
 		int toInt(java.lang.Object)
 		
 		Converts the specified object to an integer.
@@ -120,7 +133,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	
 	
 		decimal
-		org.zkoss.el.fn.CommonFns
+		org.zkoss.xel.fn.CommonFns
 		java.math.BigDecimal toDecimal(java.lang.Object)
 		
 		Converts the specified object to a (big) decimal.
@@ -128,7 +141,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	
 	
 		string
-		org.zkoss.el.fn.CommonFns
+		org.zkoss.xel.fn.CommonFns
 		java.lang.String toString(java.lang.Object)
 		
 		Converts the specified object to a string.
@@ -136,7 +149,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	
 	
 		char
-		org.zkoss.el.fn.CommonFns
+		org.zkoss.xel.fn.CommonFns
 		char toChar(java.lang.Object)
 		
 	Converts the specified object to a character.
@@ -152,7 +165,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	
 	
 		isInstance
-		org.zkoss.el.fn.CommonFns
+		org.zkoss.xel.fn.CommonFns
 		boolean isInstance(java.lang.Object, java.lang.Object)
 		
 	Tests whether an object (the second argument) is an instance of a class (the first argument).
@@ -161,7 +174,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	
 	
 		length
-		org.zkoss.el.fn.CommonFns
+		org.zkoss.xel.fn.CommonFns
 		int length(java.lang.Object)
 		
 	Returns the length of a string, array, collection or map.
@@ -169,7 +182,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	
 	
 		new
-		org.zkoss.el.fn.CommonFns
+		org.zkoss.xel.fn.CommonFns
 		java.lang.Object new_(java.lang.Object)
 		
 	Instantiates the specified class.
@@ -177,12 +190,21 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 		
 	
 
+	
+		getProperty
+		java.lang.System
+		java.lang.String getProperty(java.lang.String)
+		
+	Returns the system property.
+		
+	
+
 	
 	
 	
 	
 		cat
-		org.zkoss.el.fn.StringFns
+		org.zkoss.xel.fn.StringFns
 		
 	java.lang.String cat(java.lang.String, java.lang.String)
 		
@@ -192,7 +214,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	
 	
 		cat3
-		org.zkoss.el.fn.StringFns
+		org.zkoss.xel.fn.StringFns
 		
 	java.lang.String cat3(java.lang.String, java.lang.String, java.lang.String)
 		
@@ -202,7 +224,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	
 	
 		cat4
-		org.zkoss.el.fn.StringFns
+		org.zkoss.xel.fn.StringFns
 		
 	java.lang.String cat4(java.lang.String, java.lang.String, java.lang.String, java.lang.String)
 		
@@ -212,7 +234,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	
 	
 		cat5
-		org.zkoss.el.fn.StringFns
+		org.zkoss.xel.fn.StringFns
 		
 	java.lang.String cat5(java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String)
 		
@@ -222,7 +244,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	
 	
 		replace
-		org.zkoss.el.fn.StringFns
+		org.zkoss.xel.fn.StringFns
 		
 	java.lang.String replace(java.lang.String, java.lang.String, java.lang.String)
 		
@@ -233,12 +255,21 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 
 	
 		l
-		org.zkoss.el.fn.CommonFns
+		org.zkoss.xel.fn.CommonFns
 		java.lang.String getLabel(java.lang.String)
 		
 		Returns the label of the specified key.
 		
 	
+	
+		l2
+		org.zkoss.xel.fn.CommonFns
+		java.lang.String getLabel(java.lang.String, java.lang.Object[])
+		
+		Returns the label of the specified key, and formats with the specified
+		argument.
+		
+	
 
 	
 	
diff --git a/extension/posterita/webui/WEB-INF/tld/web/html.dsp.tld b/extension/posterita/webui/WEB-INF/tld/web/html.dsp.tld
index eae0a9a251..2523c44dc6 100755
--- a/extension/posterita/webui/WEB-INF/tld/web/html.dsp.tld
+++ b/extension/posterita/webui/WEB-INF/tld/web/html.dsp.tld
@@ -12,6 +12,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 -->
 
 
+	http://www.zkoss.org/dsp/web/html
 	
 	Used to develop ZK components for XUL/HTML.
 	
diff --git a/extension/posterita/webui/WEB-INF/tld/zk/core.dsp.tld b/extension/posterita/webui/WEB-INF/tld/zk/core.dsp.tld
index a6c25d937a..7de09b6f63 100755
--- a/extension/posterita/webui/WEB-INF/tld/zk/core.dsp.tld
+++ b/extension/posterita/webui/WEB-INF/tld/zk/core.dsp.tld
@@ -12,10 +12,22 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 -->
 
 
+	http://www.zkoss.org/dsp/zk/core
 	
 	Methods and actions for ZK in DSP/ZUML
 	
 
+	
+	
+	
+	
+		ZkFns
+		org.zkoss.zk.fn.ZkFns
+	
+
+	
+	
+	
 	
 		redraw
 		org.zkoss.zk.fn.ZkFns
@@ -46,7 +58,7 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 		
 		
 	Returns HTML tags to include all JavaScripts used by all languages.
-	The argument is the action.
+	The argument is ignored (since 3.1.0; reserved for backward compatible).
 		
 	
 	
@@ -57,17 +69,72 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 		
 		
 	Returns HTML tags to include all style sheets used by all languages.
+	Note: it cannot be called without current execution. In other words,
+	it is used to design component templates.
+		
+	
+	
+		outDeviceStyleSheets
+		org.zkoss.zk.fn.ZkFns
+		
+	java.lang.String outDeviceStyleSheets(java.lang.String deviceType)
+		
+		
+	Returns HTML tags to include all style sheets used by the specified device.
+	Note: unlike outLangStyleSheets, it can be called without current execution.
 		
 	
 
 	
-		outPageHeaders
+		outHeaders
 		org.zkoss.zk.fn.ZkFns
 		
-	java.lang.String outPageHeaders(org.zkoss.zk.ui.Page)
+	java.lang.String outHeaders(org.zkoss.zk.ui.Page)
 		
 		
-	Returns HTML header tags defined in the specified page.
+	Returns the content that will be placed inside the header element
+	of the specified page.
+		
+	
+	
+		outRootAttributes
+		org.zkoss.zk.fn.ZkFns
+		
+	java.lang.String outRootAttributes(org.zkoss.zk.ui.Page)
+		
+		
+	Returns the content that will be placed as the attributes of
+	the root element of the specified page.
+		
+	
+	
+		outContentType
+		org.zkoss.zk.fn.ZkFns
+		
+	java.lang.String outContentType(org.zkoss.zk.ui.Page)
+		
+		
+	Returns the content type.
+		
+	
+	
+		outDocType
+		org.zkoss.zk.fn.ZkFns
+		
+	java.lang.String outDocType(org.zkoss.zk.ui.Page)
+		
+		
+	Returns the doc type.
+		
+	
+	
+		outFirstLine
+		org.zkoss.zk.fn.ZkFns
+		
+	java.lang.String outFirstLine(org.zkoss.zk.ui.Page)
+		
+		
+	Returns the first line to be generated to the output.
 		
 	
 
@@ -93,4 +160,15 @@ Copyright (C) 2005 Potix Corporation. All Rights Reserved.
 	Returns date relevant labels in JavaScript.
 		
 	
+
+	
+		outPageAttrs
+		org.zkoss.zk.fn.ZkFns
+		
+	java.lang.String outPageAttrs(org.zkoss.zk.ui.Page)
+		
+		
+	Returns the attributes to render a page.
+		
+	
 
diff --git a/extension/posterita/webui/WEB-INF/tld/zul/core.dsp.tld b/extension/posterita/webui/WEB-INF/tld/zul/core.dsp.tld
index abea5bf4d9..ce38873256 100755
--- a/extension/posterita/webui/WEB-INF/tld/zul/core.dsp.tld
+++ b/extension/posterita/webui/WEB-INF/tld/zul/core.dsp.tld
@@ -12,10 +12,22 @@ Copyright (C) 2006 Potix Corporation. All Rights Reserved.
 -->
 
 
+	http://www.zkoss.org/dsp/zul/core
 	
 	Methods and actions for ZUL in DSP/ZUML
 	
 
+	
+	
+	
+	
+		ZulFns
+		org.zkoss.zul.fn.ZulFns
+	
+
+	
+	
+	
 	
 		getColAttrs
 		org.zkoss.zul.fn.ZulFns
@@ -36,16 +48,36 @@ Copyright (C) 2006 Potix Corporation. All Rights Reserved.
 	Returns the inner attributes used for the cell of the specified child
 	when it is placed inside of hbox/vbox.
 		
-	
-	
-		getBoxChildInnerAttrs
-		org.zkoss.zul.fn.ZulFns
-		
-	java.lang.String getBoxChildInnerAttrs(org.zkoss.zk.ui.Component)
-		
-		
-	Returns the outer attributes used for the cell of the specified child
-	when it is placed inside of hbox/vbox.
-		
+	
+	
+		getBoxChildInnerAttrs
+		org.zkoss.zul.fn.ZulFns
+		
+	java.lang.String getBoxChildInnerAttrs(org.zkoss.zk.ui.Component)
+		
+		
+	Returns the outer attributes used for the cell of the specified child
+	when it is placed inside of hbox/vbox.
+		
+	
+	
+		setStripeClass
+		org.zkoss.zul.fn.ZulFns
+		
+	void setStripeClass(org.zkoss.zk.ui.Component)
+		
+		
+	Sets the stripe CSS for each row.
+		
+	
+	
+		resetStripeClass
+		org.zkoss.zul.fn.ZulFns
+		
+	void resetStripeClass(org.zkoss.zk.ui.Component)
+		
+		
+	Resets the stripe CSS for each row.
+		
 	
 
diff --git a/extension/posterita/webui/WEB-INF/xsd/zul.xsd b/extension/posterita/webui/WEB-INF/xsd/zul.xsd
new file mode 100644
index 0000000000..0861926882
--- /dev/null
+++ b/extension/posterita/webui/WEB-INF/xsd/zul.xsd
@@ -0,0 +1,2477 @@
+
+
+	
+	
+		
+	
+	
+		
+			
+				
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+					
+					
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+				
+			
+			
+				
+			
+		
+		
+	
+		
+			
+				
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+					
+					
+					
+					
+					
+					
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+					
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+		
+		
+		
+		
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+		
+		
+		
+		
+		
+	
+	
+		
+		
+		
+		
+		
+		
+		
+	
+	
+		
+		
+	
+	
+		
+		
+	
+	
+		
+		
+		
+	
+	
+		
+		
+		
+	
+	
+	
+		
+			
+			
+			
+		
+	
+	
+		
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+		
+	
+	
+	
+	
+	
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+				
+				
+				
+			
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+				
+			
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+				
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+	
+	
+	
+	
+				
+			
+			
+			
+			
+			
+			
+			
+			
+					
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+					
+					
+				
+			
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+					
+					
+				
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+				
+			
+			
+				
+					
+					
+					
+						
+						
+					
+					
+						
+							
+							
+							
+								
+								
+							
+							
+								
+									
+									
+								
+							
+						
+						
+							
+							
+							
+								
+								
+							
+							
+								
+									
+									
+								
+							
+						
+					
+				
+				
+					
+					
+					
+						
+						
+					
+					
+						
+							
+							
+							
+								
+								
+							
+							
+								
+									
+									
+								
+							
+						
+						
+							
+							
+							
+								
+								
+							
+							
+								
+									
+									
+								
+							
+						
+					
+				
+				
+					
+					
+					
+						
+						
+					
+					
+						
+							
+							
+							
+								
+								
+							
+							
+								
+								
+							
+						
+						
+							
+							
+							
+								
+								
+							
+							
+								
+								
+							
+						
+					
+				
+			
+			
+				
+				
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+				
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+				
+		
+		
+	
+	
+		
+			
+				
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+				
+			
+			
+				
+					
+					
+						
+						
+					
+					
+						
+						
+					
+					
+						
+						
+					
+					
+						
+						
+							
+							
+						
+						
+							
+							
+						
+					
+				
+				
+					
+					
+						
+						
+					
+					
+						
+						
+					
+					
+						
+						
+					
+					
+						
+						
+							
+							
+						
+						
+							
+							
+						
+					
+				
+			
+			
+				
+				
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+		
+			
+				
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+	
+	
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+				
+			
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+			
+			
+		
+		
+		
+	
+	
+	
+	
+		
+		
+	
+	
+	
+			
+		
+			
+			
+				
+					
+					
+				
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+				
+	
+	
+	
+	
+		
+			
+			
+			
+			
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+	
+	
+		
+			
+				
+					
+				
+			
+			
+				
+			
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+					
+					
+				
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+			
+			
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+				
+			
+			
+				
+					
+					
+					
+						
+						
+					
+					
+						
+							
+							
+							
+								
+								
+							
+							
+								
+									
+									
+								
+							
+						
+						
+							
+							
+							
+								
+								
+							
+							
+								
+									
+									
+								
+							
+						
+					
+				
+				
+					
+					
+					
+						
+						
+					
+					
+						
+							
+							
+							
+								
+								
+							
+							
+								
+									
+									
+								
+							
+						
+						
+							
+							
+							
+								
+								
+							
+							
+								
+									
+									
+								
+							
+						
+					
+				
+				
+					
+					
+					
+						
+						
+					
+					
+						
+							
+							
+							
+								
+								
+							
+							
+								
+								
+							
+						
+						
+							
+							
+							
+								
+								
+							
+							
+								
+								
+							
+						
+					
+				
+			
+			
+				
+				
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+					
+					
+					
+						
+						
+					
+				
+				
+					
+					
+					
+						
+						
+					
+				
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+	
+	
+	
+	
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+		
+			
+			
+				
+					
+					
+				
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+				
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+					
+					
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+	
+	
+		
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+			
+		
+		
+	
+	
+	
+	
+		
+			
+				
+				
+				
+			
+		
+	
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+		
+		
+		
+		
+		
+		
+				
+		
+		
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+	
+		
+			
+			
+			
+			
+			
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+			
+			
+				
+				
+			
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+		
+	
+	
+	
+	
+		
+		
+		
+		
+		
+		
+	
+	
+		
+			
+				
+					
+					
+					
+					
+					
+					
+					
+				
+			
+			
+				
+			
+		
+	
+
diff --git a/extension/posterita/webui/WEB-INF/zk.xml b/extension/posterita/webui/WEB-INF/zk.xml
index 74de1fc0f7..659df2c9ba 100644
--- a/extension/posterita/webui/WEB-INF/zk.xml
+++ b/extension/posterita/webui/WEB-INF/zk.xml
@@ -8,7 +8,12 @@ Copyright (C) 2006 Potix Corporation. All Rights Reserved.
 	
 		[Optional] Monitor i3-log.conf and register a handler for the specified log-base
 		
-	
+	
+	
+	
+			
+	    true
+	
 
 	
-
\ No newline at end of file
+
+
+