Author: kono
Date: 2011-01-24 19:22:27 -0800 (Mon, 24 Jan 2011)
New Revision: 23594

Modified:
   
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/BiomartQuery.java
   
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ImportTableTask.java
   
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartDialogTask.java
   
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUIAction.java
   
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/AttributeImportPanel.java
   
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartAttrMappingPanel.java
   
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartMainDialog.java
   
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
   
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context.xml
Log:
This version imports global table.  Need to map this table to locals by virtual 
column.

Modified: 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/BiomartQuery.java
===================================================================
--- 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/BiomartQuery.java
   2011-01-25 01:09:33 UTC (rev 23593)
+++ 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/BiomartQuery.java
   2011-01-25 03:22:27 UTC (rev 23594)
@@ -5,10 +5,12 @@
        
        private final String xmlQuery;
        private final String keyColumnName;
+       private final String tableName;
        
-       public BiomartQuery(final String xmlQuery, final String keyColumnName) {
+       public BiomartQuery(final String xmlQuery, final String keyColumnName, 
final String tableName) {
                this.keyColumnName = keyColumnName;
                this.xmlQuery = xmlQuery;
+               this.tableName = tableName;
        }
        
        public String getKeyColumnName () {
@@ -19,5 +21,9 @@
        public String getQueryString() {
                return xmlQuery;
        }
+       
+       public String getTableName() {
+               return tableName;
+       }
 
 }

Modified: 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ImportTableTask.java
===================================================================
--- 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ImportTableTask.java
   2011-01-25 01:09:33 UTC (rev 23593)
+++ 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ImportTableTask.java
   2011-01-25 03:22:27 UTC (rev 23594)
@@ -12,6 +12,7 @@
 import org.cytoscape.model.CyNetwork;
 import org.cytoscape.model.CyNetworkManager;
 import org.cytoscape.model.CyNode;
+import org.cytoscape.model.CyRow;
 import org.cytoscape.model.CyTable;
 import org.cytoscape.model.CyTableFactory;
 import org.cytoscape.work.AbstractTask;
@@ -55,8 +56,10 @@
 
                final Set<CyTable> newTables = new HashSet<CyTable>();
 
-               final CyTable table = tableFactory.createTable("Test Table 
name", key,
+               final CyTable globalTable = 
tableFactory.createTable(query.getTableName(), key,
                                String.class, true);
+               
+               newTables.add(globalTable);
 
                // Read result from reader
                String line = reader.readLine();
@@ -76,133 +79,102 @@
 
                // Search column index of the key
                for (int i = 0; i < colSize; i++) {
-                       table.createListColumn(columnNames[i], String.class);
+                       globalTable.createColumn(columnNames[i], String.class);
 
                        if (columnNames[i].equals(key))
                                keyIdx = i;
                }
+       
 
-               // byte attrDataType =
-               // Cytoscape.getNodeAttributes().getType(keyAttrName);
-               final List<String> nodeIdList = new ArrayList<String>();
+               String[] row;
+               String val;
 
-               // Prepare list of nodes FROM ALL NETWORKS.
+               List<List<Object>> listOfValList;
+               List<String> ids = null;
 
-               final Set<CyNetwork> allNetworks = manager.getNetworkSet();
+               List<Object> testList;
+               String keyVal = null;
+               int rowLength = 0;
 
-               for (final CyNetwork network : allNetworks) {
-                       final List<CyNode> nodes = network.getNodeList();
-                       for (CyNode node : nodes) {
+               int hitCount = 0;
 
+               long start = System.currentTimeMillis();
+               while ((line = reader.readLine()) != null) {
+
+                       row = line.split("\\t");
+
+                       // Ignore invalid length entry.
+                       if ((row.length <= keyIdx) || (row.length == 0))
+                               continue;
+
+                       recordCount++;
+                       keyVal = row[keyIdx];
+//
+//                     System.out.println("Key ====>" + keyVal + "<==");
+
+                       rowLength = row.length;
+
+                       for (int j = 0; j < rowLength; j++) {
+                               val = row[j];
+
+                               if ((val != null) && (val.length() != 0) && (j 
!= keyIdx)) {
+                                       listOfValList = new 
ArrayList<List<Object>>();
+
+                                       final CyRow cyRow = 
globalTable.getRow(keyVal);
+                                       cyRow.set(columnNames[j], val);
+//                                     if (keyAttrName.equals("ID")) {
+//                                             testList = attr
+//                                                             
.getListAttribute(keyVal, columnNames[j]);
+//
+//                                             if (testList != null)
+//                                                     
listOfValList.add(testList);
+//                                     } else {
+//                                             ids = 
getIdFromAttrValue(attrDataType, keyAttrName,
+//                                                             keyVal, 
nodeIdList, attr);
+//
+//                                             if (ids.size() == 0)
+//                                                     continue;
+//
+//                                             for (String id : ids)
+//                                                     
listOfValList.add(attr.getListAttribute(id,
+//                                                                     
columnNames[j]));
+//                                     }
+//
+//                                     if (listOfValList.size() == 0) {
+//                                             List<Object> valList = new 
ArrayList<Object>();
+//                                             listOfValList.add(valList);
+//                                     }
+//
+//                                     int index = 0;
+//                                     for (List<Object> valList : 
listOfValList) {
+//                                             if (valList == null)
+//                                                     valList = new 
ArrayList<Object>();
+//
+//                                             if (valList.contains(row[j]) == 
false)
+//                                                     valList.add(row[j]);
+//
+//                                             if (keyAttrName.equals("ID")) {
+//                                                     
attr.setListAttribute(keyVal, columnNames[j],
+//                                                                     
valList);
+//                                                     
attr.setAttribute(keyVal, columnNames[j] + "-TOP",
+//                                                                     
valList.get(0).toString());
+//                                             } else {
+//                                                     
attr.setListAttribute(ids.get(index),
+//                                                                     
columnNames[j], valList);
+//                                                     
attr.setAttribute(ids.get(index), columnNames[j]
+//                                                                     + 
"-TOP", valList.get(0).toString());
+//
+//                                             }
+//                                             hitCount++;
+//                                             index++;
+//                                     }
+                               }
+                               System.out.println();
                        }
                }
 
-               // String[] row;
-               // String val;
-               //
-               // List<List<Object>> listOfValList;
-               // List<String> ids = null;
-               //
-               // List<Object> testList;
-               // String keyVal = null;
-               // int rowLength = 0;
-               //
-               // int hitCount = 0;
-               //
-               // long start = System.currentTimeMillis();
-               // while ((line = reader.readLine()) != null) {
-               // // Cancel the job.
-               // if (cancelImport) {
-               // cancelImport = false;
-               // return null;
-               // }
-               //
-               // row = line.split("\\t");
-               //
-               // // Ignore invalid length entry.
-               // if ((row.length <= keyIdx) || (row.length == 0))
-               // continue;
-               //
-               // recordCount++;
-               // keyVal = row[keyIdx];
-               //
-               // // System.out.println("Key ====>" + keyVal + "<==");
-               // // for(String s: entry)
-               // // System.out.println("ENT ======>" + s + "<===");
-               // rowLength = row.length;
-               //
-               // for (int j = 0; j < rowLength; j++) {
-               // val = row[j];
-               //
-               // if ((val != null) && (val.length() != 0) && (j != keyIdx)) {
-               // listOfValList = new ArrayList<List<Object>>();
-               //
-               // if (keyAttrName.equals("ID")) {
-               // testList = attr
-               // .getListAttribute(keyVal, columnNames[j]);
-               //
-               // if (testList != null)
-               // listOfValList.add(testList);
-               // } else {
-               // ids = getIdFromAttrValue(attrDataType, keyAttrName,
-               // keyVal, nodeIdList, attr);
-               //
-               // if (ids.size() == 0)
-               // continue;
-               //
-               // for (String id : ids)
-               // listOfValList.add(attr.getListAttribute(id,
-               // columnNames[j]));
-               // }
-               //
-               // if (listOfValList.size() == 0) {
-               // List<Object> valList = new ArrayList<Object>();
-               // listOfValList.add(valList);
-               // }
-               //
-               // int index = 0;
-               // for (List<Object> valList : listOfValList) {
-               // if (valList == null)
-               // valList = new ArrayList<Object>();
-               //
-               // if (valList.contains(row[j]) == false)
-               // valList.add(row[j]);
-               //
-               // if (keyAttrName.equals("ID")) {
-               // attr.setListAttribute(keyVal, columnNames[j],
-               // valList);
-               // attr.setAttribute(keyVal, columnNames[j] + "-TOP",
-               // valList.get(0).toString());
-               // } else {
-               // attr.setListAttribute(ids.get(index),
-               // columnNames[j], valList);
-               // attr.setAttribute(ids.get(index), columnNames[j]
-               // + "-TOP", valList.get(0).toString());
-               //
-               // }
-               // hitCount++;
-               // index++;
-               // }
-               // }
-               // }
-               // }
-               //
-               // // System.out.println("Time =====> " +
-               // // (System.currentTimeMillis()-start));
-               //
-               // reader.close();
-               // reader = null;
-               //
-               // report.add("Number of Records (Rows) from BioMart = " + 
recordCount
-               // + "\n");
-               // report.add("Number of Terms Mapped = " + hitCount + "\n");
-               // report.add("The following node attributes are created:" + 
"\n");
-               // for (String s : columnNames) {
-               // report.add(s + ", " + s + "-TOP");
-               // }
-               // report.add("\nAttributes name ends with \'TOP\' contains 
first entry of the list");
-               // return report;
-
+               reader.close();
+               reader = null;
                return newTables;
        }
 

Modified: 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartDialogTask.java
===================================================================
--- 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartDialogTask.java
     2011-01-25 01:09:33 UTC (rev 23593)
+++ 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartDialogTask.java
     2011-01-25 03:22:27 UTC (rev 23594)
@@ -2,6 +2,7 @@
 
 import org.cytoscape.application.swing.CySwingApplication;
 import org.cytoscape.io.webservice.biomart.BiomartClient;
+import org.cytoscape.io.webservice.biomart.ui.BiomartAttrMappingPanel;
 import org.cytoscape.io.webservice.biomart.ui.BiomartMainDialog;
 import org.cytoscape.model.CyTableManager;
 import org.cytoscape.session.CyApplicationManager;
@@ -19,23 +20,18 @@
        private BiomartMainDialog dialog;
        
        private final BiomartClient client;
-       private final GUITaskManager taskManager;
-       private final CyApplicationManager appManager;
-       private final CyTableManager tblManager;
        private final CySwingApplication app;
        
+       private final BiomartAttrMappingPanel panel;
+       
        private final LoadRepositoryTask loadTask;
        
-       public ShowBiomartDialogTask(final BiomartClient client,
-                       final TaskManager taskManager,
-                       final CyApplicationManager appManager,
-                       final CyTableManager tblManager, final 
CySwingApplication app, final LoadRepositoryTask loadTask) {
+       public ShowBiomartDialogTask(final BiomartAttrMappingPanel panel, final 
BiomartClient client,
+                        final CySwingApplication app, final LoadRepositoryTask 
loadTask) {
                
+               this.panel = panel;
                this.app = app;
                this.client = client;
-               this.taskManager = (GUITaskManager) taskManager;
-               this.appManager = appManager;
-               this.tblManager = tblManager;
                this.loadTask = loadTask;
        }
 
@@ -43,7 +39,7 @@
        public void run(TaskMonitor taskMonitor) throws Exception {
                if(dialog == null) {
                        final LoadRepositoryResult result = 
loadTask.getResult();
-                       dialog = new BiomartMainDialog(client, taskManager, 
appManager, tblManager, app, result);
+                       dialog = new BiomartMainDialog(panel, client, result);
                        dialog.setLocationRelativeTo(app.getJFrame());
                        dialog.setVisible(true);
                        

Modified: 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUIAction.java
===================================================================
--- 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUIAction.java
      2011-01-25 01:09:33 UTC (rev 23593)
+++ 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/task/ShowBiomartGUIAction.java
      2011-01-25 03:22:27 UTC (rev 23594)
@@ -5,6 +5,7 @@
 import org.cytoscape.application.swing.AbstractCyAction;
 import org.cytoscape.application.swing.CySwingApplication;
 import org.cytoscape.io.webservice.biomart.BiomartClient;
+import org.cytoscape.io.webservice.biomart.ui.BiomartAttrMappingPanel;
 import org.cytoscape.model.CyTableManager;
 import org.cytoscape.session.CyApplicationManager;
 import org.cytoscape.work.TaskManager;
@@ -22,9 +23,6 @@
 
        private static final Logger logger = 
LoggerFactory.getLogger(ShowBiomartGUIAction.class);
 
-       private final BiomartClient client;
-       private final CyApplicationManager appManager;
-       private final CyTableManager tblManager;
        private final GUITaskManager taskManager;
        private final CySwingApplication app;
        
@@ -32,21 +30,18 @@
        
        private final LoadRepositoryTask firstTask;
 
-       public ShowBiomartGUIAction(final BiomartClient client,
+       public ShowBiomartGUIAction(final BiomartAttrMappingPanel panel, final 
BiomartClient client,
                        final TaskManager taskManager,
                        final CyApplicationManager appManager,
-                       final CyTableManager tblManager, final 
CySwingApplication app) {
+                       final CySwingApplication app) {
                super("Import Tables from Biomart...", appManager);
                setPreferredMenu("File.Import");
 
-               this.tblManager = tblManager;
-               this.appManager = appManager;
                this.app = app;
-               this.client = client;
                this.taskManager = (GUITaskManager) taskManager;
                
                this.firstTask = new LoadRepositoryTask(client.getRestClient());
-               this.showDialogTask = new ShowBiomartDialogTask(client, 
taskManager, appManager, tblManager, app, firstTask);
+               this.showDialogTask = new ShowBiomartDialogTask(panel, client, 
app, firstTask);
        }
 
        @Override

Modified: 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/AttributeImportPanel.java
===================================================================
--- 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/AttributeImportPanel.java
        2011-01-25 01:09:33 UTC (rev 23593)
+++ 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/AttributeImportPanel.java
        2011-01-25 03:22:27 UTC (rev 23594)
@@ -36,6 +36,8 @@
 
 import java.awt.Color;
 import java.awt.event.ActionEvent;
+import java.util.Map;
+import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
@@ -46,6 +48,12 @@
 import javax.swing.JPanel;
 import javax.swing.LayoutStyle;
 
+import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyNetworkManager;
+import org.cytoscape.model.CyNode;
+import org.cytoscape.model.CyTable;
+import org.cytoscape.model.CyTableEntry;
+import org.cytoscape.model.CyTableManager;
 import org.cytoscape.model.events.ColumnCreatedEvent;
 import org.cytoscape.model.events.ColumnCreatedListener;
 import org.cytoscape.model.events.ColumnDeletedEvent;
@@ -64,6 +72,8 @@
                ColumnCreatedListener, ColumnDeletedListener {
 
        private static final long serialVersionUID = 8665197023334496167L;
+       
+       protected static final String TABLE_PREFIX = "BioMart Table ";
 
        /**
         * Will be caught by parent object (usually a dialog.)
@@ -105,18 +115,23 @@
 
        // Attribute panel border title
        protected String attributePanelTitle;
+       
+       protected final CyTableManager tblManager;
+       private final CyNetworkManager netManager;
 
-       protected AttributeImportPanel() {
-               this(null, DEF_TITLE, ATTR_PANEL_TITLE);
-       }
 
-       protected AttributeImportPanel(Icon logo, String title,
+       protected AttributeImportPanel(final CyTableManager tblManager, final 
CyNetworkManager netManager,
+                       Icon logo, String title,
                        String attrPanelTitle) {
                this.logo = logo;
                this.panelTitle = title;
                this.attributePanelTitle = attrPanelTitle;
+               this.tblManager = tblManager;
+               this.netManager = netManager;
 
                initComponents();
+               
+               setAttributeComboBox();
        }
 
        private void initComponents() {
@@ -406,21 +421,40 @@
        abstract protected void databaseComboBoxActionPerformed(
                        java.awt.event.ActionEvent evt);
 
+       
        protected abstract void importAttributes();
+       
+       
+       private void setAttributeComboBox() {
+               final Set<CyNetwork> networks = this.netManager.getNetworkSet();
+               
+               for(CyNetwork network: networks) {
+                       final Map<String, CyTable> tables = 
this.tblManager.getTableMap(CyNode.class, network);
+                       final CyTable nodeTable = 
tables.get(CyNetwork.DEFAULT_ATTRS);
+                       final Map<String, Class<?>> columns = 
nodeTable.getColumnTypeMap();
+                       for (String name : columns.keySet())
+                               attributeComboBox.addItem(name);
+               }
+       }
 
        protected void addAttribute(final String attributeName) {
                if (attributeName == null)
                        return;
 
+               final Object currentSelection = 
attributeComboBox.getSelectedItem();
+               
                final SortedSet<String> attrNameSet = new TreeSet<String>();
                attrNameSet.add(attributeName);
-               for (int i = 0; i < model.getSize(); i++)
-                       attrNameSet.add(model.get(i).toString());
+               for (int i = 0; i < attributeComboBox.getItemCount(); i++)
+                       
attrNameSet.add(attributeComboBox.getItemAt(i).toString());
 
                attributeComboBox.removeAllItems();
 
                for (String name : attrNameSet)
                        attributeComboBox.addItem(name);
+               
+               if(currentSelection != null)
+                       
attributeComboBox.setSelectedItem(currentSelection.toString());
        }
 
        protected void removeAttribute(final String attributeName) {
@@ -432,15 +466,13 @@
 
        @Override
        public void handleEvent(ColumnCreatedEvent e) {
-               final String attrName = e.getColumnName();
-
+               final String attrName = e.getColumnName();              
                addAttribute(attrName);
        }
 
        @Override
        public void handleEvent(ColumnDeletedEvent e) {
                final String attrName = e.getColumnName();
-
                removeAttribute(attrName);
        }
 

Modified: 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartAttrMappingPanel.java
===================================================================
--- 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartAttrMappingPanel.java
     2011-01-25 01:09:33 UTC (rev 23593)
+++ 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartAttrMappingPanel.java
     2011-01-25 03:22:27 UTC (rev 23594)
@@ -57,6 +57,7 @@
 import org.cytoscape.io.webservice.biomart.task.ImportFilterTask;
 import org.cytoscape.io.webservice.biomart.task.LoadRepositoryResult;
 import org.cytoscape.model.CyNetwork;
+import org.cytoscape.model.CyNetworkManager;
 import org.cytoscape.model.CyNode;
 import org.cytoscape.model.CyRow;
 import org.cytoscape.model.CyTable;
@@ -93,11 +94,12 @@
 
        private final GUITaskManager taskManager;
        private final CyApplicationManager appManager;
-       private final CyTableManager tblManager;
 
-       private final Window parent;
+       private Window parent;
 
        private final BiomartClient client;
+       
+       private int globalTableCounter;
 
        /**
         * Creates a new BiomartNameMappingPanel object.
@@ -108,20 +110,22 @@
         *            DOCUMENT ME!
         * @throws Exception
         */
-       public BiomartAttrMappingPanel(final LoadRepositoryResult res, final 
BiomartClient client,
+       public BiomartAttrMappingPanel(
+                       final BiomartClient client,
                        final TaskManager taskManager,
                        final CyApplicationManager appManager,
-                       final CyTableManager tblManager, final Window parent) {
-               super(LOGO, "Biomart", "Import Settings");
+                       final CyTableManager tblManager, final CyNetworkManager 
netManager) {
+               super(tblManager, netManager, LOGO, "Biomart", "Import 
Settings");
 
                this.client = client;
                this.taskManager = (GUITaskManager) taskManager;
                this.appManager = appManager;
-               this.tblManager = tblManager;
+               
+               this.globalTableCounter = 0;
+       }
+       
+       public void setParent(final Window parent) {
                this.parent = parent;
-
-               // Access the MartService and get the available services.
-               initDataSources(res);
        }
 
        /**
@@ -129,7 +133,7 @@
         * 
         * @throws Exception
         */
-       private void initDataSources(LoadRepositoryResult res) {
+       public void initDataSources(LoadRepositoryResult res) {
                attributeMap = new HashMap<String, Map<String, String[]>>();
                attributeListOrder = new HashMap<String, List<String>>();
                filterMap = new HashMap<String, Map<String, String>>();
@@ -141,6 +145,7 @@
                // Load available filters for current source.
                // loadFilter();
        }
+       
 
        public void setMartServiceList(LoadRepositoryResult res) {
                this.datasourceMap = res.getDatasourceMap();
@@ -241,8 +246,7 @@
                // Use Attributes for mapping
                final CyTable defTable = tblManager.getTableMap(CyNode.class,
                                curNetwork).get(CyNetwork.DEFAULT_ATTRS);
-               final Class<?> attrDataType = defTable.getColumnTypeMap().get(
-                               keyAttrName);
+               final Class<?> attrDataType = 
defTable.getColumnTypeMap().get(keyAttrName);
                for (CyNode node : nodes) {
                        final CyRow row = defTable.getRow(node.getSUID());
 
@@ -320,10 +324,9 @@
                final Map<String, String> attrMap = 
this.attrNameMap.get(datasource);
                final Map<String, String> fMap = filterMap.get(datasource);
 
-               final String keyAttrName = attributeComboBox.getSelectedItem()
-                               .toString();
+               final String keyAttrName = 
attributeComboBox.getSelectedItem().toString();
 
-               System.out.println("Target attr name found: " + keyAttrName);
+               System.out.println("Selected attr name: " + keyAttrName);
 
                Dataset dataset;
                Attribute[] attrs;
@@ -387,7 +390,8 @@
                final String query = XMLQueryBuilder.getQueryString(dataset, 
attrs,
                                filters);
 
-               return new BiomartQuery(query, keyAttrName);
+               final String tableName = TABLE_PREFIX + (++globalTableCounter);
+               return new BiomartQuery(query, keyAttrName, tableName);
        }
        
        

Modified: 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartMainDialog.java
===================================================================
--- 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartMainDialog.java
   2011-01-25 01:09:33 UTC (rev 23593)
+++ 
core3/webservice-biomart-client/trunk/src/main/java/org/cytoscape/io/webservice/biomart/ui/BiomartMainDialog.java
   2011-01-25 03:22:27 UTC (rev 23594)
@@ -42,12 +42,8 @@
 import javax.swing.JPanel;
 import javax.swing.JTabbedPane;
 
-import org.cytoscape.application.swing.CySwingApplication;
 import org.cytoscape.io.webservice.biomart.BiomartClient;
 import org.cytoscape.io.webservice.biomart.task.LoadRepositoryResult;
-import org.cytoscape.model.CyTableManager;
-import org.cytoscape.session.CyApplicationManager;
-import org.cytoscape.work.TaskManager;
 
 /**
  * BioMart client main GUI.
@@ -55,9 +51,7 @@
 public final class BiomartMainDialog extends JDialog {
 
        private static final long serialVersionUID = 2382157952635589843L;
-       
-       private final BiomartAttrMappingPanel panel;
-       
+               
        /**
         * Basic GUI to access BioMart services.
         * 
@@ -66,9 +60,7 @@
         * @param appManager
         * @param tblManager
         */
-       public BiomartMainDialog(final BiomartClient client, final TaskManager 
taskManager,
-                       final CyApplicationManager appManager,
-                       final CyTableManager tblManager, final 
CySwingApplication app, final LoadRepositoryResult result) {
+       public BiomartMainDialog(final BiomartAttrMappingPanel panel, final 
BiomartClient client, final LoadRepositoryResult result) {
                super();
                setTitle("BioMart Web Service Client");
 
@@ -88,8 +80,9 @@
 
                tunablePanel.add(tPanel);
 
-               panel = new BiomartAttrMappingPanel(result, client, 
taskManager, appManager, tblManager, this);
                client.setGUI(panel);
+               panel.initDataSources(result);
+               panel.setParent(this);
                
                tabs.addTab("Query", panel);
 

Modified: 
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
===================================================================
--- 
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
    2011-01-25 01:09:33 UTC (rev 23593)
+++ 
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context-osgi.xml
    2011-01-25 03:22:27 UTC (rev 23594)
@@ -23,7 +23,11 @@
 
        <osgi:reference id="cyTableFactoryServiceRef" 
interface="org.cytoscape.model.CyTableFactory" />
 
-       <osgi:service id="showBiomartGUIActionService" ref="showDialogAction"
+       <osgi:service id="showBiomartGUIActionService" 
ref="showBiomartGUIAction"
                interface="org.cytoscape.application.swing.CyAction" />
+               
+               
+       <!-- This is necessary to listening to Column events. -->
+       <osgi:service id="biomartAttrMappingPanelService" 
ref="biomartAttrMappingPanel" auto-export="interfaces" />
 
 </beans>

Modified: 
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context.xml
===================================================================
--- 
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context.xml
 2011-01-25 01:09:33 UTC (rev 23593)
+++ 
core3/webservice-biomart-client/trunk/src/main/resources/META-INF/spring/bundle-context.xml
 2011-01-25 03:22:27 UTC (rev 23594)
@@ -17,27 +17,39 @@
        <import resource="bundle-context-osgi.xml" />
 
        <context:annotation-config />
-       
+
        <!-- REST version of BioMart web service client -->
-       <bean id="biomartRestClient" 
class="org.cytoscape.io.webservice.biomart.rest.BiomartRestClient">
+       <bean id="biomartRestClient"
+               
class="org.cytoscape.io.webservice.biomart.rest.BiomartRestClient">
                <constructor-arg 
value="http://www.biomart.org/biomart/martservice"; />
        </bean>
-       
+
        <!-- Wrapper for the REST client -->
        <bean id="biomartClient" 
class="org.cytoscape.io.webservice.biomart.BiomartClient">
                <constructor-arg index="0" value="BioMart Client" />
-               <constructor-arg index="1" value="REST version of BioMart Web 
Service Client." />
+               <constructor-arg index="1"
+                       value="REST version of BioMart Web Service Client." />
                <constructor-arg ref="biomartRestClient" />
                <constructor-arg ref="cyTableFactoryServiceRef" />
                <constructor-arg ref="cyNetworkManagerServiceRef" />
        </bean>
-       
+
+       <bean id="biomartAttrMappingPanel"
+               
class="org.cytoscape.io.webservice.biomart.ui.BiomartAttrMappingPanel">
+               <constructor-arg ref="biomartClient" />
+               <constructor-arg ref="taskManagerServiceRef" />
+               <constructor-arg ref="cyApplicationManagerServiceRef" />
+               <constructor-arg ref="cyTableManagerServiceRef" />
+               <constructor-arg ref="cyNetworkManagerServiceRef" />
+       </bean>
+
        <!-- Task to create menu item -->
-       <bean id="showDialogAction" 
class="org.cytoscape.io.webservice.biomart.task.ShowBiomartGUIAction">
+       <bean id="showBiomartGUIAction"
+               
class="org.cytoscape.io.webservice.biomart.task.ShowBiomartGUIAction">
+               <constructor-arg ref="biomartAttrMappingPanel" />
                <constructor-arg ref="biomartClient" />
                <constructor-arg ref="taskManagerServiceRef" />
                <constructor-arg ref="cyApplicationManagerServiceRef" />
-               <constructor-arg ref="cyTableManagerServiceRef" />
                <constructor-arg ref="cySwingApplicationServiceRef" />
        </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