use of org.cytoscape.app.internal.net.WebApp in project cytoscape-impl by cytoscape.
the class InstallAppsPanel method updateDescriptionBox.
private void updateDescriptionBox() {
TreePath selectedPath = resultsTree.getSelectionPath();
if (selectedPath != null) {
DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) resultsTree.getSelectionPath().getLastPathComponent();
WebApp selectedApp = (WebApp) selectedNode.getUserObject();
boolean appAlreadyInstalled = (selectedApp.getCorrespondingApp() != null && selectedApp.getCorrespondingApp().getStatus() == AppStatus.INSTALLED);
String text = "";
// text += "<html> <head> </head> <body hspace=\"4\" vspace=\"4\">";
text += "<html> <body hspace=\"4\" vspace=\"2\">";
// App hyperlink to web store page
// text += "<p style=\"margin-top: 0\"> <a href=\"" + selectedApp.getPageUrl() + "\">" + selectedApp.getPageUrl() + "</a> </p>";
// App name, version
text += "<b>" + selectedApp.getFullName() + "</b>";
String latestReleaseVersion = selectedApp.getReleases().get(selectedApp.getReleases().size() - 1).getReleaseVersion();
text += "<br />" + latestReleaseVersion;
if (appAlreadyInstalled) {
if (!selectedApp.getCorrespondingApp().getVersion().equalsIgnoreCase(latestReleaseVersion)) {
text += " (installed: " + selectedApp.getCorrespondingApp().getVersion() + ")";
}
}
/*
text += "<p>";
text += "<b>" + selectedApp.getFullName() + "</b>";
text += "<br />" + selectedApp.getReleases().get(selectedApp.getReleases().size() - 1).getReleaseVersion();
text += "</p>";
*/
text += "<p>";
// App image
text += "<img border=\"0\" ";
text += "src=\"" + appManager.getWebQuerier().getDefaultAppStoreUrl() + selectedApp.getIconUrl() + "\" alt=\"" + selectedApp.getFullName() + "\"/>";
text += "</p>";
// App description
text += "<p>";
text += (String.valueOf(selectedApp.getDescription()).equalsIgnoreCase("null") ? "App description not found." : selectedApp.getDescription());
text += "</p>";
text += "</body> </html>";
descriptionTextPane.setText(text);
this.selectedApp = selectedApp;
if (appAlreadyInstalled) {
installButton.setEnabled(false);
} else {
installButton.setEnabled(true);
}
viewOnAppStoreButton.setEnabled(true);
} else {
// descriptionTextPane.setText("App description is displayed here.");
descriptionTextPane.setText("");
this.selectedApp = null;
installButton.setEnabled(false);
viewOnAppStoreButton.setEnabled(false);
}
}
use of org.cytoscape.app.internal.net.WebApp in project cytoscape-impl by cytoscape.
the class InstallAppsPanel method queryForApps.
// Queries the currently set app store url for available apps.
private void queryForApps() {
if (hasTagTreeBeenPopulated)
return;
final WebQuerier webQuerier = appManager.getWebQuerier();
taskManager.execute(new TaskIterator(new Task() {
// Obtain information for all available apps, then append tag information
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
taskMonitor.setTitle("Getting available apps");
taskMonitor.setStatusMessage("Obtaining apps from: " + webQuerier.getCurrentAppStoreUrl());
Set<WebApp> availableApps = webQuerier.getAllApps();
if (availableApps == null)
return;
// Once the information is obtained, update the tree
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
// populateTree(appManager.getWebQuerier().getAllApps());
buildTagsTree();
fillResultsTree(appManager.getWebQuerier().getAllApps());
}
});
}
@Override
public void cancel() {
}
}));
}
use of org.cytoscape.app.internal.net.WebApp in project cytoscape-impl by cytoscape.
the class InstallAppsFromWebAppTask method run.
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
taskMonitor.setTitle("Install from App Store");
taskMonitor.setTitle("");
DownloadStatus status = new DownloadStatus(taskMonitor);
List<File> appFiles = new ArrayList<File>();
for (WebApp webApp : webApps) {
taskMonitor.setStatusMessage("Downloading " + webApp.getFullName());
// Download app
File appFile = appManager.getWebQuerier().downloadApp(webApp, null, new File(appManager.getDownloadedAppsPath()), status);
if (appFile == null) {
throw new Exception("Unable to find download URL for about-to-be-installed " + webApp.getFullName());
}
appFiles.add(appFile);
}
insertTasksAfterCurrentTask(new InstallAppsFromFileTask(appFiles, appManager, promptToReplace));
}
use of org.cytoscape.app.internal.net.WebApp in project cytoscape-impl by cytoscape.
the class InstallTask method run.
@Override
public void run(TaskMonitor taskMonitor) throws Exception {
if (app == null && file == null) {
taskMonitor.showMessage(TaskMonitor.Level.ERROR, "Neither app name nor file provided");
return;
}
taskMonitor.setTitle("Installing app " + app);
if (file != null) {
InstallAppsFromFileTask installTask = new InstallAppsFromFileTask(Collections.singletonList(file), appManager, false);
insertTasksAfterCurrentTask(installTask);
} else {
WebApp appObject = getWebApp(app);
if (appObject == null) {
taskMonitor.showMessage(TaskMonitor.Level.ERROR, "Can't find app '" + app + "'");
return;
}
InstallAppsFromWebAppTask installTask = new InstallAppsFromWebAppTask(Collections.singletonList(appObject), appManager, false);
insertTasksAfterCurrentTask(installTask);
}
}
use of org.cytoscape.app.internal.net.WebApp in project cytoscape-impl by cytoscape.
the class RetrieveTask method getPmidsOfApps.
/**
* Return a map of app names to their PubMed IDs.
*/
private Map<String, String> getPmidsOfApps() {
final Map<String, String> pmids = new HashMap<>();
final Set<WebApp> allApps = webQuerier.getAllApps();
webQuerier.checkWebAppInstallStatus(allApps, appManager);
for (final WebApp app : allApps) {
if (app.getCorrespondingApp() == null || app.getCorrespondingApp().getStatus() != App.AppStatus.INSTALLED)
continue;
if (app.getCitation() != null)
pmids.put(app.getFullName(), app.getCitation());
}
return pmids;
}
Aggregations