if (wVO == null)
{
ADialog.error(0, null, "AccessTableNoView", "(No Window Model Info)");
return false;
}
GridWindow mWindow = new GridWindow (wVO); // Timing: ca. 0.3-1 sec
// Set SO/AutoNew for Window
Env.setContext(m_ctx, m_curWindowNo, "IsSOTrx", mWindow.isSOTrx());
if (!autoNew && mWindow.isTransaction())
Env.setAutoNew(m_ctx, m_curWindowNo, true);
m_mWorkbench.setMWindow(wb, mWindow);
if (wb == 0)
m_onlyCurrentRows = mWindow.isTransaction(); // default = only current
if (windowSize == null)
windowSize = mWindow.getWindowSize();
/**
* Window Tabs
*/
int tabSize = mWindow.getTabCount();
boolean goSingleRow = query != null; // Zoom Query
for (int tab = 0; tab < tabSize; tab++)
{
boolean included = false;
// MTab
if (tab == 0) mWindow.initTab(0);
GridTab gTab = mWindow.getTab(tab);
Env.setContext(m_ctx, m_curWindowNo, tab, GridTab.CTX_TabLevel, Integer.toString(gTab.getTabLevel()));
// Query first tab
if (tab == 0)
{
// initial user query for single workbench tab
if (m_mWorkbench.getWindowCount() == 1)
{
isCancel = false; //Goodwill
query = initialQuery (query, gTab);
if (isCancel) return false; //Cancel opening window
if (query != null && query.getRecordCount() <= 1)
goSingleRow = true;
}
else if (wb != 0)
// workbench dynamic query for dependent windows
{
query = m_mWorkbench.getQuery();
}
// Set initial Query on first tab
if (query != null)
{
m_onlyCurrentRows = false; // Query might involve history
gTab.setQuery(query);
}
if (wb == 0)
m_curTab = gTab;
} // query on first tab
Component tabElement = null;
// GridController
if (gTab.isSortTab())
{
VSortTab st = new VSortTab(m_curWindowNo, gTab.getAD_Table_ID(),
gTab.getAD_ColumnSortOrder_ID(), gTab.getAD_ColumnSortYesNo_ID());
st.setTabLevel(gTab.getTabLevel());
tabElement = st;
}
else // normal tab
{
GridController gc = new GridController(); // Timing: ca. .1 sec
CompiereColor cc = mWindow.getColor();
if (cc != null)
gc.setBackgroundColor(cc); // set color on Window level
gc.initGrid(gTab, false, m_curWindowNo, this, mWindow, (tab != 0)); // will set color on Tab level
// Timing: ca. 6-7 sec for first .2 for next
gc.addDataStatusListener(this);