diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java index 0a8b96caf8..66bdf45802 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/HeaderPanel.java @@ -28,9 +28,9 @@ import org.zkoss.zk.ui.Page; import org.zkoss.zk.ui.event.Event; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; -import org.zkoss.zul.Button; import org.zkoss.zul.Image; import org.zkoss.zul.Popup; +import org.zkoss.zul.impl.LabelImageElement; /** * @@ -45,9 +45,9 @@ public class HeaderPanel extends Panel implements EventListener { private static final long serialVersionUID = -2351317624519209484L; - private Image image; - private Button btnMenu; - private Popup popMenu; + protected Image image; + protected LabelImageElement btnMenu; + protected Popup popMenu; public HeaderPanel() { @@ -55,31 +55,39 @@ public class HeaderPanel extends Panel implements EventListener addEventListener(Events.ON_CREATE, this); } - private void onCreate() + protected void onCreate() { image = (Image) getFellow("logo"); image.setSrc(ThemeManager.getSmallLogo()); image.addEventListener(Events.ON_CLICK, this); image.setStyle("cursor: pointer;"); - MenuSearchPanel menuSearchPanel = new MenuSearchPanel(this); - Component stub = getFellow("menuLookup"); - stub.getParent().insertBefore(menuSearchPanel, stub); - stub.detach(); - menuSearchPanel.setId("menuLookup"); + createSearchPanel(); - popMenu = new Popup(); + createPopupMenu(); + + btnMenu = (LabelImageElement) getFellow("menuButton"); + btnMenu.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(),"Menu"))); + btnMenu.addEventListener(Events.ON_CLICK, this); + } + + protected void createPopupMenu() { + popMenu = new Popup(); popMenu.setId("menuTreePopup"); new MenuTreePanel(popMenu); popMenu.setSclass("desktop-menu-popup"); popMenu.setHeight("90%"); popMenu.setWidth("600px"); popMenu.setPage(this.getPage()); + } - btnMenu = (Button) getFellow("menuButton"); - btnMenu.setLabel(Util.cleanAmp(Msg.getMsg(Env.getCtx(),"Menu"))); - btnMenu.addEventListener(Events.ON_CLICK, this); - } + protected void createSearchPanel() { + MenuSearchPanel menuSearchPanel = new MenuSearchPanel(this); + Component stub = getFellow("menuLookup"); + stub.getParent().insertBefore(menuSearchPanel, stub); + stub.detach(); + menuSearchPanel.setId("menuLookup"); + } public void onEvent(Event event) throws Exception { if (Events.ON_CLICK.equals(event.getName())) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java index 332fc0efa2..04be0b3cc8 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java @@ -204,7 +204,7 @@ public class LoginPanel extends Window implements EventListener protected void createUI() { Div div = new Div(); div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS); - Label label = new Label("Login"); + Label label = new Label(Msg.getMsg(Env.getCtx(), "Login")); label.setSclass(ITheme.LOGIN_BOX_HEADER_TXT_CLASS); div.appendChild(label); this.appendChild(div); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuSearchPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuSearchPanel.java index 7f4e4f1377..6f95f9659e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuSearchPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuSearchPanel.java @@ -34,11 +34,12 @@ public class MenuSearchPanel extends AbstractMenuPanel */ private static final long serialVersionUID = 5308522340852904168L; - private MenuTreeSearchPanel pnlSearch; + protected MenuTreeSearchPanel pnlSearch; public MenuSearchPanel(Component parent) { super(parent); + this.setSclass("menu-search-panel-container"); } protected void init() @@ -70,12 +71,16 @@ public class MenuSearchPanel extends AbstractMenuPanel { super.initComponents(); - Toolbar toolbar = new Toolbar(); + createSearchPanel(); + } + + protected void createSearchPanel() { + Toolbar toolbar = new Toolbar(); toolbar.setMold("panel"); this.appendChild(toolbar); pnlSearch = new MenuTreeSearchPanel(getMenuTree()); pnlSearch.setSclass("menu-search-panel"); toolbar.appendChild(pnlSearch); - } + } } \ No newline at end of file diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuTreeSearchPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuTreeSearchPanel.java index d52b4d3b2e..0fec6fd65e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuTreeSearchPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/MenuTreeSearchPanel.java @@ -46,9 +46,9 @@ public class MenuTreeSearchPanel extends TreeSearchPanel { * generated serial id */ private static final long serialVersionUID = 8785295166415073971L; - private Toolbarbutton newBtn; - private Toolbarbutton openBtn; - private boolean isNew = false; + protected Toolbarbutton newBtn; + protected Toolbarbutton openBtn; + protected boolean isNew = false; public MenuTreeSearchPanel(Tree tree, String event, int windowno, int tabno) { super(tree, event, windowno, tabno); @@ -71,22 +71,17 @@ public class MenuTreeSearchPanel extends TreeSearchPanel { hlayout.setSpacing("0px"); hlayout.setSclass("menu-search-toggle-box"); - newBtn = new Toolbarbutton(); - newBtn.setImage(ThemeManager.getThemeResource("images/New16.png")); - newBtn.setSclass("menu-search-toggle-off"); - newBtn.addEventListener(Events.ON_CLICK, new EventListener() { - @Override - public void onEvent(Event event) throws Exception { - newBtn.setDisabled(true); - newBtn.setSclass("menu-search-toggle-on"); - isNew = true; - openBtn.setDisabled(false); - openBtn.setSclass("menu-search-toggle-off"); - refreshAutoComplete(); - } - }); - newBtn.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New"))); + createNewButton(); + createOpenButton(); + + hlayout.appendChild(newBtn); + hlayout.appendChild(openBtn); + + layout.insertBefore(hlayout, layout.getFirstChild()); + } + + protected void createOpenButton() { openBtn = new Toolbarbutton(); openBtn.setImage(ThemeManager.getThemeResource("images/Open16.png")); openBtn.setSclass("menu-search-toggle-on"); @@ -103,11 +98,24 @@ public class MenuTreeSearchPanel extends TreeSearchPanel { } }); openBtn.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Open"))); - - hlayout.appendChild(newBtn); - hlayout.appendChild(openBtn); - - layout.insertBefore(hlayout, layout.getFirstChild()); + } + + protected void createNewButton() { + newBtn = new Toolbarbutton(); + newBtn.setImage(ThemeManager.getThemeResource("images/New16.png")); + newBtn.setSclass("menu-search-toggle-off"); + newBtn.addEventListener(Events.ON_CLICK, new EventListener() { + @Override + public void onEvent(Event event) throws Exception { + newBtn.setDisabled(true); + newBtn.setSclass("menu-search-toggle-on"); + isNew = true; + openBtn.setDisabled(false); + openBtn.setSclass("menu-search-toggle-off"); + refreshAutoComplete(); + } + }); + newBtn.setTooltiptext(Util.cleanAmp(Msg.getMsg(Env.getCtx(), "New"))); } @Override @@ -131,7 +139,7 @@ public class MenuTreeSearchPanel extends TreeSearchPanel { refreshAutoComplete(); } - private void refreshAutoComplete() { + protected void refreshAutoComplete() { List valueList = new ArrayList(); List descriptionList = new ArrayList(); List imageList = new ArrayList(); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java index 5ab81b8ace..aa3740c63d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java @@ -144,7 +144,7 @@ public class RolePanel extends Window implements EventListener, Deferrabl protected void createUI() { Div div = new Div(); div.setSclass(ITheme.LOGIN_BOX_HEADER_CLASS); - Label label = new Label("Login"); + Label label = new Label(Msg.getMsg(Env.getCtx(), "SelectRole")); label.setSclass(ITheme.LOGIN_BOX_HEADER_TXT_CLASS); div.appendChild(label); this.appendChild(div); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java index 1f7a97434b..354ef58b69 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/UserPanel.java @@ -22,7 +22,6 @@ import java.util.Properties; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Menupopup; import org.adempiere.webui.component.Messagebox; -import org.adempiere.webui.component.ToolBarButton; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.util.FeedbackManager; import org.adempiere.webui.window.WPreference; @@ -32,12 +31,14 @@ import org.compiere.model.MRole; import org.compiere.model.MUser; import org.compiere.util.Env; import org.compiere.util.Msg; +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.zk.ui.util.Composer; import org.zkoss.zul.Menuitem; -import org.zkoss.zul.Vbox; +import org.zkoss.zul.impl.LabelImageElement; /** * @@ -45,51 +46,48 @@ import org.zkoss.zul.Vbox; * @date Feb 25, 2007 * @version $Revision: 0.10 $ */ -public class UserPanel extends Vbox implements EventListener +public class UserPanel implements EventListener, Composer { - /** - * - */ - private static final long serialVersionUID = 6605639697034780065L; - private Properties ctx; + protected Properties ctx; - private ToolBarButton logout = new ToolBarButton(); - private ToolBarButton changeRole = new ToolBarButton(); - private ToolBarButton preference = new ToolBarButton(); - private ToolBarButton feedback = new ToolBarButton(); + protected LabelImageElement logout; + protected LabelImageElement changeRole; + protected LabelImageElement preference; + protected LabelImageElement feedback; - private Label lblUserNameValue = new Label(); - private WPreference preferencePopup; + protected Label lblUserNameValue = new Label(); + protected WPreference preferencePopup; - private Menupopup feedbackMenu; + protected Menupopup feedbackMenu; + + protected Component component; public UserPanel() { super(); this.ctx = Env.getCtx(); - addEventListener(Events.ON_CREATE, this); } - private void onCreate() + protected void onCreate() { - lblUserNameValue = (Label) getFellow("loginUserAndRole"); + lblUserNameValue = (Label) component.getFellowIfAny("loginUserAndRole", true); lblUserNameValue.setValue(getUserName() + "@" + getClientName() + "." + getOrgName()+"/"+this.getRoleName()); lblUserNameValue.addEventListener(Events.ON_CLICK, this); - feedback = (ToolBarButton) getFellow("feedback"); + feedback = (LabelImageElement) component.getFellowIfAny("feedback", true); feedback.setLabel(Msg.getMsg(Env.getCtx(), "Feedback")); feedback.addEventListener(Events.ON_CLICK, this); - preference = (ToolBarButton) getFellow("preference"); + preference = (LabelImageElement) component.getFellowIfAny("preference", true); preference.setLabel(Msg.getMsg(Env.getCtx(), "Preference")); preference.addEventListener(Events.ON_CLICK, this); - changeRole = (ToolBarButton) getFellow("changeRole"); + changeRole = (LabelImageElement) component.getFellowIfAny("changeRole", true); changeRole.setLabel(Msg.getMsg(Env.getCtx(), "changeRole")); changeRole.addEventListener(Events.ON_CLICK, this); - logout = (ToolBarButton) getFellow("logout"); + logout = (LabelImageElement) component.getFellowIfAny("logout", true); logout.setLabel(Msg.getMsg(Env.getCtx(),"Logout")); logout.addEventListener(Events.ON_CLICK, this); @@ -104,7 +102,7 @@ public class UserPanel extends Vbox implements EventListener feedbackMenu.appendChild(mi); SessionManager.getSessionApplication().getKeylistener().addEventListener(Events.ON_CTRL_KEY, this); - addEventListener("onEmailSupport", this); + component.addEventListener("onEmailSupport", this); } private String getUserName() @@ -165,14 +163,14 @@ public class UserPanel extends Vbox implements EventListener preferencePopup.detach(); } preferencePopup = new WPreference(); - preferencePopup.setPage(this.getPage()); + preferencePopup.setPage(component.getPage()); preferencePopup.open(preference, "after_start"); } else if (feedback == event.getTarget()) { if (feedbackMenu.getPage() == null) { - this.appendChild(feedbackMenu); + component.appendChild(feedbackMenu); } feedbackMenu.open(feedback, "after_start"); } @@ -204,10 +202,11 @@ public class UserPanel extends Vbox implements EventListener } } } - else if (Events.ON_CREATE.equals(event.getName())) - { - onCreate(); - } + } + @Override + public void doAfterCompose(Component comp) throws Exception { + this.component = comp; + onCreate(); } } diff --git a/org.adempiere.ui.zk/sessiontimeout.zul b/org.adempiere.ui.zk/sessiontimeout.zul new file mode 100644 index 0000000000..ce8d7ce825 --- /dev/null +++ b/org.adempiere.ui.zk/sessiontimeout.zul @@ -0,0 +1,32 @@ + + + + + + + + +
+
+ +
+
+ +
+
diff --git a/org.adempiere.ui.zk/theme/default/zul/desktop/header.zul b/org.adempiere.ui.zk/theme/default/zul/desktop/header.zul index a74bea3922..3ee3c9f5dc 100644 --- a/org.adempiere.ui.zk/theme/default/zul/desktop/header.zul +++ b/org.adempiere.ui.zk/theme/default/zul/desktop/header.zul @@ -10,7 +10,7 @@
- diff --git a/org.adempiere.ui.zk/timeout.zul b/org.adempiere.ui.zk/timeout.zul index ce8d7ce825..d248d0034b 100644 --- a/org.adempiere.ui.zk/timeout.zul +++ b/org.adempiere.ui.zk/timeout.zul @@ -1,32 +1,19 @@ - - - - - - -
-
- -
-
-