use of org.adempiere.webui.component.Tabpanel in project adempiere by adempiere.
the class TabbedDesktop method closeWindow.
/**
*
* @param windowNo
* @return boolean
*/
public boolean closeWindow(int windowNo) {
Tabbox tabbox = windowContainer.getComponent();
Tabpanels panels = tabbox.getTabpanels();
List<?> childrens = panels.getChildren();
for (Object child : childrens) {
Tabpanel panel = (Tabpanel) child;
Component component = panel.getFirstChild();
Object att = component.getAttribute(WINDOWNO_ATTRIBUTE);
if (att != null && (att instanceof Integer)) {
if (windowNo == (Integer) att) {
Tab tab = panel.getLinkedTab();
panel.getLinkedTab().onClose();
if (tab.getParent() == null) {
unregisterWindow(windowNo);
return true;
} else {
return false;
}
}
}
}
return false;
}
use of org.adempiere.webui.component.Tabpanel in project adempiere by adempiere.
the class WindowContainer method insertBefore.
/**
*
* @param refTab
* @param comp
* @param title
* @param closeable
* @param enable
*/
public void insertBefore(Tab refTab, Component comp, String title, boolean closeable, boolean enable) {
Tab tab = new Tab();
title = title.replaceAll("[&]", "");
if (title.length() <= MAX_TITLE_LENGTH) {
tab.setLabel(title);
} else {
tab.setTooltiptext(title);
title = title.substring(0, 27) + "...";
tab.setLabel(title);
}
tab.setClosable(closeable);
// fix scroll position lost coming back into a grid view tab
tab.addEventListener(Events.ON_SELECT, new EventListener<Event>() {
public void onEvent(Event event) throws Exception {
Tab tab = (Tab) event.getTarget();
org.zkoss.zul.Tabpanel panel = tab.getLinkedPanel();
Component component = panel.getFirstChild();
if (component != null && component.getAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY) instanceof ITabOnSelectHandler) {
ITabOnSelectHandler handler = (ITabOnSelectHandler) component.getAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY);
handler.onSelect();
}
}
});
Tabpanel tabpanel = null;
if (comp instanceof Tabpanel) {
tabpanel = (Tabpanel) comp;
} else {
tabpanel = new Tabpanel();
tabpanel.appendChild(comp);
}
tabpanel.setZclass("desktop-tabpanel");
tabpanel.setHeight("100%");
tabpanel.setWidth("100%");
tabpanel.setStyle("position: relative;");
if (refTab == null) {
tabbox.getTabs().appendChild(tab);
tabbox.getTabpanels().appendChild(tabpanel);
} else {
org.zkoss.zul.Tabpanel refpanel = refTab.getLinkedPanel();
tabbox.getTabs().insertBefore(tab, refTab);
tabbox.getTabpanels().insertBefore(tabpanel, refpanel);
}
if (enable)
setSelectedTab(tab);
}
use of org.adempiere.webui.component.Tabpanel in project adempiere by adempiere.
the class MultiTabPart method addTab.
public void addTab(Component comp, String title, boolean closeable, boolean enable) {
Tab tab = new Tab();
tab.setLabel(title);
tab.setClosable(closeable);
Tabpanel tabpanel = null;
if (comp instanceof Tabpanel) {
tabpanel = (Tabpanel) comp;
} else {
tabpanel = new Tabpanel();
tabpanel.appendChild(comp);
}
tabbox.getTabs().appendChild(tab);
tabbox.getTabpanels().appendChild(tabpanel);
if (enable)
setSelectedTab(tab);
}
Aggregations