Author: rodche
Date: 2012-05-24 14:13:30 -0700 (Thu, 24 May 2012)
New Revision: 29345

Removed:
   
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml-legacy
   
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/resources/META-INF/spring/bundle-context.xml-legacy
Modified:
   csplugins/trunk/toronto/rodche/cpathsquared-impl/pom.xml
   
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/CPath2.java
   
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/FilterBoxItem.java
   
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SearchQueryPanel.java
   
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SearchResultsPanel.java
   
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SelectEntity.java
Log:
now dynamically generates lists of available data sources and organisms (for 
filtering); lists contain names, are sorted, multi-select, and with checkboxes 
(actual filter values will be set to corresponding taxonomy or Provenance URIs)

Modified: csplugins/trunk/toronto/rodche/cpathsquared-impl/pom.xml
===================================================================
--- csplugins/trunk/toronto/rodche/cpathsquared-impl/pom.xml    2012-05-24 
20:55:50 UTC (rev 29344)
+++ csplugins/trunk/toronto/rodche/cpathsquared-impl/pom.xml    2012-05-24 
21:13:30 UTC (rev 29345)
@@ -7,6 +7,8 @@
                
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
                
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
                
<bundle.symbolicName>org.cytoscape.cpathsquared-impl</bundle.symbolicName>
+               <cytoscape.version>3.0.0-beta1</cytoscape.version>
+               <spring.version>3.0.5.RELEASE</spring.version>
        </properties>
        <modelVersion>4.0.0</modelVersion>
        <artifactId>cpathsquared-impl</artifactId>
@@ -121,68 +123,65 @@
        </repositories>
 
 
-
-
-
        <dependencies>
                <dependency>
                        <groupId>org.cytoscape</groupId>
                        <artifactId>model-api</artifactId>
-                       <version>[3.0.0-alpha8-SNAPSHOT, 4.0.0)</version>
+                       <version>[${cytoscape.version}, 4.0.0)</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.cytoscape</groupId>
                        <artifactId>io-api</artifactId>
-                       <version>[3.0.0-alpha8-SNAPSHOT, 4.0.0)</version>
+                       <version>[${cytoscape.version}, 4.0.0)</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.cytoscape</groupId>
                        <artifactId>viewmodel-api</artifactId>
-                       <version>[3.0.0-alpha8-SNAPSHOT, 4.0.0)</version>
+                       <version>[${cytoscape.version}, 4.0.0)</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.cytoscape</groupId>
                        <artifactId>layout-api</artifactId>
-                       <version>[3.0.0-alpha8-SNAPSHOT, 4.0.0)</version>
+                       <version>[${cytoscape.version}, 4.0.0)</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.cytoscape</groupId>
                        <artifactId>presentation-api</artifactId>
-                       <version>[3.0.0-alpha8-SNAPSHOT, 4.0.0)</version>
+                       <version>[${cytoscape.version}, 4.0.0)</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.cytoscape</groupId>
                        <artifactId>swing-util-api</artifactId>
-                       <version>[3.0.0-alpha8-SNAPSHOT, 4.0.0)</version>
+                       <version>[${cytoscape.version}, 4.0.0)</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.cytoscape</groupId>
                        <artifactId>swing-application-api</artifactId>
-                       <version>[3.0.0-alpha8-SNAPSHOT, 4.0.0)</version>
+                       <version>[${cytoscape.version}, 4.0.0)</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.cytoscape</groupId>
                        <artifactId>vizmap-api</artifactId>
-                       <version>[3.0.0-alpha8-SNAPSHOT, 4.0.0)</version>
+                       <version>[${cytoscape.version}, 4.0.0)</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.cytoscape</groupId>
                        <artifactId>webservice-swing-api</artifactId>
-                       <version>[3.0.0-alpha8-SNAPSHOT, 4.0.0)</version>
+                       <version>[${cytoscape.version}, 4.0.0)</version>
                        <scope>provided</scope>
                </dependency>
                <dependency>
                        <groupId>org.ops4j.pax.logging</groupId>
                        <artifactId>pax-logging-api</artifactId>
