[ 1869609 ] Tabs within Collapsed Grid disabled

This commit is contained in:
Heng Sin Low 2008-01-16 04:32:56 +00:00
parent 909e6f215f
commit fd3ce2f5f9
5 changed files with 96 additions and 89 deletions

View File

@ -367,7 +367,8 @@ public final class APanel extends CPanel
toolBar.add(aSave.getButton());
toolBar.addSeparator();
toolBar.add(aRefresh.getButton()); // F5
toolBar.add(aFind.getButton());
if (!isNested())
toolBar.add(aFind.getButton());
toolBar.add(aAttachment.getButton());
toolBar.add(aChat.getButton());
toolBar.add(aMulti.getButton());
@ -700,20 +701,6 @@ public final class APanel extends CPanel
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 = new TabSwitcher(gc, this);
comp = gc.getvPanel().getComponentsRecursive();
for (int i = 0; i < comp.length; i++)
{
ts.addTabSwitchingSupport((JComponent)comp[i]);
}
ts = new TabSwitcher(gc, this);
ts.addTabSwitchingSupport((JComponent)gc.getTable());
if (!included)
log.log(Level.SEVERE, "Not Included = " + gc);
@ -2478,52 +2465,6 @@ public final class APanel extends CPanel
getActionMap().put(aSwitchLinesUpAction.getName(), aSwitchLinesUpAction);
}
//FR [ 1757088 ]
public void dispatchTabSwitch(GridController gc)
{
log.info("Current Grid " + gc.getName());
if(gc == null || gc.equals(m_curGC))
{
return;
}
if(m_curTab.getRecord_ID() == -1 )
{
gc.getMTab().navigateCurrent();
gc.dynamicDisplay(0);
gc.getMTab().dataRefresh();
return;
}
gc.getMTab().dataSave(true);
m_curGC = gc;
m_curGC.activate();
m_curTab = gc.getMTab();
aDetail.setEnabled(m_curTabIndex != m_curWinTab.getTabCount()-1);
aParent.setEnabled(m_curTabIndex != 0 && m_curWinTab.getTabCount() > 1);
if (m_mWorkbench.getMWindow(getWindowIndex()).isTransaction()) {
aHistory.setEnabled(isFirstTab());
}
else
{
aHistory.setPressed(false);
aHistory.setEnabled(false);
}
aPrint.setEnabled(m_curTab.isPrinted());
aFind.setPressed(m_curTab.isQueryActive());
aMulti.setEnabled(true);
aMulti.setPressed(!m_curGC.isSingleRow());
aFind.setEnabled(true);
aRefresh.setEnabled(true);
aAttachment.setEnabled(true);
m_curWinTab.requestFocusInWindow();
setBusy(false,true);
}
public boolean isNested() {
return isNested;
}

View File

