use of com.frostwire.gui.theme.SkinMenuItem in project frostwire by frostwire.
the class LibraryPlaylists method getStarredPlaylistPopupMenu.
private SkinPopupMenu getStarredPlaylistPopupMenu(Playlist playlist) {
SkinPopupMenu starredPlaylistPopupMenu = new SkinPopupMenu();
final List<PlaylistItem> items = playlist.getItems();
boolean playlistEmpty = items == null || items.size() == 0;
if (!playlistEmpty) {
starredPlaylistPopupMenu.add(new SkinMenuItem(actions[CLEANUP_PLAYLIST_ACTION]));
}
starredPlaylistPopupMenu.add(new SkinMenuItem(actions[REFRESH_ACTION]));
if (!playlistEmpty) {
starredPlaylistPopupMenu.add(new SkinMenuItem(actions[REFRESH_ID3_TAGS_ACTION]));
}
starredPlaylistPopupMenu.addSeparator();
starredPlaylistPopupMenu.add(new SkinMenuItem(actions[IMPORT_TO_PLAYLIST_ACTION]));
addExportActionsToPopupMenu(starredPlaylistPopupMenu, playlistEmpty);
starredPlaylistPopupMenu.addSeparator();
starredPlaylistPopupMenu.add(new SkinMenuItem(actions[CONFIGURE_OPTIONS_ACTION]));
return starredPlaylistPopupMenu;
}
use of com.frostwire.gui.theme.SkinMenuItem in project frostwire by frostwire.
the class LimeTextField method createPopup.
/**
* Creates the JPopupMenu that all LimeTextFields will share.
*/
private static JPopupMenu createPopup() {
JPopupMenu popup;
// initialize the JPopupMenu with necessary stuff.
popup = new SkinPopupMenu() {
/**
*/
private static final long serialVersionUID = -6004124495511263059L;
public void show(Component invoker, int x, int y) {
((LimeTextField) invoker).updateActions();
super.show(invoker, x, y);
}
};
popup.add(new SkinMenuItem(UNDO_ACTION));
popup.addSeparator();
popup.add(new SkinMenuItem(CUT_ACTION));
popup.add(new SkinMenuItem(COPY_ACTION));
popup.add(new SkinMenuItem(PASTE_ACTION));
popup.add(new SkinMenuItem(DELETE_ACTION));
popup.addSeparator();
popup.add(new SkinMenuItem(SELECT_ALL_ACTION));
return popup;
}
use of com.frostwire.gui.theme.SkinMenuItem in project frostwire by frostwire.
the class SearchResultMediator method createPopupMenu.
JPopupMenu createPopupMenu(SearchResultDataLine[] lines) {
// do not return a menu if right-clicking on the dummy panel
if (!isKillable())
return null;
JPopupMenu menu = new SkinPopupMenu();
if (lines.length > 0) {
boolean allWithHash = true;
for (SearchResultDataLine line : lines) {
if (line.getHash() == null) {
allWithHash = false;
break;
}
}
PopupUtils.addMenuItem(tr("Copy Magnet"), COPY_MAGNET_ACTION_LISTENER, menu, allWithHash);
PopupUtils.addMenuItem(tr("Copy Hash"), COPY_HASH_ACTION_LISTENER, menu, allWithHash);
menu.add(createSearchAgainMenu(lines[0]));
} else {
SeasonalContentSearchSuggestion.attemptToAddSeasonalContentSearchSuggestion(null, menu, searchTokens);
menu.add(new SkinMenuItem(new RepeatSearchAction()));
menu.add(new JSeparator(JSeparator.HORIZONTAL));
menu.add(new SkinMenuItem(new CloseTabAction()));
menu.add(new SkinMenuItem(new CloseAllTabsAction()));
menu.add(new SkinMenuItem(new CloseOtherTabsAction()));
menu.add(new SkinMenuItem(new CloseTabsToTheRight()));
}
return (new SearchResultMenu(this)).addToMenu(menu, lines);
}
use of com.frostwire.gui.theme.SkinMenuItem in project frostwire by frostwire.
the class SeasonalContentSearchSuggestion method attemptToAddSeasonalContentSearchSuggestion.
static void attemptToAddSeasonalContentSearchSuggestion(JMenu menu, JPopupMenu popupMenu, List<String> searchTokens) {
int i = 0;
String nextEpisodeSearchToken = null;
for (String token : searchTokens) {
final Matcher matcher = SEA_EPI_PATTERN.matcher(token.toLowerCase());
if (matcher.find()) {
String season = matcher.group(1);
String episodeStr = matcher.group(2);
int nextEpisode = Integer.parseInt(episodeStr) + 1;
String nextEpisodeStr = (nextEpisode < 10) ? "0" + String.valueOf(nextEpisode) : String.valueOf(nextEpisode);
nextEpisodeSearchToken = "s" + season + "e" + nextEpisodeStr;
break;
}
i++;
}
if (nextEpisodeSearchToken != null) {
StringBuilder buffer = new StringBuilder();
for (int j = 0; j < searchTokens.size(); j++) {
if (j != i) {
buffer.append(searchTokens.get(j));
buffer.append(" ");
} else {
buffer.append(nextEpisodeSearchToken);
buffer.append(" ");
}
}
String suggestedSearch = buffer.toString().trim();
if (menu != null) {
menu.add(new SkinMenuItem(new SeasonalContentSearchSuggestion(suggestedSearch)));
}
if (popupMenu != null) {
popupMenu.add(new SeasonalContentSearchSuggestion(suggestedSearch));
}
}
}
use of com.frostwire.gui.theme.SkinMenuItem in project frostwire by frostwire.
the class PopupUtils method addMenuItem.
/**
* Adds a menu item defined by the ActionListener & String to the JMenu, enabled or not at the given index.
*/
public static final void addMenuItem(String s, ActionListener l, JMenu m, boolean enable, int idx) {
JMenuItem item = m instanceof SkinMenu ? new SkinMenuItem(s) : new JMenuItem(s);
item.addActionListener(l);
item.setEnabled(enable);
m.add(item, idx);
}
Aggregations