Author: rodche
Date: 2012-02-21 08:09:56 -0800 (Tue, 21 Feb 2012)
New Revision: 28326

Removed:
   
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/filters/DataSourceFilter.java
Modified:
   csplugins/trunk/toronto/rodche/cpathsquared-impl/pom.xml
   
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/InteractionBundlePanel.java
   
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/JListWithToolTips.java
   
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/RecordList.java
   
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SearchHitsPanel.java
Log:
Removing the datasource filter stuff from the interactions panel (both organism 
and datasource filters are now to be set before search results are returned - 
TODO)

Modified: csplugins/trunk/toronto/rodche/cpathsquared-impl/pom.xml
===================================================================
--- csplugins/trunk/toronto/rodche/cpathsquared-impl/pom.xml    2012-02-20 
21:48:53 UTC (rev 28325)
+++ csplugins/trunk/toronto/rodche/cpathsquared-impl/pom.xml    2012-02-21 
16:09:56 UTC (rev 28326)
@@ -81,7 +81,7 @@
         <dependency>
                <groupId>pathwaycommons.cpath</groupId>
                <artifactId>cpath-api</artifactId>
-               <version>5.0.0-SNAPSHOT</version>
+               <version>5.1.0-SNAPSHOT</version>
         </dependency>
         <dependency>
                <groupId>pathwaycommons.cpath</groupId>

Deleted: 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/filters/DataSourceFilter.java
===================================================================
--- 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/filters/DataSourceFilter.java
    2012-02-20 21:48:53 UTC (rev 28325)
+++ 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/filters/DataSourceFilter.java
    2012-02-21 16:09:56 UTC (rev 28326)
@@ -1,46 +0,0 @@
-package org.cytoscape.cpathsquared.internal.filters;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import cpath.service.jaxb.SearchHit;
-
-/**
- * Data Source Filter.
- *
- * @author Ethan Cerami, Igor Rodchenkov
- */
-public class DataSourceFilter implements Filter {
-    private final Set<String> dataSourceSet;
-
-    /**
-     * Constructor.
-     *
-     * @param dataSourceSet Set of Data Sources we want to keep.
-     */
-    public DataSourceFilter(Set<String> dataSourceSet) {
-        this.dataSourceSet = dataSourceSet;
-    }
-
-    /**
-     * Filters the record list.  Those items which pass the filter
-     * are included in the returned list.
-     *
-     * @param recordList
-     * @return
-     */
-    public List<SearchHit> filter(List<SearchHit> recordList) {
-        ArrayList<SearchHit> passedList = new ArrayList<SearchHit>();
-        for (SearchHit record : recordList) {
-            List<String> dataSources = record.getDataSource();
-            if (dataSources != null && !dataSources.isEmpty()) {
-               dataSources.retainAll(dataSourceSet); // intersection
-                if (!dataSources.isEmpty()) {
-                    passedList.add(record);
-                }
-           }
-        }
-        return passedList;
-    }
-}

Modified: 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/InteractionBundlePanel.java
===================================================================
--- 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/InteractionBundlePanel.java
 2012-02-20 21:48:53 UTC (rev 28325)
+++ 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/InteractionBundlePanel.java
 2012-02-21 16:09:56 UTC (rev 28326)
@@ -29,7 +29,6 @@
 
 import org.cytoscape.cpathsquared.internal.CPath2Factory;
 import org.cytoscape.cpathsquared.internal.filters.ChainedFilter;
-import org.cytoscape.cpathsquared.internal.filters.DataSourceFilter;
 import org.cytoscape.cpathsquared.internal.filters.EntityTypeFilter;
 
 import cpath.service.jaxb.SearchHit;
