"
+ + JvSwingUtils.wrapTooltip(""
+ + (preset.isModifiable() ? "User Preset"
+ : "Service Preset") + "
"
+ + preset.getDescription() + "
"
- + JvSwingUtils.wrapTooltip(""
- + (preset.isModifiable() ? "User Preset"
- : "Service Preset") + "
"
- + preset.getDescription() + "
" + + JvSwingUtils.wrapTooltip(aaui.getAAconToggleTooltip() + "
") + + ""); + aaConEnabled.addActionListener(new ActionListener() + { + @Override + public void actionPerformed(ActionEvent arg0) + { + List" + + JvSwingUtils.wrapTooltip(aaui.getAAeditSettingsTooltip() + "
") + + ""); + modifyParams.addActionListener(new ActionListener() + { + + @Override + public void actionPerformed(ActionEvent arg0) + { + showAAConAnnotationSettingsFor(aaui, alignFrame); + } + }); + wsmenu.add(modifyParams); + + } + return true; + } + + private static void showAAConAnnotationSettingsFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame) + { + /* + * preferred settings Whether AACon is automatically recalculated Which + * AACon server to use What parameters to use + */ + // could actually do a class search for this too + AAConSettings fave = (AAConSettings) alignFrame.getViewport() + .getCalcIdSettingsFor(aaui.getCalcId()); + if (fave == null) + { + fave = createDefaultAAConSettings(aaui); + } + new SequenceAnnotationWSClient(fave, alignFrame, true); + + } + + private static void buildCurrentAAConWorkerFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame) + { + buildCurrentAAConWorkerFor(aaui, alignFrame, null); + } + + private static void buildCurrentAAConWorkerFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame, + Jws2Instance service) + { + /* + * preferred settings Whether AACon is automatically recalculated Which + * AACon server to use What parameters to use + */ + AAConSettings fave = (AAConSettings) alignFrame.getViewport() + .getCalcIdSettingsFor(aaui.getCalcId()); + if (fave == null) + { + fave = createDefaultAAConSettings(aaui, service); + } + else + { + if (service != null + && !fave.getService().hosturl.equals(service.hosturl)) + { + Cache.log.debug("Changing AACon service to " + service.hosturl + + " from " + fave.getService().hosturl); + fave.setService(service); } + } + new SequenceAnnotationWSClient(fave, alignFrame, false); + } + private static AAConSettings createDefaultAAConSettings(AlignAnalysisUIText aaui) + { + return createDefaultAAConSettings(aaui, null); + } + + private static AAConSettings createDefaultAAConSettings(AlignAnalysisUIText aaui, + Jws2Instance service) + { + if (service != null) + { + if (!service.serviceType.toString().equals( + compbio.ws.client.Services.AAConWS.toString())) + { + Cache.log + .warn("Ignoring invalid preferred service for AACon calculations (service type was " + + service.serviceType + ")"); + service = null; + } + else + { + // check service is actually in the list of currently avaialable + // services + if (!Jws2Discoverer.getDiscoverer().getServices().contains(service)) + { + // it isn't .. + service = null; + } + } } + if (service == null) + { + // get the default service for AACon + service = Jws2Discoverer.getDiscoverer().getPreferredServiceFor(null, + aaui.getServiceType()); + } + if (service == null) + { + // TODO raise dialog box explaining error, and/or open the JABA + // preferences menu. + throw new Error("No AACon service found."); + } + return new AAConSettings(true, service, null, null); + } + + private static void removeCurrentAAConWorkerFor(AlignAnalysisUIText aaui, AlignFrame alignFrame) + { + alignFrame.getViewport().getCalcManager() + .removeRegisteredWorkersOfClass(aaui.getClient()); } }