Author: mes
Date: 2011-09-13 15:40:49 -0700 (Tue, 13 Sep 2011)
New Revision: 26786
Modified:
core3/api/branches/no-spring/io-api/src/main/java/org/cytoscape/io/BasicCyFileFilter.java
Log:
added an alternative constructor to facilitate java code
Modified:
core3/api/branches/no-spring/io-api/src/main/java/org/cytoscape/io/BasicCyFileFilter.java
===================================================================
---
core3/api/branches/no-spring/io-api/src/main/java/org/cytoscape/io/BasicCyFileFilter.java
2011-09-13 22:27:13 UTC (rev 26785)
+++
core3/api/branches/no-spring/io-api/src/main/java/org/cytoscape/io/BasicCyFileFilter.java
2011-09-13 22:40:49 UTC (rev 26786)
@@ -8,6 +8,7 @@
import java.net.URI;
import java.net.URLConnection;
import java.util.Set;
+import java.util.HashSet;
import javax.swing.filechooser.FileFilter;
import org.cytoscape.io.util.StreamUtil;
import org.slf4j.Logger;
@@ -58,6 +59,28 @@
}
/**
+ * Creates a file filter from the specified arguments.
+ * Note that a "." before the extension is not needed and will be
ignored.
+ * @param extensions The set of valid extensions for this filter.
+ * @param contentTypes The set of valid MIME content types that this
filter should recognize.
+ * @param description A human readable description of the filter.
+ * @param category The type of data this filter is meant to support.
+ * @param streamUtil An instance of the StreamUtil service.
+ */
+ public BasicCyFileFilter(final String[] extensions,
+ final String[] contentTypes, final String description,
+ final DataCategory category, StreamUtil streamUtil) {
+ this(createSet(extensions), createSet(contentTypes),
description, category, streamUtil);
+ }
+
+ private static Set<String> createSet(String[] values) {
+ Set<String> set = new HashSet<String>();
+ for ( String v : values )
+ set.add(v);
+ return set;
+ }
+
+ /**
* {@inheritDoc}
*/
public boolean accepts(URI uri, DataCategory category) {
--
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.