Author: mes
Date: 2010-02-10 16:46:54 -0800 (Wed, 10 Feb 2010)
New Revision: 19285
Modified:
coreplugins/trunk/ManualLayout/src/ManualLayout/common/AbstractManualLayoutAction.java
Log:
moved some of the tools cytopanel logic out of this plugin and into the core,
so that the tools cytopanel can be managed more sanely
Modified:
coreplugins/trunk/ManualLayout/src/ManualLayout/common/AbstractManualLayoutAction.java
===================================================================
---
coreplugins/trunk/ManualLayout/src/ManualLayout/common/AbstractManualLayoutAction.java
2010-02-11 00:19:59 UTC (rev 19284)
+++
coreplugins/trunk/ManualLayout/src/ManualLayout/common/AbstractManualLayoutAction.java
2010-02-11 00:46:54 UTC (rev 19285)
@@ -43,8 +43,7 @@
import cytoscape.graph.layout.algorithm.MutablePolyEdgeGraphLayout;
import cytoscape.util.CytoscapeAction;
import cytoscape.view.CytoscapeDesktop;
-import cytoscape.view.cytopanels.BiModalJSplitPane;
-import cytoscape.view.cytopanels.CytoPanelImp;
+import cytoscape.view.cytopanels.CytoPanel;
import cytoscape.view.cytopanels.CytoPanelListener;
import cytoscape.view.cytopanels.CytoPanelState;
import java.awt.Dimension;
@@ -64,26 +63,16 @@
/**
- * Base class for displaying cytopanel menu items.
+ * Base class for displaying cytopanel menu items. This class primarily
+ * manages the Layout Menu logic and tab selection of the tools cytopanel.
*/
-public abstract class AbstractManualLayoutAction extends CytoscapeAction
implements CytoPanelListener {
+public abstract class AbstractManualLayoutAction
+ extends CytoscapeAction
+ implements CytoPanelListener {
- // set up the cytopanel
- static protected CytoPanelImp cytoPanel1;
- static protected CytoPanelImp manualLayoutPanel;
- static protected BiModalJSplitPane split;
- static {
- cytoPanel1 = (CytoPanelImp)
Cytoscape.getDesktop().getCytoPanel(SwingConstants.WEST);
- manualLayoutPanel = (CytoPanelImp)
Cytoscape.getDesktop().getCytoPanel(SwingConstants.SOUTH_WEST);
- split = new BiModalJSplitPane(Cytoscape.getDesktop(),
JSplitPane.VERTICAL_SPLIT,
-
BiModalJSplitPane.MODE_HIDE_SPLIT, new JPanel(),
- manualLayoutPanel);
- split.setResizeWeight(0);
- manualLayoutPanel.setCytoPanelContainer(split);
- manualLayoutPanel.setMinimumSize(new Dimension(180, 230));
- manualLayoutPanel.setMaximumSize(new Dimension(180, 230));
- manualLayoutPanel.setPreferredSize(new Dimension(180, 230));
- }
+ static protected CytoPanel manualLayoutPanel =
+ Cytoscape.getDesktop().getCytoPanel(SwingConstants.SOUTH_WEST);
+
private static int selectedIndex = -1;
int menuIndex;
@@ -118,8 +107,6 @@
manualLayoutPanel.setSelectedIndex(menuIndex);
selectedIndex = menuIndex;
- cytoPanel1.addComponentToSouth(split);
-
// Case 2: Panel is in the DOCK/FLOAT and a different panel is
selected
} else if ( manualLayoutPanel.getSelectedIndex() != menuIndex )
{
manualLayoutPanel.setSelectedIndex(menuIndex);
@@ -129,13 +116,7 @@
} else {
manualLayoutPanel.setState(CytoPanelState.HIDE);
selectedIndex = -1;
-
- //Remove the manuallayoutPanel
- //removeComponentAtSouth(split) does not work,
overwrite it is a workaround
- cytoPanel1.addComponentToSouth(new
javax.swing.JLabel());
}
-
- cytoPanel1.validate();
}
/**
@@ -146,7 +127,8 @@
public void menuSelected(MenuEvent e) {
enableForNetworkAndView();
JCheckBoxMenuItem item =
(JCheckBoxMenuItem)Cytoscape.getDesktop().getCyMenus().getLayoutMenu().getItem(menuIndex);
- if ( selectedIndex != menuIndex )
+ if ( manualLayoutPanel.getSelectedIndex() != menuIndex ||
+ manualLayoutPanel.getState() == CytoPanelState.HIDE )
item.setState(false);
else
item.setState(true);
--
You received this message because you are subscribed to the Google Groups
"cytoscape-cvs" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/cytoscape-cvs?hl=en.