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);
gc.registerESCAction(aIgnore); // register Escape Key
// Set First Tab
if (wb == 0 && tab == 0)
{
m_curGC = gc;
Dimension size = gc.getPreferredSize(); // Screen Sizing
size.width += 4;
size.height += 4;
gc.setPreferredSize(size);
}
tabElement = gc;
// If we have a zoom query, switch to single row
if (tab == 0 && goSingleRow)
gc.switchSingleRow();
// FR [ 1757088 ]
GridField[] fields = gc.getMTab().getFields();
int m_tab_id = 0;
for(int f =0 ; f < fields.length ; f ++)
{
m_tab_id = fields[f].getIncluded_Tab_ID();
if ( m_tab_id != 0)
{
includedMap.put(m_tab_id, gc);
}
}
// Is this tab included?
if (includedMap.size() > 0)
{
GridController parent = (GridController)includedMap.get(new Integer(gTab.getAD_Tab_ID()));
if (parent != null)
{
// FR [ 1757088 ]
gc.removeDataStatusListener(this);
GridSynchronizer synchronizer = new GridSynchronizer(mWindow, parent, gc);
if (parent == m_curGC)
synchronizer.activateChild();
included = parent.includeTab(gc,this,synchronizer);
}
}
initSwitchLineAction();
} // normal tab
if (!included) // Add to TabbedPane
{
StringBuffer tabName = new StringBuffer ();
tabName.append ("<html>");
if (gTab.isReadOnly())
tabName.append("<i>");
int pos = gTab.getName ().indexOf (" ");
if (pos == -1)
tabName.append (gTab.getName ()).append ("<br> ");
else
{
tabName.append (gTab.getName().substring (0, pos))
.append ("<br>")
.append (gTab.getName().substring(pos + 1));
}
if (gTab.isReadOnly())
tabName.append("</i>");
tabName.append ("</html>");
// Add Tab - sets ALT-<number> and Shift-ALT-<x>
window.addTab (tabName.toString(), gTab, tabElement);
}