From 3927090247f1f195ea72bdcf3e478678ed4491d0 Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Fri, 14 May 2010 09:15:27 +0000 Subject: [PATCH] [ 3001520 ] GridPanel DisplayLogic issue Credits go to Low Heng Sin and Metas Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=3001520 --- .../org/adempiere/webui/component/GridPanel.java | 14 +++++++++++++- .../webui/component/GridTabRowRenderer.java | 14 ++++++++------ 2 files changed, 21 insertions(+), 7 deletions(-) diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridPanel.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridPanel.java index c3aff88489..b77bb39867 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridPanel.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridPanel.java @@ -12,6 +12,7 @@ *****************************************************************************/ package org.adempiere.webui.component; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -562,7 +563,16 @@ public class GridPanel extends Borderlayout implements EventListener // Selective if (col > 0) - return; + { + GridField changedField = gridTab.getField(col); + String columnName = changedField.getColumnName(); + ArrayList dependants = gridTab.getDependantFields(columnName); + if (dependants.size() == 0 && changedField.getCallout().length() > 0) + { + return; + } + } + boolean noData = gridTab.getRowCount() == 0; List list = renderer.getEditors(); @@ -581,6 +591,8 @@ public class GridPanel extends Borderlayout implements EventListener boolean rw = mField.isEditable(true); // r/w - check Context comp.setReadWrite(rw); } + + comp.setVisible(mField.isDisplayed(true)); } } // all components } diff --git a/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java b/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java index 2e4127e9e9..12e71f0210 100644 --- a/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java +++ b/zkwebui/WEB-INF/src/org/adempiere/webui/component/GridTabRowRenderer.java @@ -454,15 +454,11 @@ public class GridTabRowRenderer implements RowRenderer, RowRendererExt, Renderer continue; } colIndex ++; - - //check context - if (!gridField[i].isDisplayed(true)) { - continue; - } + if (editors.get(gridField[i]) == null) editors.put(gridField[i], WebEditorFactory.getEditor(gridField[i], true)); org.zkoss.zul.Column column = (org.zkoss.zul.Column) columns.getChildren().get(colIndex); - if (column.isVisible() && gridField[i].isEditable(true)) { + if (column.isVisible()) { Div div = (Div) currentRow.getChildren().get(colIndex); WEditor editor = getEditorCell(gridField[i], currentValues[i], i); div.appendChild(editor.getComponent()); @@ -474,6 +470,12 @@ public class GridTabRowRenderer implements RowRenderer, RowRendererExt, Renderer div.appendChild(popupMenu); } div.getFirstChild().setVisible(false); + //check context + if (!gridField[i].isDisplayed(true)) + { + editor.setVisible(false); + } + editor.setReadWrite(gridField[i].isEditable(true)); } } editing = true;