-                       <version>1.5.2</version>
+                       <version>[1.5.2, 2.0.0)</version>
                        <scope>provided</scope>
                </dependency>
 
@@ -194,7 +193,7 @@
                <dependency>
                        <groupId>pathwaycommons.cpath</groupId>
                        <artifactId>cpath-client</artifactId>
-                       <version>3.1.0-SNAPSHOT</version>
+                       <version>3.2.0-SNAPSHOT</version>
                </dependency>
                <dependency>
                        <groupId>org.biopax.paxtools</groupId>
@@ -211,31 +210,31 @@
                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-context</artifactId>
-                       <version>3.0.5.RELEASE</version>
+                       <version>${spring.version}</version>
                        <scope>runtime</scope>
                </dependency>
                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-core</artifactId>
-                       <version>3.0.5.RELEASE</version>
+                       <version>${spring.version}</version>
                        <scope>runtime</scope>
                </dependency>
                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-oxm</artifactId>
-                       <version>3.0.5.RELEASE</version>
+                       <version>${spring.version}</version>
                        <scope>runtime</scope>
                </dependency>
                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-web</artifactId>
-                       <version>3.0.5.RELEASE</version>
+                       <version>${spring.version}</version>
                        <scope>runtime</scope>
                </dependency>
                <dependency>
                        <groupId>org.springframework</groupId>
                        <artifactId>spring-beans</artifactId>
-                       <version>3.0.5.RELEASE</version>
+                       <version>${spring.version}</version>
                        <scope>runtime</scope>
                </dependency>
        </dependencies>

Modified: 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/CPath2.java
===================================================================
--- 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/CPath2.java
      2012-05-24 20:55:50 UTC (rev 29344)
+++ 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/CPath2.java
      2012-05-24 21:13:30 UTC (rev 29345)
@@ -3,7 +3,7 @@
 import java.io.ByteArrayOutputStream;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.List;
+import java.util.Map;
 import java.util.Set;
 
 import org.biopax.paxtools.model.Model;
@@ -54,15 +54,16 @@
             listener.searchInitiated(keyword, organism, datasource);
         }
 
-        CPath2Client client = CPath2Client.newInstance();
-        client.setEndPointURL("http://awabi.cbio.mskcc.org/cpath2/";);
+        CPath2Client client = newClient();
        if(LOGGER.isDebugEnabled())
                LOGGER.debug("cPath2Url=" + client.getEndPointURL());
        
         if(organism != null)
                client.setOrganisms(organism);
         
-        client.setType("Entity"); //TODO make sure: we want Entity type hits 
only, because UtilityClass elements can be retrieved via sub-queries 
+        //TODO design choice: search for interactions right away (cpath2 cool! 
index allows it) vs. get physical entities first (then get processes...)
+//        client.setType("PhysicalEntity");
+        client.setType("Interaction");
         
         if(datasource != null)
                client.setDataSources(datasource);
@@ -76,8 +77,14 @@
                        return res;
     }
 
+    private static CPath2Client newClient() {
+        CPath2Client client = CPath2Client.newInstance();
+//        client.setEndPointURL("http://localhost:8080/cpath-web-service/";);
+        client.setEndPointURL("http://awabi.cbio.mskcc.org/cpath2/";);
+               return client;
+       }
 
-    /**
+       /**
      * Gets One or more records by Primary ID.
      * @param ids               Array of URIs.
      * @param format            Output format. TODO
@@ -87,10 +94,8 @@
      */
     public static String getRecordsByIds(String[] ids, OutputFormat format) 
     {
-       CPath2Client client = CPath2Client.newInstance();
-        
        //TODO client must return other formats, if requested
-       Model res = client.get(Arrays.asList(ids));
+       Model res = newClient().get(Arrays.asList(ids));
                
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BioPaxUtil.getBiopaxIO().convertToOWL(res, baos);
@@ -99,15 +104,13 @@
     }
 
 
