Author: kono
Date: 2010-12-02 19:06:05 -0800 (Thu, 02 Dec 2010)
New Revision: 23082

Modified:
   core3/ding-presentation-impl/trunk/pom.xml
   
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeShape.java
   
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeView.java
   
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
   
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeView.java
   core3/graph-render/trunk/pom.xml
Log:
Removing GINY conversions (not finished yet).

Modified: core3/ding-presentation-impl/trunk/pom.xml
===================================================================
--- core3/ding-presentation-impl/trunk/pom.xml  2010-12-03 00:50:04 UTC (rev 
23081)
+++ core3/ding-presentation-impl/trunk/pom.xml  2010-12-03 03:06:05 UTC (rev 
23082)
@@ -111,7 +111,6 @@
                        <artifactId>presentation-api</artifactId>
                        <version>3.0.0-alpha2-SNAPSHOT</version>
                </dependency>
-
                <dependency>
                        <groupId>org.cytoscape</groupId>
                        <artifactId>core-task-api</artifactId>
@@ -130,18 +129,7 @@
                        <version>3.0.0-alpha1</version>
                </dependency>
 
-               <dependency>
-                       <groupId>org.cytoscape</groupId>
-                       <artifactId>util-intr</artifactId>
-                       <version>1.0-SNAPSHOT</version>
-               </dependency>
 
-               <dependency>
-                       <groupId>org.cytoscape</groupId>
-                       <artifactId>spacial</artifactId>
-                       <version>1.0-SNAPSHOT</version>
-               </dependency>
-
                <!-- Wrapped libraries -->
                <dependency>
                        <groupId>cytoscape-temp</groupId>

Modified: 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeShape.java
===================================================================
--- 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeShape.java
  2010-12-03 00:50:04 UTC (rev 23081)
+++ 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeShape.java
  2010-12-03 03:06:05 UTC (rev 23082)
@@ -34,66 +34,58 @@
 */
 package org.cytoscape.ding;
 
-import org.cytoscape.ding.icon.NodeIcon;
-import org.cytoscape.ding.icon.VisualPropertyIcon;
+import java.awt.Shape;
+import java.util.Map;
 
 import org.cytoscape.graph.render.immed.GraphGraphics;
 
