Author: paperwing
Date: 2012-08-20 09:59:57 -0700 (Mon, 20 Aug 2012)
New Revision: 30225

Modified:
   
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/WebApp.java
   
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/WebQuerier.java
   
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/ui/InstallFromStorePanel.java
Log:
refs #1348 Installed apps now marked as installed in the app store app list, 
will show the currently installed version if it is older than the latest 
available version

Modified: 
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/WebApp.java
===================================================================
--- 
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/WebApp.java
  2012-08-20 14:59:53 UTC (rev 30224)
+++ 
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/WebApp.java
  2012-08-20 16:59:57 UTC (rev 30225)
@@ -21,6 +21,9 @@
        /** The name of the app that is displayed to the user. */
        private String fullName;
        
+       /** The name of the app to be used for listing available apps from the 
app store. May contain postfixes */
+       private String appListDisplayName;
+       
        /** A short description of the app. */
        private String description;
        
@@ -139,6 +142,14 @@
        public String getFullName() {
                return fullName;
        }
+       
+       /**
+        * Obtain the name of the app to be used in the available apps listing
+        * @return The name of the app to be used for the available apps listing
+        */
+       public String getAppListDisplayName() {
+               return appListDisplayName;
+       }
 
        /** 
         * Obtain a short description of the app 
@@ -232,6 +243,10 @@
        public void setName(String name) {
                this.name = name;
        }
+       
+       public void setAppListDisplayName(String appListDisplayName) {
+               this.appListDisplayName = appListDisplayName;
+       }
 
        public void setDescription(String description) {
                this.description = description;
@@ -283,6 +298,6 @@
        
        @Override
        public String toString() {
-               return fullName;
+               return appListDisplayName;
        }
 }

Modified: 
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/WebQuerier.java
===================================================================
--- 
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/WebQuerier.java
      2012-08-20 14:59:53 UTC (rev 30224)
+++ 
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/net/WebQuerier.java
      2012-08-20 16:59:57 UTC (rev 30225)
@@ -576,7 +576,6 @@
                        }
                        
                        if (app.getSha512Checksum() != null) {
-
                                String sha512checksum = 
app.getSha512Checksum().toLowerCase();
                                
                                for (WebApp webApp : webApps) {
@@ -585,7 +584,8 @@
                                        
                                        for (Release release : releases) {
                                                
-                                               if 
(sha512checksum.indexOf(release.getSha512Checksum()) != -1) {
+                                               if 
(release.getSha512Checksum().trim().length() > 0
+                                                               && 
sha512checksum.indexOf(release.getSha512Checksum()) != -1) {
                                                        
                                                        
webApp.setCorrespondingApp(app);
                                                }

Modified: 
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/ui/InstallFromStorePanel.java
===================================================================
--- 
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/ui/InstallFromStorePanel.java
    2012-08-20 14:59:53 UTC (rev 30224)
+++ 
core3/impl/trunk/app-impl/src/main/java/org/cytoscape/app/internal/ui/InstallFromStorePanel.java
    2012-08-20 16:59:57 UTC (rev 30225)
@@ -1,5 +1,6 @@
 package org.cytoscape.app.internal.ui;
 
+import java.awt.Color;
 import java.awt.Component;
 import java.awt.Container;
 import java.awt.Desktop;
@@ -36,6 +37,7 @@
 import javax.swing.tree.TreePath;
 
 import org.cytoscape.app.internal.manager.App;
+import org.cytoscape.app.internal.manager.App.AppStatus;
 import org.cytoscape.app.internal.manager.AppManager;
 import org.cytoscape.app.internal.manager.AppParser;
 import org.cytoscape.app.internal.net.ResultsFilterer;
@@ -609,6 +611,9 @@
     }
     
     private void fillResultsTree(Set<WebApp> webApps) {
+       appManager.getWebQuerier().checkWebAppInstallStatus(
+                       appManager.getWebQuerier().getAllApps(), appManager);
+       
        Set<WebApp> appsToShow = webApps;
        List<WebApp> sortedApps = new LinkedList<WebApp>(appsToShow);
        
@@ -625,6 +630,13 @@
        
        DefaultMutableTreeNode treeNode;
        for (WebApp webApp : sortedApps) {
+               if (webApp.getCorrespondingApp() != null
+                               && webApp.getCorrespondingApp().getStatus() == 
AppStatus.INSTALLED) {
+                       webApp.setAppListDisplayName(webApp.getFullName() + " 
(Installed)");
+               } else {
+                       webApp.setAppListDisplayName(webApp.getFullName());
+               }
+
                treeNode = new DefaultMutableTreeNode(webApp);
                root.add(treeNode);
        }
@@ -640,6 +652,9 @@
                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\">";
@@ -651,7 +666,15 @@
                
                // App name, version
                text += "<b>" + selectedApp.getFullName() + "</b>";
-               text += "<br />" + 
selectedApp.getReleases().get(selectedApp.getReleases().size() - 
1).getReleaseVersion();
+               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>";
@@ -677,7 +700,12 @@
                
                this.selectedApp = selectedApp;
                
-               installButton.setEnabled(true);
+               if (appAlreadyInstalled) {
+                       installButton.setEnabled(false);
+               } else {
+                       installButton.setEnabled(true);
+               }
+               
                viewOnAppStoreButton.setEnabled(true);
                
        } else {

-- 
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.

Reply via email to