Author: kono
Date: 2010-08-03 13:35:28 -0700 (Tue, 03 Aug 2010)
New Revision: 21146
Modified:
core3/viewmodel-api/trunk/pom.xml
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/AbstractVisualProperty.java
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/CyNetworkView.java
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/CyNetworkViewFactory.java
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/DependentVisualPropertyCallback.java
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/RootVisualLexicon.java
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/View.java
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/VisualLexicon.java
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/VisualProperty.java
core3/viewmodel-api/trunk/src/test/java/org/cytoscape/view/model/IntegerVisualProperty.java
Log:
JavaDocs are added and some method names are modified.
Modified: core3/viewmodel-api/trunk/pom.xml
===================================================================
--- core3/viewmodel-api/trunk/pom.xml 2010-08-03 19:46:58 UTC (rev 21145)
+++ core3/viewmodel-api/trunk/pom.xml 2010-08-03 20:35:28 UTC (rev 21146)
@@ -28,10 +28,8 @@
<resource>
<directory>src/main/resources</directory>
</resource>
- <!--
- | example additional resource entries, useful
when building Eclipse
- RCP applications
- -->
+ <!-- | example additional resource entries, useful when
building Eclipse
+ RCP applications -->
</resources>
<plugins>
<plugin>
@@ -56,34 +54,26 @@
<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
- -->
+ <!-- | 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>
- <!--
- | the following instructions build a
simple set of public/private
- classes into an OSGi bundle
- -->
+
<version>${maven-bundle-plugin.version}</version>
+ <!-- | the following instructions build a
simple set of public/private
+ classes into an OSGi bundle -->
<configuration>
<instructions>
<Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
<Bundle-Version>${pom.version}</Bundle-Version>
- <!--
- | assume public classes
are in the top package, and private
- classes are under
".internal"
- -->
+ <!-- | assume public classes
are in the top package, and private classes
+ are under ".internal"
-->
<Export-Package>!${bundle.namespace}.internal.*,${bundle.namespace}.*;version="${pom.version}"</Export-Package>
<Private-Package>${bundle.namespace}.internal.*</Private-Package>
- <!--
- | each module can
override these defaults in their osgi.bnd file
- -->
+ <!-- | each module can override
these defaults in their osgi.bnd file -->
<_include>-osgi.bnd</_include>
</instructions>
</configuration>
@@ -92,9 +82,7 @@
</build>
<repositories>
- <!--
- bootstrap for cytoscape dependencies, namely the parent
POM snapshots
- -->
+ <!-- bootstrap for cytoscape dependencies, namely the parent
POM snapshots -->
<repository>
<id>cytoscape_snapshots</id>
<snapshots>
@@ -106,9 +94,7 @@
<name>Cytoscape Snapshots</name>
<url>http://cytoscape.wodaklab.org/nexus/content/repositories/snapshots/</url>
</repository>
- <!--
- bootstrap for cytoscape dependencies, namely the parent
POM releases
- -->
+ <!-- bootstrap for cytoscape dependencies, namely the parent
POM releases -->
<repository>
<id>cytoscape_releases</id>
<snapshots>
@@ -139,18 +125,18 @@
</dependency>
<!-- unit tests -->
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>com.springsource.org.easymock</artifactId>
- <version>2.3.0</version>
- <scope>test</scope>
- </dependency>
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.4</version>
- <scope>test</scope>
- </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>com.springsource.org.easymock</artifactId>
+ <version>${easymock.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ <scope>test</scope>
+ </dependency>
</dependencies>
</project>
Modified:
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/AbstractVisualProperty.java
===================================================================
---
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/AbstractVisualProperty.java
2010-08-03 19:46:58 UTC (rev 21145)
+++
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/AbstractVisualProperty.java
2010-08-03 20:35:28 UTC (rev 21146)
@@ -1,4 +1,3 @@
-
/*
Copyright (c) 2008, The Cytoscape Consortium (www.cytoscape.org)
@@ -32,41 +31,77 @@
You should have received a copy of the GNU Lesser General Public License
along with this library; if not, write to the Free Software Foundation,
Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-*/
+ */
package org.cytoscape.view.model;
/**
- * An abstract implementation of VisualProperty that omits the methods
- * dealing with serializing data.
+ * An abstract implementation of VisualProperty that omits the methods dealing
+ * with serializing data.
+ *
+ * @since Cytoscape 3.0
+ *
*/
public abstract class AbstractVisualProperty<T> implements VisualProperty<T> {
- final protected String ot;
- final protected T def;
+ // Object type (node/edge/network)
+ protected final String objectType;
+
+ // Default value for this VP.
+ protected final T defaultValue;
+
+ // Identifier.
final protected String id;
+
+ // Human-readable name of VP.
final protected String name;
- public AbstractVisualProperty(final String ot, final T def, final
String id, final String name) {
- this.ot = ot;
- this.def = def;
+
+ /**
+ * Constructor with all required immutable field values.
+ *
+ * @param objectType
+ * @param defaultValue
+ * @param id
+ * @param name
+ */
+ public AbstractVisualProperty(final String objectType,
+ final T defaultValue, final String id, final String
name) {
+ this.objectType = objectType;
+ this.defaultValue = defaultValue;
this.id = id;
this.name = name;
}
- public String getObjectType() { return ot; }
+ public String getObjectType() {
+ return objectType;
+ }
+
@SuppressWarnings("unchecked")
- public Class<T> getType() {
- if(def != null)
- return (Class<T>) def.getClass();
- else return null;
+ public Class<T> getType() {
+ if (defaultValue != null)
+ return (Class<T>) defaultValue.getClass();
+ else
+ return null;
}
- public T getDefault() { return def; }
+
+ public T getDefault() {
+ return defaultValue;
+ }
- public String getIdString() { return id; }
+
+ public String getIdString() {
+ return id;
+ }
- public String getDisplayName() { return name; }
+
+ public String getDisplayName() {
+ return name;
+ }
- public DependentVisualPropertyCallback
dependentVisualPropertyCallback() { return null; }
+ // TODO: REMOVE THIS!
+ public DependentVisualPropertyCallback
dependentVisualPropertyCallback() {
+ return null;
+ }
}
Modified:
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/CyNetworkView.java
===================================================================
---
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/CyNetworkView.java
2010-08-03 19:46:58 UTC (rev 21145)
+++
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/CyNetworkView.java
2010-08-03 20:35:28 UTC (rev 21146)
@@ -34,35 +34,36 @@
*/
package org.cytoscape.view.model;
+import java.util.List;
+
import org.cytoscape.model.CyEdge;
import org.cytoscape.model.CyNetwork;
import org.cytoscape.model.CyNode;
import org.cytoscape.model.GraphObject;
-import java.util.List;
-import java.util.Set;
-
/**
* Contains the visual representation of a Network.
*/
-public interface CyNetworkView extends View<CyNetwork>{
+public interface CyNetworkView extends View<CyNetwork> {
/**
* Returns a View for a specified Node.
*
- * @param n DOCUMENT ME!
+ * @param node Node object
*
- * @return DOCUMENT ME!
+ * @return View for the given node object.
*/
- View<CyNode> getNodeView(CyNode n);
+ public View<CyNode> getNodeView(final CyNode node);
+
/**
* Returns a list of Views for all CyNodes in the network.
*
- * @return DOCUMENT ME!
+ * @return List of all node views.
*/
- List<View<CyNode>> getNodeViews();
+ public List<View<CyNode>> getNodeViews();
+
/**
* Returns a View for a specified Edge.
@@ -71,7 +72,7 @@
*
* @return DOCUMENT ME!
*/
- View<CyEdge> getEdgeView(CyEdge n);
+ public View<CyEdge> getEdgeView(CyEdge n);
/**
* Returns a list of Views for all CyEdges in the network.
Modified:
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/CyNetworkViewFactory.java
===================================================================
---
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/CyNetworkViewFactory.java
2010-08-03 19:46:58 UTC (rev 21145)
+++
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/CyNetworkViewFactory.java
2010-08-03 20:35:28 UTC (rev 21146)
@@ -38,12 +38,15 @@
/**
- *
+ *
*/
public interface CyNetworkViewFactory {
- /** Create a NetworkView.
+
+ /**
+ * Create a NetworkView.
+ *
* @param network for which the CyNetworkView is to be created
* @return the CyNetworkView
*/
- CyNetworkView getNetworkViewFor(CyNetwork network);
+ public CyNetworkView getNetworkViewFor(CyNetwork network);
}
Modified:
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/DependentVisualPropertyCallback.java
===================================================================
---
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/DependentVisualPropertyCallback.java
2010-08-03 19:46:58 UTC (rev 21145)
+++
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/DependentVisualPropertyCallback.java
2010-08-03 20:35:28 UTC (rev 21146)
@@ -39,7 +39,8 @@
/**
- *
+ * TODO: remove this
+ *
*/
public abstract class DependentVisualPropertyCallback {
/** Called when mapping results change.
Modified:
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/RootVisualLexicon.java
===================================================================
---
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/RootVisualLexicon.java
2010-08-03 19:46:58 UTC (rev 21145)
+++
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/RootVisualLexicon.java
2010-08-03 20:35:28 UTC (rev 21146)
@@ -45,7 +45,7 @@
* @return VisualProperties, filtered with the DependentVisualProperty
* callbacks
*/
- Set<VisualProperty<?>> getVisualProperties(
+ public Set<VisualProperty<?>> getVisualProperties(
Collection<? extends View<?>> views, String objectType);
/**
@@ -58,7 +58,7 @@
*
* @return DOCUMENT ME!
*/
- Set<VisualProperty<?>> getVisualProperties(CyNetworkView networkview,
+ public Set<VisualProperty<?>> getVisualProperties(CyNetworkView
networkview,
String objectType);
@@ -71,4 +71,5 @@
* @return DOCUMENT ME!
*/
public VisualProperty<?> getVisualProperty(String idString);
+
}
Modified:
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/View.java
===================================================================
--- core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/View.java
2010-08-03 19:46:58 UTC (rev 21145)
+++ core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/View.java
2010-08-03 20:35:28 UTC (rev 21146)
@@ -43,59 +43,76 @@
*
* Think of it as a row in the viewmodel table.
*
- * @param <S> the base (model-level) object for which this is a View. For
example, CyNode or CyEdge
+ * @param <S> the base (model-level) object for which this is a View. For
example, CyNode or CyEdge.
+ * In the future versions, Attributes can be this parameter.
+ *
*/
public interface View<S> extends Identifiable {
/**
+ * Assign a value to the given Visual Property of this view.
+ *
* @param <T> Data type of the visual property. This can be subclasses
of type T.
* @param <V> Value of the visual property. This can be subclasses of
T.
- * @param vp the VisualProperty
+ *
+ * @param vp the VisualProperty (Node Color, Edge Width, etc.)
* @param value actual value stored in this visual property.
*/
- <T, V extends T> void setVisualProperty(VisualProperty<? extends T> vp,
V value);
+ public <T, V extends T> void setVisualProperty(VisualProperty<? extends
T> vp, V value);
+
/**
- * @param <T> DOCUMENT ME!
+ * Get the actual value for the given visual property.
+ *
+ * @param <T> Object type of the Visual Property (Color, Double, ...)
+ *
* @param vp the VisualProperty
- * @return DOCUMENT ME!
+ * @return Value associated with this View and Visual Property pair.
*/
- <T> T getVisualProperty(VisualProperty<T> vp);
+ public <T> T getVisualProperty(VisualProperty<T> vp);
+
/**
- * @param <T> DOCUMENT ME!
+ * Set locked value. This value will be used to bypass the style.
+ *
+ * @param <T>
* @param vp the VisualProperty
* @param value DOCUMENT ME!
*/
- <T, V extends T> void setLockedValue(VisualProperty<? extends T> vp, V
value);
+ public <T, V extends T> void setLockedValue(VisualProperty<? extends T>
vp, V value);
+
/**
* @param vp the VisualProperty
* @return true if current VisualProperty value is locked
*/
- boolean isValueLocked(VisualProperty<?> vp);
+ public boolean isValueLocked(VisualProperty<?> vp);
+
/**
* Clear value lock for given VisualProperty.
*
* @param vp the VisualProperty
*/
- void clearValueLock(VisualProperty<?> vp);
+ public void clearValueLock(VisualProperty<?> vp);
+
/**
- * DOCUMENT ME!
+ * Get source data structure, such as CyNode, CyEdge, etc.
*
- * @return DOCUMENT ME!
+ * @return Data object of this view.
*/
- S getSource();
+ public S getSource();
+
/**
* Adds the specified listener to this View.
*/
- void addViewChangeListener(ViewChangeListener vcl);
+ void addViewChangeListener(final ViewChangeListener vcl);
+
/**
* Removes the specified listener from this View.
*/
- void removeViewChangeListener(ViewChangeListener vcl);
+ void removeViewChangeListener(final ViewChangeListener vcl);
}
Modified:
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/VisualLexicon.java
===================================================================
---
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/VisualLexicon.java
2010-08-03 19:46:58 UTC (rev 21145)
+++
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/VisualLexicon.java
2010-08-03 20:35:28 UTC (rev 21146)
@@ -41,29 +41,37 @@
* Should be implemented as a service. 'Renderer' is simply anything that
* provides VisualProperties. With a 'VisualProperties as annotations' this
* won't be needed.
+ *
+ * @since Cytoscape 3.0
+ *
*/
public interface VisualLexicon {
+
/**
* Returns the Set of VisualPropertys supported by this Renderer.
*
- * @return DOCUMENT ME!
+ * @return Set of all visual properties
+ *
*/
public Set<VisualProperty<?>> getAllVisualProperties();
+
/**
- * DOCUMENT ME!
+ * Get collection of visual properties for a given object type
(node/edge/network).
*
* @param objectType
* GraphObject type. i.e., NODE/EDGE/NETWORK.
*
- * @return DOCUMENT ME!
+ * @return Collection of visual properties for the type
*/
- public Collection<VisualProperty<?>> getVisualProperties(String
objectType);
+ public Collection<VisualProperty<?>> getVisualProperties(final String
objectType);
+
/**
- * Used to add new Visual Property.
+ * Register new visual property to the lexicon.
*
* @param prop
*/
- public void addVisualProperty(VisualProperty<?> prop);
+ public void addVisualProperty(final VisualProperty<?> prop);
+
}
Modified:
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/VisualProperty.java
===================================================================
---
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/VisualProperty.java
2010-08-03 19:46:58 UTC (rev 21145)
+++
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/VisualProperty.java
2010-08-03 20:35:28 UTC (rev 21146)
@@ -52,53 +52,63 @@
*
* @return the string describing the object type
*/
- String getObjectType();
+ public String getObjectType();
+
/**
* The type of object represented by this property.
*
- * @return DOCUMENT ME!
+ * @return Type of object stored in this VP.
*/
- Class<T> getType();
+ public Class<T> getType();
+
/**
* The default value of this property.
*
* @return DOCUMENT ME!
*/
- T getDefault();
+ public T getDefault();
+
/**
* A short string used to identify this visual property and suitable for
* serializing to XML and other text formats.
*
* @return DOCUMENT ME!
*/
- String getIdString();
+ public String getIdString();
+
/**
* A short string suitable for presentation to humans. Should not be
used
* for serialization.
*
* @return DOCUMENT ME!
*/
- String getDisplayName();
+ public String getDisplayName();
- /**
- *
- * @return callback, or null if there isn't one
- */
- DependentVisualPropertyCallback dependentVisualPropertyCallback();
+
/**
* Returns a string of the specified value suitable for serializing to
XML
* other text output.
*/
- String getSerializableString(T value);
+ public String toString(final T value);
+
/**
* Returns an object of type T given a string serialized from the
getSerializableString(T value)
* method.
*/
- T parseSerializableString(String value);
+ public T parse(final String value);
+
+
+ /**
+ * TODO: remove this!
+ *
+ *
+ * @return callback, or null if there isn't one
+ */
+ DependentVisualPropertyCallback dependentVisualPropertyCallback();
}
Modified:
core3/viewmodel-api/trunk/src/test/java/org/cytoscape/view/model/IntegerVisualProperty.java
===================================================================
---
core3/viewmodel-api/trunk/src/test/java/org/cytoscape/view/model/IntegerVisualProperty.java
2010-08-03 19:46:58 UTC (rev 21145)
+++
core3/viewmodel-api/trunk/src/test/java/org/cytoscape/view/model/IntegerVisualProperty.java
2010-08-03 20:35:28 UTC (rev 21146)
@@ -41,12 +41,15 @@
public IntegerVisualProperty(final String ot, final Integer def, final
String id, final String name) {
super(ot,def,id,name);
}
+
+
+ public Integer parse(final String text) {
+ return Integer.valueOf(text);
+ }
+
- public String getSerializableString(final Integer value) {
+ @Override
+ public String toString(Integer value) {
return value.toString();
}
-
- public Integer parseSerializableString(final String text) {
- return Integer.valueOf(text);
- }
}
--
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.