Author: clopes
Date: 2012-07-16 08:53:00 -0700 (Mon, 16 Jul 2012)
New Revision: 29906
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/AbstractMCODEAction.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/CyActivator.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAnalyzeAction.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/MCODEUtil.java
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/view/MCODEResultsPanel.java
Log:
Fixed bug that would disable the Analyze action after loading a new session.
Fixed bug that woundn't allow node selection from MCODE's results panel when
the analyzed network had no view.
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/AbstractMCODEAction.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/AbstractMCODEAction.java
2012-07-15 22:20:17 UTC (rev 29905)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/AbstractMCODEAction.java
2012-07-16 15:53:00 UTC (rev 29906)
@@ -5,6 +5,7 @@
import org.cytoscape.application.CyApplicationManager;
import org.cytoscape.application.swing.AbstractCyAction;
+import org.cytoscape.application.swing.ActionEnableSupport;
import org.cytoscape.application.swing.CySwingApplication;
import org.cytoscape.application.swing.CytoPanel;
import org.cytoscape.application.swing.CytoPanelName;
@@ -24,7 +25,7 @@
final
CyApplicationManager applicationManager,
final
CySwingApplication swingApplication,
final
CyNetworkViewManager netViewManager) {
- super(name, applicationManager, "network", netViewManager);
+ super(name, applicationManager,
ActionEnableSupport.ENABLE_FOR_NETWORK, netViewManager);
this.applicationManager = applicationManager;
this.swingApplication = swingApplication;
this.netViewManager = netViewManager;
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/CyActivator.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/CyActivator.java
2012-07-15 22:20:17 UTC (rev 29905)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/CyActivator.java
2012-07-16 15:53:00 UTC (rev 29906)
@@ -3,6 +3,7 @@
import java.util.Properties;
import org.cytoscape.application.CyApplicationManager;
+import org.cytoscape.application.events.SetCurrentNetworkListener;
import org.cytoscape.application.swing.CyAction;
import org.cytoscape.application.swing.CySwingApplication;
import
org.cytoscape.application.swing.events.CytoPanelComponentSelectedListener;
@@ -11,8 +12,6 @@
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNetworkManager;
import org.cytoscape.model.events.NetworkAboutToBeDestroyedListener;
-import org.cytoscape.model.events.NetworkAddedListener;
-import org.cytoscape.model.events.NetworkDestroyedListener;
import org.cytoscape.model.subnetwork.CyRootNetworkManager;
import org.cytoscape.service.util.AbstractCyActivator;
import org.cytoscape.service.util.CyServiceRegistrar;
@@ -75,8 +74,7 @@
registerService(bc, closeAction,
NetworkAboutToBeDestroyedListener.class, new Properties());
registerService(bc, helpAction, CyAction.class, new
Properties());
registerService(bc, aboutAction, CyAction.class, new
Properties());
- registerService(bc, analyzeAction, NetworkAddedListener.class,
new Properties());
- registerService(bc, analyzeAction,
NetworkDestroyedListener.class, new Properties());
+ registerService(bc, analyzeAction,
SetCurrentNetworkListener.class, new Properties());
registerService(bc, visualStyleAction, CyAction.class, new
Properties());
registerService(bc, visualStyleAction,
CytoPanelComponentSelectedListener.class, new Properties());
}
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAnalyzeAction.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAnalyzeAction.java
2012-07-15 22:20:17 UTC (rev 29905)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/MCODEAnalyzeAction.java
2012-07-16 15:53:00 UTC (rev 29906)
@@ -8,6 +8,8 @@
import javax.swing.JOptionPane;
import org.cytoscape.application.CyApplicationManager;
+import org.cytoscape.application.events.SetCurrentNetworkEvent;
+import org.cytoscape.application.events.SetCurrentNetworkListener;
import org.cytoscape.application.swing.CySwingApplication;
import org.cytoscape.application.swing.CytoPanel;
import org.cytoscape.application.swing.CytoPanelComponent;
@@ -22,10 +24,6 @@
import org.cytoscape.mcode.internal.view.MCODEResultsPanel;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
-import org.cytoscape.model.events.NetworkAddedEvent;
-import org.cytoscape.model.events.NetworkAddedListener;
-import org.cytoscape.model.events.NetworkDestroyedEvent;
-import org.cytoscape.model.events.NetworkDestroyedListener;
import org.cytoscape.service.util.CyServiceRegistrar;
import org.cytoscape.view.model.CyNetworkView;
import org.cytoscape.view.model.CyNetworkViewManager;
@@ -72,8 +70,7 @@
/**
* Simple score and find action for MCODE. This should be the default for
general users.
*/
-public class MCODEAnalyzeAction extends AbstractMCODEAction implements
NetworkAddedListener,
- NetworkDestroyedListener {
+public class MCODEAnalyzeAction extends AbstractMCODEAction implements
SetCurrentNetworkListener {
private static final long serialVersionUID = 87924889404093104L;
@@ -238,8 +235,7 @@
mcodeUtil);
resultsPanel = new
MCODEResultsPanel(e.getClusters(), alg, mcodeUtil, network, networkView,
-
e.getImageList(), resultId,
swingApplication,
-
discardResultAction);
+
e.getImageList(), resultId,
discardResultAction);
registrar.registerService(resultsPanel, CytoPanelComponent.class, new
Properties());
} else {
@@ -274,12 +270,7 @@
}
@Override
- public void handleEvent(NetworkAddedEvent e) {
+ public void handleEvent(SetCurrentNetworkEvent e) {
updateEnableState();
}
-
- @Override
- public void handleEvent(NetworkDestroyedEvent e) {
- updateEnableState();
- }
}
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/MCODEUtil.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/MCODEUtil.java
2012-07-15 22:20:17 UTC (rev 29905)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/util/MCODEUtil.java
2012-07-16 15:53:00 UTC (rev 29906)
@@ -538,7 +538,7 @@
tbl.addVirtualColumn("MCODE_Score", "MCODE_Score",
parentTbl, CyNetwork.SUID, false);
}
- @SuppressWarnings("unchecked")
+ @SuppressWarnings({ "unchecked", "rawtypes" })
public VisualStyle getClusterStyle() {
if (clusterStyle == null) {
clusterStyle =
visualStyleFactory.createVisualStyle("MCODE Cluster");
@@ -622,10 +622,9 @@
}
}
- @SuppressWarnings("unchecked")
- public void setSelected(final Collection<? extends CyIdentifiable>
elements, CyNetwork network, CyNetworkView view) {
- Collection<? extends CyIdentifiable> allElements = new
ArrayList<CyIdentifiable>(network.getNodeList());
- allElements.addAll((Collection) network.getEdgeList());
+ public void setSelected(final Collection<? extends CyIdentifiable>
elements, CyNetwork network) {
+ final Collection<CyIdentifiable> allElements = new
ArrayList<CyIdentifiable>(network.getNodeList());
+ allElements.addAll(network.getEdgeList());
for (final CyIdentifiable nodeOrEdge : allElements) {
boolean select = elements.contains(nodeOrEdge);
@@ -634,10 +633,13 @@
eventHelper.flushPayloadEvents();
- if (view != null) {
+ final Collection<CyNetworkView> netViews =
networkViewMgr.getNetworkViews(network);
+
+ for (final CyNetworkView view : netViews) {
view.updateView();
- swingApplication.getJFrame().repaint(); // TODO: remove
this ugly hack!!!
}
+
+ swingApplication.getJFrame().repaint(); // TODO: remove this
ugly hack!!!
}
public void interruptLoading() {
Modified:
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/view/MCODEResultsPanel.java
===================================================================
---
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/view/MCODEResultsPanel.java
2012-07-15 22:20:17 UTC (rev 29905)
+++
csplugins/trunk/toronto/clopes/mcode/src/main/java/org/cytoscape/mcode/internal/view/MCODEResultsPanel.java
2012-07-16 15:53:00 UTC (rev 29906)
@@ -36,7 +36,6 @@
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
-import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JSlider;
@@ -53,7 +52,6 @@
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableCellRenderer;
-import org.cytoscape.application.swing.CySwingApplication;
import org.cytoscape.application.swing.CytoPanelComponent;
import org.cytoscape.application.swing.CytoPanelName;
import org.cytoscape.mcode.internal.MCODEDiscardResultAction;
@@ -140,7 +138,6 @@
private MCODELoader loader;
private final MCODEUtil mcodeUtil;
- private final CySwingApplication swingApplication;
private final MCODEDiscardResultAction discardResultAction;
/**
@@ -160,7 +157,6 @@
CyNetworkView
networkView,
Image[] imageList,
int resultId,
- final
CySwingApplication swingApplication,
final
MCODEDiscardResultAction discardResultAction) {
setLayout(new BorderLayout());
@@ -171,7 +167,6 @@
this.network = network;
// The view may not exist, but we only test for that when we
need to (in the TableRowSelectionHandler below)
this.networkView = networkView;
- this.swingApplication = swingApplication;
this.discardResultAction = discardResultAction;
currentParamsCopy =
mcodeUtil.getCurrentParameters().getResultParams(resultId);
@@ -912,28 +907,19 @@
public void selectCluster(final CyNetwork custerNetwork) {
if (custerNetwork != null) {
// Only do this if a view has been created on this
network
- if (networkView != null) {
- // start with no selected nodes
- //
mcodeUtil.setSelected(network.getNodeList(), false, networkView);
-
mcodeUtil.setSelected(custerNetwork.getNodeList(), network, networkView);
+ // start with no selected nodes
+ //
mcodeUtil.setSelected(network.getNodeList(), false, networkView);
+ mcodeUtil.setSelected(custerNetwork.getNodeList(),
network);
- // TODO: is it still necessary?
- // We want the focus to switch to the
appropriate network view but only if the cytopanel is docked
- // If it is not docked then it is best if the
focus stays on the panel
- // if
(swingApplication.getCytoPanel(CytoPanelName.EAST).getState() ==
CytoPanelState.DOCK) {
- //
- //
Cytoscape.getDesktop().setFocus(networkView.getSUID());
- // }
- } else {
- // Warn user that nothing will happen in this
case because there
- // is no view to select nodes with
-
JOptionPane.showMessageDialog(swingApplication.getJFrame(),
-
"You must have a network view\ncreated to select nodes.",
-
"No Network View",
-
JOptionPane.INFORMATION_MESSAGE);
- }
+ // TODO: is it still necessary?
+ // We want the focus to switch to the appropriate
network view but only if the cytopanel is docked
+ // If it is not docked then it is best if the focus
stays on the panel
+ // if
(swingApplication.getCytoPanel(CytoPanelName.EAST).getState() ==
CytoPanelState.DOCK) {
+ //
+ //
Cytoscape.getDesktop().setFocus(networkView.getSUID());
+ // }
} else {
- mcodeUtil.setSelected(new ArrayList<CyIdentifiable>(),
network, networkView); // deselect all
+ mcodeUtil.setSelected(new ArrayList<CyIdentifiable>(),
network); // deselect all
}
}
--
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.