use of org.cytoscape.view.presentation.RenderingEngineManager in project cytoscape-impl by cytoscape.
the class CloneNetworkTaskTest method runTest.
@Test
public void runTest() {
final CyNetworkManager netmgr = mock(CyNetworkManager.class);
final CyNetworkViewManager networkViewManager = mock(CyNetworkViewManager.class);
final CyNetworkViewFactory netViewFactory = mock(CyNetworkViewFactory.class);
final RenderingEngineManager reManager = mock(RenderingEngineManager.class);
final CyNetworkNaming naming = mock(CyNetworkNaming.class);
final TaskMonitor tm = mock(TaskMonitor.class);
}
use of org.cytoscape.view.presentation.RenderingEngineManager in project cytoscape-impl by cytoscape.
the class ViewWriterTest method setUp.
@Before
@SuppressWarnings("rawtypes")
public void setUp() throws Exception {
final PresentationWriterManager viewWriterMgr = mock(PresentationWriterManager.class);
final CyApplicationManager applicationManager = mock(CyApplicationManager.class);
final RenderingEngineManager engineManager = mock(RenderingEngineManager.class);
final CyNetworkView view = mock(CyNetworkView.class);
final CyNetwork network = mock(CyNetwork.class);
final CyRow row = mock(CyRow.class);
final RenderingEngine re = mock(RenderingEngine.class);
final CyServiceRegistrar serviceRegistrar = mock(CyServiceRegistrar.class);
when(serviceRegistrar.getService(CyApplicationManager.class)).thenReturn(applicationManager);
when(serviceRegistrar.getService(RenderingEngineManager.class)).thenReturn(engineManager);
when(serviceRegistrar.getService(PresentationWriterManager.class)).thenReturn(viewWriterMgr);
fileFilter = mock(CyFileFilter.class);
when(fileFilter.getDescription()).thenReturn("A dummy filter");
when(fileFilter.getExtensions()).thenReturn(Collections.singleton("dummy"));
final List<CyFileFilter> filters = new ArrayList<>();
filters.add(fileFilter);
when(viewWriterMgr.getAvailableWriterFilters()).thenReturn(filters);
when(view.getModel()).thenReturn(network);
when(network.getRow(network)).thenReturn(row);
cyWriter = new ViewWriter(view, re, serviceRegistrar);
final CyWriter aWriter = mock(CyWriter.class);
when(viewWriterMgr.getWriter(eq(view), eq(re), eq(fileFilter), argThat(new AnyOutputStreamMatcher()))).thenReturn(aWriter);
}
use of org.cytoscape.view.presentation.RenderingEngineManager in project cytoscape-impl by cytoscape.
the class ViewWriter method setView.
public void setView(CyNetworkView view) {
this.view = view;
if (view != null) {
// Get the rendering engine
RenderingEngine<?> engine = serviceRegistrar.getService(CyApplicationManager.class).getCurrentRenderingEngine();
// Now get the rendering engine for this view and use this one if we can
String engineId = view.getRendererId();
RenderingEngineManager engineManager = serviceRegistrar.getService(RenderingEngineManager.class);
for (RenderingEngine<?> e : engineManager.getRenderingEngines(view)) {
if (engineId.equals(e.getRendererId())) {
engine = e;
break;
}
}
this.re = engine;
}
}
use of org.cytoscape.view.presentation.RenderingEngineManager in project cytoscape-impl by cytoscape.
the class VisualStyleSerializer method createVizmap.
/**
* This method creates a serializable Vizmap object based on the provided collection of visual styles.
* @param styles The collection of VisualStyles that you wish to convert into a serializable object.
* @return A Vizmap object that contains a representation of the collection of visual styles.
*/
public Vizmap createVizmap(final Collection<VisualStyle> styles) {
final Vizmap vizmap = new Vizmap();
final RenderingEngineManager renderingEngineManager = serviceRegistrar.getService(RenderingEngineManager.class);
lexicon = renderingEngineManager.getDefaultVisualLexicon();
if (styles != null) {
for (VisualStyle style : styles) {
org.cytoscape.io.internal.util.vizmap.model.VisualStyle vsModel = new org.cytoscape.io.internal.util.vizmap.model.VisualStyle();
vizmap.getVisualStyle().add(vsModel);
vsModel.setName(style.getTitle());
vsModel.setNetwork(new Network());
vsModel.setNode(new Node());
vsModel.setEdge(new Edge());
createVizmapProperties(style, BasicVisualLexicon.NETWORK, vsModel.getNetwork().getVisualProperty());
createVizmapProperties(style, BasicVisualLexicon.NODE, vsModel.getNode().getVisualProperty());
createVizmapProperties(style, BasicVisualLexicon.EDGE, vsModel.getEdge().getVisualProperty());
// Create Dependencies
createDependencies(style, vsModel);
}
}
return vizmap;
}
use of org.cytoscape.view.presentation.RenderingEngineManager in project cytoscape-impl by cytoscape.
the class SessionXGMMLNetworkViewWriter method writeRootElementAtributes.
@Override
protected void writeRootElementAtributes() throws IOException {
writeAttributePair("id", networkView.getSUID());
writeAttributePair("label", getLabel(networkView));
writeAttributePair("cy:view", ObjectTypeMap.toXGMMLBoolean(true));
writeAttributePair("cy:networkId", network.getSUID());
if (visualStyle != null)
writeAttributePair("cy:visualStyle", visualStyle.getTitle());
final RenderingEngineManager renderingEngineMgr = serviceRegistrar.getService(RenderingEngineManager.class);
final Collection<RenderingEngine<?>> renderingEngines = renderingEngineMgr.getRenderingEngines(networkView);
if (renderingEngines != null && !renderingEngines.isEmpty())
writeAttributePair("cy:rendererId", renderingEngines.iterator().next().getRendererId());
}
Aggregations