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.

This commit is contained in:
Heng Sin Low 2013-06-29 01:23:59 +08:00
parent c361e73378
commit 197afc88af
2 changed files with 72 additions and 14 deletions

View File

@ -21,7 +21,6 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events; import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Comboitem; import org.zkoss.zul.Comboitem;
import org.zkoss.zul.Div; import org.zkoss.zul.Div;
import org.zkoss.zul.Hlayout;
/** /**
* *
@ -52,20 +51,17 @@ public class Paymentbox extends Div {
} }
private void initComponents() { private void initComponents() {
Hlayout hlayout = new Hlayout();
this.appendChild(hlayout);
hlayout.setHflex("1");
combo = new Combobox(); combo = new Combobox();
hlayout.appendChild(combo); appendChild(combo);
combo.setHflex("1"); combo.setHflex("0");
btn = new Button(); btn = new Button();
btn.setTabindex(-1); btn.setTabindex(-1);
btn.setSclass("editor-button"); btn.setSclass("editor-button");
btn.setHflex("0"); btn.setHflex("0");
hlayout.appendChild(btn); appendChild(btn);
LayoutUtils.addSclass("editor-box", this); LayoutUtils.addSclass("payment-rule-editor", this);
} }
public Combobox getCombobox() { public Combobox getCombobox() {
@ -81,19 +77,31 @@ public class Paymentbox extends Div {
} }
public void setEnabled(boolean isComboEnabled, boolean isBtnEnabled) { public void setEnabled(boolean isComboEnabled, boolean isBtnEnabled) {
combo.setReadonly(!isComboEnabled); combo.setEnabled(isComboEnabled);
combo.setButtonVisible(isComboEnabled);
btn.setEnabled(isBtnEnabled); btn.setEnabled(isBtnEnabled);
btn.setVisible(isBtnEnabled); btn.setVisible(isBtnEnabled);
if (isBtnEnabled) { if (isBtnEnabled) {
btn.setSclass("editor-button"); if (btn.getParent() != combo.getParent())
btn.setParent(this.getFirstChild()); btn.setParent(combo.getParent());
} else { } 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() { public boolean isEnabled() {
return !combo.isReadonly(); return combo.isEnabled();
} }
public boolean addEventListener(String evtnm, EventListener<?> listener) { public boolean addEventListener(String evtnm, EventListener<?> listener) {

View File

@ -1807,3 +1807,53 @@ table.z-vbox > tbody > tr > td > table {
.help-window-content-l tr:hover td { .help-window-content-l tr:hover td {
background-color: #eee; 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;
}