use of org.cytoscape.app.internal.net.WebQuerier.AppTag in project cytoscape-impl by cytoscape.
the class InstallAppsPanel method buildTagsTree.
private void buildTagsTree() {
WebQuerier webQuerier = appManager.getWebQuerier();
// Get all available apps and tags
Set<WebApp> availableApps = webQuerier.getAllApps();
Set<WebQuerier.AppTag> availableTags = webQuerier.getAllTags();
if (availableApps == null || availableTags == null)
return;
List<WebQuerier.AppTag> sortedTags = new LinkedList<WebQuerier.AppTag>(availableTags);
Collections.sort(sortedTags, new Comparator<WebQuerier.AppTag>() {
@Override
public int compare(AppTag tag, AppTag other) {
return other.getCount() - tag.getCount();
}
});
DefaultMutableTreeNode root = new DefaultMutableTreeNode("root");
DefaultMutableTreeNode allAppsTreeNode = new DefaultMutableTreeNode("all apps" + " (" + availableApps.size() + ")");
root.add(allAppsTreeNode);
DefaultMutableTreeNode collectionsTreeNode = new DefaultMutableTreeNode("collections (0)");
DefaultMutableTreeNode appsByTagTreeNode = new DefaultMutableTreeNode("apps by tag");
for (final WebQuerier.AppTag appTag : sortedTags) {
if (appTag.getName().equals("collections"))
collectionsTreeNode.setUserObject(appTag);
else
appsByTagTreeNode.add(new DefaultMutableTreeNode(appTag));
}
root.add(collectionsTreeNode);
root.add(appsByTagTreeNode);
tagsTree.setModel(new DefaultTreeModel(root));
// tagsTree.expandRow(2);
currentSelectedAppTag = null;
hasTagTreeBeenPopulated = true;
}
Aggregations