From 197afc88af05c072c8ac7d211324c1004d82422d Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Sat, 29 Jun 2013 01:23:59 +0800 Subject: [PATCH] IDEMPIERE-1118 Zk: Payment rule field editor is missing the dropdown button. Added css classes for payment rule field editor. Hide combobutton when combobox is readonly. --- .../adempiere/webui/component/Paymentbox.java | 36 +++++++------ .../theme/default/css/theme.css.dsp | 50 +++++++++++++++++++ 2 files changed, 72 insertions(+), 14 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Paymentbox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Paymentbox.java index 0ea3242833..0cd4b59c38 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Paymentbox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/Paymentbox.java @@ -21,7 +21,6 @@ import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Comboitem; import org.zkoss.zul.Div; -import org.zkoss.zul.Hlayout; /** * @@ -52,20 +51,17 @@ public class Paymentbox extends Div { } private void initComponents() { - Hlayout hlayout = new Hlayout(); - this.appendChild(hlayout); - hlayout.setHflex("1"); combo = new Combobox(); - hlayout.appendChild(combo); - combo.setHflex("1"); + appendChild(combo); + combo.setHflex("0"); btn = new Button(); btn.setTabindex(-1); btn.setSclass("editor-button"); btn.setHflex("0"); - hlayout.appendChild(btn); + appendChild(btn); - LayoutUtils.addSclass("editor-box", this); + LayoutUtils.addSclass("payment-rule-editor", this); } public Combobox getCombobox() { @@ -81,19 +77,31 @@ public class Paymentbox extends Div { } public void setEnabled(boolean isComboEnabled, boolean isBtnEnabled) { - combo.setReadonly(!isComboEnabled); + combo.setEnabled(isComboEnabled); + combo.setButtonVisible(isComboEnabled); btn.setEnabled(isBtnEnabled); btn.setVisible(isBtnEnabled); if (isBtnEnabled) { - btn.setSclass("editor-button"); - btn.setParent(this.getFirstChild()); + if (btn.getParent() != combo.getParent()) + btn.setParent(combo.getParent()); } else { - btn.detach(); + if (btn.getParent() != null) + btn.detach(); + } + if (isComboEnabled) { + LayoutUtils.removeSclass("editor-input-disd", combo); + } else { + LayoutUtils.addSclass("editor-input-disd", combo); + } + if (btn.getParent() == null) { + LayoutUtils.addSclass("no-button", combo); + } else { + LayoutUtils.removeSclass("no-button", combo); } } public boolean isEnabled() { - return !combo.isReadonly(); + return combo.isEnabled(); } public boolean addEventListener(String evtnm, EventListener listener) { @@ -110,5 +118,5 @@ public class Paymentbox extends Div { public Button getButton() { return btn; - } + } } diff --git a/org.adempiere.ui.zk/theme/default/css/theme.css.dsp b/org.adempiere.ui.zk/theme/default/css/theme.css.dsp index 3e9e3c2fa5..bda1e55aaa 100644 --- a/org.adempiere.ui.zk/theme/default/css/theme.css.dsp +++ b/org.adempiere.ui.zk/theme/default/css/theme.css.dsp @@ -1806,4 +1806,54 @@ table.z-vbox > tbody > tr > td > table { .help-window-content-l tr:hover td { background-color: #eee; +} + +<%-- payment rule --%> +.payment-rule-editor { + display: inline-block; + border: none; + padding: 0px; + margin: 0px; + background-color: transparent; + position: relative; +} +.payment-rule-editor .z-combobox { + width: 100%; +} +.payment-rule-editor .z-combobox-inp { + box-sizing: border-box; + -moz-box-sizing: border-box; /* Firefox */ + display: inline-block; + padding-right: 44px; + width: 100%; + height: 21px; +} +.payment-rule-editor .z-combobox-inp:focus { + border: 1px solid #0000ff; +} +.payment-rule-editor .z-combobox-inp.editor-input-disd { + padding-right: 22px !important; +} +.payment-rule-editor .z-combobox-btn { + padding: 0px; + margin: 0px; + display: inline-block; + border: none; + position: absolute; + right: 22px; + top: 1px; +} +.payment-rule-editor .z-combobox.no-button .z-combobox-btn { + right: 1px; +} +.payment-rule-editor .z-combobox .z-combobox-btn-over { + background-color: #ddd; + background-position: 0px 0px; +} +.payment-rule-editor .editor-button { + border-radius: 0px; +} +.payment-rule-editor .editor-button :hover { + border-radius: 0px; + background-color: #ddd; } \ No newline at end of file