use of org.cytoscape.view.model.VisualProperty in project EnrichmentMapApp by BaderLab.
the class EMStyleBuilder method setNodeChart.
@SuppressWarnings({ "rawtypes", "unchecked" })
private void setNodeChart(VisualStyle vs, CyCustomGraphics2<?> chart) {
VisualLexicon lexicon = renderingEngineManager.getDefaultVisualLexicon();
VisualProperty customPaint1 = lexicon.lookup(CyNode.class, "NODE_CUSTOMGRAPHICS_1");
if (customPaint1 != null)
vs.setDefaultValue(customPaint1, chart);
}
use of org.cytoscape.view.model.VisualProperty in project cytoscape-api by cytoscape.
the class AbstractVisualLexiconTest method testTree.
protected void testTree(VisualLexicon lexicon) throws Exception {
final VisualProperty<NullDataType> root = lexicon.getRootVisualProperty();
assertNotNull(root);
assertEquals(lexicon.getRootVisualProperty(), root);
// test common methods
try {
Collection<VisualProperty<?>> result = lexicon.getAllDescendants(null);
} catch (Exception e) {
assertTrue(e instanceof NullPointerException);
}
try {
Collection<VisualProperty<?>> result = lexicon.getAllDescendants(new DefaultVisualizableVisualProperty("test", "Test Visual Property", CyNode.class));
} catch (Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
final VisualLexiconNode rootNode = lexicon.getVisualLexiconNode(root);
assertNotNull(rootNode);
assertEquals(root, rootNode.getVisualProperty());
final Collection<VisualLexiconNode> children = rootNode.getChildren();
assertFalse(0 == children.size());
traverse(children, lexicon);
// Test adding
final DoubleVisualProperty dummyVP = new DoubleVisualProperty(new Double(10), BasicVisualLexicon.ARBITRARY_DOUBLE_RANGE, "DUMMY", "Dummy VP", CyNode.class);
try {
((BasicVisualLexicon) lexicon).addVisualProperty(BasicVisualLexicon.NODE_FILL_COLOR, root);
} catch (Exception e) {
assertTrue(e instanceof IllegalStateException);
}
try {
((BasicVisualLexicon) lexicon).addVisualProperty(dummyVP, null);
} catch (Exception e) {
assertTrue(e instanceof NullPointerException);
}
try {
((BasicVisualLexicon) lexicon).addVisualProperty(dummyVP, dummyVP);
} catch (Exception e) {
assertTrue(e instanceof IllegalArgumentException);
}
((BasicVisualLexicon) lexicon).addVisualProperty(dummyVP, root);
}
use of org.cytoscape.view.model.VisualProperty in project EnrichmentMapApp by BaderLab.
the class LegendPanel method getIcon.
@SuppressWarnings({ "unchecked", "rawtypes" })
private Icon getIcon(VisualProperty<?> vp, Object value, CyNetworkView netView) {
if (value == null || netView == null)
return null;
Collection<RenderingEngine<?>> engines = engineManager.getRenderingEngines(netView);
RenderingEngine<?> engine = null;
for (RenderingEngine<?> re : engines) {
if (re.getRendererId().equals(netView.getRendererId())) {
engine = re;
break;
}
}
Icon icon = engine != null ? engine.createIcon((VisualProperty) vp, value, LEGEND_ICON_SIZE, LEGEND_ICON_SIZE) : null;
return icon;
}
use of org.cytoscape.view.model.VisualProperty in project cytoscape-api by cytoscape.
the class BasicVisualLexicon method getChildNodes.
private Set<VisualProperty<?>> getChildNodes(VisualProperty<?> prop) {
final VisualLexiconNode node = visualPropertyMap.get(prop);
final Set<VisualProperty<?>> children = new HashSet<>();
// if this is a leaf node, return empty set
if (node.getChildren().size() == 0)
return children;
Collection<VisualLexiconNode> currentChildren = node.getChildren();
for (VisualLexiconNode nd : currentChildren) children.add(nd.getVisualProperty());
for (VisualLexiconNode nd : currentChildren) children.addAll(getChildNodes(nd.getVisualProperty()));
return children;
}
use of org.cytoscape.view.model.VisualProperty in project cytoscape-api by cytoscape.
the class VisualPropertyDependencyTest method setUp.
@Before
public void setUp() throws Exception {
MockitoAnnotations.initMocks(this);
lexicon = new BasicVisualLexicon(rootVisualProperty);
vpSet = new HashSet<VisualProperty<Paint>>();
vpSet.add(BasicVisualLexicon.NODE_BORDER_PAINT);
vpSet.add(BasicVisualLexicon.NODE_FILL_COLOR);
dependency = new VisualPropertyDependency<Paint>(id, displayName, vpSet, lexicon);
}
Aggregations