use of org.adempiere.webui.component.IADTab in project adempiere by adempiere.
the class ADWindowPanel method doCreatePart.
protected Component doCreatePart(Component parent) {
layout = new Borderlayout();
if (parent != null) {
layout.setParent(parent);
layout.setStyle("position:absolute");
layout.setHeight("100%");
layout.setWidth("100%");
} else {
layout.setPage(page);
}
if (!isEmbedded()) {
North n = new North();
n.setParent(layout);
n.setCollapsible(false);
n.setFlex(true);
Vbox box = new Vbox();
box.setWidth("100%");
toolbar.setParent(box);
box.setParent(n);
toolbar.setWindowNo(getWindowNo());
// FR [ 588 ]
South s = new South();
layout.appendChild(s);
s.setCollapsible(false);
statusBar.setParent(s);
} else {
South s = new South();
layout.appendChild(s);
s.setCollapsible(false);
statusBar.setParent(s);
}
LayoutUtils.addSclass("adwindow-status", statusBar);
if (!isEmbedded() && adTab.isUseExternalSelection()) {
String tabPlacement = SessionManager.getSessionApplication().getUserPreference().getProperty(UserPreference.P_WINDOW_TAB_PLACEMENT);
if (tabPlacement == null || "left".equalsIgnoreCase(tabPlacement)) {
west = new West();
layout.appendChild(west);
west.setSplittable(false);
west.setAutoscroll(true);
west.setFlex(true);
LayoutUtils.addSclass("adwindow-nav adwindow-left-nav", west);
adTab.setTabplacement(IADTab.LEFT);
adTab.getTabSelectionComponent().setParent(west);
if (SessionManager.getSessionApplication().getUserPreference().isPropertyBool(UserPreference.P_WINDOW_TAB_COLLAPSIBLE)) {
west.setTitle(Msg.getElement(Env.getCtx(), "AD_Tab_ID"));
west.setCollapsible(true);
}
} else {
east = new East();
layout.appendChild(east);
east.setSplittable(false);
east.setAutoscroll(true);
east.setFlex(true);
LayoutUtils.addSclass("adwindow-nav adwindow-right-nav", east);
adTab.setTabplacement(IADTab.RIGHT);
adTab.getTabSelectionComponent().setParent(east);
if (SessionManager.getSessionApplication().getUserPreference().isPropertyBool(UserPreference.P_WINDOW_TAB_COLLAPSIBLE)) {
east.setTitle(Msg.getElement(Env.getCtx(), "AD_Tab_ID"));
east.setCollapsible(true);
}
}
LayoutUtils.addSclass("adwindow-nav-content", (HtmlBasedComponent) adTab.getTabSelectionComponent());
}
contentArea = new Center();
contentArea.setParent(layout);
contentArea.setAutoscroll(true);
contentArea.setFlex(true);
adTab.createPart(contentArea);
if (parent instanceof Tabpanel) {
TabOnCloseHanlder handler = new TabOnCloseHanlder();
((Tabpanel) parent).setOnCloseHandler(handler);
}
if (!isEmbedded()) {
if (keyListener != null)
keyListener.detach();
keyListener = new Keylistener();
statusBar.appendChild(keyListener);
keyListener.setCtrlKeys("#f1#f2#f3#f4#f5#f6#f7#f8#f9#f10#f11#f12^f^i^n^s^d@#left@#right@#up@#down@#pgup@#pgdn@p^p@z@x#enter");
keyListener.addEventListener(Events.ON_CTRL_KEY, toolbar);
keyListener.addEventListener(Events.ON_CTRL_KEY, this);
keyListener.setAutoBlur(false);
}
layout.setAttribute(ITabOnSelectHandler.ATTRIBUTE_KEY, new ITabOnSelectHandler() {
public void onSelect() {
IADTab adTab = getADTab();
if (adTab != null) {
IADTabPanel iadTabpanel = adTab.getSelectedTabpanel();
if (iadTabpanel != null && iadTabpanel instanceof ADTabPanel) {
ADTabPanel adTabpanel = (ADTabPanel) iadTabpanel;
if (adTabpanel.isGridView()) {
adTabpanel.getGridView().scrollToCurrentRow();
}
}
}
}
});
return layout;
}
Aggregations