// For input with secondary structure
if (aa.label.equals(Constants.SS_ANNOTATION_LABEL)
- && aa.description.equals(Constants.SS_ANNOTATION_LABEL))
+ && aa.description != null && aa.description.equals(Constants.SS_ANNOTATION_LABEL))
{
return (Constants.SECONDARY_STRUCTURE_LABELS.get(aa.label));
showOrHideSecondaryStructureForSource(ssSource, true);
- } else {
-
+ } else {
showOrHideSecondaryStructureForSource(ssSource, false);
+
}
});
showSS.add(checkBox);
return checkboxMap;
}
-
+ @Override
protected void showOrHideSecondaryStructureForSource(String ssSourceSelection, boolean visible){
+ String noneOption = MessageManager.getString("option.ss_providers_none");
+ String allOption = MessageManager.getString("option.ss_providers_all");
+
AlignmentAnnotation[] annotations = alignPanel.getAlignment()
.getAlignmentAnnotation();
for (AlignmentAnnotation aa: annotations) {
- if(aa.label.startsWith(MessageManager.getString("label.ssconsensus_label")) && aa.description.startsWith(ssSourceSelection)) {
- aa.visible = visible;
+ boolean isSSConsensus = aa.label.startsWith(MessageManager.getString("label.ssconsensus_label"));
+ boolean matchesSSSourceSelection = aa.description.startsWith(ssSourceSelection);
+
+ if(isSSConsensus && (matchesSSSourceSelection || ssSourceSelection.equals(noneOption))) {
+
+ if (ssSourceSelection.equals(allOption)) {
+ aa.visible = true;
+ break;
+ }
+
+ if(!aa.description.startsWith(allOption))
+ aa.visible = visible;
+
}
for (String label : Constants.SECONDARY_STRUCTURE_LABELS.keySet()) {
if (label.equals(aa.label)) {
String ssSource = AlignmentUtils.extractSSSourceFromAnnotationDescription(aa);
- if(ssSource.equals(ssSourceSelection)) {
+ if(ssSource.equals(ssSourceSelection) || ssSourceSelection.equals(noneOption)) {
aa.visible = visible;
}
}
treeCanvas = new TreeCanvas(this, ap, scrollPane);
scrollPane.setViewportView(treeCanvas);
- if(this.similarityParams.getSecondaryStructureSource()!=null ) {
+ if(this.similarityParams!=null)
+ if(this.similarityParams.getSecondaryStructureSource()!=null ) {
- // Initialize the subtitle label
subtitleLabel = new JLabel(" Secondary Structure Provider : "
+ this.similarityParams.getSecondaryStructureSource(), SwingConstants.LEFT);
- // Create a new panel to hold the label and treeCanvas
JPanel panel = new JPanel(new BorderLayout());
panel.add(subtitleLabel, BorderLayout.NORTH);
panel.add(scrollPane, BorderLayout.CENTER);
radioButtonAllSS.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- showSS_actionPerformed(MessageManager.getString("option.ss_providers_all"));
+ showOrHideSecondaryStructureForSource(MessageManager.getString("option.ss_providers_all"), true);
// Select all checkboxes if "All" is selected
Component[] components = showSS.getMenuComponents();
for (Component component : components) {
radioButtonNoneSS.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
- showSS_actionPerformed(MessageManager.getString("option.ss_providers_none"));
+ showOrHideSecondaryStructureForSource(MessageManager.getString("option.ss_providers_none"), false);
// Remove selection of all checkboxes if "None" is selected
Component[] components = showSS.getMenuComponents();
for (Component component : components) {
return null;
}
- protected void showSS_actionPerformed(String ssSourceSelection)
+ protected void showOrHideSecondaryStructureForSource(String ssSourceSelection, boolean visible)
{
// TODO Auto-generated method stub