Author: clopes
Date: 2012-07-06 11:37:16 -0700 (Fri, 06 Jul 2012)
New Revision: 29781

Modified:
   
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
   
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
   
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
Log:
Fixes #1226 (Nodes and edges are deselected when visual style is reapplied)

Modified: 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
     2012-07-06 09:05:31 UTC (rev 29780)
+++ 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
     2012-07-06 18:37:16 UTC (rev 29781)
@@ -73,7 +73,6 @@
 import org.cytoscape.ding.GraphViewChangeListener;
 import org.cytoscape.ding.GraphViewObject;
 import org.cytoscape.ding.NodeView;
-import org.cytoscape.ding.ObjectPosition;
 import org.cytoscape.ding.PrintLOD;
 import org.cytoscape.ding.icon.VisualPropertyIconFactory;
 import org.cytoscape.ding.impl.cyannotator.CyAnnotator;
@@ -87,7 +86,6 @@
 import org.cytoscape.ding.impl.events.GraphViewNodesUnselectedEvent;
 import org.cytoscape.ding.impl.events.ViewportChangeListener;
 import org.cytoscape.ding.impl.events.ViewportChangeListenerChain;
-import org.cytoscape.ding.impl.visualproperty.CustomGraphicsVisualProperty;
 import org.cytoscape.event.CyEventHelper;
 import org.cytoscape.graph.render.immed.GraphGraphics;
 import org.cytoscape.graph.render.stateful.GraphLOD;
@@ -2670,32 +2668,35 @@
 
        @Override
        public <T, V extends T> void setViewDefault(VisualProperty<? extends T> 
vp, V defaultValue) {
+               if (vp.shouldIgnoreDefault())
+                       return;
+               
                final Class<?> targetType = vp.getTargetDataType();
                
-               // Filter some special cases here: 
-               if (vp == BasicVisualLexicon.NODE_X_LOCATION || vp == 
BasicVisualLexicon.NODE_Y_LOCATION
-                               || vp == BasicVisualLexicon.NODE_Z_LOCATION)
-                       return;
+//             // Filter some special cases here:
+//             if (vp == BasicVisualLexicon.NODE_X_LOCATION || vp == 
BasicVisualLexicon.NODE_Y_LOCATION
+//                             || vp == BasicVisualLexicon.NODE_Z_LOCATION)
+//                     return;
                
                // In DING, there is no default W, H, and D.
                // Also, custom Graphics should be applied for each view.
-               if (vp == BasicVisualLexicon.NODE_SIZE || vp == 
BasicVisualLexicon.NODE_WIDTH
-                               || vp == BasicVisualLexicon.NODE_HEIGHT || vp 
== BasicVisualLexicon.NODE_TRANSPARENCY) {
-                       applyToAllNodes(vp, defaultValue);
-                       return;
-               }
+//             if (vp == BasicVisualLexicon.NODE_SIZE || vp == 
BasicVisualLexicon.NODE_WIDTH
+//                             || vp == BasicVisualLexicon.NODE_HEIGHT || vp 
== BasicVisualLexicon.NODE_TRANSPARENCY) {
+//                     applyToAllNodes(vp, defaultValue);
+//                     return;
+//             }
                
-               if ((VisualProperty<?>)vp instanceof 
CustomGraphicsVisualProperty) {
-                       applyToAllNodes(vp, defaultValue);
-                       return;
-               }
+//             if ((VisualProperty<?>)vp instanceof 
CustomGraphicsVisualProperty) {
+//                     applyToAllNodes(vp, defaultValue);
+//                     return;
+//             }
                
-               if (vp != DVisualLexicon.NODE_LABEL_POSITION && defaultValue 
instanceof ObjectPosition) {
-                       if (defaultValue != 
ObjectPositionImpl.DEFAULT_POSITION) {
-                               applyToAllNodes(vp, defaultValue);
-                               return;
-                       }
-               }
+//             if (vp != DVisualLexicon.NODE_LABEL_POSITION && defaultValue 
instanceof ObjectPosition) {
+//                     if (defaultValue != 
ObjectPositionImpl.DEFAULT_POSITION) {
+//                             applyToAllNodes(vp, defaultValue);
+//                             return;
+//                     }
+//             }
                
                if (targetType == CyNode.class) {
 //                     m_nodeDetails.clear(); // TODO double-check and delete 
commented lines if ok
@@ -2705,8 +2706,7 @@
                        m_edgeDetails.clear();
                        
m_edgeViewDefaultSupport.setEdgeViewDefault(vp,defaultValue);
                } else if (targetType == CyNetwork.class) {
-                       if (vp.shouldIgnoreDefault() == false)
-                               this.setVisualProperty(vp, defaultValue);
+                       this.setVisualProperty(vp, defaultValue);
                }
        }
        

Modified: 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
   2012-07-06 09:05:31 UTC (rev 29780)
+++ 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
   2012-07-06 18:37:16 UTC (rev 29781)
@@ -119,7 +119,7 @@
        private Double m_labelWidthDefault;
 
 
-       private boolean isCleared = false;
+       private boolean isCleared;
        
        
        DNodeDetails(final DGraphView view) {
@@ -316,22 +316,22 @@
        
        void setSelectedPaint(final CyNode node, final Paint paint) {
                m_selectedPaints.put(node, paint);
-               if(paint instanceof Color)
+               if (paint instanceof Color)
                        m_selectedColorsLowDetail.put(node, paint);
 
                isCleared = false;
        }
-       
+
        @Override
        public Paint fillPaint(final CyNode node) {
                boolean isSelected = selected.contains(node);
-               
-               if(isSelected)
+
+               if (isSelected)
                        return selectedPaint(node);
                else
                        return unselectedPaint(node);
        }
-       
+
        void select(final CyNode node) {
                selected.add(node);
        }

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
    2012-07-06 09:05:31 UTC (rev 29780)
+++ 
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewEditorImpl.java
    2012-07-06 18:37:16 UTC (rev 29781)
@@ -307,7 +307,6 @@
                setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
 
                jXTitledPanel1.setTitle("Default Visual Properties");
-
                jXTitledPanel1.setTitleFont(new Font("SansSerif", 1, 12));
                jXTitledPanel1.setMinimumSize(new Dimension(300, 27));
                jXTitledPanel1.setPreferredSize(new Dimension(300, 27));
@@ -321,7 +320,6 @@
                defaultObjectTabbedPane.addTab("Node", nodeScrollPane);
                defaultObjectTabbedPane.addTab("Edge", edgeScrollPane);
                defaultObjectTabbedPane.addTab("Network", globalScrollPane);
-
                defaultObjectTabbedPane.addTab("Dependency", 
dependencyScrollPane);
 
                GroupLayout jXTitledPanel1Layout = new 
GroupLayout(jXTitledPanel1.getContentContainer());
@@ -423,13 +421,14 @@
                if (SwingUtilities.isLeftMouseButton(e) && e.getClickCount() == 
2) {
                        final VisualStyle selectedStyle = 
vmm.getCurrentVisualStyle();
                        final V defaultVal = selectedStyle.getDefaultValue(vp);
+                       
                        try {
                                if (defaultVal != null)
                                        newValue = 
editorFactory.showVisualPropertyValueEditor(this, vp, defaultVal);
                                else
                                        newValue = 
editorFactory.showVisualPropertyValueEditor(this, vp, vp.getDefault());
-                       } catch (Exception e1) {
-                               e1.printStackTrace();
+                       } catch (Exception ex) {
+                               logger.error("Error opening Visual Property 
values editor for: " + vp, ex);
                        }
 
                        if (newValue != null) {

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