Author: paperwing
Date: 2012-02-17 10:48:28 -0800 (Fri, 17 Feb 2012)
New Revision: 28309
Modified:
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/ExternalRenderer.java
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/ExternalRendererManager.java
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/RenderingEngineFactoryManager.java
csplugins/trunk/toronto/yuedong/multi_renderer/impl/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DingRenderer.java
csplugins/trunk/toronto/yuedong/multi_renderer/impl/presentation-impl/src/main/java/org/cytoscape/view/presentation/internal/ExternalRendererManagerImpl.java
csplugins/trunk/toronto/yuedong/multi_renderer/impl/swing-application-impl/src/main/java/org/cytoscape/internal/view/BirdsEyeViewHandler.java
csplugins/trunk/toronto/yuedong/multi_renderer/impl/swing-application-impl/src/main/java/org/cytoscape/internal/view/NetworkViewManager.java
csplugins/trunk/toronto/yuedong/multi_renderer/impl/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewPanelImpl.java
Log:
Function header change for presentation-api's
ExternalRendere.getRenderingEngineFactory. Reason: be able to avoid having to
implement extensions of RenderingEngineFactory interface, and because the main
reason for the different extensions of RenderingEngineFactory is to replace the
previously proposed enumeration for storing the different types of
RenderingEngineFactory objects
Modified:
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/ExternalRenderer.java
===================================================================
---
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/ExternalRenderer.java
2012-02-17 18:48:01 UTC (rev 28308)
+++
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/ExternalRenderer.java
2012-02-17 18:48:28 UTC (rev 28309)
@@ -26,7 +26,7 @@
* @param type The {@link Class} object containing the type of the
desired {@link RenderingEngineFactory}
* @return A {@link RenderingEngineFactory} with the desired type if
available, <code>null</code> otherwise.
*/
- <T extends RenderingEngineFactory<?>> T
getRenderingEngineFactory(Class<T> type);
+ RenderingEngineFactory<?> getRenderingEngineFactory(final Class<?
extends RenderingEngineFactory<?>> type);
/**
* Returns the {@link CyNetworkViewFactory} for this renderer.
Modified:
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/ExternalRendererManager.java
===================================================================
---
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/ExternalRendererManager.java
2012-02-17 18:48:01 UTC (rev 28308)
+++
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/ExternalRendererManager.java
2012-02-17 18:48:28 UTC (rev 28309)
@@ -11,44 +11,44 @@
/**
* Adds a renderer to this manager. There can be only one {@link
ExternalRenderer} of a given type
- * registered to this manager.
+ * registered to this manager.
*
* @param ExternalRenderer The renderer to be added.
*/
- void addRenderer(ExternalRenderer externalRenderer, Map<String, String>
properties);
+ void addRenderer(final ExternalRenderer externalRenderer, Map<String,
String> properties);
/**
* Removes a renderer from this manager.
*
* @param externalRenderer The renderer to be removed.
*/
- void removeRenderer(ExternalRenderer externalRenderer, Map<String,
String> properties);
+ void removeRenderer(final ExternalRenderer externalRenderer,
Map<String, String> properties);
/**
* Removes an {@link ExternalRenderer} based on its class type which
identifies that renderer.
*/
- void removeRenderer(Class<? extends ExternalRenderer> rendererType);
+ void removeRenderer(final Class<? extends ExternalRenderer>
rendererType);
/**
* Return a collection of currently installed renderers.
*
* @return A {@link Collection} of available renderers.
*/
- Collection<ExternalRendererManager> getAvailableRenderers();
+ Collection<ExternalRenderer> getAvailableRenderers();
/**
* Returns the {@link ExternalRenderer} associated with the given
renderer type, if there is one.
*
* @return The {@link ExternalRenderer} associated with the given
renderer type, or <code>null</code> if there is none.
*/
- ExternalRenderer getRenderer(Class<? extends ExternalRenderer>
rendererType);
+ ExternalRenderer getRenderer(final Class<? extends ExternalRenderer>
rendererType);
/**
* Sets the current renderer.
*
* @param rendererType The class type of the renderer desired to be set
as the current renderer.
*/
- void setCurrentRenderer(Class<? extends ExternalRenderer> rendererType);
+ void setCurrentRenderer(final Class<? extends ExternalRenderer>
rendererType);
/**
* Returns the current {@link ExternalRenderer}. If there is only one
renderer available, that
@@ -57,4 +57,9 @@
* @return The current renderer, or <code>null</code> if none are
available.
*/
ExternalRenderer getCurrentRenderer();
+
+ // TODO:
+ // - Retrieving properties for a given renderer?
+ // - Use Properties class instead of Map<String, String> for properties?
+ // - Are properties needed for the remove method?
}
Modified:
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/RenderingEngineFactoryManager.java
===================================================================
---
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/RenderingEngineFactoryManager.java
2012-02-17 18:48:01 UTC (rev 28308)
+++
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/RenderingEngineFactoryManager.java
2012-02-17 18:48:28 UTC (rev 28309)
@@ -1,6 +1,6 @@
package org.cytoscape.view.presentation;
-import java.util.List;
+import java.util.Collection;
/**
* This interface represents a manager service for
@@ -33,7 +33,7 @@
*
* @return A list, defensively copied, containing the available
renderer IDs.
*/
- public List getAvailableRendererIDs();
+ public Collection<String> getAvailableRendererIDs();
/**
* Attempts to set the current default renderer ID to the given
renderer ID.
@@ -56,19 +56,19 @@
*
* @param renderingEngineFactory
* @param rendererID The ID of the renderer, which is the renderer name.
- * @param rendererType The type of the renderer, such as bird's eye
view or main, via the {@link RenderingEngineFactoryType} enumeration.
+ * @param factoryType The type of the renderer, such as bird's eye view
or main, via the {@link RenderingEngineFactoryType} enumeration.
*/
- public void addRenderingEngineFactory(final RenderingEngineFactory<?>
renderingEngineFactory, String rendererID, RenderingEngineFactoryType
rendererType);
+ public void addRenderingEngineFactory(final RenderingEngineFactory<?>
renderingEngineFactory, String rendererID, RenderingEngineFactoryType
factoryType);
/**
* If one exists, returns the {@link RenderingEngineFactory} associated
with the given renderer ID and renderer type. Otherwise,
* returns <code>null</code>.
*
* @param rendererID The ID of the renderer, which is the renderer name.
- * @param rendererType The type of the renderer, such as bird's eye
view or main, via the {@link RenderingEngineFactoryType} enumeration.
+ * @param factoryType The type of the renderer, such as bird's eye view
or main, via the {@link RenderingEngineFactoryType} enumeration.
* @return The {@link RenderingEngineFactory} associated with the given
renderer ID and renderer type, or null if none exist.
*/
- public RenderingEngineFactory<?> getRenderingEngineFactory(String
rendererID, RenderingEngineFactoryType rendererType);
+ public RenderingEngineFactory<?> getRenderingEngineFactory(String
rendererID, RenderingEngineFactoryType factoryType);
/**
* Removes the given {@link RenderingEngineFactory} from the manager.
@@ -81,9 +81,9 @@
* Removes the {@link RenderingEngineFactory} associated with the given
renderer ID and of the given renderer type, such as bird's eye view.
*
* @param rendererID The ID of the renderer, which is the renderer name.
- * @param rendererType The type of the renderer, such as bird's eye
view or main, via the {@link RenderingEngineFactoryType} enumeration.
+ * @param factoryType The type of the renderer, such as bird's eye view
or main, via the {@link RenderingEngineFactoryType} enumeration.
*/
- public void removeRenderingEngineFactory(String rendererID,
RenderingEngineFactoryType rendererType);
+ public void removeRenderingEngineFactory(String rendererID,
RenderingEngineFactoryType factoryType);
/**
* Removes all {@link RenderingEngineFactory} objects associated with
the given rendererID.
Modified:
csplugins/trunk/toronto/yuedong/multi_renderer/impl/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DingRenderer.java
===================================================================
---
csplugins/trunk/toronto/yuedong/multi_renderer/impl/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DingRenderer.java
2012-02-17 18:48:01 UTC (rev 28308)
+++
csplugins/trunk/toronto/yuedong/multi_renderer/impl/ding-impl/ding-presentation-impl/src/main/java/org/cytoscape/ding/impl/DingRenderer.java
2012-02-17 18:48:28 UTC (rev 28309)
@@ -2,11 +2,14 @@
import java.util.HashMap;
+import
org.cytoscape.application.swing.presentation.BirdsEyeViewRenderingEngineFactory;
+import
org.cytoscape.application.swing.presentation.MainViewRenderingEngineFactory;
import org.cytoscape.view.model.CyNetworkViewFactory;
import org.cytoscape.view.model.VisualLexicon;
import org.cytoscape.view.presentation.ExternalRenderer;
import org.cytoscape.view.presentation.ExternalRendererManager;
import org.cytoscape.view.presentation.RenderingEngineFactory;
+import
org.cytoscape.view.vizmap.gui.presentation.VisualStylePreviewRenderingEngineFactory;
public class DingRenderer implements ExternalRenderer {
@@ -36,12 +39,24 @@
return READBLE_NAME;
}
+
@Override
- public <T extends RenderingEngineFactory<?>> T
getRenderingEngineFactory(
- Class<T> type) {
+ public RenderingEngineFactory<?> getRenderingEngineFactory(
+ final Class<? extends RenderingEngineFactory<?>> type) {
+
+ if (type == MainViewRenderingEngineFactory.class) {
+ return mainRenderingEngineFactory;
+ } else if (type == BirdsEyeViewRenderingEngineFactory.class) {
+ return birdEyeRenderingEngineFactory;
+ } else if (type ==
VisualStylePreviewRenderingEngineFactory.class) {
+
+ // Ding uses the default rendering engine factory for
visual style previews
+ return mainRenderingEngineFactory;
+ }
return null;
}
+
@Override
public CyNetworkViewFactory getNetworkViewFactory() {
Modified:
csplugins/trunk/toronto/yuedong/multi_renderer/impl/presentation-impl/src/main/java/org/cytoscape/view/presentation/internal/ExternalRendererManagerImpl.java
===================================================================
---
csplugins/trunk/toronto/yuedong/multi_renderer/impl/presentation-impl/src/main/java/org/cytoscape/view/presentation/internal/ExternalRendererManagerImpl.java
2012-02-17 18:48:01 UTC (rev 28308)
+++
csplugins/trunk/toronto/yuedong/multi_renderer/impl/presentation-impl/src/main/java/org/cytoscape/view/presentation/internal/ExternalRendererManagerImpl.java
2012-02-17 18:48:28 UTC (rev 28309)
@@ -23,6 +23,11 @@
private ExternalRenderer currentRenderer;
+ public ExternalRendererManagerImpl() {
+ renderers = new HashMap<Class<? extends ExternalRenderer>,
ExternalRenderer>();
+ currentRenderer = null;
+ }
+
@Override
public void addRenderer(ExternalRenderer externalRenderer,
Map<String, String> properties) {
Modified:
csplugins/trunk/toronto/yuedong/multi_renderer/impl/swing-application-impl/src/main/java/org/cytoscape/internal/view/BirdsEyeViewHandler.java
===================================================================
---
csplugins/trunk/toronto/yuedong/multi_renderer/impl/swing-application-impl/src/main/java/org/cytoscape/internal/view/BirdsEyeViewHandler.java
2012-02-17 18:48:01 UTC (rev 28308)
+++
csplugins/trunk/toronto/yuedong/multi_renderer/impl/swing-application-impl/src/main/java/org/cytoscape/internal/view/BirdsEyeViewHandler.java
2012-02-17 18:48:28 UTC (rev 28309)
@@ -217,7 +217,7 @@
if (renderer != null) {
- factory =
renderer.getRenderingEngineFactory(BirdsEyeViewRenderingEngineFactory.class);
+ factory = (RenderingEngineFactory<CyNetwork>)
renderer.getRenderingEngineFactory(BirdsEyeViewRenderingEngineFactory.class);
if (factory != null) {
factory.createRenderingEngine(container,
viewModel);
Modified:
csplugins/trunk/toronto/yuedong/multi_renderer/impl/swing-application-impl/src/main/java/org/cytoscape/internal/view/NetworkViewManager.java
===================================================================
---
csplugins/trunk/toronto/yuedong/multi_renderer/impl/swing-application-impl/src/main/java/org/cytoscape/internal/view/NetworkViewManager.java
2012-02-17 18:48:01 UTC (rev 28308)
+++
csplugins/trunk/toronto/yuedong/multi_renderer/impl/swing-application-impl/src/main/java/org/cytoscape/internal/view/NetworkViewManager.java
2012-02-17 18:48:28 UTC (rev 28309)
@@ -377,11 +377,14 @@
RenderingEngineFactory<CyNetwork> factory;
RenderingEngine<CyNetwork> renderingEngine = null;
+ System.out.println("NetworkViewManager: Getting renderer from
renderer manager");
if (externalRendererManager.getCurrentRenderer() != null) {
- factory =
externalRendererManager.getCurrentRenderer().getRenderingEngineFactory(MainViewRenderingEngineFactory.class);
+ factory = (RenderingEngineFactory<CyNetwork>)
externalRendererManager.getCurrentRenderer().getRenderingEngineFactory(MainViewRenderingEngineFactory.class);
+ System.out.println("NetworkViewManager: Got renderer,
getting factory");
if (factory != null) {
- renderingEngine =
factory.createRenderingEngine(iframe, view);
+ System.out.println("NetworkViewManager: Got
factory");
+ renderingEngine =
factory.createRenderingEngine(iframe, view);
}
}
Modified:
csplugins/trunk/toronto/yuedong/multi_renderer/impl/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewPanelImpl.java
===================================================================
---
csplugins/trunk/toronto/yuedong/multi_renderer/impl/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewPanelImpl.java
2012-02-17 18:48:01 UTC (rev 28308)
+++
csplugins/trunk/toronto/yuedong/multi_renderer/impl/vizmap-gui-impl/src/main/java/org/cytoscape/view/vizmap/gui/internal/DefaultViewPanelImpl.java
2012-02-17 18:48:28 UTC (rev 28309)
@@ -135,7 +135,7 @@
if (renderer != null) {
CyNetworkViewFactory cyNetworkViewFactory =
renderer.getNetworkViewFactory();
- RenderingEngineFactory<CyNetwork> presentationFactory =
renderer
+ RenderingEngineFactory<CyNetwork> presentationFactory =
(RenderingEngineFactory<CyNetwork>) renderer
.getRenderingEngineFactory(VisualStylePreviewRenderingEngineFactory.class);
final CyNetworkView dummyview = cyNetworkViewFactory
--
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.