* Ensure m_lookup and p_data is in sync after refresh.

This commit is contained in:
Heng Sin Low 2007-06-11 23:59:32 +00:00
parent 3be5e7907b
commit 967c7fc1ab
1 changed files with 27 additions and 8 deletions

View File

@ -339,7 +339,7 @@ public final class MLookup extends Lookup implements Serializable
// Never Loaded (correctly) // Never Loaded (correctly)
if (!m_allLoaded || m_lookup.size() == 0) if (!m_allLoaded || m_lookup.size() == 0)
refresh (loadParent); loadData (loadParent);
// already validation included // already validation included
//if (m_info.IsValidated) //if (m_info.IsValidated)
@ -350,7 +350,7 @@ public final class MLookup extends Lookup implements Serializable
//if (!m_info.IsValidated && onlyValidated) //if (!m_info.IsValidated && onlyValidated)
if (!validated && onlyValidated) if (!validated && onlyValidated)
{ {
refresh (loadParent); loadData (loadParent);
log.fine(m_info.KeyColumn + ": Validated - #" + m_lookup.size()); log.fine(m_info.KeyColumn + ": Validated - #" + m_lookup.size());
} }
@ -556,17 +556,36 @@ public final class MLookup extends Lookup implements Serializable
if (m_info.DisplayType == DisplayType.Search if (m_info.DisplayType == DisplayType.Search
|| m_info.IsCreadedUpdatedBy) || m_info.IsCreadedUpdatedBy)
return 0; return 0;
log.fine(m_info.KeyColumn + ": start");
m_refreshing = true; m_refreshing = true;
m_loader = new MLoader(); fillComboBox(isMandatory(), true, true, false);
m_loader.start();
// m_loader.run(); // test sync call
loadComplete();
log.fine(m_info.KeyColumn + ": #" + m_lookup.size());
m_refreshing = false; m_refreshing = false;
return m_lookup.size(); return m_lookup.size();
} // refresh } // refresh
/**
* Do the actual loading from database
* @param loadParent
* @return number of records loaded
*/
private int loadData(boolean loadParent)
{
if (!loadParent && m_info.IsParent)
return 0;
// Don't load Search or CreatedBy/UpdatedBy
if (m_info.DisplayType == DisplayType.Search
|| m_info.IsCreadedUpdatedBy)
return 0;
log.fine(m_info.KeyColumn + ": start");
m_loader = new MLoader();
m_loader.start();
loadComplete();
log.fine(m_info.KeyColumn + ": #" + m_lookup.size());
return m_lookup.size();
} // refresh
/** /**
* Remove All cached Elements * Remove All cached Elements
* @see org.compiere.model.Lookup#removeAllElements() * @see org.compiere.model.Lookup#removeAllElements()