" + + JvSwingUtils.wrapTooltip(aaui.getAAconToggleTooltip() + "
") + + ""); + aaConEnabled.addActionListener(new ActionListener() + { @Override - public void menuSelected(MenuEvent arg0) + public void actionPerformed(ActionEvent arg0) { - wsmenu.setEnabled(!alignFrame.getViewport().getAlignment() - .isNucleotide()); - List" + + JvSwingUtils.wrapTooltip(aaui.getAAeditSettingsTooltip() + "
") + + ""); + modifyParams.addActionListener(new ActionListener() + { @Override - public void menuCanceled(MenuEvent arg0) + public void actionPerformed(ActionEvent arg0) { - // TODO Auto-generated method stub - + showAAConAnnotationSettingsFor(aaui, alignFrame); } }); - aaConsEnabled.setToolTipText("" - + JvSwingUtils.wrapTooltip(AAconsToggleTooltip + "
") - + ""); - aaConsEnabled.addActionListener(new ActionListener() + wsmenu.add(modifyParams); + wsmenu.addMenuListener(new MenuListener() { + @Override - public void actionPerformed(ActionEvent arg0) + public void menuSelected(MenuEvent arg0) { - // aaConsEnabled.setSelected(!aaConsEnabled.isSelected()); - List" - + JvSwingUtils.wrapTooltip(AAeditSettingsTooltip + "
") - + ""); - modifyParams.addActionListener(new ActionListener() - { + @Override + public void menuDeselected(MenuEvent arg0) + { + // TODO Auto-generated method stub + + } @Override - public void actionPerformed(ActionEvent arg0) + public void menuCanceled(MenuEvent arg0) { - showAAConsAnnotationSettingsFor(alignFrame); + // TODO Auto-generated method stub + } }); - wsmenu.add(modifyParams); } + return true; } - private static void showAAConsAnnotationSettingsFor(AlignFrame alignFrame) + private static void showAAConAnnotationSettingsFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame) { /* - * preferred settings Whether AACons is automatically recalculated Which - * AACons server to use What parameters to use + * 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 - AAConsSettings fave = (AAConsSettings) alignFrame.getViewport() - .getCalcIdSettingsFor(AAConsCalcId); + AAConSettings fave = (AAConSettings) alignFrame.getViewport() + .getCalcIdSettingsFor(aaui.getCalcId()); if (fave == null) { - fave = createDefaultAAConsSettings(); + fave = createDefaultAAConSettings(aaui); } new SequenceAnnotationWSClient(fave, alignFrame, true); } - private static void buildCurrentAAConsWorkerFor(AlignFrame alignFrame) + private static void buildCurrentAAConWorkerFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame) { - buildCurrentAAConsWorkerFor(alignFrame, null); + buildCurrentAAConWorkerFor(aaui, alignFrame, null); } - private static void buildCurrentAAConsWorkerFor(AlignFrame alignFrame, + private static void buildCurrentAAConWorkerFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame, Jws2Instance service) { /* - * preferred settings Whether AACons is automatically recalculated Which - * AACons server to use What parameters to use + * preferred settings Whether AACon is automatically recalculated Which + * AACon server to use What parameters to use */ - AAConsSettings fave = (AAConsSettings) alignFrame.getViewport() - .getCalcIdSettingsFor(AAConsCalcId); + AAConSettings fave = (AAConSettings) alignFrame.getViewport() + .getCalcIdSettingsFor(aaui.getCalcId()); if (fave == null) { - fave = createDefaultAAConsSettings(service); + fave = createDefaultAAConSettings(aaui, service); } else { if (service != null && !fave.getService().hosturl.equals(service.hosturl)) { - Cache.log.debug("Changing AACons service to " + service.hosturl + Cache.log.debug("Changing AACon service to " + service.hosturl + " from " + fave.getService().hosturl); fave.setService(service); } @@ -396,12 +436,12 @@ public class SequenceAnnotationWSClient extends Jws2Client new SequenceAnnotationWSClient(fave, alignFrame, false); } - private static AAConsSettings createDefaultAAConsSettings() + private static AAConSettings createDefaultAAConSettings(AlignAnalysisUIText aaui) { - return createDefaultAAConsSettings(null); + return createDefaultAAConSettings(aaui, null); } - private static AAConsSettings createDefaultAAConsSettings( + private static AAConSettings createDefaultAAConSettings(AlignAnalysisUIText aaui, Jws2Instance service) { if (service != null) @@ -410,7 +450,7 @@ public class SequenceAnnotationWSClient extends Jws2Client compbio.ws.client.Services.AAConWS.toString())) { Cache.log - .warn("Ignoring invalid preferred service for AACons calculations (service type was " + .warn("Ignoring invalid preferred service for AACon calculations (service type was " + service.serviceType + ")"); service = null; } @@ -427,30 +467,22 @@ public class SequenceAnnotationWSClient extends Jws2Client } if (service == null) { - // get the default service for AACons + // get the default service for AACon service = Jws2Discoverer.getDiscoverer().getPreferredServiceFor(null, - compbio.ws.client.Services.AAConWS.toString()); - /* - * for (Jws2Instance sv : Jws2Discoverer.getDiscoverer().getServices()) { - * if (sv.serviceType.toString().equals( - * compbio.ws.client.Services.AAConWS.toString())) { service = sv; break; - * } } - */ + aaui.getServiceType()); } if (service == null) { // TODO raise dialog box explaining error, and/or open the JABA // preferences menu. - throw new Error("No AACons service found."); + throw new Error("No AACon service found."); } - return new AAConsSettings(true, service, null, null); + return new AAConSettings(true, service, null, null); } - private static void removeCurrentAAConsWorkerFor(AlignFrame alignFrame) + private static void removeCurrentAAConWorkerFor(AlignAnalysisUIText aaui, AlignFrame alignFrame) { alignFrame.getViewport().getCalcManager() - .removeRegisteredWorkersOfClass(AAConsClient.class); - // AAConsClient.removeAAConsAnnotation(alignFrame.alignPanel); - + .removeRegisteredWorkersOfClass(aaui.getClient()); } }