}
@Override
public IGVPopupMenu getPopupMenu(TrackClickEvent te) {
IGVPopupMenu menu = new IGVPopupMenu();
final List<Track> selfAsList = Arrays.asList((Track) this);
menu.add(TrackMenuUtils.getTrackRenameItem(selfAsList));
//Give users the ability to set the color of each track individually
JMenu setPosColorMenu = new JMenu("Change Track Color (Positive Values)");
JMenu setNegColorMenu = new JMenu("Change Track Color (Negative Values)");
for(DataTrack track: memberTracks){
Icon posColorIcon = new ColorIcon(track.getColor());
JMenuItem posItem = new JMenuItem(track.getName(), posColorIcon);
posItem.addActionListener(new ChangeTrackColorActionListener(track, ChangeTrackMethod.POSITIVE));
setPosColorMenu.add(posItem);
Icon negColorIcon = new ColorIcon(track.getAltColor());
JMenuItem negItem = new JMenuItem(track.getName(), negColorIcon);
negItem.addActionListener(new ChangeTrackColorActionListener(track, ChangeTrackMethod.NEGATIVE));
setNegColorMenu.add(negItem);
}
menu.add(setPosColorMenu);
menu.add(setNegColorMenu);
menu.add(TrackMenuUtils.getChangeTrackHeightItem(selfAsList));
menu.add(TrackMenuUtils.getChangeFontSizeItem(selfAsList));
menu.addSeparator();
TrackMenuUtils.addDataItems(menu, selfAsList);
for(Component c: menu.getComponents()){
if(c instanceof JMenuItem){
String text = ((JMenuItem) c).getText();
text = text != null ? text.toLowerCase() : "null";
if(text.contains("heatmap")){
c.setEnabled(false);
}
}
}
menu.addSeparator();
menu.add(TrackMenuUtils.getRemoveMenuItem(selfAsList));
return menu;
}