use of org.zkoss.zkex.zul.Borderlayout in project adempiere by adempiere.
the class ADTabPanel method includedAutoResize.
public int includedAutoResize(HorizontalEmbeddedPanel embeddedPanel) {
if (embeddedPanel.windowPanel != null) {
if (embeddedPanel.windowPanel.isEmbedded()) {
Borderlayout window = embeddedPanel.windowPanel.getComponent();
try {
int size = 0;
int addSize = 0;
if (!embeddedPanel.tabPanel.getGridTab().isSingleRow()) {
size = MSysConfig.getIntValue("TAB_INCLUDING_HEIGHT", 400);
} else {
for (Object o : embeddedPanel.tabPanel.getGrid().getRows().getChildren()) {
if (o instanceof Row) {
if (((Row) o).isVisible()) {
size += getComponentSize((Row) o);
}
} else if (o instanceof org.zkoss.zul.Div) {
// Group
size += 20;
}
}
// 25 = statusbar
size += 25;
size += addSize;
List<HorizontalEmbeddedPanel> included = embeddedPanel.tabPanel.getHorizontalIncludedPanel();
if (included.size() > 0) {
for (HorizontalEmbeddedPanel panel : included) {
size += includedAutoResize(panel);
}
}
}
window.setHeight(size + "px");
window.resize();
return size;
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}
}
return 0;
}
use of org.zkoss.zkex.zul.Borderlayout in project adempiere by adempiere.
the class ADTabPanel method init.
/**
*
* @param winPanel
* @param windowNo
* @param gridTab
* @param gridWindow
*/
public void init(AbstractADWindowPanel winPanel, int windowNo, GridTab gridTab, GridWindow gridWindow) {
this.windowNo = windowNo;
this.gridWindow = gridWindow;
this.gridTab = gridTab;
this.windowPanel = winPanel;
gridTab.addDataStatusListener(this);
this.dataBinder = new GridTabDataBinder(gridTab);
this.getChildren().clear();
int AD_Tree_ID = 0;
if (gridTab.isTreeTab())
AD_Tree_ID = MTree.getDefaultAD_Tree_ID(Env.getAD_Client_ID(Env.getCtx()), gridTab.getKeyColumnName());
if (gridTab.isTreeTab() && AD_Tree_ID != 0) {
Borderlayout layout = new Borderlayout();
layout.setParent(this);
layout.setStyle("width: 100%; height: 100%; position: absolute;");
treePanel = new ADTreePanel();
West west = new West();
west.appendChild(treePanel);
west.setWidth("300px");
west.setCollapsible(true);
west.setSplittable(true);
west.setAutoscroll(true);
layout.appendChild(west);
Center center = new Center();
center.setFlex(true);
center.appendChild(grid);
layout.appendChild(center);
formComponent = layout;
treePanel.getTree().addEventListener(Events.ON_SELECT, this);
} else {
this.appendChild(grid);
formComponent = grid;
}
this.appendChild(listPanel);
listPanel.setVisible(false);
listPanel.setWindowNo(windowNo);
listPanel.setADWindowPanel(winPanel);
gridTab.getTableModel().addVetoableChangeListener(this);
}
use of org.zkoss.zkex.zul.Borderlayout in project adempiere by adempiere.
the class ADTabPanel method autoResize.
public void autoResize() {
if (windowPanel != null) {
if (windowPanel.isEmbedded()) {
Borderlayout window = ((ADWindowPanel) windowPanel).getComponent();
if (isGridView()) {
int size = MSysConfig.getIntValue("TAB_INCLUDING_HEIGHT", 400);
window.setHeight(size + "px");
listPanel.resize();
window.resize();
} else {
try {
int addSize = 0;
int size = 0;
if (grid.getRows() != null) {
for (Object o : grid.getRows().getChildren()) {
if (o instanceof Row) {
if (((Row) o).isVisible()) {
size += getComponentSize((Row) o);
}
} else if (o instanceof org.zkoss.zul.Group) {
size += 20;
}
}
}
// 25 = statusbar
size += 25;
size += addSize;
size += doAutoSize();
window.setHeight(size + "px");
window.resize();
} catch (Exception e) {
e.printStackTrace();
//nothing to do, just ignore
window.setHeight("61px");
window.resize();
}
}
}
}
}
use of org.zkoss.zkex.zul.Borderlayout in project adempiere by adempiere.
the class ADTabPanel method includedAutoResize.
public int includedAutoResize(EmbeddedPanel embeddedpanel) {
if (embeddedpanel.windowPanel != null) {
if (embeddedpanel.windowPanel.isEmbedded()) {
Borderlayout window = embeddedpanel.windowPanel.getComponent();
try {
int size = 0;
int addSize = 0;
if (!embeddedpanel.tabPanel.getGridTab().isSingleRow()) {
size = MSysConfig.getIntValue("TAB_INCLUDING_HEIGHT", 400);
} else {
for (Object o : embeddedpanel.tabPanel.getGrid().getRows().getChildren()) {
if (o instanceof Row) {
if (((Row) o).isVisible()) {
size += getComponentSize((Row) o);
}
} else if (o instanceof org.zkoss.zul.Group) {
// Group
size += 20;
}
}
// 25 = statusbar
size += 25;
size += addSize;
List<EmbeddedPanel> included = embeddedpanel.tabPanel.getIncludedPanel();
if (included.size() > 0) {
for (EmbeddedPanel panel : included) {
size += includedAutoResize(panel);
}
}
}
window.setHeight(size + "px");
window.resize();
return size;
} catch (Exception e) {
e.printStackTrace();
}
return 0;
}
}
return 0;
}
use of org.zkoss.zkex.zul.Borderlayout 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