Author: scooter
Date: 2010-11-11 11:21:08 -0800 (Thu, 11 Nov 2010)
New Revision: 22820

Modified:
   csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/BioCycPlugin.java
   
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/webservices/BioCycClient.java
   
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/webservices/BioCycClientGui.java
Log:
Added support for multiple sites.


Modified: 
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/BioCycPlugin.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/BioCycPlugin.java    
    2010-11-11 00:14:33 UTC (rev 22819)
+++ 
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/BioCycPlugin.java    
    2010-11-11 19:21:08 UTC (rev 22820)
@@ -55,9 +55,9 @@
        private BioCycClient wpclient;
        private static Properties defaultProps = null;
 
-       protected static final String WEBSERVICE_URL = "biocyc.webservice.uri";
+       public static final String WEBSERVICE_URL = "biocyc.webservice.uri";
        // protected static final String DEFAULT_URL = 
"http://brg-preview.ai.sri.com/";;
-       protected static final String DEFAULT_URL = "http://websvc.biocyc.org/";;
+       public static final String DEFAULT_URL = "http://websvc.biocyc.org/";;
 
        /**
         * We don't do much at initialization time
@@ -75,12 +75,6 @@
                // Listen for exits
                
Cytoscape.getPropertyChangeSupport().addPropertyChangeListener(Cytoscape.CYTOSCAPE_EXIT,
 this);
 
-               // Setup any global properties
-               Properties p = CytoscapeInit.getProperties();
-               if (p.get(WEBSERVICE_URL) == null) {
-                       p.put(WEBSERVICE_URL, DEFAULT_URL);
-               }
-
                // Initialize our properties file
                initBioCycProps();
 
@@ -113,7 +107,12 @@
        }
 
        public static String getBaseUrl() {
-               return 
CytoscapeInit.getProperties().getProperty(WEBSERVICE_URL);
+               String url = defaultProps.getProperty(WEBSERVICE_URL);
+               if (url == null) {
+                       url = DEFAULT_URL;
+                       setProp(WEBSERVICE_URL, DEFAULT_URL);
+               }
+               return url;
        }
 
        public void propertyChange(PropertyChangeEvent evt) {

Modified: 
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/webservices/BioCycClient.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/webservices/BioCycClient.java
    2010-11-11 00:14:33 UTC (rev 22819)
+++ 
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/webservices/BioCycClient.java
    2010-11-11 19:21:08 UTC (rev 22820)
@@ -100,6 +100,14 @@
                return stub;
        }
 
+       public String getDescription() {
+               String description = "<html><body><b>BioCyc</b> is one of 
several repositories using the Pathway Tools software (";
+               description += "<a 
href=\"http://bioinformatics.ai.sri.com/ptools\";>http://bioinformatics.ai.sri.com/ptools</a>)
 ";
+               description += "for pathway information on a variety of 
species.  This plugin supports any of the repositories ";
+               description += "running Pathway Tools release <b>14.5</b> or 
later</body></html>";
+               return description;
+       }
+
        /**
         * Check if a working connection to the wikipathways
         * web service is available.

Modified: 
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/webservices/BioCycClientGui.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/webservices/BioCycClientGui.java
 2010-11-11 00:14:33 UTC (rev 22819)
+++ 
csplugins/trunk/ucsf/scooter/bioCycPlugin/src/bioCycPlugin/webservices/BioCycClientGui.java
 2010-11-11 19:21:08 UTC (rev 22820)
@@ -16,6 +16,7 @@
 //
 package bioCycPlugin.webservices;
 
+import bioCycPlugin.BioCycPlugin;
 import bioCycPlugin.model.Database;
 import bioCycPlugin.model.Pathway;
 import bioCycPlugin.webservices.ResultProperty;
@@ -62,6 +63,7 @@
        Database defaultDatabase = null;
        JComboBox databaseCombo;
        JTextField searchText;
+       JTextField webServiceText;
        JTable resultTable;
        ListWithPropertiesTableModel<ResultProperty, ResultRow> tableModel;
 
@@ -78,6 +80,11 @@
                searchText.setActionCommand(ACTION_SEARCH);
                searchText.addActionListener(this);
 
+               webServiceText = new JTextField();
+               webServiceText.setActionCommand(ACTION_SET_WEBSERVICE);
+               webServiceText.addActionListener(this);
+               webServiceText.setText(BioCycPlugin.getBaseUrl());
+
                JButton searchBtn = new JButton("Search");
                searchBtn.setActionCommand(ACTION_SEARCH);
                searchBtn.addActionListener(this);
@@ -96,15 +103,17 @@
 
                setLayout(new FormLayout(
                                "4dlu, pref, 2dlu, fill:pref:grow, 4dlu, pref, 
4dlu, pref, 4dlu",
-                               "4dlu, pref, 4dlu, pref, 4dlu, fill:pref:grow, 
4dlu"
+                               "4dlu, pref, 4dlu, pref, 4dlu, pref, 4dlu, 
fill:pref:grow, 4dlu"
                ));
                CellConstraints cc = new CellConstraints();
-               add(new JLabel("Database:"), cc.xy(2, 2));
-               add(databaseCombo, cc.xy(4, 2));
-               add(new JLabel("Search:"), cc.xy(2, 4));
-               add(searchText, cc.xy(4, 4));
-               add(searchBtn, cc.xy(8, 4));
-               add(new JScrollPane(resultTable), cc.xyw(2, 6, 7));
+               add(new JLabel("Web Server:"), cc.xy(2, 2));
+               add(webServiceText, cc.xy(4, 2));
+               add(new JLabel("Database:"), cc.xy(2, 4));
+               add(databaseCombo, cc.xy(4, 4));
+               add(new JLabel("Search:"), cc.xy(2, 6));
+               add(searchText, cc.xy(4, 6));
+               add(searchBtn, cc.xy(8, 6));
+               add(new JScrollPane(resultTable), cc.xyw(2, 8, 7));
        }
 
        protected void resetDatabases() {
@@ -159,6 +168,15 @@
                } else if (ACTION_SET_DATABASE.equals(action)) {
                        defaultDatabase = (Database) 
databaseCombo.getSelectedItem();
                        Database.setDefaultDatabase(defaultDatabase);
+               } else if (ACTION_SET_WEBSERVICE.equals(action)) {
+                       String url = webServiceText.getText();
+                       if (url == null || url.length() == 0)
+                               url = BioCycPlugin.DEFAULT_URL;
+                       BioCycPlugin.setProp(BioCycPlugin.WEBSERVICE_URL, url);
+                       client.getStub();
+                       // Now, update the text again
+                       webServiceText.setText(url);
+                       resetDatabases();
                }
        }
 
@@ -225,4 +243,5 @@
 
        private static final String ACTION_SEARCH = "Search";
        private static final String ACTION_SET_DATABASE = "Set Database";
+       private static final String ACTION_SET_WEBSERVICE = "Set Web Service 
URL";
 }

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