Author: pwang
Date: 2010-10-25 11:22:26 -0700 (Mon, 25 Oct 2010)
New Revision: 22362
Removed:
core3/io-api/trunk/src/main/java/org/cytoscape/io/write/AbstractCyWriter.java
core3/io-api/trunk/src/main/java/org/cytoscape/io/write/CyTableWriter.java
core3/io-api/trunk/src/main/java/org/cytoscape/io/write/ViewWriter.java
Modified:
core3/io-api/trunk/src/main/java/org/cytoscape/io/write/CyWriterFactory.java
Log:
Moved to core-task-impl
Deleted:
core3/io-api/trunk/src/main/java/org/cytoscape/io/write/AbstractCyWriter.java
===================================================================
---
core3/io-api/trunk/src/main/java/org/cytoscape/io/write/AbstractCyWriter.java
2010-10-25 18:21:17 UTC (rev 22361)
+++
core3/io-api/trunk/src/main/java/org/cytoscape/io/write/AbstractCyWriter.java
2010-10-25 18:22:26 UTC (rev 22362)
@@ -1,113 +0,0 @@
-
-package org.cytoscape.io.write;
-
-import org.cytoscape.work.AbstractTask;
-import org.cytoscape.work.TaskMonitor;
-import org.cytoscape.work.Tunable;
-import org.cytoscape.work.util.ListSingleSelection;
-import org.cytoscape.io.CyFileFilter;
-import java.io.File;
-
-import java.util.Map;
-import java.util.TreeMap;
-import java.util.ArrayList;
-
-/**
- * An abstract utility implementation of a Task that writes a user defined
- * file to a file type determined by a provided writer manager. This class
- * is meant to be extended for specific file types such that the appropriate
- * {...@link org.cytoscape.io.write.CyWriter} can be identified.
- */
-public abstract class AbstractCyWriter<T extends CyWriterManager> extends
AbstractTask
- implements CyWriter {
-
- private File outputFile;
-
- /**
- * The method sets the file to be written. This field should not
- * be called directly, but rather handled by the {...@link
org.cytoscape.work.Tunable}
- * processing. This method is the "setter" portion of a
- * getter/setter tunable method pair.
- * @param f The file to be written.
- */
- public final void setOutputFile(File f) {
- if ( f != null )
- outputFile = f;
- }
-
- /**
- * This method gets the file to be written. This method should not
- * be called directly, but rather handled by the {...@link
org.cytoscape.work.Tunable}
- * processing. This method is the "getter" portion of a
- * getter/setter tunable method pair.
- * @return The file to be written.
- */
- @Tunable(description="Select the output file name")
- public final File getOutputFile() {
- return outputFile;
- }
-
- /**
- * The list of file type options generated by the file types
- * available from the CyWriterManager. This field should not
- * be set directly, but rather handled by the {...@link
org.cytoscape.work.Tunable}
- * processing.
- */
- @Tunable(description = "Select the export file format")
- public final ListSingleSelection<String> options;
-
- private final Map<String,CyFileFilter> descriptionFilterMap;
-
- /**
- * The CyWriterManager specified in the constructor.
- */
- protected final T writerManager;
-
- /**
- * @param writerManager The CyWriterManager to be used to determine
which
- * {...@link org.cytoscape.io.write.CyWriter} to be used to write the
file chosen by the user.
- */
- public AbstractCyWriter(T writerManager) {
- if ( writerManager == null )
- throw new NullPointerException("CyWriterManager is
null");
- this.writerManager = writerManager;
-
- descriptionFilterMap = new TreeMap<String,CyFileFilter>();
- for ( CyFileFilter f : writerManager.getAvailableWriters() )
- descriptionFilterMap.put( f.getDescription(), f );
-
- options = new ListSingleSelection<String>( new
ArrayList<String>( descriptionFilterMap.keySet() ) );
- }
-
- /**
- * This method processes the chosen input file and output type and
attempts
- * to write the file.
- * @param tm The {...@link org.cytoscape.work.TaskMonitor} provided by
the TaskManager execution environment.
- */
- public final void run(TaskMonitor tm) throws Exception {
- if ( outputFile == null )
- throw new NullPointerException("Output file has not be
specified!");
-
- String desc = options.getSelectedValue();
- if ( desc == null )
- throw new NullPointerException("No file type has been
specified!");
-
- CyFileFilter filter = descriptionFilterMap.get(desc);
- if ( filter == null )
- throw new NullPointerException("No file filter found
for specified file type!");
-
- CyWriter writer = getWriter(filter,outputFile);
- if ( writer == null )
- throw new NullPointerException("No CyWriter found for
specified file type!");
-
- insertTasksAfterCurrentTask( writer );
- }
-
- /**
- * Should return a {...@link org.cytoscape.io.write.CyWriter} object
for writing the specified file of the specified type.
- * @param filter The specific type of file to be written.
- * @param out The file that will be written.
- */
- protected abstract CyWriter getWriter(CyFileFilter filter, File out)
throws Exception;
-
-}
Deleted:
core3/io-api/trunk/src/main/java/org/cytoscape/io/write/CyTableWriter.java
===================================================================
--- core3/io-api/trunk/src/main/java/org/cytoscape/io/write/CyTableWriter.java
2010-10-25 18:21:17 UTC (rev 22361)
+++ core3/io-api/trunk/src/main/java/org/cytoscape/io/write/CyTableWriter.java
2010-10-25 18:22:26 UTC (rev 22362)
@@ -1,33 +0,0 @@
-
-package org.cytoscape.io.write;
-
-import org.cytoscape.model.CyTable;
-import org.cytoscape.io.CyFileFilter;
-import java.io.File;
-
-/**
- * A utility Task implementation specifically for writing {...@link
org.cytoscape.model.CyTable} objects.
- */
-public final class CyTableWriter extends
AbstractCyWriter<CyTableWriterManager> {
-
- private final CyTable table;
-
- /**
- * @param writerManager The {...@link
org.cytoscape.io.write.CyTableWriterManager} used to determine which
- * {...@link org.cytoscape.io.write.CyTableWriterFactory} to use to
write the file.
- * @param table The {...@link org.cytoscape.model.CyTable} to be
written out.
- */
- public CyTableWriter(CyTableWriterManager writerManager, CyTable table ) {
- super(writerManager);
- if ( table == null )
- throw new NullPointerException("Table is null");
- this.table = table;
- }
-
- /**
- * {...@inheritdoc}
- */
- protected CyWriter getWriter(CyFileFilter filter, File file) throws
Exception{
- return writerManager.getWriter(table,filter,file);
- }
-}
Modified:
core3/io-api/trunk/src/main/java/org/cytoscape/io/write/CyWriterFactory.java
===================================================================
---
core3/io-api/trunk/src/main/java/org/cytoscape/io/write/CyWriterFactory.java
2010-10-25 18:21:17 UTC (rev 22361)
+++
core3/io-api/trunk/src/main/java/org/cytoscape/io/write/CyWriterFactory.java
2010-10-25 18:22:26 UTC (rev 22362)
@@ -24,5 +24,5 @@
* @return A {...@link CyWriter} Task suitable for writing to the
specified
* output stream.
*/
- CyWriter getWriter();
+ CyWriter getWriterTask();
}
Deleted: core3/io-api/trunk/src/main/java/org/cytoscape/io/write/ViewWriter.java
===================================================================
--- core3/io-api/trunk/src/main/java/org/cytoscape/io/write/ViewWriter.java
2010-10-25 18:21:17 UTC (rev 22361)
+++ core3/io-api/trunk/src/main/java/org/cytoscape/io/write/ViewWriter.java
2010-10-25 18:22:26 UTC (rev 22362)
@@ -1,42 +0,0 @@
-
-package org.cytoscape.io.write;
-
-import org.cytoscape.view.model.View;
-import org.cytoscape.view.presentation.RenderingEngine;
-import org.cytoscape.io.CyFileFilter;
-import java.io.File;
-
-/**
- * A utility Task implementation that will write the specified View to the
- * the specified image file using the specified RenderingEngine.
- */
-public final class ViewWriter extends AbstractCyWriter<ViewWriterManager> {
-
- private final View<?> view;
- private final RenderingEngine re;
-
- /**
- * @param writerManager The {...@link
org.cytoscape.io.write.ViewWriterManager} used to determine which type of
- * file should be written.
- * @param view The View object to be written to the specified file.
- * @param re The RenderingEngine used to generate the image to be
written to the file.
- */
- public ViewWriter(ViewWriterManager writerManager, View<?> view,
RenderingEngine re ) {
- super(writerManager);
-
- if ( view == null )
- throw new NullPointerException("view is null");
- this.view = view;
-
- if ( re == null )
- throw new NullPointerException("rendering engine is
null");
- this.re = re;
- }
-
- /**
- * {...@inheritdoc}
- */
- protected CyWriter getWriter(CyFileFilter filter, File file) throws
Exception {
- return writerManager.getWriter(view,re,filter,file);
- }
-}
--
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.