Author: ruschein
Date: 2009-12-30 17:12:52 -0800 (Wed, 30 Dec 2009)
New Revision: 18807

Modified:
   corelibs/trunk/ding/lib/giny.jar
   corelibs/trunk/ding/src/ding/view/DNodeView.java
   corelibs/trunk/giny/src/giny/model/Node.java
Log:
Added groundwork for support of the new "nested_network_is_visible" node 
attribute.

Modified: corelibs/trunk/ding/lib/giny.jar
===================================================================
(Binary files differ)

Modified: corelibs/trunk/ding/src/ding/view/DNodeView.java
===================================================================
--- corelibs/trunk/ding/src/ding/view/DNodeView.java    2009-12-29 22:15:43 UTC 
(rev 18806)
+++ corelibs/trunk/ding/src/ding/view/DNodeView.java    2009-12-31 01:12:52 UTC 
(rev 18807)
@@ -75,7 +75,7 @@
 public class DNodeView implements NodeView, Label {
        // For Cytoscape 2.7: Nested Network Image size
        private static final float NESTED_IMAGE_SCALE_FACTOR = 0.6f;
-       
+
        // This image will be used when view is not available for a nested 
network.
        private static BufferedImage DEFAULT_NESTED_NETWORK_IMAGE;
 
@@ -90,7 +90,7 @@
                        DEFAULT_NESTED_NETWORK_IMAGE = null;
                }
        }
-       
+
        static final float DEFAULT_WIDTH = 20.0f;
        static final float DEFAULT_HEIGHT = 20.0f;
        static final byte DEFAULT_SHAPE = GraphGraphics.SHAPE_ELLIPSE;
@@ -107,7 +107,7 @@
        Paint m_borderPaint;
 
        /**
-        * Stores the position of a nodeView when it's hidden so that when the 
+        * Stores the position of a nodeView when it's hidden so that when the
         * nodeView is restored we can restore the view into the same position.
         */
        float m_hiddenXMin = Float.MIN_VALUE;
@@ -131,7 +131,7 @@
     private final static HashSet<CustomGraphic> EMPTY_CUSTOM_GRAPHICS = new 
LinkedHashSet<CustomGraphic>(0);
        // AJK: 04/26/06 for tooltip
        String m_toolTipText = null;
