From 6b4c3884ec0dc4b5b56990a2ce3dbbbcd95dc687 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 2 Mar 2012 15:15:22 +0800 Subject: [PATCH] Use inplace edit mode for grid view. --- .../webui/editor/WebEditorFactory.java | 20 +++++++++++++++++++ .../org/adempiere/webui/panel/ADTabpanel.java | 7 ++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WebEditorFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WebEditorFactory.java index 4f450cfd9c..e14f35941c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WebEditorFactory.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WebEditorFactory.java @@ -20,10 +20,13 @@ package org.adempiere.webui.editor; import java.util.List; import org.adempiere.base.Service; +import org.adempiere.webui.component.EditorBox; +import org.adempiere.webui.component.NumberBox; import org.adempiere.webui.factory.IEditorFactory; import org.compiere.model.GridField; import org.compiere.model.GridTab; import org.compiere.util.CLogger; +import org.zkoss.zul.impl.InputElement; /** * @@ -60,6 +63,23 @@ public class WebEditorFactory if (editor != null) break; } + if (tableEditor) + { + if (editor.getComponent() instanceof InputElement) + { + ((InputElement)editor.getComponent()).setInplace(true); + } + else if (editor.getComponent() instanceof EditorBox) + { + EditorBox box = (EditorBox) editor.getComponent(); + box.getTextbox().setInplace(true); + } + else if (editor.getComponent() instanceof NumberBox) + { + NumberBox box = (NumberBox) editor.getComponent(); + box.getDecimalbox().setInplace(true); + } + } return editor; } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java index d8bb211e85..6e956f4d0c 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java @@ -78,6 +78,7 @@ import org.zkoss.zul.Separator; import org.zkoss.zul.DefaultTreeNode; import org.zkoss.zul.Space; import org.zkoss.zul.Treeitem; +import org.zkoss.zul.impl.InputElement; /** * @@ -471,7 +472,11 @@ DataStatusListener, IADTabpanel, VetoableChangeListener } //streach component to fill grid cell - editor.fillHorizontal(); + if (editor.getComponent() instanceof InputElement) { + ((InputElement)editor.getComponent()).setHflex("1"); + } else { + editor.fillHorizontal(); + } //setup editor context menu WEditorPopupMenu popupMenu = editor.getPopupMenu();