-    //TODO
-    public static List<String> getOrganisms() {
-        throw new UnsupportedOperationException("Not implemented.");
+    public static Map<String, String> getAvailableOrganisms() {
+        return newClient().getValidOrganisms();
     }
 
     
-    //TODO
-    public static List<String> getDataSources() {
-        throw new UnsupportedOperationException("Not implemented.");
+    public static Map<String, String> getLoadedDataSources() {
+        return newClient().getValidDataSources();
     }
     
     
@@ -141,7 +144,6 @@
 
        public static SearchResponse topPathways(String keyword, Set<String> 
organism,
                        Set<String> datasource) {
-               // TODO Auto-generated method stub
-               return null;
+               return newClient().getTopPathways();
        }
 }

Modified: 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/FilterBoxItem.java
===================================================================
--- 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/FilterBoxItem.java
  2012-05-24 20:55:50 UTC (rev 29344)
+++ 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/FilterBoxItem.java
  2012-05-24 21:13:30 UTC (rev 29345)
@@ -1,7 +1,7 @@
 package org.cytoscape.cpathsquared.internal.view;
 
 
-public class FilterBoxItem {
+public class FilterBoxItem implements Comparable<FilterBoxItem> {
     private String name;
     private String value;
 
@@ -23,4 +23,11 @@
     public String toString() {
         return name;
     }
+
+
+    //in order to order by name
+       @Override
+       public int compareTo(FilterBoxItem o) {
+               return this.name.compareTo(o.getName());
+       }
 }

Modified: 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SearchQueryPanel.java
===================================================================
--- 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SearchQueryPanel.java
       2012-05-24 20:55:50 UTC (rev 29344)
+++ 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SearchQueryPanel.java
       2012-05-24 21:13:30 UTC (rev 29345)
@@ -10,19 +10,15 @@
 import java.awt.event.FocusEvent;
 import java.awt.event.KeyAdapter;
 import java.awt.event.KeyEvent;
-import java.net.URL;
-import java.util.HashSet;
-import java.util.Set;
 
+import javax.swing.AbstractListModel;
 import javax.swing.BorderFactory;
 import javax.swing.Box;
 import javax.swing.BoxLayout;
 import javax.swing.DefaultListModel;
-import javax.swing.ImageIcon;
 import javax.swing.JButton;
 import javax.swing.JComponent;
 import javax.swing.JEditorPane;
-import javax.swing.JList;
 import javax.swing.JOptionPane;
 import javax.swing.JPanel;
 import javax.swing.JScrollPane;
@@ -31,30 +27,32 @@
 import javax.swing.event.HyperlinkEvent;
 import javax.swing.event.HyperlinkListener;
 
+import org.cytoscape.cpathsquared.internal.CPath2;
 import org.cytoscape.cpathsquared.internal.CPath2Factory;
 import org.cytoscape.cpathsquared.internal.task.ExecuteSearchTask;
 import org.cytoscape.cpathsquared.internal.task.ResultHandler;
+import org.cytoscape.util.swing.CheckBoxJList;
 import org.cytoscape.work.TaskFactory;
 
+import java.util.*;
 
 /**
  * Search Box Panel.
  *
  */
 public class SearchQueryPanel extends JPanel {
-    private JButton searchButton;
     private static final String ENTER_TEXT = "Enter Gene Name or ID";
-    private final JList organismBox;
-    private final JList dataSourceBox;
+    private final CheckBoxJList organismList;
+    private final CheckBoxJList dataSourceList;
     private final JTextField searchField;
        
     /**
      * Constructor.
      */
     public SearchQueryPanel() {  
-       this.organismBox = new JList();
-       this.dataSourceBox = new JList();
-       this.searchField = createSearchField();        
+       this.organismList = new CheckBoxJList();
+       this.dataSourceList = new CheckBoxJList();
+       this.searchField = createSearchField();
        
         GradientHeader header = new GradientHeader("Search");
         header.setAlignmentX(Component.LEFT_ALIGNMENT);
@@ -63,19 +61,22 @@
         add(header);
         add(Box.createVerticalStrut(5));
 
-        JPanel centerPanel = new JPanel();
-        BoxLayout boxLayoutMain = new BoxLayout(centerPanel, BoxLayout.X_AXIS);
-        centerPanel.setLayout(boxLayoutMain);
-        centerPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
+        JPanel queryPanel = new JPanel();
+        queryPanel.setLayout(new BoxLayout(queryPanel, BoxLayout.Y_AXIS));
+        queryPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
+        queryPanel.setAlignmentY(Component.TOP_ALIGNMENT);
         
+        JPanel queryFiltersPanel = new JPanel();
+        queryFiltersPanel.setLayout(new BoxLayout(queryFiltersPanel, 
BoxLayout.X_AXIS));
+        queryFiltersPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
+        queryFiltersPanel.setAlignmentY(Component.TOP_ALIGNMENT);
+        
         // create query field, examples/label, and button
-        URL url = GradientHeader.class.getResource("resources/run_tool.gif");
-        ImageIcon icon = new ImageIcon(url);
-        searchButton = new JButton("Search");
+        JButton searchButton = new JButton("Search");
         searchButton.setToolTipText("Execute Search");
         searchButton.addActionListener(new ActionListener() {
             public void actionPerformed(ActionEvent actionEvent) {
-                executeSearch(searchField.getText(), 
organismBox.getSelectedValues(), dataSourceBox.getSelectedValues());
+                executeSearch(searchField.getText(), 
organismList.getSelectedValues(), dataSourceList.getSelectedValues());
             }
         });
         searchButton.setAlignmentX(Component.LEFT_ALIGNMENT);
@@ -84,8 +85,10 @@
         searchField.setBorder 
(BorderFactory.createCompoundBorder(searchField.getBorder(),
                 pulsatingBorder));
         searchField.setAlignmentX(Component.LEFT_ALIGNMENT);
+        searchField.setMaximumSize(new Dimension(1000, 100));
         
-        JEditorPane label = new JEditorPane ("text/html", "Examples:  <a 
href='TP53'>TP53</a>, " +
+        JEditorPane label = new JEditorPane (
+                       "text/html", "Examples:  <a href='TP53'>TP53</a>, " +
                 "<a href='BRCA1'>BRCA1</a>, or <a href='SRY'>SRY</a>.");
         label.setEditable(false);
         label.setOpaque(false);
@@ -105,57 +108,44 @@
         label.setBorder(new EmptyBorder(5,3,3,3));
         label.setAlignmentX(Component.LEFT_ALIGNMENT);       
         
-        centerPanel.add(searchField);
-        centerPanel.add(createOrganismFilterBox());
-        centerPanel.add(createDataSourceFilterBox());
-        
-        JButton clearButton = new JButton("Clear");
-        clearButton.setToolTipText("Clear");
-        clearButton.addActionListener(new ActionListener() {
-            public void actionPerformed(ActionEvent actionEvent) {
-                searchField.setText(null);
-                organismBox.clearSelection();
-                dataSourceBox.clearSelection();
-            }
-        });
-        
-        centerPanel.add(clearButton);
-        centerPanel.add(searchButton);
-
-        add(centerPanel);
-        add(label);
+       queryPanel.add(searchField); 
+       queryPanel.add(label);
+       queryPanel.add(searchButton);
+       queryFiltersPanel.add(queryPanel);
+       queryFiltersPanel.add(createOrganismFilterBox());
+       queryFiltersPanel.add(createDataSourceFilterBox());
+       
+        add(queryFiltersPanel);
     }
 
 
-    private final JComponent createOrganismFilterBox() {
-       //TODO fill the lists dynamically (from the web service)
-       DefaultListModel organismBoxModel = new DefaultListModel();
-       organismBoxModel.addElement(new FilterBoxItem("Human", 
"urn:miriam:taxonomy:9606"));
-        organismBoxModel.addElement(new FilterBoxItem("Mouse", 
"urn:miriam:taxonomy:10090"));
-        organismBoxModel.addElement(new FilterBoxItem("Rat", 
"urn:miriam:taxonomy:10116"));
-        organismBoxModel.addElement(new FilterBoxItem("S. cerevisiae", 
"urn:miriam:taxonomy:4932"));
-       organismBox.setModel(organismBoxModel);
-        organismBox.setToolTipText("Select Organisms");
-        organismBox.setMaximumSize(new Dimension(200, 9999));
-        organismBox.setAlignmentX(Component.LEFT_ALIGNMENT);
-        JScrollPane scroll = new JScrollPane(organismBox);
-        scroll.setSize(100, 100);
+    private final JComponent createOrganismFilterBox() {       
+       SortedJListModel<FilterBoxItem> model = new 
SortedJListModel<FilterBoxItem>();
+       Map<String,String> map = CPath2.getAvailableOrganisms();
+       for(String o : map.keySet()) {
+               model.addElement(new FilterBoxItem(map.get(o), o));
+       }
+       organismList.setModel(model);
+        organismList.setToolTipText("Select Organisms");
+        organismList.setAlignmentX(Component.LEFT_ALIGNMENT);
+        JScrollPane scroll = new JScrollPane(organismList, 
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
         
         return scroll;
     }
     
     private final JComponent createDataSourceFilterBox() {
-        //TODO fill the lists dynamically (from the web service)
         DefaultListModel dataSourceBoxModel = new DefaultListModel();
-        dataSourceBoxModel.addElement(new FilterBoxItem("Reactome", 
"urn:miriam:reactome"));
-        dataSourceBoxModel.addElement(new FilterBoxItem("NCI_Nature Curated", 
"urn:miriam:pid.pathway"));
-        dataSourceBox.setModel(dataSourceBoxModel);
-        dataSourceBox.setToolTipText("Select Datasources");
-        dataSourceBox.setMaximumSize(new Dimension(200, 9999));
-        dataSourceBox.setAlignmentX(Component.LEFT_ALIGNMENT);
-        JScrollPane scroll = new JScrollPane(dataSourceBox);
-        scroll.setSize(100, 100);
         
+        Map<String,String> map = CPath2.getLoadedDataSources();
+       for(String d : map.keySet()) {
+               dataSourceBoxModel.addElement(new FilterBoxItem(map.get(d), d));
+       }
+        
+        dataSourceList.setModel(dataSourceBoxModel);
+        dataSourceList.setToolTipText("Select Datasources");
+        dataSourceList.setAlignmentX(Component.LEFT_ALIGNMENT);
+        JScrollPane scroll = new JScrollPane(dataSourceList, 
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+        
         return scroll;
     }
     
@@ -183,7 +173,7 @@
                 int keyCode = e.getKeyCode();
                 if (keyCode == 10) {
                     executeSearch(searchField.getText(), 
-                               organismBox.getSelectedValues(), 
dataSourceBox.getSelectedValues());
+                               organismList.getSelectedValues(), 
dataSourceList.getSelectedValues());
                 }
             }
         });
@@ -224,12 +214,63 @@
             
CPath2Factory.getTaskManager().execute(search.createTaskIterator());
         }
     }
+   
+    static class SortedJListModel<E> extends AbstractListModel {
+               SortedSet<E> items;
 
-    
-    /**
-     * Initializes Focus to the Search Button.
-     */
-    public final void initFocus() {
-        searchButton.requestFocusInWindow();
-    }
+               public SortedJListModel() {
+                       super();
+                       items = new TreeSet<E>();
+               }
+
+               @Override
+               public Object getElementAt(int index) {
+                       return items.toArray()[index];
+               }
+
+               @Override
+               public int getSize() {
+                       return items.size();
+               }
+               
+               public void addAll(Object elements[]) {
+                   Collection c = Arrays.asList(elements);
+                   items.addAll(c);
+                   fireContentsChanged(this, 0, getSize());
+               }
+               
+               public void addElement(E o) {
+                       items.add(o);
+                       fireContentsChanged(this, 0, getSize());
+               }
+               
+               public boolean removeElement(Object element) {
+                       boolean removed = items.remove(element);
+                       if (removed) {
+                               fireContentsChanged(this, 0, getSize());
+                       }
+                       return removed;
+               }
+
+               public void clear() {
+                       items.clear();
+                       fireContentsChanged(this, 0, getSize());
+               }
+
+               public boolean contains(Object element) {
+                       return items.contains(element);
+               }
+
+               public Object firstElement() {
+                       return items.first();
+               }
+
+               public Iterator iterator() {
+                       return items.iterator();
+               }
+
+               public Object lastElement() {
+                       return items.last();
+               }
+       }
 }

