JAL-1365 use AlignAnalysisUIText class to provide metadata for a service's UI elements
authorJim Procter <jprocter@compbio.dundee.ac.uk>
Wed, 25 Sep 2013 15:30:37 +0000 (16:30 +0100)
committerJim Procter <jprocter@compbio.dundee.ac.uk>
Wed, 25 Sep 2013 15:30:37 +0000 (16:30 +0100)
src/jalview/ws/jws2/AAConClient.java
src/jalview/ws/jws2/JabaWsServerQuery.java
src/jalview/ws/jws2/RNAalifoldClient.java
src/jalview/ws/jws2/jabaws2/Jws2Instance.java
src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java [new file with mode: 0644]

index 3d50026..2750293 100644 (file)
@@ -23,6 +23,7 @@ import jalview.gui.AlignmentPanel;
 import jalview.ws.jws2.dm.AAConSettings;
 import jalview.ws.jws2.jabaws2.Jws2Instance;
 import jalview.ws.params.WsParamSetI;
+import jalview.ws.uimodel.AlignAnalysisUIText;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -104,6 +105,14 @@ public class AAConClient extends JabawsAlignCalcWorker
   }
   private static String CALC_ID="jabaws2.AACon";
 
+  public static AlignAnalysisUIText getAlignAnalysisUITest()
   {
+    return new AlignAnalysisUIText(
+            compbio.ws.client.Services.AAConWS.toString(),
+            jalview.ws.jws2.AAConClient.class, CALC_ID, false, true, true,
+            "AACon Calculations",
+            "When checked, AACon calculations are updated automatically.",
+            "Change AACon Settings...",
+            "Modify settings for AACon calculations.");
   }
 }
index 8bf8a94..fe61ff3 100644 (file)
@@ -22,6 +22,7 @@ package jalview.ws.jws2;
 
 import jalview.bin.Cache;
 import jalview.ws.jws2.jabaws2.Jws2Instance;
+import jalview.ws.jws2.jabaws2.Jws2InstanceFactory;
 
 import java.util.HashSet;
 import java.util.Set;
@@ -177,12 +178,12 @@ public class JabaWsServerQuery implements Runnable
 
                 String description = registry.getServiceDescription(srv);
 
-                svc = new Jws2Instance(jwsservers, srv.toString(),
+                svc = Jws2InstanceFactory.newJws2Instance(jwsservers, srv.toString(),
                         cat.name, description, service);
               }
               if (svc == null)
               {
-                svc = new Jws2Instance(jwsservers, srv.toString(),
+                svc = Jws2InstanceFactory.newJws2Instance(jwsservers, srv.toString(),
                         cat.name, "JABAWS 1 Alignment Service", service);
               }
               jws2Discoverer.addService(jwsservers, svc);
index b8b30c5..2779732 100644 (file)
@@ -7,6 +7,7 @@ import jalview.gui.AlignFrame;
 import jalview.ws.jws2.dm.AAConSettings;
 import jalview.ws.jws2.jabaws2.Jws2Instance;
 import jalview.ws.params.WsParamSetI;
+import jalview.ws.uimodel.AlignAnalysisUIText;
 
 import java.text.MessageFormat;
 import java.util.ArrayList;
@@ -62,7 +63,20 @@ public class RNAalifoldClient extends JabawsAlignCalcWorker implements
   }
   private static String CALC_ID="jalview.ws.jws2.RNAalifoldClient";
 
+  public static AlignAnalysisUIText getAlignAnalysisUITest()
   {
+    return new AlignAnalysisUIText(
+            compbio.ws.client.Services.RNAalifoldWS.toString(),
+            jalview.ws.jws2.RNAalifoldClient.class,
+            CALC_ID,
+            true,
+            false,
+            true,
+            "RNAAliFold Prediction",
+            "When checked, RNA secondary structure predictions will be calculated for the alignment, and updated when edits are made.",
+            "Change RNAAliFold settings...",
+            "Modify settings for the RNAAliFold prediction. Use this to hide or show different results of the RNA calculation, and change RNA folding parameters");
+
   }
 
   @Override
index aa42ff7..509b96f 100644 (file)
@@ -48,6 +48,14 @@ public class Jws2Instance
 
   public String docUrl;
 
+  /**
+   * 
+   * @param hosturl Service endpoint
+   * @param serviceType Category for this service's analysis
+   * @param action text describing their action that service performs (eg 'aligning', 'analysing')
+   * @param description Description from JABAWS registry
+   * @param service JABAWS registry ID for service
+   */
   public Jws2Instance(String hosturl, String serviceType, String action,
           String description, JABAService service)
   {
@@ -224,4 +232,9 @@ public class Jws2Instance
   {
     return "java:" + serviceType;
   }
+  jalview.ws.uimodel.AlignAnalysisUIText aaui;
+  public jalview.ws.uimodel.AlignAnalysisUIText getAlignAnalysisUI()
+  {
+    return aaui;
+  }
 }
diff --git a/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java b/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java
new file mode 100644 (file)
index 0000000..3923bba
--- /dev/null
@@ -0,0 +1,50 @@
+package jalview.ws.jws2.jabaws2;
+
+import java.util.HashMap;
+
+import compbio.data.msa.JABAService;
+
+import jalview.ws.jws2.AAConClient;
+import jalview.ws.jws2.RNAalifoldClient;
+import jalview.ws.uimodel.AlignAnalysisUIText;
+
+public class Jws2InstanceFactory
+{
+  private static HashMap<String, AlignAnalysisUIText> aaConGUI;
+
+  private static void init()
+  {
+    if (aaConGUI == null)
+    {
+      aaConGUI = new HashMap<String, AlignAnalysisUIText>();
+      aaConGUI.put(compbio.ws.client.Services.AAConWS.toString(),
+              AAConClient.getAlignAnalysisUITest());
+      aaConGUI.put(compbio.ws.client.Services.RNAalifoldWS.toString(),
+              RNAalifoldClient.getAlignAnalysisUITest());
+    }
+  }
+
+  /**
+   * construct a service instance and configure it with any additional
+   * properties needed so Jalview can access it correctly
+   * 
+   * @param jwsservers
+   * @param serviceType
+   * @param name
+   * @param description
+   * @param service
+   * @return
+   */
+  public static Jws2Instance newJws2Instance(String jwsservers,
+          String serviceType, String name, String description,
+          JABAService service)
+  {
+    init();
+    Jws2Instance svc = new Jws2Instance(jwsservers, serviceType, name,
+            description, service);
+    
+    svc.aaui = aaConGUI.get(serviceType.toString());
+    return svc;
+  }
+
+}