Search in sources :

Example 6 with SkinMenuItem

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;
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) SkinPopupMenu(com.frostwire.gui.theme.SkinPopupMenu) PlaylistItem(com.frostwire.alexandria.PlaylistItem)

Example 7 with SkinMenuItem

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;
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) SkinPopupMenu(com.frostwire.gui.theme.SkinPopupMenu)

Example 8 with SkinMenuItem

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);
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) SkinPopupMenu(com.frostwire.gui.theme.SkinPopupMenu)

Example 9 with SkinMenuItem

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));
        }
    }
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) Matcher(com.frostwire.regex.Matcher)

Example 10 with SkinMenuItem

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);
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) SkinMenu(com.frostwire.gui.theme.SkinMenu)

Aggregations

SkinMenuItem (com.frostwire.gui.theme.SkinMenuItem)22 SkinPopupMenu (com.frostwire.gui.theme.SkinPopupMenu)11 SkinMenu (com.frostwire.gui.theme.SkinMenu)9 File (java.io.File)5 SearchAction (com.limegroup.gnutella.gui.actions.SearchAction)3 Library (com.frostwire.alexandria.Library)2 Playlist (com.frostwire.alexandria.Playlist)2 PlaylistItem (com.frostwire.alexandria.PlaylistItem)2 AddToPlaylistAction (com.frostwire.gui.bittorrent.BTDownloadActions.AddToPlaylistAction)1 CreateNewPlaylistAction (com.frostwire.gui.bittorrent.BTDownloadActions.CreateNewPlaylistAction)1 Matcher (com.frostwire.regex.Matcher)1 ConfigureOptionsAction (com.limegroup.gnutella.gui.options.ConfigureOptionsAction)1 DefaultMouseListener (com.limegroup.gnutella.gui.tables.DefaultMouseListener)1 ActionEvent (java.awt.event.ActionEvent)1 ActionListener (java.awt.event.ActionListener)1 KeyAdapter (java.awt.event.KeyAdapter)1 KeyEvent (java.awt.event.KeyEvent)1 BasicTreeUI (javax.swing.plaf.basic.BasicTreeUI)1