Author: kono
Date: 2012-07-26 15:15:36 -0700 (Thu, 26 Jul 2012)
New Revision: 30011

Removed:
   
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/mapper/CyNetworkBuilder.java
   
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/mapper/Mitab25Mapper.java
   
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/ontology/
   
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/ui/ResultDialog.java
Modified:
   
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/CyActivator.java
   
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/PSICQUICRestClient.java
   
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/mapper/InteractionClusterMapper.java
   
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/simpleclient/PSICQUICSimpleClient.java
   
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/task/ImportNetworkFromPSICQUICTask.java
   
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/ui/SourceStatusPanel.java
Log:
Network Builder code is consolidated to PSI-MI library ones.  Also, URL 
encoding bug fixed.

Modified: 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/CyActivator.java
===================================================================
--- 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/CyActivator.java
   2012-07-26 21:45:23 UTC (rev 30010)
+++ 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/CyActivator.java
   2012-07-26 22:15:36 UTC (rev 30011)
@@ -1,8 +1,12 @@
 package org.cytoscape.webservice.psicquic;
 
+import static org.cytoscape.work.ServiceProperties.MENU_GRAVITY;
+import static org.cytoscape.work.ServiceProperties.NODE_APPS_MENU;
+import static org.cytoscape.work.ServiceProperties.PREFERRED_MENU;
+import static org.cytoscape.work.ServiceProperties.TITLE;
+
 import java.util.Properties;
 
-import org.cytoscape.application.swing.CyNodeViewContextMenuFactory;
 import org.cytoscape.event.CyEventHelper;
 import org.cytoscape.model.CyNetworkFactory;
 import org.cytoscape.model.CyNetworkManager;
@@ -14,7 +18,6 @@
 import org.cytoscape.view.vizmap.VisualMappingManager;
 import org.cytoscape.webservice.psicquic.mapper.MergedNetworkBuilder;
 import org.cytoscape.webservice.psicquic.task.ExpandNodeContextMenuFactory;
-import static org.cytoscape.work.ServiceProperties.*;
 import org.cytoscape.work.swing.DialogTaskManager;
 import org.osgi.framework.BundleContext;
 
@@ -35,8 +38,6 @@
                VisualMappingManager vmm = getService(bc, 
VisualMappingManager.class);
                CyEventHelper eh = getService(bc, CyEventHelper.class);
 
-               DialogTaskManager taskManager = getService(bc, 
DialogTaskManager.class);
-
                CreateNetworkViewTaskFactory createViewTaskFactoryServiceRef = 
getService(bc,
                                CreateNetworkViewTaskFactory.class);
                

Modified: 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/PSICQUICRestClient.java
===================================================================
--- 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/PSICQUICRestClient.java
    2012-07-26 21:45:23 UTC (rev 30010)
+++ 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/PSICQUICRestClient.java
    2012-07-26 22:15:36 UTC (rev 30011)
@@ -1,10 +1,11 @@
 package org.cytoscape.webservice.psicquic;
 
 import java.io.IOException;
-import java.io.InputStream;
 import java.net.URL;
+import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -12,7 +13,6 @@
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
-import java.util.WeakHashMap;
 import java.util.concurrent.Callable;
 import java.util.concurrent.CancellationException;
 import java.util.concurrent.CompletionService;
@@ -27,7 +27,6 @@
 
 import org.cytoscape.model.CyNetwork;
 import org.cytoscape.model.CyNetworkFactory;
-import org.cytoscape.webservice.psicquic.mapper.CyNetworkBuilder;
 import org.cytoscape.webservice.psicquic.mapper.MergedNetworkBuilder;
 import org.cytoscape.webservice.psicquic.simpleclient.PSICQUICSimpleClient;
 import org.cytoscape.work.TaskMonitor;
@@ -68,10 +67,10 @@
        public static final Long ERROR_TIMEOUT = -2l;
        public static final Long ERROR_CANCEL = -3l;
 
-       // Timeout for search.  TODO: Make public as property.
+       // Timeout for search. TODO: Make public as property.
        private static final long SEARCH_TIMEOUT_MSEC = 7000;
-       
-       // Timeout for import.  TODO: Make public as property.
+
+       // Timeout for import. TODO: Make public as property.
        private static final long IMPORT_TIMEOUT = 1000;
 
        private final CyNetworkFactory factory;
@@ -80,121 +79,73 @@
 
        private boolean canceled = false;
 
