if (workWithTabs == 1) {
/* get an instance of the borderlayout defined in the zul-file */
Borderlayout bl = (Borderlayout) Path.getComponent("/outerIndexWindow/borderlayoutMain");
/* get an instance of the searched CENTER layout area */
Center center = bl.getCenter();
// get the tabs component
Tabs tabs = (Tabs) center.getFellow("divCenter").getFellow("tabBoxIndexCenter").getFellow("tabsIndexCenter");
/**
* Check if the tab is already opened than select them and<br>
* go out of here. If not than create them.<br>
*/
Tab checkTab = null;
try {
// checkTab = (Tab) tabs.getFellow(tabName);
checkTab = (Tab) tabs.getFellow("tab_" + tabName.trim());
checkTab.setSelected(true);
} catch (final ComponentNotFoundException ex) {
// Ignore if can not get tab.
}
if (checkTab == null) {
Tab tab = new Tab();
tab.setId("tab_" + tabName.trim());
tab.setLabel(tabName.trim());
tab.setClosable(true);
tab.setParent(tabs);
Tabpanels tabpanels = (Tabpanels) center.getFellow("divCenter").getFellow("tabBoxIndexCenter").getFellow("tabsIndexCenter").getFellow("tabpanelsBoxIndexCenter");
Tabpanel tabpanel = new Tabpanel();
tabpanel.setHeight("100%");
tabpanel.setStyle("padding: 0px;");
tabpanel.setParent(tabpanels);
/**
* Create the page and put it in the tabs area. If zul-file
* is not found, detach the created tab
*/
try {
Executions.createComponents(zulFilePathName, tabpanel, null);
tab.setSelected(true);
} catch (final Exception e) {
tab.detach();
}
}
} else {
/* get an instance of the borderlayout defined in the zul-file */
Borderlayout bl = (Borderlayout) Path.getComponent("/outerIndexWindow/borderlayoutMain");
/* get an instance of the searched CENTER layout area */
Center center = bl.getCenter();
/* clear the center child comps */
center.getChildren().clear();
/**
* create the page and put it in the center layout area
*/
Executions.createComponents(zulFilePathName, center, null);
}