final int workWithTabs = 1;
if (workWithTabs == 1) {
/* get an instance of the borderlayout defined in the zul-file */
final Borderlayout bl = (Borderlayout) Path.getComponent("/outerIndexWindow/borderlayoutMain");
/* get an instance of the searched CENTER layout area */
final Center center = bl.getCenter();
// get the tabs component
final 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_" + tabID.trim());
checkTab.setSelected(true);
} catch (final ComponentNotFoundException ex) {
// Ignore if can not get tab.
}
if (checkTab == null) {
final Tab tab = new Tab();
tab.setId("tab_" + tabID.trim());
if (tabLabel != null) {
tab.setLabel(tabLabel.trim());
} else {
tab.setLabel(tabLabel.trim());
}
tab.setClosable(true);
tab.setParent(tabs);
final Tabpanels tabpanels = (Tabpanels) center.getFellow("divCenter").getFellow("tabBoxIndexCenter").getFellow("tabsIndexCenter")
.getFellow("tabpanelsBoxIndexCenter");
final Tabpanel tabpanel = new Tabpanel();
tabpanel.setHeight("100%");
tabpanel.setStyle("padding: 0px;");
tabpanel.setParent(tabpanels);
/*
* create the page and put it in the tabs area
*/
Executions.createComponents(zulFilePathName, tabpanel, null);
tab.setSelected(true);
}
} else {
/* get an instance of the borderlayout defined in the zul-file */
final Borderlayout bl = (Borderlayout) Path.getComponent("/outerIndexWindow/borderlayoutMain");
/* get an instance of the searched CENTER layout area */
final Center center = bl.getCenter();
/* clear old center child comps */
center.getChildren().clear();
/*
* create the page and put it in the center layout area
*/