Author: rozagh
Date: 2012-07-26 15:42:58 -0700 (Thu, 26 Jul 2012)
New Revision: 30012

Modified:
   
core3/api/trunk/work-swing-api/src/main/java/org/cytoscape/work/swing/DirectlyPresentableTunableHandler.java
   
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/BooleanHandler.java
   
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/FileHandler.java
   
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/JPanelTunableMutator.java
Log:
fixes #1307 A new method is added to the DirectlyPresentableTunableHandler 
which checks if the tunable has been forced to set directly. This way, we can 
prevent single tunables in tasks that needs to be added to the parent panel. 

In BooleanHandler, a new param value named ForceSetDirectly is checked, but in 
FileHandler the check always returns true. 

Modified: 
core3/api/trunk/work-swing-api/src/main/java/org/cytoscape/work/swing/DirectlyPresentableTunableHandler.java
===================================================================
--- 
core3/api/trunk/work-swing-api/src/main/java/org/cytoscape/work/swing/DirectlyPresentableTunableHandler.java
        2012-07-26 22:15:36 UTC (rev 30011)
+++ 
core3/api/trunk/work-swing-api/src/main/java/org/cytoscape/work/swing/DirectlyPresentableTunableHandler.java
        2012-07-26 22:42:58 UTC (rev 30012)
@@ -10,4 +10,15 @@
         */
        boolean setTunableDirectly(Window possibleParent);
        
+       /**
+        * If this method returns true, the boolean will be presented
+        * to set directly from GUI without being a part of a parent panel.
+        * This method can be controlled by the param field available in
+        * tunables. For instance, in Boolean tunable if parameter
+        * "ForceSetDirectly"="true" is defined, the tunable will be
+        * set directly.  
+        * @return
+        */
+       boolean isForcedToSetDirectly();
+       
 }

Modified: 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/BooleanHandler.java
===================================================================
--- 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/BooleanHandler.java
        2012-07-26 22:15:36 UTC (rev 30011)
+++ 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/BooleanHandler.java
        2012-07-26 22:42:58 UTC (rev 30012)
@@ -91,6 +91,11 @@
                }
        }
        
+       
+       @Override
+       public boolean isForcedToSetDirectly() {
+               return getParams().getProperty("ForceSetDirectly", 
"false").equalsIgnoreCase("true");
+       }
 
        @Override
        public boolean setTunableDirectly(Window possibleParent) {

Modified: 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/FileHandler.java
===================================================================
--- 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/FileHandler.java
   2012-07-26 22:15:36 UTC (rev 30011)
+++ 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/FileHandler.java
   2012-07-26 22:42:58 UTC (rev 30012)
@@ -221,6 +221,12 @@
        }
 
        
+
+       @Override
+       public boolean isForcedToSetDirectly() {
+               return true;
+       }
+       
        /**
         * This method allows us to bypass the normal tunable support when the 
only
         * tunable in a Task is a File.  This allows us to pop up a file dialog

Modified: 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/JPanelTunableMutator.java
===================================================================
--- 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/JPanelTunableMutator.java
  2012-07-26 22:15:36 UTC (rev 30011)
+++ 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/tunables/JPanelTunableMutator.java
  2012-07-26 22:42:58 UTC (rev 30012)
@@ -161,14 +161,16 @@
                // and all of the extra clicks, instead we just want to show 
the special dialog.
                if ( handlers.size() == 1 && handlers.get(0) instanceof 
DirectlyPresentableTunableHandler ) {
                        DirectlyPresentableTunableHandler fh = 
(DirectlyPresentableTunableHandler) handlers.get(0);
-                       boolean fileFound = 
fh.setTunableDirectly(possibleParent);
-                       if ( fileFound )
-                               return null; 
-                       else
-                               return HANDLER_CANCEL_PANEL;
+                       if (fh.isForcedToSetDirectly()){
+                               boolean fileFound = 
fh.setTunableDirectly(possibleParent);
+                               if ( fileFound )
+                                       return null; 
+                               else
+                                       return HANDLER_CANCEL_PANEL;
+                       }
                } 
+
                
-               
                if (!panelMap.containsKey(handlers)) {
                        final String MAIN = " ";
                        Map<String, JPanel> panels = new HashMap<String, 
JPanel>();

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