From f1860fa2ce05e9c8c96f7f887a97c075648a06e9 Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Wed, 12 Sep 2012 18:18:34 +0800 Subject: [PATCH] IDEMPIERE-369 Master Detail layout improvements. First step - remove existing embedded tab implementation. --- .../webui/component/AbstractADTab.java | 2 +- .../webui/component/CWindowToolbar.java | 52 +--- .../org/adempiere/webui/panel/ADTabpanel.java | 151 ----------- .../adempiere/webui/panel/ADWindowPanel.java | 66 ++--- .../webui/panel/AbstractADWindowPanel.java | 250 +++++------------- .../adempiere/webui/panel/StatusBarPanel.java | 53 ++-- 6 files changed, 118 insertions(+), 456 deletions(-) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java index 12c7a9cbe7..31e9727607 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/AbstractADTab.java @@ -135,7 +135,7 @@ public abstract class AbstractADTab extends AbstractUIPart implements IADTab private void prepareContext(int newIndex, IADTabpanel newTab) { //update context - if (newTab != null && (adWindowPanel == null || !adWindowPanel.isEmbedded())) + if (newTab != null) { List parents = new ArrayList(); //get parent list, always include first tab (0) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java index 7d6e72b356..14bd500e44 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/component/CWindowToolbar.java @@ -61,8 +61,6 @@ public class CWindowToolbar extends FToolbar implements EventListener private static final String BTNPREFIX = "Btn"; - private static final String EMBEDDED_TOOLBAR_BUTTON_STYLE = "background-color: transparent; display:inline-block; margin-left: 1px; margin-right: 1px; width: 20px; height: 18px;"; - private static CLogger log = CLogger.getCLogger(CWindowToolbar.class); private ToolBarButton btnIgnore; @@ -101,8 +99,6 @@ public class CWindowToolbar extends FToolbar implements EventListener private Map altKeyMap = new HashMap(); private Map ctrlKeyMap = new HashMap(); - private boolean embedded; - // Elaine 2008/12/04 /** Show Personal Lock */ public boolean isPersonalLock = MRole.getDefault().isPersonalLock(); @@ -120,17 +116,10 @@ public class CWindowToolbar extends FToolbar implements EventListener public CWindowToolbar() { - this(false); + this(0); } - public CWindowToolbar(boolean embedded) - { - this.embedded = embedded; - init(); - } - - public CWindowToolbar(boolean embedded, int windowNo) { - this.embedded = embedded; + public CWindowToolbar(int windowNo) { setWindowNo(windowNo); init(); } @@ -197,20 +186,7 @@ public class CWindowToolbar extends FToolbar implements EventListener configureKeyMap(); - if (embedded) - { - btnParentRecord.setVisible(false); - btnDetailRecord.setVisible(false); - btnActiveWorkflows.setVisible(false); - btnProductInfo.setVisible(false); - setAlign("end"); - setWidth("100%"); - setStyle("background: transparent none; "); - } - else - { - setWidth("100%"); - } + setWidth("100%"); } @@ -219,20 +195,13 @@ public class CWindowToolbar extends FToolbar implements EventListener ToolBarButton btn = new ToolBarButton(""); btn.setName(BTNPREFIX+name); if (windowNo > 0) - btn.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unq" + btn.getName() + "_" + windowNo + (embedded ? "E" : "")); + btn.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, "unq" + btn.getName() + "_" + windowNo); else btn.setAttribute(AdempiereIdGenerator.ZK_COMPONENT_PREFIX_ATTRIBUTE, btn.getName()); - btn.setImage("/images/"+image + (embedded ? "16.png" : "24.png")); + btn.setImage("/images/"+image + "24.png"); btn.setTooltiptext(Msg.getMsg(Env.getCtx(),tooltip)); - if (embedded) - { - btn.setStyle(EMBEDDED_TOOLBAR_BUTTON_STYLE); - btn.setSclass("embedded-toolbar-button"); - } - else - { - btn.setSclass("toolbar-button"); - } + btn.setSclass("toolbar-button"); + buttons.put(name, btn); this.appendChild(btn); //make toolbar button last to receive focus @@ -310,10 +279,7 @@ public class CWindowToolbar extends FToolbar implements EventListener protected void addSeparator() { Space s = new Space(); - if (embedded) - s.setSpacing("3px"); - else - s.setSpacing("6px"); + s.setSpacing("6px"); s.setOrient("vertical"); this.appendChild(s); } @@ -505,7 +471,7 @@ public class CWindowToolbar extends FToolbar implements EventListener { this.btnLock.setPressed(locked); - String imgURL = "/images/"+ (this.btnLock.isPressed() ? "LockX" : "Lock") + (embedded ? "16.png" : "24.png"); + String imgURL = "/images/"+ (this.btnLock.isPressed() ? "LockX" : "Lock") + "24.png"; this.btnLock.setImage(imgURL); } 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 a6fc1224d1..0bb4fe591a 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 @@ -23,7 +23,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Map.Entry; -import java.util.Properties; import java.util.logging.Level; import org.adempiere.webui.LayoutUtils; @@ -146,8 +145,6 @@ DataStatusListener, IADTabpanel private Map includedTab = new HashMap(); private Map includedTabFooter = new HashMap(); - private List includedPanel = new ArrayList(); - private boolean active = false; private Group currentGroup; @@ -335,14 +332,6 @@ DataStatusListener, IADTabpanel 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, field.getDisplayLength()); - break; - } - } - row = new Row(); continue; } @@ -759,27 +748,11 @@ DataStatusListener, IADTabpanel } } - //activate embedded panel - for(EmbeddedPanel ep : includedPanel) - { - activateChild(activate, ep); - } - if (gridTab.getRecord_ID() > 0 && gridTab.isTreeTab() && treePanel != null) { setSelectedNode(gridTab.getRecord_ID()); } } - private void activateChild(boolean activate, EmbeddedPanel panel) { - if (activate) - { - panel.windowPanel.getADTab().evaluate(null); - panel.windowPanel.getADTab().setSelectedIndex(0); - panel.tabPanel.query(false, 0, 0); - } - panel.tabPanel.activate(activate); - } - /** * set focus to first active editor */ @@ -928,27 +901,6 @@ DataStatusListener, IADTabpanel listPanel.updateListIndex(); listPanel.dynamicDisplay(col); } - - if (!includedPanel.isEmpty() && e.getChangedColumn() == -1) { - ArrayList parentColumnNames = new ArrayList(); - GridField[] parentFields = gridTab.getFields(); - for (GridField parentField : parentFields) - parentColumnNames.add(parentField.getColumnName()); - - for (EmbeddedPanel panel : includedPanel) - { - GridTab tab = panel.tabPanel.getGridTab(); - GridField[] fields = tab.getFields(); - for (GridField field : fields) - { - if (!parentColumnNames.contains(field.getColumnName())) - Env.setContext(Env.getCtx(), field.getWindowNo(), field.getColumnName(), ""); - } - panel.tabPanel.query(false, 0, 0); - } - - parentColumnNames = null; - } } private void deleteNode(int recordId) { @@ -1029,18 +981,8 @@ DataStatusListener, IADTabpanel public void switchRowPresentation() { if (formComponent.isVisible()) { formComponent.setVisible(false); - //de-activate embedded panel - for(EmbeddedPanel ep : includedPanel) - { - activateChild(false, ep); - } } else { formComponent.setVisible(true); - //activate embedded panel - for(EmbeddedPanel ep : includedPanel) - { - activateChild(true, ep); - } formComponent.getParent().invalidate(); } listPanel.setVisible(!formComponent.isVisible()); @@ -1069,89 +1011,10 @@ DataStatusListener, IADTabpanel } - /** - * 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) { - 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; - ep.tabIndex = tabIndex; - ep.gridWindow = gridWindow; - includedPanel.add(ep); - Group group = includedTab.get(adTabId); - ep.group = group; - if (tabPanel instanceof ADTabpanel) { - ADTabpanel atp = (ADTabpanel) tabPanel; - atp.listPanel.setPageSize(-1); - } - ADWindowPanel panel = new ADWindowPanel(ctx, windowNo, gridWindow, tabIndex, tabPanel); - ep.windowPanel = panel; - - if (group != null) { - createEmbeddedPanelUI(ep, height); - if (active) - activateChild(true, ep); - } - } - - class EmbeddedPanel { - Group group; - GridWindow gridWindow; - int tabIndex; - ADWindowPanel windowPanel; - IADTabpanel tabPanel; - int adTabId; - } - /** * @see IADTabpanel#afterSave(boolean) */ public void afterSave(boolean onSaveEvent) { - if (!includedPanel.isEmpty()) { - for (EmbeddedPanel panel : includedPanel) - panel.tabPanel.query(false, 0, 0); - } - } - - private void createEmbeddedPanelUI(EmbeddedPanel ep, int height) { - 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;"); - //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.initPanel(-1, null); } @Override @@ -1196,20 +1059,6 @@ DataStatusListener, IADTabpanel return listPanel.isVisible(); } - /** - * @param gTab - * @return embedded panel or null if not found - */ - public IADTabpanel findEmbeddedPanel(GridTab gTab) { - IADTabpanel panel = null; - for(EmbeddedPanel ep : includedPanel) { - if (ep.tabPanel.getGridTab().equals(gTab)) { - return ep.tabPanel; - } - } - return panel; - } - /** * * @return GridPanel 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 059eb78136..14b05a7882 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 @@ -35,7 +35,6 @@ import org.adempiere.webui.component.Tabs; import org.adempiere.webui.part.ITabOnSelectHandler; import org.adempiere.webui.session.SessionManager; import org.adempiere.webui.util.UserPreference; -import org.compiere.model.GridWindow; import org.compiere.model.MQuery; import org.compiere.util.CLogger; import org.compiere.util.Env; @@ -86,12 +85,6 @@ public class ADWindowPanel extends AbstractADWindowPanel } - public ADWindowPanel(Properties ctx, int windowNo, GridWindow gridWindow, - int tabIndex, IADTabpanel tabPanel) { - super(ctx, windowNo, gridWindow, tabIndex, tabPanel); - } - - protected Component doCreatePart(Component parent) { layout = new Borderlayout(); @@ -102,37 +95,24 @@ public class ADWindowPanel extends AbstractADWindowPanel layout.setPage(page); } - //toolbar would be added to group for embedded tab - if (!isEmbedded()) - { - North n = new North(); - n.setParent(layout); - n.setCollapsible(false); - n.setSclass("adwindow-north"); - toolbar.setParent(n); - toolbar.setWindowNo(getWindowNo()); - } + //toolbar + North n = new North(); + n.setParent(layout); + n.setCollapsible(false); + n.setSclass("adwindow-north"); + toolbar.setParent(n); + toolbar.setWindowNo(getWindowNo()); - //status bar on top for embedded tab - if (!isEmbedded()) - { - South s = new South(); - layout.appendChild(s); - s.setCollapsible(false); - s.setSclass("adwindow-south"); - statusBar.setParent(s); - } - else - { - North n = new North(); - layout.appendChild(n); - n.setCollapsible(false); - statusBar.setParent(n); - } + //status bar + South s = new South(); + layout.appendChild(s); + s.setCollapsible(false); + s.setSclass("adwindow-south"); + statusBar.setParent(s); LayoutUtils.addSclass("adwindow-status", statusBar); - if (!isEmbedded() && adTab.isUseExternalSelection()) + if (adTab.isUseExternalSelection()) { String tabPlacement = SessionManager.getSessionApplication().getUserPreference().getProperty(UserPreference.P_WINDOW_TAB_PLACEMENT); if (tabPlacement == null || "left".equalsIgnoreCase(tabPlacement)) @@ -183,16 +163,14 @@ public class ADWindowPanel extends AbstractADWindowPanel ((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); - } + 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() { 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 7db0b7384b..a5d7d12311 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 @@ -168,46 +168,19 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To private boolean m_findCancelled; - private int embeddedTabindex = -1; - - protected Map includedMap = new HashMap(); - - protected Map includedFieldMap = new HashMap(); - - private IADTabpanel embeddedTabPanel; - private boolean m_findCreateNew; private boolean m_queryInitiating; /** - * Constructor for non-embedded mode + * Constructor * @param ctx * @param windowNo */ public AbstractADWindowPanel(Properties ctx, int windowNo) - { - this(ctx, windowNo, null, -1, null); - } - - /** - * Constructor for embedded mode - * @param ctx - * @param windowNo - * @param gridWindow - * @param tabIndex - * @param tabPanel - */ - public AbstractADWindowPanel(Properties ctx, int windowNo, GridWindow gridWindow, int tabIndex, IADTabpanel tabPanel) { this.ctx = ctx; this.curWindowNo = windowNo; - this.gridWindow = gridWindow; - this.embeddedTabindex = tabIndex; - this.embeddedTabPanel = tabPanel; - curTabpanel = tabPanel; - if (gridWindow != null && tabIndex >= 0) - curTab = gridWindow.getTab(tabIndex); initComponents(); } @@ -236,20 +209,13 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To return statusBar; } - /** - * @return boolean - */ - public boolean isEmbedded() { - return embeddedTabindex >= 0; - } - private void initComponents() { /** Initalise toolbar */ - toolbar = new CWindowToolbar(isEmbedded(), getWindowNo()); + toolbar = new CWindowToolbar(getWindowNo()); toolbar.addListener(this); - statusBar = new StatusBarPanel(isEmbedded()); + statusBar = new StatusBarPanel(); } /** @@ -294,88 +260,69 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To // End of temporary code for [ adempiere-ZK Web Client-2832968 ] User context lost? // Set AutoCommit for this Window - if (embeddedTabindex < 0) - { - Env.setAutoCommit(ctx, curWindowNo, Env.isAutoCommit(ctx)); - boolean autoNew = Env.isAutoNew(ctx); - Env.setAutoNew(ctx, curWindowNo, autoNew); + Env.setAutoCommit(ctx, curWindowNo, Env.isAutoCommit(ctx)); + boolean autoNew = Env.isAutoNew(ctx); + Env.setAutoNew(ctx, curWindowNo, autoNew); - GridWindowVO gWindowVO = AEnv.getMWindowVO(curWindowNo, adWindowId, 0); - if (gWindowVO == null) - { - throw new ApplicationException(Msg.getMsg(ctx, - "AccessTableNoView") - + "(No Window Model Info)"); - } - gridWindow = new GridWindow(gWindowVO, true); - title = gridWindow.getName(); + GridWindowVO gWindowVO = AEnv.getMWindowVO(curWindowNo, adWindowId, 0); + if (gWindowVO == null) + { + throw new ApplicationException(Msg.getMsg(ctx, + "AccessTableNoView") + + "(No Window Model Info)"); + } + gridWindow = new GridWindow(gWindowVO, true); + title = gridWindow.getName(); - // Set AutoNew for Window - if (!autoNew && gridWindow.isTransaction()) - { - Env.setAutoNew(ctx, curWindowNo, true); - } - } + // Set AutoNew for Window + if (!autoNew && gridWindow.isTransaction()) + { + Env.setAutoNew(ctx, curWindowNo, true); + } - m_onlyCurrentRows = embeddedTabindex < 0 && gridWindow.isTransaction(); + m_onlyCurrentRows = gridWindow.isTransaction(); MQuery detailQuery = null; /** * Window Tabs */ - if (embeddedTabindex < 0) + if (query != null && query.getZoomTableName() != null && query.getZoomColumnName() != null + && query.getZoomValue() instanceof Integer && (Integer)query.getZoomValue() > 0) + { + if (!query.getZoomTableName().equalsIgnoreCase(gridWindow.getTab(0).getTableName())) + { + detailQuery = query; + query = new MQuery(); + query.addRestriction("1=2"); + query.setRecordCount(0); + } + } + + int tabSize = gridWindow.getTabCount(); + + for (int tab = 0; tab < tabSize; tab++) { - if (query != null && query.getZoomTableName() != null && query.getZoomColumnName() != null - && query.getZoomValue() instanceof Integer && (Integer)query.getZoomValue() > 0) - { - if (!query.getZoomTableName().equalsIgnoreCase(gridWindow.getTab(0).getTableName())) - { - detailQuery = query; - query = new MQuery(); - query.addRestriction("1=2"); - query.setRecordCount(0); - } - } - - int tabSize = gridWindow.getTabCount(); - - for (int tab = 0; tab < tabSize; tab++) - { - initTab(query, tab); - if (tab == 0 && curTab == null && m_findCancelled) - return false; - } - Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName()); + initTab(query, tab); + if (tab == 0 && curTab == null && m_findCancelled) + return false; } - else - { - initEmbeddedTab(query, embeddedTabindex); - } - + Env.setContext(ctx, curWindowNo, "WindowName", gridWindow.getName()); + if (curTab != null) curTab.getTableModel().setChanged(false); - if (embeddedTabindex < 0) - { - curTabIndex = 0; + curTabIndex = 0; - adTab.setSelectedIndex(0); - // all fields context for window is clear at AbstractADTab.prepareContext, set IsSOTrx for window - Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx()); - toolbar.enableTabNavigation(adTab.getTabCount() > 1); - toolbar.enableFind(true); - adTab.evaluate(null); + adTab.setSelectedIndex(0); + // all fields context for window is clear at AbstractADTab.prepareContext, set IsSOTrx for window + Env.setContext(ctx, curWindowNo, "IsSOTrx", gridWindow.isSOTrx()); + toolbar.enableTabNavigation(adTab.getTabCount() > 1); + toolbar.enableFind(true); + adTab.evaluate(null); - if (detailQuery != null && zoomToDetailTab(detailQuery)) - { - return true; - } - } - else + if (detailQuery != null && zoomToDetailTab(detailQuery)) { - curTabIndex = embeddedTabindex; - toolbar.enableTabNavigation(false); - toolbar.enableFind(true); + return true; } updateToolbar(); @@ -471,15 +418,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To targetQuery.addRestriction(gTab.getLinkColumnName(), "=", parentId); gTab.setQuery(targetQuery); IADTabpanel gc = null; - if (!includedMap.containsKey(gTab.getAD_Tab_ID())) - { - gc = adTab.findADTabpanel(gTab); - } - else - { - ADTabpanel parent = (ADTabpanel)includedMap.get(gTab.getAD_Tab_ID()); - gc = parent.findEmbeddedPanel(gTab); - } + gc = adTab.findADTabpanel(gTab); gc.createUI(); gc.query(false, 0, 0); @@ -490,17 +429,7 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To int id = table.getKeyID(i); if (id == ((Integer)query.getZoomValue()).intValue()) { - if (!includedMap.containsKey(gTab.getAD_Tab_ID())) - { - setActiveTab(gridWindow.getTabIndex(gTab), null); - } - else - { - IADTabpanel parent = includedMap.get(gTab.getAD_Tab_ID()); - int pindex = gridWindow.getTabIndex(parent.getGridTab()); - if (pindex >= 0) - setActiveTab(pindex, null); - } + setActiveTab(gridWindow.getTabIndex(gTab), null); gTab.navigate(i); return true; } @@ -511,17 +440,6 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To return false; } - private void initEmbeddedTab(MQuery query, int tabIndex) { - GridTab gTab = gridWindow.getTab(tabIndex); - gTab.addDataStatusListener(this); - adTab.addTab(gTab, embeddedTabPanel); - if (gTab.isSortTab()) { - ((ADSortTab)embeddedTabPanel).registerAPanel(this); - } else { - ((ADTabpanel)embeddedTabPanel).init(this, curWindowNo, gTab, gridWindow); - } - } - private void initQueryOnNew(MQuery result) { if (curTab.isHighVolume() && m_findCreateNew) onNew(); @@ -583,57 +501,31 @@ public abstract class AbstractADWindowPanel extends AbstractUIPart implements To if (gTab.isSortTab()) { ADSortTab sortTab = new ADSortTab(curWindowNo, gTab); - if (includedMap.containsKey(gTab.getAD_Tab_ID())) - { - includedMap.get(gTab.getAD_Tab_ID()).embed(ctx, curWindowNo, gridWindow, gTab.getAD_Tab_ID(), tabIndex, sortTab); - } - else - { - adTab.addTab(gTab, sortTab); - sortTab.registerAPanel(this); - if (tabIndex == 0) { - curTabpanel = sortTab; - curTabpanel.createUI(); - if (!m_queryInitiating) - { - initFirstTabpanel(); - } + adTab.addTab(gTab, sortTab); + sortTab.registerAPanel(this); + if (tabIndex == 0) { + curTabpanel = sortTab; + curTabpanel.createUI(); + if (!m_queryInitiating) + { + initFirstTabpanel(); } - gTab.addDataStatusListener(this); } + gTab.addDataStatusListener(this); } else { - //build embedded tab map ADTabpanel fTabPanel = new ADTabpanel(); - GridField[] fields = gTab.getTableModel().getFields(); - for(int i = 0; i < fields.length; i++) - { - 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, - includedFieldMap.get(gTab.getAD_Tab_ID()).getDisplayLength()); - } - else - { - gTab.addDataStatusListener(this); - fTabPanel.init(this, curWindowNo, gTab, gridWindow); - adTab.addTab(gTab, fTabPanel); - if (tabIndex == 0) { - fTabPanel.createUI(); - curTabpanel = fTabPanel; - if (!m_queryInitiating) - { - initFirstTabpanel(); - } - } + gTab.addDataStatusListener(this); + fTabPanel.init(this, curWindowNo, gTab, gridWindow); + adTab.addTab(gTab, fTabPanel); + if (tabIndex == 0) { + fTabPanel.createUI(); + curTabpanel = fTabPanel; + if (!m_queryInitiating) + { + initFirstTabpanel(); + } } if (!m_queryInitiating && tabIndex == 0) diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/StatusBarPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/StatusBarPanel.java index 0611c03704..8f899cec75 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/StatusBarPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/StatusBarPanel.java @@ -49,7 +49,7 @@ import org.zkoss.zul.Vbox; * @date Mar 12, 2007 * @version $Revision: 0.10 $ */ -public class StatusBarPanel extends Panel implements EventListener, IStatusBar +public class StatusBarPanel extends Panel implements EventListener, IStatusBar { /** * @@ -79,20 +79,10 @@ public class StatusBarPanel extends Panel implements EventListener, IStatusBar private Div popupContent; private String popupStyle; - private boolean embedded; public StatusBarPanel() { - this(false); - } - - /** - * @param embedded - */ - public StatusBarPanel(boolean embedded) - { super(); - this.embedded = embedded; init(); } @@ -109,16 +99,10 @@ public class StatusBarPanel extends Panel implements EventListener, IStatusBar hbox.appendChild(leftCell); Cell rightCell = new Cell(); hbox.appendChild(rightCell); - if (embedded) - { - leftCell.setWidth("90%"); - rightCell.setWidth("10%"); - } - else - { - leftCell.setWidth("50%"); - rightCell.setWidth("50%"); - } + + leftCell.setWidth("50%"); + rightCell.setWidth("50%"); + west = new Div(); west.setStyle("text-align: left; "); west.appendChild(statusLine); @@ -131,17 +115,13 @@ public class StatusBarPanel extends Panel implements EventListener, IStatusBar east = new Div(); east.setWidth("100%"); east.setStyle("text-align: right; "); - if (!embedded) - { - infoLine = new Label(); - east.appendChild(infoLine); - infoLine.setVisible(false); - } + infoLine = new Label(); + east.appendChild(infoLine); + infoLine.setVisible(false); east.appendChild(statusDB); LayoutUtils.addSclass("status-db", statusDB); - if (!embedded) - LayoutUtils.addSclass("status-info", infoLine); + LayoutUtils.addSclass("status-info", infoLine); vbox = new Vbox(); vbox.setAlign("stretch"); vbox.setPack("center"); @@ -306,15 +286,12 @@ public class StatusBarPanel extends Panel implements EventListener, IStatusBar */ public void setInfo (String text) { - if (!embedded) - { - infoLine.setValue(text != null ? text : ""); - infoLine.setTooltiptext(text); - if (text == null || text.trim().length() == 0) - infoLine.setVisible(false); - else - infoLine.setVisible(true); - } + infoLine.setValue(text != null ? text : ""); + infoLine.setTooltiptext(text); + if (text == null || text.trim().length() == 0) + infoLine.setVisible(false); + else + infoLine.setVisible(true); } // setInfo public void onEvent(Event event) throws Exception {