[ 3001520 ] GridPanel DisplayLogic issue

Credits go to Low Heng Sin and Metas

Link to SF Tracker: http://sourceforge.net/support/tracker.php?aid=3001520
This commit is contained in:
teo_sarca 2010-05-14 09:15:27 +00:00
parent 6eea0a82fe
commit 3927090247
2 changed files with 21 additions and 7 deletions

View File

@ -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<WEditor> 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
}

View File

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