diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java b/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java index dc615b54ed..1c61df9b0b 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/Desktop.java @@ -28,6 +28,9 @@ import java.util.logging.Level; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.ProcessDialog; import org.adempiere.webui.component.Button; +import org.adempiere.webui.component.Grid; +import org.adempiere.webui.component.Row; +import org.adempiere.webui.component.Rows; import org.adempiere.webui.component.Tabpanel; import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.component.Window; @@ -69,6 +72,7 @@ import org.zkoss.zul.Caption; import org.zkoss.zul.Groupbox; import org.zkoss.zul.Hbox; import org.zkoss.zul.Iframe; +import org.zkoss.zul.Label; import org.zkoss.zul.Separator; import org.zkoss.zul.Vbox; @@ -95,7 +99,7 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl private Borderlayout layout; private WindowContainer windowContainer; - + private Button btnNotice, btnRequest, btnWorkflow; public Desktop() @@ -112,8 +116,13 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl layout = new Borderlayout(); if (parent != null) + { layout.setParent(parent); - else + layout.setWidth("100%"); + layout.setHeight("100%"); + layout.setStyle("position: absolute"); + } + else layout.setPage(page); North n = new North(); @@ -193,7 +202,7 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl borderlayout.setWidth("100%"); borderlayout.setHeight("100%"); borderlayout.setStyle("background-color: transparent; position: absolute;"); - + West west = new West(); west.appendChild(gbxFav); borderlayout.appendChild(west); @@ -204,12 +213,12 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl center.appendChild(gbxView); borderlayout.appendChild(center); center.setStyle("background-color: transparent"); - + South south = new South(); south.appendChild(hbox); borderlayout.appendChild(south); south.setStyle("background-color: transparent"); - + //register as 0 registerWindow(homeTab); @@ -537,7 +546,7 @@ public class Desktop extends AbstractUIPart implements MenuListener, Serializabl if(menuId > 0) onMenuSelected(menuId); } } - } + } /** * Retrieves the Client website url diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java index cbd9fe9f21..21df1bc41d 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java @@ -20,7 +20,9 @@ package org.adempiere.webui.component; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.util.ArrayList; +import java.util.HashMap; import java.util.Iterator; +import java.util.Map; import java.util.logging.Level; import org.adempiere.webui.LayoutUtils; @@ -32,6 +34,7 @@ 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.zk.ui.event.KeyEvent; import org.zkoss.zul.Label; /** @@ -67,8 +70,10 @@ public class CWindowToolbar extends FToolbar implements EventListener // private ToolBarButton btnExit; private ArrayList listeners = new ArrayList(); - -private Event event; + + private Event event; + + private Map keyMap = new HashMap(); public CWindowToolbar() { @@ -259,11 +264,28 @@ private Event event; btnGridToggle.setDisabled(false); btnZoomAcross.setDisabled(false); - + btnActiveWorkflows.setDisabled(false); // Elaine 2008/07/17 + + configureKeyMap(); + } - protected void addSeparator() + private void configureKeyMap() { + keyMap.put(KeyEvent.F1, btnHelp); + keyMap.put(KeyEvent.F2, btnNew); + keyMap.put(KeyEvent.F3, btnDelete); + keyMap.put(KeyEvent.F4, btnSave); + keyMap.put(KeyEvent.F5, btnRefresh); + keyMap.put(KeyEvent.F6, btnFind); + keyMap.put(KeyEvent.F7, btnAttachment); + keyMap.put(KeyEvent.F8, btnGridToggle); + keyMap.put(KeyEvent.F9, btnHistoryRecords); + keyMap.put(KeyEvent.F11, btnReport); + keyMap.put(KeyEvent.F12, btnPrint); + } + + protected void addSeparator() { Label lblSeparator = new Label(); lblSeparator.setWidth("3px"); @@ -286,49 +308,57 @@ private Event event; { String eventName = event.getName(); Component eventComp = event.getTarget(); - - Iterator listenerIter = listeners.iterator(); + if(eventName.equals(Events.ON_CLICK)) { - if(eventComp instanceof ToolBarButton) + if(event.getTarget() instanceof ToolBarButton) { - this.event = event; - ToolBarButton cComponent = (ToolBarButton) eventComp; - String compName = cComponent.getName(); - String methodName = "on" + compName.substring(3); - while(listenerIter.hasNext()) - { - try - { - ToolbarListener tListener = listenerIter.next(); - Method method = tListener.getClass().getMethod(methodName, (Class[]) null); - method.invoke(tListener, (Object[]) null); - } - catch(SecurityException e) - { - log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e); - } - catch(NoSuchMethodException e) - { - log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e); - } - catch(IllegalArgumentException e) - { - log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e); - } - catch(IllegalAccessException e) - { - log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e); - } - catch(InvocationTargetException e) - { - log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e); - } - } - this.event = null; + doOnClick(event); } + } else if (eventName.equals(Events.ON_CTRL_KEY)) + { + KeyEvent keyEvent = (KeyEvent) event; + this.onCtrlKeyEvent(keyEvent.getKeyCode()); } } + + private void doOnClick(Event event) { + this.event = event; + ToolBarButton cComponent = (ToolBarButton) event.getTarget(); + String compName = cComponent.getName(); + String methodName = "on" + compName.substring(3); + Iterator listenerIter = listeners.iterator(); + while(listenerIter.hasNext()) + { + try + { + ToolbarListener tListener = listenerIter.next(); + Method method = tListener.getClass().getMethod(methodName, (Class[]) null); + method.invoke(tListener, (Object[]) null); + } + catch(SecurityException e) + { + log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e); + } + catch(NoSuchMethodException e) + { + log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e); + } + catch(IllegalArgumentException e) + { + log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e); + } + catch(IllegalAccessException e) + { + log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e); + } + catch(InvocationTargetException e) + { + log.log(Level.SEVERE, "Could not invoke Toolbar listener method: " + methodName + "()", e); + } + } + this.event = null; + } public void enableHistoryRecords(boolean enabled) { @@ -460,4 +490,26 @@ private Event event; { return event; } + + public void onCtrlKeyEvent(int keycode) { + if (isRealVisible()) { + ToolBarButton btn = keyMap.get(keycode); + if (btn != null && !btn.isDisabled() && btn.isVisible()) { + Events.sendEvent(btn, new Event(Events.ON_CLICK, btn)); + } + } + + } + + private boolean isRealVisible() { + if (!isVisible()) + return false; + Component parent = this.getParent(); + while (parent != null) { + if (!parent.isVisible()) + return false; + parent = parent.getParent(); + } + return true; + } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/CompositeADTab.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/CompositeADTab.java index 13f8a56959..3a788580b4 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/CompositeADTab.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/CompositeADTab.java @@ -27,7 +27,6 @@ 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; /** * @@ -45,7 +44,7 @@ public class CompositeADTab extends AbstractADTab private List tabLabelList = new ArrayList(); - private Div div; + private Window window; protected ADButtonTabList tabList; @@ -57,20 +56,21 @@ public class CompositeADTab extends AbstractADTab protected Component doCreatePart(Component parent) { - div = new Div(); + window = new Window(); if (parent != null) { - div.setParent(parent); - LayoutUtils.addSclass("adtab-body", div); + window.setParent(parent); + LayoutUtils.addSclass("adtab-body", window); + window.setContentSclass("adtab-body"); } else { - div.setPage(page); + window.setPage(page); } - - return div; + window.setCtrlKeys("#f1#f2#f3#f4#f5#f6#f7#f8#f9#f10#f11#f12"); + return window; } @Override protected void doAddTab(GridTab gTab, IADTabpanel tabPanel) { - tabPanel.setParent(div); + tabPanel.setParent(window); tabPanel.setVisible(false); ADTabListModel.ADTabLabel tabLabel = new ADTabListModel.ADTabLabel(gTab.getName(), gTab.getTabLevel()); @@ -141,6 +141,6 @@ public class CompositeADTab extends AbstractADTab } public Component getComponent() { - return div; + return window; } } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/Textbox.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/Textbox.java index 65d32c4112..15dcecb199 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/Textbox.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/Textbox.java @@ -18,8 +18,6 @@ package org.adempiere.webui.component; import org.zkoss.zk.ui.WrongValueException; -import org.zkoss.zul.Constraint; -import org.zkoss.zul.SimpleConstraint; /** * diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java index 3d0126ac1f..8e35da34fc 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java @@ -29,12 +29,14 @@ import org.adempiere.webui.component.Tabs; import org.compiere.util.CLogger; import org.zkoss.zk.ui.Component; import org.zkoss.zk.ui.HtmlBasedComponent; +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.Tab; +import org.zkoss.zul.Window; /** * @@ -69,7 +71,7 @@ public class ADWindowPanel extends AbstractADWindowPanel protected Component doCreatePart(Component parent) { layout = new Borderlayout(); - if (layout != null) { + if (parent != null) { layout.setParent(parent); layout.setStyle("position:absolute"); layout.setHeight("100%"); @@ -112,6 +114,11 @@ public class ADWindowPanel extends AbstractADWindowPanel TabOnCloseHanlder handler = new TabOnCloseHanlder(); ((Tabpanel)parent).setOnCloseHandler(handler); } + + if (adTab.getComponent() instanceof Window) { + Window w = (Window) adTab.getComponent(); + w.addEventListener(Events.ON_CTRL_KEY, toolbar); + } return layout; } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/part/AbstractUIPart.java b/zkwebui/WEB-INF/src/org/adempiere/webui/part/AbstractUIPart.java index 7a0672272b..71c6a66576 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/part/AbstractUIPart.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/part/AbstractUIPart.java @@ -16,6 +16,7 @@ public abstract class AbstractUIPart implements UIPart { page = (Page)parent; } else if (parent instanceof Component) { component = (Component)parent; + page = component.getPage(); } else { throw new IllegalArgumentException("Parent must of class Page or Component."); } diff --git a/zkwebui/css/default.css.dsp b/zkwebui/css/default.css.dsp index f8516a1a0e..31403ccbff 100644 --- a/zkwebui/css/default.css.dsp +++ b/zkwebui/css/default.css.dsp @@ -188,15 +188,17 @@ tr.tab-desktop-tb-m { padding: 0; width: 100%; height: 100%; + border: none; } .adtab-content { margin: 0; padding: 0; + border: none; overflow: auto; width: 100%; height: 100%; - position: absolute; + position: absolute; } .adtab-grid-panel {