@ -145,8 +145,6 @@ public class GridController extends CPanel
private CardLayout cardLayout = new CardLayout();
private JSplitPane srPane = new JSplitPane();
private JScrollPane vPane = new JScrollPane();
//FR [ 1757088 ]
private GridController detail = null;
private CScrollPane mrPane = new CScrollPane();
private CPanel xPanel = new CPanel();
private BorderLayout xLayout = new BorderLayout();
@ -432,7 +430,7 @@ public class GridController extends CPanel
//FR [ 1757088 ]
public boolean includeTab (GridController gc , APanel aPanel)
{
detail = gc;
GridController detail = gc;
int screenWidth = (int) Toolkit.getDefaultToolkit().getScreenSize().getWidth() - 630;
// Set screen dimension
detail.setPreferredSize(new Dimension(screenWidth, 250));
@ -445,9 +443,10 @@ public class GridController extends CPanel
else if (parents.size() == 1)
detail.getMTab().setLinkColumnName((String)parents.get(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);
vTable.getActionMap().put(aPanel.aSave.getName(), aPanel.aSave);*/
CollapsiblePanel section = vPanel.getIncludedSection(detail.getMTab().getAD_Tab_ID());
gc.setDetailGrid(true);
@ -460,29 +459,13 @@ public class GridController extends CPanel
section.getCollapsiblePane().getContentPane().setLayout(new BorderLayout());
section.getCollapsiblePane().getContentPane().add(panel, BorderLayout.CENTER);
}
JRootPane rt = SwingUtilities.getRootPane(this);
if (rt == null)
log.info("Root pane null");
else
{
log.info("Root=" + rt);
rt.addMouseListener(detail);
Component gp = rt.getGlassPane();
if (gp == null)
log.info("No Glass Pane");
else
{
log.info("Glass=" + gp);
gp.addMouseListener(detail);
}
}
detail.addMouseListener(detail);
detail.enableEvents(AWTEvent.HIERARCHY_EVENT_MASK + AWTEvent.MOUSE_EVENT_MASK);
detail.activate();
new GridSynchronizer(this, detail);
return true;
} // IncludeTab
@ -795,10 +778,6 @@ public class GridController extends CPanel
// log.config( "GridController.valueChanged (" + m_mTab.toString() + ") - fini",
// "Row in Table=" + rowTable + ", in Model=" + rowCurrent);
// FR [ 1757088 ]
// Query Included Tab
if (detail != null)
detail.getMTab().query(false, 0, 0);
} // valueChanged
/**

View File

@ -0,0 +1,49 @@
package org.compiere.grid;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import org.compiere.model.StateChangeEvent;
import org.compiere.model.StateChangeListener;
import org.compiere.model.GridTab;
import org.compiere.model.MRole;
/**
*
* @author Low Heng Sin
*
*/
public class GridSynchronizer implements PropertyChangeListener, StateChangeListener {
private GridController parent;
private GridController child;
public GridSynchronizer(GridController parent, GridController child) {
this.parent = parent;
this.child = child;
parent.getMTab().addPropertyChangeListener(this);
parent.getMTab().addStateChangeListener(this);
}
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals(GridTab.PROPERTY)) {
if (child.isCurrent()) {
child.getMTab().dataRefresh();
} else {
MRole role = MRole.getDefault();
child.query (false, 0, role.getMaxQueryRecords());
}
}
}
public void stateChange(StateChangeEvent event) {
if (child.isCurrent()) {
child.getMTab().dataRefresh();
} else {
MRole role = MRole.getDefault();
child.query (false, 0, role.getMaxQueryRecords());
}
}
}

View File

@ -119,6 +119,11 @@ public final class VCellEditor extends AbstractCellEditor
table.setRowSelectionInterval(row,row); // force moving to new row
if (m_editor == null)
createEditor();
if ( m_editor instanceof VLookup)
{
((VLookup)m_editor).setStopEditing(false);
}
m_table = table;
@ -211,4 +216,24 @@ public final class VCellEditor extends AbstractCellEditor
m_table = null;
} // dispose
@Override
public boolean stopCellEditing() {
if (super.stopCellEditing()) {
if (m_editor instanceof VLookup) {
((VLookup)m_editor).setStopEditing(true);
}
return true;
} else {
return false;
}
}
@Override
public void cancelCellEditing() {
super.cancelCellEditing();
if (m_editor instanceof VLookup) {
((VLookup)m_editor).setStopEditing(true);
}
}
} // VCellEditor

View File

@ -277,6 +277,8 @@ public class VLookup extends JComponent
private boolean m_comboActive = true;
/** The Value */
private Object m_value;
private boolean m_stopediting = false;
// Popup
JPopupMenu popupMenu = new JPopupMenu();
@ -530,6 +532,9 @@ public class VLookup extends JComponent
*/
public void propertyChange (PropertyChangeEvent evt)
{
if (m_stopediting)
return;
// log.fine( "VLookup.propertyChange", evt);
if (evt.getPropertyName().equals(GridField.PROPERTY))
{
@ -587,7 +592,7 @@ public class VLookup extends JComponent
*/
public void actionPerformed (ActionEvent e)
{
if (m_settingValue || m_settingFocus)
if (m_settingValue || m_settingFocus || m_stopediting)
return;
log.config(m_columnName + " - " + e.getActionCommand() + ", ComboValue=" + m_combo.getSelectedItem());
// log.fine("Hash=" + this.hashCode());
@ -1415,6 +1420,14 @@ public class VLookup extends JComponent
return m_lookup.refresh();
} // refresh
/**
* Use by vcelleditor to indicate editing is off and don't invoke databinding
* @param stopediting
*/
public void setStopEditing(boolean stopediting) {
m_stopediting = stopediting;
}
} // VLookup