Author: kono Date: 2011-05-23 16:54:32 -0700 (Mon, 23 May 2011) New Revision: 25513
Modified: core3/vizmap-api/trunk/pom.xml core3/vizmap-api/trunk/src/test/java/org/cytoscape/view/vizmap/AbstractVisualStyleTest.java core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleFactoryImpl.java core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java core3/vizmap-impl/trunk/impl/src/test/java/org/cytoscape/view/vizmap/VisualStyleTest.java core3/vizmap-impl/trunk/pom.xml Log: Adding tests to check visual style functionality. Still there are several bugs in apply() method. Modified: core3/vizmap-api/trunk/pom.xml =================================================================== --- core3/vizmap-api/trunk/pom.xml 2011-05-23 21:03:54 UTC (rev 25512) +++ core3/vizmap-api/trunk/pom.xml 2011-05-23 23:54:32 UTC (rev 25513) @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <parent> <artifactId>parent</artifactId> <groupId>org.cytoscape</groupId> - <version>3.0.0-alpha7</version> + <version>3.0.0-alpha8-SNAPSHOT</version> </parent> <properties> @@ -141,5 +142,23 @@ <version>3.0.0-alpha3</version> <scope>test</scope> </dependency> + <dependency> + <groupId>org.cytoscape</groupId> + <artifactId>default-mappings</artifactId> + <version>3.0.0-alpha4-SNAPSHOT</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.cytoscape</groupId> + <artifactId>test-support</artifactId> + <version>3.0.0-alpha3-SNAPSHOT</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.cytoscape</groupId> + <artifactId>property-api</artifactId> + <version>3.0.0-alpha5-SNAPSHOT</version> + <scope>test</scope> + </dependency> </dependencies> </project> Modified: core3/vizmap-api/trunk/src/test/java/org/cytoscape/view/vizmap/AbstractVisualStyleTest.java =================================================================== --- core3/vizmap-api/trunk/src/test/java/org/cytoscape/view/vizmap/AbstractVisualStyleTest.java 2011-05-23 21:03:54 UTC (rev 25512) +++ core3/vizmap-api/trunk/src/test/java/org/cytoscape/view/vizmap/AbstractVisualStyleTest.java 2011-05-23 23:54:32 UTC (rev 25513) @@ -1,16 +1,34 @@ package org.cytoscape.view.vizmap; +import static org.junit.Assert.*; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import static org.mockito.Mockito.mock; +import java.awt.Color; +import java.awt.Paint; +import java.util.Properties; + +import org.cytoscape.model.CyEdge; +import org.cytoscape.model.CyNetwork; +import org.cytoscape.model.CyNode; +import org.cytoscape.model.CyTable; +import org.cytoscape.property.CyProperty; +import org.cytoscape.test.support.NetworkViewTestSupport; +import org.cytoscape.view.model.CyNetworkView; +import org.cytoscape.view.model.View; import org.cytoscape.view.model.VisualLexicon; +import org.cytoscape.view.presentation.property.MinimalVisualLexicon; +import org.cytoscape.view.vizmap.mappings.DiscreteMapping; import org.junit.After; +import org.junit.Before; import org.junit.Test; public abstract class AbstractVisualStyleTest { - + protected static final String attrName = "Sample attr 1"; + protected VisualStyle style; protected String originalTitle; @@ -18,6 +36,53 @@ protected VisualLexicon lexicon; + protected DiscreteMapping<String, Paint> colorMapping1; + protected DiscreteMapping<String, Paint> colorMapping2; + + + // Simple test network + protected CyNode node1; + protected CyNode node2; + protected CyNode node3; + protected CyEdge edge; + protected CyNetwork network; + protected CyNetworkView networkView; + + + @Before + public void setUp() throws Exception { + + final Class<String> type = String.class; + colorMapping1 = new DiscreteMapping<String, Paint>(attrName, type, + MinimalVisualLexicon.NODE_PAINT); + colorMapping2 = new DiscreteMapping<String, Paint>(attrName, type, + MinimalVisualLexicon.NODE_FILL_COLOR); + + colorMapping1.putMapValue("red", Color.RED); + colorMapping1.putMapValue("green", Color.GREEN); + colorMapping1.putMapValue("blue", Color.BLUE); + + colorMapping2.putMapValue("red", Color.RED); + colorMapping2.putMapValue("green", Color.GREEN); + colorMapping2.putMapValue("blue", Color.BLUE); + + CyProperty<Properties> cyProperties = mock(CyProperty.class); + NetworkViewTestSupport nvts = new NetworkViewTestSupport(cyProperties); + network = nvts.getNetworkFactory().getInstance(); + + node1 = network.addNode(); + node2 = network.addNode(); + node3 = network.addNode(); + + edge = network.addEdge(node1, node2, true); + CyTable nodeTable = network.getDefaultNodeTable(); + nodeTable.createColumn(attrName, String.class, true); + nodeTable.getRow(node1.getSUID()).set(attrName, "red"); + nodeTable.getRow(node2.getSUID()).set(attrName, "green"); + nodeTable.getRow(node3.getSUID()).set(attrName, "foo"); + + networkView = nvts.getNetworkViewFactory().getNetworkView(network); + } @After public void tearDown() throws Exception { @@ -29,10 +94,48 @@ assertNotNull(style); assertNotNull(originalTitle); assertNotNull(newTitle); + assertNotNull(network); + assertNotNull(networkView); + assertNotNull(colorMapping1); + assertNotNull(networkView.getNodeView(node1)); + assertNotNull(networkView.getNodeView(node2)); + assertNotNull(networkView.getNodeView(node3)); + assertEquals("red", networkView.getModel().getDefaultNodeTable().getRow(node1.getSUID()).get(attrName, String.class)); + assertEquals("green", networkView.getModel().getDefaultNodeTable().getRow(node2.getSUID()).get(attrName, String.class)); + assertEquals("foo", networkView.getModel().getDefaultNodeTable().getRow(node3.getSUID()).get(attrName, String.class)); + // Test title assertEquals(originalTitle, style.getTitle()); style.setTitle(newTitle); assertEquals(newTitle, style.getTitle()); + + style.addVisualMappingFunction(colorMapping1); + style.addVisualMappingFunction(colorMapping2); + style.setDefaultValue(MinimalVisualLexicon.NODE_PAINT, Color.BLACK); + style.setDefaultValue(MinimalVisualLexicon.NODE_FILL_COLOR, Color.PINK); + + final Paint defaultNodeColor = MinimalVisualLexicon.NODE_FILL_COLOR.getDefault(); + final View<CyNode> nodeView1 = networkView.getNodeView(node1); + final View<CyNode> nodeView2 = networkView.getNodeView(node2); + final View<CyNode> nodeView3 = networkView.getNodeView(node3); + assertEquals(defaultNodeColor, nodeView2.getVisualProperty(MinimalVisualLexicon.NODE_FILL_COLOR)); + + assertEquals(2, style.getAllVisualMappingFunctions().size()); + style.apply(networkView); + assertEquals(Color.PINK, style.getDefaultValue(MinimalVisualLexicon.NODE_FILL_COLOR)); + + + Paint prop1 = nodeView1.getVisualProperty(MinimalVisualLexicon.NODE_FILL_COLOR); +// assertEquals(Color.RED, nodeView1.getVisualProperty(MinimalVisualLexicon.NODE_FILL_COLOR)); +// +// assertEquals(Color.PINK, networkView.getNodeView(node3).getVisualProperty(MinimalVisualLexicon.NODE_FILL_COLOR)); +// assertEquals(Color.GREEN, networkView.getNodeView(node2).getVisualProperty(MinimalVisualLexicon.NODE_FILL_COLOR)); +// +// assertEquals(Color.RED, networkView.getNodeView(node1).getVisualProperty(MinimalVisualLexicon.NODE_PAINT)); + + //assertEquals(Color.BLACK, networkView.getNodeView(node3)); + } + } Modified: core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleFactoryImpl.java =================================================================== --- core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleFactoryImpl.java 2011-05-23 21:03:54 UTC (rev 25512) +++ core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleFactoryImpl.java 2011-05-23 23:54:32 UTC (rev 25513) @@ -10,9 +10,9 @@ import org.cytoscape.view.vizmap.VisualStyleFactory; public class VisualStyleFactoryImpl implements VisualStyleFactory { - + private final VisualLexiconManager lexManager; - + public VisualStyleFactoryImpl(final VisualLexiconManager lexManager) { this.lexManager = lexManager; } @@ -26,36 +26,37 @@ return copy; } - + @Override public VisualStyle getInstance(String title) { return new VisualStyleImpl(title, lexManager); } - + private <V, S extends V> void copyDefaultValues(final VisualStyle original, final VisualStyle copy) { - Set<VisualProperty<?>> visualProps = new HashSet<VisualProperty<?>>(); - visualProps.addAll(lexManager.getNetworkVisualProperties()); - visualProps.addAll(lexManager.getNodeVisualProperties()); - visualProps.addAll(lexManager.getEdgeVisualProperties()); - - for (VisualProperty<?> vp : visualProps) { - S value = (S) original.getDefaultValue(vp); - - // TODO: if the value is not immutable, this can create problems, since it is not setting a copy! - if (value != null) - copy.setDefaultValue((VisualProperty<V>) vp, value); - } + Set<VisualProperty<?>> visualProps = new HashSet<VisualProperty<?>>(); + visualProps.addAll(lexManager.getNetworkVisualProperties()); + visualProps.addAll(lexManager.getNodeVisualProperties()); + visualProps.addAll(lexManager.getEdgeVisualProperties()); + + for (VisualProperty<?> vp : visualProps) { + S value = (S) original.getDefaultValue(vp); + + // TODO: if the value is not immutable, this can create problems, + // since it is not setting a copy! + if (value != null) + copy.setDefaultValue((VisualProperty<V>) vp, value); + } } - + private void copyMappingFunctions(final VisualStyle original, final VisualStyle copy) { - Collection<VisualMappingFunction<?, ?>> allMapping = original.getAllVisualMappingFunctions(); - - for (VisualMappingFunction<?, ?> mapping : allMapping) { - String attrName = mapping.getMappingAttributeName(); - VisualProperty<?> vp = mapping.getVisualProperty(); - - // TODO: clone mappings -// copy.addVisualMappingFunction(mapping); - } + Collection<VisualMappingFunction<?, ?>> allMapping = original.getAllVisualMappingFunctions(); + + for (VisualMappingFunction<?, ?> mapping : allMapping) { + String attrName = mapping.getMappingAttributeName(); + VisualProperty<?> vp = mapping.getVisualProperty(); + + // TODO: clone mappings + // copy.addVisualMappingFunction(mapping); + } } } Modified: core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java =================================================================== --- core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java 2011-05-23 21:03:54 UTC (rev 25512) +++ core3/vizmap-impl/trunk/impl/src/main/java/org/cytoscape/view/vizmap/internal/VisualStyleImpl.java 2011-05-23 23:54:32 UTC (rev 25513) @@ -56,266 +56,267 @@ */ public class VisualStyleImpl implements VisualStyle { - private static final Logger logger = LoggerFactory.getLogger(VisualStyleImpl.class); + private static final Logger logger = LoggerFactory.getLogger(VisualStyleImpl.class); - private static final String DEFAULT_TITLE = "?"; + private static final String DEFAULT_TITLE = "?"; - private final Map<VisualProperty<?>, VisualMappingFunction<?, ?>> mappings; - private final Map<VisualProperty<?>, Object> perVSDefaults; + private final Map<VisualProperty<?>, VisualMappingFunction<?, ?>> mappings; + private final Map<VisualProperty<?>, Object> perVSDefaults; - private final VisualLexiconManager lexManager; + private final VisualLexiconManager lexManager; - private String title; + private String title; - /** - * Creates a new VisualStyleImpl object. - * - * @param eventHelper - * DOCUMENT ME! - * @param rootLexicon - * DOCUMENT ME! - */ - public VisualStyleImpl(final String title, final VisualLexiconManager lexManager) { + /** + * Creates a new VisualStyleImpl object. + * + * @param eventHelper + * DOCUMENT ME! + * @param rootLexicon + * DOCUMENT ME! + */ + public VisualStyleImpl(final String title, final VisualLexiconManager lexManager) { - if (lexManager == null) - throw new NullPointerException("Lexicon Manager is missing."); + if (lexManager == null) + throw new NullPointerException("Lexicon Manager is missing."); - this.lexManager = lexManager; + this.lexManager = lexManager; - if (title == null) - this.title = DEFAULT_TITLE; - else - this.title = title; + if (title == null) + this.title = DEFAULT_TITLE; + else + this.title = title; - mappings = new HashMap<VisualProperty<?>, VisualMappingFunction<?, ?>>(); - perVSDefaults = new HashMap<VisualProperty<?>, Object>(); + mappings = new HashMap<VisualProperty<?>, VisualMappingFunction<?, ?>>(); + perVSDefaults = new HashMap<VisualProperty<?>, Object>(); - logger.info("New Visual Style Created: Style Name = " + this.title); - } + logger.info("New Visual Style Created: Style Name = " + this.title); + } - /** - * DOCUMENT ME! - * - * @param c - * DOCUMENT ME! - */ - @Override - public void addVisualMappingFunction(final VisualMappingFunction<?, ?> mapping) { - mappings.put(mapping.getVisualProperty(), mapping); - } + /** + * DOCUMENT ME! + * + * @param c + * DOCUMENT ME! + */ + @Override + public void addVisualMappingFunction(final VisualMappingFunction<?, ?> mapping) { + mappings.put(mapping.getVisualProperty(), mapping); + } - /** - * DOCUMENT ME! - * - * @param <V> - * DOCUMENT ME! - * @param t - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - @SuppressWarnings("unchecked") - public <V> VisualMappingFunction<?, V> getVisualMappingFunction(VisualProperty<V> t) { - return (VisualMappingFunction<?, V>) mappings.get(t); - } + /** + * DOCUMENT ME! + * + * @param <V> + * DOCUMENT ME! + * @param t + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + @SuppressWarnings("unchecked") + public <V> VisualMappingFunction<?, V> getVisualMappingFunction(VisualProperty<V> t) { + return (VisualMappingFunction<?, V>) mappings.get(t); + } - /** - * DOCUMENT ME! - * - * @param <V> - * DOCUMENT ME! - * @param t - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - @SuppressWarnings("unchecked") - @Override - public void removeVisualMappingFunction(VisualProperty<?> t) { - mappings.remove(t); - } + /** + * DOCUMENT ME! + * + * @param <V> + * DOCUMENT ME! + * @param t + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + @SuppressWarnings("unchecked") + @Override + public void removeVisualMappingFunction(VisualProperty<?> t) { + mappings.remove(t); + } - /** - * DOCUMENT ME! - * - * @param <T> - * DOCUMENT ME! - * @param vp - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - @SuppressWarnings("unchecked") - @Override - public <V> V getDefaultValue(final VisualProperty<V> vp) { - return (V) perVSDefaults.get(vp); - } + /** + * DOCUMENT ME! + * + * @param <T> + * DOCUMENT ME! + * @param vp + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + @SuppressWarnings("unchecked") + @Override + public <V> V getDefaultValue(final VisualProperty<V> vp) { + return (V) perVSDefaults.get(vp); + } - /** - * Set the default value for a Visual Property - * - * @param <T> - * Default value data type. - * @param vp - * DOCUMENT ME! - * @param value - * DOCUMENT ME! - */ - @Override - public <V, S extends V> void setDefaultValue(final VisualProperty<V> vp, final S value) { - perVSDefaults.put(vp, value); - } - - /** - * DOCUMENT ME! - * - * @param networkView - * DOCUMENT ME! - */ - @Override - public void apply(final CyNetworkView networkView) { - if (networkView == null) { - logger.warn("Tried to apply Visual Style to null view"); - return; + /** + * Set the default value for a Visual Property + * + * @param <T> + * Default value data type. + * @param vp + * DOCUMENT ME! + * @param value + * DOCUMENT ME! + */ + @Override + public <V, S extends V> void setDefaultValue(final VisualProperty<V> vp, final S value) { + perVSDefaults.put(vp, value); } - logger.debug("Visual Style Apply method called: " + this.title); + /** + * DOCUMENT ME! + * + * @param networkView + * DOCUMENT ME! + */ + @Override + public void apply(final CyNetworkView networkView) { + if (networkView == null) { + logger.warn("Tried to apply Visual Style to null view"); + return; + } - final Collection<View<CyNode>> nodeViews = networkView.getNodeViews(); - final Collection<View<CyEdge>> edgeViews = networkView.getEdgeViews(); - final Collection<View<CyNetwork>> networkViewSet = new HashSet<View<CyNetwork>>(); - networkViewSet.add(networkView); + logger.debug("Visual Style Apply method called: " + this.title); - // Current visual prop tree. - applyImpl(nodeViews, lexManager.getNodeVisualProperties()); - applyImpl(edgeViews, lexManager.getEdgeVisualProperties()); - applyImpl(networkViewSet, lexManager.getNetworkVisualProperties()); + final Collection<View<CyNode>> nodeViews = networkView.getNodeViews(); + final Collection<View<CyEdge>> edgeViews = networkView.getEdgeViews(); + final Collection<View<CyNetwork>> networkViewSet = new HashSet<View<CyNetwork>>(); + networkViewSet.add(networkView); - logger.debug("Visual Style applied: " + this.title + "\n"); - } + // Current visual prop tree. + applyImpl(nodeViews, lexManager.getNodeVisualProperties()); + applyImpl(edgeViews, lexManager.getEdgeVisualProperties()); + applyImpl(networkViewSet, lexManager.getNetworkVisualProperties()); - /** - * DOCUMENT ME! - * - * @param <T> - * DOCUMENT ME! - * @param views - * DOCUMENT ME! - * @param visualProperties - * DOCUMENT ME! - */ - private void applyImpl(final Collection<? extends View<?>> views, - final Collection<VisualProperty<?>> visualProperties) { + logger.debug("Visual Style applied: " + this.title + "\n"); + } - for (VisualProperty<?> vp : visualProperties) - applyToView(views, vp); - } + /** + * DOCUMENT ME! + * + * @param <T> + * DOCUMENT ME! + * @param views + * DOCUMENT ME! + * @param visualProperties + * DOCUMENT ME! + */ + private void applyImpl(final Collection<? extends View<?>> views, + final Collection<VisualProperty<?>> visualProperties) { + + for (VisualProperty<?> vp : visualProperties) + applyToView(views, vp); + } - - private void applyToView(final Collection<? extends View<?>> views, final VisualProperty<?> vp) { + private void applyToView(final Collection<? extends View<?>> views, final VisualProperty<?> vp) { - final VisualMappingFunction<?, ?> mapping = getVisualMappingFunction(vp); + logger.info("###### Apply called for " + vp.getDisplayName()); + + final VisualMappingFunction<?, ?> mapping = getVisualMappingFunction(vp); - if (mapping != null) { - // Mapping is available for this VP. Apply it. - logger.debug("###### Mapping found for " + vp.getDisplayName() + ": " + mapping.toString()); - final Object styleDefaultValue = getDefaultValue(vp); - for (View<?> view : views) { - mapping.apply((View<? extends CyTableEntry>) view); + if (mapping != null) { + // Mapping is available for this VP. Apply it. + logger.debug("###### Visual Mapping found for " + vp.getDisplayName() + ": " + mapping.toString()); + final Object styleDefaultValue = getDefaultValue(vp); + for (View<?> view : views) { + mapping.apply((View<? extends CyTableEntry>) view); - // FIXME: this condition is not enough in some cases. - if (view.getVisualProperty(vp) == vp.getDefault()) - view.setVisualProperty(vp, styleDefaultValue); - } - } else if (!vp.shouldIgnoreDefault()) { - // Ignore defaults flag is OFF. Apply defaults. - applyStyleDefaults((Collection<View<?>>) views, vp); - } else if (vp.getDefault() instanceof Visualizable == false) { - Object defVal = getDefaultValue(vp); - if (defVal == null) { - this.perVSDefaults.put(vp, vp.getDefault()); - defVal = getDefaultValue(vp); - } - for (View<?> view : views) { - Object val = view.getVisualProperty(vp); - // logger.debug(vp.getDisplayName() + ": Ignore flag. Val = " + - // val); - // logger.debug(vp.getDisplayName() + ": DEF Val = " + defVal); - if (defVal.equals(val) == false) - view.setVisualProperty(vp, val); - } + // FIXME: this condition is not enough in some cases. + if (view.getVisualProperty(vp) == vp.getDefault()) + view.setVisualProperty(vp, styleDefaultValue); + } + } else if (!vp.shouldIgnoreDefault()) { + // Ignore defaults flag is OFF. Apply defaults. + applyStyleDefaults((Collection<View<?>>) views, vp); + } else if (vp.getDefault() instanceof Visualizable == false) { + Object defVal = getDefaultValue(vp); + if (defVal == null) { + this.perVSDefaults.put(vp, vp.getDefault()); + defVal = getDefaultValue(vp); + } + for (View<?> view : views) { + Object val = view.getVisualProperty(vp); + // logger.debug(vp.getDisplayName() + ": Ignore flag. Val = " + + // val); + // logger.debug(vp.getDisplayName() + ": DEF Val = " + defVal); + if (defVal.equals(val) == false) + view.setVisualProperty(vp, val); + } + } } - } - private void applyStyleDefaults(final Collection<View<?>> views, final VisualProperty<?> vp) { + private void applyStyleDefaults(final Collection<View<?>> views, final VisualProperty<?> vp) { - Object defaultValue = getDefaultValue(vp); + Object defaultValue = getDefaultValue(vp); - if (defaultValue == null) { - this.perVSDefaults.put(vp, vp.getDefault()); - defaultValue = getDefaultValue(vp); - } - // reset all rows to allow usage of default value: - for (final View<?> viewModel : views) { + if (defaultValue == null) { + this.perVSDefaults.put(vp, vp.getDefault()); + defaultValue = getDefaultValue(vp); + } + // reset all rows to allow usage of default value: + for (final View<?> viewModel : views) { - // Not a leaf VP. We can ignore those. - if (vp.getDefault() instanceof Visualizable) - continue; + // Not a leaf VP. We can ignore those. + if (vp.getDefault() instanceof Visualizable) + continue; - final Object currentValue = viewModel.getVisualProperty(vp); + final Object currentValue = viewModel.getVisualProperty(vp); - // // Some of the VP has null defaults. - // if (currentValue == null) - // continue; + // // Some of the VP has null defaults. + // if (currentValue == null) + // continue; - // // If equals, it is not necessary to set new value. - // if (currentValue.equals(defaultValue)) - // continue; - // - // + // // If equals, it is not necessary to set new value. + // if (currentValue.equals(defaultValue)) + // continue; + // + // - // This is a leaf, and need to be updated. - viewModel.setVisualProperty(vp, defaultValue); + // This is a leaf, and need to be updated. + viewModel.setVisualProperty(vp, defaultValue); - // logger.debug(vp.getDisplayName() + " updated from: " + - // currentValue + " to " + defaultValue); + // logger.debug(vp.getDisplayName() + " updated from: " + + // currentValue + " to " + defaultValue); + } } - } - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - @Override - public String getTitle() { - return title; - } + /** + * DOCUMENT ME! + * + * @return DOCUMENT ME! + */ + @Override + public String getTitle() { + return title; + } - /** - * DOCUMENT ME! - * - * @param title - * DOCUMENT ME! - */ - @Override - public void setTitle(String title) { - this.title = title; - } + /** + * DOCUMENT ME! + * + * @param title + * DOCUMENT ME! + */ + @Override + public void setTitle(String title) { + this.title = title; + } - /** - * toString method returns title of this Visual Style. - * - * @return DOCUMENT ME! - */ - @Override - public String toString() { - return this.title; - } + /** + * toString method returns title of this Visual Style. + * + * @return DOCUMENT ME! + */ + @Override + public String toString() { + return this.title; + } - @Override - public Collection<VisualMappingFunction<?, ?>> getAllVisualMappingFunctions() { - return mappings.values(); - } + @Override + public Collection<VisualMappingFunction<?, ?>> getAllVisualMappingFunctions() { + return mappings.values(); + } } Modified: core3/vizmap-impl/trunk/impl/src/test/java/org/cytoscape/view/vizmap/VisualStyleTest.java =================================================================== --- core3/vizmap-impl/trunk/impl/src/test/java/org/cytoscape/view/vizmap/VisualStyleTest.java 2011-05-23 21:03:54 UTC (rev 25512) +++ core3/vizmap-impl/trunk/impl/src/test/java/org/cytoscape/view/vizmap/VisualStyleTest.java 2011-05-23 23:54:32 UTC (rev 25513) @@ -1,7 +1,12 @@ package org.cytoscape.view.vizmap; -import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.*; +import java.util.Collection; + +import org.cytoscape.view.model.VisualProperty; +import org.cytoscape.view.presentation.property.MinimalVisualLexicon; +import org.cytoscape.view.presentation.property.NullVisualProperty; import org.cytoscape.view.vizmap.internal.VisualLexiconManager; import org.cytoscape.view.vizmap.internal.VisualStyleFactoryImpl; import org.junit.After; @@ -11,9 +16,19 @@ @Before public void setUp() throws Exception { - + super.setUp(); + // Create root node. final VisualLexiconManager lexManager = mock(VisualLexiconManager.class); + + // Create root node. + final NullVisualProperty minimalRoot = new NullVisualProperty("MINIMAL_ROOT", "Minimal Root Visual Property"); + final MinimalVisualLexicon minimalLex = new MinimalVisualLexicon(minimalRoot); + final Collection<VisualProperty<?>> nodeVP = minimalLex.getAllDescendants(MinimalVisualLexicon.NODE); + final Collection<VisualProperty<?>> edgeVP = minimalLex.getAllDescendants(MinimalVisualLexicon.EDGE); + when(lexManager.getNodeVisualProperties()).thenReturn(nodeVP); + when(lexManager.getEdgeVisualProperties()).thenReturn(edgeVP); + final VisualStyleFactoryImpl visualStyleFactory = new VisualStyleFactoryImpl(lexManager); originalTitle = "Style 1"; newTitle = "Style 2"; Modified: core3/vizmap-impl/trunk/pom.xml =================================================================== --- core3/vizmap-impl/trunk/pom.xml 2011-05-23 21:03:54 UTC (rev 25512) +++ core3/vizmap-impl/trunk/pom.xml 2011-05-23 23:54:32 UTC (rev 25513) @@ -1,9 +1,10 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.cytoscape</groupId> <artifactId>parent</artifactId> - <version>3.0.0-alpha7</version> + <version>3.0.0-alpha8-SNAPSHOT</version> </parent> <groupId>org.cytoscape</groupId> @@ -11,6 +12,10 @@ <packaging>pom</packaging> <version>3.0.0-alpha3-SNAPSHOT</version> <name>vizmap-impl-parent</name> + + <properties> + <vizmap-api.version>3.0.0-alpha4-SNAPSHOT</vizmap-api.version> + </properties> <modules> <module>impl</module> @@ -48,33 +53,31 @@ </repository> </repositories> - <build> - <plugins> - <plugin> - <inherited>false</inherited> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-release-plugin</artifactId> - <version>${maven-release-plugin.version}</version> - <configuration> - <autoVersionSubmodules>true</autoVersionSubmodules> - <goals>deploy</goals> - <!-- so that impl bundles with modules will build correctly --> - <preparationGoals>clean install</preparationGoals> - </configuration> - </plugin> - </plugins> - </build> + <build> + <plugins> + <plugin> + <inherited>false</inherited> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-release-plugin</artifactId> + <version>${maven-release-plugin.version}</version> + <configuration> + <autoVersionSubmodules>true</autoVersionSubmodules> + <goals>deploy</goals> + <!-- so that impl bundles with modules will build correctly --> + <preparationGoals>clean install</preparationGoals> + </configuration> + </plugin> + </plugins> + </build> - <!-- - Dependencies included here should *ONLY* be for the impl bundle. - All additional dependencies necessary for the integration tests (it) - should be kept in the it/pom.xml - --> + <!-- Dependencies included here should *ONLY* be for the impl bundle. All + additional dependencies necessary for the integration tests (it) should be + kept in the it/pom.xml --> <dependencies> <dependency> <groupId>org.cytoscape</groupId> <artifactId>vizmap-api</artifactId> - <version>3.0.0-alpha2</version> + <version>${vizmap-api.version}</version> <scope>provided</scope> </dependency> <dependency> @@ -95,6 +98,7 @@ <version>3.0.0-alpha3</version> <scope>provided</scope> </dependency> + <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> @@ -110,21 +114,34 @@ <dependency> <groupId>org.cytoscape</groupId> <artifactId>vizmap-api</artifactId> - <version>3.0.0-alpha2</version> + <version>${vizmap-api.version}</version> <type>test-jar</type> <scope>test</scope> </dependency> <dependency> <groupId>org.cytoscape</groupId> + <artifactId>property-api</artifactId> + <version>3.0.0-alpha5-SNAPSHOT</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.cytoscape</groupId> + <artifactId>test-support</artifactId> + <version>3.0.0-alpha3-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.cytoscape</groupId> <artifactId>presentation-api</artifactId> <version>3.0.0-alpha3</version> <scope>provided</scope> </dependency> <dependency> - <groupId>org.cytoscape</groupId> - <artifactId>default-mappings</artifactId> - <version>3.0.0-alpha3</version> - <scope>provided</scope> - </dependency> + <groupId>org.cytoscape</groupId> + <artifactId>default-mappings</artifactId> + <version>3.0.0-alpha4-SNAPSHOT</version> + <scope>provided</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.
