*/
protected int _annotationScoreVectorHash;
- /**
+ /**g
* search the alignment and rebuild the sort by annotation score submenu the
* last alignment annotation vector hash is stored to minimize cost of
* rebuilding in subsequence calls.
}
/**
+ * Enable (or, if desired, make visible) the By Tree
+ * submenu only if it has at least one element (or will have).
+ *
+ */
+ @Override
+ protected void enableSortMenuOptions()
+ {
+ List<TreePanel> treePanels = getTreePanels();
+ sortByTreeMenu.setEnabled(!treePanels.isEmpty());
+ }
+
+ /**
* Maintain the Order by->Displayed Tree menu. Creates a new menu item for a
* TreePanel with an appropriate <code>jalview.analysis.AlignmentSorter</code>
* call. Listeners are added to remove the menu item when the treePanel is
{
sortByTreeMenu.removeAll();
- List<Component> comps = PaintRefresher.components
- .get(viewport.getSequenceSetId());
- List<TreePanel> treePanels = new ArrayList<>();
- for (Component comp : comps)
- {
- if (comp instanceof TreePanel)
- {
- treePanels.add((TreePanel) comp);
- }
- }
-
- if (treePanels.size() < 1)
- {
- sortByTreeMenu.setVisible(false);
- return;
- }
-
- sortByTreeMenu.setVisible(true);
+ List<TreePanel> treePanels = getTreePanels();
for (final TreePanel tp : treePanels)
{
}
}
+ private List<TreePanel> getTreePanels()
+ {
+ List<Component> comps = PaintRefresher.components
+ .get(viewport.getSequenceSetId());
+ List<TreePanel> treePanels = new ArrayList<>();
+ for (Component comp : comps)
+ {
+ if (comp instanceof TreePanel)
+ {
+ treePanels.add((TreePanel) comp);
+ }
+ }
+ return treePanels;
+ }
+
public boolean sortBy(AlignmentOrder alorder, String undoname)
{
SequenceI[] oldOrder = viewport.getAlignment().getSequencesArray();