Author: kono
Date: 2012-01-03 12:36:14 -0800 (Tue, 03 Jan 2012)
New Revision: 27903

Modified:
   
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/Bend.java
   
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/Handle.java
   
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/BendImpl.java
   
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
Log:
API for Edge Bends had been updated.  JavaDoc added for the interfaces.

Modified: 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/Bend.java
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/Bend.java
        2012-01-03 19:46:34 UTC (rev 27902)
+++ 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/Bend.java
        2012-01-03 20:36:14 UTC (rev 27903)
@@ -2,118 +2,47 @@
 
 import java.util.List;
 
+
+/**
+ * Definition of Edge Bends.
+ * Bend is an ordered {@link List} of {@link Handle}s.
+ *
+ */
 public interface Bend {
        
+       /**
+        * 
+        * @return All {@link Handle}s belong to this Bend.
+        */
        List<Handle> getAllHandles();
-       void addHandle(final Handle handle);
-       void insertHandle(final int index, final Handle handle);
+       
+       /**
+        * Insert a Handle to the specified position in the Bend
+        * 
+        * @param index Position of the new Handle
+        * @param handle Handle to be added
+        */
+       void insertHandleAt(final int index, final Handle handle);
 
-       void removeHandle(final int handleIndex);
-       void removeHandle(final Handle handle);
+       /**
+        * Remove a Handle at the given index.
+        * 
+        * @param handleIndex Index of the Handle to be removed
+        */
+       void removeHandleAt(final int handleIndex);
+       
+       /**
+        * Remove all Handles in this Bend
+        */
        void removeAllHandles();
 
+       
+       /**
+        * Get index of a Handle
+        * 
+        * @param handle 
+        * 
+        * @return Index of the given Handle
+        */
        int getIndex(final Handle handle);
-
-//     /**
-//      * Given a list of points removes all existing handles/handlePoints and 
adds
-//      * new ones for those specified in the List.
-//      * 
-//      * @param bendPoints
-//      *            A list of Point2Ds to create new handles.
-//      */
-//     void setHandles(final List<Point2D> bendPoints);
-//
-//     /**
-//      * Returns a (new) List of clones of the Point2Ds that locate the 
handles.
-//      */
-//     List<Point2D> getHandles();
-//
-//     /**
-//      * Moves the handle specified at the given index to the given point.
-//      * 
-//      * @param handleIndex
-//      *            Index of the handle to move.
-//      * @param handlePosition
-//      *            Point2D to which to move the specified handle.
-//      */
-//     void moveHandle(final int handleIndex, final Point2D handlePosition);
-//
-//     /**
-//      * Returns the handle Point2D closest to the source node.
-//      */
-//     Point2D getSourceHandlePoint();
-//
-//     /**
-//      * Returns the handle Point2D closest to the target node.
-//      */
-//     Point2D getTargetHandlePoint();
-//
-//     /**
-//      * Add a PHandle to the edge at the point specified. Acts as an 
interface to
-//      * actuallyAddHandle() which does the actual adding.
-//      * 
-//      * @param handlePosition
-//      *            The point at which to draw the PHandle and to which the
-//      *            PHandle will be attached via the locator.
-//      */
-//     void addHandle(final Point2D handlePosition);
-//
-//     /**
-//      * Add a PHandle to the edge at the point and index specified. Acts as 
an
-//      * interface to actuallyAddHandle() which does the actual adding.
-//      * 
-//      * @param handleIndex
-//      *            The index at which to add the PHandle to the list of 
handles.
-//      * @param handlePosition
-//      *            The point at which to draw the PHandle and to which the
-//      *            PHandle will be attached via the locator.
-//      */
-//     void addHandle(final int handleIndex, final Point2D handlePosition);
-//
-//     /**
-//      * Removes the PHandle at the specified point.
-//      * 
-//      * @param handlePosition
-//      *            If this point intersects an existing PHandle, then remove 
that
-//      *            PHandle.
-//      */
-//     void removeHandle(final Point2D handlePosition);
-//
-//     /**
-//      * Removes the PHandle at the given index.
-//      * 
-//      * @param handleIndex
-//      *            The index of the PHandle to remove.
-//      */
-//     void removeHandle(final int handleIndex);
-//
-//     /**
-//      * Removes all handles
-//      */
-//     void removeAllHandles();
-//
-//     /**
-//      * Checks to see if a PHandle already exists for the given point.
-//      * 
-//      * @param pt
-//      *            If this point intersects a currently existing PHandle, 
then
-//      *            return true, else return false.
-//      */
-//     boolean handleAlreadyExists(final Point2D handlePosition);
-//
-//     /**
-//      * Draws any handles previously added.
-//      */
-//     void drawSelected();
-//
-//     /**
-//      * Removes any handles from the display.
-//      */
-//     void drawUnselected();
-//
-//     /**
-//      * Returns a list of points that define what gets drawn and hence what 
is
-//      * visible to the user.
-//      */
-//     Point2D[] getDrawPoints();
 }

