import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.api.FeatureSettingsControllerI;
+import jalview.api.FeatureSettingsModelI;
import jalview.api.SplitContainerI;
import jalview.api.ViewStyleI;
import jalview.api.analysis.SimilarityParamsI;
scaleLeft.setVisible(av.getWrapAlignment());
scaleRight.setVisible(av.getWrapAlignment());
annotationPanelMenuItem.setState(av.isShowAnnotation());
+
/*
* Show/hide annotations only enabled if annotation panel is shown
*/
showConsensusHistogram.setSelected(av.isShowConsensusHistogram());
showSequenceLogo.setSelected(av.isShowSequenceLogo());
normaliseSequenceLogo.setSelected(av.isNormaliseSequenceLogo());
+ buildAutoAnnotationMenu(av);
ColourMenuHelper.setColourSelected(colourMenu,
av.getGlobalColourScheme());
}
/**
+ * Adds menu items for the Autocalculated Annotation sub-menu
+ *
+ * @param av
+ */
+ void buildAutoAnnotationMenu(AlignViewport av)
+ {
+ autoAnnMenu.removeAll();
+ autoAnnMenu.add(showAutoFirst);
+ autoAnnMenu.add(showAutoLast);
+ autoAnnMenu.addSeparator();
+ autoAnnMenu.add(applyAutoAnnotationSettings);
+ autoAnnMenu.add(showConsensusHistogram);
+ autoAnnMenu.add(showSequenceLogo);
+ autoAnnMenu.add(normaliseSequenceLogo);
+ autoAnnMenu.addSeparator();
+
+ /*
+ * add options to reinstate any deleted auto-calculated annotations
+ */
+ boolean hasConservation = false;
+ boolean hasQuality = false;
+ boolean hasConsensus = false;
+ boolean hasOccupancy = false;
+ boolean hasRnaStruct = false;
+ AlignmentAnnotation[] anns = av.getAlignment().getAlignmentAnnotation();
+ if (anns == null)
+ {
+ return;
+ }
+ for (int i = 0; i < anns.length; i++)
+ {
+ if (anns[i].autoCalculated)
+ {
+ // TODO JAL-3485 should let these strings be constants instead
+ if ("Conservation".equals(anns[i].label))
+ {
+ hasConservation = true;
+ }
+ else if ("Quality".equals(anns[i].label))
+ {
+ hasQuality = true;
+ }
+ else if ("Consensus".equals(anns[i].label))
+ {
+ hasConsensus = true;
+ }
+ else if ("Occupancy".equals(anns[i].label))
+ {
+ hasOccupancy = true;
+ }
+ else if ("StrucConsensus".equals(anns[i].label))
+ {
+ hasRnaStruct = true;
+ }
+ }
+ }
+ boolean added = false;
+
+ /*
+ * a shareable action to refresh stuff; NB action listeners
+ * get run in reverse order to that in which they are added!
+ */
+ ActionListener refresher = new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ alignPanel.adjustAnnotationHeight();
+ av.alignmentChanged(alignPanel);
+ buildAutoAnnotationMenu(av);
+ }
+ };
+
+ if (!av.isNucleotide())
+ {
+ if (!hasConservation)
+ {
+ JMenuItem mi = new JMenuItem("Conservation");
+ mi.addActionListener(refresher);
+ mi.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ av.initConservation();
+ }
+ });
+ autoAnnMenu.add(mi);
+ added = true;
+ }
+ if (!hasQuality)
+ {
+ JMenuItem mi = new JMenuItem("Quality");
+ mi.addActionListener(refresher);
+ mi.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ av.initQuality();
+ }
+ });
+ autoAnnMenu.add(mi);
+ added = true;
+ }
+ }
+ if (!hasConsensus)
+ {
+ JMenuItem mi = new JMenuItem("Consensus");
+ mi.addActionListener(refresher);
+ mi.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ av.initConsensus();
+ }
+ });
+ autoAnnMenu.add(mi);
+ added = true;
+ }
+ if (!hasOccupancy)
+ {
+ JMenuItem mi = new JMenuItem("Occupancy");
+ mi.addActionListener(refresher);
+ mi.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ av.initOccupancy();
+ }
+ });
+ autoAnnMenu.add(mi);
+ added = true;
+ }
+ if (!hasRnaStruct && av.isNucleotide()
+ && av.getAlignment().hasRNAStructure())
+ {
+ JMenuItem mi = new JMenuItem("Structure Consensus");
+ mi.addActionListener(refresher);
+ mi.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ av.initRNAStructure();
+ }
+ });
+ autoAnnMenu.add(mi);
+ added = true;
+ }
+
+ if (added)
+ {
+ autoAnnMenu.addSeparator();
+ }
+ autoAnnMenu.add(showGroupConservation);
+ autoAnnMenu.add(showGroupConsensus);
+ }
+
+ /**
* Set the enabled state of the 'Run Groovy' option in the Calculate menu
*
* @param b
@Override
public void setStatus(String text)
{
- statusBar.setText(text);
+ statusBar.setText(text == null || text.isEmpty() ? " " : text);
}
/*
newGraphGroups.add(q, null);
}
newGraphGroups.set(newann.graphGroup,
- new Integer(++fgroup));
+ Integer.valueOf(++fgroup));
}
newann.graphGroup = newGraphGroups.get(newann.graphGroup)
.intValue();
newGraphGroups.add(q, null);
}
newGraphGroups.set(newann.graphGroup,
- new Integer(++fgroup));
+ Integer.valueOf(++fgroup));
}
newann.graphGroup = newGraphGroups.get(newann.graphGroup)
.intValue();
protected void scaleAbove_actionPerformed(ActionEvent e)
{
viewport.setScaleAboveWrapped(scaleAbove.isSelected());
- // TODO: do we actually need to update overview for scale above change ?
+ alignPanel.updateLayout();
alignPanel.paintAlignment(true, false);
}
protected void scaleLeft_actionPerformed(ActionEvent e)
{
viewport.setScaleLeftWrapped(scaleLeft.isSelected());
+ alignPanel.updateLayout();
alignPanel.paintAlignment(true, false);
}
protected void scaleRight_actionPerformed(ActionEvent e)
{
viewport.setScaleRightWrapped(scaleRight.isSelected());
+ alignPanel.updateLayout();
alignPanel.paintAlignment(true, false);
}
* otherwise set the chosen colour scheme (or null for 'None')
*/
ColourSchemeI cs = ColourSchemes.getInstance().getColourScheme(name,
+ viewport,
viewport.getAlignment(), viewport.getHiddenRepSequences());
changeColour(cs);
}
int assocfiles = 0;
if (filesmatched.size() > 0)
{
- boolean autoAssociate = Cache.getDefault("AUTOASSOCIATE_PDBANDSEQS", false);
+ boolean autoAssociate = Cache
+ .getDefault("AUTOASSOCIATE_PDBANDSEQS", false);
if (!autoAssociate)
{
String msg = MessageManager.formatMessage(
@Override
public void finished()
{
+
+ for (FeatureSettingsModelI srcSettings : dbRefFetcher
+ .getFeatureSettingsModels())
+ {
+
+ alignPanel.av.mergeFeaturesStyle(srcSettings);
+ }
AlignFrame.this.setMenusForViewport();
}
});
@Override
public void finished()
{
+ FeatureSettingsModelI srcSettings = dassource[0]
+ .getFeatureColourScheme();
+ alignPanel.av.mergeFeaturesStyle(
+ srcSettings);
AlignFrame.this.setMenusForViewport();
}
});
{
PaintRefresher.Refresh(this, viewport.getSequenceSetId());
alignPanel.updateAnnotation();
- alignPanel.paintAlignment(true, true);
+ alignPanel.paintAlignment(true,
+ viewport.needToUpdateStructureViews());
}
}