IDEMPIERE-924 Reloading find window set value from current record on advance tab instead of keeping selected value. Base on patch from Deepak.

This commit is contained in:
Heng Sin Low 2013-05-17 17:19:42 +08:00
parent 747470b2f1
commit c155937c9e
2 changed files with 17 additions and 16 deletions

View File

@ -1998,6 +1998,7 @@ public class GridField
field.m_vo = field.m_vo.clone(ctx, field.m_vo.WindowNo, field.m_vo.TabNo,
field.m_vo.AD_Window_ID, field.m_vo.AD_Tab_ID, field.m_vo.tabReadOnly);
field.m_vo.lookupInfo = null;
field.m_propertyChangeListeners = new PropertyChangeSupport(this);
return field;
} catch (CloneNotSupportedException e) {
throw new IllegalStateException(e.getLocalizedMessage(), e);

View File

@ -1600,45 +1600,45 @@ public class FindWindow extends Window implements EventListener<Event>, ValueCha
boolean enabled = !to || (to && between);
// Create Editor
GridField field = getTargetMField(columnName);
GridField field = getTargetMField(columnName);
if(field == null) return new Label("");
GridField findField = (GridField) field.clone(m_findCtx);
WEditor editor = null;
if (field.isKey()
|| (!DisplayType.isLookup(field.getDisplayType()) && DisplayType.isID(field.getDisplayType())))
if (findField.isKey()
|| (!DisplayType.isLookup(findField.getDisplayType()) && DisplayType.isID(findField.getDisplayType())))
{
editor = new WNumberEditor(field);
editor = new WNumberEditor(findField);
}
else if (field.getDisplayType() == DisplayType.Button)
else if (findField.getDisplayType() == DisplayType.Button)
{
if (columnName.endsWith("_ID"))
{
editor = new WNumberEditor(field);
editor = new WNumberEditor(findField);
} else {
editor = new WStringEditor(field);
editor = new WStringEditor(findField);
}
}
else
{
//reload lookupinfo for find window
if (DisplayType.isLookup(field.getDisplayType()) )
{
GridField findField = (GridField) field.clone(m_findCtx);
findField.loadLookupNoValidate();
if (DisplayType.isLookup(findField.getDisplayType()) )
{
findField.loadLookupNoValidate();
editor = WebEditorFactory.getEditor(findField, true);
findField.addPropertyChangeListener(editor);
}
else
{
editor = WebEditorFactory.getEditor(field, true);
field.addPropertyChangeListener(editor);
editor = WebEditorFactory.getEditor(findField, true);
findField.addPropertyChangeListener(editor);
}
}
if (editor == null)
{
editor = new WStringEditor(field);
field.addPropertyChangeListener(editor);
editor = new WStringEditor(findField);
findField.addPropertyChangeListener(editor);
}
editor.addValueChangeListener(this);