Author: scooter
Date: 2011-10-26 13:43:45 -0700 (Wed, 26 Oct 2011)
New Revision: 27311

Modified:
   
csplugins/trunk/ucsf/scooter/SFLDLoader/src/SFLDLoader/ui/SFLDQueryDialog.java
Log:
More UI fixes


Modified: 
csplugins/trunk/ucsf/scooter/SFLDLoader/src/SFLDLoader/ui/SFLDQueryDialog.java
===================================================================
--- 
csplugins/trunk/ucsf/scooter/SFLDLoader/src/SFLDLoader/ui/SFLDQueryDialog.java  
    2011-10-26 20:18:04 UTC (rev 27310)
+++ 
csplugins/trunk/ucsf/scooter/SFLDLoader/src/SFLDLoader/ui/SFLDQueryDialog.java  
    2011-10-26 20:43:45 UTC (rev 27311)
@@ -313,19 +313,23 @@
                }
                infoTextPanel.removeAll();
                JEditorPane description = null;
+               JScrollPane scrollPane = new JScrollPane();
+               scrollPane.setVerticalScrollBarPolicy( 
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
+               scrollPane.setPreferredSize(new Dimension(800, 300));
+               scrollPane.setMinimumSize(new Dimension(700, 10));
+               infoTextPanel.add(scrollPane);
                try {
                        if (group == null) 
                                description = new 
JEditorPane("text/plain",null);
-                       else
-                               description = new JEditorPane(URI);
+                       else {
+                               description = new JEditorPane("text/plain", 
"Fetching page...");
+                               fetchContent(infoTextPanel, scrollPane, URI);
+                       }
                } catch (Exception e) {
                        logger.error(e.getMessage());
+                       return;
                }
-               JScrollPane scrollPane = new JScrollPane(description);
-               scrollPane.setVerticalScrollBarPolicy( 
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS );
-               scrollPane.setPreferredSize(new Dimension(800, 300));
-               scrollPane.setMinimumSize(new Dimension(700, 10));
-               infoTextPanel.add(scrollPane);
+               scrollPane.setViewportView(description);
                pack();
                setVisible(true);
                infoTextPanel.repaint();
@@ -386,6 +390,31 @@
                return layoutAlgorithm;
        }
 
+       private void fetchContent(JPanel infoTextPanel, JScrollPane scrollPane, 
String uri) {
+               Thread t = new PageFetch(infoTextPanel, scrollPane, uri);
+               t.start();
+
+       }
+
+       private class PageFetch extends Thread {
+               JScrollPane scrollPane;
+               String uri;
+               public PageFetch(JPanel infoTextPanel, JScrollPane scrollPane, 
String uri) {
+                       this.scrollPane = scrollPane;
+                       this.uri = uri;
+               }
+               
+               public void run() {
+                       JEditorPane jep = null;
+                       try {
+                               jep = new JEditorPane(uri);
+                       } catch (Exception e) {
+                               jep = new JEditorPane("text/plain", "Unable to 
fetch page: "+e.getMessage());
+                       }
+                       scrollPane.setViewportView(jep);
+               }
+       }
+
        public class BrowseTableModel extends AbstractTableModel 
                                      implements ListSelectionListener {
                final String[] columnNames = 
{"Superfamily","SubGroup","Family"};
@@ -536,12 +565,13 @@
                                                Family fam = 
selSubgroup.getFamily(selectedRows[0]);
                                                if (selFamilies.size() > 0 && 
selFamilies.contains(fam)) {
                                                        // Deselect
-                                                       selFamilies.add(fam);
+                                                       selFamilies.remove(fam);
                                                } else {
                                                        selFamilies.add(fam);
                                                }
                                        } else {
                                                for (int i = 0; i < 
selectedRows.length; i++) {
+                                                       
System.out.println("Selecting row "+i);
                                                        
selFamilies.add(selSubgroup.getFamily(selectedRows[i]));
                                                }
                                        }
@@ -553,6 +583,7 @@
                                                
descTitleBorder.setTitle("Multiple families");
                                                getDescription(null);
                                        }
+                                       fireTableDataChanged();
                                }
                                loadNetworkButton.setEnabled(true);
                                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