Author: ghuck
Date: 2011-09-04 19:18:16 -0700 (Sun, 04 Sep 2011)
New Revision: 26722

Added:
   
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/AboutDialog.java
Modified:
   
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/IgraphPlugin.java
   
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/IsConnected.java
   
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/MinimumSpanningTree.java
Log:
Small changes as part of the pre-publish process

Added: 
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/AboutDialog.java
===================================================================
--- 
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/AboutDialog.java
                                (rev 0)
+++ 
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/AboutDialog.java
        2011-09-05 02:18:16 UTC (rev 26722)
@@ -0,0 +1,52 @@
+/**************************************************************************************
+Copyright (C) Gerardo Huck, 2011
+
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program 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.  See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+**************************************************************************************/
+
+package cytoscape.plugins.igraph;
+
+import java.awt.event.ActionEvent;
+import javax.swing.JOptionPane;
+import java.util.*;
+
+import cytoscape.Cytoscape;
+import cytoscape.*;
+import cytoscape.data.*;
+import cytoscape.plugin.CytoscapePlugin;
+import cytoscape.util.CytoscapeAction;
+
+import giny.model.*;
+
+
+public class AboutDialog extends CytoscapeAction {
+    
+    public AboutDialog() {
+       super("About");
+       setPreferredMenu("Plugins.Igraph");
+    }
+       
+    public void actionPerformed(ActionEvent e) {
+
+       String message = "This plugin was developed as part of Google Summer of 
Code 2011 by Gerardo Huck\n" + 
+                        "You may find further information at the following 
address:\n" +
+                        
"http://plato.cgl.ucsf.edu/trac/GenMAPP/wiki/GerardoHuck";;         
+           
+       JOptionPane.showMessageDialog( Cytoscape.getDesktop(), message);
+    }
+    
+    
+}      

Modified: 
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/IgraphPlugin.java
===================================================================
--- 
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/IgraphPlugin.java
       2011-09-02 22:33:12 UTC (rev 26721)
+++ 
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/IgraphPlugin.java
       2011-09-05 02:18:16 UTC (rev 26722)
@@ -85,11 +85,15 @@
            
            // Layouts
            CyLayouts.addLayout(new CircleLayout(),                       
"Igraph");
-           CyLayouts.addLayout(new StarLayout(),                         
"Igraph");
+           //      CyLayouts.addLayout(new StarLayout(),                       
  "Igraph");
            CyLayouts.addLayout(new FruchtermanReingoldLayout(true),      
"Igraph");
            CyLayouts.addLayout(new FruchtermanReingoldGridLayout(true),  
"Igraph");
            CyLayouts.addLayout(new LGLLayout(),                          
"Igraph");
            
+           // About Dialog
+           AboutDialog dialogMenu = new AboutDialog();
+           
Cytoscape.getDesktop().getCyMenus().addCytoscapeAction((CytoscapeAction) 
dialogMenu);
+           
        } catch (Exception e) {
            e.printStackTrace();
            String message = "Error while initializing Igraph Plugin:\n" + 
e.getMessage(); 

Modified: 
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/IsConnected.java
===================================================================
--- 
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/IsConnected.java
        2011-09-02 22:33:12 UTC (rev 26721)
+++ 
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/IsConnected.java
        2011-09-05 02:18:16 UTC (rev 26722)
@@ -47,7 +47,27 @@
     }
        
     public void actionPerformed(ActionEvent e) {
-       JOptionPane.showMessageDialog(Cytoscape.getDesktop(), "Is Connected?: " 
+ isConnected(this.selectedOnly));
+       // Check whether there are any nodes to analyze
+       CyNetwork network = Cytoscape.getCurrentNetwork();
+       int numNodes;
+       
+       if (selectedOnly)           
+           numNodes = network.getSelectedNodes().size();
+       else 
+           numNodes = network.getNodeCount();
+
+       if (numNodes == 0) {
+           JOptionPane.showMessageDialog(Cytoscape.getDesktop(), 
+                                         "No nodes selected!");
+           return;
+       }
+
+       boolean res = isConnected(this.selectedOnly);
+       
+       if (res)
+           JOptionPane.showMessageDialog(Cytoscape.getDesktop(), "The nodes 
are connected!");
+       else 
+           JOptionPane.showMessageDialog(Cytoscape.getDesktop(), "The nodes 
are NOT connected!");
     }
     
     public boolean isConnected(boolean selectedOnly) {

Modified: 
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/MinimumSpanningTree.java
===================================================================
--- 
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/MinimumSpanningTree.java
        2011-09-02 22:33:12 UTC (rev 26721)
+++ 
csplugins/trunk/soc/ghuck/IgraphPlugin/src/cytoscape/plugins/igraph/MinimumSpanningTree.java
        2011-09-05 02:18:16 UTC (rev 26722)
@@ -71,6 +71,12 @@
            else
                numNodes = network.getNodeCount();
 
+           /*          Check that there are any nodes          */
+           if (numNodes == 0) {
+               JOptionPane.showMessageDialog(Cytoscape.getDesktop(), "ERROR: 
No nodes selected or empty network!");
+               return;
+           }
+
            /*          Load graph into Igraph library          */
            HashMap<Integer,Integer> mapping = 
IgraphAPI.loadGraph(selectedOnly, false);
 

-- 
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.

Reply via email to