JAL-2738 copy to spikes/mungo
[jalview.git] / src / jalview / gui / DasSourceBrowser.java
index c5ec067..8570ac3 100644 (file)
@@ -52,8 +52,8 @@ import org.biodas.jdas.schema.sources.COORDINATES;
 import org.biodas.jdas.schema.sources.PROP;
 import org.biodas.jdas.schema.sources.VERSION;
 
-public class DasSourceBrowser extends GDasSourceBrowser implements
-        Runnable, ListSelectionListener
+public class DasSourceBrowser extends GDasSourceBrowser
+        implements Runnable, ListSelectionListener
 {
   DasSourceRegistryI sourceRegistry = null;
 
@@ -138,8 +138,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     for (int i = 0; i < dSize; i++)
     {
       data[i][0] = sources.get(i).getTitle(); // what's equivalent of nickname
-      data[i][1] = new Boolean(selectedSources.contains(sources.get(i)
-              .getTitle()));
+      data[i][1] = new Boolean(
+              selectedSources.contains(sources.get(i).getTitle()));
     }
 
     refreshTableData(data);
@@ -177,9 +177,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
 
     if (nickName == null)
     {
-      fullDetails.setText(text
-              + MessageManager
-                      .getString("label.select_das_service_from_table"));
+      fullDetails.setText(text + MessageManager
+              .getString("label.select_das_service_from_table"));
       return;
     }
 
@@ -192,8 +191,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       }
 
       VERSION latest = ds.getVersion();
-      text.append("<font color=\"#0000FF\">Id:</font> " + ds.getUri()
-              + "<br>");
+      text.append(
+              "<font color=\"#0000FF\">Id:</font> " + ds.getUri() + "<br>");
       text.append("<font color=\"#0000FF\">Nickname:</font> "
               + ds.getTitle() + "<br>");
 
@@ -212,8 +211,10 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
         text.append("<font color=\"#0000FF\">Description:</font> "
                 + ds.getDescription() + "<br>");
 
-        text.append("<font color=\"#0000FF\">Admin Email:</font> <a href=\"mailto:"
-                + ds.getEmail() + "\">" + ds.getEmail() + "</a>" + "<br>");
+        text.append(
+                "<font color=\"#0000FF\">Admin Email:</font> <a href=\"mailto:"
+                        + ds.getEmail() + "\">" + ds.getEmail() + "</a>"
+                        + "<br>");
 
         text.append("<font color=\"#0000FF\">Registered at:</font> "
                 + latest.getCreated() + "<br>");
@@ -460,8 +461,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     panel.add(pane12, BorderLayout.SOUTH);
 
     int reply = JvOptionPane.showInternalConfirmDialog(Desktop.desktop,
-            panel,
-            MessageManager.getString("label.enter_local_das_source"),
+            panel, MessageManager.getString("label.enter_local_das_source"),
             JvOptionPane.OK_CANCEL_OPTION);
 
     if (reply != JvOptionPane.OK_OPTION)
@@ -474,19 +474,21 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       urltf.setText(urltf.getText() + "/");
     }
 
-    jalviewSourceI local = sourceRegistry.createLocalSource(
-            urltf.getText(), nametf.getText(), seqs.isSelected(), true);
+    jalviewSourceI local = sourceRegistry.createLocalSource(urltf.getText(),
+            nametf.getText(), seqs.isSelected(), true);
     List sources = sourceRegistry.getSources();
     int osize = sources.size();
     int size = osize + (newSource ? 1 : 0);
 
     Object[][] data = new Object[size][2];
-    DASTableModel dtm = (table != null) ? (DASTableModel) ((TableSorter) table
-            .getModel()).getTableModel() : null;
+    DASTableModel dtm = (table != null)
+            ? (DASTableModel) ((TableSorter) table.getModel())
+                    .getTableModel()
+            : null;
     for (int i = 0; i < osize; i++)
     {
-      String osrc = (dtm == null || i >= osize) ? null : (String) dtm
-              .getValueAt(i, 0);
+      String osrc = (dtm == null || i >= osize) ? null
+              : (String) dtm.getValueAt(i, 0);
       if (!newSource && osrc != null
               && dtm.getValueAt(i, 0).equals(nickname))
       {
@@ -514,8 +516,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       @Override
       public void run()
       {
-        scrollPane.getVerticalScrollBar().setValue(
-                scrollPane.getVerticalScrollBar().getMaximum());
+        scrollPane.getVerticalScrollBar()
+                .setValue(scrollPane.getVerticalScrollBar().getMaximum());
       }
     });
 
