use of org.cytoscape.io.DataCategory in project cytoscape-impl by cytoscape.
the class DataSourceManagerImpl method getDataSources.
@Override
public Collection<DataSource> getDataSources(String providerName) {
final Set<DataSource> sources = new LinkedHashSet<>();
synchronized (lock) {
Iterator<DataCategory> it = this.dataSourceMap.keySet().iterator();
Map<String, DataSource> map;
while (it.hasNext()) {
map = this.dataSourceMap.get(it.next());
Iterator<DataSource> it_ds = map.values().iterator();
while (it_ds.hasNext()) {
DataSource ds = it_ds.next();
if (ds.getProvider().equals(providerName))
sources.add(ds);
}
}
return sources;
}
}
use of org.cytoscape.io.DataCategory in project cytoscape-api by cytoscape.
the class InputStreamTaskFactoryTest method setUp.
@Before
public void setUp() throws Exception {
Set<String> extensions = new HashSet<String>();
extensions.add("xml");
Set<String> contentTypes = new HashSet<String>();
String description = "test filter";
DataCategory category = DataCategory.NETWORK;
this.fileFilter = new BasicCyFileFilter(extensions, contentTypes, description, category, streamUtil);
this.taskFactory = new DummyInputStreamTaskFactory(fileFilter);
}
use of org.cytoscape.io.DataCategory in project cytoscape-api by cytoscape.
the class AbstractDataSourceTest method testGetDataCategory.
@Test
public void testGetDataCategory() {
final DataCategory category = source.getDataCategory();
assertEquals(this.category, category);
}
use of org.cytoscape.io.DataCategory in project cytoscape-impl by cytoscape.
the class FileHandler method init.
private void init() {
input = isInput();
final String fileCategory = getFileCategory();
final DataCategory dataCategory = DataCategory.valueOf(fileCategory.toUpperCase());
filters = fileTypesManager.getSupportedFileTypes(dataCategory, input);
String displayName = dataCategory.getDisplayName().toLowerCase();
String a = isVowel(displayName.charAt(0)) ? "an" : "a";
setGui();
updateFieldPanel(panel, label, controlPanel, horizontal);
setTooltip(getTooltip(), textField, browseButton);
}
use of org.cytoscape.io.DataCategory in project cytoscape-impl by cytoscape.
the class BookmarksUtilImpl method convertToDataSource.
public org.cytoscape.io.datasource.DataSource convertToDataSource(Bookmarks pBookmarks, String pCategoryName, DataSource pDataSource, String pProvider) {
final String location = pDataSource.getHref();
final String name = pDataSource.getName();
final String description = "From Bookmarks";
// final String provider = "Example";
DataCategory dataType;
URL url = null;
if (pCategoryName.contentEquals("network")) {
dataType = DataCategory.NETWORK;
} else if (pCategoryName.contentEquals("table")) {
dataType = DataCategory.TABLE;
} else {
return null;
}
try {
url = new URL(location);
} catch (MalformedURLException e) {
logger.warn("Bookmark file coniatin invalid URL: " + location);
return null;
}
return (new DefaultDataSource(name, pProvider, description, dataType, url));
}
Aggregations