use of org.cytoscape.view.vizmap.events.VisualStyleAddedEvent in project cytoscape-impl by cytoscape.
the class VisualMappingManagerImpl method addVisualStyle.
/**
* Add a new VisualStyle to this manager. This will be called through OSGi service mechanism.
*
* @param vs new Visual Style to be added.
*/
@Override
public void addVisualStyle(final VisualStyle vs) {
if (vs == null) {
logger.warn("Tried to add null to VMM.");
return;
}
if (hasDuplicatedTitle(vs)) {
String newTitle = getSuggestedTitle(vs.getTitle());
// Update the title
vs.setTitle(newTitle);
}
synchronized (lock) {
this.visualStyles.add(vs);
}
logger.info("New visual Style registered to VMM: " + vs.getTitle());
logger.info("Total Number of VS in VMM = " + visualStyles.size());
if (vs.getTitle() != null && vs.getTitle().equals(DEFAULT_STYLE_NAME))
defaultStyle = vs;
final CyEventHelper eventHelper = serviceRegistrar.getService(CyEventHelper.class);
eventHelper.fireEvent(new VisualStyleAddedEvent(this, vs));
}
use of org.cytoscape.view.vizmap.events.VisualStyleAddedEvent in project cytoscape-api by cytoscape.
the class VizmapEventsTest method testVisualStyleCreatedEvent.
@Test
public void testVisualStyleCreatedEvent() {
final VisualStyleAddedEvent event = new VisualStyleAddedEvent(manager, style);
assertEquals(style, event.getVisualStyleAdded());
}
Aggregations