IDEMPIERE-877 Zk: Remove unnecessary refresh from WTableDirEditor

This commit is contained in:
Heng Sin Low 2013-04-25 15:35:07 +08:00
parent faae2ab46e
commit 759583ebb0
2 changed files with 21 additions and 7 deletions

View File

@ -542,8 +542,14 @@ public final class MLookup extends Lookup implements Serializable
if (cacheLocal && !saveInCache && directValue != null) if (cacheLocal && !saveInCache && directValue != null)
{ {
if (m_lookupDirect == null) if (m_lookupDirect == null)
{
m_lookupDirect = new HashMap<Object,Object>(); m_lookupDirect = new HashMap<Object,Object>();
m_lookupDirect.put(key, directValue); }
else if (!m_lookupDirect.containsKey(key))
{
m_lookupDirect.clear();
m_lookupDirect.put(key, directValue);
}
} }
m_hasInactive = true; m_hasInactive = true;
return directValue; return directValue;

View File

@ -167,7 +167,8 @@ ContextMenuListener, IZoomableEditor
//no need to refresh readonly lookup //no need to refresh readonly lookup
if (isReadWrite()) if (isReadWrite())
lookup.refresh(); lookup.refresh();
refreshList(); else
refreshList();
} }
if (gridField != null) if (gridField != null)
@ -265,11 +266,17 @@ ContextMenuListener, IZoomableEditor
getComponent().setValue(value); getComponent().setValue(value);
if (!getComponent().isSelected(value)) if (!getComponent().isSelected(value))
{ {
if (isReadWrite() && lookup != null)
lookup.refresh();
Object curValue = oldValue; Object curValue = oldValue;
oldValue = value; oldValue = value;
refreshList();
if (isReadWrite() && lookup != null)
{
lookup.refresh();
}
else
{
refreshList();
}
//still not in list, reset to zero //still not in list, reset to zero
if (!getComponent().isSelected(value)) if (!getComponent().isSelected(value))
@ -349,7 +356,7 @@ ContextMenuListener, IZoomableEditor
} }
if (!found && oldValue != null) if (!found && oldValue != null)
{ {
NamePair pair = lookup.getDirect(oldValue, false, false); NamePair pair = lookup.getDirect(oldValue, false, true);
if (pair != null) { if (pair != null) {
if (pair instanceof KeyNamePair) { if (pair instanceof KeyNamePair) {
int key = ((KeyNamePair)pair).getKey(); int key = ((KeyNamePair)pair).getKey();
@ -449,7 +456,8 @@ ContextMenuListener, IZoomableEditor
if (isReadWrite()) if (isReadWrite())
lookup.refresh(); lookup.refresh();
refreshList(); else
refreshList();
if (curValue != null) if (curValue != null)
{ {
setValue(curValue); setValue(curValue);