Author: mes
Date: 2012-03-23 15:11:56 -0700 (Fri, 23 Mar 2012)
New Revision: 28636

Modified:
   
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/task/JDialogTaskManager.java
   
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/task/SwingTaskMonitor.java
Log:
fixes #724 added a toggle option for the task monitor so that we can hide it 
while the tunable dialog is being displayed

Modified: 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/task/JDialogTaskManager.java
===================================================================
--- 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/task/JDialogTaskManager.java
        2012-03-23 21:42:16 UTC (rev 28635)
+++ 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/task/JDialogTaskManager.java
        2012-03-23 22:11:56 UTC (rev 28636)
@@ -225,11 +225,17 @@
                                        final Task task = taskIterator.next();
                                        taskMonitor.setTask(task);
 
+                                       // hide the dialog to avoid swing 
threading issues
+                                       // while displaying tunables
+                                       taskMonitor.showDialog(false);
+
                                        if (!displayTunables(task)) {
                                                taskMonitor.cancel();
                                                return;
                                        }
 
+                                       taskMonitor.showDialog(true);
+
                                        task.run(taskMonitor);
 
                                        if (taskMonitor.cancelled())

Modified: 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/task/SwingTaskMonitor.java
===================================================================
--- 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/task/SwingTaskMonitor.java
  2012-03-23 21:42:16 UTC (rev 28635)
+++ 
core3/impl/trunk/work-swing-impl/impl/src/main/java/org/cytoscape/work/internal/task/SwingTaskMonitor.java
  2012-03-23 22:11:56 UTC (rev 28636)
@@ -25,6 +25,7 @@
        private Future<?> future = null;
        private int expectedNumTasks = 1;
        private int currentTaskNum = -1; // so that the first task is numbered 0
+       private boolean showDialog = true;
 
        /**
         * Based on the expected number of tasks, this is the fraction of the 
overall
@@ -68,9 +69,21 @@
                if (progress > 0)
                        dialog.setPercentCompleted(progress);
                
-               dialog.setVisible(true);
+               dialog.setVisible(showDialog);
        }
 
+       /**
+        * Used to toggle the monitor dialog so that when tunables
+        * are being displayed there are no Swing related threading 
+        * issues.
+        */
+       public void showDialog(boolean sd) {
+               showDialog = sd;
+               if ( dialog != null ) {
+                       dialog.setVisible(showDialog);
+               }
+       }
+
        public synchronized void close() {
                if (dialog != null) {
                        dialog.dispose();

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