IDEMPIERE-1069 Callout doesn’t work the same way in quick entry window and normal AD window. / Peer review
This commit is contained in:
parent
bc61b7d56c
commit
577057b1ba
|
@ -2668,23 +2668,18 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
|
||||||
private void processDependencies (GridField changedField)
|
private void processDependencies (GridField changedField)
|
||||||
{
|
{
|
||||||
String columnName = changedField.getColumnName();
|
String columnName = changedField.getColumnName();
|
||||||
// log.trace(log.l4_Data, "Changed Column", columnName);
|
|
||||||
|
|
||||||
// when column name is not in list of DependentOn fields - fini
|
// when column name is not in list of DependentOn fields - fini
|
||||||
if (!hasDependants(columnName))
|
if (!hasDependants(columnName))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Get dependent MFields (may be because of display or dynamic lookup)
|
// Get dependent MFields (may be because of display or dynamic lookup)
|
||||||
ArrayList<GridField> list = getDependantFields(columnName);
|
for (GridField dependentField : getDependantFields(columnName))
|
||||||
for (int i = 0; i < list.size(); i++)
|
|
||||||
{
|
{
|
||||||
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 the field has a lookup
|
||||||
if (dependentField != null && dependentField.getLookup() instanceof MLookup)
|
if (dependentField != null && dependentField.getLookup() instanceof MLookup)
|
||||||
{
|
{
|
||||||
MLookup mLookup = (MLookup)dependentField.getLookup();
|
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 the lookup is dynamic (i.e. contains this columnName as variable)
|
||||||
if (mLookup.getValidation().indexOf("@"+columnName+"@") != -1)
|
if (mLookup.getValidation().indexOf("@"+columnName+"@") != -1)
|
||||||
{
|
{
|
||||||
|
|
|
@ -676,7 +676,7 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
||||||
{
|
{
|
||||||
GridField changedField = gridTab.getField(col);
|
GridField changedField = gridTab.getField(col);
|
||||||
String columnName = changedField.getColumnName();
|
String columnName = changedField.getColumnName();
|
||||||
ArrayList<?> dependants = gridTab.getDependantFields(columnName);
|
ArrayList<GridField> dependants = gridTab.getDependantFields(columnName);
|
||||||
if (logger.isLoggable(Level.CONFIG)) logger.config("(" + gridTab.toString() + ") "
|
if (logger.isLoggable(Level.CONFIG)) logger.config("(" + gridTab.toString() + ") "
|
||||||
+ columnName + " - Dependents=" + dependants.size());
|
+ columnName + " - Dependents=" + dependants.size());
|
||||||
if ( ! ( dependants.size() > 0
|
if ( ! ( dependants.size() > 0
|
||||||
|
@ -1144,11 +1144,8 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh the list on dependant fields
|
// Refresh the list on dependant fields
|
||||||
ArrayList<GridField> list = gridTab.getDependantFields(mField.getColumnName());
|
for (GridField dependentField : gridTab.getDependantFields(mField.getColumnName()))
|
||||||
for (int i = 0; i < list.size(); i++)
|
|
||||||
{
|
{
|
||||||
GridField dependentField = list.get(i);
|
|
||||||
// log.trace(log.l5_DData, "Dependent Field", dependentField==null ? "null" : dependentField.getColumnName());
|
|
||||||
// if the field has a lookup
|
// if the field has a lookup
|
||||||
if (dependentField != null && dependentField.getLookup() instanceof MLookup)
|
if (dependentField != null && dependentField.getLookup() instanceof MLookup)
|
||||||
{
|
{
|
||||||
|
|
|
@ -18,6 +18,7 @@ import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.adempiere.base.Core;
|
||||||
import org.adempiere.webui.component.ConfirmPanel;
|
import org.adempiere.webui.component.ConfirmPanel;
|
||||||
import org.adempiere.webui.component.Label;
|
import org.adempiere.webui.component.Label;
|
||||||
import org.adempiere.webui.component.Window;
|
import org.adempiere.webui.component.Window;
|
||||||
|
@ -31,6 +32,7 @@ import org.compiere.model.GridField;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
import org.compiere.model.GridWindow;
|
import org.compiere.model.GridWindow;
|
||||||
import org.compiere.model.MField;
|
import org.compiere.model.MField;
|
||||||
|
import org.compiere.model.MLookup;
|
||||||
import org.compiere.model.MQuery;
|
import org.compiere.model.MQuery;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
|
@ -60,7 +62,7 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -4121297375382998263L;
|
private static final long serialVersionUID = -949213040088881469L;
|
||||||
|
|
||||||
public static final String QUICK_ENTRY_MODE = "_QUICK_ENTRY_MODE_";
|
public static final String QUICK_ENTRY_MODE = "_QUICK_ENTRY_MODE_";
|
||||||
|
|
||||||
|
@ -282,6 +284,7 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
|
||||||
}
|
}
|
||||||
initialValues.add(editor.getValue());
|
initialValues.add(editor.getValue());
|
||||||
}
|
}
|
||||||
|
dynamicDisplay();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -303,6 +306,7 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
|
||||||
initialValues.add(editor.getValue());
|
initialValues.add(editor.getValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dynamicDisplay();
|
||||||
return true;
|
return true;
|
||||||
} // loadRecord
|
} // loadRecord
|
||||||
|
|
||||||
|
@ -458,26 +462,47 @@ public class WQuickEntry extends Window implements EventListener<Event>, ValueCh
|
||||||
int idx = quickEditors.indexOf(evt.getSource());
|
int idx = quickEditors.indexOf(evt.getSource());
|
||||||
if (idx >= 0) {
|
if (idx >= 0) {
|
||||||
GridField field = quickFields.get(idx);
|
GridField field = quickFields.get(idx);
|
||||||
|
GridTab gridTab = field.getGridTab();
|
||||||
|
String columnName = field.getColumnName();
|
||||||
// process dependencies and callouts for the changed field
|
// process dependencies and callouts for the changed field
|
||||||
field.getGridTab().setValue(field, evt.getNewValue());
|
field.setValue(evt.getNewValue(), false);
|
||||||
field.getGridTab().processFieldChange(field);
|
gridTab.processFieldChange(field);
|
||||||
if (!field.getCallout().isEmpty()) {
|
// Refresh the list on dependant fields
|
||||||
refresh();
|
ArrayList<GridField> 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
|
* refresh all fields
|
||||||
*/
|
*/
|
||||||
public void refresh()
|
public void dynamicDisplay()
|
||||||
{
|
{
|
||||||
for (int idxf = 0; idxf < quickFields.size(); idxf++) {
|
for (int idxf = 0; idxf < quickFields.size(); idxf++) {
|
||||||
GridField field = quickFields.get(idxf);
|
GridField field = quickFields.get(idxf);
|
||||||
WEditor editor = quickEditors.get(idxf);
|
WEditor editor = quickEditors.get(idxf);
|
||||||
editor.setValue(field.getValue());
|
editor.setValue(field.getValue());
|
||||||
|
editor.setReadWrite(field.isEditable(true));
|
||||||
|
editor.setVisible(field.isDisplayed(true));
|
||||||
}
|
}
|
||||||
}//refresh
|
} // dynamicDisplay
|
||||||
|
|
||||||
} // WQuickEntry
|
} // WQuickEntry
|
||||||
|
|
Loading…
Reference in New Issue