IDEMPIERE-123 Embedded Tab Enhancement

(transplanted from 9e9c9b9a7660697b9cb35c4ce88abe195c2b0828)
This commit is contained in:
Heng Sin Low 2012-01-21 10:42:34 +08:00
parent 533e1c0a72
commit 857badd5fc
3 changed files with 51 additions and 12 deletions

View File

@ -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().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);
}

View File

@ -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());
}
//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())

View File

@ -164,6 +164,8 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To
protected Map<Integer, ADTabpanel> includedMap = new HashMap<Integer, ADTabpanel>();
protected Map<Integer, GridField> includedFieldMap = new HashMap<Integer, GridField>();
private IADTabpanel embeddedTabPanel;
private boolean m_findCreateNew;
@ -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
{