diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java index 83d3f332cd..a564d60336 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADTabpanel.java @@ -311,10 +311,15 @@ DataStatusListener, IADTabpanel, VetoableChangeListener rows.appendChild(row); includedTabFooter.put(field.getIncluded_Tab_ID(), (Groupfoot)row); + row = new Row(); + row.setSpans("5"); + row.appendChild(new Separator()); + rows.appendChild(row); + for (EmbeddedPanel ep : includedPanel) { if (ep.adTabId == field.getIncluded_Tab_ID()) { ep.group = includedTab.get(ep.adTabId); - createEmbeddedPanelUI(ep); + createEmbeddedPanelUI(ep, field.getDisplayLength()); break; } } @@ -1045,6 +1050,20 @@ DataStatusListener, IADTabpanel, VetoableChangeListener */ public void embed(Properties ctx, int windowNo, GridWindow gridWindow, int adTabId, int tabIndex, IADTabpanel tabPanel) { + embed(ctx, windowNo, gridWindow, adTabId, tabIndex, tabPanel, 0); + } + + /** + * Embed detail tab + * @param ctx + * @param windowNo + * @param gridWindow + * @param adTabId + * @param tabIndex + * @param tabPanel + */ + public void embed(Properties ctx, int windowNo, GridWindow gridWindow, + int adTabId, int tabIndex, IADTabpanel tabPanel, int height) { EmbeddedPanel ep = new EmbeddedPanel(); ep.tabPanel = tabPanel; ep.adTabId = adTabId; @@ -1061,7 +1080,7 @@ DataStatusListener, IADTabpanel, VetoableChangeListener ep.windowPanel = panel; if (group != null) { - createEmbeddedPanelUI(ep); + createEmbeddedPanelUI(ep, height); if (active) activateChild(true, ep); } @@ -1086,19 +1105,22 @@ DataStatusListener, IADTabpanel, VetoableChangeListener } } - private void createEmbeddedPanelUI(EmbeddedPanel ep) { + private void createEmbeddedPanelUI(EmbeddedPanel ep, int height) { org.zkoss.zul.Row row = new Row(); row.setSpans("5"); grid.getRows().insertBefore(row, includedTabFooter.get(ep.adTabId)); ep.windowPanel.createPart(row); ep.windowPanel.getComponent().setWidth("100%"); - ep.windowPanel.getComponent().setStyle("position: relative"); - ep.windowPanel.getComponent().setHeight("400px"); + ep.windowPanel.getComponent().setStyle("position: relative;"); + //for backward compatibility, only treat display length > 50 as height for the embedded panel + if (height > 50) + ep.windowPanel.getComponent().setHeight(height + "px"); + else + ep.windowPanel.getComponent().setHeight("400px"); Label title = new Label(ep.gridWindow.getTab(ep.tabIndex).getName()); ep.group.appendChild(title); ep.group.appendChild(ep.windowPanel.getToolbar()); - ep.windowPanel.getStatusBar().setZclass("z-group-foot"); ep.windowPanel.initPanel(-1, null); } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java index 307334d720..0f8f8b1c6d 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/ADWindowPanel.java @@ -104,6 +104,7 @@ public class ADWindowPanel extends AbstractADWindowPanel layout.setPage(page); } + //toolbar would be added to group for embedded tab if (!isEmbedded()) { North n = new North(); @@ -115,10 +116,22 @@ public class ADWindowPanel extends AbstractADWindowPanel toolbar.setWindowNo(getWindowNo()); } - South s = new South(); - layout.appendChild(s); - s.setCollapsible(false); - statusBar.setParent(s); + //status bar on top for embedded tab + if (!isEmbedded()) + { + South s = new South(); + layout.appendChild(s); + s.setCollapsible(false); + statusBar.setParent(s); + } + else + { + North n = new North(); + layout.appendChild(n); + n.setCollapsible(false); + statusBar.setParent(n); + } + LayoutUtils.addSclass("adwindow-status", statusBar); if (!isEmbedded() && adTab.isUseExternalSelection()) @@ -270,5 +283,5 @@ public class ADWindowPanel extends AbstractADWindowPanel SessionManager.getAppDesktop().unregisterWindow(getWindowNo()); } } - } + } } diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java index 5435a41d79..3600e88eec 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/AbstractADWindowPanel.java @@ -163,6 +163,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private int embeddedTabindex = -1; protected Map includedMap = new HashMap(); + + protected Map includedFieldMap = new HashMap(); private IADTabpanel embeddedTabPanel; @@ -577,12 +579,14 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To if (fields[i].getIncluded_Tab_ID() > 0) { includedMap.put(fields[i].getIncluded_Tab_ID(), fTabPanel); + includedFieldMap.put(fields[i].getIncluded_Tab_ID(), fields[i]); } } if (includedMap.containsKey(gTab.getAD_Tab_ID())) { - includedMap.get(gTab.getAD_Tab_ID()).embed(ctx, curWindowNo, gridWindow, gTab.getAD_Tab_ID(), tabIndex, fTabPanel); + includedMap.get(gTab.getAD_Tab_ID()).embed(ctx, curWindowNo, gridWindow, gTab.getAD_Tab_ID(), tabIndex, fTabPanel, + includedFieldMap.get(gTab.getAD_Tab_ID()).getDisplayLength()); } else {