-import javax.swing.*;
-import java.awt.*;
-import java.util.HashMap;
-import java.util.Map;
-
 /**
- * This is a replacement for ShapeNodeRealizer.java
+ * Defines node shapes used in DING rendering engine.
+ * This enum wires shape definitions to actual rendering code in graph-render 
bundle.
  *
- * @since Cytoscape 2.5
- * @version 0.7
- * @author kono
- *
  */
 public enum NodeShape {
-       RECT(GraphGraphics.SHAPE_RECTANGLE, "Rectangle", true),
-       ROUND_RECT(GraphGraphics.SHAPE_ROUNDED_RECTANGLE, "Round Rectangle", 
true),
-       RECT_3D(GraphGraphics.SHAPE_RECTANGLE, "3D Rectabgle", false),
-       TRAPEZOID(GraphGraphics.SHAPE_RECTANGLE, "Trapezoid", false),
-       TRAPEZOID_2(GraphGraphics.SHAPE_RECTANGLE, "Trapezoid 2", false),
-       TRIANGLE(GraphGraphics.SHAPE_TRIANGLE, "Triangle", true),
-       PARALLELOGRAM(GraphGraphics.SHAPE_PARALLELOGRAM, "Parallelogram", true),
-       DIAMOND(GraphGraphics.SHAPE_DIAMOND, "Diamond", true),
-       ELLIPSE(GraphGraphics.SHAPE_ELLIPSE, "Ellipse", true),
-       HEXAGON(GraphGraphics.SHAPE_HEXAGON, "Hexagon", true),
-       OCTAGON(GraphGraphics.SHAPE_OCTAGON, "Octagon", true);
 
-       private final Byte ginyShape;
-       private final String name;
-       private final boolean isSupported;
+       RECT(GraphGraphics.SHAPE_RECTANGLE, "Rectangle"),
+       ROUND_RECT(GraphGraphics.SHAPE_ROUNDED_RECTANGLE, "Round Rectangle"),
+       TRIANGLE(GraphGraphics.SHAPE_TRIANGLE, "Triangle"),
+       PARALLELOGRAM(GraphGraphics.SHAPE_PARALLELOGRAM, "Parallelogram"),
+       DIAMOND(GraphGraphics.SHAPE_DIAMOND, "Diamond"),
+       ELLIPSE(GraphGraphics.SHAPE_ELLIPSE, "Ellipse"),
+       HEXAGON(GraphGraphics.SHAPE_HEXAGON, "Hexagon"),
+       OCTAGON(GraphGraphics.SHAPE_OCTAGON, "Octagon");
+
+       private final Byte rendererShapeID;
+       private final String displayName;
        
        private static final Map<Byte, Shape> nodeShapes = 
GraphGraphics.getNodeShapes();
 
-       private NodeShape(Byte ginyShape, String name, boolean isSupported) {
-               this.ginyShape = ginyShape;
-               this.name = name;
-               this.isSupported = isSupported;
+       private NodeShape(final Byte rendererShapeID, final String displayName) 
{
+               this.rendererShapeID = rendererShapeID;
+               this.displayName = displayName;
        }
-
+       
+       
        /**
-        * If the shape is supported by rendering engine, return true.<br>
-        * Otherwise, return false.
-        * @return
+        * Display name will be used for toString() method.
         */
-       public boolean isSupported() {
-               return isSupported;
+       @Override public String toString() {
+               return displayName;
        }
+       
+       public Byte getNativeShape() {
+               return this.rendererShapeID;
+       }
 
+
        /**
-        * DOCUMENT ME!
+        * Get a node shape from a given string.
         *
         * @param text DOCUMENT ME!
         *
         * @return DOCUMENT ME!
         */
-       public static NodeShape parseNodeShapeText(String text) {
+       public static NodeShape parseNodeShapeText(final String text) {
                String trimed = text.trim();
 
                for (NodeShape shape : values()) {
@@ -126,26 +118,10 @@
         * @return DOCUMENT ME!
         */
        public String getShapeName() {
-               return name;
+               return displayName;
        }
 
-       /**
-        * DOCUMENT ME!
-        *
-        * @param type
-        *            DOCUMENT ME!
-        *
-        * @return DOCUMENT ME!
-        */
-       public static boolean isValidShape(NodeShape type) {
-               for (NodeShape curType : values()) {
-                       if (type == curType)
-                               return true;
-               }
 
-               return false;
-       }
-
        /**
         * DOCUMENT ME!
         *
@@ -161,37 +137,29 @@
                return nstext.toLowerCase();
        }
 
+       
        /**
-        * Get GINY shape as integer.
-        *
-        * @return Giny shape as integer.
-        */
-        // TODO rename this method so that it doesn't reference GINY
-       public Byte getGinyShape() {
-               return ginyShape;
-       }
-
-       /**
         * Convert from Giny shape to Cytoscape NodeShape enum.
         *
         * @param ginyShape
         * @return
         */
-       public static NodeShape getNodeShape(Byte ginyShape) {
+       public static NodeShape getNodeShape(final Byte ginyShape) {
                for (NodeShape shape : values()) {
-                       if (shape.ginyShape == ginyShape)
+                       if (shape.rendererShapeID == ginyShape)
                                return shape;
                }
 
                // Unknown. Return rectangle as the def val.
                return NodeShape.RECT;
        }
+       
 
        /**
         * Returns a Shape object for the NodeShape in question.
         */
        public Shape getShape() {
-               return nodeShapes.get(ginyShape);
+               return nodeShapes.get(rendererShapeID);
        }
 
 //     /**

Modified: 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeView.java
===================================================================
--- 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeView.java
   2010-12-03 00:50:04 UTC (rev 23081)
+++ 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/NodeView.java
   2010-12-03 03:06:05 UTC (rev 23082)
@@ -235,7 +235,7 @@
         * <B>Note:</B> calling setPathTo( Shape ), allows one to define their 
own
         * java.awt.Shape ( i.e. A picture of Johnny Cash )
         */
-       public void setShape(int shape) ;
+       public void setShape(NodeShape shape) ;
 
        /**
         * Sets what the tooltip will be for this NodeView

Modified: 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
===================================================================
--- 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
  2010-12-03 00:50:04 UTC (rev 23081)
+++ 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeDetails.java
  2010-12-03 03:06:05 UTC (rev 23082)
@@ -32,6 +32,7 @@
 import org.cytoscape.graph.render.stateful.NodeDetails;
 import org.cytoscape.util.intr.IntObjHash;
 import org.cytoscape.ding.Label;
+import org.cytoscape.ding.NodeShape;
 
 import java.awt.*;
 import java.util.HashMap;
@@ -148,11 +149,12 @@
         * The shape argument must be pre-checked for correctness.
         * A negative shape value has the special meaning to remove overridden 
shape.
         */
-       void overrideShape(int node, byte shape) {
-               if ((shape < 0) || (shape == super.shape(node)))
-                       m_shapes.remove(new Integer(node));
-               else
-                       m_shapes.put(new Integer(node), new Byte(shape));
+       void overrideShape(int node, NodeShape shape) {
+//             if ((shape < 0) || (shape == super.shape(node)))
+//                     m_shapes.remove(new Integer(node));
+//             else
+//                     m_shapes.put(new Integer(node), new Byte(shape));
+               m_shapes.put(node, shape.getNativeShape());
        }
 
        /**

Modified: 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeView.java
===================================================================
--- 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeView.java
     2010-12-03 00:50:04 UTC (rev 23081)
+++ 
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DNodeView.java
     2010-12-03 03:06:05 UTC (rev 23082)
@@ -108,6 +108,7 @@
        static final int DEFAULT_TRANSPARENCY = 255;
 
        private final int m_inx; // The FixedGraph index (non-negative).
+       
        private boolean m_selected;
        private Paint m_unselectedPaint;
        private Paint m_selectedPaint;
@@ -505,7 +506,7 @@
 
                        if (!(Math.max(w, h) < (1.99d * Math.min(w, h)))
                                        && (getShape() == 
GraphGraphics.SHAPE_ROUNDED_RECTANGLE))
-                               setShape(GraphGraphics.SHAPE_RECTANGLE);
+                               setShape(NodeShape.RECT);
 
                        graphView.m_contentChanged = true;
 
@@ -560,7 +561,7 @@
 
                        if (!(Math.max(w, h) < (1.99d * Math.min(w, h)))
                                        && (getShape() == 
GraphGraphics.SHAPE_ROUNDED_RECTANGLE))
-                               setShape(GraphGraphics.SHAPE_RECTANGLE);
+                               setShape(NodeShape.RECT);
 
                        graphView.m_contentChanged = true;
 
@@ -919,11 +920,12 @@
         * @param shape
         *            DOCUMENT ME!
         */
-       public void setShape(final int shape) {
+       public void setShape(final NodeShape shape) {
                synchronized (graphView.m_lock) {
-                       byte nativeShape = GinyUtil.getNativeNodeType(shape);
+                       //byte nativeShape = GinyUtil.getNativeNodeType(shape);
+                       
 
-                       graphView.m_nodeDetails.overrideShape(m_inx, 
nativeShape);
+                       graphView.m_nodeDetails.overrideShape(m_inx, shape);
                        graphView.m_contentChanged = true;
                }
        }
@@ -1505,7 +1507,7 @@
        public void setVisualPropertyValue(VisualProperty<?> vp, Object value) {
 
                if (vp == DVisualLexicon.NODE_SHAPE) {
-                       setShape(((NodeShape) value).getGinyShape());
+                       setShape(((NodeShape) value));
                } else if (vp == DVisualLexicon.NODE_SELECTED_PAINT) {
                        setSelectedPaint((Paint) value);
                } else if (vp == TwoDVisualLexicon.NODE_SELECTED) {

Modified: core3/graph-render/trunk/pom.xml
===================================================================
--- core3/graph-render/trunk/pom.xml    2010-12-03 00:50:04 UTC (rev 23081)
+++ core3/graph-render/trunk/pom.xml    2010-12-03 03:06:05 UTC (rev 23082)
@@ -1,125 +1,119 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
 
-  <parent>
-    <artifactId>parent</artifactId>
-    <groupId>org.cytoscape</groupId>
-    <version>1.0-SNAPSHOT</version>
-  </parent>
+       <parent>
+               <artifactId>parent</artifactId>
+               <groupId>org.cytoscape</groupId>
+               <version>1.0-SNAPSHOT</version>
+       </parent>
 
-  <properties>
-    <bundle.symbolicName>org.cytoscape.graph-render</bundle.symbolicName>
-    <bundle.namespace>org.cytoscape.graph.render</bundle.namespace>
-  </properties>
+       <properties>
+               
<bundle.symbolicName>org.cytoscape.graph-render</bundle.symbolicName>
+               <bundle.namespace>org.cytoscape.graph.render</bundle.namespace>
+       </properties>
 
-  <modelVersion>4.0.0</modelVersion>
-  <groupId>org.cytoscape</groupId>
-  <artifactId>graph-render</artifactId>
-  <version>1.0-SNAPSHOT</version>
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>org.cytoscape</groupId>
+       <artifactId>graph-render</artifactId>
+       <version>1.0-SNAPSHOT</version>
 
-  <name>${bundle.symbolicName}</name>
+       <name>${bundle.symbolicName}</name>
 
-  <packaging>bundle</packaging>
+       <packaging>bundle</packaging>
 
-  <repositories>
-    <!-- bootstrap for cytoscape dependencies, namely the parent POM snapshots 
-->
-    <repository>
-      <id>cytoscape_snapshots</id>
-      <snapshots>
-        <enabled>true</enabled>
-      </snapshots>
-      <releases>
-        <enabled>false</enabled>
-      </releases>
-      <name>Cytoscape Snapshots</name>
-      
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/snapshots/</url>
-    </repository>
-    <!-- bootstrap for cytoscape dependencies, namely the parent POM releases 
-->
-    <repository>
-      <id>cytoscape_releases</id>
-      <snapshots>
-        <enabled>false</enabled>
-      </snapshots>
-      <releases>
-        <enabled>true</enabled>
-      </releases>
-      <name>Cytoscape Releases</name>
-      
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/releases/</url>
-    </repository>
-  </repositories>
+       <repositories>
+               <!-- bootstrap for cytoscape dependencies, namely the parent 
POM snapshots -->
+               <repository>
+                       <id>cytoscape_snapshots</id>
+                       <snapshots>
+                               <enabled>true</enabled>
+                       </snapshots>
+                       <releases>
+                               <enabled>false</enabled>
+                       </releases>
+                       <name>Cytoscape Snapshots</name>
+                       
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/snapshots/</url>
+               </repository>
+               <!-- bootstrap for cytoscape dependencies, namely the parent 
POM releases -->
+               <repository>
+                       <id>cytoscape_releases</id>
+                       <snapshots>
+                               <enabled>false</enabled>
+                       </snapshots>
+                       <releases>
+                               <enabled>true</enabled>
+                       </releases>
+                       <name>Cytoscape Releases</name>
+                       
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/releases/</url>
+               </repository>
+       </repositories>
 
-  <build>
-    <resources>
-      <resource>
-        <directory>src/main/resources</directory>
-      </resource>
-      <!--
-         | example additional resource entries, useful when building Eclipse 
RCP applications
-       -->
-      <resource>
-        <directory>.</directory>
-        <includes>
-          <include>plugin.xml</include>
-          <include>plugin.properties</include>
-          <include>icons/**</include>
-        </includes>
-      </resource>
-    </resources>
-    <plugins>
-      <plugin>
-        <groupId>org.ops4j</groupId>
-        <artifactId>maven-pax-plugin</artifactId>
-        <version>1.4</version>
-        <!--
-            | enable improved OSGi compilation support for the bundle 
life-cycle.
-            | to switch back to the standard bundle life-cycle, move this 
setting
-            | down to the maven-bundle-plugin section
-          -->
-        <extensions>true</extensions>
-      </plugin>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <version>1.4.3</version>
-        <configuration>
-          <instructions>
-            <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
-            <Bundle-Version>${pom.version}</Bundle-Version>
-            <_include>-osgi.bnd</_include>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
+       <build>
+               <resources>
+                       <resource>
+                               <directory>src/main/resources</directory>
+                       </resource>
+                       <!-- | example additional resource entries, useful when 
building Eclipse 
+                               RCP applications -->
+                       <resource>
+                               <directory>.</directory>
+                               <includes>
+                                       <include>plugin.xml</include>
+                                       <include>plugin.properties</include>
+                                       <include>icons/**</include>
+                               </includes>
+                       </resource>
+               </resources>
+               <plugins>
+                       <plugin>
+                               <groupId>org.ops4j</groupId>
+                               <artifactId>maven-pax-plugin</artifactId>
+                               <version>1.4</version>
+                               <!-- | enable improved OSGi compilation support 
for the bundle life-cycle. 
+                                       | to switch back to the standard bundle 
life-cycle, move this setting | down 
+                                       to the maven-bundle-plugin section -->
+                               <extensions>true</extensions>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.felix</groupId>
+                               <artifactId>maven-bundle-plugin</artifactId>
+                               <version>1.4.3</version>
+                               <configuration>
+                                       <instructions>
+                                               
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
+                                               
<Bundle-Version>${pom.version}</Bundle-Version>
+                                               <_include>-osgi.bnd</_include>
+                                       </instructions>
+                               </configuration>
+                       </plugin>
+               </plugins>
+       </build>
 
-  <dependencies>
-    <dependency>
-      <groupId>org.cytoscape</groupId>
-      <artifactId>spacial</artifactId>
-      <version>1.0-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.cytoscape</groupId>
-      <artifactId>util-intr</artifactId>
-      <version>1.0-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>org.cytoscape</groupId>
-      <artifactId>model-api</artifactId>
-      <version>3.0.0-alpha2-SNAPSHOT</version>
-    </dependency>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <version>${junit.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.apache.commons</groupId>
-      <artifactId>commons-math</artifactId>
-      <version>2.1</version>
-      <scope>test</scope>
-    </dependency>
-  </dependencies>
+       <dependencies>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>spacial</artifactId>
+                       <version>1.0-SNAPSHOT</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.cytoscape</groupId>
+                       <artifactId>model-api</artifactId>
+                       <version>3.0.0-alpha2-SNAPSHOT</version>
+               </dependency>
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+                       <version>${junit.version}</version>
+                       <scope>test</scope>
+               </dependency>
+               <dependency>
+                       <groupId>org.apache.commons</groupId>
+                       <artifactId>commons-math</artifactId>
+                       <version>2.1</version>
+                       <scope>test</scope>
+               </dependency>
+       </dependencies>
 
 </project>

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