Author: mes
Date: 2010-11-09 16:02:30 -0800 (Tue, 09 Nov 2010)
New Revision: 22791
Modified:
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/common/AbstractManualLayoutAction.java
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/GraphConverter2.java
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/control/ControlPanelAction.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:
manual layout now largely working
Modified:
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-09 22:54:03 UTC (rev 22790)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/ManualLayoutPlugin.java
2010-11-10 00:02:30 UTC (rev 22791)
@@ -69,10 +69,5 @@
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);
-
- // create the actions
- app.addAction( new RotatePanelAction(app,appMgr));
- app.addAction( new ScalePanelAction(app,appMgr));
- app.addAction( new ControlPanelAction(app,appMgr));
}
}
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-09 22:54:03 UTC (rev 22790)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/AbstractManualLayoutAction.java
2010-11-10 00:02:30 UTC (rev 22791)
@@ -45,6 +45,7 @@
import javax.swing.Action;
import javax.swing.JCheckBoxMenuItem;
import javax.swing.JMenu;
+import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
import javax.swing.SwingConstants;
@@ -73,8 +74,13 @@
private static int selectedIndex = -1;
+ private final CySwingApplication swingApp;
+
int menuIndex;
+ private final static String preferredMenu = "Layout";
+ private final String title;
+
/**
* Base class for displaying cytopanel menu items.
*
@@ -83,9 +89,11 @@
*/
public AbstractManualLayoutAction(String title, int menuIndex,
CySwingApplication swingApp, CyApplicationManager appMgr) {
super(title, appMgr);
+ this.title = title;
+ this.swingApp = swingApp;
manualLayoutPanel = swingApp.getCytoPanel(CytoPanelName.SOUTH_WEST);
this.menuIndex = menuIndex;
- setPreferredMenu("Layout");
+ setPreferredMenu(preferredMenu);
useCheckBoxMenuItem = true;
manualLayoutPanel.addCytoPanelListener(this);
}
@@ -118,30 +126,44 @@
}
}
+ private JCheckBoxMenuItem getThisItem() {
+ JMenu layouts = swingApp.getJMenu(preferredMenu);
+ for ( int i = 0; i < layouts.getItemCount(); i++ ) {
+ JMenuItem item = layouts.getItem(i);
+ if ( item.getText().equals(title) && item instanceof
JCheckBoxMenuItem) {
+ return (JCheckBoxMenuItem)item;
+ }
+ }
+ return null;
+ }
+
/**
* Enables of disables the action based on system state.
*
* @param ev Triggering event - not used.
-
+ */
public void menuSelected(MenuEvent e) {
- enableForNetworkAndView();
- JCheckBoxMenuItem item =
(JCheckBoxMenuItem)Cytoscape.getDesktop().getCyMenus().getLayoutMenu().getItem(menuIndex);
- if ( manualLayoutPanel.getSelectedIndex() != menuIndex ||
- manualLayoutPanel.getState() == CytoPanelState.HIDE )
- item.setState(false);
+ // set the check next to the menu item
+ JCheckBoxMenuItem item = getThisItem();
+ if ( item != null ) {
+ if ( manualLayoutPanel.getSelectedIndex() != menuIndex
||
+ manualLayoutPanel.getState() ==
CytoPanelState.HIDE )
+ item.setState(false);
+ else
+ item.setState(true);
+ }
+
+ // enable the menu based on cytopanel state
+ CytoPanelState parentState =
swingApp.getCytoPanel(CytoPanelName.WEST).getState();
+ if ( parentState == CytoPanelState.HIDE )
+ setEnabled(false);
else
- item.setState(true);
-
- CytoPanelState parentState =
Cytoscape.getDesktop().getCytoPanel(SwingConstants.WEST).getState();
- if ( parentState == CytoPanelState.HIDE ) {
- setEnabled(false);
- }
- else {
setEnabled(true);
- }
+ // enable the menu based on presence of network
+ enableForNetworkAndView();
}
-*/
+
/**
* Makes sure the menu check stays in sync with the selections made in
the cytopanel.
*
Modified:
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/GraphConverter2.java
===================================================================
---
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/GraphConverter2.java
2010-11-09 22:54:03 UTC (rev 22790)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/common/GraphConverter2.java
2010-11-10 00:02:30 UTC (rev 22791)
@@ -102,8 +102,8 @@
if ((!preserveEdgeAnchors)
&& (noNodesSelected
- ||
currentEdgeView.getModel().getSource().getCyRow().get(CyTableEntry.SELECTED,boolean.class)
- ||
currentEdgeView.getModel().getTarget().getCyRow().get(CyTableEntry.SELECTED,boolean.class)))
{
+ ||
currentEdgeView.getModel().getSource().getCyRow().get(CyTableEntry.SELECTED,Boolean.class)
+ ||
currentEdgeView.getModel().getTarget().getCyRow().get(CyTableEntry.SELECTED,Boolean.class)))
{
currentEdgeView.getBend().removeAllHandles();
} else {
List handles =
currentEdgeView.getBend().getHandles();
@@ -161,7 +161,7 @@
if (noNodesSelected)
return true;
- return
node.getCyRow().get(CyTableEntry.SELECTED,boolean.class);
+ return
node.getCyRow().get(CyTableEntry.SELECTED,Boolean.class);
}
public void setNodePosition(CyNode node, double
xPos, double yPos) {
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-09 22:54:03 UTC (rev 22790)
+++
core3/manual-layout-impl/trunk/src/main/java/org/cytoscape/view/manual/internal/control/ControlPanelAction.java
2010-11-10 00:02:30 UTC (rev 22791)
@@ -54,6 +54,6 @@
* Action for the Align and Distribute functionality. Should be in menu
slot 2.
*/
public ControlPanelAction(CySwingApplication swingApp,
CyApplicationManager appMgr) {
- super("Align and Distribute", 0, swingApp, appMgr);
+ super("Align and Distribute", 2, 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-09 22:54:03 UTC (rev 22790)
+++
core3/manual-layout-impl/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
2010-11-10 00:02:30 UTC (rev 22791)
@@ -12,4 +12,16 @@
<osgi:reference id="cyApplicationManagerServiceRef"
interface="org.cytoscape.session.CyApplicationManager" />
+ <osgi:service id="controlPanelActionService"
+ ref="controlPanelAction"
interface="org.cytoscape.view.CyAction">
+ </osgi:service>
+
+ <osgi:service id="scalePanelActionService"
+ ref="scalePanelAction" interface="org.cytoscape.view.CyAction">
+ </osgi:service>
+
+ <osgi:service id="rotatePanelActionService"
+ ref="rotatePanelAction" interface="org.cytoscape.view.CyAction">
+ </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-09 22:54:03 UTC (rev 22790)
+++
core3/manual-layout-impl/trunk/src/main/resources/META-INF/spring/bundle-context.xml
2010-11-10 00:02:30 UTC (rev 22791)
@@ -20,4 +20,22 @@
<constructor-arg ref="cyApplicationManagerServiceRef" />
</bean>
+ <bean id="controlPanelAction"
+
class="org.cytoscape.view.manual.internal.control.ControlPanelAction">
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ </bean>
+
+ <bean id="rotatePanelAction"
+
class="org.cytoscape.view.manual.internal.rotate.RotatePanelAction">
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ </bean>
+
+ <bean id="scalePanelAction"
+ class="org.cytoscape.view.manual.internal.scale.ScalePanelAction">
+ <constructor-arg ref="cySwingApplicationServiceRef" />
+ <constructor-arg ref="cyApplicationManagerServiceRef" />
+ </bean>
+
</beans>
--
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.