@@ -42,7 +41,6 @@
 public class InteractionBundlePanel extends JPanel {
     private JLabel matchingInteractionsLabel;
     private InteractionBundleModel interactionBundleModel;
-    private CheckNode dataSourceFilter;
     private CheckNode interactionTypeFilter;
     private JButton retrieveButton;
     private JTreeWithCheckNodes tree;
@@ -98,12 +96,9 @@
      */
     public void expandAllNodes() {
         filterPanel.setCollapsed(false);
-        dataSourceFilter.setSelected(true);
         interactionTypeFilter.setSelected(true);
-        TreePath path = new TreePath(dataSourceFilter.getPath());
+        TreePath path = new TreePath(interactionTypeFilter.getPath());
         tree.expandPath(path);
-        path = new TreePath(interactionTypeFilter.getPath());
-        tree.expandPath(path);
     }
 
     private void addObserver(final InteractionBundleModel 
interactionBundleModel,
@@ -123,15 +118,9 @@
                     retrieveButton.setVisible(true);
                 }
 
-                TreeMap<String, Integer> dataSourceMap = 
recordList.getDataSourceMap();
                 TreeMap<String, Integer> entityTypeMap = 
recordList.getEntityTypeMap();
 
                 //  Store current expansion states
-                boolean dataSourceFilterExpanded = false;
-                if (dataSourceFilter != null) {
-                    TreePath path = new TreePath(dataSourceFilter.getPath());
-                    dataSourceFilterExpanded = tree.isExpanded(path);
-                }
                 boolean interactionTypeFilterExpanded = false;
                 if (interactionTypeFilter != null) {
                     TreePath path = new 
TreePath(interactionTypeFilter.getPath());
@@ -141,20 +130,7 @@
                 //  Remove all children
                 rootNode.removeAllChildren();
 
-                //  Create Data Source Filter
-                if (dataSourceMap.size() > 0) {
-                    dataSourceFilter = new CheckNode("Filter by Data Source");
-                    rootNode.add(dataSourceFilter);
-                    for (String key : dataSourceMap.keySet()) {
-                        CategoryCount categoryCount = new CategoryCount(key,
-                                dataSourceMap.get(key));
-                        CheckNode dataSourceNode = new 
CheckNode(categoryCount, false, true);
-                        dataSourceFilter.add(dataSourceNode);
-                    }
-                    dataSourceFilter.setSelected(true);
-                }
-
-                //  Create Entity Type Filter
+                 //  Create Entity Type Filter
                 if (entityTypeMap.size() > 0) {
                     interactionTypeFilter = new CheckNode("Filter by 
Interaction Type");
                     rootNode.add(interactionTypeFilter);
@@ -201,10 +177,6 @@
                 });
 
                 //  Restore expansion state.
-                if (dataSourceFilterExpanded) {
-                    TreePath path = new TreePath(dataSourceFilter.getPath());
-                    tree.expandPath(path);
-                }
                 if (interactionTypeFilterExpanded) {
                     TreePath path = new 
TreePath(interactionTypeFilter.getPath());
                     tree.expandPath(path);
@@ -241,30 +213,23 @@
     }
 
     private List<SearchHit> executeFilter() {
-        Set<String> dataSourceSet = new HashSet<String>();
         Set<String> entityTypeSet = new HashSet<String>();
-        int childCount = dataSourceFilter.getChildCount();
-        for (int i = 0; i < childCount; i++) {
-            CheckNode checkNode = (CheckNode) dataSourceFilter.getChildAt(i);
-            CategoryCount categoryCount = (CategoryCount) 
checkNode.getUserObject();
-            String dataSource = categoryCount.getCategoryName();
-            if (checkNode.isSelected()) {
-                dataSourceSet.add(dataSource);
-            }
-        }
-        childCount = interactionTypeFilter.getChildCount();
-        for (int i = 0; i < childCount; i++) {
-            CheckNode checkNode = (CheckNode) 
interactionTypeFilter.getChildAt(i);
-            CategoryCount categoryCount = (CategoryCount) 
checkNode.getUserObject();
-            String entityType = categoryCount.getCategoryName();
-            if (checkNode.isSelected()) {
-                entityTypeSet.add(entityType);
-            }
-        }
+        
+               if (interactionTypeFilter != null) {
+                       int childCount = interactionTypeFilter.getChildCount();
+                       for (int i = 0; i < childCount; i++) {
+                               CheckNode checkNode = (CheckNode) 
interactionTypeFilter
+                                               .getChildAt(i);
+                               CategoryCount categoryCount = (CategoryCount) 
checkNode
+                                               .getUserObject();
+                               String entityType = 
categoryCount.getCategoryName();
+                               if (checkNode.isSelected()) {
+                                       entityTypeSet.add(entityType);
+                               }
+                       }
+               }
         ChainedFilter chainedFilter = new ChainedFilter();
-        DataSourceFilter dataSourceFilter = new 
DataSourceFilter(dataSourceSet);
         EntityTypeFilter entityTypeFilter = new 
EntityTypeFilter(entityTypeSet);
-        chainedFilter.addFilter(dataSourceFilter);
         chainedFilter.addFilter(entityTypeFilter);
         List<SearchHit> passedRecordList;
         try {

Modified: 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/JListWithToolTips.java
===================================================================
--- 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/JListWithToolTips.java
      2012-02-20 21:48:53 UTC (rev 28325)
+++ 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/JListWithToolTips.java
      2012-02-21 16:09:56 UTC (rev 28326)
@@ -43,16 +43,6 @@
                                html.append(organisms.toString());
                        }
 
-                       // TODO Next, add synonyms
-//                     for (String synonym : synList) {
-//                             if (!synonym.equalsIgnoreCase(record.getName()))
-//                                     synBuffer.append("- " + synonym + 
"<BR>");
-//                     }
-//                     if (synBuffer.length() > 0) {
-//                             html.append("<BR><BR>");
-//                             html.append(synBuffer.toString());
-//                     }
-
                        html.append("</td></tr></table>");
                        html.append("</html>");
                        return html.toString();

Modified: 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/RecordList.java
===================================================================
--- 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/RecordList.java
     2012-02-20 21:48:53 UTC (rev 28325)
+++ 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/RecordList.java
     2012-02-21 16:09:56 UTC (rev 28326)
@@ -14,7 +14,6 @@
  */
 public class RecordList {
     private SearchResponse response;
-    TreeMap<String, Integer> dataSourceMap = new TreeMap<String, Integer>();
     TreeMap<String, Integer> interactionTypeMap = new TreeMap<String, 
Integer>();
 
     /**
@@ -46,13 +45,6 @@
         return response;
     }
 
-    /**
-     * Gets catalog of data sources.
-     * @return Map<Data Source Name, # Records>
-     */
-    public TreeMap<String, Integer> getDataSourceMap() {
-        return dataSourceMap;
-    }
 
     /**
      * Gets catalog of entity sources.
@@ -66,25 +58,12 @@
         List<SearchHit> recordList = response.getSearchHit();
         if (recordList != null) {
             for (SearchHit record:  recordList) {
-                catalogDataSource(record.getDataSource());
                 catalogInteractionType(record);
                 //  TODO:  additional catalogs, as needed.
             }
         }
     }
 
-    private void catalogDataSource(List<String> dataSources) {
-               for (String name : dataSources) {
-                       Integer count = dataSourceMap.get(name);
-                       if (count != null) {
-                               count = count + 1;
-                       } else {
-                               count = 1;
-                       }
-                       dataSourceMap.put(name, count);
-               }
-    }
-
     private void catalogInteractionType(SearchHit record) {
         String type = record.getBiopaxClass();
         Integer count = interactionTypeMap.get(type);

Modified: 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SearchHitsPanel.java
===================================================================
--- 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SearchHitsPanel.java
        2012-02-20 21:48:53 UTC (rev 28325)
+++ 
csplugins/trunk/toronto/rodche/cpathsquared-impl/src/main/java/org/cytoscape/cpathsquared/internal/view/SearchHitsPanel.java
        2012-02-21 16:09:56 UTC (rev 28326)
@@ -147,7 +147,7 @@
             peListModel.setSize(searchHits.size());
             int i = 0;
             for (SearchHit searchHit : searchHits) {
-                peListModel.setElementAt(searchHit.toString(), i++);
+                peListModel.setElementAt(searchHit, i++);
             }
         } else {
             SwingUtilities.invokeLater(new Runnable(){

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