addshowLinks(linkMenu, linkset.values());
+ // disable link menu if there are no valid entries
if (linkMenu.getItemCount() > 0)
{
- if (seq != null)
- {
- seqMenu.add(linkMenu);
- }
- else
- {
- add(linkMenu);
- }
+ linkMenu.setEnabled(true);
+ }
+ else
+ {
+ linkMenu.setEnabled(false);
}
+
+ if (seq != null)
+ {
+ seqMenu.add(linkMenu);
+ }
+ else
+ {
+ add(linkMenu);
+ }
+
}
private void addshowLinks(Menu linkMenu, Collection<List<String>> linkset)
addshowLinks(linkMenu, linkset.values());
+ // disable link menu if there are no valid entries
+ if (linkMenu.getItemCount() > 0)
+ {
+ linkMenu.setEnabled(true);
+ }
+ else
+ {
+ linkMenu.setEnabled(false);
+ }
+
if (sequence != null)
{
sequenceMenu.add(linkMenu);
{
add(linkMenu);
}
+
}
((JMenuItem) linkItems[i]).getText().split("\\|")[1]);
}
+ // if there are no valid links the Links submenu is disabled
+ List<String> nomatchlinks = new ArrayList<String>();
+ nomatchlinks.add("NOMATCH | http://www.uniprot.org/uniprot/$"
+ + DB_ACCESSION + "$");
+
+ testee = new PopupMenu(parentPanel, (Sequence) seqs.get(0),
+ nomatchlinks);
+ seqItems = testee.sequenceMenu.getMenuComponents();
+ linkMenu = (JMenu) seqItems[6];
+ assertFalse(linkMenu.isEnabled());
}
}