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 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;

View File

@ -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<Event>, 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<Event>, PropertyChangeLis
} else {
((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.setTableEditor(tableEditor);
return editor;
}