Author: mes
Date: 2010-11-09 13:50:54 -0800 (Tue, 09 Nov 2010)
New Revision: 22788
Added:
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/view/ToolCytoPanelListener.java
Modified:
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/view/CytoscapeDesktop.java
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
Log:
got tool cytopanel working
Modified:
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/view/CytoscapeDesktop.java
===================================================================
---
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/view/CytoscapeDesktop.java
2010-11-09 21:42:42 UTC (rev 22787)
+++
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/view/CytoscapeDesktop.java
2010-11-09 21:50:54 UTC (rev 22788)
@@ -69,6 +69,7 @@
private static final String SMALL_ICON = "/images/c16.png";
+ private static final int DEVIDER_SIZE = 4;
/**
* The network panel that sends out events when a network is selected
from
@@ -121,12 +122,8 @@
// create the CytoscapeDesktop
BiModalJSplitPane masterPane = setupCytoPanels(networkPanel,
networkViewManager);
- // note - proper networkViewManager has been properly selected
in
- // setupCytoPanels()
main_panel.add(masterPane, BorderLayout.CENTER);
main_panel.add(cyMenus.getJToolBar(), BorderLayout.NORTH);
-
- // Remove status bar.
setJMenuBar(cyMenus.getJMenuBar());
//don't automatically close window. Let shutdown.exit(returnVal)
@@ -134,6 +131,7 @@
setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
addWindowListener(new WindowAdapter() {
+ // TODO should use shutdown handler!!!
public void windowClosing(WindowEvent we) {
shutdown.exit(0);
}
@@ -162,6 +160,7 @@
BiModalJSplitPane topRightPane =
createTopRightPane(networkViewManager);
BiModalJSplitPane rightPane = createRightPane(topRightPane);
BiModalJSplitPane masterPane = createMasterPane(networkPanel,
rightPane);
+ createBottomLeft();
return masterPane;
}
@@ -178,10 +177,8 @@
cytoPanelEast = new CytoPanelImp(CytoPanelName.EAST,
JTabbedPane.TOP, CytoPanelState.HIDE);
// determine proper network view manager component
- Component networkViewComp = null;
+ Component networkViewComp = (Component)
networkViewManager.getDesktopPane();
- networkViewComp = (Component)
networkViewManager.getDesktopPane();
-
// create the split pane - we show this on startup
BiModalJSplitPane splitPane = new BiModalJSplitPane(this,
JSplitPane.HORIZONTAL_SPLIT,
BiModalJSplitPane.MODE_HIDE_SPLIT,
@@ -217,16 +214,34 @@
// set the cytopanel container
cytoPanelSouth.setCytoPanelContainer(splitPane);
+ splitPane.setDividerSize(DEVIDER_SIZE);
+
// set resize weight - top component gets all the extra space.
splitPane.setResizeWeight(1.0);
+ // outta here
+ return splitPane;
+ }
+
+ private void createBottomLeft() {
+
// create cytopanel with tabs along the top for manual layout
cytoPanelSouthWest = new CytoPanelImp(CytoPanelName.SOUTH_WEST,
JTabbedPane.TOP,
CytoPanelState.HIDE);
- // outta here
- return splitPane;
+ final BiModalJSplitPane split = new BiModalJSplitPane(this,
JSplitPane.VERTICAL_SPLIT,
+ BiModalJSplitPane.MODE_HIDE_SPLIT, new
JPanel(),
+ cytoPanelSouthWest);
+ split.setResizeWeight(0);
+ cytoPanelSouthWest.setCytoPanelContainer(split);
+ cytoPanelSouthWest.setMinimumSize(new Dimension(180, 330));
+ cytoPanelSouthWest.setMaximumSize(new Dimension(180, 330));
+ cytoPanelSouthWest.setPreferredSize(new Dimension(180, 330));
+
+ split.setDividerSize(DEVIDER_SIZE);
+
+ new ToolCytoPanelListener( split, (CytoPanelImp)cytoPanelWest,
cytoPanelSouthWest );
}
/**
@@ -253,6 +268,8 @@
BiModalJSplitPane.MODE_SHOW_SPLIT,
cytoPanelWest, rightPane);
+ splitPane.setDividerSize(DEVIDER_SIZE);
+
// set the cytopanel container
cytoPanelWest.setCytoPanelContainer(splitPane);
Added:
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/view/ToolCytoPanelListener.java
===================================================================
---
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/view/ToolCytoPanelListener.java
(rev 0)
+++
core3/swing-application-impl/trunk/src/main/java/org/cytoscape/internal/view/ToolCytoPanelListener.java
2010-11-09 21:50:54 UTC (rev 22788)
@@ -0,0 +1,81 @@
+
+/*
+ Copyright (c) 2010, The Cytoscape Consortium (www.cytoscape.org)
+
+ The Cytoscape Consortium is:
+ - Institute for Systems Biology
+ - University of California San Diego
+ - Memorial Sloan-Kettering Cancer Center
+ - Institut Pasteur
+ - Agilent Technologies
+
+ This library is free software; you can redistribute it and/or modify it
+ under the terms of the GNU Lesser General Public License as published
+ by the Free Software Foundation; either version 2.1 of the License, or
+ any later version.
+
+ This library is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF
+ MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. The software and
+ documentation provided hereunder is on an "as is" basis, and the
+ Institute for Systems Biology and the Whitehead Institute
+ have no obligations to provide maintenance, support,
+ updates, enhancements or modifications. In no event shall the
+ Institute for Systems Biology and the Whitehead Institute
+ be liable to any party for direct, indirect, special,
+ incidental or consequential damages, including lost profits, arising
+ out of the use of this software and its documentation, even if the
+ Institute for Systems Biology and the Whitehead Institute
+ have been advised of the possibility of such damage. See
+ the GNU Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public License
+ along with this library; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
+*/
+
+package org.cytoscape.internal.view;
+
+import org.cytoscape.view.CytoPanelListener;
+import org.cytoscape.view.CytoPanelState;
+import org.cytoscape.view.CytoPanel;
+
+import javax.swing.JLabel;
+
+
+/**
+ * This class handles the embedding of the Tools CytoPanel within the Control
+ * CytoPanel. For all other cytopanels this is handled by CytoPanelAction,
+ * but because tools panel is within another cytopanel, we have to handle
things
+ * separately.
+ */
+class ToolCytoPanelListener implements CytoPanelListener {
+
+ BiModalJSplitPane split;
+ CytoPanel southWest;
+ CytoPanelImp west;
+
+ ToolCytoPanelListener(BiModalJSplitPane split, CytoPanelImp west,
CytoPanel southWest) {
+ this.split = split;
+ this.west = west;
+ this.southWest = southWest;
+
+ southWest.addCytoPanelListener(this);
+ }
+
+
+ public void onStateChange(CytoPanelState newState) {
+
+ if (newState == CytoPanelState.DOCK)
+ west.addComponentToSouth(split);
+ else
+ // removeComponentAtSouth() doesn't work properly, so
we do this...
+ west.addComponentToSouth(new JLabel());
+
+ west.validate();
+ }
+
+ public void onComponentSelected(int componentIndex) {}
+ public void onComponentAdded(int count) {}
+ public void onComponentRemoved(int count) {}
+}
Modified:
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
---
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2010-11-09 21:42:42 UTC (rev 22787)
+++
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2010-11-09 21:50:54 UTC (rev 22788)
@@ -113,9 +113,10 @@
interface="org.cytoscape.view.CyAction" />
<osgi:service id="cytoPanelSouthActionService"
ref="cytoPanelSouthAction"
interface="org.cytoscape.view.CyAction" />
-
<osgi:service id="cytoPanelEastActionService" ref="cytoPanelEastAction"
interface="org.cytoscape.view.CyAction" />
+ <osgi:service id="cytoPanelSouthWestActionService"
ref="cytoPanelSouthWestAction"
+ interface="org.cytoscape.view.CyAction" />
<osgi:set id="cyActionSet" interface="org.cytoscape.view.CyAction"
cardinality="0..N">
Modified:
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
---
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2010-11-09 21:42:42 UTC (rev 22787)
+++
core3/swing-application-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2010-11-09 21:50:54 UTC (rev 22788)
@@ -221,6 +221,12 @@
<constructor-arg ref="cytoscapeDesktop" />
<constructor-arg ref="cyApplicationManagerServiceRef" />
</bean>
+ <bean id="cytoPanelSouthWestAction"
class="org.cytoscape.internal.actions.CytoPanelAction">
+ <constructor-arg type="org.cytoscape.view.CytoPanelName"
value="SOUTH_WEST" />
+ <constructor-arg value="false" />
+ <constructor-arg ref="cytoscapeDesktop" />
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ </bean>
<!-- Other stuff to be started -->
<bean id="undoMonitor"
class="org.cytoscape.internal.util.undo.UndoMonitor">
--
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.