* [ 1661548 ] WAN: tab loading should be improved

- Improve loading of field meta data for wan profile
- Added optional background loading of field meta data ( default to off )
This commit is contained in:
Heng Sin Low 2007-02-20 13:40:47 +00:00
parent 2483cb5a4b
commit 1f6d8cbd0d
2 changed files with 37 additions and 17 deletions

View File

@ -67,15 +67,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
m_mTable.setReadOnly(m_vo.IsReadOnly || m_vo.IsView); m_mTable.setReadOnly(m_vo.IsReadOnly || m_vo.IsView);
m_mTable.setDeleteable(m_vo.IsDeleteable); m_mTable.setDeleteable(m_vo.IsDeleteable);
// Load Tab // Load Tab
// if (vo.TabNo == 0) //initTab(false);
//initTab(false);
// else
// {
// m_loader = new Loader();
// m_loader.setPriority(Thread.MIN_PRIORITY);
// m_loader.start();
// }
// waitLoadCompete();
} // GridTab } // GridTab
/** Value Object */ /** Value Object */
@ -141,7 +133,7 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
*/ */
public void run() public void run()
{ {
initTab (true); loadTab();
} // run } // run
} // Loader } // Loader
@ -179,12 +171,34 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
* @param async async * @param async async
* @return true, if correctly initialized (ignored) * @return true, if correctly initialized (ignored)
*/ */
protected boolean initTab (boolean async) public boolean initTab (boolean async)
{ {
log.fine("#" + m_vo.TabNo + " - Async=" + async + " - Where=" + m_vo.WhereClause); log.fine("#" + m_vo.TabNo + " - Async=" + async + " - Where=" + m_vo.WhereClause);
if (isLoadComplete()) return true;
if (m_loader != null && m_loader.isAlive())
{
waitLoadCompete();
if (isLoadComplete())
return true;
}
if (async)
{
m_loader = new Loader();
m_loader.start();
return false;
}
else
{
return loadTab();
}
} // initTab
protected boolean loadTab()
{
m_extendedWhere = m_vo.WhereClause; m_extendedWhere = m_vo.WhereClause;
// Get Field Data // Get Field Data
if (!loadFields()) if (!loadFields())
{ {
@ -195,12 +209,10 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
// Order By // Order By
m_mTable.setOrderClause(getOrderByClause(m_vo.onlyCurrentRows)); m_mTable.setOrderClause(getOrderByClause(m_vo.onlyCurrentRows));
if (async)
log.fine("#" + m_vo.TabNo + " - Async=" + async + " - fini");
m_loadComplete = true; m_loadComplete = true;
return true; return true;
} // initTab }
/** /**
* Dispose - clean up resources * Dispose - clean up resources
*/ */
@ -227,6 +239,11 @@ public class GridTab implements DataStatusListener, Evaluatee, Serializable
m_vo.getFields().clear(); m_vo.getFields().clear();
//m_vo.Fields = null; //m_vo.Fields = null;
m_vo = null; m_vo = null;
if (m_loader != null)
{
if (m_loader.isAlive()) m_loader.interrupt();
m_loader = null;
}
} // dispose } // dispose

View File

@ -73,6 +73,8 @@ public class GridWindow implements Serializable
/** Model last updated */ /** Model last updated */
private Timestamp m_modelUpdated = null; private Timestamp m_modelUpdated = null;
private Set initTabs = new HashSet<GridTab>();
/** Logger */ /** Logger */
private static CLogger log = CLogger.getCLogger(GridWindow.class); private static CLogger log = CLogger.getCLogger(GridWindow.class);
@ -129,7 +131,7 @@ public class GridWindow implements Serializable
public void initTab(int index) public void initTab(int index)
{ {
GridTab mTab = m_tabs.get(index); GridTab mTab = m_tabs.get(index);
if (mTab.isLoadComplete()) return; if (initTabs.contains(mTab)) return;
mTab.initTab(false); mTab.initTab(false);
// Set Link Column // Set Link Column
@ -175,6 +177,7 @@ public class GridWindow implements Serializable
} // set Link column } // set Link column
mTab.setLinkColumnName(null); // overwrites, if AD_Column_ID exists mTab.setLinkColumnName(null); // overwrites, if AD_Column_ID exists
// //
initTabs.add(mTab);
} }
/** /**