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,6 +478,7 @@ 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) {
if (!tableEditor) {
Button btn = (Button) getComponent(); Button btn = (Button) getComponent();
String zclass = btn.getZclass(); String zclass = btn.getZclass();
if (gridField.getDisplayType() == DisplayType.Image) { if (gridField.getDisplayType() == DisplayType.Image) {
@ -486,6 +488,7 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
} else if (!zclass.contains("form-button ")) { } else if (!zclass.contains("form-button ")) {
btn.setZclass("form-button " + zclass); btn.setZclass("form-button " + zclass);
} }
}
} else if (getComponent() instanceof Image) { } else if (getComponent() instanceof Image) {
Image image = (Image) getComponent(); Image image = (Image) getComponent();
image.setWidth("24px"); image.setWidth("24px");
@ -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;
} }