From fbf734ea36c66073efc08ff9815458df64be9417 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Tue, 1 May 2012 17:20:21 +0800 Subject: [PATCH] IDEMPIERE-142 Zk6 Port. Fixed grid view row size changing between edit and view mode. --- .../webui/component/GridTabRowRenderer.java | 1 - .../org/adempiere/webui/editor/WEditor.java | 26 +++++++++++++------ .../webui/factory/DefaultEditorFactory.java | 2 ++ 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java index b2ffcf0b36..1b57c9fe4f 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java @@ -22,7 +22,6 @@ import java.util.Map; import java.util.Map.Entry; import org.adempiere.util.GridRowCtx; -import org.adempiere.webui.LayoutUtils; import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.editor.WButtonEditor; import org.adempiere.webui.editor.WEditor; diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java index b98c2420f4..368ec1bcfc 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/editor/WEditor.java @@ -43,6 +43,7 @@ import org.zkoss.zk.ui.event.EventListener; import org.zkoss.zk.ui.event.Events; import org.zkoss.zul.Image; import org.zkoss.zul.Menuitem; +import org.zkoss.zul.Textbox; import org.zkoss.zul.impl.InputElement; /** @@ -477,14 +478,16 @@ public abstract class WEditor implements EventListener, PropertyChangeLis !(getComponent() instanceof Datebox)) { String width = tableEditor ? "98%" : "100%"; if (getComponent() instanceof Button) { - Button btn = (Button) getComponent(); - String zclass = btn.getZclass(); - if (gridField.getDisplayType() == DisplayType.Image) { - if (!zclass.contains("image-button-field ")) { - btn.setZclass("image-button-field " + zclass); - } - } else if (!zclass.contains("form-button ")) { - btn.setZclass("form-button " + zclass); + if (!tableEditor) { + Button btn = (Button) getComponent(); + String zclass = btn.getZclass(); + if (gridField.getDisplayType() == DisplayType.Image) { + if (!zclass.contains("image-button-field ")) { + btn.setZclass("image-button-field " + zclass); + } + } else if (!zclass.contains("form-button ")) { + btn.setZclass("form-button " + zclass); + } } } else if (getComponent() instanceof Image) { Image image = (Image) getComponent(); @@ -496,6 +499,13 @@ public abstract class WEditor implements EventListener, PropertyChangeLis } else { ((HtmlBasedComponent)getComponent()).setWidth(width); } + + if (getComponent() instanceof Textbox && tableEditor) { + Textbox textbox = (Textbox) getComponent(); + if (textbox.isMultiline()) { + textbox.setRows(1); + } + } } } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java index 2d1d8629f0..353343638e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/factory/DefaultEditorFactory.java @@ -175,6 +175,8 @@ public class DefaultEditorFactory implements IEditorFactory { editor = new WUnknownEditor(gridField); } + editor.setTableEditor(tableEditor); + return editor; }