IDEMPIERE-142 Zk6 Port. Fixed grid view row size changing between edit and view mode.

This commit is contained in:
Heng Sin Low 2012-05-01 17:20:21 +08:00
parent 44fecb0ca9
commit fbf734ea36
3 changed files with 20 additions and 9 deletions

View File

@ -22,7 +22,6 @@ import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
import org.adempiere.util.GridRowCtx; import org.adempiere.util.GridRowCtx;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.apps.AEnv; import org.adempiere.webui.apps.AEnv;
import org.adempiere.webui.editor.WButtonEditor; import org.adempiere.webui.editor.WButtonEditor;
import org.adempiere.webui.editor.WEditor; import org.adempiere.webui.editor.WEditor;

View File

@ -43,6 +43,7 @@ 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.Image; import org.zkoss.zul.Image;
import org.zkoss.zul.Menuitem; import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Textbox;
import org.zkoss.zul.impl.InputElement; import org.zkoss.zul.impl.InputElement;
/** /**
@ -477,14 +478,16 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
!(getComponent() instanceof Datebox)) { !(getComponent() instanceof Datebox)) {
String width = tableEditor ? "98%" : "100%"; String width = tableEditor ? "98%" : "100%";
if (getComponent() instanceof Button) { if (getComponent() instanceof Button) {
Button btn = (Button) getComponent(); if (!tableEditor) {
String zclass = btn.getZclass(); Button btn = (Button) getComponent();
if (gridField.getDisplayType() == DisplayType.Image) { String zclass = btn.getZclass();
if (!zclass.contains("image-button-field ")) { if (gridField.getDisplayType() == DisplayType.Image) {
btn.setZclass("image-button-field " + zclass); 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 (!zclass.contains("form-button ")) {
btn.setZclass("form-button " + zclass);
}
} }
} else if (getComponent() instanceof Image) { } else if (getComponent() instanceof Image) {
Image image = (Image) getComponent(); Image image = (Image) getComponent();
@ -496,6 +499,13 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
} else { } else {
((HtmlBasedComponent)getComponent()).setWidth(width); ((HtmlBasedComponent)getComponent()).setWidth(width);
} }
if (getComponent() instanceof Textbox && tableEditor) {
Textbox textbox = (Textbox) getComponent();
if (textbox.isMultiline()) {
textbox.setRows(1);
}
}
} }
} }
} }

View File

@ -175,6 +175,8 @@ public class DefaultEditorFactory implements IEditorFactory {
editor = new WUnknownEditor(gridField); editor = new WUnknownEditor(gridField);
} }
editor.setTableEditor(tableEditor);
return editor; return editor;
} }