IDEMPIERE-2935 New record on GridMode error on fields with DisplayLogic / minor defensive programming refactor

This commit is contained in:
Carlos Ruiz 2015-11-11 09:54:24 -05:00
parent 641d918ebb
commit 7687494731
1 changed files with 15 additions and 17 deletions

View File

@ -172,23 +172,21 @@ public class GridTabDataBinder implements ValueChangeListener {
//Checks if the change in a field modifies the display logic in the dependant fields //Checks if the change in a field modifies the display logic in the dependant fields
Object source = e.getSource(); Object source = e.getSource();
if (source != null && source instanceof WEditor) {
WEditor editor = (WEditor) source; WEditor editor = (WEditor) source;
if( editor != null ){
ArrayList<GridField> dependants = gridTab.getDependantFields(editor.getColumnName()); ArrayList<GridField> dependants = gridTab.getDependantFields(editor.getColumnName());
if (dependants != null
if ( dependants != null && !dependants.isEmpty() ) && !dependants.isEmpty()
if( editor.getComponent() != null ) //Editor && editor.getComponent() != null //Editor
if( editor.getComponent().getParent() != null) //Cell && editor.getComponent().getParent() != null //Cell
if( editor.getComponent().getParent().getParent() != null ) //Row && editor.getComponent().getParent().getParent() != null //Row
if( editor.getComponent().getParent().getParent().getParent() != null ) //Rows && editor.getComponent().getParent().getParent().getParent() != null //Rows
if( editor.getComponent().getParent().getParent().getParent().getParent() != null ){ //Grid && editor.getComponent().getParent().getParent().getParent().getParent() != null //Grid
&& editor.getComponent().getParent().getParent().getParent().getParent() instanceof Grid) {
Grid listBox = (Grid) editor.getComponent().getParent().getParent().getParent().getParent(); Grid listBox = (Grid) editor.getComponent().getParent().getParent().getParent().getParent();
RowRenderer<Object[]> renderer = listBox.getRowRenderer(); RowRenderer<Object[]> renderer = listBox.getRowRenderer();
GridTabRowRenderer gtr = (GridTabRowRenderer)renderer; GridTabRowRenderer gtr = (GridTabRowRenderer)renderer;
gtr.checkDependants(dependants); gtr.checkDependants(dependants);
} }
} }