@@ -534,13 +536,11 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
 
     if (!sourceRegistry.getSource(nickname).isLocal())
     {
-      JvOptionPane
-              .showInternalMessageDialog(
-                      Desktop.desktop,
-                      MessageManager
-                              .getString("label.you_can_only_edit_or_remove_local_das_sources"),
-                      MessageManager.getString("label.public_das_source"),
-                      JvOptionPane.WARNING_MESSAGE);
+      JvOptionPane.showInternalMessageDialog(Desktop.desktop,
+              MessageManager.getString(
+                      "label.you_can_only_edit_or_remove_local_das_sources"),
+              MessageManager.getString("label.public_das_source"),
+              JvOptionPane.WARNING_MESSAGE);
       return;
     }
 
@@ -548,8 +548,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
     int choice = JvOptionPane.showInternalOptionDialog(Desktop.desktop,
             "Do you want to edit or remove " + nickname + "?",
             "Edit / Remove Local DAS Source",
-            JvOptionPane.YES_NO_CANCEL_OPTION, JvOptionPane.QUESTION_MESSAGE,
-            null, options, options[2]);
+            JvOptionPane.YES_NO_CANCEL_OPTION,
+            JvOptionPane.QUESTION_MESSAGE, null, options, options[2]);
 
     switch (choice)
     {
@@ -560,8 +560,7 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       sourceRegistry.removeLocalSource(sourceRegistry.getSource(nickname));
       selectedSources.remove(nickname);
       Object[][] data = new Object[sourceRegistry.getSources().size()][2];
-      int index = 0,
-      l = table.getRowCount();
+      int index = 0, l = table.getRowCount();
 
       for (int i = 0; i < l; i++)
       {
@@ -583,8 +582,8 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
         @Override
         public void run()
         {
-          scrollPane.getVerticalScrollBar().setValue(
-                  scrollPane.getVerticalScrollBar().getMaximum());
+          scrollPane.getVerticalScrollBar()
+                  .setValue(scrollPane.getVerticalScrollBar().getMaximum());
         }
       });
 
@@ -618,11 +617,10 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
 
       VERSION v = ds.getVersion();
       List<COORDINATES> coords = v.getCOORDINATES();
-      if (ds.isLocal()
-              || ((coords == null || coords.size() == 0)
-                      && filter1.getSelectedIndex() == 0
-                      && filter2.getSelectedIndex() == 0 && filter3
-                      .getSelectedIndex() == 0))
+      if (ds.isLocal() || ((coords == null || coords.size() == 0)
+              && filter1.getSelectedIndex() == 0
+              && filter2.getSelectedIndex() == 0
+              && filter3.getSelectedIndex() == 0))
       {
         // THIS IS A FIX FOR LOCAL SOURCES WHICH DO NOT
         // HAVE COORDINATE SYSTEMS, INFO WHICH AT PRESENT
@@ -642,12 +640,14 @@ public class DasSourceBrowser extends GDasSourceBrowser implements
       for (int j = 0; j < coords.size(); j++)
       {
         if (selectedInList(filter1.getSelectedValues(),
-                new String[] { coords.get(j).getAuthority() })
+                new String[]
+                { coords.get(j).getAuthority() })
                 && selectedInList(filter2.getSelectedValues(), new String[]
                 { coords.get(j).getSource() }))
         {
           names.add(ds.getTitle());
-          selected.add(new Boolean(selectedSources.contains(ds.getTitle())));
+          selected.add(
+                  new Boolean(selectedSources.contains(ds.getTitle())));
           break;
         }
       }