Author: mes
Date: 2010-11-10 14:33:35 -0800 (Wed, 10 Nov 2010)
New Revision: 22809
Added:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/AbstractManualPanel.java
Removed:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/ManualLayoutPlugin.java
Modified:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/AbstractManualLayoutAction.java
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/control/ControlPanel.java
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/control/ControlPanelAction.java
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/rotate/RotatePanel.java
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/rotate/RotatePanelAction.java
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/scale/ScalePanel.java
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/scale/ScalePanelAction.java
core3/manual-layout-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
core3/manual-layout-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
Log:
now everything is being registered as services
Deleted:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/ManualLayoutPlugin.java
===================================================================
---
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/ManualLayoutPlugin.java
2010-11-10 22:33:04 UTC (rev 22808)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/ManualLayoutPlugin.java
2010-11-10 22:33:35 UTC (rev 22809)
@@ -1,73 +0,0 @@
-
-/*
- Copyright (c) 2006, 2007, 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.view.manual.internal;
-
-import org.cytoscape.view.manual.internal.control.ControlPanel;
-import org.cytoscape.view.manual.internal.control.ControlPanelAction;
-import org.cytoscape.view.manual.internal.rotate.RotatePanel;
-import org.cytoscape.view.manual.internal.rotate.RotatePanelAction;
-import org.cytoscape.view.manual.internal.scale.ScalePanel;
-import org.cytoscape.view.manual.internal.scale.ScalePanelAction;
-
-
-import org.cytoscape.view.CySwingApplication;
-import org.cytoscape.view.CytoPanelName;
-import org.cytoscape.session.CyApplicationManager;
-
-
-
-/**
- *
- */
-public class ManualLayoutPlugin {
-
- /**
- * Creates a new ManualLayoutPlugin object.
- */
- public ManualLayoutPlugin(CySwingApplication app, CyApplicationManager
appMgr) {
-
- // create the panels
- RotatePanel rotatePanel = new RotatePanel(appMgr);
- ScalePanel scalePanel = new ScalePanel(appMgr);
- ControlPanel controlPanel = new ControlPanel(appMgr);
-
- // add them to the cytopanel
- app.getCytoPanel(CytoPanelName.SOUTH_WEST).add("Rotate",
rotatePanel);
- app.getCytoPanel(CytoPanelName.SOUTH_WEST).add("Scale",
scalePanel);
- app.getCytoPanel(CytoPanelName.SOUTH_WEST).add("Align and
Distribute", controlPanel);
- }
-}
Modified:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/AbstractManualLayoutAction.java
===================================================================
---
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/AbstractManualLayoutAction.java
2010-11-10 22:33:04 UTC (rev 22808)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/AbstractManualLayoutAction.java
2010-11-10 22:33:35 UTC (rev 22809)
@@ -58,7 +58,9 @@
import org.cytoscape.view.CytoPanel;
import org.cytoscape.view.CytoPanelState;
import org.cytoscape.view.CytoPanelName;
-import org.cytoscape.view.CytoPanelListener;
+import org.cytoscape.view.CytoPanelComponent;
+import org.cytoscape.view.events.CytoPanelComponentSelectedListener;
+import org.cytoscape.view.events.CytoPanelComponentSelectedEvent;
import org.cytoscape.session.CyApplicationManager;
@@ -68,7 +70,7 @@
*/
public abstract class AbstractManualLayoutAction
extends CytoscapeAction
- implements CytoPanelListener {
+ implements CytoPanelComponentSelectedListener {
static protected CytoPanel manualLayoutPanel;
@@ -76,26 +78,23 @@
private final CySwingApplication swingApp;
- int menuIndex;
-
private final static String preferredMenu = "Layout";
private final String title;
+ private final CytoPanelComponent comp;
/**
* Base class for displaying cytopanel menu items.
*
* @param title The title of the menu item.
- * @param menuIndex The desired menu index for the action.
*/
- public AbstractManualLayoutAction(String title, int menuIndex,
CySwingApplication swingApp, CyApplicationManager appMgr) {
- super(title, appMgr);
- this.title = title;
+ public AbstractManualLayoutAction(CytoPanelComponent comp,
CySwingApplication swingApp, CyApplicationManager appMgr) {
+ super(comp.getTitle(), appMgr);
+ this.title = comp.getTitle();
this.swingApp = swingApp;
+ this.comp = comp;
manualLayoutPanel = swingApp.getCytoPanel(CytoPanelName.SOUTH_WEST);
- this.menuIndex = menuIndex;
setPreferredMenu(preferredMenu);
useCheckBoxMenuItem = true;
- manualLayoutPanel.addCytoPanelListener(this);
}
/**
@@ -108,6 +107,8 @@
// Check the state of the manual layout Panel
CytoPanelState curState = manualLayoutPanel.getState();
+ int menuIndex =
manualLayoutPanel.indexOfComponent(comp.getComponent());
+
// Case 1: Panel is disabled
if (curState == CytoPanelState.HIDE) {
manualLayoutPanel.setState(CytoPanelState.DOCK);
@@ -145,6 +146,8 @@
public void menuSelected(MenuEvent e) {
// set the check next to the menu item
JCheckBoxMenuItem item = getThisItem();
+ int menuIndex =
manualLayoutPanel.indexOfComponent(comp.getComponent());
+
if ( item != null ) {
if ( manualLayoutPanel.getSelectedIndex() != menuIndex
||
manualLayoutPanel.getState() ==
CytoPanelState.HIDE )
@@ -169,11 +172,7 @@
*
* @param componentIndex the index of the menu
*/
- public void onComponentSelected(int componentIndex) {
- selectedIndex = componentIndex;
+ public void handleEvent(CytoPanelComponentSelectedEvent e) {
+ selectedIndex = e.getSelectedIndex();
}
-
- public void onStateChange(CytoPanelState newState) {}
- public void onComponentAdded(int count) {}
- public void onComponentRemoved(int count) {}
}
Added:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/AbstractManualPanel.java
===================================================================
---
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/AbstractManualPanel.java
(rev 0)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/AbstractManualPanel.java
2010-11-10 22:33:35 UTC (rev 22809)
@@ -0,0 +1,68 @@
+/*
+ Copyright (c) 2006, 2007, 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.view.manual.internal.common;
+
+import java.awt.Component;
+import javax.swing.JPanel;
+import javax.swing.Icon;
+import org.cytoscape.view.CytoPanelComponent;
+import org.cytoscape.view.CytoPanelName;
+
+public abstract class AbstractManualPanel extends JPanel implements
CytoPanelComponent {
+
+ private final String title;
+
+ public AbstractManualPanel(String title) {
+ super();
+ this.title = title;
+ }
+
+ public CytoPanelName getCytoPanelName() {
+ return CytoPanelName.SOUTH_WEST;
+ }
+
+ public String getTitle() {
+ return title;
+ }
+
+ public Component getComponent() {
+ return this;
+ }
+
+ public Icon getIcon() {
+ return null;
+ }
+}
Modified:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/control/ControlPanel.java
===================================================================
---
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/control/ControlPanel.java
2010-11-10 22:33:04 UTC (rev 22808)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/control/ControlPanel.java
2010-11-10 22:33:35 UTC (rev 22809)
@@ -39,6 +39,7 @@
import org.cytoscape.view.manual.internal.control.view.AlignPanel;
import org.cytoscape.view.manual.internal.control.view.DistPanel;
import org.cytoscape.view.manual.internal.control.view.StackPanel;
+import org.cytoscape.view.manual.internal.common.AbstractManualPanel;
import javax.swing.JPanel;
@@ -54,7 +55,7 @@
* Rewrite based on the class ControlAction 9/13/2006
Peng-Liang Wang
*
*/
-public class ControlPanel extends JPanel {
+public class ControlPanel extends AbstractManualPanel {
/**
*
@@ -65,6 +66,7 @@
* Creates a new ControlPanel object.
*/
public ControlPanel(CyApplicationManager app) {
+ super("Align and Distribute");
setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
setLayout(new GridLayout(3,1));
Modified:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/control/ControlPanelAction.java
===================================================================
---
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/control/ControlPanelAction.java
2010-11-10 22:33:04 UTC (rev 22808)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/control/ControlPanelAction.java
2010-11-10 22:33:35 UTC (rev 22809)
@@ -39,6 +39,7 @@
import org.cytoscape.view.manual.internal.common.AbstractManualLayoutAction;
import org.cytoscape.view.CySwingApplication;
import org.cytoscape.session.CyApplicationManager;
+import org.cytoscape.view.CytoPanelComponent;
/**
* Action for the Align and Distribute functionality.
@@ -53,7 +54,7 @@
/**
* Action for the Align and Distribute functionality. Should be in menu
slot 2.
*/
- public ControlPanelAction(CySwingApplication swingApp,
CyApplicationManager appMgr) {
- super("Align and Distribute", 2, swingApp, appMgr);
+ public ControlPanelAction(CytoPanelComponent comp, CySwingApplication
swingApp, CyApplicationManager appMgr) {
+ super(comp, swingApp, appMgr);
}
}
Modified:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/rotate/RotatePanel.java
===================================================================
---
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/rotate/RotatePanel.java
2010-11-10 22:33:04 UTC (rev 22808)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/rotate/RotatePanel.java
2010-11-10 22:33:35 UTC (rev 22809)
@@ -54,7 +54,7 @@
*
* Rewrite based on the class RotateAction 9/13/2006
Peng-Liang Wang
*/
-public class RotatePanel extends JPanel implements ChangeListener,
PolymorphicSlider {
+public class RotatePanel extends AbstractManualPanel implements
ChangeListener, PolymorphicSlider {
private JCheckBox jCheckBox;
private JSlider jSlider;
private int prevValue;
@@ -65,6 +65,7 @@
private final CyApplicationManager appMgr;
public RotatePanel(CyApplicationManager appMgr) {
+ super("Rotate");
this.appMgr = appMgr;
// set up the user interface
JLabel jLabel = new JLabel();
Modified:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/rotate/RotatePanelAction.java
===================================================================
---
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/rotate/RotatePanelAction.java
2010-11-10 22:33:04 UTC (rev 22808)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/rotate/RotatePanelAction.java
2010-11-10 22:33:35 UTC (rev 22809)
@@ -39,6 +39,7 @@
import org.cytoscape.session.CyApplicationManager;
import org.cytoscape.view.CySwingApplication;
import org.cytoscape.view.manual.internal.common.AbstractManualLayoutAction;
+import org.cytoscape.view.CytoPanelComponent;
/**
* Rotate network action.
@@ -48,7 +49,7 @@
/**
* Rotate network action. Should be in menu slot 0.
*/
- public RotatePanelAction(CySwingApplication swingApp,
CyApplicationManager appMgr) {
- super("Rotate",0,swingApp, appMgr);
+ public RotatePanelAction(CytoPanelComponent comp, CySwingApplication
swingApp, CyApplicationManager appMgr) {
+ super(comp,swingApp, appMgr);
}
}
Modified:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/scale/ScalePanel.java
===================================================================
---
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/scale/ScalePanel.java
2010-11-10 22:33:04 UTC (rev 22808)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/scale/ScalePanel.java
2010-11-10 22:33:35 UTC (rev 22809)
@@ -64,7 +64,7 @@
* Rewrite based on the class ScaleAction 9/13/2006
Peng-Liang Wang
*
*/
-public class ScalePanel extends JPanel implements ChangeListener,
PolymorphicSlider {
+public class ScalePanel extends AbstractManualPanel implements ChangeListener,
PolymorphicSlider {
private JCheckBox jCheckBox;
private JSlider jSlider;
private JRadioButton alongXAxisOnlyRadioButton;
@@ -79,6 +79,7 @@
private final CyApplicationManager appMgr;
public ScalePanel(CyApplicationManager appMgr) {
+ super("Scale");
this.appMgr = appMgr;
JLabel jLabel = new JLabel();
jLabel.setText("Scale:");
Modified:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/scale/ScalePanelAction.java
===================================================================
---
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/scale/ScalePanelAction.java
2010-11-10 22:33:04 UTC (rev 22808)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/scale/ScalePanelAction.java
2010-11-10 22:33:35 UTC (rev 22809)
@@ -39,6 +39,7 @@
import org.cytoscape.session.CyApplicationManager;
import org.cytoscape.view.CySwingApplication;
import org.cytoscape.view.manual.internal.common.AbstractManualLayoutAction;
+import org.cytoscape.view.CytoPanelComponent;
/**
* Scale network action.
@@ -53,7 +54,7 @@
/**
* Scale network action. Should be in menu slot 1.
*/
- public ScalePanelAction(CySwingApplication swingApp,
CyApplicationManager appMgr) {
- super("Scale",1, swingApp, appMgr);
+ public ScalePanelAction(CytoPanelComponent comp, CySwingApplication
swingApp, CyApplicationManager appMgr) {
+ super(comp, swingApp, appMgr);
}
}
Modified:
core3/manual-layout-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
---
core3/manual-layout-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2010-11-10 22:33:04 UTC (rev 22808)
+++
core3/manual-layout-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2010-11-10 22:33:35 UTC (rev 22809)
@@ -12,16 +12,37 @@
<osgi:reference id="cyApplicationManagerServiceRef"
interface="org.cytoscape.session.CyApplicationManager" />
- <osgi:service id="controlPanelActionService"
- ref="controlPanelAction"
interface="org.cytoscape.view.CyAction">
+ <osgi:service id="controlPanelActionService" ref="controlPanelAction" >
+ <osgi:interfaces>
+ <value>org.cytoscape.view.CyAction</value>
+
<value>org.cytoscape.view.events.CytoPanelComponentSelectedListener</value>
+ </osgi:interfaces>
</osgi:service>
- <osgi:service id="scalePanelActionService"
- ref="scalePanelAction" interface="org.cytoscape.view.CyAction">
+ <osgi:service id="scalePanelActionService" ref="scalePanelAction" >
+ <osgi:interfaces>
+ <value>org.cytoscape.view.CyAction</value>
+
<value>org.cytoscape.view.events.CytoPanelComponentSelectedListener</value>
+ </osgi:interfaces>
</osgi:service>
- <osgi:service id="rotatePanelActionService"
- ref="rotatePanelAction" interface="org.cytoscape.view.CyAction">
+ <osgi:service id="rotatePanelActionService" ref="rotatePanelAction">
+ <osgi:interfaces>
+ <value>org.cytoscape.view.CyAction</value>
+
<value>org.cytoscape.view.events.CytoPanelComponentSelectedListener</value>
+ </osgi:interfaces>
</osgi:service>
+ <osgi:service id="controlPanelService"
+ ref="controlPanel"
interface="org.cytoscape.view.CytoPanelComponent">
+ </osgi:service>
+
+ <osgi:service id="scalePanelService"
+ ref="scalePanel"
interface="org.cytoscape.view.CytoPanelComponent">
+ </osgi:service>
+
+ <osgi:service id="rotatePanelService"
+ ref="rotatePanel"
interface="org.cytoscape.view.CytoPanelComponent">
+ </osgi:service>
+
</beans>
Modified:
core3/manual-layout-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
---
core3/manual-layout-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2010-11-10 22:33:04 UTC (rev 22808)
+++
core3/manual-layout-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2010-11-10 22:33:35 UTC (rev 22809)
@@ -15,25 +15,35 @@
<context:annotation-config/>
- <bean id="manualLayoutPlugin"
class="org.cytoscape.view.manual.internal.ManualLayoutPlugin">
- <constructor-arg ref="cySwingApplicationServiceRef" />
+ <bean id="controlPanel"
class="org.cytoscape.view.manual.internal.control.ControlPanel">
<constructor-arg ref="cyApplicationManagerServiceRef" />
</bean>
+ <bean id="rotatePanel"
class="org.cytoscape.view.manual.internal.rotate.RotatePanel">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ </bean>
+
+ <bean id="scalePanel"
class="org.cytoscape.view.manual.internal.scale.ScalePanel">
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ </bean>
+
<bean id="controlPanelAction"
class="org.cytoscape.view.manual.internal.control.ControlPanelAction">
+ <constructor-arg ref="controlPanel" />
<constructor-arg ref="cySwingApplicationServiceRef" />
<constructor-arg ref="cyApplicationManagerServiceRef" />
</bean>
<bean id="rotatePanelAction"
class="org.cytoscape.view.manual.internal.rotate.RotatePanelAction">
+ <constructor-arg ref="rotatePanel" />
<constructor-arg ref="cySwingApplicationServiceRef" />
<constructor-arg ref="cyApplicationManagerServiceRef" />
</bean>
<bean id="scalePanelAction"
class="org.cytoscape.view.manual.internal.scale.ScalePanelAction">
+ <constructor-arg ref="scalePanel" />
<constructor-arg ref="cySwingApplicationServiceRef" />
<constructor-arg ref="cyApplicationManagerServiceRef" />
</bean>
--
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.