diff --git a/org.adempiere.base/src/org/compiere/model/GridTab.java b/org.adempiere.base/src/org/compiere/model/GridTab.java index da93807ec8..6e8122bc03 100644 --- a/org.adempiere.base/src/org/compiere/model/GridTab.java +++ b/org.adempiere.base/src/org/compiere/model/GridTab.java @@ -2668,23 +2668,18 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable private void processDependencies (GridField changedField) { String columnName = changedField.getColumnName(); - // log.trace(log.l4_Data, "Changed Column", columnName); // when column name is not in list of DependentOn fields - fini if (!hasDependants(columnName)) return; // Get dependent MFields (may be because of display or dynamic lookup) - ArrayList list = getDependantFields(columnName); - for (int i = 0; i < list.size(); i++) + for (GridField dependentField : getDependantFields(columnName)) { - GridField dependentField = (GridField)list.get(i); - // log.trace(log.l5_DData, "Dependent Field", dependentField==null ? "null" : dependentField.getColumnName()); // if the field has a lookup if (dependentField != null && dependentField.getLookup() instanceof MLookup) { MLookup mLookup = (MLookup)dependentField.getLookup(); - // log.trace(log.l6_Database, "Lookup Validation", mLookup.getValidation()); // if the lookup is dynamic (i.e. contains this columnName as variable) if (mLookup.getValidation().indexOf("@"+columnName+"@") != -1) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java index 3c2be622ef..2436d63623 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/adwindow/ADTabpanel.java @@ -676,7 +676,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer { GridField changedField = gridTab.getField(col); String columnName = changedField.getColumnName(); - ArrayList dependants = gridTab.getDependantFields(columnName); + ArrayList dependants = gridTab.getDependantFields(columnName); if (logger.isLoggable(Level.CONFIG)) logger.config("(" + gridTab.toString() + ") " + columnName + " - Dependents=" + dependants.size()); if ( ! ( dependants.size() > 0 @@ -1144,11 +1144,8 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer } // Refresh the list on dependant fields - ArrayList list = gridTab.getDependantFields(mField.getColumnName()); - for (int i = 0; i < list.size(); i++) + for (GridField dependentField : gridTab.getDependantFields(mField.getColumnName())) { - GridField dependentField = list.get(i); - // log.trace(log.l5_DData, "Dependent Field", dependentField==null ? "null" : dependentField.getColumnName()); // if the field has a lookup if (dependentField != null && dependentField.getLookup() instanceof MLookup) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java index b0c39aae22..f4e3a8e665 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/grid/WQuickEntry.java @@ -18,6 +18,7 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Level; +import org.adempiere.base.Core; import org.adempiere.webui.component.ConfirmPanel; import org.adempiere.webui.component.Label; import org.adempiere.webui.component.Window; @@ -31,6 +32,7 @@ import org.compiere.model.GridField; import org.compiere.model.GridTab; import org.compiere.model.GridWindow; import org.compiere.model.MField; +import org.compiere.model.MLookup; import org.compiere.model.MQuery; import org.compiere.model.MRole; import org.compiere.model.MTable; @@ -60,7 +62,7 @@ public class WQuickEntry extends Window implements EventListener, ValueCh /** * */ - private static final long serialVersionUID = -4121297375382998263L; + private static final long serialVersionUID = -949213040088881469L; public static final String QUICK_ENTRY_MODE = "_QUICK_ENTRY_MODE_"; @@ -282,6 +284,7 @@ public class WQuickEntry extends Window implements EventListener, ValueCh } initialValues.add(editor.getValue()); } + dynamicDisplay(); return true; } @@ -303,6 +306,7 @@ public class WQuickEntry extends Window implements EventListener, ValueCh initialValues.add(editor.getValue()); } + dynamicDisplay(); return true; } // loadRecord @@ -458,26 +462,47 @@ public class WQuickEntry extends Window implements EventListener, ValueCh int idx = quickEditors.indexOf(evt.getSource()); if (idx >= 0) { GridField field = quickFields.get(idx); + GridTab gridTab = field.getGridTab(); + String columnName = field.getColumnName(); // process dependencies and callouts for the changed field - field.getGridTab().setValue(field, evt.getNewValue()); - field.getGridTab().processFieldChange(field); - if (!field.getCallout().isEmpty()) { - refresh(); - } + field.setValue(evt.getNewValue(), false); + gridTab.processFieldChange(field); + // Refresh the list on dependant fields + ArrayList dependants = gridTab.getDependantFields(columnName); + for (GridField dependentField : dependants) + { + // if the field has a lookup + if (dependentField != null && dependentField.getLookup() instanceof MLookup) + { + MLookup mLookup = (MLookup)dependentField.getLookup(); + // if the lookup is dynamic (i.e. contains this columnName as variable) + if (mLookup.getValidation().indexOf("@"+columnName+"@") != -1) + { + mLookup.refresh(); + } + } + } // for all dependent fields + if ( dependants.size() > 0 + || field.getCallout().length() > 0 + || Core.findCallout(gridTab.getTableName(), columnName).size() > 0) { + dynamicDisplay(); + } } } } - + /** * refresh all fields */ - public void refresh() + public void dynamicDisplay() { for (int idxf = 0; idxf < quickFields.size(); idxf++) { GridField field = quickFields.get(idxf); WEditor editor = quickEditors.get(idxf); editor.setValue(field.getValue()); + editor.setReadWrite(field.isEditable(true)); + editor.setVisible(field.isDisplayed(true)); } - }//refresh + } // dynamicDisplay } // WQuickEntry