Search in sources :

Example 1 with SkinMenuItem

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

the class BTDownloadMediatorAdvancedMenuFactory method createTrackerMenu.

public static SkinMenu createTrackerMenu() {
    com.frostwire.bittorrent.BTDownload[] dms = getSingleSelectedDownloadManagers();
    if (dms == null) {
        return null;
    }
    SkinMenu menu = new SkinMenu(I18n.tr("Trackers"));
    menu.add(new SkinMenuItem(new EditTrackersAction(dms[0])));
    menu.add(new SkinMenuItem(new UpdateTrackerAction(dms[0])));
    menu.add(new SkinMenuItem(new ScrapeTrackerAction(dms[0])));
    return menu;
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) SkinMenu(com.frostwire.gui.theme.SkinMenu)

Example 2 with SkinMenuItem

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

the class LibraryExplorer method setupTree.

private void setupTree() {
    tree = new LibraryIconTree(model);
    tree.setRowHeight(TableSettings.DEFAULT_TABLE_ROW_HEIGHT.getValue());
    tree.setRootVisible(false);
    tree.setShowsRootHandles(false);
    tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    tree.setCellRenderer(new NodeRenderer());
    tree.setDragEnabled(true);
    tree.setTransferHandler(new LibraryFilesTransferHandler(tree));
    ((BasicTreeUI) tree.getUI()).setExpandedIcon(null);
    ((BasicTreeUI) tree.getUI()).setCollapsedIcon(null);
    SkinPopupMenu popup = new SkinPopupMenu();
    popup.add(new SkinMenuItem(refreshAction));
    popup.add(new SkinMenuItem(exploreAction));
    popup.add(new SkinMenuItem(new ConfigureOptionsAction(OptionsConstructor.SHARED_KEY, I18n.tr("Configure Options"), I18n.tr("You can configure the FrostWire\'s Options."))));
    tree.addMouseListener(new DefaultMouseListener(new TreeMouseObserver(tree, popup)));
    tree.addKeyListener(new KeyAdapter() {

        @Override
        public void keyReleased(KeyEvent e) {
            if (LibraryUtils.isRefreshKeyEvent(e)) {
                refreshSelection(true);
            }
        }
    });
    treeSelectionListener = new LibraryExplorerTreeSelectionListener();
    tree.addTreeSelectionListener(treeSelectionListener);
    ToolTipManager.sharedInstance().registerComponent(tree);
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) SkinPopupMenu(com.frostwire.gui.theme.SkinPopupMenu) KeyAdapter(java.awt.event.KeyAdapter) ConfigureOptionsAction(com.limegroup.gnutella.gui.options.ConfigureOptionsAction) DefaultMouseListener(com.limegroup.gnutella.gui.tables.DefaultMouseListener) KeyEvent(java.awt.event.KeyEvent) BasicTreeUI(javax.swing.plaf.basic.BasicTreeUI)

Example 3 with SkinMenuItem

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

the class LibraryFilesTableMediator method createPopupMenu.

// inherit doc comment
protected JPopupMenu createPopupMenu() {
    if (TABLE.getSelectionModel().isSelectionEmpty()) {
        return null;
    }
    JPopupMenu menu = new SkinPopupMenu();
    menu.add(new SkinMenuItem(LAUNCH_ACTION));
    if (getMediaType().equals(MediaType.getAudioMediaType())) {
        menu.add(new SkinMenuItem(LAUNCH_OS_ACTION));
    }
    if (hasExploreAction()) {
        menu.add(new SkinMenuItem(OPEN_IN_FOLDER_ACTION));
    }
    if (areAllSelectedFilesMP4s()) {
        menu.add(DEMUX_MP4_AUDIO_ACTION);
        DEMUX_MP4_AUDIO_ACTION.setEnabled(!((DemuxMP4AudioAction) DEMUX_MP4_AUDIO_ACTION).isDemuxing());
    }
    menu.add(new SkinMenuItem(CREATE_TORRENT_ACTION));
    if (areAllSelectedFilesPlayable()) {
        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(DELETE_ACTION));
    menu.addSeparator();
    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;
    }
    DELETE_ACTION.setEnabled(true);
    LibraryFilesTableDataLine 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 4 with SkinMenuItem

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

the class AbstractLibraryTableMediator method createAddToPlaylistSubMenu.

SkinMenu createAddToPlaylistSubMenu() {
    SkinMenu menu = new SkinMenu(tr("Add to playlist"));
    menu.add(new SkinMenuItem(new CreateNewPlaylistAction()));
    Playlist currentPlaylist = LibraryMediator.instance().getSelectedPlaylist();
    Playlist starredPlaylist = LibraryMediator.getLibrary().getStarredPlaylist();
    if (currentPlaylist == null || !currentPlaylist.equals(starredPlaylist)) {
        addToStarredPlaylistMenuItem(menu, starredPlaylist);
    }
    Library library = LibraryMediator.getLibrary();
    List<Playlist> playlists = library.getPlaylists();
    if (playlists.size() > 0) {
        menu.addSeparator();
        for (Playlist playlist : library.getPlaylists()) {
            if (currentPlaylist != null && currentPlaylist.equals(playlist)) {
                continue;
            }
            menu.add(new SkinMenuItem(new AddToPlaylistAction(playlist)));
        }
    }
    return menu;
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) Playlist(com.frostwire.alexandria.Playlist) SkinMenu(com.frostwire.gui.theme.SkinMenu) Library(com.frostwire.alexandria.Library)

Example 5 with SkinMenuItem

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

the class LibraryPlaylists method getPlaylistPopupMenu.

private SkinPopupMenu getPlaylistPopupMenu(Playlist playlist) {
    SkinPopupMenu playlistPopup = new SkinPopupMenu();
    final List<PlaylistItem> items = playlist.getItems();
    boolean playlistEmpty = items == null || items.size() == 0;
    playlistPopup.add(new SkinMenuItem(actions[REFRESH_ACTION]));
    if (!playlistEmpty) {
        playlistPopup.add(new SkinMenuItem(actions[REFRESH_ID3_TAGS_ACTION]));
    }
    playlistPopup.addSeparator();
    playlistPopup.add(new SkinMenuItem(actions[RENAME_ACTION]));
    playlistPopup.add(new SkinMenuItem(actions[DELETE_ACTION]));
    if (!playlistEmpty) {
        playlistPopup.add(new SkinMenuItem(actions[CLEANUP_PLAYLIST_ACTION]));
    }
    playlistPopup.addSeparator();
    playlistPopup.add(new SkinMenuItem(actions[IMPORT_TO_PLAYLIST_ACTION]));
    playlistPopup.add(new SkinMenuItem(actions[IMPORT_TO_NEW_PLAYLIST_ACTION]));
    addExportActionsToPopupMenu(playlistPopup, playlistEmpty);
    playlistPopup.addSeparator();
    playlistPopup.add(new SkinMenuItem(actions[CONFIGURE_OPTIONS_ACTION]));
    return playlistPopup;
}
Also used : SkinMenuItem(com.frostwire.gui.theme.SkinMenuItem) SkinPopupMenu(com.frostwire.gui.theme.SkinPopupMenu) PlaylistItem(com.frostwire.alexandria.PlaylistItem)

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