Author: scooter
Date: 2011-10-07 18:33:24 -0700 (Fri, 07 Oct 2011)
New Revision: 27098

Modified:
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/CyChimera.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/OpenTask.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/GraphObjectSelectionListener.java
   
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ModelNavigatorDialog.java
Log:
Fixes for various problems discovered while preparing for the Advisory 
Committee Meeting.


Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java 
    2011-10-08 00:08:57 UTC (rev 27097)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/Chimera.java 
    2011-10-08 01:33:24 UTC (rev 27098)
@@ -40,7 +40,6 @@
 import java.util.Map;
 import java.util.Set;
 import java.io.*;
-import javax.swing.JOptionPane;
 import java.awt.Color;
 
 import cytoscape.Cytoscape;
@@ -456,6 +455,7 @@
                        chimeraSend("listen stop models; listen stop select; 
close #"+model+"."+subModel);
                }
                chimeraSend("listen start models; listen start select");
+               Structure.close(structure);
                return;
        }
 
@@ -498,6 +498,10 @@
                chimera.getOutputStream().flush();
                } catch (IOException e) {
                        CyLogger.getLogger(Chimera.class).warning("Unable to 
execute command: "+text);
+                       CyLogger.getLogger(Chimera.class).warning("Exiting...");
+                       chimera = null;
+                       if (mnDialog != null)
+                               mnDialog.lostChimera();
                }
 
                return listener.getResponse(command);
@@ -516,6 +520,10 @@
                chimera.getOutputStream().flush();
                } catch (IOException e) {
                        CyLogger.getLogger(Chimera.class).warning("Unable to 
execute command: "+text);
+                       CyLogger.getLogger(Chimera.class).warning("Exiting...");
+                       chimera = null;
+                       if (mnDialog != null)
+                               mnDialog.lostChimera();
                }
                return;
        }
@@ -538,6 +546,8 @@
 
                if (mnDialog != null)
                        mnDialog.setVisible(false);
+
+               Structure.closeAll();
   }
 
        /**

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/CyChimera.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/CyChimera.java
   2011-10-08 00:08:57 UTC (rev 27097)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/CyChimera.java
   2011-10-08 01:33:24 UTC (rev 27098)
@@ -528,7 +528,7 @@
                                             boolean state) {
                for (GraphObject obj: goList) {
                        if (obj instanceof Node) {
-                               // Handle secondary paint??
+                               // TODO: Handle secondary paint??
                                NodeView nv = view.getNodeView((Node)obj);
                                if (nv != null)
                                        nv.setSelected(state);

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/OpenTask.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/OpenTask.java
    2011-10-08 00:08:57 UTC (rev 27097)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/actions/OpenTask.java
    2011-10-08 01:33:24 UTC (rev 27098)
@@ -66,7 +66,7 @@
                        // See if this structure is already open somewhere
                        Structure s = CyChimera.findStructureForModel(null, 
structureName, false);
                        if (s != null) {
-                               // System.out.println("Found existing 
structure: "+s.toString());
+                               // System.out.println("Found existing 
structure: "+s.toString()+", model = "+s.modelNumber());
                                s.addStructure(structure);
                                structure = s;
                        }

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java 
    2011-10-08 00:08:57 UTC (rev 27097)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/model/Structure.java 
    2011-10-08 01:33:24 UTC (rev 27098)
@@ -62,10 +62,25 @@
        /**
         * Get the next available model number
         *
+        * TODO: This really should be a table of models based
+        * on what the Chimera module tells us.
+        *
         * @return the next model number
         */
        public static int getNextModel() {return nextModel++;}
 
+       public static void closeAll() {
+               nextModel = 0;
+               structureMap.clear();
+       }
+
+       public static void close(Structure structure) {
+               if (structureMap.containsKey(structure.name()))
+                       structureMap.remove(structure.name());
+
+               if (structureMap.size() == 0) nextModel = 0;
+       }
+
        public static Structure getStructure(String name, CyNode node, 
                                             StructureType type) {
                // System.out.println("Getting structure for "+name);

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/GraphObjectSelectionListener.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/GraphObjectSelectionListener.java
     2011-10-08 00:08:57 UTC (rev 27097)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/GraphObjectSelectionListener.java
     2011-10-08 01:33:24 UTC (rev 27098)
@@ -114,7 +114,7 @@
                }
                // System.out.println("SelectionMap has "+selectionMap.size()+ 
" values");
                setResidueSelection(chimera, selectionMap.values());
-               chimera.modelChanged();
+               // chimera.modelChanged();
        }
 
        private String getSelectionString(Chimera chimera, Structure structure, 
@@ -147,6 +147,6 @@
                        }
                }
                // System.out.println("Selection command: "+command);
-               chimera.selectNoReply(command);
+               chimera.chimeraSendNoReply(command);
        }
 }

Modified: 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ModelNavigatorDialog.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ModelNavigatorDialog.java
     2011-10-08 00:08:57 UTC (rev 27097)
+++ 
csplugins/trunk/ucsf/scooter/structureViz/src/structureViz/ui/ModelNavigatorDialog.java
     2011-10-08 01:33:24 UTC (rev 27098)
@@ -120,6 +120,7 @@
                return mnDialog;
        }
 
+
        /**
         * Create a new ModelNavigatorDialog.
         *
@@ -136,6 +137,17 @@
        }
 
        /**
+        * We lost our connection to Chimera!  Tell the user and exit.
+        */
+       public void lostChimera() {
+               JOptionPane.showMessageDialog(this, 
+                                             "Lost connection to Chimera! 
structureViz must exit",
+                                             "Lost connection",
+                                             JOptionPane.ERROR_MESSAGE);
+               chimeraObject.exit();
+       }
+
+       /**
         * Call this method when something significant has changed in the model
         * such as a new model opened or closed
         */

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