Author: kono
Date: 2011-09-28 14:59:28 -0700 (Wed, 28 Sep 2011)
New Revision: 27019
Modified:
core3/api/trunk/viewmodel-api/src/main/java/org/cytoscape/view/model/CyNetworkView.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
Log:
Set methods for Node and Edge are consolidated into one.
Modified:
core3/api/trunk/viewmodel-api/src/main/java/org/cytoscape/view/model/CyNetworkView.java
===================================================================
---
core3/api/trunk/viewmodel-api/src/main/java/org/cytoscape/view/model/CyNetworkView.java
2011-09-28 21:09:52 UTC (rev 27018)
+++
core3/api/trunk/viewmodel-api/src/main/java/org/cytoscape/view/model/CyNetworkView.java
2011-09-28 21:59:28 UTC (rev 27019)
@@ -112,18 +112,12 @@
*/
void updateView();
+
/**
* Sets the default value to be used for the specified visual property.
* @param vp The visual property whose default value we're specifying.
* @param defaultValue The default value to be used for this visual
property for this view.
*/
- <T, V extends T> void setNodeViewDefault(VisualProperty<? extends T>
vp, V defaultValue);
+ <T, V extends T> void setViewDefault(final VisualProperty<? extends T>
vp, final V defaultValue);
- /**
- * Sets the default value to be used for the specified visual property.
- * @param vp The visual property whose default value we're specifying.
- * @param defaultValue The default value to be used for this visual
property for this view.
- */
- <T, V extends T> void setEdgeViewDefault(VisualProperty<? extends T>
vp, V defaultValue);
-
}
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
2011-09-28 21:09:52 UTC (rev 27018)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DGraphView.java
2011-09-28 21:59:28 UTC (rev 27019)
@@ -2964,11 +2964,14 @@
}
}
- public <T, V extends T> void setNodeViewDefault(final VisualProperty<?
extends T> vp, final V defaultValue) {
- m_nodeViewDefaultSupport.setNodeViewDefault(vp,defaultValue);
- }
- public <T, V extends T> void setEdgeViewDefault(final VisualProperty<?
extends T> vp, final V defaultValue) {
- m_edgeViewDefaultSupport.setEdgeViewDefault(vp,defaultValue);
+ @Override
+ public <T, V extends T> void setViewDefault(VisualProperty<? extends T>
vp, V defaultValue) {
+ final Class<?> targetType = vp.getTargetDataType();
+ if(targetType == CyNode.class)
+
m_nodeViewDefaultSupport.setNodeViewDefault(vp,defaultValue);
+ else if(targetType == CyEdge.class)
+
m_edgeViewDefaultSupport.setEdgeViewDefault(vp,defaultValue);
+
}
}
Modified:
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
===================================================================
---
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
2011-09-28 21:09:52 UTC (rev 27018)
+++
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java
2011-09-28 21:59:28 UTC (rev 27019)
@@ -112,14 +112,7 @@
}
/**
- * DOCUMENT ME!
- *
- * @param <V>
- * DOCUMENT ME!
- * @param t
- * DOCUMENT ME!
- *
- * @return DOCUMENT ME!
+ * {@inheritDoc}
*/
@SuppressWarnings("unchecked")
@Override
@@ -144,14 +137,7 @@
}
/**
- * Set the default value for a Visual Property
- *
- * @param <T>
- * Default value data type.
- * @param vp
- * DOCUMENT ME!
- * @param value
- * DOCUMENT ME!
+ * {@inheritDoc}
*/
@Override
public <V, S extends V> void setDefaultValue(final VisualProperty<V>
vp, final S value) {
@@ -181,8 +167,8 @@
final Collection<View<CyNetwork>> networkViewSet = new
HashSet<View<CyNetwork>>();
networkViewSet.add(networkView);
- applyNodeViewDefaults(networkView,
lexManager.getNodeVisualProperties());
- applyEdgeViewDefaults(networkView,
lexManager.getEdgeVisualProperties());
+ applyViewDefaults(networkView,
lexManager.getNodeVisualProperties());
+ applyViewDefaults(networkView,
lexManager.getEdgeVisualProperties());
// Current visual prop tree.
applyImpl(nodeViews, lexManager.getNodeVisualProperties());
@@ -229,7 +215,7 @@
}
}
- private void applyNodeViewDefaults(final CyNetworkView view, final
Collection<VisualProperty<?>> vps) {
+ private void applyViewDefaults(final CyNetworkView view, final
Collection<VisualProperty<?>> vps) {
for ( VisualProperty<?> vp : vps ) {
Object defaultValue = getDefaultValue(vp);
@@ -239,24 +225,24 @@
defaultValue = getDefaultValue(vp);
}
- view.setNodeViewDefault(vp,defaultValue);
+ view.setViewDefault(vp,defaultValue);
}
}
- private void applyEdgeViewDefaults(final CyNetworkView view, final
Collection<VisualProperty<?>> vps) {
+// private void applyEdgeViewDefaults(final CyNetworkView view, final
Collection<VisualProperty<?>> vps) {
+//
+// for ( VisualProperty<?> vp : vps ) {
+// Object defaultValue = getDefaultValue(vp);
+//
+// if (defaultValue == null) {
+// this.perVSDefaults.put(vp, vp.getDefault());
+// defaultValue = getDefaultValue(vp);
+// }
+//
+// view.setEdgeViewDefault(vp,defaultValue);
+// }
+// }
- for ( VisualProperty<?> vp : vps ) {
- Object defaultValue = getDefaultValue(vp);
-
- if (defaultValue == null) {
- this.perVSDefaults.put(vp, vp.getDefault());
- defaultValue = getDefaultValue(vp);
- }
-
- view.setEdgeViewDefault(vp,defaultValue);
- }
- }
-
/**
* DOCUMENT ME!
*
--
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.