-       public PSICQUICRestClient(final CyNetworkFactory factory, final 
RegistryManager regManager, final MergedNetworkBuilder builder) {
+       public PSICQUICRestClient(final CyNetworkFactory factory, final 
RegistryManager regManager,
+                       final MergedNetworkBuilder builder) {
                this.factory = factory;
                this.regManager = regManager;
                this.builder = builder;
        }
 
-       public Map<String, CyNetwork> importNetwork(final String query, final 
Collection<String> targetServices,
-                       final SearchMode mode, final TaskMonitor tm) {
+       public CyNetwork importMergedNetwork(final String query, final 
Collection<String> targetServices,
+                       final SearchMode mode, final TaskMonitor tm) throws 
IOException {
 
-               canceled = false;
+               final InteractionCluster importedCluster = importMerged(query, 
targetServices, mode, tm);
+               final CyNetwork network = builder.buildNetwork(importedCluster);
 
-               tm.setTitle("Loading network data from PSICQUIC Remote 
Services");
+               tm.setProgress(1.0d);
+               return network;
+       }
 
-               Map<String, CyNetwork> resultMap = new 
ConcurrentHashMap<String, CyNetwork>();
-               final ExecutorService exe = Executors.newCachedThreadPool();
-               final CompletionService<Map<CyNetwork, String>> 
completionService = new ExecutorCompletionService<Map<CyNetwork, String>>(
-                               exe);
+       public Collection<CyNetwork> importNetworks(final String query, final 
Collection<String> targetServices,
+                       final SearchMode mode, final TaskMonitor tm) throws 
IOException {
 
-               final long startTime = System.currentTimeMillis();
+               final Set<CyNetwork> networks = new HashSet<CyNetwork>();
+               final Map<String, Collection<BinaryInteraction>> result = 
importNetwork(query, targetServices, mode, tm);
 
-               // Submit the query for each active service
-               double completed = 0.0d;
-               final double increment = 1.0d / (double) targetServices.size();
+               for (String source : result.keySet()) {
+                       tm.setStatusMessage("Merging results...");
+                       final InteractionCluster iC = new InteractionCluster();
+                       
iC.setBinaryInteractionIterator(result.get(source).iterator());
+                       iC.setMappingIdDbNames(MAPPING_NAMES);
+                       iC.runService();
 
-               final SortedSet<String> sourceSet = new TreeSet<String>();
-               final Set<ImportNetworkTask> taskSet = new 
HashSet<ImportNetworkTask>();
-               for (final String serviceURL : targetServices) {
-                       ImportNetworkTask task = new 
ImportNetworkTask(serviceURL, query, mode);
-                       completionService.submit(task);
-                       taskSet.add(task);
-                       sourceSet.add(serviceURL);
+                       final CyNetwork network = builder.buildNetwork(iC);
+                       final String networkName = 
regManager.getSource2NameMap().get(source);
+                       network.getRow(network).set(CyNetwork.NAME, 
networkName);
+                       networks.add(network);
                }
 
-               for (int i = 0; i < targetServices.size(); i++) {
-                       if (canceled) {
-                               logger.warn("Interrupted by user: network 
import task");
-                               exe.shutdownNow();
-                               resultMap.clear();
-                               resultMap = null;
+               tm.setProgress(1.0d);
+               return networks;
+       }
 
-                               return new ConcurrentHashMap<String, 
CyNetwork>();
-                       }
+       public InteractionCluster importNeighbours(final String query, final 
Collection<String> targetServices,
+                       final SearchMode mode, final TaskMonitor tm) throws 
IOException {
+               return importMerged(query, targetServices, mode, tm);
+       }
 
-                       Future<Map<CyNetwork, String>> future = null;
-                       try {
-                               future = completionService.take();
-                               final Map<CyNetwork, String> ret = future.get();
-                               final CyNetwork network = 
ret.keySet().iterator().next();
-                               final String source = ret.get(network);
-                               resultMap.put(source, network);
-                               sourceSet.remove(source);
+       private final InteractionCluster importMerged(final String query, final 
Collection<String> targetServices,
+                       final SearchMode mode, final TaskMonitor tm) {
 
-                               completed = completed + increment;
-                               tm.setProgress(completed);
+               final Map<String, Collection<BinaryInteraction>> result = 
importNetwork(query, targetServices, mode, tm);
+               final Collection<Collection<BinaryInteraction>> 
binaryInteractions = result.values();
+               final List<BinaryInteraction> allInteractions = new 
ArrayList<BinaryInteraction>();
+               for (Collection<BinaryInteraction> interactions : 
binaryInteractions)
+                       allInteractions.addAll(interactions);
 
-                               final StringBuilder sBuilder = new 
StringBuilder();
-                               for (String sourceStr : sourceSet) {
-                                       
sBuilder.append(regManager.getSource2NameMap().get(sourceStr) + " ");
-                               }
+               tm.setStatusMessage("Merging results...");
+               InteractionCluster iC = new InteractionCluster();
+               iC.setBinaryInteractionIterator(allInteractions.iterator());
+               iC.setMappingIdDbNames(MAPPING_NAMES);
+               iC.runService();
 
-                               tm.setStatusMessage((i + 1) + " / " + 
targetServices.size() + " tasks finished.\n"
-                                               + "Still waiting responses from 
the following databases:\n\n" + sBuilder.toString());
-
-                       } catch (InterruptedException ie) {
-                               for (ImportNetworkTask t : taskSet)
-                                       t.cancel();
-                               taskSet.clear();
-
-                               List<Runnable> tasks = exe.shutdownNow();
-                               logger.warn("Interrupted: network import.  
Remaining = " + tasks.size(), ie);
-                               resultMap.clear();
-                               resultMap = null;
-                               return new ConcurrentHashMap<String, 
CyNetwork>();
-                       } catch (ExecutionException e) {
-                               logger.warn("Error occured in network import", 
e);
-                               continue;
-                       }
-               }
-
-               try {
-                       exe.shutdown();
-                       exe.awaitTermination(IMPORT_TIMEOUT, TimeUnit.SECONDS);
-
-                       long endTime = System.currentTimeMillis();
-                       double sec = (endTime - startTime) / (1000.0);
-                       logger.info("PSICUQIC Import Finished in " + sec + " 
sec.");
-               } catch (Exception ex) {
-                       logger.warn("Import operation timeout", ex);
-                       return resultMap;
-               } finally {
-                       taskSet.clear();
-                       sourceSet.clear();
-               }
-
-               return resultMap;
+               return iC;
        }
 
-       public CyNetwork importClusteredNetwork(final String query, final 
Collection<String> targetServices,
-                       final SearchMode mode, final TaskMonitor tm) throws 
IOException {
-               
-               InteractionCluster importedCluster = importClustered(query, 
targetServices, mode, tm);
+       private Map<String, Collection<BinaryInteraction>> importNetwork(final 
String query,
+                       final Collection<String> targetServices, final 
SearchMode mode, final TaskMonitor tm) {
+               final Map<String, Collection<BinaryInteraction>> result = new 
HashMap<String, Collection<BinaryInteraction>>();
 
-               final CyNetwork network = builder.buildNetwork(importedCluster);
-               
-               tm.setProgress(1.0d);
-               return network;
-       }
-       
-       public InteractionCluster importNeighbours(final String query, final 
Collection<String> targetServices,
-                       final SearchMode mode, final TaskMonitor tm) throws 
IOException {
-               return importClustered(query, targetServices, mode, tm);
-       }
-       
-       private final InteractionCluster importClustered(final String query, 
final Collection<String> targetServices,
-                       final SearchMode mode, final TaskMonitor tm) {
                canceled = false;
 
                tm.setTitle("Loading network data from Remote PSICQUIC 
Services");
@@ -211,16 +162,16 @@
                final double increment = 1.0d / (double) targetServices.size();
 
                final SortedSet<String> sourceSet = new TreeSet<String>();
-               final Set<ImportNetworkAsStreamsTask> taskSet = new 
HashSet<ImportNetworkAsStreamsTask>();
+               final Set<ImportNetworkAsMitabTask> taskSet = new 
HashSet<ImportNetworkAsMitabTask>();
                for (final String serviceURL : targetServices) {
-                       ImportNetworkAsStreamsTask task = new 
ImportNetworkAsStreamsTask(serviceURL, query, mode);
+                       final ImportNetworkAsMitabTask task = new 
ImportNetworkAsMitabTask(serviceURL, query, mode);
                        completionService.submit(task);
                        taskSet.add(task);
                        sourceSet.add(serviceURL);
                }
 
-               final List<BinaryInteraction> binaryInteractions = new 
ArrayList<BinaryInteraction>();
-               for (int i = 0; i < targetServices.size(); i++) {
+               int i = 0;
+               for (final String service : targetServices) {
                        if (canceled) {
                                logger.warn("Interrupted by user: network 
import task");
                                exe.shutdownNow();
@@ -234,8 +185,10 @@
                        try {
                                future = completionService.take();
                                final Collection<BinaryInteraction> ret = 
future.get();
-                               if (ret != null)
-                                       binaryInteractions.addAll(ret);
+                               if (ret != null) {
+                                       result.put(service, ret);
+                                       // binaryInteractions.addAll(ret);
+                               }
 
                                completed = completed + increment;
                                tm.setProgress(completed);
@@ -249,7 +202,7 @@
                                                + "Still waiting responses from 
the following databases:\n\n" + sBuilder.toString());
 
                        } catch (InterruptedException ie) {
-                               for (ImportNetworkAsStreamsTask t : taskSet) {
+                               for (ImportNetworkAsMitabTask t : taskSet) {
                                        // t.cancel();
                                }
 
@@ -264,6 +217,8 @@
                                logger.warn("Error occured in network import", 
e);
                                continue;
                        }
+
+                       i++;
                }
 
                try {
@@ -281,13 +236,7 @@
                        sourceSet.clear();
                }
 
-               tm.setStatusMessage("Merging results...");
-               InteractionCluster iC = new InteractionCluster();
-               iC.setBinaryInteractionIterator(binaryInteractions.iterator());
-               iC.setMappingIdDbNames(MAPPING_NAMES);
-               iC.runService();
-               
-               return iC;
+               return result;
        }
 
        public Map<String, Long> search(final String query, final 
Collection<String> targetServices, final SearchMode mode,
@@ -359,7 +308,7 @@
         * Search each data source and return aggregated result.
         * 
         */
-       private final class SearchTask implements Callable<Long> {
+       private static final class SearchTask implements Callable<Long> {
                private final String serviceURL;
                private final String query;
                private final SearchMode mode;
@@ -383,69 +332,36 @@
                }
        }
 
-       private final class ImportNetworkTask implements 
Callable<Map<CyNetwork, String>> {
+       private static final class ImportNetworkAsMitabTask implements 
Callable<Collection<BinaryInteraction>> {
                private final String serviceURL;
                private final String query;
                private final SearchMode mode;
 
-               private final Map<CyNetwork, String> returnThis;
-
-               private final CyNetworkBuilder networkBuilder;
-
-               private ImportNetworkTask(final String serviceURL, final String 
query, final SearchMode mode) {
+               private ImportNetworkAsMitabTask(final String serviceURL, final 
String query, final SearchMode mode) {
                        this.serviceURL = serviceURL;
                        this.query = query;
                        this.mode = mode;
-                       this.returnThis = new WeakHashMap<CyNetwork, String>();
-                       this.networkBuilder = new CyNetworkBuilder(factory);
                }
 
                @Override
-               public Map<CyNetwork, String> call() throws Exception {
-                       final PSICQUICSimpleClient simpleClient = new 
PSICQUICSimpleClient(serviceURL);
-                       InputStream is = null;
-                       if (mode == SearchMode.INTERACTOR)
-                               is = simpleClient.getByInteraction(query);
-                       else if (mode == SearchMode.MIQL)
-                               is = simpleClient.getByQuery(query);
+               public Collection<BinaryInteraction> call() throws Exception {
 
-                       // This can be null if interrupted.
-                       final CyNetwork network = 
networkBuilder.buildNetwork(is);
-                       is.close();
-                       is = null;
+                       String encodedStr = URLEncoder.encode(query, "UTF-8");
+                       encodedStr = encodedStr.replaceAll("\\+", "%20");
 
-                       if (network != null)
-                               returnThis.put(network, serviceURL);
+                       URL queryURL = null;
+                       if (mode == SearchMode.INTERACTOR) {
+                               // Query is list of interactors.
+                               queryURL = new URL(serviceURL + "interactor/" + 
encodedStr);
+                       } else if (mode == SearchMode.MIQL) {
+                               queryURL = new URL(serviceURL + "query/" + 
encodedStr);
+                       }
 
-                       return returnThis;
-               }
+                       if (queryURL == null)
+                               throw new IllegalArgumentException("Could not 
create query URL.");
 
-               public void cancel() {
-                       networkBuilder.cancel();
-               }
-       }
+                       logger.info("Query URL: " + queryURL);
 
-       private final class ImportNetworkAsStreamsTask implements 
Callable<Collection<BinaryInteraction>> {
-               private final String serviceURL;
-               private final String query;
-               private final SearchMode mode;
-
-               private ImportNetworkAsStreamsTask(final String serviceURL, 
final String query, final SearchMode mode) {
-                       this.serviceURL = serviceURL;
-                       this.query = query;
-                       this.mode = mode;
-               }
-
-               @Override
-               public Collection<BinaryInteraction> call() throws Exception {
-                       final PSICQUICSimpleClient simpleClient = new 
PSICQUICSimpleClient(serviceURL);
-                       InputStream is = null;
-                       if (mode == SearchMode.INTERACTOR)
-                               is = simpleClient.getByInteraction(query);
-                       else if (mode == SearchMode.MIQL)
-                               is = simpleClient.getByQuery(query);
-
-                       URL queryURL = new URL(serviceURL + "query/" + query);
                        final PsimiTabReader mitabReader = new 
PsimiTabReader(false);
                        return mitabReader.read(queryURL);
                }
@@ -454,5 +370,4 @@
        public void cancel() {
                this.canceled = true;
        }
-
-}
+}
\ No newline at end of file

Deleted: 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/mapper/CyNetworkBuilder.java
===================================================================
--- 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/mapper/CyNetworkBuilder.java
       2012-07-26 21:45:23 UTC (rev 30010)
+++ 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/mapper/CyNetworkBuilder.java
       2012-07-26 22:15:36 UTC (rev 30011)
@@ -1,51 +0,0 @@
-package org.cytoscape.webservice.psicquic.mapper;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-import org.cytoscape.model.CyNetwork;
-import org.cytoscape.model.CyNetworkFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CyNetworkBuilder {
-       
-       private static final Logger logger = 
LoggerFactory.getLogger(CyNetworkBuilder.class);
-
-       private final CyNetworkFactory networkFactory;
-       
-       volatile boolean cancel = false;
-       
-       public CyNetworkBuilder(final CyNetworkFactory networkFactory) {
-               this.networkFactory = networkFactory;
-       }
-       
-       public CyNetwork buildNetwork(final InputStream is) throws IOException {
-               CyNetwork network = networkFactory.createNetwork();
-               
-               final Mitab25Mapper mapper = new Mitab25Mapper(network);
-               
-               String line = null;
-               final BufferedReader br = new BufferedReader(new 
InputStreamReader(is));
-               while ((line = br.readLine()) != null) {
-                       if(cancel) {
-                               br.close();
-                               logger.warn("Network bulilder interrupted.");
-                               network = null;
-                               return null;
-                       }
-                       
-                       mapper.parse(line);
-               }
-
-               br.close();
-               logger.info("Import Done: " + network.getSUID());
-               return network;
-       }
-       
-       public void cancel() {
-               this.cancel = true;
-       }
-}

Modified: 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/mapper/InteractionClusterMapper.java
===================================================================
--- 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/mapper/InteractionClusterMapper.java
       2012-07-26 21:45:23 UTC (rev 30010)
+++ 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/mapper/InteractionClusterMapper.java
       2012-07-26 22:15:36 UTC (rev 30011)
@@ -15,12 +15,11 @@
 import javax.xml.bind.JAXBException;
 import javax.xml.bind.Unmarshaller;
 
-import org.cytoscape.event.CyEventHelper;
 import org.cytoscape.model.CyEdge;
 import org.cytoscape.model.CyRow;
 import org.cytoscape.webservice.psicquic.miriam.Miriam;
-import org.cytoscape.webservice.psicquic.miriam.Synonyms;
 import org.cytoscape.webservice.psicquic.miriam.Miriam.Datatype;
+import org.cytoscape.webservice.psicquic.miriam.Synonyms;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

Deleted: 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/mapper/Mitab25Mapper.java
===================================================================
--- 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/mapper/Mitab25Mapper.java
  2012-07-26 21:45:23 UTC (rev 30010)
+++ 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/mapper/Mitab25Mapper.java
  2012-07-26 22:15:36 UTC (rev 30011)
@@ -1,284 +0,0 @@
-package org.cytoscape.webservice.psicquic.mapper;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.cytoscape.model.CyEdge;
-import org.cytoscape.model.CyNetwork;
-import org.cytoscape.model.CyNode;
-import org.cytoscape.model.CyRow;
-
-/**
- * Map minimal set of information from MITAB25.
- * 
- */
-public class Mitab25Mapper {
-
-       // Separator for multiple entries.
-       private static final String SEPARATOR = "\\|";
-       private static final String ATTR_PREFIX = "PSI-MI-25: ";
-
-       private static final int COLUMN_COUNT = 15;
-
-       // Reg.Ex for parsing entry
-       private final static Pattern miPttr = Pattern.compile("MI:\\d{4}");
-       private final static Pattern miNamePttr = Pattern.compile("\\(.+\\)");
-
-       private static final String TAB = "\t";
-
-       // Attr Names
-       private static final String DATABASE_UNIQUE_ID = ATTR_PREFIX + 
"database-unique ID";
-       private static final String DETECTION_METHOD = ATTR_PREFIX + 
"interaction detection method";
-       private static final String INTERACTION_TYPE = ATTR_PREFIX + 
"interaction type";
-       private static final String SOURCE_DB = ATTR_PREFIX + "source database";
-       private static final String INTERACTION_ID = ATTR_PREFIX + "Interaction 
ID";
-       private static final String EDGE_SCORE = ATTR_PREFIX + "confidence 
score";
-
-       // Stable IDs which maybe used for mapping later
-       private static final String UNIPROT = "uniprotkb";
-       private static final String ENTREZ_GENE = "entrezgene/locuslink";
-       private static final String ENTREZ_GENE_SYN = "entrez gene/locuslink";
-
-       private static final String CHEBI = "chebi";
-
-       private static final String INTERACTOR_TYPE = ATTR_PREFIX + "interactor 
type";
-       private static final String COMPOUND = "compound";
-
-       private Matcher matcher;
-
-       
-       
-       private final CyNetwork network;
-       private final Map<String, CyNode> nodeMap;
-       
-       public Mitab25Mapper(final CyNetwork network) {
-               this.network = network;
-               this.nodeMap = new HashMap<String, CyNode>();
-               
-               // Create Columns
-               network.getDefaultNodeTable().createColumn(INTERACTOR_TYPE, 
String.class, true);
-               network.getDefaultNodeTable().createColumn(DATABASE_UNIQUE_ID, 
String.class, true);
-               network.getDefaultEdgeTable().createColumn(INTERACTION_ID, 
String.class, true);
-       }
-
-       public void parse(final String line) {
-               
-               String[] sourceID;
-               String[] targetID;
-
-               String[] detectionMethods;
-               CyNode source;
-               CyNode target;
-               CyEdge e;
-
-               String[] sourceDB;
-               String[] interactionID;
-               String[] interactionType;
-
-               String[] edgeScore;
-
-               
-               final String[] entry = line.split(TAB);
-
-               // Validate entry list.
-               if (entry == null || entry.length < COLUMN_COUNT)
-                       return;
-
-               sourceID = entry[0].split(SEPARATOR);
-               final String sourceIDHalf = sourceID[0].split(":")[1];
-               targetID = entry[1].split(SEPARATOR);
-               final String targetIDHalf = targetID[0].split(":")[1];
-
-               // Create source and target node if necessary.
-               source = nodeMap.get(sourceID[0]);
-               if(source == null) {
-                       source = network.addNode();
-                       network.getRow(source).set(CyNetwork.NAME, 
sourceIDHalf);
-                       network.getRow(source).set(DATABASE_UNIQUE_ID, 
sourceID[0]);
-                       nodeMap.put(sourceID[0], source);
-               }
-               target = nodeMap.get(targetID[0]);
-               if (target == null) {
-                       target = network.addNode();
-                       network.getRow(target).set(CyNetwork.NAME, 
targetIDHalf);
-                       network.getRow(target).set(DATABASE_UNIQUE_ID, 
targetID[0]);
-                       nodeMap.put(targetID[0], target);
-               }
-               
-               // Set type if not protein
-               if (sourceID[0].contains(CHEBI))
-                       network.getRow(source).set(INTERACTOR_TYPE, COMPOUND);
-               if (targetID[0].contains(CHEBI))
-                       network.getRow(target).set(INTERACTOR_TYPE, COMPOUND);
-
-//             // Aliases
-//             setAliases(nodeAttr, source.getIdentifier(), 
entry[0].split(SEPARATOR));
-//             setAliases(nodeAttr, target.getIdentifier(), 
entry[1].split(SEPARATOR));
-//             setAliases(nodeAttr, source.getIdentifier(), 
entry[2].split(SEPARATOR));
-//             setAliases(nodeAttr, target.getIdentifier(), 
entry[3].split(SEPARATOR));
-//             setAliases(nodeAttr, source.getIdentifier(), 
entry[4].split(SEPARATOR));
-//             setAliases(nodeAttr, target.getIdentifier(), 
entry[5].split(SEPARATOR));
-//
-               // Tax ID (pick first one only)
-               setTaxID(network.getRow(source), entry[9].split(SEPARATOR)[0]);
-               setTaxID(network.getRow(target), entry[10].split(SEPARATOR)[0]);
-
-//             sourceDB = entry[12].split(SEPARATOR);
-               interactionID = entry[13].split(SEPARATOR);
-               edgeScore = entry[14].split(SEPARATOR);
-
-               detectionMethods = entry[6].split(SEPARATOR);
-               interactionType = entry[11].split(SEPARATOR);
-               e = network.addEdge(source, target, true);
-               network.getRow(e).set(
-                               CyNetwork.NAME,
-                               network.getRow(source).get(CyNetwork.NAME, 
String.class) + " (" + interactionID[0] + ") "
-                                               + 
network.getRow(target).get(CyNetwork.NAME, String.class));
-               network.getRow(e).set(CyEdge.INTERACTION, interactionID[0]);
-
-//             setEdgeListAttribute(edgeAttr, e.getIdentifier(), 
interactionType, INTERACTION_TYPE);
-//             setEdgeListAttribute(edgeAttr, e.getIdentifier(), 
detectionMethods, DETECTION_METHOD);
-//             setEdgeListAttribute(edgeAttr, e.getIdentifier(), sourceDB, 
SOURCE_DB);
-//
-//             // Map scores
-//             setEdgeScoreListAttribute(edgeAttr, e.getIdentifier(), 
edgeScore, EDGE_SCORE);
-//
-               network.getRow(e).set(INTERACTION_ID, interactionID[0]);
-//
-//             setPublication(edgeAttr, e.getIdentifier(), 
entry[8].split(SEPARATOR), entry[7].split(SEPARATOR));
-
-       }
-
-
-       private void setTaxID(final CyRow row, String value) {
-               String[] buf = value.split(":", 2);
-               String attrName;
-               String taxonName;
-               if (buf != null && buf.length == 2) {
-                       attrName = ATTR_PREFIX + buf[0];
-                       
-                       if(row.getTable().getColumn(attrName) == null)
-                               row.getTable().createColumn(attrName, 
String.class, false);
-                       if(row.getTable().getColumn(attrName+ ".name") == null)
-                               row.getTable().createColumn(attrName+ ".name", 
String.class, false);
-
-                       matcher = miNamePttr.matcher(buf[1]);
-                       if (matcher.find()) {
-                               taxonName = matcher.group();
-                               row.set(attrName, buf[1].split("\\(")[0]);
-                               row.set(attrName + ".name", 
taxonName.substring(1, taxonName.length() - 1));
-                       } else {
-                               row.set(attrName, buf[1]);
-                       }
-               }
-       }
-//
-//     private void setPublication(CyAttributes attr, String id, String[] 
pubID, String[] authors) {
-//             String key = null;
-//             String[] temp;
-//
-//             for (String val : pubID) {
-//                     temp = val.split(":", 2);
-//                     if (temp == null || temp.length < 2)
-//                             continue;
-//
-//                     key = ATTR_PREFIX + temp[0];
-//                     listAttrMapper(attr, key, id, temp[1]);
-//             }
-//
-//             for (String val : authors) {
-//                     key = ATTR_PREFIX + "author";
-//                     listAttrMapper(attr, key, id, val);
-//             }
-//     }
-//
-//     private void setAliases(final String id, final String[] entry) {
-//             String key = null;
-//             String[] temp;
-//             String value;
-//
-//             for (String val : entry) {
-//                     temp = val.split(":", 2);
-//                     if (temp == null || temp.length < 2)
-//                             continue;
-//
-//                     key = ATTR_PREFIX + temp[0];
-//                     value = temp[1].replaceAll("\\(.+\\)", "");
-//                     listAttrMapper(attr, key, id, value);
-//             }
-//     }
-//
-//     private void setEdgeListAttribute(CyAttributes attr, String id, 
String[] entry, String key) {
-//
-//             String value;
-//             String name;
-//
-//             for (String val : entry) {
-//                     value = trimPSITerm(val);
-//                     name = trimPSIName(val);
-//
-//                     listAttrMapper(attr, key, id, value);
-//                     listAttrMapper(attr, key + ".name", id, name);
-//             }
-//     }
-//
-//     // Special case for edge scores
-//     private void setEdgeScoreListAttribute(CyAttributes attr, String id, 
String[] entry, String key) {
-//
-//             String scoreString;
-//             String scoreType;
-//
-//             for (String val : entry) {
-//                     final String[] parts = val.split(":");
-//                     if (parts == null || parts.length != 2)
-//                             continue;
-//
-//                     scoreString = parts[1];
-//                     scoreType = parts[0];
-//
-//                     try {
-//                             final Double score = 
Double.parseDouble(scoreString);
-//                             edgeAttr.setAttribute(id, key + "." + 
scoreType, score);
-//                     } catch (Exception e) {
-//                             if (scoreString != null && 
scoreString.trim().equals("") == false)
-//                                     edgeAttr.setAttribute(id, key + "." + 
scoreType, scoreString);
-//
-//                             continue;
-//                     }
-//             }
-//     }
-//
-
-//
-//     private String trimPSITerm(String original) {
-//             String miID = null;
-//
-//             matcher = miPttr.matcher(original);
-//
-//             if (matcher.find()) {
-//                     miID = matcher.group();
-//             } else {
-//                     miID = "-";
-//             }
-//
-//             return miID;
-//     }
-//
-//     private String trimPSIName(String original) {
-//             String miName = null;
-//
-//             matcher = miNamePttr.matcher(original);
-//
-//             if (matcher.find()) {
-//                     miName = matcher.group();
-//                     miName = miName.substring(1, miName.length() - 1);
-//             } else {
-//                     miName = "-";
-//             }
-//
-//             return miName;
-//     }
-
-}

Modified: 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/simpleclient/PSICQUICSimpleClient.java
===================================================================
--- 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/simpleclient/PSICQUICSimpleClient.java
     2012-07-26 21:45:23 UTC (rev 30010)
+++ 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/simpleclient/PSICQUICSimpleClient.java
     2012-07-26 22:15:36 UTC (rev 30011)
@@ -108,6 +108,8 @@
                String strCount = streamToString(result);
                strCount = strCount.replaceAll("\n", "");
 
+               result.close();
+               
                return Long.parseLong(strCount);
        }
 

Modified: 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/task/ImportNetworkFromPSICQUICTask.java
===================================================================
--- 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/task/ImportNetworkFromPSICQUICTask.java
    2012-07-26 21:45:23 UTC (rev 30010)
+++ 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/task/ImportNetworkFromPSICQUICTask.java
    2012-07-26 22:15:36 UTC (rev 30011)
@@ -11,7 +11,6 @@
 import org.cytoscape.model.CyNetwork;
 import org.cytoscape.model.CyNetworkManager;
 import org.cytoscape.task.create.CreateNetworkViewTaskFactory;
-import org.cytoscape.view.model.CyNetworkView;
 import org.cytoscape.webservice.psicquic.PSICQUICRestClient;
 import org.cytoscape.webservice.psicquic.PSICQUICRestClient.SearchMode;
 import org.cytoscape.webservice.psicquic.RegistryManager;
@@ -21,6 +20,7 @@
 import org.slf4j.LoggerFactory;
 
 public class ImportNetworkFromPSICQUICTask extends AbstractTask {
+       
        private static final Logger logger = 
LoggerFactory.getLogger(ImportNetworkFromPSICQUICTask.class);
 
        private final PSICQUICRestClient client;
@@ -31,7 +31,6 @@
        private final CreateNetworkViewTaskFactory createViewTaskFactory;
 
        private String query;
-
        private Collection<String> targetServices;
 
        private Set<String> searchResult;
@@ -40,23 +39,20 @@
        private SearchRecoredsTask searchTask;
        
        private final SearchMode mode;
-       private final boolean toCluster;
-       private final CyNetworkView parentNetworkView;
+       private final boolean mergeNetworks;
        
        
        private volatile boolean canceled = false;
        
        public ImportNetworkFromPSICQUICTask(final String query, final 
PSICQUICRestClient client,
                        final CyNetworkManager manager, final RegistryManager 
registryManager, final Set<String> searchResult,
-                       final SearchMode mode, final 
CreateNetworkViewTaskFactory createViewTaskFactory, final boolean toCluster, 
final CyNetworkView parentNetworkView) {
+                       final SearchMode mode, final 
CreateNetworkViewTaskFactory createViewTaskFactory, final boolean toCluster) {
                this.client = client;
                this.manager = manager;
                this.registryManager = registryManager;
                this.query = query;
-               this.toCluster = toCluster;
-               this.parentNetworkView = parentNetworkView;
+               this.mergeNetworks = toCluster;
                
-
                this.searchResult = searchResult;
                this.mode = mode;
                this.createViewTaskFactory = createViewTaskFactory;
@@ -65,16 +61,15 @@
        public ImportNetworkFromPSICQUICTask(final String query, final 
PSICQUICRestClient client,
                        final CyNetworkManager manager, final RegistryManager 
registryManager, final SearchRecoredsTask searchTask,
                        final SearchMode mode, final 
CreateNetworkViewTaskFactory createViewTaskFactory) {
+               
                this.client = client;
                this.manager = manager;
                this.registryManager = registryManager;
                this.query = query;
-               this.toCluster = false;
-
+               this.mergeNetworks = false;
                this.searchTask = searchTask;
                this.mode = mode;
                this.createViewTaskFactory = createViewTaskFactory;
-               this.parentNetworkView = null;
        }
 
        @Override
@@ -85,62 +80,46 @@
                
                if(searchResult == null)
                        processSearchResult();
-               else {
+               else
                        targetServices = searchResult;
-               }
                
                if(searchResult == null)
                        throw new NullPointerException("Could not find search 
result");
-               
                if (query == null)
                        throw new NullPointerException("Query is null");
                if (targetServices == null)
                        throw new NullPointerException("Target service set is 
null");
 
                // Switch task type based on the user option.
-               if(toCluster) {
-                       final CyNetwork network = 
client.importClusteredNetwork(query, targetServices, mode, taskMonitor);
-                       result = new HashMap<String, CyNetwork>();
-                       result.put("clustered", network);
-               } else
-                       result = client.importNetwork(query, targetServices, 
mode, taskMonitor);
                
-               if(canceled) {
-                       result.clear();
-                       result = null;
-                       return;
-               }
-                       
                final Date date = new Date();
                final SimpleDateFormat timestamp = new 
SimpleDateFormat("yyyy/MM/dd K:mm:ss a, z");
                final String suffix = "(" + timestamp.format(date) + ")";
-               
-               // Register networks to the manager
-               final Set<CyNetwork> networks = new HashSet<CyNetwork>();
-               
-               if (toCluster) {
-                       final CyNetwork network = 
result.values().iterator().next();
-                       if(network != null) {
-                               network.getRow(network).set(CyNetwork.NAME, 
"Merged Network " + suffix);
-                               addNetworkData(network);
-                               manager.addNetwork(network);
-                               networks.add(network);
-                       }
+               result = new HashMap<String, CyNetwork>();
+               if(mergeNetworks) {
+                       final CyNetwork network = 
client.importMergedNetwork(query, targetServices, mode, taskMonitor);
+                       network.getRow(network).set(CyNetwork.NAME, "Merged 
Network " + suffix);
+                       addNetworkData(network);
+                       manager.addNetwork(network);
+                       result.put("clustered", network);
                } else {
-                       for (String sourceURL : result.keySet()) {
-                               final CyNetwork network = result.get(sourceURL);
-                               network.getRow(network).set(CyNetwork.NAME,
-                                               
registryManager.getSource2NameMap().get(sourceURL) + " " + suffix);
+                       final Collection<CyNetwork> networks = 
client.importNetworks(query, targetServices, mode, taskMonitor);
+                       for(CyNetwork network: networks) {
+                               final String networkName = 
network.getRow(network).get(CyNetwork.NAME, String.class) + " " + suffix;
+                               network.getRow(network).set(CyNetwork.NAME, 
networkName);
                                addNetworkData(network);
                                manager.addNetwork(network);
-                               networks.add(network);
+                               result.put(networkName, network);
                        }
                }
-
-               logger.debug(networks.size() + " networks created.");
+               if(canceled) {
+                       result.clear();
+                       result = null;
+                       return;
+               }
                
                if (!canceled)
-                       
insertTasksAfterCurrentTask(createViewTaskFactory.createTaskIterator(networks));
+                       
insertTasksAfterCurrentTask(createViewTaskFactory.createTaskIterator(result.values()));
        }
        
        @Override

Deleted: 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/ui/ResultDialog.java
===================================================================
--- 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/ui/ResultDialog.java
       2012-07-26 21:45:23 UTC (rev 30010)
+++ 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/ui/ResultDialog.java
       2012-07-26 22:15:36 UTC (rev 30011)
@@ -1,195 +0,0 @@
-package org.cytoscape.webservice.psicquic.ui;
-
-import java.awt.Frame;
-import java.net.URI;
-import java.util.Map;
-
-import javax.swing.GroupLayout;
-import javax.swing.JDialog;
-import javax.swing.LayoutStyle;
-import javax.swing.table.DefaultTableModel;
-
-/**
- * Display result of the query.
- * 
- */
-public class ResultDialog extends JDialog {
-
-       private static final long serialVersionUID = 6996385373168492882L;
-
-       private Map<URI, String> dbNames;
-       private DefaultTableModel model;
-
-       private boolean mergeNetworks;
-
-       /**
-        * Creates new form PSICQUICResultDialog
-        * 
-        */
-       public ResultDialog(Frame parent, boolean modal, Map<URI, String> 
dbNames) {
-               super(parent, modal);
-               this.dbNames = dbNames;
-               setTableModel();
-               initComponents();
-               mergeNetworks = false;
-       }
-
-       private void setTableModel() {
-               resultTable = new javax.swing.JTable(new DefaultTableModel() {
-                       @Override
-                       public boolean isCellEditable(int row, int column) {
-                               if (column == 0)
-                                       return false;
-                               else
-                                       return true;
-                       }
-               });
-
-               model = (DefaultTableModel) resultTable.getModel();
-               model.addColumn("Service URL", dbNames.keySet().toArray());
-               model.addColumn("Network Name (Please edit these if 
necessary)");
-               for (int i = 0; i < model.getRowCount(); i++) {
-                       model.setValueAt(dbNames.get(model.getValueAt(i, 0)), 
i, 1);
-               }
-
-               resultTable.getTableHeader().setReorderingAllowed(false);
-       }
-
-       /**
-        * This method is called from within the constructor to initialize the 
form.
-        * WARNING: Do NOT modify this code. The content of this method is 
always
-        * regenerated by the Form Editor.
-        */
-       @SuppressWarnings("unchecked")
-       // <editor-fold defaultstate="collapsed" desc="Generated Code">
-       private void initComponents() {
-               setTitle("PSICQUIC Import Result");
-
-               titlePanel = new javax.swing.JPanel();
-               titleLabel = new javax.swing.JLabel();
-               resultScrollPane = new javax.swing.JScrollPane();
-
-               buttonPanel = new javax.swing.JPanel();
-               okButton = new javax.swing.JButton();
-               mergeButton = new javax.swing.JButton();
-               mergeButton = new javax.swing.JButton();
-
-               
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
-               titlePanel.setBackground(java.awt.Color.white);
-
-               titleLabel.setFont(new java.awt.Font("SansSerif", 1, 14)); // 
NOI18N
-               titleLabel.setText("PSICQUIC Data Import Result");
-
-               GroupLayout titlePanelLayout = new GroupLayout(titlePanel);
-               titlePanel.setLayout(titlePanelLayout);
-               
titlePanelLayout.setHorizontalGroup(titlePanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
-                               .addGroup(
-                                               
titlePanelLayout.createSequentialGroup().addContainerGap().addComponent(titleLabel)
-                                                               
.addContainerGap(390, Short.MAX_VALUE)));
-               
titlePanelLayout.setVerticalGroup(titlePanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(
-                               
titlePanelLayout.createSequentialGroup().addContainerGap().addComponent(titleLabel)
-                                               
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
-
-               resultScrollPane.setBackground(java.awt.Color.white);
-
-               resultScrollPane.setViewportView(resultTable);
-
-               buttonPanel.setBackground(java.awt.Color.white);
-
-               okButton.setText("OK");
-               okButton.setPreferredSize(new java.awt.Dimension(70, 26));
-               okButton.addActionListener(new java.awt.event.ActionListener() {
-                       public void actionPerformed(java.awt.event.ActionEvent 
evt) {
-                               okButtonActionPerformed(evt);
-                       }
-               });
-
-               mergeButton.setText("Merge");
-               mergeButton.setPreferredSize(new java.awt.Dimension(70, 26));
-               mergeButton.addActionListener(new 
java.awt.event.ActionListener() {
-                       public void actionPerformed(java.awt.event.ActionEvent 
evt) {
-                               mergeButtonActionPerformed(evt);
-                       }
-               });
-
-               GroupLayout buttonPanelLayout = new GroupLayout(buttonPanel);
-               buttonPanel.setLayout(buttonPanelLayout);
-               
buttonPanelLayout.setHorizontalGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
-                               .addGroup(
-                                               GroupLayout.Alignment.TRAILING,
-                                               buttonPanelLayout
-                                                               
.createSequentialGroup()
-                                                               
.addContainerGap(491, Short.MAX_VALUE)
-                                                               
.addComponent(mergeButton, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
-                                                                               
GroupLayout.PREFERRED_SIZE)
-                                                               
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-                                                               
.addComponent(okButton, GroupLayout.PREFERRED_SIZE, 55, 
GroupLayout.PREFERRED_SIZE)
-                                                               
.addContainerGap()));
-               
buttonPanelLayout.setVerticalGroup(buttonPanelLayout.createParallelGroup(GroupLayout.Alignment.LEADING)
-                               .addGroup(
-                                               GroupLayout.Alignment.TRAILING,
-                                               buttonPanelLayout
-                                                               
.createSequentialGroup()
-                                                               
.addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-                                                               .addGroup(
-                                                                               
buttonPanelLayout
-                                                                               
                .createParallelGroup(GroupLayout.Alignment.BASELINE)
-                                                                               
                .addComponent(okButton, GroupLayout.PREFERRED_SIZE,
-                                                                               
                                GroupLayout.DEFAULT_SIZE, 
GroupLayout.PREFERRED_SIZE)
-                                                                               
                .addComponent(mergeButton, GroupLayout.PREFERRED_SIZE,
-                                                                               
                                GroupLayout.DEFAULT_SIZE, 
GroupLayout.PREFERRED_SIZE))
-                                                               
.addContainerGap()));
-
-               GroupLayout layout = new GroupLayout(getContentPane());
-               getContentPane().setLayout(layout);
-               
layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
-                               .addComponent(titlePanel, 
GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
-                               .addComponent(resultScrollPane, 
GroupLayout.DEFAULT_SIZE, 614, Short.MAX_VALUE)
-                               .addComponent(buttonPanel, 
GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE));
-               
layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(
-                               layout.createSequentialGroup()
-                                               .addComponent(titlePanel, 
GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
-                                                               
GroupLayout.PREFERRED_SIZE)
-                                               
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-                                               .addComponent(resultScrollPane, 
GroupLayout.DEFAULT_SIZE, 173, Short.MAX_VALUE)
-                                               
.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
-                                               .addComponent(buttonPanel, 
GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
-                                                               
GroupLayout.PREFERRED_SIZE)));
-
-               pack();
-       }// </editor-fold>
-
-       private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {
-               this.dispose();
-       }
-
-       private void mergeButtonActionPerformed(java.awt.event.ActionEvent evt) 
{
-               mergeNetworks = true;
-               this.dispose();
-       }
-
-       public boolean isMerge() {
-               return mergeNetworks;
-       }
-
-       public Map<URI, String> getNewNames() {
-               for (int i = 0; i < resultTable.getModel().getRowCount(); i++) {
-                       // TODO: FIXME use suggested network naming utility.
-                       final String newName = 
resultTable.getModel().getValueAt(i, 1).toString();
-                       dbNames.put((URI) resultTable.getModel().getValueAt(i, 
0), newName);
-               }
-               return dbNames;
-       }
-
-       // Variables declaration - do not modify
-       private javax.swing.JPanel buttonPanel;
-       private javax.swing.JButton mergeButton;
-       private javax.swing.JButton okButton;
-       private javax.swing.JScrollPane resultScrollPane;
-       private javax.swing.JTable resultTable;
-       private javax.swing.JLabel titleLabel;
-       private javax.swing.JPanel titlePanel;
-       // End of variables declaration
-
-}

Modified: 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/ui/SourceStatusPanel.java
===================================================================
--- 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/ui/SourceStatusPanel.java
  2012-07-26 21:45:23 UTC (rev 30010)
+++ 
core3/impl/trunk/webservice-psicquic-client-impl/src/main/java/org/cytoscape/webservice/psicquic/ui/SourceStatusPanel.java
  2012-07-26 22:15:36 UTC (rev 30011)
@@ -337,20 +337,20 @@
 
        private void importButtonActionPerformed(ActionEvent evt) {
 
-               final boolean toBeClustered = 
clusterResultCheckBox.isSelected();
+               final boolean mergeNetwork = clusterResultCheckBox.isSelected();
+               
                final Set<String> targetSources = getSelected();
                final Set<String> sourceURLs = new HashSet<String>();
-               for (String source : targetSources) {
+               for (String source : targetSources)
                        sourceURLs.add(manager.getActiveServices().get(source));
-               }
 
                // Execute Import Task
                final ImportNetworkFromPSICQUICTask networkTask = new 
ImportNetworkFromPSICQUICTask(query, client,
-                               networkManager, manager, sourceURLs, mode, 
createViewTaskFactory, toBeClustered, null);
+                               networkManager, manager, sourceURLs, mode, 
createViewTaskFactory, mergeNetwork);
 
                taskManager.execute(new TaskIterator(networkTask));
 
-               Window parentWindow = ((Window) getRootPane().getParent());
+               final Window parentWindow = ((Window) 
getRootPane().getParent());
                parentWindow.pack();
                repaint();
 

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