diff --git a/client/src/org/compiere/apps/APanel.java b/client/src/org/compiere/apps/APanel.java index 7b0486140f..a922911deb 100644 --- a/client/src/org/compiere/apps/APanel.java +++ b/client/src/org/compiere/apps/APanel.java @@ -56,29 +56,41 @@ import org.compiere.util.*; public final class APanel extends CPanel implements DataStatusListener, ChangeListener, ActionListener, ASyncProcess { + private boolean isNested = false; + /** * Constructs a new instance. * Need to call initPanel for dynamic initialization */ //FR [ 1757088 ] - public APanel(GridController gc){ + public APanel(GridController gc, int windowNo){ super(); + isNested = true; m_ctx = Env.getCtx(); try{ m_curGC = gc; + gc.addDataStatusListener(this); m_curTab = gc.getMTab(); + Component tabElement = null; tabElement = gc; VTabbedPane tabPane = new VTabbedPane(false); tabPane.addTab(m_curTab.getName().toString(), m_curTab, tabElement); m_curWinTab = tabPane; + m_curWindowNo = windowNo; jbInit(); initSwitchLineAction(); } catch(Exception e){ log.log(Level.SEVERE, "", e); } + createMenu(); + + MRole role = MRole.getDefault(); + m_curGC.query (m_onlyCurrentRows, m_onlyCurrentDays, role.getMaxQueryRecords()); + m_curTab.navigateCurrent(); // updates counter + m_curGC.dynamicDisplay(0); } public APanel(AWindow window) @@ -445,7 +457,7 @@ public final class APanel extends CPanel */ public String getTitle() { - if (m_mWorkbench.getWindowCount() > 1) + if (m_mWorkbench != null && m_mWorkbench.getWindowCount() > 1) { StringBuffer sb = new StringBuffer(); sb.append(m_mWorkbench.getName()).append(" ") @@ -669,11 +681,11 @@ public final class APanel extends CPanel int m_tab_id = 0; for(int f =0 ; f < fields.length ; f ++) { - m_tab_id = fields[f].getIncluded_Tab_ID(); - if ( m_tab_id != 0) - { - includedMap.put(m_tab_id, gc); - } + m_tab_id = fields[f].getIncluded_Tab_ID(); + if ( m_tab_id != 0) + { + includedMap.put(m_tab_id, gc); + } } // Is this tab included? @@ -683,22 +695,25 @@ public final class APanel extends CPanel if (parent != null) { // FR [ 1757088 ] - gc.initGrid(gTab, false, m_curWindowNo, this, mWindow, false); // will set color on Tab level + gc.removeDataStatusListener(this); + //gc.initGrid(gTab, false, m_curWindowNo, this, mWindow, false); // will set color on Tab level + m_mWorkbench.getMWindow(0).initTab(tab); + gc.activate(); included = parent.includeTab(gc,this); TabSwitcher ts = new TabSwitcher(parent, this); Component[] comp = parent.getvPanel().getComponentsRecursive(); for (int i = 0; i < comp.length; i++) { - ts.addTabSwitchingSupport((JComponent)comp[i]); + ts.addTabSwitchingSupport((JComponent)comp[i]); } - ts = new TabSwitcher(gc, this); - comp = gc.getvPanel().getComponentsRecursive(); + ts = new TabSwitcher(gc, this); + comp = gc.getvPanel().getComponentsRecursive(); for (int i = 0; i < comp.length; i++) { - ts.addTabSwitchingSupport((JComponent)comp[i]); + ts.addTabSwitchingSupport((JComponent)comp[i]); } - ts = new TabSwitcher(gc, this); - ts.addTabSwitchingSupport((JComponent)gc.getTable()); + ts = new TabSwitcher(gc, this); + ts.addTabSwitchingSupport((JComponent)gc.getTable()); if (!included) log.log(Level.SEVERE, "Not Included = " + gc); @@ -881,7 +896,8 @@ public final class APanel extends CPanel if (m_curTab != null && m_curTab.isQueryActive()) dbInfo = "[ " + dbInfo + " ]"; statusBar.setStatusDB(dbInfo, e); - m_window.setTitle(getTitle()); + if (!isNested) + m_window.setTitle(getTitle()); // Set Message / Info if (e.getAD_Message() != null || e.getInfo() != null) @@ -1695,7 +1711,8 @@ public final class APanel extends CPanel m_curGC.rowChanged(true, m_curTab.getRecord_ID()); if (manualCmd) { m_curGC.dynamicDisplay(0); - m_window.setTitle(getTitle()); + if (!isNested) + m_window.setTitle(getTitle()); } return retValue; } // cmd_save @@ -2507,4 +2524,8 @@ public final class APanel extends CPanel setBusy(false,true); } + public boolean isNested() { + return isNested; + } + } // APanel diff --git a/client/src/org/compiere/grid/GridController.java b/client/src/org/compiere/grid/GridController.java index 3410e7b014..ad2d59e894 100644 --- a/client/src/org/compiere/grid/GridController.java +++ b/client/src/org/compiere/grid/GridController.java @@ -436,6 +436,7 @@ public class GridController extends CPanel int screenWidth = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth() - 630; // Set screen dimension detail.setPreferredSize(new Dimension(screenWidth, 250)); + /* ArrayList parents = detail.getMTab().getParentColumnNames(); // No Parent - no link if (parents.size() == 0) @@ -443,16 +444,16 @@ public class GridController extends CPanel // Standard case else if (parents.size() == 1) detail.getMTab().setLinkColumnName((String)parents.get(0)); - detail.getMTab().query(false, 0, 0); + detail.getMTab().query(false, 0, 0);*/ int c = VTable.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT; vTable.getInputMap(c).put(KeyStroke.getKeyStroke(KeyEvent.VK_F4, 0), aPanel.aSave.getName()); vTable.getActionMap().put(aPanel.aSave.getName(), aPanel.aSave); CollapsiblePanel section = vPanel.getIncludedSection(detail.getMTab().getAD_Tab_ID()); - gc.isDetailGrid(true); + gc.setDetailGrid(true); if(section != null) - { - APanel panel = new APanel(gc); + { + APanel panel = new APanel(gc, m_WindowNo); String name = detail.getMTab().getName() + ""; section.setTitle(name); panel.add(detail); @@ -481,11 +482,12 @@ public class GridController extends CPanel detail.addMouseListener(detail); detail.enableEvents(AWTEvent.HIERARCHY_EVENT_MASK + AWTEvent.MOUSE_EVENT_MASK); + detail.activate(); return true; } // IncludeTab //FR [ 1757088 ] - public void isDetailGrid(boolean value){ + public void setDetailGrid(boolean value){ detailGrid = value; } diff --git a/client/src/org/compiere/grid/VPanel.java b/client/src/org/compiere/grid/VPanel.java index 4b8def1dd2..94468507c9 100644 --- a/client/src/org/compiere/grid/VPanel.java +++ b/client/src/org/compiere/grid/VPanel.java @@ -185,17 +185,16 @@ public final class VPanel extends CTabbedPane { m_gbc.gridx = 0; m_gbc.gridy = m_line++; - m_gbc.gridwidth = 4; CollapsiblePanel m_tab = new CollapsiblePanel(""); m_tabincludelist.put(AD_Tab_ID, m_tab); m_gbc.anchor = GridBagConstraints.NORTHWEST; m_gbc.gridx = 0; m_gbc.gridheight = 1; - m_gbc.insets = new Insets(2,12,0,0); + m_gbc.insets = new Insets(2,0,0,0); m_gbc.gridy = m_line++; m_gbc.gridwidth = 4; m_gbc.fill = GridBagConstraints.HORIZONTAL; - m_gbc.weightx = 0; + m_gbc.weightx = 1; m_gbc.ipadx = 0; m_main.add(m_tab,m_gbc); return; @@ -345,7 +344,6 @@ public final class VPanel extends CTabbedPane // First time - add top if (m_oldFieldGroup == null) { - addTop(); m_oldFieldGroup = ""; m_oldFieldGroupType = ""; } @@ -458,13 +456,6 @@ public final class VPanel extends CTabbedPane fields.get(3).add(label); m_tab.add(label, gbc); - //Right gap - gbc.gridx = 4; // 5th column - gbc.gridwidth = 1; - gbc.weightx = 1; - gbc.insets = m_zeroInset; - gbc.fill = GridBagConstraints.HORIZONTAL; - m_tab.add(Box.createHorizontalStrut(1), gbc); } /** @@ -521,21 +512,6 @@ public final class VPanel extends CTabbedPane collapsibleEndFiller.put(m_tab, c); } - /** - * Add right gap - */ - private void addTop() - { - m_gbc.gridy = m_line++; - // Right gap - m_gbc.gridx = 4; // 5th column - m_gbc.gridwidth = 1; - m_gbc.weightx = 1; - m_gbc.insets = m_zeroInset; - m_gbc.fill = GridBagConstraints.HORIZONTAL; - m_main.add(Box.createHorizontalStrut(1), m_gbc); - } // addTop - /** * Add End (9) of Form */