Author: kono
Date: 2010-10-19 13:52:27 -0700 (Tue, 19 Oct 2010)
New Revision: 22301
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/RenderingEngineCreatedEvent.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/RenderingEngineCreatedEventListener.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/package-info.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/package-info.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/package-info.java
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DingNavigationRenderingEngine.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/RenderingEngine.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/RenderingEngineFactory.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/RenderingEngineManager.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/AbstractVisualLexicon.java
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/TwoDVisualLexicon.java
Log:
New events had been added for RenderingEngineManager.
Modified:
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DingNavigationRenderingEngine.java
===================================================================
---
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DingNavigationRenderingEngine.java
2010-10-19 20:48:55 UTC (rev 22300)
+++
core3/ding-presentation-impl/trunk/src/main/java/org/cytoscape/ding/impl/DingNavigationRenderingEngine.java
2010-10-19 20:52:27 UTC (rev 22301)
@@ -22,8 +22,11 @@
private final DGraphView dgv;
+ private final Properties props;
+
public DingNavigationRenderingEngine(final DGraphView dgv) {
this.dgv = dgv;
+ this.props = new Properties();
}
@@ -38,15 +41,10 @@
return dgv.getVisualLexicon();
}
- @Override
- public void setProperties(Properties props) {
- dgv.setProperties(props);
- }
@Override
public Properties getProperties() {
- // TODO Auto-generated method stub
- return null;
+ return props;
}
@Override
Modified:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/RenderingEngine.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/RenderingEngine.java
2010-10-19 20:48:55 UTC (rev 22300)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/RenderingEngine.java
2010-10-19 20:52:27 UTC (rev 22301)
@@ -25,7 +25,7 @@
public interface RenderingEngine<T> {
/**
- * Returns View Model being rendered.
+ * Returns {...@linkplain View} being rendered.
*
* @return view model. This is an immutable object.
*/
@@ -33,21 +33,21 @@
/**
- * Provide all compatible Visual Properties as a Visual Lexicon.
+ * Provide all compatible Visual Properties as a {...@linkplain
VisualLexicon}.
*
* @return Visual Lexicon of this rendering engine.
*/
public VisualLexicon getVisualLexicon();
-
- /**
- * Set prop values to rendering engine, like LOD
- */
- public void setProperties(final Properties props);
/**
- * Get current rendering engine dependent properties, like LOD
+ * Get property values for the rendering engine, like LOD.
+ * Users can set each property value by getting this {...@linkplain
Properties} object.
+ * <p>
+ * {...@linkplain Properties} object itself is immutable.
+ *
+ * @return property values.
*/
public Properties getProperties();
@@ -61,7 +61,7 @@
/**
- * Render image from the current view model state.
+ * Render an {...@linkplain Image} object from current visualization.
*
* @return Image object created from current window.
*/
Modified:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/RenderingEngineFactory.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/RenderingEngineFactory.java
2010-10-19 20:48:55 UTC (rev 22300)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/RenderingEngineFactory.java
2010-10-19 20:52:27 UTC (rev 22301)
@@ -22,10 +22,14 @@
* will be rendered in a window, using same rendering engine.
*
* @param visualizationContainer
- * @param viewModel view-model to be rendered by the RenderingEngine.
+ * Window component which contains the rendered view. In most
+ * cases, {...@linkplain Window} components in Swing will be
used.
+ * @param viewModel
+ * view-model to be rendered by the RenderingEngine.
*
* @return Rendering Engine for visualization on the
visualizationContainer.
*/
- public RenderingEngine<T> render(final Object visualizationContainer,
final View<T> viewModel);
+ public RenderingEngine<T> render(final Object visualizationContainer,
+ final View<T> viewModel);
}
Modified:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/RenderingEngineManager.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/RenderingEngineManager.java
2010-10-19 20:48:55 UTC (rev 22300)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/RenderingEngineManager.java
2010-10-19 20:52:27 UTC (rev 22301)
@@ -1,7 +1,36 @@
package org.cytoscape.view.presentation;
+import java.util.Collection;
+
+import org.cytoscape.view.model.View;
+
+/**
+ * Manager for {...@linkplain RenderingEngine} objects. All RenderingEngine
objects
+ * created by {...@linkplain RenderingEngineFactory} should be registered to
this
+ * manager.
+ * <P>
+ * Register/unregister engines are handled through
+ * {...@linkplain RenderingEngineCreatedEvent}s.
+ *
+ *
+ * @author kono
+ *
+ */
public interface RenderingEngineManager {
- void addRenderingEngine(final RenderingEngine<?> engine);
-
- void removeRenderingEngine(final RenderingEngine<?> engine);
+
+ /**
+ * Get all rendering engines for the given view model.
+ *
+ * @param <T>
+ * Data model type. Usually they are {...@linkplain CyNode},
+ * {...@linkplain CyEdge}, {...@linkplain CyNetwork}, or
+ * {...@linkplain CyDataTable}.
+ * @param viewModel
+ * View model for the presentation.
+ *
+ * @return collection of rendering engines (presentations) for the given
+ * view model.
+ */
+ <T> Collection<RenderingEngine<T>> getRendringEngines(
+ final View<T> viewModel);
}
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/RenderingEngineCreatedEvent.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/RenderingEngineCreatedEvent.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/RenderingEngineCreatedEvent.java
2010-10-19 20:52:27 UTC (rev 22301)
@@ -0,0 +1,24 @@
+package org.cytoscape.view.presentation.events;
+
+import org.cytoscape.event.AbstractCyEvent;
+import org.cytoscape.view.presentation.RenderingEngine;
+
+/**
+ * When {...@linkplain RenderingEngineFactory} creates a new presentation (
+ * {...@linkplain RenderingEngine}), this event should be fired.
+ *
+ * @author kono
+ *
+ */
+public class RenderingEngineCreatedEvent extends
AbstractCyEvent<RenderingEngine<?>> {
+
+ /**
+ * Create a new event for the new RenderingEngine object.
+ *
+ * @param engine newly created RenderingEngine object.
+ */
+ public RenderingEngineCreatedEvent(RenderingEngine<?> engine) {
+ super(engine, RenderingEngineCreatedEventListener.class);
+ }
+
+}
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/RenderingEngineCreatedEventListener.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/RenderingEngineCreatedEventListener.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/RenderingEngineCreatedEventListener.java
2010-10-19 20:52:27 UTC (rev 22301)
@@ -0,0 +1,23 @@
+package org.cytoscape.view.presentation.events;
+
+import org.cytoscape.event.CyListener;
+
+/**
+ * Listener for {...@linkplain RenderingEngineCreatedEvent}.
+ * {...@linkplain RenderingEngineManager} implementation should implement this
+ * interface, too.
+ *
+ * @author kono
+ *
+ */
+public interface RenderingEngineCreatedEventListener extends CyListener {
+
+ /**
+ * Listener can extract source RenderingEngine object in this method.
This
+ * is mainly for {...@linkplain RenderingEngineManager}.
+ *
+ * @param e
+ * an event object which contains source RenderingEngine.
+ */
+ void handleEvent(final RenderingEngineCreatedEvent e);
+}
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/package-info.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/package-info.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/events/package-info.java
2010-10-19 20:52:27 UTC (rev 22301)
@@ -0,0 +1,5 @@
+/**
+ * Event implementations and listener interfaces for the Presentation layer.
+ */
+package org.cytoscape.view.presentation.events;
+
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/package-info.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/package-info.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/package-info.java
2010-10-19 20:52:27 UTC (rev 22301)
@@ -0,0 +1,5 @@
+/**
+ * API set for all rendering engines (visualizers).
+ */
+package org.cytoscape.view.presentation;
+
Modified:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/AbstractVisualLexicon.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/AbstractVisualLexicon.java
2010-10-19 20:48:55 UTC (rev 22300)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/AbstractVisualLexicon.java
2010-10-19 20:52:27 UTC (rev 22301)
@@ -11,14 +11,13 @@
import org.cytoscape.view.model.VisualLexiconNode;
import org.cytoscape.view.model.VisualLexiconNodeFactory;
import org.cytoscape.view.model.VisualProperty;
-import org.cytoscape.view.model.Visualizable;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+/**
+ * Implementations for common features for all VisualLexicons.
+ *
+ */
public abstract class AbstractVisualLexicon implements VisualLexicon {
- private static final Logger logger =
LoggerFactory.getLogger(AbstractVisualLexicon.class);
-
//
private final Map<VisualProperty<?>, VisualLexiconNode>
visualPropertyMap;
@@ -29,9 +28,10 @@
/**
- * Insert a root node to the tree and build it.
+ * Constructor for VisualLexicon. The parameters are required for all
lexicons.
*
- * @param rootVisualProperty
+ * @param rootVisualProperty Root of the visual property tree.
+ * @param nodeFactory factory to create tree nodes for a lexicon.
*/
public AbstractVisualLexicon(final VisualProperty<NullDataType>
rootVisualProperty, final VisualLexiconNodeFactory nodeFactory) {
this.nodeFactory = nodeFactory;
@@ -44,38 +44,12 @@
}
- // Returns all visual properties as a set.
- public Set<VisualProperty<?>> getAllVisualProperties() {
+ @Override public Set<VisualProperty<?>> getAllVisualProperties() {
return new
HashSet<VisualProperty<?>>(visualPropertyMap.keySet());
}
-
-
-// /**
-// * Add a new VP as a leaf.
-// *
-// * @param prop
-// * @param parent
-// */
-// void insertVisualProperty(final VisualProperty<?> prop, final
VisualProperty<?> parent) {
-// //Sanity check
-// if(prop == null)
-// throw new NullPointerException("Cannot add null to the
lexicon tree.");
-// if(parent == null)
-// throw new NullPointerException("Parent Visual Property
should not be null.");
-//
-// if(this.visualPropertyMap.containsValue(prop))
-// throw new IllegalArgumentException("The Visual Property
already exists: " + prop.getDisplayName());
-//
-// if(!this.visualPropertyMap.containsValue(parent))
-// throw new IllegalArgumentException("Parent Visual
Property does not exist in the tree.");
-//
-// this.visualPropertyMap.put(prop.getIdString(), prop);
-// parent.getChildren().add(prop);
-// }
- @Override
- public Collection<VisualProperty<?>> getAllDescendants(final
VisualProperty<?> prop) {
+ @Override public Collection<VisualProperty<?>> getAllDescendants(final
VisualProperty<?> prop) {
if(prop == null)
throw new NullPointerException("Target visual property
cannot be null.");
@@ -86,8 +60,7 @@
}
- @Override
- public VisualProperty<NullDataType> getRootVisualProperty() {
+ @Override public VisualProperty<NullDataType> getRootVisualProperty() {
return this.rootVisualProperty;
}
@@ -110,6 +83,12 @@
return children;
}
+ /**
+ * Insert a Visual Property to the tree.
+ *
+ * @param vp
+ * @param parent
+ */
protected void addVisualProperty(final VisualProperty<?> vp, final
VisualProperty<?> parent) {
if(this.visualPropertyMap.containsKey(vp))
throw new IllegalStateException("The key " +
vp.getIdString() + " already exists in the lexicon.");
Modified:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/TwoDVisualLexicon.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/TwoDVisualLexicon.java
2010-10-19 20:48:55 UTC (rev 22300)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/TwoDVisualLexicon.java
2010-10-19 20:52:27 UTC (rev 22301)
@@ -43,14 +43,18 @@
import org.cytoscape.view.model.Visualizable;
/**
- * Should be implemented as a service. 'Renderer' is simply anything that
- * provides VisualProperties. With a 'VisualProperties as annotations' this
- * won't be needed.
+ * Minimal set of {...@linkplain VisualProperty} objects which will be
required for
+ * all {...@linkplain RenderingEngine}s. All of Visual Properties are
singletons
+ * and accessible as static object.
+ *
+ * @author kono
+ *
*/
public class TwoDVisualLexicon extends AbstractVisualLexicon {
// Top level nodes has null as parent, and will be pointed by parent
node.
// This is because all VPs are static objects.
+
public static final VisualProperty<Visualizable> NETWORK = new
DefaultVisualizableVisualProperty(
"NETWORK", "Network Visual Property");
@@ -140,9 +144,11 @@
Color.WHITE, "NETWORK_BACKGROUND_COLOR", "Network
Background Color");
/**
- * Build basic VP tree.
+ * Build tree-structure for the set of Visual Properties defined in this
+ * class.
*
- * @param rootVisualProperty
+ * @param root
+ * @param nodeFactory
*/
public TwoDVisualLexicon(final VisualProperty<NullDataType> root,
final VisualLexiconNodeFactory nodeFactory) {
Added:
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/package-info.java
===================================================================
---
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/package-info.java
(rev 0)
+++
core3/presentation-api/trunk/src/main/java/org/cytoscape/view/presentation/property/package-info.java
2010-10-19 20:52:27 UTC (rev 22301)
@@ -0,0 +1,5 @@
+/**
+ * Implementations of basic {...@linkplain VisualProperty} objects and
{...@linkplain VisualLexicon}s.
+ */
+package org.cytoscape.view.presentation.property;
+
--
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.