Author: mmichaud
Date: 2009-04-02 07:57:42 -0700 (Thu, 02 Apr 2009)
New Revision: 16421

Modified:
   
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/AbstractGuiHandler.java
Log:


Modified: 
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/AbstractGuiHandler.java
===================================================================
--- 
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/AbstractGuiHandler.java
  2009-04-02 14:57:35 UTC (rev 16420)
+++ 
csplugins/trunk/pasteur/mathieu/tunables2/src/main/java/org/cytoscape/work/AbstractGuiHandler.java
  2009-04-02 14:57:42 UTC (rev 16421)
@@ -7,6 +7,7 @@
 import java.awt.event.ActionListener;
 import java.lang.reflect.Field;
 import java.util.LinkedList;
+import java.util.List;
 
 import javax.swing.JPanel;
 import javax.swing.event.ChangeEvent;
@@ -23,15 +24,25 @@
 
     private String depName;
     private String depState;
+    
+    private String depUnState;
 
-       private java.util.List<Guihandler> deps;
+       private List<Guihandler> deps;
 
        public AbstractGuiHandler(Field f, Object o, Tunable t) {
-               super(f,o,t);   
+               super(f,o,t);
         String s = t.dependsOn();
         if ( !s.equals("") ) {
-            depName = s.substring(0,s.indexOf("="));
-            depState = s.substring(s.indexOf("=") + 1);
+               if(!s.contains("!=")){
+                       depName = s.substring(0,s.indexOf("="));
+                       depState = s.substring(s.indexOf("=") + 1);
+                       depUnState = "";
+               }
+               else {
+                       depName = s.substring(0,s.indexOf("!"));
+                       depUnState = s.substring(s.indexOf("=")+1);
+                       depState = "";
+               }
         }
        
                deps = new LinkedList<Guihandler>();
@@ -40,19 +51,19 @@
 
        public void actionPerformed(ActionEvent ae) {
                //System.out.println(this.getName() + " actionPerformed");
+               notifyDependents();
                handle();
-               notifyDependents();
        }
 
        public void stateChanged(ChangeEvent e){
-               handle();
+               //handle();
                notifyDependents();
        }
        
     public void valueChanged(ListSelectionEvent le) {
        boolean ok = le.getValueIsAdjusting();
        if(!ok){
-               handle();
+               //handle();
                notifyDependents();
        }
     }
@@ -88,11 +99,25 @@
                // if the dependency name matches ...
         if ( depName.equals(name) ) {
                        // ... and the state matches, then enable 
-                       if ( depState.equals(state) )
-                               setEnabledContainer(true,panel); 
+               if(depState!=""){
+                       if ( depState.equals(state) ){
+                               setEnabledContainer(true,panel);
+                               handle();}
                        // ... and the state doesn't match, then disable 
-                       else    
-                               setEnabledContainer(false,panel); 
+                       else{
+                               setEnabledContainer(false,panel);
+                       }
+               }
+               else {
+                       if ( !depUnState.equals(state) ){
+                               setEnabledContainer(true,panel);
+                               handle();
+                       }
+                       // ... and the state doesn't match, then disable 
+                       else{
+                               setEnabledContainer(false,panel);
+                       }
+               }
                }
 
         return;


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