Modified: 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/Handle.java
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/Handle.java
      2012-01-03 19:46:34 UTC (rev 27902)
+++ 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/Handle.java
      2012-01-03 20:36:14 UTC (rev 27903)
@@ -6,8 +6,32 @@
 import org.cytoscape.ding.impl.DGraphView;
 
 
+/**
+ * Defines a handle, an anchor point in the edge. 
+ *
+ */
 public interface Handle {
 
-       Point2D getPoint(DGraphView graphView, DEdgeView view);
-       void setPoint(DGraphView graphView, DEdgeView view, double x, double y);
+       /**
+        * Calculate absolute position of this handle.
+        * 
+        * @param graphView graph view for this handle
+        * @param edgeView The handle belongs to this edge view.
+        * 
+        * @return Absolute position of this handle in the network view.
+        */
+       Point2D getPoint(final DGraphView graphView, final DEdgeView edgeView);
+       
+       /**
+        * Set a new position of this handle.
+        * 
+        * NOTE: in the implementation, the given (x, y) values will be 
converted to relative position.
+        * The conversion equation is exchangeable.
+        * 
+        * @param graphView graph view for this handle
+        * @param edgeView The handle belongs to this edge view.
+        * @param x Absolute value for X-location.
+        * @param y Absolute value for Y-location.
+        */
+       void setPoint(final DGraphView graphView, final DEdgeView edgeView, 
final double x, final double y);
 }

Modified: 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/BendImpl.java
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/BendImpl.java
       2012-01-03 19:46:34 UTC (rev 27902)
+++ 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/BendImpl.java
       2012-01-03 20:36:14 UTC (rev 27903)
@@ -24,23 +24,15 @@
                return handles;
        }
 
-       @Override
-       public void addHandle(final Handle handle) {
-               this.handles.add(handle);
-       }
 
        @Override
-       public void removeHandle(final int handleIndex) {
+       public void removeHandleAt(final int handleIndex) {
                if(handleIndex > handles.size())
                        throw new IllegalArgumentException("handleIndex is out 
of range: " + handleIndex);
                
                this.handles.remove(handleIndex);
        }
 
-       @Override
-       public void removeHandle(final Handle handle) {
-               this.handles.remove(handle);
-       }
 
        @Override
        public void removeAllHandles() {
@@ -53,7 +45,7 @@
        }
 
        @Override
-       public void insertHandle(final int index, final Handle handle) {
+       public void insertHandleAt(final int index, final Handle handle) {
                this.handles.add(index, handle);
        }
        

Modified: 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
===================================================================
--- 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
      2012-01-03 19:46:34 UTC (rev 27902)
+++ 
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DEdgeView.java
      2012-01-03 20:36:14 UTC (rev 27903)
@@ -818,7 +818,7 @@
 //                     }
                                
                        //m_anchors.add(insertInx, addThis);
-                       bend.insertHandle(insertInx, handle);
+                       bend.insertHandleAt(insertInx, handle);
 
                        if (m_selected) {
                                for (int j = bend.getAllHandles().size() - 1; j 
> insertInx; j--) {
@@ -871,7 +871,7 @@
        public void removeHandle(int inx) {
                synchronized (m_view.m_lock) {
                        final Bend bend = m_view.m_edgeDetails.bend(m_inx);
-                       bend.removeHandle(inx);
+                       bend.removeHandleAt(inx);
                        //m_anchors.remove(inx);
 
                        if (m_selected) {

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