Author: kono
Date: 2011-04-29 13:28:52 -0700 (Fri, 29 Apr 2011)
New Revision: 24857
Added:
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/NullCyNetworkView.java
Modified:
core3/io-api/trunk/src/main/java/org/cytoscape/io/read/CyNetworkViewReader.java
Log:
Null object for network view had been added.
Modified:
core3/io-api/trunk/src/main/java/org/cytoscape/io/read/CyNetworkViewReader.java
===================================================================
---
core3/io-api/trunk/src/main/java/org/cytoscape/io/read/CyNetworkViewReader.java
2011-04-29 18:01:23 UTC (rev 24856)
+++
core3/io-api/trunk/src/main/java/org/cytoscape/io/read/CyNetworkViewReader.java
2011-04-29 20:28:52 UTC (rev 24857)
@@ -5,28 +5,36 @@
import org.cytoscape.work.Task;
/**
- * An extension of the Task interface that returns an array of
- * {@link org.cytoscape.view.model.CyNetworkView} objects as well as optional
- * {@link org.cytoscape.view.vizmap.VisualStyle} objects that are read as part
of the Task.
- * Instances of this interface are created by InputStreamTaskFactory
- * objects registered as OSGi services, which are in turn processed
- * by associated reader manager objects that distinguish
- * InputStreamTaskFactories based on the DataCategory associated with
- * the {@link org.cytoscape.io.CyFileFilter}.
+ * An extension of the Task interface that returns an array of
+ * {@link org.cytoscape.view.model.CyNetworkView} objects as well as optional
+ * {@link org.cytoscape.view.vizmap.VisualStyle} objects that are read as part
+ * of the Task. Instances of this interface are created by
+ * InputStreamTaskFactory objects registered as OSGi services, which are in
turn
+ * processed by associated reader manager objects that distinguish
+ * InputStreamTaskFactories based on the DataCategory associated with the
+ * {@link org.cytoscape.io.CyFileFilter}.
*/
public interface CyNetworkViewReader extends Task {
- /**
- * Return an array of {@link org.cytoscape.view.model.CyNetworkView}
objects
- * @return An array of {@link org.cytoscape.view.model.CyNetworkView}
objects.
- */
- CyNetworkView[] getNetworkViews();
+ /**
+ * Return an array of {@link org.cytoscape.view.model.CyNetworkView}
objects
+ *
+ * <p>
+ * This array may contain {@link
org.cytoscape.view.model.NullCyNetworkView}.
+ * Create actual view or not is controlled by a parameter for reader
implementation.
+ * </p>
+ *
+ * @return An array of {@link org.cytoscape.view.model.CyNetworkView}
+ * objects.
+ */
+ CyNetworkView[] getNetworkViews();
- /**
- * Return an array of {@link org.cytoscape.view.vizmap.VisualStyle}
objects.
- * @return An array of {@link org.cytoscape.view.vizmap.VisualStyle}
objects. The list may be
- * empty if no VisualStyle is defined by the input being
- * read.
- */
- VisualStyle[] getVisualStyles();
+ /**
+ * Return an array of {@link org.cytoscape.view.vizmap.VisualStyle}
objects.
+ *
+ * @return An array of {@link org.cytoscape.view.vizmap.VisualStyle}
+ * objects. The list may be empty if no VisualStyle is defined by
+ * the input being read.
+ */
+ VisualStyle[] getVisualStyles();
}
Added:
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/NullCyNetworkView.java
===================================================================
---
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/NullCyNetworkView.java
(rev 0)
+++
core3/viewmodel-api/trunk/src/main/java/org/cytoscape/view/model/NullCyNetworkView.java
2011-04-29 20:28:52 UTC (rev 24857)
@@ -0,0 +1,104 @@
+package org.cytoscape.view.model;
+
+import java.util.Collection;
+
+import org.cytoscape.model.CyEdge;
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyNode;
+import org.cytoscape.model.CyTableEntry;
+import org.cytoscape.model.SUIDFactory;
+
+/**
+ * Null object for CyNetworkView.
+ *
+ * Network readers may return this null object.
+ *
+ */
+public final class NullCyNetworkView implements CyNetworkView {
+
+ private final long suid;
+ private final CyNetwork model;
+
+ public NullCyNetworkView(final CyNetwork model) {
+ this.model = model;
+ this.suid = SUIDFactory.getNextSUID();
+ }
+
+ @Override
+ public CyNetwork getModel() {
+ return model;
+ }
+
+ @Override
+ public long getSUID() {
+ return suid;
+ }
+
+ // All of the methods below are dummy.
+
+ @Override
+ public <T, V extends T> void setVisualProperty(VisualProperty<? extends T>
vp, V value) {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+ @Override
+ public <T> T getVisualProperty(VisualProperty<T> vp) {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+ @Override
+ public <T, V extends T> void setLockedValue(VisualProperty<? extends T>
vp, V value) {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+ @Override
+ public boolean isValueLocked(VisualProperty<?> vp) {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+ @Override
+ public void clearValueLock(VisualProperty<?> vp) {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+ @Override
+ public View<CyNode> getNodeView(CyNode node) {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+ @Override
+ public Collection<View<CyNode>> getNodeViews() {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+ @Override
+ public View<CyEdge> getEdgeView(CyEdge edge) {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+ @Override
+ public Collection<View<CyEdge>> getEdgeViews() {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+ @Override
+ public Collection<View<? extends CyTableEntry>> getAllViews() {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+ @Override
+ public void fitContent() {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+ @Override
+ public void fitSelected() {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+ @Override
+ public void updateView() {
+ throw new UnsupportedOperationException("This is a null object and does
not support this method.");
+ }
+
+}
--
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.