This repository has been archived by the owner on Nov 17, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,019 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/main/java/org/cytoscape/rest/internal/GraphicsWriterManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package org.cytoscape.rest.internal; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import java.util.Set; | ||
|
||
import org.cytoscape.io.CyFileFilter; | ||
import org.cytoscape.io.write.PresentationWriterFactory; | ||
|
||
public class GraphicsWriterManager { | ||
|
||
private final Map<String, PresentationWriterFactory> factories; | ||
|
||
public GraphicsWriterManager() { | ||
factories = new HashMap<>(); | ||
} | ||
|
||
public PresentationWriterFactory getFactory(final String fileType) { | ||
return factories.get(fileType); | ||
} | ||
|
||
@SuppressWarnings("rawtypes") | ||
public void addFactory(PresentationWriterFactory factory, Map properties) { | ||
final CyFileFilter ff = factory.getFileFilter(); | ||
final Set<String> ext = ff.getExtensions(); | ||
|
||
final String firstExt = ext.iterator().next(); | ||
System.out.println("Got writer: " + firstExt); | ||
|
||
factories.put(firstExt, factory); | ||
} | ||
|
||
@SuppressWarnings("rawtypes") | ||
public void removeFactory(PresentationWriterFactory factory, Map properties) { | ||
final CyFileFilter ff = factory.getFileFilter(); | ||
final Set<String> ext = ff.getExtensions(); | ||
factories.remove(ext.iterator().next()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.