Author: paperwing
Date: 2012-02-14 15:55:52 -0800 (Tue, 14 Feb 2012)
New Revision: 28274
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
Log:
Updated API classes according to feedback. ExternalRendererManager now uses the
renderer's class type as the renderer's ID.
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-14 23:07:53 UTC (rev 28273)
+++
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/ExternalRenderer.java
2012-02-14 23:55:52 UTC (rev 28274)
@@ -13,51 +13,32 @@
public interface ExternalRenderer {
/**
- * An enumeration encoding rendering purposes that may be intended for
certain {@link RenderingEngine} objects. For example,
- * this could be used to differentiate between a {@link
RenderingEngine} that renders for the bird's eye view versus
- * a {@link RenderingEngine} that is designed for the main network view.
+ * Returns a human-readable form of the renderer's name
+ *
+ * @return The renderer's name, in human-readable form
*/
- enum RenderPurpose {
- BIRDS_EYE_VIEW,
- DETAIL_VIEW,
- VISUAL_STYLE_PREVIEW
- }
+ String getRendererName();
/**
- * Return the renderer's ID. This ID is used to distinguish between
different renderers.
+ * Returns a {@link RenderingEngineFactory} of the given type, if
available.
*
- * @return The renderer's ID
+ * @param <T> The type of the {@link RenderingEngineFactory}
+ * @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.
*/
- public String getRendererID();
+ <T extends RenderingEngineFactory<?>> T
getRenderingEngineFactory(Class<T> type);
/**
- * Return a {@link RenderingEngineFactory} object to be used for
creating {@link RenderingEngine} objects with the given rendering purpose,
- * such as bird's eye view or detail view.
+ * Returns the {@link CyNetworkViewFactory} for this renderer.
+ *
+ * @return The {@link CyNetworkViewFactory} used by this renderer.
*/
- RenderingEngineFactory<?> getRenderingEngineFactory(RenderPurpose
renderPurpose);
+ CyNetworkViewFactory getNetworkViewFactory();
- // Allow returning different CyNetworkView factories. This could be
helpful for efficiency. For example, a bird's eye RenderingEngine may not
- // need some visual properties of the main view.
/**
- * Return the {@link CyNetworkViewFactory} used for creating {@link
CyNetworkView} objects for the given rendering purpose.
+ * Returns the {@link VisualLexicon} for this renderer.
+ *
+ * @return The {@link VisualLexicon} used by this renderer.
*/
- CyNetworkViewFactory getNetworkViewFactory(RenderPurpose renderPurpose);
-
- // Allow returning different VisualLexicons; a bird's eye
RenderingEngine may not need some visual properties of the main view.
- /**
- * Return the {@link VisualLexicon} for this renderer associated with
the given rendering purpose.
- */
- VisualLexicon getVisualLexicon(RenderPurpose renderPurpose);
-
- // Prepares the renderer to be removed.
- /**
- * Notifies this renderer to release all its resources and prepare for
removal. The renderer is allowed to become unuseable after this call,
- * and should at least fail safely if asked to render anything else
onwards.
- */
- public void dispose();
-
- // TODO: Determine how RenderingEngine instances will be obtained: via
returning RenderingEngineFactory objects or directly
- // creating RenderingEngine objects
-
-
+ VisualLexicon getVisualLexicon();
}
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-14 23:07:53 UTC (rev 28273)
+++
csplugins/trunk/toronto/yuedong/multi_renderer/api/presentation-api/src/main/java/org/cytoscape/view/presentation/ExternalRendererManager.java
2012-02-14 23:55:52 UTC (rev 28274)
@@ -2,6 +2,7 @@
import java.util.Collection;
import java.util.List;
+import java.util.Map;
/**
* Draft manager class for installed {@link ExternalRenderer} or Cytoscape
renderers.
@@ -9,62 +10,51 @@
public interface ExternalRendererManager {
/**
- * Installs a renderer and adds it to this manager.
+ * Adds a renderer to this manager. There can be only one {@link
ExternalRenderer} of a given type
+ * registered to this manager.
*
- * @param ExternalRenderer The renderer to be installed.
+ * @param ExternalRenderer The renderer to be added.
*/
- public void installRenderer(ExternalRenderer externalRenderer);
+ void addRenderer(ExternalRenderer externalRenderer, Map<String, String>
properties);
/**
- * Uninstalls a renderer and removes it from this manager.
+ * Removes a renderer from this manager.
*
- * @param externalRenderer The renderer to be installed.
+ * @param externalRenderer The renderer to be removed.
*/
- public void uninstallRenderer(ExternalRenderer externalRenderer);
+ void removeRenderer(ExternalRenderer externalRenderer, Map<String,
String> properties);
/**
- * Removes a renderer based on its renderer ID.
- *
- * @param renderID The renderer ID of the renderer to be removed.
+ * Removes an {@link ExternalRenderer} based on its class type which
identifies that renderer.
*/
- public void uninstallRenderer(String rendererID);
+ void removeRenderer(Class<? extends ExternalRenderer> rendererType);
/**
- * Return a defensively copied {@link List} containing the list of
installed renderers' IDs.
+ * Return a collection of currently installed renderers.
*
- * @return A defensively copied list of the IDs of the currently
installed renderers.
- */
- public Collection<String> getInstalledRenderers();
+ * @return A {@link Collection} of available renderers.
+ */
+ Collection<ExternalRendererManager> getAvailableRenderers();
/**
- * Return the number of currently installed renderers.
+ * Returns the {@link ExternalRenderer} associated with the given
renderer type, if there is one.
*
- * @return The number of currently installed renderers.
+ * @return The {@link ExternalRenderer} associated with the given
renderer type, or <code>null</code> if there is none.
*/
- public int getInstalledRendererCount();
+ ExternalRenderer getRenderer(Class<? extends ExternalRenderer>
rendererType);
/**
- * Returns the installed {@link ExternalRenderer} associated with the
given renderer ID, if there is one.
+ * Sets the current renderer.
*
- * @param rendererID The renderer ID of the desired renderer.
- * @return The {@link ExternalRenderer} associated with the given
renderer ID, or <code>null</code> if there is none.
+ * @param rendererType The class type of the renderer desired to be set
as the current renderer.
*/
- public ExternalRenderer getRenderer(String rendererID);
+ void setCurrentRenderer(Class<? extends ExternalRenderer> rendererType);
/**
- * Sets the ID used to look for the default renderer.
+ * Returns the current {@link ExternalRenderer}. If there is only one
renderer available, that
+ * renderer is returned as current.
*
- * @param rendererID The ID of the renderer to be used as the default
renderer.
- * @return The ID of the new default renderer, or <code>null</code> if
there is no new default or if no renderer was found with the given renderer ID.
+ * @return The current renderer, or <code>null</code> if none are
available.
*/
- public String setDefaultRendererID(String rendererID);
-
-
- /**
- * Return the default renderer's renderer ID.
- *
- * @return The ID of the default renderer, or null if there are no
renderers installed. If there is only 1 renderer installed, the ID of that
renderer
- * will be returned.
- */
- public String getDefaultRendererID();
+ ExternalRenderer getCurrentRenderer();
}
--
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.