Author: kono
Date: 2011-10-17 11:21:10 -0700 (Mon, 17 Oct 2011)
New Revision: 27203

Modified:
   
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
   
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/EditorManagerImpl.java
   
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/valueeditor/DiscreteValueEditor.java
Log:
Infinite loop bug in the editor had been fixed.

Modified: 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
===================================================================
--- 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
    2011-10-17 18:08:42 UTC (rev 27202)
+++ 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
    2011-10-17 18:21:10 UTC (rev 27203)
@@ -487,21 +487,18 @@
                        final V defaultVal = selectedStyle.getDefaultValue(vp);
                        try {
                                if (defaultVal != null)
-                                       newValue = 
editorFactory.showVisualPropertyValueEditor(
-                                                       this, vp, defaultVal);
+                                       newValue = 
editorFactory.showVisualPropertyValueEditor(this, vp, defaultVal);
                                else
-                                       newValue = 
editorFactory.showVisualPropertyValueEditor(
-                                                       this, vp, 
vp.getDefault());
+                                       newValue = 
editorFactory.showVisualPropertyValueEditor(this, vp, vp.getDefault());
                        } catch (Exception e1) {
                                e1.printStackTrace();
                        }
-
+                       
                        if (newValue != null) {
                                // Got new value.  Apply to the dummy view.
                                selectedStyle.setDefaultValue(vp, newValue);
                                mainView.updateView();
                                mainView.repaint();
-                               //selectedStyle.apply(mainView.updateView());
                        }
 
                        repaint();

Modified: 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/EditorManagerImpl.java
===================================================================
--- 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/EditorManagerImpl.java
 2011-10-17 18:08:42 UTC (rev 27202)
+++ 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/EditorManagerImpl.java
 2011-10-17 18:21:10 UTC (rev 27203)
@@ -189,17 +189,20 @@
 
                while (true) {
                        final V newValue = editor.showEditor(parentComponent, 
initialValue);
+                       // Null is valid return value.  It's from "Cancel" 
button.
+                       if(newValue == null)
+                               return null;
+                       
                        if (type.getRange().inRange(newValue))
                                return newValue;
                        else {
-                               String message = "Please evter valid value";
-                               if(type.getRange() instanceof ContinuousRange)
-                                       message = message + ": " + 
((ContinuousRange)type.getRange()).getMin() + " to " + 
((ContinuousRange)type.getRange()).getMax();
-                               JOptionPane.showMessageDialog(parentComponent, 
message, "Invalid Value",
-                                               JOptionPane.ERROR_MESSAGE);
+                               String message = "Value is out-of-range.  
Please evter valid value.";
+                               if (type.getRange() instanceof ContinuousRange)
+                                       message = message + ": " + 
((ContinuousRange) type.getRange()).getMin() + " to "
+                                                       + ((ContinuousRange) 
type.getRange()).getMax();
+                               JOptionPane.showMessageDialog(parentComponent, 
message, "Invalid Value", JOptionPane.ERROR_MESSAGE);
                        }
                }
-               
        }
 
        /*

Modified: 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/valueeditor/DiscreteValueEditor.java
===================================================================
--- 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/valueeditor/DiscreteValueEditor.java
   2011-10-17 18:08:42 UTC (rev 27202)
+++ 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/editor/valueeditor/DiscreteValueEditor.java
   2011-10-17 18:21:10 UTC (rev 27203)
@@ -311,7 +311,14 @@
                setListItems();
                setLocationRelativeTo(parent);
                setVisible(true);
-               return getValue();
+               
+               final T newValue = getValue();
+               canceled = false;
+               
+               if(newValue == null)
+                       return initialValue;
+               else
+                       return newValue;
        }
 
        @Override

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