From: Jim Procter Date: Wed, 25 Sep 2013 15:30:37 +0000 (+0100) Subject: JAL-1365 use AlignAnalysisUIText class to provide metadata for a service's UI elements X-Git-Tag: Jalview_2_9~200^2~21^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=6c54f6a2f72b57aa1f803d68241549e050ae68e8;p=jalview.git JAL-1365 use AlignAnalysisUIText class to provide metadata for a service's UI elements --- diff --git a/src/jalview/ws/jws2/AAConClient.java b/src/jalview/ws/jws2/AAConClient.java index 3d50026..2750293 100644 --- a/src/jalview/ws/jws2/AAConClient.java +++ b/src/jalview/ws/jws2/AAConClient.java @@ -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."); } } diff --git a/src/jalview/ws/jws2/JabaWsServerQuery.java b/src/jalview/ws/jws2/JabaWsServerQuery.java index 8bf8a94..fe61ff3 100644 --- a/src/jalview/ws/jws2/JabaWsServerQuery.java +++ b/src/jalview/ws/jws2/JabaWsServerQuery.java @@ -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); diff --git a/src/jalview/ws/jws2/RNAalifoldClient.java b/src/jalview/ws/jws2/RNAalifoldClient.java index b8b30c5..2779732 100644 --- a/src/jalview/ws/jws2/RNAalifoldClient.java +++ b/src/jalview/ws/jws2/RNAalifoldClient.java @@ -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 diff --git a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java index aa42ff7..509b96f 100644 --- a/src/jalview/ws/jws2/jabaws2/Jws2Instance.java +++ b/src/jalview/ws/jws2/jabaws2/Jws2Instance.java @@ -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 index 0000000..3923bba --- /dev/null +++ b/src/jalview/ws/jws2/jabaws2/Jws2InstanceFactory.java @@ -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 aaConGUI; + + private static void init() + { + if (aaConGUI == null) + { + aaConGUI = new HashMap(); + 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; + } + +}