diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java index 7d758aa12a..c1d05d5ae7 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/LayoutUtils.java @@ -16,6 +16,7 @@ import java.io.IOException; import java.io.StringWriter; import org.adempiere.webui.component.Label; +import org.compiere.util.Util; import org.zkoss.zk.au.out.AuOuter; import org.zkoss.zk.au.out.AuScript; import org.zkoss.zk.ui.AbstractComponent; @@ -206,4 +207,18 @@ public final class LayoutUtils { } return true; } + + public static void removeSclass(String cls, HtmlBasedComponent target) { + String sclass = target.getSclass(); + if (Util.isEmpty(sclass)) + return; + + sclass = " " + sclass + " "; + cls = " " + cls + " "; + if (sclass.indexOf(cls) >= 0) { + sclass.replace(cls, ""); + sclass = sclass.trim(); + target.setSclass(sclass); + } + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/EditorBox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/EditorBox.java index 3f082df3b5..79456ed4d4 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/EditorBox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/EditorBox.java @@ -19,7 +19,6 @@ import org.adempiere.webui.LayoutUtils; import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Div; -import org.zkoss.zul.Hlayout; /** * @author Low Heng Sin @@ -33,6 +32,7 @@ public class EditorBox extends Div { this); protected Textbox txt; protected Button btn; +// private Hlayout hlayout; public EditorBox() { initComponents(); @@ -54,20 +54,18 @@ public class EditorBox extends Div { } private void initComponents() { - Hlayout hlayout = new Hlayout(); - this.appendChild(hlayout); - hlayout.setHflex("1"); +// hlayout = new Hlayout(); +// hlayout.setHflex("1"); txt = new Textbox(); - hlayout.appendChild(txt); - txt.setHflex("1"); - + appendChild(txt); btn = new Button(); btn.setTabindex(-1); - btn.setSclass("editor-button"); btn.setHflex("0"); - hlayout.appendChild(btn); - + btn.setSclass("editor-button"); + appendChild(btn); + LayoutUtils.addSclass("editor-box", this); + setTableEditorMode(false); } /** @@ -99,10 +97,11 @@ public class EditorBox extends Div { btn.setEnabled(enabled); btn.setVisible(enabled); if (enabled) { - btn.setSclass("editor-button"); - btn.setParent(this.getFirstChild()); + if (btn.getParent() != txt.getParent()) + btn.setParent(txt.getParent()); } else { - btn.detach(); + if (btn.getParent() != null) + btn.detach(); } } @@ -145,4 +144,19 @@ public class EditorBox extends Div { public Button getButton() { return btn; } + + public void setTableEditorMode(boolean flag) { + if (flag) { + txt.setHflex("0"); + setHflex("0"); + LayoutUtils.addSclass("grid-editor-input", txt); + LayoutUtils.addSclass("grid-editor-button", btn); + } else { + txt.setHflex("1"); + setHflex("1"); + LayoutUtils.removeSclass("grid-editor-input", txt); + LayoutUtils.removeSclass("grid-editor-button", btn); + } + + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java index 8e37667080..1a28e2308c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/NumberBox.java @@ -31,7 +31,6 @@ import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Decimalbox; import org.zkoss.zul.Div; import org.zkoss.zul.Hbox; -import org.zkoss.zul.Hlayout; import org.zkoss.zul.Popup; import org.zkoss.zul.Vbox; @@ -61,29 +60,30 @@ public class NumberBox extends Div private Popup popup; + public NumberBox(boolean integral) + { + this(integral, false); + } + /** * * @param integral */ - public NumberBox(boolean integral) + public NumberBox(boolean integral, boolean tableEditor) { super(); this.integral = integral; - init(); + init(tableEditor); } - private void init() + private void init(boolean tableEditor) { - Hlayout hlayout = new Hlayout(); - hlayout.setHflex("1"); - appendChild(hlayout); - decimalBox = new Decimalbox(); if (integral) decimalBox.setScale(0); decimalBox.setStyle("display: inline-block;text-align:right"); decimalBox.setHflex("1"); - hlayout.appendChild(decimalBox); + appendChild(decimalBox); btn = new Button(); btn.setImage(ThemeManager.getThemeResource("images/Calculator16.png")); @@ -93,14 +93,15 @@ public class NumberBox extends Div "} catch(error) {}"); LayoutUtils.addSclass("editor-button", btn); - hlayout.appendChild(btn); + appendChild(btn); popup = getCalculatorPopup(); appendChild(popup); btn.setPopup(popup); btn.setStyle("text-align: center;"); - LayoutUtils.addSclass(".number-box", this); + LayoutUtils.addSclass("number-box", this); + LayoutUtils.addSclass("editor-box", this); } /** @@ -433,4 +434,19 @@ public class NumberBox extends Div { return btn; } + + public void setTableEditorMode(boolean flag) { + if (flag) { + decimalBox.setHflex("0"); + setHflex("0"); + LayoutUtils.addSclass("grid-editor-input", decimalBox); + LayoutUtils.addSclass("grid-editor-button", btn); + } else { + decimalBox.setHflex("1"); + setHflex("1"); + LayoutUtils.removeSclass("grid-editor-input", decimalBox); + LayoutUtils.removeSclass("grid-editor-button", btn); + } + + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAccountEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAccountEditor.java index 2b345e8638..338685f90a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAccountEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAccountEditor.java @@ -243,5 +243,10 @@ public class WAccountEditor extends WEditor implements ContextMenuListener return value == null; } - + @Override + public void setTableEditor(boolean b) { + super.setTableEditor(b); + getComponent().setTableEditorMode(b); + } + } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAssignmentEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAssignmentEditor.java index 65bd7dce0a..e567dad3a3 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAssignmentEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WAssignmentEditor.java @@ -214,4 +214,9 @@ public class WAssignmentEditor extends WEditor implements ContextMenuListener { } } + @Override + public void setTableEditor(boolean b) { + super.setTableEditor(b); + getComponent().setTableEditorMode(b); + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WFilenameEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WFilenameEditor.java index 7b5bbb1258..cbf0bdd61d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WFilenameEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WFilenameEditor.java @@ -181,4 +181,11 @@ public class WFilenameEditor extends WEditor { return LISTENER_EVENTS; } + + @Override + public void setTableEditor(boolean b) { + super.setTableEditor(b); + getComponent().setTableEditorMode(b); + } + } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java index e315831f51..f4f2b5704a 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocationEditor.java @@ -231,4 +231,12 @@ public class WLocationEditor extends WEditor implements EventListener, Pr ValuePreference.start (getComponent(), this.getGridField(), getValue()); } } + + @Override + public void setTableEditor(boolean b) { + super.setTableEditor(b); + getComponent().setTableEditorMode(b); + } + + } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocatorEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocatorEditor.java index 80b430451b..4de11da14c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocatorEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WLocatorEditor.java @@ -514,4 +514,12 @@ public class WLocatorEditor extends WEditor implements EventListener, Pro { return LISTENER_EVENTS; } + + @Override + public void setTableEditor(boolean b) { + super.setTableEditor(b); + getComponent().setTableEditorMode(b); + } + + } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WNumberEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WNumberEditor.java index 28466f34bc..a6593b1e13 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WNumberEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WNumberEditor.java @@ -78,7 +78,7 @@ public class WNumberEditor extends WEditor implements ContextMenuListener */ public WNumberEditor(boolean tableEditor, GridField gridField) { - super(new NumberBox(gridField.getDisplayType() == DisplayType.Integer), + super(new NumberBox(gridField.getDisplayType() == DisplayType.Integer, tableEditor), gridField); this.displayType = gridField.getDisplayType(); this.tableEditor = tableEditor; @@ -246,4 +246,11 @@ public class WNumberEditor extends WEditor implements ContextMenuListener WFieldRecordInfo.start(gridField); } } + + @Override + public void setTableEditor(boolean b) { + super.setTableEditor(b); + getComponent().setTableEditorMode(b); + } + } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WPAttributeEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WPAttributeEditor.java index 9ed104433e..7823f0fc09 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WPAttributeEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WPAttributeEditor.java @@ -317,5 +317,9 @@ public class WPAttributeEditor extends WEditor implements ContextMenuListener getComponent().getTextbox().setReadonly(true); } - + @Override + public void setTableEditor(boolean b) { + super.setTableEditor(b); + getComponent().setTableEditorMode(b); + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java index e6ddf4ee8c..12301d0c3c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WSearchEditor.java @@ -893,6 +893,13 @@ public class WSearchEditor extends WEditor implements ContextMenuListener, Value } + @Override + public void setTableEditor(boolean b) { + super.setTableEditor(b); + getComponent().setTableEditorMode(b); + } + + /** * @param windowNo * @return WSearchEditor 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 4d832188c8..08dbf2358d 100644 --- a/org.adempiere.ui.zk/theme/default/css/theme.css.dsp +++ b/org.adempiere.ui.zk/theme/default/css/theme.css.dsp @@ -988,54 +988,74 @@ span.z-tree-tee, span.z-tree-last, span.z-tree-firstspacer { padding: 0px; margin: 0px; background-color: transparent; - width: 100%; -} - -.editor-box table { - border: none; - padding: 0px; - margin: 0px; - width: 100%; - border: none; -} - -.editor-box tr { - width: 100%; - border: none; - padding: 0px; - margin: 0px; - white-space:nowrap; -} - -.editor-box td { - border: none; - padding: 0px; - margin: 0px; } .editor-box .z-textbox { - display: inline; - width: 99%; + display: inline-block; + border-right-color: transparent; + border-top-right-radius: 0px; + border-bottom-right-radius: 0px; } +.editor-box .z-textbox:focus { + border: 1px solid #0000ff; +} + .editor-button { - padding: 0px 2px; + padding: 0px; margin: 0px; - border-radius: 2px; + display: inline-block; + background-color: transparent; + background-image: none; + width: 19px; + height: 20px; + border: 1px solid #e6e6e6; + border-top-color: #b2b2b2; + border-left-width: 0px; + border-radius: 0 2px 2px 0; +} + +.editor-button :hover { + background-color: #ddd; } .editor-button img { - vertical-align: middle; - text-align: center; + vertical-align: top; + text-align: left; width: 16px; height: 16px; + padding: 2px 1px; } -.editor-button-column { + +.editor-box .grid-editor-input.z-textbox { + width: 90%; +} + +.grid-editor-button { +} + +.grid-editor-button img { } .number-box { - display: inline-block; white-space:nowrap; + display: inline-block; + white-space:nowrap; +} + +.number-box .z-decimalbox { + display: inline-block; + border-right-color: transparent; + border-top-right-radius: 0px; + border-bottom-right-radius: 0px; +} + +.number-box .grid-editor-input.z-decimalbox { + width: 80%; +} + +.number-box .z-decimalbox:focus { + border: 1px solid #0000ff; } .datetime-box {