Modified: 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SearchResultsPanel.java
===================================================================
--- 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SearchResultsPanel.java
     2012-05-24 20:55:50 UTC (rev 29344)
+++ 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SearchResultsPanel.java
     2012-05-24 21:13:30 UTC (rev 29345)
@@ -85,7 +85,7 @@
         header.setAlignmentX(Component.LEFT_ALIGNMENT);
         hitListPane.add(header, BorderLayout.NORTH);
         JSplitPane internalPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT, 
hitListScrollPane, detailsPanel);
-        internalPanel.setDividerLocation(100);
+        internalPanel.setDividerLocation(200);
         hitListPane.add(internalPanel, BorderLayout.CENTER);
         
         //  Create search results extra filtering panel
@@ -104,7 +104,7 @@
         //  Create the Split Pane
         JSplitPane splitPane = new JSplitPane (JSplitPane.HORIZONTAL_SPLIT, 
                hitListPane, networksPanel);
-        splitPane.setDividerLocation(200);
+        splitPane.setDividerLocation(400);
         splitPane.setAlignmentX(Component.LEFT_ALIGNMENT);
         this.add(splitPane);
 
@@ -181,8 +181,7 @@
                 //  Ignore the "unselect" event.
                 if (!listSelectionEvent.getValueIsAdjusting()) {
                     if (selectedIndex >=0) {
-                        SelectEntity selectTask = new SelectEntity();
-                        selectTask.selectItem(
+                       (new SelectEntity()).selectItem(
                                        
(SearchHit)resList.getModel().getElementAt(selectedIndex),
                                 summaryDocument, summaryTextPane, 
appLayeredPane);
                     }
@@ -206,27 +205,27 @@
      * @param pathwayModel     Pathway Model.
      */
     private final void downloadPathway(int[] rows, DefaultTableModel model) {
-        try {
-               SearchHit hit = (SearchHit) model.getDataVector().get(rows[0]);
-               String internalId = hit.getUri();
-            String title = model.getValueAt(rows[0], 0)
-                    + " (" + model.getValueAt(rows[0], 1) + ")";
+       if(rows.length < 1) {
+               return;
+       }
+       
+        int i= rows[0];
+       SearchHit hit = (SearchHit) model.getDataVector().get(i);
+        String internalId = hit.getUri();
+        String title = model.getValueAt(i, 0)
+               + " (" + model.getValueAt(i, 1) + ")";
 
-            OutputFormat format;
-            //TODO add EXTENDED_BINARY_SIF
-            if (CPath2Properties.downloadMode == 
CPath2Properties.DOWNLOAD_BIOPAX) {
-                format = OutputFormat.BIOPAX;
-            } else {
-                format = OutputFormat.BINARY_SIF;
-            }
-
-            TaskFactory taskFactory = CPath2Factory.newTaskFactory(new 
ExecuteGetRecordByCPathIdTask(
-                       new String[]{internalId}, format, title));
-            
CPath2Factory.getTaskManager().execute(taskFactory.createTaskIterator());
-            
-        } catch (IndexOutOfBoundsException e) {
-            //  Ignore TODO strange...
+        OutputFormat format;
+        //TODO add EXTENDED_BINARY_SIF
+        if (CPath2Properties.downloadMode == CPath2Properties.DOWNLOAD_BIOPAX) 
{
+               format = OutputFormat.BIOPAX;
+        } else {
+            format = OutputFormat.BINARY_SIF;
         }
+
+        TaskFactory taskFactory = CPath2Factory.newTaskFactory(new 
ExecuteGetRecordByCPathIdTask(
+               new String[]{internalId}, format, title));
+        
CPath2Factory.getTaskManager().execute(taskFactory.createTaskIterator());
     }
     
 }
\ No newline at end of file

Modified: 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SelectEntity.java
===================================================================
--- 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SelectEntity.java
   2012-05-24 20:55:50 UTC (rev 29344)
+++ 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SelectEntity.java
   2012-05-24 21:13:30 UTC (rev 29345)
@@ -24,7 +24,8 @@
             StringBuffer html = new StringBuffer();
             html.append("<html>");
 
-            html.append ("<h2>" + item.getName() + "</h2>");
+            if(item.getName() != null)
+               html.append ("<h2>" + item.getName() + "</h2>");
             html.append ("<h3>Class: " + item.getBiopaxClass() + "</h3>");
             html.append ("<h3>URI: " + item.getUri() + "</h3>");
 

Deleted: 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml-legacy
===================================================================
--- 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml-legacy
  2012-05-24 20:55:50 UTC (rev 29344)
+++ 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/resources/META-INF/spring/bundle-context-osgi.xml-legacy
  2012-05-24 21:13:30 UTC (rev 29345)
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans";
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:osgi="http://www.springframework.org/schema/osgi";
-       xsi:schemaLocation="http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-                      http://www.springframework.org/schema/osgi 
http://www.springframework.org/schema/osgi/spring-osgi-1.0.xsd";
-       default-lazy-init="false">
-
-
-       <!-- Import services -->
-       <osgi:reference id="cySwingApplicationRef"
-               interface="org.cytoscape.application.swing.CySwingApplication" 
/>
-       
-       <osgi:reference id="taskManagerRef"
-               interface="org.cytoscape.work.TaskManager" />
-       
-       <osgi:reference id="openBrowserRef"
-               interface="org.cytoscape.util.swing.OpenBrowser" />
-               
-       <osgi:reference id="cyNetworkManagerRef"
-               interface="org.cytoscape.model.CyNetworkManager" />
-
-       <osgi:reference id="cyApplicationManagerRef"
-               interface="org.cytoscape.session.CyApplicationManager" />
-
-       <osgi:reference id="cyNetworkViewManagerRef"
-               interface="org.cytoscape.view.model.CyNetworkViewManager" />
-
-       <osgi:reference id="cyNetworkViewReaderManagerRef"
-               interface="org.cytoscape.io.read.CyNetworkReaderManager" />
-
-       <osgi:reference id="cyNetworkNamingRef"
-               interface="org.cytoscape.session.CyNetworkNaming" />
-
-       <osgi:reference id="cyNetworkFactoryRef"
-               interface="org.cytoscape.model.CyNetworkFactory" />
-
-       <osgi:reference id="cyLayoutsRef"
-               interface="org.cytoscape.view.layout.CyLayoutAlgorithmManager" 
/>
-               
-       <osgi:reference id="undoSupportRef"
-               interface="org.cytoscape.work.undo.UndoSupport" />
-
-       <osgi:reference id="bioPaxContainerRef"
-               interface="org.cytoscape.biopax.internal.BioPaxContainer" />
-       
-       <osgi:reference id="mapBioPaxToCytoscapeFactoryRef"
-               interface="org.cytoscape.biopax.internal.BioPaxMapperFactory" />
-
-       <osgi:reference id="networkListenerRef"
-               interface="org.cytoscape.biopax.internal.BioPaxViewTracker" />
-
-       <osgi:reference id="visualMappingManagerRef"
-               interface="org.cytoscape.view.vizmap.VisualMappingManager"/>
-       
-       <osgi:reference id="visualStyleFactoryRef"
-               interface="org.cytoscape.view.vizmap.VisualStyleFactory"/>
-
-       <osgi:reference id="discreteMappingFactoryRef"
-               
interface="org.cytoscape.view.vizmap.VisualMappingFunctionFactory"
-               filter="(mapping.type=discrete)"/>
-               
-       <osgi:reference id="passthroughMappingFactoryRef"
-               
interface="org.cytoscape.view.vizmap.VisualMappingFunctionFactory"
-               filter="(mapping.type=passthrough)"/>
-
-       <osgi:service ref="cPathWebService" auto-export="interfaces" />
-</beans>

Deleted: 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/resources/META-INF/spring/bundle-context.xml-legacy
===================================================================
--- 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/resources/META-INF/spring/bundle-context.xml-legacy
       2012-05-24 20:55:50 UTC (rev 29344)
+++ 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/resources/META-INF/spring/bundle-context.xml-legacy
       2012-05-24 21:13:30 UTC (rev 29345)
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<beans xmlns="http://www.springframework.org/schema/beans";
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:aop="http://www.springframework.org/schema/aop";
-       xmlns:context="http://www.springframework.org/schema/context";
-       xmlns:lang="http://www.springframework.org/schema/lang"; 
xmlns:osgi="http://www.springframework.org/schema/osgi";
-       xsi:schemaLocation="
-    http://www.springframework.org/schema/beans
-    http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
-    http://www.springframework.org/schema/aop
-    http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
-    http://www.springframework.org/schema/context
-           http://www.springframework.org/schema/context/spring-context-2.5.xsd
-           http://www.springframework.org/schema/lang 
http://www.springframework.org/schema/lang/spring-lang-2.5.xsd
-            http://www.springframework.org/schema/osgi 
http://www.springframework.org/schema/osgi/spring-osgi-1.0.xsd";
-       default-lazy-init="true">
-
-       <context:annotation-config />
-
-       <bean id="cPath2Factory" 
class="org.cytoscape.cpathsquared.internal.CPath2Factory">
-               <constructor-arg ref="cySwingApplicationRef" />
-               <constructor-arg ref="taskManagerRef" />
-               <constructor-arg ref="openBrowserRef" />
-               <constructor-arg ref="cyNetworkManagerRef" />
-               <constructor-arg ref="cyApplicationManagerRef" />
-               <constructor-arg ref="cyNetworkViewManagerRef" />
-               <constructor-arg ref="cyNetworkViewReaderManagerRef" />
-               <constructor-arg ref="cyNetworkNamingRef" />
-               <constructor-arg ref="cyNetworkFactoryRef" />
-               <constructor-arg ref="cyLayoutsRef" />
-               <constructor-arg ref="undoSupportRef" />
-               <constructor-arg ref="bioPaxContainerRef" />
-               <constructor-arg ref="mapBioPaxToCytoscapeFactoryRef" />
-               <constructor-arg ref="networkListenerRef" />
-               <constructor-arg ref="binarySifVisualStyleUtil" />
-               <constructor-arg ref="visualMappingManagerRef" />
-       </bean>
-       
-       <bean id="cPathWebService" 
class="org.cytoscape.cpathsquared.internal.CPath2CytoscapeWebService">
-               <constructor-arg ref="cPath2Factory" />
-       </bean>
-       
-       <bean id="binarySifVisualStyleUtil" 
class="org.cytoscape.cpathsquared.internal.view.BinarySifVisualStyleFactory">
-               <constructor-arg ref="visualStyleFactoryRef" />
-               <constructor-arg ref="visualMappingManagerRef" />
-               <constructor-arg ref="discreteMappingFactoryRef" />
-               <constructor-arg ref="passthroughMappingFactoryRef" />
-       </bean>
-</beans>

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