Author: kono
Date: 2012-08-20 17:02:44 -0700 (Mon, 20 Aug 2012)
New Revision: 30239
Modified:
core3/api/trunk/vizmap-api/src/test/java/org/cytoscape/view/vizmap/AbstractVisualStyleTest.java
core3/impl/trunk/ding-impl/ding-presentation-impl/src/test/java/org/cytoscape/ding/impl/DGraphViewApplyTest.java
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/CyActivator.java
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/AbstractApplyHandler.java
Log:
Some of the tests are modified.
Modified:
core3/api/trunk/vizmap-api/src/test/java/org/cytoscape/view/vizmap/AbstractVisualStyleTest.java
===================================================================
---
core3/api/trunk/vizmap-api/src/test/java/org/cytoscape/view/vizmap/AbstractVisualStyleTest.java
2012-08-20 23:07:23 UTC (rev 30238)
+++
core3/api/trunk/vizmap-api/src/test/java/org/cytoscape/view/vizmap/AbstractVisualStyleTest.java
2012-08-21 00:02:44 UTC (rev 30239)
@@ -27,7 +27,6 @@
protected static final String attrName = "Sample attr 1";
-
protected static final Color RED1 = new Color(200, 0, 0);
protected static final Color GREEN1 = new Color(0, 200, 0);
protected static final Color RED2 = new Color(100, 0, 0);
@@ -51,12 +50,12 @@
@Test
public void testVisualStyle() {
+ // Make sure all required o
assertNotNull(style);
assertNotNull(originalTitle);
assertNotNull(newTitle);
assertNotNull(network);
assertNotNull(networkView);
-// assertNotNull(colorMapping1);
assertNotNull(networkView.getNodeView(node1));
assertNotNull(networkView.getNodeView(node2));
assertNotNull(networkView.getNodeView(node3));
@@ -70,18 +69,13 @@
style.setTitle(newTitle);
assertEquals(newTitle, style.getTitle());
-// style.addVisualMappingFunction(colorMapping1);
-// style.addVisualMappingFunction(colorMapping2);
- style.setDefaultValue(BasicVisualLexicon.NODE_PAINT,
Color.BLACK);
- style.setDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR,
Color.PINK);
-
final Paint defaultNodeColor =
BasicVisualLexicon.NODE_FILL_COLOR.getDefault();
final Paint defaultNodePaint =
BasicVisualLexicon.NODE_PAINT.getDefault();
final View<CyNode> nodeView1 = networkView.getNodeView(node1);
final View<CyNode> nodeView2 = networkView.getNodeView(node2);
final View<CyNode> nodeView3 = networkView.getNodeView(node3);
- // Before apply call, all node views should have same color
(property default).
+ // Before apply call, all node views should have same color
(Visual Property default).
assertEquals(defaultNodeColor,
nodeView1.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
assertEquals(defaultNodeColor,
nodeView2.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
assertEquals(defaultNodeColor,
nodeView3.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
@@ -89,28 +83,39 @@
assertEquals(defaultNodePaint,
nodeView2.getVisualProperty(BasicVisualLexicon.NODE_PAINT));
assertEquals(defaultNodePaint,
nodeView3.getVisualProperty(BasicVisualLexicon.NODE_PAINT));
- // Two existing mappings.
-// assertEquals(2, style.getAllVisualMappingFunctions().size());
+ // Set some default values for the VS
+ style.setDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR,
Color.PINK);
+ style.setDefaultValue(BasicVisualLexicon.NODE_WIDTH, 60d);
+ style.setDefaultValue(BasicVisualLexicon.NODE_BORDER_WIDTH, 7d);
- // Apply mappings.
+ assertEquals(Color.PINK,
style.getDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR));
+ assertEquals(Double.valueOf(60d),
style.getDefaultValue(BasicVisualLexicon.NODE_WIDTH));
+ assertEquals(Double.valueOf(7d),
style.getDefaultValue(BasicVisualLexicon.NODE_BORDER_WIDTH));
+
+ // Apply default values.
style.apply(networkView);
- // Check defaults
- assertEquals(Color.PINK,
style.getDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR));
- assertEquals(Color.BLACK,
style.getDefaultValue(BasicVisualLexicon.NODE_PAINT));
+ // Check defaults are correct
+ assertEquals(Color.PINK,
nodeView1.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
+ assertEquals(Double.valueOf(60d),
nodeView1.getVisualProperty(BasicVisualLexicon.NODE_WIDTH));
+ assertEquals(Double.valueOf(7d),
nodeView1.getVisualProperty(BasicVisualLexicon.NODE_BORDER_WIDTH));
- // Check results.
-// assertEquals(RED1,
nodeView1.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR)); // TODO
-// assertEquals(RED1,
nodeView2.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
+ // Check others
+ assertEquals(Color.PINK,
nodeView2.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
+ assertEquals(Color.PINK,
nodeView3.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
// Apply to individual values
style.setDefaultValue(BasicVisualLexicon.NODE_FILL_COLOR,
Color.YELLOW);
final CyRow row =
networkView.getModel().getRow(nodeView3.getModel());
+
+ // Apply only to node 3.
style.apply(row, nodeView3);
-// assertEquals(RED1,
nodeView1.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR)); // TODO
-// assertEquals(RED1,
nodeView2.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
- //assertEquals(Color.YELLOW,
nodeView3.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
+
+ // Make sure only node 3 has different color.
+ assertEquals(Color.PINK,
nodeView1.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
+ assertEquals(Color.PINK,
nodeView2.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
+ assertEquals(Color.YELLOW,
nodeView3.getVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR));
}
@Test
Modified:
core3/impl/trunk/ding-impl/ding-presentation-impl/src/test/java/org/cytoscape/ding/impl/DGraphViewApplyTest.java
===================================================================
---
core3/impl/trunk/ding-impl/ding-presentation-impl/src/test/java/org/cytoscape/ding/impl/DGraphViewApplyTest.java
2012-08-20 23:07:23 UTC (rev 30238)
+++
core3/impl/trunk/ding-impl/ding-presentation-impl/src/test/java/org/cytoscape/ding/impl/DGraphViewApplyTest.java
2012-08-21 00:02:44 UTC (rev 30239)
@@ -239,7 +239,7 @@
assertEquals(8, dgv.m_nodeDetails.getLabelFont(node2,
0).getSize());
assertEquals(20, dgv.m_nodeDetails.getLabelFont(node3,
0).getSize());
- final Font defFont = new Font("SansSerif", Font.BOLD, 22);
+ final Font defFont = new Font("SansSerif", Font.PLAIN, 22);
final Font mapFont = new Font("Serif", Font.PLAIN, 40);
dgv.setViewDefault(DVisualLexicon.NODE_LABEL_FONT_FACE,
defFont);
nodeView1.setVisualProperty(DVisualLexicon.NODE_LABEL_FONT_FACE, mapFont);
@@ -248,6 +248,7 @@
assertEquals(mapFont.getFontName(),
dgv.m_nodeDetails.getLabelFont(node1, 0).getFontName());
assertEquals(mapFont.getFontName(),
dgv.m_nodeDetails.getLabelFont(node2, 0).getFontName());
assertEquals(defFont.getFontName(),
dgv.m_nodeDetails.getLabelFont(node3, 0).getFontName());
+
}
@Test
Modified:
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/CyActivator.java
===================================================================
---
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/CyActivator.java
2012-08-20 23:07:23 UTC (rev 30238)
+++
core3/impl/trunk/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/CyActivator.java
2012-08-21 00:02:44 UTC (rev 30239)
@@ -64,6 +64,7 @@
import org.cytoscape.view.vizmap.gui.util.DiscreteMappingGenerator;
import org.cytoscape.work.ServiceProperties;
import org.cytoscape.work.TaskFactory;
+import org.cytoscape.work.TaskManager;
import org.cytoscape.work.swing.DialogTaskManager;
import org.osgi.framework.BundleContext;
@@ -80,7 +81,7 @@
public void start(BundleContext bc) {
CyApplicationConfiguration cyApplicationConfigurationServiceRef
= getService(bc,CyApplicationConfiguration.class);
- DialogTaskManager dialogTaskManagerServiceRef =
getService(bc,DialogTaskManager.class);
+ TaskManager dialogTaskManagerServiceRef =
getService(bc,TaskManager.class);
VisualStyleFactory visualStyleFactoryServiceRef =
getService(bc,VisualStyleFactory.class);
VisualMappingManager vmmServiceRef =
getService(bc,VisualMappingManager.class);
CyNetworkManager cyNetworkManagerServiceRef =
getService(bc,CyNetworkManager.class);
Modified:
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/AbstractApplyHandler.java
===================================================================
---
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/AbstractApplyHandler.java
2012-08-20 23:07:23 UTC (rev 30238)
+++
core3/impl/trunk/vizmap-impl/impl/src/main/java/org/cytoscape/view/vizmap/internal/AbstractApplyHandler.java
2012-08-21 00:02:44 UTC (rev 30239)
@@ -59,12 +59,16 @@
if (children.size() != 0)
return;
+ // This is the view default value.
Object defaultValue = style.getDefaultValue(vp);
if (defaultValue == null) {
((VisualStyleImpl) style).getStyleDefaults().put(vp,
vp.getDefault());
defaultValue = style.getDefaultValue(vp);
}
+
+ // TODO: is this correct?
+ view.setVisualProperty(vp, defaultValue);
}
private void override(final CyRow row, final View<T> view) {
--
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.