JAL-1517 source formatting
[jalview.git] / src / jalview / ws / jws2 / SequenceAnnotationWSClient.java
index cbf7c29..77ba300 100644 (file)
@@ -63,31 +63,31 @@ public class SequenceAnnotationWSClient extends Jws2Client
     initSequenceAnnotationWSClient(sh, alignFrame, preset, editParams);
   }
 
-  // dan think. Do I need to change this method to run RNAalifold through the GUI
-  
+  // dan think. Do I need to change this method to run RNAalifold through the
+  // GUI
+
   public void initSequenceAnnotationWSClient(final Jws2Instance sh,
           AlignFrame alignFrame, WsParamSetI preset, boolean editParams)
   {
-       // dan changed! dan test. comment out if conditional
-//    if (alignFrame.getViewport().getAlignment().isNucleotide())
-//    {
-//      JOptionPane.showMessageDialog(Desktop.desktop, sh.serviceType
-//              + " can only be used\nfor amino acid alignments.",
-//              "Wrong type of sequences!", JOptionPane.WARNING_MESSAGE);
-//      return;
-//
-//    }
+    // dan changed! dan test. comment out if conditional
+    // if (alignFrame.getViewport().getAlignment().isNucleotide())
+    // {
+    // JOptionPane.showMessageDialog(Desktop.desktop, sh.serviceType
+    // + " can only be used\nfor amino acid alignments.",
+    // "Wrong type of sequences!", JOptionPane.WARNING_MESSAGE);
+    // return;
+    //
+    // }
     AlignAnalysisUIText aaui = sh.getAlignAnalysisUI();
-    if (aaui!=null)
+    if (aaui != null)
     {
       Class clientClass = aaui.getClient();
-      
+
       // Build an AACon style client - take alignment, return annotation for
       // columns
 
       List<AlignCalcWorkerI> clnts = alignFrame.getViewport()
-              .getCalcManager()
-              .getRegisteredWorkersOfClass(clientClass);
+              .getCalcManager().getRegisteredWorkersOfClass(clientClass);
       JabawsAlignCalcWorker worker;
       if (clnts == null || clnts.size() == 0)
       {
@@ -95,21 +95,20 @@ public class SequenceAnnotationWSClient extends Jws2Client
         {
           return;
         }
-        try {
-          worker = (JabawsAlignCalcWorker) (clientClass.getConstructor(
-                  new Class[] { Jws2Instance.class, 
-                          AlignFrame.class, WsParamSetI.class, 
-                          List.class }).newInstance(new Object[] { sh, alignFrame, this.preset, paramset}));
+        try
+        {
+          worker = (JabawsAlignCalcWorker) (clientClass
+                  .getConstructor(new Class[]
+                  { Jws2Instance.class, AlignFrame.class,
+                      WsParamSetI.class, List.class })
+                  .newInstance(new Object[]
+                  { sh, alignFrame, this.preset, paramset }));
         } catch (Exception x)
         {
           x.printStackTrace();
-          throw new Error("Implementation error",x);
+          throw new Error("Implementation error", x);
         }
-        alignFrame
-                .getViewport()
-                .getCalcManager()
-                .registerWorker(
-                        worker);
+        alignFrame.getViewport().getCalcManager().registerWorker(worker);
         alignFrame.getViewport().getCalcManager().startWorker(worker);
 
       }
@@ -166,7 +165,8 @@ public class SequenceAnnotationWSClient extends Jws2Client
   public void attachWSMenuEntry(JMenu wsmenu, final Jws2Instance service,
           final AlignFrame alignFrame)
   {
-    if (registerAAConWSInstance(wsmenu, service, alignFrame)) {
+    if (registerAAConWSInstance(wsmenu, service, alignFrame))
+    {
       // Alignment dependent analysis calculation WS gui
       return;
     }
@@ -175,7 +175,9 @@ public class SequenceAnnotationWSClient extends Jws2Client
     String calcName = service.serviceType.substring(0,
             service.serviceType.length() - 2);
 
-    JMenuItem annotservice = new JMenuItem(MessageManager.formatMessage("label.calcname_with_default_settings", new String[]{calcName}));
+    JMenuItem annotservice = new JMenuItem(MessageManager.formatMessage(
+            "label.calcname_with_default_settings", new String[]
+            { calcName }));
     annotservice.addActionListener(new ActionListener()
     {
 
@@ -190,9 +192,11 @@ public class SequenceAnnotationWSClient extends Jws2Client
     {
       // only add these menu options if the service has user-modifiable
       // arguments
-      annotservice = new JMenuItem(MessageManager.getString("label.edit_settings_and_run"));
+      annotservice = new JMenuItem(
+              MessageManager.getString("label.edit_settings_and_run"));
       annotservice
-              .setToolTipText(MessageManager.getString("label.view_and_change_parameters_before_running_calculation"));
+              .setToolTipText(MessageManager
+                      .getString("label.view_and_change_parameters_before_running_calculation"));
 
       annotservice.addActionListener(new ActionListener()
       {
@@ -232,7 +236,8 @@ public class SequenceAnnotationWSClient extends Jws2Client
     }
     else
     {
-      annotservice = new JMenuItem(MessageManager.getString("label.view_documentation"));
+      annotservice = new JMenuItem(
+              MessageManager.getString("label.view_documentation"));
       if (service.docUrl != null)
       {
         annotservice.addActionListener(new ActionListener()
@@ -253,18 +258,19 @@ public class SequenceAnnotationWSClient extends Jws2Client
     }
   }
 
-  
   private boolean registerAAConWSInstance(final JMenu wsmenu,
           final Jws2Instance service, final AlignFrame alignFrame)
   {
-    final AlignAnalysisUIText aaui = service.getAlignAnalysisUI(); // null ; // AlignAnalysisUIText.aaConGUI.get(service.serviceType.toString());
-    if (aaui==null)
+    final AlignAnalysisUIText aaui = service.getAlignAnalysisUI(); // null ; //
+                                                                   // AlignAnalysisUIText.aaConGUI.get(service.serviceType.toString());
+    if (aaui == null)
     {
       // not an instantaneous calculation GUI type service
       return false;
     }
-    // create the instaneous calculation GUI bits and update state if existing GUI elements already present
-    
+    // create the instaneous calculation GUI bits and update state if existing
+    // GUI elements already present
+
     JCheckBoxMenuItem _aaConEnabled = null;
     for (int i = 0; i < wsmenu.getItemCount(); i++)
     {
@@ -283,7 +289,8 @@ public class SequenceAnnotationWSClient extends Jws2Client
               .getRegisteredWorkersOfClass(aaui.getClient());
       if (aaconClient != null && aaconClient.size() > 0)
       {
-        JabawsAlignCalcWorker worker = (JabawsAlignCalcWorker) aaconClient.get(0);
+        JabawsAlignCalcWorker worker = (JabawsAlignCalcWorker) aaconClient
+                .get(0);
         if (!worker.service.hosturl.equals(service.hosturl))
         {
           // javax.swing.SwingUtilities.invokeLater(new Runnable()
@@ -307,8 +314,8 @@ public class SequenceAnnotationWSClient extends Jws2Client
               aaui.getAAconToggle());
 
       aaConEnabled.setToolTipText("<html><p>"
-              + JvSwingUtils.wrapTooltip(aaui.getAAconToggleTooltip() + "</p>")
-              + "</html>");
+              + JvSwingUtils.wrapTooltip(aaui.getAAconToggleTooltip()
+                      + "</p>") + "</html>");
       aaConEnabled.addActionListener(new ActionListener()
       {
         @Override
@@ -332,8 +339,8 @@ public class SequenceAnnotationWSClient extends Jws2Client
       wsmenu.add(aaConEnabled);
       final JMenuItem modifyParams = new JMenuItem(aaui.getAAeditSettings());
       modifyParams.setToolTipText("<html><p>"
-              + JvSwingUtils.wrapTooltip(aaui.getAAeditSettingsTooltip() + "</p>")
-              + "</html>");
+              + JvSwingUtils.wrapTooltip(aaui.getAAeditSettingsTooltip()
+                      + "</p>") + "</html>");
       modifyParams.addActionListener(new ActionListener()
       {
 
@@ -351,12 +358,14 @@ public class SequenceAnnotationWSClient extends Jws2Client
         public void menuSelected(MenuEvent arg0)
         {
           // TODO: refactor to the implementing class.
-          if (alignFrame.getViewport().getAlignment()
-                  .isNucleotide() ? aaui.isNa() : aaui.isPr()) {
+          if (alignFrame.getViewport().getAlignment().isNucleotide() ? aaui
+                  .isNa() : aaui.isPr())
+          {
             aaConEnabled.setEnabled(true);
             modifyParams.setEnabled(true);
           }
-          else {
+          else
+          {
             aaConEnabled.setEnabled(false);
             modifyParams.setEnabled(false);
           }
@@ -392,7 +401,8 @@ public class SequenceAnnotationWSClient extends Jws2Client
     return true;
   }
 
-  private static void showAAConAnnotationSettingsFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame)
+  private static void showAAConAnnotationSettingsFor(
+          final AlignAnalysisUIText aaui, AlignFrame alignFrame)
   {
     /*
      * preferred settings Whether AACon is automatically recalculated Which
@@ -409,12 +419,14 @@ public class SequenceAnnotationWSClient extends Jws2Client
 
   }
 
-  private static void buildCurrentAAConWorkerFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame)
+  private static void buildCurrentAAConWorkerFor(
+          final AlignAnalysisUIText aaui, AlignFrame alignFrame)
   {
     buildCurrentAAConWorkerFor(aaui, alignFrame, null);
   }
 
-  private static void buildCurrentAAConWorkerFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame,
+  private static void buildCurrentAAConWorkerFor(
+          final AlignAnalysisUIText aaui, AlignFrame alignFrame,
           Jws2Instance service)
   {
     /*
@@ -440,13 +452,14 @@ public class SequenceAnnotationWSClient extends Jws2Client
     new SequenceAnnotationWSClient(fave, alignFrame, false);
   }
 
-  private static AAConSettings createDefaultAAConSettings(AlignAnalysisUIText aaui)
+  private static AAConSettings createDefaultAAConSettings(
+          AlignAnalysisUIText aaui)
   {
     return createDefaultAAConSettings(aaui, null);
   }
 
-  private static AAConSettings createDefaultAAConSettings(AlignAnalysisUIText aaui,
-          Jws2Instance service)
+  private static AAConSettings createDefaultAAConSettings(
+          AlignAnalysisUIText aaui, Jws2Instance service)
   {
     if (service != null)
     {
@@ -484,7 +497,8 @@ public class SequenceAnnotationWSClient extends Jws2Client
     return new AAConSettings(true, service, null, null);
   }
 
-  private static void removeCurrentAAConWorkerFor(AlignAnalysisUIText aaui, AlignFrame alignFrame)
+  private static void removeCurrentAAConWorkerFor(AlignAnalysisUIText aaui,
+          AlignFrame alignFrame)
   {
     alignFrame.getViewport().getCalcManager()
             .removeRegisteredWorkersOfClass(aaui.getClient());