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 = 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.AD_Window_ID, field.m_vo.AD_Tab_ID, field.m_vo.tabReadOnly);
field.m_vo.lookupInfo = null; field.m_vo.lookupInfo = null;
field.m_propertyChangeListeners = new PropertyChangeSupport(this);
return field; return field;
} catch (CloneNotSupportedException e) { } catch (CloneNotSupportedException e) {
throw new IllegalStateException(e.getLocalizedMessage(), 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); boolean enabled = !to || (to && between);
// Create Editor // Create Editor
GridField field = getTargetMField(columnName); GridField field = getTargetMField(columnName);
if(field == null) return new Label(""); if(field == null) return new Label("");
GridField findField = (GridField) field.clone(m_findCtx);
WEditor editor = null; WEditor editor = null;
if (field.isKey() if (findField.isKey()
|| (!DisplayType.isLookup(field.getDisplayType()) && DisplayType.isID(field.getDisplayType()))) || (!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")) if (columnName.endsWith("_ID"))
{ {
editor = new WNumberEditor(field); editor = new WNumberEditor(findField);
} else { } else {
editor = new WStringEditor(field); editor = new WStringEditor(findField);
} }
} }
else else
{ {
//reload lookupinfo for find window //reload lookupinfo for find window
if (DisplayType.isLookup(field.getDisplayType()) ) if (DisplayType.isLookup(findField.getDisplayType()) )
{ {
GridField findField = (GridField) field.clone(m_findCtx); findField.loadLookupNoValidate();
findField.loadLookupNoValidate();
editor = WebEditorFactory.getEditor(findField, true); editor = WebEditorFactory.getEditor(findField, true);
findField.addPropertyChangeListener(editor); findField.addPropertyChangeListener(editor);
} }
else else
{ {
editor = WebEditorFactory.getEditor(field, true); editor = WebEditorFactory.getEditor(findField, true);
field.addPropertyChangeListener(editor); findField.addPropertyChangeListener(editor);
} }
} }
if (editor == null) if (editor == null)
{ {
editor = new WStringEditor(field); editor = new WStringEditor(findField);
field.addPropertyChangeListener(editor); findField.addPropertyChangeListener(editor);
} }
editor.addValueChangeListener(this); editor.addValueChangeListener(this);