Search in sources :

Example 1 with SkinPopupMenu

use of com.frostwire.gui.theme.SkinPopupMenu 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 2 with SkinPopupMenu

use of com.frostwire.gui.theme.SkinPopupMenu 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 3 with SkinPopupMenu

use of com.frostwire.gui.theme.SkinPopupMenu 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)

Example 4 with SkinPopupMenu

use of com.frostwire.gui.theme.SkinPopupMenu 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 5 with SkinPopupMenu

use of com.frostwire.gui.theme.SkinPopupMenu 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)

Aggregations

SkinMenuItem (com.frostwire.gui.theme.SkinMenuItem)11 SkinPopupMenu (com.frostwire.gui.theme.SkinPopupMenu)11 PlaylistItem (com.frostwire.alexandria.PlaylistItem)2 File (java.io.File)2 SkinMenu (com.frostwire.gui.theme.SkinMenu)1 ConfigureOptionsAction (com.limegroup.gnutella.gui.options.ConfigureOptionsAction)1 DefaultMouseListener (com.limegroup.gnutella.gui.tables.DefaultMouseListener)1 KeyAdapter (java.awt.event.KeyAdapter)1 KeyEvent (java.awt.event.KeyEvent)1 BasicTreeUI (javax.swing.plaf.basic.BasicTreeUI)1