Search in sources :

Example 1 with WYesNoEditor

use of org.adempiere.webui.editor.WYesNoEditor in project adempiere by adempiere.

the class WPreference method init.

private void init() {
    ThemeUtils.addSclass("ad-wpreference", this);
    Div div = new Div();
    autoCommit = new WYesNoEditor("AutoCommit", Msg.getMsg(Env.getCtx(), "AutoCommit", true), null, false, false, true);
    div.appendChild(autoCommit.getComponent());
    autoCommit.getComponent().setTooltiptext(Msg.getMsg(Env.getCtx(), "AutoCommit", false));
    autoCommit.getComponent().setAttribute("zk_component_ID", "Preference_autoCommit");
    autoCommit.getComponent().setAttribute("zk_component_prefix", "Preference_");
    this.appendChild(div);
    autoNew = new WYesNoEditor("AutoNew", Msg.getMsg(Env.getCtx(), "AutoNew", true), null, false, false, true);
    autoNew.getComponent().setTooltiptext(Msg.getMsg(Env.getCtx(), "AutoNew", false));
    autoNew.getComponent().setAttribute("zk_component_ID", "Preference_autoNew");
    autoNew.getComponent().setAttribute("zk_component_prefix", "Preference_");
    div = new Div();
    div.appendChild(autoNew.getComponent());
    this.appendChild(div);
    tabCollapsible = new WYesNoEditor("WindowTabCollapsible", Msg.getMsg(Env.getCtx(), "WindowTabCollapsible", true), null, false, false, true);
    tabCollapsible.getComponent().setTooltiptext(Msg.getMsg(Env.getCtx(), "WindowTabCollapsible", false));
    tabCollapsible.getComponent().setAttribute("zk_component_ID", "Preference_tabCollapsible");
    tabCollapsible.getComponent().setAttribute("zk_component_prefix", "Preference_");
    div = new Div();
    div.appendChild(tabCollapsible.getComponent());
    this.appendChild(div);
    div = new Div();
    Label label = new Label(Msg.getMsg(Env.getCtx(), "WindowTabPlacement", true));
    label.setTooltiptext(Msg.getMsg(Env.getCtx(), "WindowTabPlacement", false));
    div.appendChild(label);
    div.appendChild(new Space());
    tabPlacement = new Combobox();
    tabPlacement.appendItem(Msg.getMsg(Env.getCtx(), "Left", true), "Left");
    tabPlacement.appendItem(Msg.getMsg(Env.getCtx(), "Right", true), "Right");
    tabPlacement.setAttribute("zk_component_ID", "Preference_tabPlacement");
    tabPlacement.setAttribute("zk_component_prefix", "Preference_");
    div.appendChild(tabPlacement);
    this.appendChild(div);
    div = new Div();
    label = new Label(Msg.getMsg(Env.getCtx(), "Theme", true));
    label.setTooltiptext(Msg.getMsg(Env.getCtx(), "SelectTheme", false));
    div.appendChild(label);
    div.appendChild(new Space());
    selectedTheme = new WTableDirEditor("AD_Theme_ID", true, false, true, MLookupFactory.get(Env.getCtx(), 0, 0, MColumn.getColumn_ID(MTheme.Table_Name, MTheme.COLUMNNAME_AD_Theme_ID), DisplayType.TableDir));
    selectedTheme.getComponent().addEventListener(Events.ON_CHANGE, this);
    selectedTheme.getComponent().setAttribute("zk_component_ID", "Preference_SetTheme");
    selectedTheme.getComponent().setAttribute("zk_component_prefix", "Preference_");
    div.appendChild(selectedTheme.getComponent());
    this.appendChild(div);
    Separator separator = new Separator();
    separator.setSpacing("20px");
    div = new Div();
    div.appendChild(separator);
    this.appendChild(div);
    ToolBar toolbar = new ToolBar();
    toolbar.setAlign("end");
    this.appendChild(toolbar);
    ToolBarButton btn = new ToolBarButton("");
    btn.setName("btnSave");
    btn.setImage(ServletFns.resolveThemeURL("~./images/Save24.png"));
    btn.setTooltiptext(Msg.getMsg(Env.getCtx(), "Save"));
    btn.addEventListener(Events.ON_CLICK, this);
    toolbar.appendChild(btn);
    UserPreference preference = SessionManager.getSessionApplication().getUserPreference();
    if (Integer.parseInt(preference.getProperty(UserPreference.P_ZK_THEME_PREFERENCE)) > 0) {
        m_preferredTheme_ID = Integer.parseInt(preference.getProperty(UserPreference.P_ZK_THEME_PREFERENCE));
    }
    autoCommit.setValue(preference.getProperty(UserPreference.P_AUTO_COMMIT));
    autoNew.setValue(preference.getProperty(UserPreference.P_AUTO_NEW));
    tabCollapsible.setValue(preference.getProperty(UserPreference.P_WINDOW_TAB_COLLAPSIBLE));
    tabPlacement.setValue(preference.getProperty(UserPreference.P_WINDOW_TAB_PLACEMENT));
    selectedTheme.setValue(m_preferredTheme_ID);
}
Also used : Div(org.zkoss.zul.Div) Space(org.zkoss.zul.Space) WTableDirEditor(org.adempiere.webui.editor.WTableDirEditor) ToolBarButton(org.adempiere.webui.component.ToolBarButton) Combobox(org.adempiere.webui.component.Combobox) WYesNoEditor(org.adempiere.webui.editor.WYesNoEditor) Label(org.adempiere.webui.component.Label) ToolBar(org.adempiere.webui.component.ToolBar) UserPreference(org.adempiere.webui.util.UserPreference) Separator(org.zkoss.zul.Separator)

Aggregations

Combobox (org.adempiere.webui.component.Combobox)1 Label (org.adempiere.webui.component.Label)1 ToolBar (org.adempiere.webui.component.ToolBar)1 ToolBarButton (org.adempiere.webui.component.ToolBarButton)1 WTableDirEditor (org.adempiere.webui.editor.WTableDirEditor)1 WYesNoEditor (org.adempiere.webui.editor.WYesNoEditor)1 UserPreference (org.adempiere.webui.util.UserPreference)1 Div (org.zkoss.zul.Div)1 Separator (org.zkoss.zul.Separator)1 Space (org.zkoss.zul.Space)1