-       
+
        private DGraphView nestedNetworkView;
 
        /*
@@ -146,7 +146,7 @@
                m_borderPaint = m_view.m_nodeDetails.borderPaint(m_inx);
                m_graphicShapes = null;
                m_graphicPaints = null;
-               
+
                // By default, no nested network is available.
                nestedNetworkView = null;
        }
@@ -596,7 +596,7 @@
                        final double wDiv2;
                        final boolean nodeVisible = 
m_view.m_spacial.exists(m_inx, m_view.m_extentsBuff, 0);
 
-                       if ( nodeVisible ) 
+                       if ( nodeVisible )
                                wDiv2 = (((double) m_view.m_extentsBuff[2]) - 
m_view.m_extentsBuff[0]) / 2.0d;
                        else
                                wDiv2 = (double)(m_hiddenXMax - 
m_hiddenXMin)/2.0d;
@@ -657,7 +657,7 @@
         */
        public void setYPosition(double yPos) {
                synchronized (m_view.m_lock) {
-                       final double hDiv2; 
+                       final double hDiv2;
                        final boolean nodeVisible = 
m_view.m_spacial.exists(m_inx, m_view.m_extentsBuff, 0);
 
                        if ( nodeVisible )
@@ -675,7 +675,7 @@
                        // If the node is visible, set the extents.
                        if ( nodeVisible ) {
                                m_view.m_spacial.delete(m_inx);
-                               m_view.m_spacial.insert(m_inx, 
m_view.m_extentsBuff[0], yMin, 
+                               m_view.m_spacial.insert(m_inx, 
m_view.m_extentsBuff[0], yMin,
                                                        
m_view.m_extentsBuff[2], yMax);
                                m_view.m_contentChanged = true;
 
@@ -1135,12 +1135,12 @@
     public Iterator<CustomGraphic> customGraphicIterator() {
        Iterator<CustomGraphic> retVal = null;
        final Iterable<CustomGraphic> toIterate;
-       //      CG_RW_LOCK.readLock().lock();   
+       //      CG_RW_LOCK.readLock().lock();
        //      if (_customGraphics == null) {
        //          toIterate = EMPTY_CUSTOM_GRAPHICS;
        //      } else {
        //          toIterate = _customGraphics;
-       //      }           
+       //      }
        //      retVal = new LockingIterator<CustomGraphic>(toIterate);
        //      retVal = new Iterator<CustomGraphic>() {
        //          Iterator<? extends CustomGraphic> i = toIterate.iterator();
@@ -1150,7 +1150,7 @@
        //              throw new UnsupportedOperationException();
        //          }
        //      };
-       //      CG_RW_LOCK.readLock().unlock();            
+       //      CG_RW_LOCK.readLock().unlock();
        //      return retVal;
        synchronized (CG_LOCK) {
            if (_customGraphics == null) {
@@ -1164,7 +1164,7 @@
 
     /**
      * A thread-safe method for removing a given custom graphic from this 
DNodeView.
-     * @return true if the custom graphic was found an removed. Returns false 
if 
+     * @return true if the custom graphic was found an removed. Returns false 
if
      *         cg is null or is not a custom graphic associated with this 
DNodeView.
      * @since Cytoscape 2.6
      */
@@ -1173,9 +1173,9 @@
        //      CG_RW_LOCK.writeLock().lock();
        //      if (_customGraphics != null) {
        //          retVal = _customGraphics.remove (cg);
-       //      }       
+       //      }
        //      CG_RW_LOCK.writeLock().unlock();
-       synchronized (CG_LOCK) {        
+       synchronized (CG_LOCK) {
            if (_customGraphics != null) {
                retVal = _customGraphics.remove (cg);
            }
@@ -1206,7 +1206,7 @@
        }
     }
 
-    
+
     private void ensureContentChanged () {
        synchronized (m_view.m_lock) {
            m_view.m_contentChanged = true;
@@ -1455,7 +1455,7 @@
                synchronized (m_view.m_lock) {
                        ++nestedNetworkPaintingDepth;
                        try {
-                               if (nestedNetworkPaintingDepth > 1 || 
getNode().getNestedNetwork() == null)
+                               if (nestedNetworkPaintingDepth > 1 || 
getNode().getNestedNetwork() == null || !getNode().nestedNetworkIsVisible())
                                        return null;
 
                                final double IMAGE_WIDTH  = 
getWidth()*NESTED_IMAGE_SCALE_FACTOR;
@@ -1474,7 +1474,7 @@
                        }
                }
        }
-       
+
        public void setNestedNetworkView(final DGraphView nestedNetworkView) {
                this.nestedNetworkView = nestedNetworkView;
        }

Modified: corelibs/trunk/giny/src/giny/model/Node.java
===================================================================
--- corelibs/trunk/giny/src/giny/model/Node.java        2009-12-29 22:15:43 UTC 
(rev 18806)
+++ corelibs/trunk/giny/src/giny/model/Node.java        2009-12-31 01:12:52 UTC 
(rev 18807)
@@ -2,44 +2,56 @@
 
 import java.util.*;
 
+
 public interface Node extends GraphObject {
- 
-  /**
-   * If a Node is a meta-parent of any other nodes and edges,
-   * then it contains those nodes and edges 
-   * in a <code>GraphPerspective</code>.  This method returns such
-   * a GraphPerspective.
-   * @deprecated Don't use this method because the behavior of the returned
-   *   GraphPerspective with respect to changing meta-children of this Node
-   *   is ill-defined; use RootGraph.getNodeMetaChildIndicesArray(int) and
-   *   RootGraph.getEdgeMetaChildIndicesArray(int) instead.
-   * @see RootGraph#getNodeMetaChildIndicesArray(int)
-   * @see RootGraph#getEdgeMetaChildIndicesArray(int)
-   */
-  public GraphPerspective getGraphPerspective ();
 
-  /**
-   * This method adds all Nodes and Edges contained in the specified
-   * GraphPerspective as children of this Node.
-   * The return value of this method is undefined and should not be used.
-   * @deprecated Don't use this method because the behavior of the
-   *   input GraphPerspective with respect to changing meta-children of
-   *   this Node is ill-defined; use RootGraph.addNodeMetaChild(int, int) and
-   *   RootGraph.addEdgeMetaChild(int, int) instead.
-   * @see RootGraph#addNodeMetaChild(int, int)
-   * @see RootGraph#addEdgeMetaChild(int, int)
-   */
-  public boolean setGraphPerspective ( GraphPerspective gp );
+       /**
+        * If a Node is a meta-parent of any other nodes and edges,
+        * then it contains those nodes and edges
+        * in a <code>GraphPerspective</code>.  This method returns such
+        * a GraphPerspective.
+        * @deprecated Don't use this method because the behavior of the 
returned
+        *   GraphPerspective with respect to changing meta-children of this 
Node
+        *   is ill-defined; use RootGraph.getNodeMetaChildIndicesArray(int) and
+        *   RootGraph.getEdgeMetaChildIndicesArray(int) instead.
+        * @see RootGraph#getNodeMetaChildIndicesArray(int)
+        * @see RootGraph#getEdgeMetaChildIndicesArray(int)
+        */
+       public GraphPerspective getGraphPerspective ();
 
-  /**
-    * Assign a graph perspective reference to this node.
-    */
-  public void setNestedNetwork(final GraphPerspective graphPerspective);
-               
-  /**
-    * Return the currently set graph perspective (may be null) associated with 
this node.
-    *
-    *  @return a network reference or null.
-    */
-  public GraphPerspective getNestedNetwork();
+       /**
+        * This method adds all Nodes and Edges contained in the specified
+        * GraphPerspective as children of this Node.
+        * The return value of this method is undefined and should not be used.
+        * @deprecated Don't use this method because the behavior of the
+        *   input GraphPerspective with respect to changing meta-children of
+        *   this Node is ill-defined; use RootGraph.addNodeMetaChild(int, int) 
and
+        *   RootGraph.addEdgeMetaChild(int, int) instead.
+        * @see RootGraph#addNodeMetaChild(int, int)
+        * @see RootGraph#addEdgeMetaChild(int, int)
+        */
+       public boolean setGraphPerspective ( GraphPerspective gp );
+
+       /**
+        * Assign a graph perspective reference to this node.
+        */
+       public void setNestedNetwork(final GraphPerspective graphPerspective);
+
+       /**
+        * Return the currently set graph perspective (may be null) associated 
with this node.
+        *
+        *  @return a network reference or null.
+        */
+       public GraphPerspective getNestedNetwork();
+
+       /** Determines whether a nested network should be rendered as part of a 
node's view or not.
+        * @return true if the node has a nested network and we want it 
rendered, else false.
+        */
+       boolean nestedNetworkIsVisible();
+
+       /** Set the visibility of a node's nested network when rendered.
+        * @param makeVisible forces the visibility of a nested network.
+        * Please note that this call has no effect if a node has no associated 
nested network!
+        */
+       void showNestedNetwork(final boolean makeVisible);
 } // interface Node

--

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