Search in sources :

Example 11 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 JPopupMenu, enabled or not at the given index.
 */
public static final void addMenuItem(String s, ActionListener l, JPopupMenu m, boolean enable, int idx) {
    JMenuItem item = m instanceof SkinPopupMenu ? new SkinMenuItem(s) : new JMenuItem(s);
    item.addActionListener(l);
    item.setEnabled(enable);
    m.add(item, idx);
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) SkinPopupMenu(com.frostwire.gui.theme.SkinPopupMenu)

Example 12 with SkinMenuItem

use of com.frostwire.gui.theme.SkinMenuItem in project frostwire by frostwire.

the class SearchField method createPopup.

/**
 * Creates the JPopupMenu that all LimeTextFields will share.
 */
private static JPopupMenu createPopup() {
    if (POPUP != null) {
        return 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) {
            ((SearchField) 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 13 with SkinMenuItem

use of com.frostwire.gui.theme.SkinMenuItem in project frostwire by frostwire.

the class LibraryPlaylistsTableMediator method createSearchSubMenu.

private JMenu createSearchSubMenu(LibraryPlaylistsTableDataLine dl) {
    JMenu menu = new SkinMenu(I18n.tr("Search"));
    if (dl != null) {
        File f = dl.getFile();
        String keywords = QueryUtils.createQueryString(f.getName());
        if (keywords.length() > 0)
            menu.add(new SkinMenuItem(new SearchAction(keywords)));
    }
    if (menu.getItemCount() == 0)
        menu.setEnabled(false);
    return menu;
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) SkinMenu(com.frostwire.gui.theme.SkinMenu) File(java.io.File) SearchAction(com.limegroup.gnutella.gui.actions.SearchAction)

Example 14 with SkinMenuItem

use of com.frostwire.gui.theme.SkinMenuItem in project frostwire by frostwire.

the class LibraryPlaylistsTableMediator method createPopupMenu.

// inherit doc comment
protected JPopupMenu createPopupMenu() {
    if (TABLE.getSelectionModel().isSelectionEmpty())
        return null;
    JPopupMenu menu = new SkinPopupMenu();
    menu.add(new SkinMenuItem(LAUNCH_ACTION));
    menu.add(new SkinMenuItem(LAUNCH_OS_ACTION));
    if (hasExploreAction()) {
        menu.add(new SkinMenuItem(OPEN_IN_FOLDER_ACTION));
    }
    menu.add(new SkinMenuItem(CREATE_TORRENT_ACTION));
    menu.add(createAddToPlaylistSubMenu());
    menu.add(new SkinMenuItem(SEND_TO_FRIEND_ACTION));
    menu.add(new SkinMenuItem(SEND_TO_ITUNES_ACTION));
    menu.addSeparator();
    menu.add(new SkinMenuItem(COPY_PLAYLIST_FILES_TO_FOLDER_ACTION));
    menu.addSeparator();
    menu.add(new SkinMenuItem(DELETE_ACTION));
    int[] rows = TABLE.getSelectedRows();
    boolean dirSelected = false;
    boolean fileSelected = false;
    for (int row : rows) {
        File f = DATA_MODEL.get(row).getFile();
        if (f.isDirectory()) {
            dirSelected = true;
        // if (IncompleteFileManager.isTorrentFolder(f))
        // torrentSelected = true;
        } else
            fileSelected = true;
        if (dirSelected && fileSelected)
            break;
    }
    if (dirSelected) {
        DELETE_ACTION.setEnabled(true);
    } else {
        DELETE_ACTION.setEnabled(true);
    }
    menu.addSeparator();
    menu.add(new SkinMenuItem(importToPlaylistAction));
    menu.add(new SkinMenuItem(exportPlaylistAction));
    menu.add(new SkinMenuItem(cleanupPlaylistAction));
    menu.add(new SkinMenuItem(refreshID3TagsAction));
    menu.addSeparator();
    LibraryPlaylistsTableDataLine line = DATA_MODEL.get(rows[0]);
    menu.add(createSearchSubMenu(line));
    return menu;
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) SkinPopupMenu(com.frostwire.gui.theme.SkinPopupMenu) File(java.io.File)

Example 15 with SkinMenuItem

use of com.frostwire.gui.theme.SkinMenuItem in project frostwire by frostwire.

the class LibraryPlaylists method getNewPlaylistPopupMenu.

private SkinPopupMenu getNewPlaylistPopupMenu() {
    SkinPopupMenu popupMenu = new SkinPopupMenu();
    popupMenu.add(new SkinMenuItem(actions[IMPORT_TO_NEW_PLAYLIST_ACTION]));
    popupMenu.add(new SkinMenuItem(actions[CONFIGURE_OPTIONS_ACTION]));
    return popupMenu;
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) SkinPopupMenu(com.frostwire.gui.theme.SkinPopupMenu)

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