IDEMPIERE-486 Display problem in grid model of Windows>Tab>Field page. Faster fix for the issue, previous fix caused significant performance issue when the number of column and row of the grid is big.

This commit is contained in:
Heng Sin Low 2012-12-31 14:27:29 +08:00
parent 45d88ff3ab
commit b92320fdb6
3 changed files with 29 additions and 12 deletions

View File

@ -45,7 +45,6 @@ import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zk.ui.util.Clients;
import org.zkoss.zul.Cell;
import org.zkoss.zul.Div;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Label;
import org.zkoss.zul.Paging;
@ -252,11 +251,11 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
for (Entry<GridField, WEditor> entry : editors.entrySet()) {
if (entry.getValue().getComponent().getParent() != null) {
Component child = entry.getValue().getComponent();
Div div = null;
Cell div = null;
while (div == null && child != null) {
Component parent = child.getParent();
if (parent instanceof Div && parent.getParent() instanceof Row)
div = (Div)parent;
if (parent instanceof Cell && parent.getParent() instanceof Row)
div = (Cell)parent;
else
child = parent;
}
@ -383,7 +382,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
}
colIndex ++;
Div div = new Div();
Cell div = new Cell();
String divStyle = CELL_DIV_STYLE;
org.zkoss.zul.Column column = (org.zkoss.zul.Column) columns.getChildren().get(colIndex);
if (column.isVisible()) {
@ -399,8 +398,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
}
}
div.setStyle(divStyle);
div.setWidth(column.getWidth());
div.setHflex("1");
div.setWidth("100%");
div.setAttribute("columnName", gridPanelFields[i].getColumnName());
div.addEventListener(Events.ON_CLICK, rowListener);
div.addEventListener(Events.ON_DOUBLE_CLICK, rowListener);
@ -483,7 +481,7 @@ public class GridTabRowRenderer implements RowRenderer<Object[]>, RowRendererExt
org.zkoss.zul.Column column = (org.zkoss.zul.Column) columns.getChildren().get(colIndex);
if (column.isVisible()) {
Div div = (Div) currentRow.getChildren().get(colIndex);
Cell div = (Cell) currentRow.getChildren().get(colIndex);
div.getChildren().clear();
WEditor editor = getEditorCell(gridPanelFields[i]);
div.appendChild(editor.getComponent());

View File

@ -23,6 +23,7 @@ import java.beans.PropertyChangeListener;
import java.util.ArrayList;
import org.adempiere.webui.AdempiereWebUI;
import org.adempiere.webui.LayoutUtils;
import org.adempiere.webui.component.Bandbox;
import org.adempiere.webui.component.Button;
import org.adempiere.webui.component.Datebox;
@ -42,6 +43,7 @@ import org.zkoss.zk.ui.HtmlBasedComponent;
import org.zkoss.zk.ui.event.Event;
import org.zkoss.zk.ui.event.EventListener;
import org.zkoss.zk.ui.event.Events;
import org.zkoss.zul.Combobox;
import org.zkoss.zul.Image;
import org.zkoss.zul.Menuitem;
import org.zkoss.zul.Textbox;
@ -489,7 +491,7 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
//can't stretch bandbox & datebox
if (!(getComponent() instanceof Bandbox) &&
!(getComponent() instanceof Datebox)) {
String width = tableEditor ? "98%" : "100%";
String width = tableEditor ? "96%" : "100%";
if (getComponent() instanceof Button) {
if (!tableEditor) {
Button btn = (Button) getComponent();
@ -507,11 +509,20 @@ public abstract class WEditor implements EventListener<Event>, PropertyChangeLis
image.setWidth("24px");
image.setHeight("24px");
} else {
if (!tableEditor) {
if (getComponent() instanceof InputElement) {
((InputElement)getComponent()).setHflex("1");
} else {
((HtmlBasedComponent)getComponent()).setWidth(width);
}
} else {
if (getComponent() instanceof Combobox) {
LayoutUtils.addSclass("grid-combobox-editor", (HtmlBasedComponent)getComponent());
} else {
((HtmlBasedComponent)getComponent()).setWidth(width);
}
}
if (getComponent() instanceof Textbox && tableEditor) {
Textbox textbox = (Textbox) getComponent();

View File

@ -998,3 +998,11 @@ tbody.z-grid-empty-body td {
border-right: 5px dashed transparent;
border-bottom: 5px solid transparent;
}
.grid-combobox-editor {
width: 96% !important;
}
.grid-combobox-editor input {
width: 85% !important;
}