" + + 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); } }); - aaConEnabled.setToolTipText("" - + JvSwingUtils.wrapTooltip(AAconToggleTooltip + "
") - + ""); - aaConEnabled.addActionListener(new ActionListener() + wsmenu.add(modifyParams); + wsmenu.addMenuListener(new MenuListener() { + @Override - public void actionPerformed(ActionEvent arg0) + public void menuSelected(MenuEvent arg0) { + // TODO: refactor to the implementing class. + if (alignFrame.getViewport().getAlignment() + .isNucleotide() ? aaui.isNa() : aaui.isPr()) { + aaConEnabled.setEnabled(true); + modifyParams.setEnabled(true); + } + else { + aaConEnabled.setEnabled(false); + modifyParams.setEnabled(false); + } 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) { - showAAConAnnotationSettingsFor(alignFrame); + // TODO Auto-generated method stub + } }); - wsmenu.add(modifyParams); } + return true; } - private static void showAAConAnnotationSettingsFor(AlignFrame alignFrame) + private static void showAAConAnnotationSettingsFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame) { /* * preferred settings Whether AACon is automatically recalculated Which @@ -421,21 +398,21 @@ public class SequenceAnnotationWSClient extends Jws2Client */ // could actually do a class search for this too AAConSettings fave = (AAConSettings) alignFrame.getViewport() - .getCalcIdSettingsFor(AAConCalcId); + .getCalcIdSettingsFor(aaui.getCalcId()); if (fave == null) { - fave = createDefaultAAConSettings(); + fave = createDefaultAAConSettings(aaui); } new SequenceAnnotationWSClient(fave, alignFrame, true); } - private static void buildCurrentAAConWorkerFor(AlignFrame alignFrame) + private static void buildCurrentAAConWorkerFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame) { - buildCurrentAAConWorkerFor(alignFrame, null); + buildCurrentAAConWorkerFor(aaui, alignFrame, null); } - private static void buildCurrentAAConWorkerFor(AlignFrame alignFrame, + private static void buildCurrentAAConWorkerFor(final AlignAnalysisUIText aaui, AlignFrame alignFrame, Jws2Instance service) { /* @@ -443,10 +420,10 @@ public class SequenceAnnotationWSClient extends Jws2Client * AACon server to use What parameters to use */ AAConSettings fave = (AAConSettings) alignFrame.getViewport() - .getCalcIdSettingsFor(AAConCalcId); + .getCalcIdSettingsFor(aaui.getCalcId()); if (fave == null) { - fave = createDefaultAAConSettings(service); + fave = createDefaultAAConSettings(aaui, service); } else { @@ -461,12 +438,12 @@ public class SequenceAnnotationWSClient extends Jws2Client new SequenceAnnotationWSClient(fave, alignFrame, false); } - private static AAConSettings createDefaultAAConSettings() + private static AAConSettings createDefaultAAConSettings(AlignAnalysisUIText aaui) { - return createDefaultAAConSettings(null); + return createDefaultAAConSettings(aaui, null); } - private static AAConSettings createDefaultAAConSettings( + private static AAConSettings createDefaultAAConSettings(AlignAnalysisUIText aaui, Jws2Instance service) { if (service != null) @@ -494,7 +471,7 @@ public class SequenceAnnotationWSClient extends Jws2Client { // get the default service for AACon service = Jws2Discoverer.getDiscoverer().getPreferredServiceFor(null, - compbio.ws.client.Services.AAConWS.toString()); + aaui.getServiceType()); } if (service == null) { @@ -505,9 +482,9 @@ public class SequenceAnnotationWSClient extends Jws2Client return new AAConSettings(true, service, null, null); } - private static void removeCurrentAAConWorkerFor(AlignFrame alignFrame) + private static void removeCurrentAAConWorkerFor(AlignAnalysisUIText aaui, AlignFrame alignFrame) { alignFrame.getViewport().getCalcManager() - .removeRegisteredWorkersOfClass(AAConClient.class); + .removeRegisteredWorkersOfClass(aaui.getClient()); } }