Author: abeld
Date: 2008-12-26 02:02:39 -0800 (Fri, 26 Dec 2008)
New Revision: 15509
Modified:
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/integration_test/src/main/java/cytoscape/CyMain.java
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/presentation/src/main/java/org/cytoscape/presentation/internal/DiscreteVisualProperty.java
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/presentation/src/main/java/org/cytoscape/presentation/internal/VisualPropertyImpl.java
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/View.java
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/VisualProperty.java
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/VisualPropertyCatalog.java
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/internal/VisualPropertyCatalogImpl.java
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/test/java/org/cytoscape/viewmodel/internal/EdgeWidthVisualProperty.java
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/test/java/org/cytoscape/viewmodel/internal/NodeColorVisualProperty.java
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/vizmap/src/main/java/org/cytoscape/vizmap/internal/VisualStyleImpl.java
Log:
refactored-viewmodel: replace VisualProperty.GraphObjectType enum with String
constants
Modified:
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/integration_test/src/main/java/cytoscape/CyMain.java
===================================================================
---
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/integration_test/src/main/java/cytoscape/CyMain.java
2008-12-25 20:54:56 UTC (rev 15508)
+++
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/integration_test/src/main/java/cytoscape/CyMain.java
2008-12-26 10:02:39 UTC (rev 15509)
@@ -146,6 +146,7 @@
// TODO: add passthroughMapping to copy id to nodeLabel
TextPresentation p = pf.getTextPresentationFor(view);
System.out.println(p.render());
+
}
/**
Modified:
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/presentation/src/main/java/org/cytoscape/presentation/internal/DiscreteVisualProperty.java
===================================================================
---
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/presentation/src/main/java/org/cytoscape/presentation/internal/DiscreteVisualProperty.java
2008-12-25 20:54:56 UTC (rev 15508)
+++
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/presentation/src/main/java/org/cytoscape/presentation/internal/DiscreteVisualProperty.java
2008-12-26 10:02:39 UTC (rev 15509)
@@ -58,14 +58,14 @@
* added/removed. (Maybe UI will listen directly to OSGi events, maybe
* DiscreteVisualProperty will wrap OSGi events, so that UI can be
* OSGi-agnostic.)
- *
+ * @param <T> DOCUMENT ME!
*/
public class DiscreteVisualProperty<T> implements VisualProperty<T> {
private String id;
private String name;
private T defaultValue;
private Class<T> dataType;
- private VisualProperty.GraphObjectType objectType;
+ private String objectType;
private DependentVisualPropertyCallback callback;
private BundleContext bc;
@@ -80,7 +80,7 @@
* @param bc DOCUMENT ME!
*/
public DiscreteVisualProperty(final String id, final String name, final
Class<T> dataType, final T defaultValue,
- final VisualProperty.GraphObjectType
objectType, final BundleContext bc) {
+ final String objectType, final
BundleContext bc) {
this(id, name, dataType, defaultValue, objectType, null, bc);
}
@@ -96,7 +96,7 @@
* @param bc DOCUMENT ME!
*/
public DiscreteVisualProperty(final String id, final String name, final
Class<T> dataType, final T defaultValue,
- final VisualProperty.GraphObjectType
objectType,
+ final String objectType,
final DependentVisualPropertyCallback
callback, final BundleContext bc) {
this.id = id;
this.name = name;
@@ -114,6 +114,7 @@
*
* This implementation simply queries the OSGi framework for all
* services implementing dataType interface.
+ * @return DOCUMENT ME!
*/
public Set<T> getValues() { // copy-paste-modified from
CyEventHelperImpl in core3/model
@@ -147,7 +148,7 @@
*
* @return DOCUMENT ME!
*/
- public VisualProperty.GraphObjectType getObjectType() {
+ public String getObjectType() {
return objectType;
}
Modified:
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/presentation/src/main/java/org/cytoscape/presentation/internal/VisualPropertyImpl.java
===================================================================
---
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/presentation/src/main/java/org/cytoscape/presentation/internal/VisualPropertyImpl.java
2008-12-25 20:54:56 UTC (rev 15508)
+++
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/presentation/src/main/java/org/cytoscape/presentation/internal/VisualPropertyImpl.java
2008-12-26 10:02:39 UTC (rev 15509)
@@ -50,7 +50,7 @@
private String name;
private T defaultValue;
private Class<T> dataType;
- private VisualProperty.GraphObjectType objectType;
+ private String objectType;
private DependentVisualPropertyCallback callback;
/**
@@ -63,7 +63,7 @@
* @param objectType DOCUMENT ME!
*/
public VisualPropertyImpl(final String id, final String name, final T
defaultValue, final Class<T> dataType,
- final VisualProperty.GraphObjectType
objectType) {
+ final String objectType) {
this(id, name, defaultValue, dataType, objectType, null);
}
@@ -78,7 +78,7 @@
* @param callback DOCUMENT ME!
*/
public VisualPropertyImpl(final String id, final String name, final T
defaultValue, final Class<T> dataType,
- final VisualProperty.GraphObjectType
objectType,
+ final String objectType,
final DependentVisualPropertyCallback
callback) {
this.id = id;
this.name = name;
@@ -93,7 +93,7 @@
*
* @return DOCUMENT ME!
*/
- public VisualProperty.GraphObjectType getObjectType() {
+ public String getObjectType() {
return objectType;
}
Modified:
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/View.java
===================================================================
---
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/View.java
2008-12-25 20:54:56 UTC (rev 15508)
+++
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/View.java
2008-12-26 10:02:39 UTC (rev 15509)
@@ -46,10 +46,23 @@
* @param <S> the base (model-level) object for which this is a View. For
example, CyNode or CyEdge
*/
public interface View<S> extends Identifiable {
+ /**
+ * @param <T> DOCUMENT ME!
+ * @param vp the VisualProperty
+ * @param o DOCUMENT ME!
+ */
<T> void setVisualProperty(VisualProperty<T> vp, T o);
-
+ /**
+ * @param <T> DOCUMENT ME!
+ * @param vp the VisualProperty
+ * @return DOCUMENT ME!
+ */
<T> T getVisualProperty(VisualProperty<T> vp);
-
+ /**
+ * @param <T> DOCUMENT ME!
+ * @param vp the VisualProperty
+ * @param value DOCUMENT ME!
+ */
<T> void setLockedValue(VisualProperty<T> vp, T value);
/**
Modified:
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/VisualProperty.java
===================================================================
---
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/VisualProperty.java
2008-12-25 20:54:56 UTC (rev 15508)
+++
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/VisualProperty.java
2008-12-26 10:02:39 UTC (rev 15509)
@@ -38,25 +38,33 @@
/**
* FIXME
* Think of it as a column in the viewmodel table.
+ *
+ * Uses String constants as ObjectTypes, ie. to seperate NodeVisualProperties
from EdgeVisualProperties, etc.
+ * Ideally, we could use Class<? extends View<?>> or something like that, but
unfortunately that is impossible due to type erasure.
+ *
* @param <T> the dataType of the VisualProperty, ie. what kind of objects are
the values
*/
public interface VisualProperty<T> {
- /** FIXME: Strings be used instead, with "NODE", "EDGE",
- * "NETWORK" being the canonical values?
- *
- * Or, even better, is there a way to specify 'non-generic subclass of
{...@link View<S>}?'
- * (That being the actual constraint we want to enforce.)
+ /**
+ * Canonical ObjectType string for CyNode.
*/
- enum GraphObjectType {
- NODE,
- EDGE,
- NETWORK;
- }
+ String NODE = "NODE";
/**
+ * Canonical ObjectType string for CyEdge.
+ */
+ String EDGE = "EDGE";
+ /**
+ * Canonical ObjectType string for CyNetwork.
+ */
+ String NETWORK = "NETWORK";
+
+ /**
* Returns what type of objects this VisualProperty stores values for.
- * @return the object type
+ * canonical values are VisualProperty.NODE, etc.
+ *
+ * @return the string describing the object type
*/
- VisualProperty.GraphObjectType getObjectType();
+ String getObjectType();
/**
* The type of object represented by this property.
Modified:
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/VisualPropertyCatalog.java
===================================================================
---
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/VisualPropertyCatalog.java
2008-12-25 20:54:56 UTC (rev 15508)
+++
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/VisualPropertyCatalog.java
2008-12-26 10:02:39 UTC (rev 15509)
@@ -73,7 +73,7 @@
*
* @return DOCUMENT ME!
*/
- Collection<VisualProperty<?>>
collectionOfVisualProperties(VisualProperty.GraphObjectType objectType);
+ Collection<VisualProperty<?>> collectionOfVisualProperties(String
objectType);
/**
* DOCUMENT ME!
@@ -84,7 +84,7 @@
* @return DOCUMENT ME!
*/
Collection<VisualProperty<?>>
collectionOfVisualProperties(CyNetworkView networkview,
-
VisualProperty.GraphObjectType objectType);
+ String
objectType);
/**
* Returns the collection of all those VisualProperties that are in use
for
@@ -102,6 +102,6 @@
* @param objectType for which to filter
* @return VisualProperties, filtered with the DependentVisualProperty
callbacks
*/
- Collection<VisualProperty<?>> collectionOfVisualProperties(Collection<?
extends View<?>> views,
-
VisualProperty.GraphObjectType objectType);
+ Collection<VisualProperty<?>>
collectionOfVisualProperties(Collection<?extends View<?>> views,
+ String
objectType);
}
Modified:
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/internal/VisualPropertyCatalogImpl.java
===================================================================
---
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/internal/VisualPropertyCatalogImpl.java
2008-12-25 20:54:56 UTC (rev 15508)
+++
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/main/java/org/cytoscape/viewmodel/internal/VisualPropertyCatalogImpl.java
2008-12-26 10:02:39 UTC (rev 15509)
@@ -143,7 +143,7 @@
*
* @return DOCUMENT ME!
*/
- public Collection<VisualProperty<?>> collectionOfVisualProperties(final
VisualProperty.GraphObjectType objectType) {
+ public Collection<VisualProperty<?>> collectionOfVisualProperties(final
String objectType) {
return collectionOfVisualProperties((Collection<View<?>>) null,
objectType);
}
@@ -156,7 +156,7 @@
* @return DOCUMENT ME!
*/
public Collection<VisualProperty<?>> collectionOfVisualProperties(final
CyNetworkView networkview,
- final
VisualProperty.GraphObjectType objectType) {
+ final
String objectType) {
if (networkview != null) {
// FIXME: could filter Views based on objectType, right
here
final Collection<View<?>> views = new
HashSet<View<?>>(networkview.getCyNodeViews());
@@ -179,7 +179,7 @@
* @return VisualProperties
*/
public Collection<VisualProperty<?>> collectionOfVisualProperties(final
Collection<? extends View<?>> views,
- final
VisualProperty.GraphObjectType objectType) {
+ final
String objectType) {
final Collection<VisualProperty<?>> allVisualProperties =
readAllVisualPropertiesFromOSGI();
if (views == null)
@@ -207,7 +207,7 @@
/* return collection of only those that have a matching objectType */
private Collection<VisualProperty<?>> filterForObjectType(final
Collection<VisualProperty<?>> vps,
- final
VisualProperty.GraphObjectType objectType) {
+ final String
objectType) {
final ArrayList<VisualProperty<?>> result = new
ArrayList<VisualProperty<?>>();
for (VisualProperty<?> vp : vps) {
Modified:
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/test/java/org/cytoscape/viewmodel/internal/EdgeWidthVisualProperty.java
===================================================================
---
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/test/java/org/cytoscape/viewmodel/internal/EdgeWidthVisualProperty.java
2008-12-25 20:54:56 UTC (rev 15508)
+++
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/test/java/org/cytoscape/viewmodel/internal/EdgeWidthVisualProperty.java
2008-12-26 10:02:39 UTC (rev 15509)
@@ -46,8 +46,8 @@
*
* @return DOCUMENT ME!
*/
- public VisualProperty.GraphObjectType getObjectType() {
- return VisualProperty.GraphObjectType.EDGE;
+ public String getObjectType() {
+ return VisualProperty.EDGE;
}
/**
Modified:
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/test/java/org/cytoscape/viewmodel/internal/NodeColorVisualProperty.java
===================================================================
---
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/test/java/org/cytoscape/viewmodel/internal/NodeColorVisualProperty.java
2008-12-25 20:54:56 UTC (rev 15508)
+++
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/viewmodel/src/test/java/org/cytoscape/viewmodel/internal/NodeColorVisualProperty.java
2008-12-26 10:02:39 UTC (rev 15509)
@@ -48,8 +48,8 @@
*
* @return DOCUMENT ME!
*/
- public VisualProperty.GraphObjectType getObjectType() {
- return VisualProperty.GraphObjectType.NODE;
+ public String getObjectType() {
+ return VisualProperty.NODE;
}
/**
Modified:
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/vizmap/src/main/java/org/cytoscape/vizmap/internal/VisualStyleImpl.java
===================================================================
---
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/vizmap/src/main/java/org/cytoscape/vizmap/internal/VisualStyleImpl.java
2008-12-25 20:54:56 UTC (rev 15508)
+++
cytoscape3/branches/abeld-gsoc/dev/refactored-viewmodel/vizmap/src/main/java/org/cytoscape/vizmap/internal/VisualStyleImpl.java
2008-12-26 10:02:39 UTC (rev 15509)
@@ -135,11 +135,11 @@
final List<View<CyEdge>> edgeviews = view.getCyEdgeViews();
applyImpl(nodeviews,
- vpCatalog.collectionOfVisualProperties(nodeviews,
VisualProperty.GraphObjectType.NODE));
+ vpCatalog.collectionOfVisualProperties(nodeviews,
VisualProperty.NODE));
applyImpl(edgeviews,
- vpCatalog.collectionOfVisualProperties(edgeviews,
VisualProperty.GraphObjectType.EDGE));
+ vpCatalog.collectionOfVisualProperties(edgeviews,
VisualProperty.EDGE));
applyImpl(view.getNetworkView(),
-
vpCatalog.collectionOfVisualProperties(VisualProperty.GraphObjectType.NETWORK));
+
vpCatalog.collectionOfVisualProperties(VisualProperty.NETWORK));
}
// note: can't use applyImpl(List<View<?>>views ... ) because that does
not compile
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---