List of usage examples for javax.swing JScrollPane setViewportView
public void setViewportView(Component view)
From source file:org.tinymediamanager.ui.movies.settings.MovieTrailerSettingsPanel.java
public MovieTrailerSettingsPanel() { // data init/*from w w w . jav a 2s . c om*/ List<String> enabledTrailerProviders = settings.getMovieTrailerScrapers(); int selectedIndex = -1; int counter = 0; for (MediaScraper scraper : MovieList.getInstance().getAvailableTrailerScrapers()) { TrailerScraper trailerScraper = new TrailerScraper(scraper); if (enabledTrailerProviders.contains(trailerScraper.getScraperId())) { trailerScraper.active = true; if (selectedIndex < 0) { selectedIndex = counter; } } scrapers.add(trailerScraper); counter++; } // UI init setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); JPanel panelTrailerScrapers = new JPanel(); panelTrailerScrapers.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), BUNDLE.getString("scraper.trailer"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); // $NON-NLS-1$ add(panelTrailerScrapers, "2, 2, fill, fill"); panelTrailerScrapers.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("100dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); final JScrollPane scrollPaneScraperDetails = new JScrollPane(); scrollPaneScraperDetails.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); scrollPaneScraperDetails.setBorder(null); panelTrailerScrapers.add(scrollPaneScraperDetails, "8, 1, 1, 2, fill, fill"); JPanel panelScraperDetails = new JPanel(); scrollPaneScraperDetails.setViewportView(panelScraperDetails); panelScraperDetails.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("default:grow"), }, new RowSpec[] { RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, })); { // add a CSS rule to force body tags to use the default label font // instead of the value in javax.swing.text.html.default.csss Font font = UIManager.getFont("Label.font"); String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize() + "pt; }"; tpScraperDescription = new JTextPane(); tpScraperDescription.setOpaque(false); tpScraperDescription.setEditorKit(new HTMLEditorKit()); ((HTMLDocument) tpScraperDescription.getDocument()).getStyleSheet().addRule(bodyRule); panelScraperDetails.add(tpScraperDescription, "1, 1, fill, top"); } panelScraperOptions = new ScrollablePanel(); panelScraperOptions.setLayout(new FlowLayout(FlowLayout.LEFT)); panelScraperDetails.add(panelScraperOptions, "1, 3, fill, top"); JScrollPane scrollPaneScraper = new JScrollPane(); panelTrailerScrapers.add(scrollPaneScraper, "2, 2, 5, 1, fill, fill"); tableTrailerScraper = new JTable(); tableTrailerScraper.setRowHeight(29); scrollPaneScraper.setViewportView(tableTrailerScraper); JSeparator separator = new JSeparator(); panelTrailerScrapers.add(separator, "2, 4, 7, 1"); checkBox = new JCheckBox(BUNDLE.getString("Settings.trailer.preferred")); //$NON-NLS-1$ panelTrailerScrapers.add(checkBox, "2, 6, 7, 1"); JLabel lblTrailerSource = new JLabel(BUNDLE.getString("Settings.trailer.source")); //$NON-NLS-1$ panelTrailerScrapers.add(lblTrailerSource, "4, 8, right, default"); cbTrailerSource = new JComboBox<>(); cbTrailerSource.setModel(new DefaultComboBoxModel<>(MovieTrailerSources.values())); panelTrailerScrapers.add(cbTrailerSource, "6, 8, fill, default"); JLabel lblTrailerQuality = new JLabel(BUNDLE.getString("Settings.trailer.quality")); //$NON-NLS-1$ panelTrailerScrapers.add(lblTrailerQuality, "4, 10, right, default"); cbTrailerQuality = new JComboBox<>(); cbTrailerQuality.setModel(new DefaultComboBoxModel<>(MovieTrailerQuality.values())); panelTrailerScrapers.add(cbTrailerQuality, "6, 10, fill, default"); chckbxAutomaticTrailerDownload = new JCheckBox(BUNDLE.getString("Settings.trailer.automaticdownload")); //$NON-NLS-1$ panelTrailerScrapers.add(chckbxAutomaticTrailerDownload, "2, 12, 7, 1"); JLabel lblAutomaticTrailerDownloadHint = new JLabel( BUNDLE.getString("Settings.trailer.automaticdownload.hint")); //$NON-NLS-1$ TmmFontHelper.changeFont(lblAutomaticTrailerDownloadHint, 0.833); panelTrailerScrapers.add(lblAutomaticTrailerDownloadHint, "4, 14, 5, 1"); initDataBindings(); // adjust table columns // Checkbox and Logo shall have minimal width TableColumnResizer.setMaxWidthForColumn(tableTrailerScraper, 0, 2); TableColumnResizer.setMaxWidthForColumn(tableTrailerScraper, 1, 2); TableColumnResizer.adjustColumnPreferredWidths(tableTrailerScraper, 5); tableTrailerScraper.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { // click on the checkbox if (arg0.getColumn() == 0) { int row = arg0.getFirstRow(); TrailerScraper changedScraper = scrapers.get(row); if (changedScraper.active) { settings.addMovieTrailerScraper(changedScraper.getScraperId()); } else { settings.removeMovieTrailerScraper(changedScraper.getScraperId()); } } } }); // implement selection listener to load settings tableTrailerScraper.getSelectionModel().addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { int index = tableTrailerScraper.convertRowIndexToModel(tableTrailerScraper.getSelectedRow()); if (index > -1) { panelScraperOptions.removeAll(); if (scrapers.get(index).getMediaProvider().getProviderInfo().getConfig().hasConfig()) { panelScraperOptions .add(new MediaScraperConfigurationPanel(scrapers.get(index).getMediaProvider())); } panelScraperOptions.revalidate(); } } }); // select default movie scraper if (selectedIndex < 0) { selectedIndex = 0; } if (counter > 0) { tableTrailerScraper.getSelectionModel().setSelectionInterval(selectedIndex, selectedIndex); } }
From source file:org.tinymediamanager.ui.moviesets.dialogs.MovieSetChooserDialog.java
/** * Instantiates a new movie set chooser panel. * /*from w w w .j a v a2 s .c o m*/ * @param movieSet * the movie set */ public MovieSetChooserDialog(MovieSet movieSet, boolean inQueue) { super(BUNDLE.getString("movieset.search"), "movieSetChooser"); //$NON-NLS-1$ setBounds(5, 5, 865, 578); movieSetToScrape = movieSet; getContentPane().setLayout(new BorderLayout(0, 0)); JPanel panelHeader = new JPanel(); getContentPane().add(panelHeader, BorderLayout.NORTH); panelHeader.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("114px:grow"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px"), ColumnSpec.decode("2dlu"), }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("25px"), FormFactory.RELATED_GAP_ROWSPEC, })); { tfMovieSetName = new JTextField(); panelHeader.add(tfMovieSetName, "2, 2, fill, fill"); tfMovieSetName.setColumns(10); } { JButton btnSearch = new JButton(""); btnSearch.setAction(actionSearch); panelHeader.add(btnSearch, "4, 2, fill, top"); } { JSplitPane splitPane = new JSplitPane(); splitPane.setContinuousLayout(true); splitPane.setResizeWeight(0.5); getContentPane().add(splitPane, BorderLayout.CENTER); { JPanel panelResults = new JPanel(); panelResults.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("300px:grow"), }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:403px:grow"), })); JScrollPane panelSearchResults = new JScrollPane(); panelResults.add(panelSearchResults, "2, 2, fill, fill"); splitPane.setLeftComponent(panelResults); { tableMovieSets = new JTable(); panelSearchResults.setViewportView(tableMovieSets); tableMovieSets.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tableMovieSets.setBorder(new LineBorder(new Color(0, 0, 0))); ListSelectionModel rowSM = tableMovieSets.getSelectionModel(); rowSM.addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent e) { // Ignore extra messages. if (e.getValueIsAdjusting()) return; ListSelectionModel lsm = (ListSelectionModel) e.getSource(); if (!lsm.isSelectionEmpty()) { int selectedRow = lsm.getMinSelectionIndex(); selectedRow = tableMovieSets.convertRowIndexToModel(selectedRow); try { MovieSetChooserModel model = movieSetsFound.get(selectedRow); if (model != MovieSetChooserModel.emptyResult && !model.isScraped()) { ScrapeTask task = new ScrapeTask(model); task.execute(); } } catch (Exception ex) { LOGGER.warn(ex.getMessage()); } } } }); } } { JPanel panelSearchDetail = new JPanel(); splitPane.setRightComponent(panelSearchDetail); panelSearchDetail.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:150px"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(300px;default):grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("250px"), FormFactory.PARAGRAPH_GAP_ROWSPEC, RowSpec.decode("top:default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC })); { lblMovieSetName = new JTextArea(""); lblMovieSetName.setLineWrap(true); lblMovieSetName.setOpaque(false); lblMovieSetName.setWrapStyleWord(true); TmmFontHelper.changeFont(lblMovieSetName, 1.166, Font.BOLD); panelSearchDetail.add(lblMovieSetName, "2, 1, 3, 1, fill, top"); } { lblMovieSetPoster = new ImageLabel(); lblMovieSetPoster.setAlternativeText(BUNDLE.getString("image.notfound.poster")); //$NON-NLS-1$ panelSearchDetail.add(lblMovieSetPoster, "2, 3, fill, fill"); } { JPanel panel = new JPanel(); panelSearchDetail.add(panel, "4, 3, fill, fill"); panel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); } { JScrollPane scrollPane = new JScrollPane(); panelSearchDetail.add(scrollPane, "2, 5, 3, 1, fill, fill"); { tableMovies = new JTable(); scrollPane.setViewportView(tableMovies); } } { cbAssignMovies = new JCheckBox(BUNDLE.getString("movieset.movie.assign")); //$NON-NLS-1$ cbAssignMovies.setSelected(true); panelSearchDetail.add(cbAssignMovies, "2, 7, 3, 1"); } } } { JPanel bottomPane = new JPanel(); getContentPane().add(bottomPane, BorderLayout.SOUTH); { bottomPane.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("2dlu"), ColumnSpec.decode("185px"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("18px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, ColumnSpec.decode("2dlu"), }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC })); { progressBar = new JProgressBar(); bottomPane.add(progressBar, "2, 2, fill, center"); } { lblProgressAction = new JLabel(""); bottomPane.add(lblProgressAction, "4, 2, fill, center"); } { JPanel buttonPane = new JPanel(); bottomPane.add(buttonPane, "6, 2, fill, fill"); EqualsLayout layout = new EqualsLayout(5); buttonPane.setBorder(new EmptyBorder(4, 4, 4, 4)); layout.setMinWidth(100); buttonPane.setLayout(layout); btnOk = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ btnOk.setActionCommand("Save"); btnOk.setToolTipText(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ btnOk.setIcon(IconManager.APPLY); btnOk.addActionListener(this); buttonPane.add(btnOk); JButton btnCancel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ btnCancel.setActionCommand("Cancel"); btnCancel.setToolTipText(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ btnCancel.setIcon(IconManager.CANCEL); btnCancel.addActionListener(this); buttonPane.add(btnCancel); if (inQueue) { JButton btnAbort = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ btnAbort.setActionCommand("Abort"); btnAbort.setToolTipText(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ btnAbort.setIcon(IconManager.PROCESS_STOP); btnAbort.addActionListener(this); buttonPane.add(btnAbort, "6, 1, fill, top"); } } } } initDataBindings(); // adjust table columns tableMovies.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); tableMovies.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); tableMovieSets.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("chooser.searchresult")); tfMovieSetName.setText(movieSet.getTitle()); searchMovie(); }
From source file:org.tinymediamanager.ui.moviesets.dialogs.MovieSetEditorDialog.java
/** * Instantiates a new movie set editor./*from ww w . j a v a2s .c o m*/ * * @param movieSet * the movie set * @param inQueue * the in queue */ public MovieSetEditorDialog(MovieSet movieSet, boolean inQueue) { super(BUNDLE.getString("movieset.edit"), "movieSetEditor"); //$NON-NLS-1$ setBounds(5, 5, 800, 500); movieSetToEdit = movieSet; try { List<String> enabledScrapers = new ArrayList<>(); if (MovieModuleManager.MOVIE_SETTINGS.getMovieArtworkScrapers().contains(Constants.TMDB)) { enabledScrapers.add(Constants.TMDB); } if (MovieModuleManager.MOVIE_SETTINGS.getMovieArtworkScrapers().contains(Constants.FANART_TV)) { enabledScrapers.add(Constants.FANART_TV); } artworkScrapers.addAll(movieList.getArtworkScrapers(enabledScrapers)); // artworkScrapers.addAll(movieList.getArtworkScrapers(Arrays.asList(Constants.TMDB, Constants.FANART_TV))); } catch (Exception e2) { LOGGER.warn("error getting IMediaArtworkProvider " + e2.getMessage()); } getContentPane().setLayout(new BorderLayout()); JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.NORTH); getContentPane().add(tabbedPane, BorderLayout.CENTER); JPanel panelContent = new JPanel(); panelContent.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("300px:grow"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("75px:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.NARROW_LINE_GAP_ROWSPEC, })); tabbedPane.addTab(BUNDLE.getString("metatag.details"), panelContent); //$NON-NLS-1$ JLabel lblName = new JLabel(BUNDLE.getString("movieset.title")); //$NON-NLS-1$ panelContent.add(lblName, "2, 2, right, default"); tfName = new JTextField(); panelContent.add(tfName, "4, 2, 3, 1, fill, default"); tfName.setColumns(10); lblPoster = new ImageLabel(); lblPoster.setAlternativeText(BUNDLE.getString("image.notfound.poster")); //$NON-NLS-1$ lblPoster.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int tmdbId = 0; try { tmdbId = Integer.parseInt(tfTmdbId.getText()); } catch (Exception e1) { } HashMap<String, Object> ids = new HashMap<>(movieSetToEdit.getIds()); ids.put(Constants.TMDB, tmdbId); // MovieSetImageChooserDialog dialog = new MovieSetImageChooserDialog(tmdbId, ImageType.POSTER, lblPoster); ImageChooserDialog dialog = new ImageChooserDialog(ids, ImageType.POSTER, artworkScrapers, lblPoster, null, null, MediaType.MOVIE_SET); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); panelContent.add(lblPoster, "8, 2, 1, 9, fill, fill"); JLabel lblTmdbid = new JLabel(BUNDLE.getString("metatag.tmdb")); //$NON-NLS-1$ panelContent.add(lblTmdbid, "2, 4, right, default"); tfTmdbId = new JTextField(); panelContent.add(tfTmdbId, "4, 4, fill, default"); tfTmdbId.setColumns(10); JButton btnSearchTmdbId = new JButton(""); btnSearchTmdbId.setAction(actionSearchTmdbId); panelContent.add(btnSearchTmdbId, "6, 4, left, default"); JLabel lblOverview = new JLabel(BUNDLE.getString("metatag.plot")); //$NON-NLS-1$ panelContent.add(lblOverview, "2, 6, right, top"); JScrollPane scrollPaneOverview = new JScrollPane(); panelContent.add(scrollPaneOverview, "4, 6, 3, 1, fill, fill"); tpOverview = new JTextPane(); scrollPaneOverview.setViewportView(tpOverview); JLabel lblMovies = new JLabel(BUNDLE.getString("tmm.movies")); //$NON-NLS-1$ panelContent.add(lblMovies, "2, 8, right, top"); JScrollPane scrollPaneMovies = new JScrollPane(); panelContent.add(scrollPaneMovies, "4, 8, 3, 9, fill, fill"); tableMovies = new JTable(); scrollPaneMovies.setViewportView(tableMovies); JButton btnRemoveMovie = new JButton(""); btnRemoveMovie.setAction(actionRemoveMovie); panelContent.add(btnRemoveMovie, "2, 10, right, top"); lblFanart = new ImageLabel(); lblFanart.setAlternativeText(BUNDLE.getString("image.notfound.fanart")); //$NON-NLS-1$ lblFanart.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { int tmdbId = 0; try { tmdbId = Integer.parseInt(tfTmdbId.getText()); } catch (Exception e1) { } HashMap<String, Object> ids = new HashMap<>(movieSetToEdit.getIds()); ids.put(Constants.TMDB, tmdbId); ImageChooserDialog dialog = new ImageChooserDialog(ids, ImageType.FANART, artworkScrapers, lblFanart, null, null, MediaType.MOVIE_SET); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); panelContent.add(lblFanart, "8, 12, 1, 5, fill, fill"); /** * Artwork pane */ { JPanel artworkPanel = new JPanel(); tabbedPane.addTab(BUNDLE.getString("metatag.extraartwork"), null, artworkPanel, null); //$NON-NLS-1$ artworkPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("150px:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("50px:grow(2)"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("200px:grow(2)"), FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), })); { JLabel lblLogoT = new JLabel(BUNDLE.getString("mediafiletype.logo")); //$NON-NLS-1$ artworkPanel.add(lblLogoT, "2, 2"); } { lblLogo = new ImageLabel(); lblLogo.setAlternativeText(BUNDLE.getString("image.notfound.logo")); //$NON-NLS-1$ lblLogo.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieSetToEdit.getIds(), ImageType.LOGO, movieList.getDefaultArtworkScrapers(), lblLogo, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); { final JLabel lblClearlogoT = new JLabel(BUNDLE.getString("mediafiletype.clearlogo")); //$NON-NLS-1$ artworkPanel.add(lblClearlogoT, "4, 2"); } lblLogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblLogo, "2, 4, fill, fill"); } { lblClearlogo = new ImageLabel(); lblClearlogo.setAlternativeText(BUNDLE.getString("image.notfound.clearlogo")); //$NON-NLS-1$ lblClearlogo.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieSetToEdit.getIds(), ImageType.CLEARLOGO, movieList.getDefaultArtworkScrapers(), lblClearlogo, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblClearlogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblClearlogo, "4, 4, fill, fill"); } { JLabel lblClearartT = new JLabel(BUNDLE.getString("mediafiletype.clearart")); //$NON-NLS-1$ artworkPanel.add(lblClearartT, "2, 6"); } { lblClearart = new ImageLabel(); lblClearart.setAlternativeText(BUNDLE.getString("image.notfound.clearart")); //$NON-NLS-1$ lblClearart.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieSetToEdit.getIds(), ImageType.CLEARART, movieList.getDefaultArtworkScrapers(), lblClearart, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); { JLabel lblBannerT = new JLabel(BUNDLE.getString("mediafiletype.banner")); //$NON-NLS-1$ artworkPanel.add(lblBannerT, "4, 6"); } lblClearart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblClearart, "2, 8, fill, fill"); } { lblBanner = new ImageLabel(); lblBanner.setAlternativeText(BUNDLE.getString("image.notfound.banner")); //$NON-NLS-1$ lblBanner.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieSetToEdit.getIds(), ImageType.BANNER, movieList.getDefaultArtworkScrapers(), lblBanner, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblBanner.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblBanner, "4, 8, 3, 1, fill, fill"); } // extra artwork lblBanner.setImagePath(movieSetToEdit.getArtworkFilename(MediaFileType.BANNER)); } /** * Button pane */ { JPanel buttonPane = new JPanel(); getContentPane().add(buttonPane, BorderLayout.SOUTH); EqualsLayout layout = new EqualsLayout(5); buttonPane.setBorder(new EmptyBorder(4, 4, 4, 4)); layout.setMinWidth(100); buttonPane.setLayout(layout); { JButton btnOk = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ btnOk.setAction(actionOk); buttonPane.add(btnOk); getRootPane().setDefaultButton(btnOk); JButton btnCancel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ btnCancel.setAction(actionCancel); buttonPane.add(btnCancel); if (inQueue) { JButton abortButton = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ buttonPane.add(abortButton); abortButton.setAction(actionAbort); } } } { tfName.setText(movieSetToEdit.getTitle()); tfTmdbId.setText(String.valueOf(movieSetToEdit.getTmdbId())); tpOverview.setText(movieSetToEdit.getPlot()); moviesInSet.addAll(movieSetToEdit.getMovies()); if (StringUtils.isNotBlank(movieSetToEdit.getArtworkFilename(MediaFileType.POSTER))) { lblPoster.setImagePath(movieSetToEdit.getArtworkFilename(MediaFileType.POSTER)); } else { lblPoster.setImageUrl(movieSetToEdit.getArtworkUrl(MediaFileType.POSTER)); } if (StringUtils.isNotBlank(movieSetToEdit.getArtworkFilename(MediaFileType.FANART))) { lblFanart.setImagePath(movieSetToEdit.getArtworkFilename(MediaFileType.FANART)); } else { lblFanart.setImageUrl(movieSetToEdit.getArtworkUrl(MediaFileType.FANART)); } lblLogo.setImagePath(movieSetToEdit.getArtworkFilename(MediaFileType.LOGO)); lblClearlogo.setImagePath(movieSetToEdit.getArtworkFilename(MediaFileType.CLEARLOGO)); lblClearart.setImagePath(movieSetToEdit.getArtworkFilename(MediaFileType.CLEARART)); } initDataBindings(); // adjust table columns // name column tableMovies.getTableHeader().getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.name")); // year column int width = tableMovies.getFontMetrics(tableMovies.getFont()).stringWidth(" 2000"); int titleWidth = tableMovies.getFontMetrics(tableMovies.getFont()) .stringWidth(BUNDLE.getString("metatag.year")); //$NON-NLS-1$ if (titleWidth > width) { width = titleWidth; } tableMovies.getTableHeader().getColumnModel().getColumn(1).setPreferredWidth(width); tableMovies.getTableHeader().getColumnModel().getColumn(1).setMinWidth(width); tableMovies.getTableHeader().getColumnModel().getColumn(1).setMaxWidth((int) (width * 1.5)); tableMovies.getTableHeader().getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.year")); // watched column tableMovies.getTableHeader().getColumnModel().getColumn(2).setPreferredWidth(70); tableMovies.getTableHeader().getColumnModel().getColumn(2).setMinWidth(70); tableMovies.getTableHeader().getColumnModel().getColumn(2).setMaxWidth(85); tableMovies.getTableHeader().getColumnModel().getColumn(2) .setHeaderValue(BUNDLE.getString("metatag.watched")); }
From source file:org.tinymediamanager.ui.moviesets.MovieSetInformationPanel.java
/** * Instantiates a new movie set information panel. * /*from w w w .j a v a2 s . c o m*/ * @param model * the model */ public MovieSetInformationPanel(MovieSetSelectionModel model) { this.selectionModel = model; movieEventList = new ObservableElementList<>( GlazedListsSwing.swingThreadProxyList(new BasicEventList<Movie>()), GlazedLists.beanConnector(Movie.class)); setLayout(new BorderLayout(0, 0)); panel = new JPanel(); add(panel, BorderLayout.CENTER); panel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("180px:grow"), ColumnSpec.decode("1px"), }, new RowSpec[] { FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("pref:grow"), RowSpec.decode("bottom:default"), })); lblMovieSetName = new JLabel(""); TmmFontHelper.changeFont(lblMovieSetName, 1.5, Font.BOLD); panel.add(lblMovieSetName, "2,1, fill, fill"); layeredPane = new JLayeredPane(); panel.add(layeredPane, "1, 3, 2, 1, fill, fill"); layeredPane.setLayout(new FormLayout( new ColumnSpec[] { ColumnSpec.decode("10px"), ColumnSpec.decode("120px"), ColumnSpec.decode("200px:grow"), }, new RowSpec[] { RowSpec.decode("10px"), RowSpec.decode("180px"), RowSpec.decode("default:grow"), })); lblMovieSetPoster = new ImageLabel(); lblMovieSetPoster.setAlternativeText(BUNDLE.getString("image.notfound.poster")); //$NON-NLS-1$ lblMovieSetPoster.enableLightbox(); layeredPane.setLayer(lblMovieSetPoster, 1); layeredPane.add(lblMovieSetPoster, "2, 2, fill, fill"); lblMovieSetFanart = new ImageLabel(false, true); lblMovieSetFanart.setAlternativeText(BUNDLE.getString("image.notfound.fanart")); //$NON-NLS-1$ lblMovieSetFanart.enableLightbox(); layeredPane.add(lblMovieSetFanart, "1, 1, 3, 3, fill, fill"); panelSouth = new JSplitPane(); panelSouth.setContinuousLayout(true); panelSouth.setResizeWeight(0.5); add(panelSouth, BorderLayout.SOUTH); panelOverview = new JPanel(); panelSouth.setLeftComponent(panelOverview); panelOverview.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("100px:grow"), }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("24px:grow"), })); lblOverview = new JLabel(BUNDLE.getString("metatag.plot")); //$NON-NLS-1$ panelOverview.add(lblOverview, "1, 2"); scrollPaneOverview = new JScrollPane(); panelOverview.add(scrollPaneOverview, "1, 4, fill, fill"); tpOverview = new JTextPane(); tpOverview.setEditable(false); scrollPaneOverview.setViewportView(tpOverview); JPanel panelMovies = new JPanel(); panelSouth.setRightComponent(panelMovies); panelMovies.setLayout(new FormLayout(new ColumnSpec[] { ColumnSpec.decode("200px:grow(3)"), }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("203px:grow"), })); movieTableModel = new DefaultEventTableModel<>(GlazedListsSwing.swingThreadProxyList(movieEventList), new MovieInMovieSetTableFormat()); // tableAssignedMovies = new JTable(movieTableModel); tableAssignedMovies = new ZebraJTable(movieTableModel); // JScrollPane scrollPaneMovies = new JScrollPane(); JScrollPane scrollPaneMovies = ZebraJTable.createStripedJScrollPane(tableAssignedMovies); panelMovies.add(scrollPaneMovies, "1, 2, fill, fill"); tableAssignedMovies.setPreferredScrollableViewportSize(new Dimension(450, 200)); scrollPaneMovies.setViewportView(tableAssignedMovies); initDataBindings(); // adjust table columns // year column int width = tableAssignedMovies.getFontMetrics(tableAssignedMovies.getFont()).stringWidth(" 2000"); int titleWidth = tableAssignedMovies.getFontMetrics(tableAssignedMovies.getFont()) .stringWidth(BUNDLE.getString("metatag.year")); //$NON-NLS-1$ if (titleWidth > width) { width = titleWidth; } tableAssignedMovies.getTableHeader().getColumnModel().getColumn(1).setPreferredWidth(width); tableAssignedMovies.getTableHeader().getColumnModel().getColumn(1).setMinWidth(width); tableAssignedMovies.getTableHeader().getColumnModel().getColumn(1).setMaxWidth((int) (width * 1.5)); // watched column tableAssignedMovies.getTableHeader().getColumnModel().getColumn(2).setPreferredWidth(70); tableAssignedMovies.getTableHeader().getColumnModel().getColumn(2).setMinWidth(70); tableAssignedMovies.getTableHeader().getColumnModel().getColumn(2).setMaxWidth(85); // install the propertychangelistener PropertyChangeListener propertyChangeListener = new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent propertyChangeEvent) { String property = propertyChangeEvent.getPropertyName(); Object source = propertyChangeEvent.getSource(); // react on selection of a movie and change of media files if ((source.getClass() == MovieSetSelectionModel.class && "selectedMovieSet".equals(property)) || (source.getClass() == MovieSet.class && "movies".equals(property))) { movieEventList.clear(); movieEventList.addAll(selectionModel.getSelectedMovieSet().getMovies()); if (StringUtils.isNotBlank( selectionModel.getSelectedMovieSet().getArtworkFilename(MediaFileType.POSTER))) { lblMovieSetPoster.setImagePath( selectionModel.getSelectedMovieSet().getArtworkFilename(MediaFileType.POSTER)); } else { lblMovieSetPoster.setImagePath(""); lblMovieSetPoster.setImageUrl( selectionModel.getSelectedMovieSet().getArtworkUrl(MediaFileType.POSTER)); } if (StringUtils.isNotBlank( selectionModel.getSelectedMovieSet().getArtworkFilename(MediaFileType.FANART))) { lblMovieSetFanart.setImagePath( selectionModel.getSelectedMovieSet().getArtworkFilename(MediaFileType.FANART)); } else { lblMovieSetFanart.setImagePath(""); lblMovieSetFanart.setImageUrl( selectionModel.getSelectedMovieSet().getArtworkUrl(MediaFileType.FANART)); } } // react on changes of the images if ((source.getClass() == MovieSet.class && FANART.equals(property))) { MovieSet movieSet = (MovieSet) source; lblMovieSetFanart.clearImage(); lblMovieSetFanart.setImagePath(movieSet.getArtworkFilename(MediaFileType.FANART)); } if ((source.getClass() == MovieSet.class && POSTER.equals(property))) { MovieSet movieSet = (MovieSet) source; lblMovieSetPoster.clearImage(); lblMovieSetPoster.setImagePath(movieSet.getArtworkFilename(MediaFileType.POSTER)); } } }; selectionModel.addPropertyChangeListener(propertyChangeListener); }
From source file:org.tinymediamanager.ui.settings.FileTypesSettingsPanel.java
/** * Instantiates a new general settings panel. *//*w w w . j a v a 2s . c om*/ public FileTypesSettingsPanel() { setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("left:max(200px;min)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(200px;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(200px;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(200px;default)"), }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("top:default"), FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("top:default"), FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), })); panelVideoFiletypes = new JPanel(); panelVideoFiletypes.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), //$NON-NLS-1$ BUNDLE.getString("Settings.videofiletypes"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelVideoFiletypes.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); JScrollPane scrollPaneVideoFiletypes = new JScrollPane(); panelVideoFiletypes.add(scrollPaneVideoFiletypes, "2, 2, 5, 1, fill, fill"); listVideoFiletypes = new JList(); scrollPaneVideoFiletypes.setViewportView(listVideoFiletypes); tfVideoFiletype = new JTextField(); panelVideoFiletypes.add(tfVideoFiletype, "2, 4, fill, default"); tfVideoFiletype.setColumns(10); JButton btnAddVideoFiletype = new JButton(IconManager.LIST_ADD); btnAddVideoFiletype.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$ btnAddVideoFiletype.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotEmpty(tfVideoFiletype.getText())) { Globals.settings.addVideoFileTypes(tfVideoFiletype.getText()); tfVideoFiletype.setText(""); } } }); panelVideoFiletypes.add(btnAddVideoFiletype, "4, 4"); add(panelVideoFiletypes, "2, 2, fill, fill"); JButton btnRemoveVideoFiletype = new JButton(IconManager.LIST_REMOVE); btnRemoveVideoFiletype.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$ btnRemoveVideoFiletype.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int row = listVideoFiletypes.getSelectedIndex(); if (row != -1) { String prefix = Globals.settings.getVideoFileType().get(row); Globals.settings.removeVideoFileType(prefix); } } }); panelVideoFiletypes.add(btnRemoveVideoFiletype, "6, 4, default, bottom"); panelSubtitleFiletypes = new JPanel(); add(panelSubtitleFiletypes, "4, 2, fill, fill"); panelSubtitleFiletypes.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), //$NON-NLS-1$ BUNDLE.getString("Settings.extrafiletypes"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelSubtitleFiletypes.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); JScrollPane scrollPaneSubtitleFiletypes = new JScrollPane(); panelSubtitleFiletypes.add(scrollPaneSubtitleFiletypes, "2, 2, 5, 1, fill, fill"); listSubtitleFiletypes = new JList(); scrollPaneSubtitleFiletypes.setViewportView(listSubtitleFiletypes); tfSubtitleFiletype = new JTextField(); panelSubtitleFiletypes.add(tfSubtitleFiletype, "2, 4, fill, default"); tfSubtitleFiletype.setColumns(10); JButton btnAddSubtitleFiletype = new JButton(IconManager.LIST_ADD); btnAddSubtitleFiletype.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$ btnAddSubtitleFiletype.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotEmpty(tfSubtitleFiletype.getText())) { Globals.settings.addSubtitleFileTypes(tfSubtitleFiletype.getText()); tfSubtitleFiletype.setText(""); } } }); panelSubtitleFiletypes.add(btnAddSubtitleFiletype, "4, 4"); JButton btnRemoveSubtitleFiletype = new JButton(IconManager.LIST_REMOVE); btnRemoveSubtitleFiletype.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$ btnRemoveSubtitleFiletype.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int row = listSubtitleFiletypes.getSelectedIndex(); if (row != -1) { String prefix = Globals.settings.getSubtitleFileType().get(row); Globals.settings.removeSubtitleFileType(prefix); } } }); panelSubtitleFiletypes.add(btnRemoveSubtitleFiletype, "6, 4, default, bottom"); panelAudioFiletypes = new JPanel(); add(panelAudioFiletypes, "6, 2, fill, fill"); panelAudioFiletypes.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), //$NON-NLS-1$ BUNDLE.getString("Settings.audiofiletypes"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); panelAudioFiletypes.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); JScrollPane scrollPaneAudioFiletypes = new JScrollPane(); panelAudioFiletypes.add(scrollPaneAudioFiletypes, "2, 2, 5, 1, fill, fill"); listAudioFiletypes = new JList(); scrollPaneAudioFiletypes.setViewportView(listAudioFiletypes); tfAudioFiletype = new JTextField(); panelAudioFiletypes.add(tfAudioFiletype, "2, 4, fill, default"); tfAudioFiletype.setColumns(10); JButton btnAddAudioFiletype = new JButton(IconManager.LIST_ADD); btnAddAudioFiletype.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$ btnAddAudioFiletype.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotEmpty(tfAudioFiletype.getText())) { Globals.settings.addAudioFileTypes(tfAudioFiletype.getText()); tfAudioFiletype.setText(""); } } }); panelAudioFiletypes.add(btnAddAudioFiletype, "4, 4"); JButton btnRemoveAudioFiletype = new JButton(IconManager.LIST_REMOVE); btnRemoveAudioFiletype.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$ btnRemoveAudioFiletype.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int row = listAudioFiletypes.getSelectedIndex(); if (row != -1) { String prefix = Globals.settings.getAudioFileType().get(row); Globals.settings.removeAudioFileType(prefix); } } }); panelAudioFiletypes.add(btnRemoveAudioFiletype, "6, 4, default, bottom"); JPanel panelSortOptions = new JPanel(); panelSortOptions.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), BUNDLE.getString("Settings.sorting"), TitledBorder.LEADING, TitledBorder.TOP, null, null)); // $NON-NLS-1$ add(panelSortOptions, "2, 4, 3, 1, fill, fill"); panelSortOptions.setLayout(new FormLayout(new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, })); JScrollPane scrollPaneSortPrefixes = new JScrollPane(); panelSortOptions.add(scrollPaneSortPrefixes, "2, 2, 5, 1, fill, fill"); listSortPrefixes = new JList(); scrollPaneSortPrefixes.setViewportView(listSortPrefixes); tfSortPrefix = new JTextField(); panelSortOptions.add(tfSortPrefix, "2, 4, fill, default"); tfSortPrefix.setColumns(10); JButton btnAddSortPrefix = new JButton(IconManager.LIST_ADD); btnAddSortPrefix.setToolTipText(BUNDLE.getString("Button.add")); //$NON-NLS-1$ btnAddSortPrefix.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotEmpty(tfSortPrefix.getText())) { Globals.settings.addTitlePrefix(tfSortPrefix.getText()); tfSortPrefix.setText(""); MovieList.getInstance().invalidateTitleSortable(); TvShowList.getInstance().invalidateTitleSortable(); } } }); panelSortOptions.add(btnAddSortPrefix, "4, 4"); JButton btnRemoveSortPrefix = new JButton(IconManager.LIST_REMOVE); btnRemoveSortPrefix.setToolTipText(BUNDLE.getString("Button.remove")); //$NON-NLS-1$ btnRemoveSortPrefix.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { int row = listSortPrefixes.getSelectedIndex(); if (row != -1) { String prefix = Globals.settings.getTitlePrefix().get(row); Globals.settings.removeTitlePrefix(prefix); MovieList.getInstance().invalidateTitleSortable(); TvShowList.getInstance().invalidateTitleSortable(); } } }); panelSortOptions.add(btnRemoveSortPrefix, "6, 4, default, bottom"); JTextPane tpSortingHints = new JTextPane(); TmmFontHelper.changeFont(tpSortingHints, 0.833); tpSortingHints.setText(BUNDLE.getString("Settings.sorting.info")); //$NON-NLS-1$ tpSortingHints.setBackground(UIManager.getColor("Panel.background")); panelSortOptions.add(tpSortingHints, "2, 6, 3, 1, fill, fill"); initDataBindings(); }
From source file:org.tinymediamanager.ui.tvshows.dialogs.TvShowEditorDialog.java
/** * Instantiates a new tv show editor dialog. * /*from w w w .ja va 2s.c om*/ * @param tvShow * the tv show * @param inQueue * the in queue */ public TvShowEditorDialog(TvShow tvShow, boolean inQueue) { super(BUNDLE.getString("tvshow.edit"), "tvShowEditor"); //$NON-NLS-1$ setBounds(5, 5, 950, 700); tvShowToEdit = tvShow; ids = MediaIdTable.convertIdMapToEventList(tvShowToEdit.getIds()); getContentPane().setLayout(new BorderLayout()); { JPanel panelPath = new JPanel(); getContentPane().add(panelPath, BorderLayout.NORTH); panelPath.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("15px"), FormFactory.RELATED_GAP_ROWSPEC, })); JLabel lblTvShowPathT = new JLabel(BUNDLE.getString("metatag.path")); //$NON-NLS-1$ panelPath.add(lblTvShowPathT, "2, 2, left, top"); lvlTvShowPath = new JLabel(""); TmmFontHelper.changeFont(lblTvShowPathT, 1.166, Font.BOLD); panelPath.add(lvlTvShowPath, "5, 2, left, top"); } JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.NORTH); tabbedPane.addTab(BUNDLE.getString("metatag.details"), details1Panel); //$NON-NLS-1$ getContentPane().add(tabbedPane, BorderLayout.CENTER); details1Panel.setBorder(new EmptyBorder(5, 5, 5, 5)); details1Panel.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(40dlu;default)"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50px:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("50px:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("30dlu"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("15dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("top:max(30dlu;default)"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("20dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:30px:grow(2)"), })); { JLabel lblTitle = new JLabel(BUNDLE.getString("metatag.title")); //$NON-NLS-1$ details1Panel.add(lblTitle, "2, 2, right, default"); } { tfTitle = new JTextField(); details1Panel.add(tfTitle, "4, 2, 15, 1, fill, default"); tfTitle.setColumns(10); } { lblPoster = new ImageLabel(); lblPoster.setAlternativeText(BUNDLE.getString("image.notfound.poster")); //$NON-NLS-1$ lblPoster.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(tvShowToEdit.getIds(), ImageType.POSTER, tvShowList.getAvailableArtworkScrapers(), lblPoster, null, null, MediaType.TV_SHOW); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblPoster.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); details1Panel.add(lblPoster, "22, 2, 3, 19, fill, fill"); } { JLabel lblSortTitle = new JLabel(BUNDLE.getString("metatag.sorttitle")); //$NON-NLS-1$ details1Panel.add(lblSortTitle, "2, 4, right, default"); } { tfSorttitle = new JTextField(); details1Panel.add(tfSorttitle, "4, 4, 15, 1, fill, default"); tfSorttitle.setColumns(10); } { JLabel lblYear = new JLabel(BUNDLE.getString("metatag.year")); //$NON-NLS-1$ details1Panel.add(lblYear, "2, 6, right, default"); } { spYear = new YearSpinner(); details1Panel.add(spYear, "4, 6, fill, top"); } { JLabel lblpremiered = new JLabel(BUNDLE.getString("metatag.premiered")); //$NON-NLS-1$ details1Panel.add(lblpremiered, "8, 6, right, default"); } { dpPremiered = new DatePicker(tvShow.getFirstAired()); details1Panel.add(dpPremiered, "10, 6, fill, default"); } { JLabel lblRuntime = new JLabel(BUNDLE.getString("metatag.runtime")); //$NON-NLS-1$ details1Panel.add(lblRuntime, "14, 6, right, default"); } { spRuntime = new JSpinner(); details1Panel.add(spRuntime, "16, 6, fill, default"); } spRuntime.setValue(tvShow.getRuntime()); { JLabel lblMin = new JLabel(BUNDLE.getString("metatag.minutes")); //$NON-NLS-1$ details1Panel.add(lblMin, "18, 6"); } { JLabel lblRating = new JLabel(BUNDLE.getString("metatag.rating")); //$NON-NLS-1$ details1Panel.add(lblRating, "2, 8, right, default"); } { spRating = new JSpinner(); details1Panel.add(spRating, "4, 8"); } spRating.setModel(new SpinnerNumberModel(tvShow.getRating(), 0.0, 10.0, 0.1)); { { JLabel lblCertification = new JLabel(BUNDLE.getString("metatag.certification")); //$NON-NLS-1$ details1Panel.add(lblCertification, "8, 8, right, default"); } } cbCertification = new JComboBox(); for (Certification cert : Certification .getCertificationsforCountry(TvShowModuleManager.SETTINGS.getCertificationCountry())) { cbCertification.addItem(cert); } details1Panel.add(cbCertification, "10, 8, fill, default"); cbCertification.setSelectedItem(tvShow.getCertification()); { JLabel lblStatus = new JLabel(BUNDLE.getString("metatag.status")); //$NON-NLS-1$ details1Panel.add(lblStatus, "14, 8, right, default"); } { cbStatus = new JComboBox(new String[] { "", "Continuing", "Ended" }); details1Panel.add(cbStatus, "16, 8, 3, 1, fill, default"); } cbStatus.setSelectedItem(tvShow.getStatus()); { JLabel lblDateAdded = new JLabel(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$ details1Panel.add(lblDateAdded, "2, 10, right, default"); } { spDateAdded = new JSpinner(new SpinnerDateModel()); details1Panel.add(spDateAdded, "4, 10"); } { JLabel lblIds = new JLabel("Ids"); details1Panel.add(lblIds, "2, 12, right, default"); } { JScrollPane scrollPaneIds = new JScrollPane(); details1Panel.add(scrollPaneIds, "4, 12, 9, 5, fill, fill"); { tableIds = new MediaIdTable(ids, ScraperType.TV_SHOW); scrollPaneIds.setViewportView(tableIds); } } { JButton btnAddId = new JButton(""); btnAddId.setAction(new AddIdAction()); btnAddId.setIcon(IconManager.LIST_ADD); btnAddId.setMargin(new Insets(2, 2, 2, 2)); details1Panel.add(btnAddId, "2, 14, right, top"); } { JButton btnRemoveId = new JButton("RemoveId"); btnRemoveId.setAction(new RemoveIdAction()); btnRemoveId.setIcon(IconManager.LIST_REMOVE); btnRemoveId.setMargin(new Insets(2, 2, 2, 2)); details1Panel.add(btnRemoveId, "2, 16, right, top"); } { JLabel lblPlot = new JLabel(BUNDLE.getString("metatag.plot")); //$NON-NLS-1$ details1Panel.add(lblPlot, "2, 18, right, top"); } { JScrollPane scrollPanePlot = new JScrollPane(); details1Panel.add(scrollPanePlot, "4, 18, 15, 3, fill, fill"); { tpPlot = new JTextPane(); scrollPanePlot.setViewportView(tpPlot); } } { JLabel lblStudio = new JLabel(BUNDLE.getString("metatag.studio")); //$NON-NLS-1$ details1Panel.add(lblStudio, "2, 22, right, top"); } { tfStudio = new JTextField(); details1Panel.add(tfStudio, "4, 22, 15, 1"); } /** * DetailsPanel 2 */ tabbedPane.addTab(BUNDLE.getString("metatag.details2"), details2Panel); //$NON-NLS-1$ details2Panel.setBorder(new EmptyBorder(5, 5, 5, 5)); details2Panel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("max(40dlu;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px:grow(2)"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("100px:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:30px:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow(2)"), })); { JLabel lblActors = new JLabel(BUNDLE.getString("metatag.actors")); //$NON-NLS-1$ details2Panel.add(lblActors, "2, 2, right, default"); } { JScrollPane scrollPane = new JScrollPane(); details2Panel.add(scrollPane, "4, 2, 1, 7"); { tableActors = new JTable(); tableActors.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); scrollPane.setViewportView(tableActors); } } { JLabel lblGenres = new JLabel(BUNDLE.getString("metatag.genre")); //$NON-NLS-1$ details2Panel.add(lblGenres, "6, 2"); } { JButton btnAddActor = new JButton("Add Actor"); btnAddActor.setMargin(new Insets(2, 2, 2, 2)); btnAddActor.setAction(new AddActorAction()); btnAddActor.setIcon(IconManager.LIST_ADD); details2Panel.add(btnAddActor, "2, 4, right, top"); } { JScrollPane scrollPaneGenres = new JScrollPane(); details2Panel.add(scrollPaneGenres, "8, 2, 1, 5"); { listGenres = new JList(); scrollPaneGenres.setViewportView(listGenres); } } { JButton btnAddGenre = new JButton(""); btnAddGenre.setAction(new AddGenreAction()); btnAddGenre.setIcon(IconManager.LIST_ADD); btnAddGenre.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnAddGenre, "6, 4, right, top"); } { JButton btnRemoveActor = new JButton(BUNDLE.getString("cast.actor.remove")); //$NON-NLS-1$ btnRemoveActor.setMargin(new Insets(2, 2, 2, 2)); btnRemoveActor.setAction(new RemoveActorAction()); btnRemoveActor.setIcon(IconManager.LIST_REMOVE); details2Panel.add(btnRemoveActor, "2,6, right, top"); } { JButton btnRemoveGenre = new JButton(""); btnRemoveGenre.setAction(new RemoveGenreAction()); btnRemoveGenre.setMargin(new Insets(2, 2, 2, 2)); btnRemoveGenre.setIcon(IconManager.LIST_REMOVE); details2Panel.add(btnRemoveGenre, "6, 6, right, top"); } { cbGenres = new AutocompleteComboBox(MediaGenres.values()); cbGenres.setEditable(true); details2Panel.add(cbGenres, "8,8"); } { JLabel lblTags = new JLabel(BUNDLE.getString("metatag.tags")); //$NON-NLS-1$ details2Panel.add(lblTags, "2, 10, right, default"); } { JScrollPane scrollPaneTags = new JScrollPane(); details2Panel.add(scrollPaneTags, "4, 10, 1, 5"); listTags = new JList(); scrollPaneTags.setViewportView(listTags); } { JButton btnAddTag = new JButton(""); btnAddTag.setAction(new AddTagAction()); btnAddTag.setIcon(IconManager.LIST_ADD); btnAddTag.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnAddTag, "2, 12, right, top"); } { JButton btnRemoveTag = new JButton(""); btnRemoveTag.setAction(new RemoveTagAction()); btnRemoveTag.setIcon(IconManager.LIST_REMOVE); btnRemoveTag.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnRemoveTag, "2, 14, right, top"); } { cbTags = new AutocompleteComboBox(tvShowList.getTagsInTvShows().toArray()); cbTags.setEditable(true); details2Panel.add(cbTags, "4, 16"); } /** * extra artwork pane */ { JPanel artworkPanel = new JPanel(); tabbedPane.addTab(BUNDLE.getString("metatag.extraartwork"), null, artworkPanel, null); //$NON-NLS-1$ artworkPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("50px:grow(2)"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("200px:grow(2)"), FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), })); { JLabel lblLogoT = new JLabel(BUNDLE.getString("mediafiletype.logo")); //$NON-NLS-1$ artworkPanel.add(lblLogoT, "2, 2"); } { lblLogo = new ImageLabel(); lblLogo.setAlternativeText(BUNDLE.getString("image.notfound.logo")); //$NON-NLS-1$ lblLogo.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(tvShowToEdit.getIds(), ImageType.LOGO, tvShowList.getAvailableArtworkScrapers(), lblLogo, null, null, MediaType.TV_SHOW); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); { final JLabel lblClearlogoT = new JLabel(BUNDLE.getString("mediafiletype.clearlogo")); //$NON-NLS-1$ artworkPanel.add(lblClearlogoT, "4, 2"); } lblLogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblLogo, "2, 4, fill, fill"); } { lblClearlogo = new ImageLabel(); lblClearlogo.setAlternativeText(BUNDLE.getString("image.notfound.clearlogo")); //$NON-NLS-1$ lblClearlogo.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(tvShowToEdit.getIds(), ImageType.CLEARLOGO, tvShowList.getAvailableArtworkScrapers(), lblClearlogo, null, null, MediaType.TV_SHOW); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblClearlogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblClearlogo, "4, 4, fill, fill"); } { JLabel lblClearartT = new JLabel(BUNDLE.getString("mediafiletype.clearart")); //$NON-NLS-1$ artworkPanel.add(lblClearartT, "2, 6"); } { lblClearart = new ImageLabel(); lblClearart.setAlternativeText(BUNDLE.getString("image.notfound.clearart")); //$NON-NLS-1$ lblClearart.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(tvShowToEdit.getIds(), ImageType.CLEARART, tvShowList.getAvailableArtworkScrapers(), lblClearart, null, null, MediaType.TV_SHOW); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblClearart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblClearart, "2, 8, fill, fill"); } { JLabel lblThumbT = new JLabel(BUNDLE.getString("mediafiletype.thumb")); //$NON-NLS-1$ artworkPanel.add(lblThumbT, "4, 6"); } { lblThumb = new ImageLabel(); lblThumb.setAlternativeText(BUNDLE.getString("image.notfound.thumb")); //$NON-NLS-1$ lblThumb.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(tvShowToEdit.getIds(), ImageType.THUMB, tvShowList.getAvailableArtworkScrapers(), lblThumb, null, null, MediaType.TV_SHOW); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblThumb.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblThumb, "4, 8, fill, fill"); } } tabbedPane.addTab(BUNDLE.getString("metatag.episodes"), episodesPanel); //$NON-NLS-1$ episodesPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), })); { JButton btnCloneEpisode = new JButton(""); btnCloneEpisode.setAction(new CloneEpisodeAction()); episodesPanel.add(btnCloneEpisode, "2, 2"); } { JScrollPane scrollPaneEpisodes = new JScrollPane(); episodesPanel.add(scrollPaneEpisodes, "4, 2, 1, 3, fill, fill"); { tableEpisodes = new JTable(); scrollPaneEpisodes.setViewportView(tableEpisodes); } } { JButton btnRemoveEpisode = new JButton(""); btnRemoveEpisode.setAction(new RemoveEpisodeAction()); btnRemoveEpisode.setIcon(IconManager.LIST_REMOVE); episodesPanel.add(btnRemoveEpisode, "2, 4, default, top"); } /** * Button pane */ { JPanel bottomPane = new JPanel(); getContentPane().add(bottomPane, BorderLayout.SOUTH); bottomPane.setLayout(new FormLayout( new ColumnSpec[] { ColumnSpec.decode("371px:grow"), FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("25px"), FormFactory.RELATED_GAP_ROWSPEC, })); JPanel buttonPane = new JPanel(); bottomPane.add(buttonPane, "2, 2, left, top"); EqualsLayout layout = new EqualsLayout(5); layout.setMinWidth(100); buttonPane.setLayout(layout); { JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ buttonPane.add(okButton); okButton.setAction(new OKAction()); okButton.setActionCommand("OK"); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ buttonPane.add(cancelButton); cancelButton.setAction(new CancelAction()); cancelButton.setActionCommand("Cancel"); } if (inQueue) { JButton btnAbort = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ btnAbort.setAction(new AbortAction()); buttonPane.add(btnAbort); } } initDataBindings(); { lvlTvShowPath.setText(tvShow.getPath()); tfTitle.setText(tvShow.getTitle()); tfSorttitle.setText(tvShow.getSortTitle()); tpPlot.setText(tvShow.getPlot()); lblPoster.setImagePath(tvShow.getArtworkFilename(MediaFileType.POSTER)); lblThumb.setImagePath(tvShowToEdit.getArtworkFilename(MediaFileType.THUMB)); lblLogo.setImagePath(tvShowToEdit.getArtworkFilename(MediaFileType.LOGO)); lblClearlogo.setImagePath(tvShowToEdit.getArtworkFilename(MediaFileType.CLEARLOGO)); lblClearart.setImagePath(tvShowToEdit.getArtworkFilename(MediaFileType.CLEARART)); tfStudio.setText(tvShow.getProductionCompany()); int year = 0; try { year = Integer.parseInt(tvShow.getYear()); } catch (Exception e) { } spYear.setValue(year); spDateAdded.setValue(tvShow.getDateAdded()); for (TvShowActor origCast : tvShow.getActors()) { TvShowActor actor = new TvShowActor(); actor.setName(origCast.getName()); actor.setCharacter(origCast.getCharacter()); actor.setThumbUrl(origCast.getThumbUrl()); actors.add(actor); } for (MediaGenres genre : tvShow.getGenres()) { genres.add(genre); } // for (MediaTrailer trailer : tvShow.getTrailers()) { // trailers.add(trailer); // } for (String tag : tvShowToEdit.getTags()) { tags.add(tag); } List<TvShowEpisode> epl = new ArrayList<>(tvShowToEdit.getEpisodes()); // custom sort per filename (just this time) // for unknown EPs (-1/-1) this is extremely useful to sort like on filesystem // and for already renamed ones, it makes no difference Collections.sort(epl, new Comparator<TvShowEpisode>() { public int compare(TvShowEpisode s1, TvShowEpisode s2) { return s1.getMediaFiles(MediaFileType.VIDEO).get(0).getFile() .compareTo(s2.getMediaFiles(MediaFileType.VIDEO).get(0).getFile()); } }); for (TvShowEpisode episode : epl) { TvShowEpisodeEditorContainer container = new TvShowEpisodeEditorContainer(); container.tvShowEpisode = episode; container.dvdOrder = episode.isDvdOrder(); container.season = episode.getSeason(); container.episode = episode.getEpisode(); episodes.add(container); } if (((DefaultComboBoxModel) cbCertification.getModel()).getIndexOf(tvShow.getCertification()) == -1) { cbCertification.addItem(tvShow.getCertification()); } } lblBanner = new ImageLabel(); lblBanner.setAlternativeText(BUNDLE.getString("image.notfound.banner")); //$NON-NLS-1$ lblBanner.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); lblBanner.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(tvShowToEdit.getIds(), ImageType.BANNER, tvShowList.getAvailableArtworkScrapers(), lblBanner, null, null, MediaType.TV_SHOW); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); details1Panel.add(lblBanner, "4, 24, 15, 3, fill, fill"); lblBanner.setImagePath(tvShow.getArtworkFilename(MediaFileType.BANNER)); { // JLabel lblFanart = new JLabel(""); lblFanart = new ImageLabel(); lblFanart.setAlternativeText(BUNDLE.getString("image.notfound.fanart")); //$NON-NLS-1$ lblFanart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); lblFanart.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(tvShowToEdit.getIds(), ImageType.FANART, tvShowList.getAvailableArtworkScrapers(), lblFanart, null, null, MediaType.TV_SHOW); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); details1Panel.add(lblFanart, "22, 22, 3, 5, fill, fill"); } lblFanart.setImagePath(tvShow.getArtworkFilename(MediaFileType.FANART)); // adjust columnn titles - we have to do it this way - thx to windowbuilder pro tableActors.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$ tableActors.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.role")); //$NON-NLS-1$ tableEpisodes.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.title")); //$NON-NLS-1$ tableEpisodes.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.filename")); //$NON-NLS-1$ tableEpisodes.getColumnModel().getColumn(2).setHeaderValue(BUNDLE.getString("metatag.season")); //$NON-NLS-1$ tableEpisodes.getColumnModel().getColumn(3).setHeaderValue(BUNDLE.getString("metatag.episode")); //$NON-NLS-1$ tableEpisodes.getColumnModel().getColumn(4).setHeaderValue(BUNDLE.getString("metatag.dvdorder")); //$NON-NLS-1$ tableEpisodes.getColumnModel().getColumn(2).setMaxWidth(150); tableEpisodes.getColumnModel().getColumn(3).setMaxWidth(150); tableEpisodes.getColumnModel().getColumn(2).setCellEditor(new TableSpinnerEditor()); tableEpisodes.getColumnModel().getColumn(3).setCellEditor(new TableSpinnerEditor()); // adjust table columns TableColumnResizer.adjustColumnPreferredWidths(tableActors, 6); // TableColumnResizer.adjustColumnPreferredWidths(tableTrailer, 6); TableColumnResizer.adjustColumnPreferredWidths(tableEpisodes, 6); }
From source file:org.tinymediamanager.ui.tvshows.dialogs.TvShowEpisodeChooserDialog.java
public TvShowEpisodeChooserDialog(TvShowEpisode ep, MediaScraper mediaScraper) { super(BUNDLE.getString("tvshowepisode.choose"), "episodeChooser"); //$NON-NLS-1$ setBounds(5, 5, 600, 400);// www. j av a 2 s.co m this.episode = ep; this.mediaScraper = mediaScraper; this.metadata = new MediaEpisode(mediaScraper.getId()); episodeEventList = new ObservableElementList<>( GlazedLists.threadSafeList(new BasicEventList<TvShowEpisodeChooserModel>()), GlazedLists.beanConnector(TvShowEpisodeChooserModel.class)); sortedEpisodes = new SortedList<>(GlazedListsSwing.swingThreadProxyList(episodeEventList), new EpisodeComparator()); getContentPane().setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("590px:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("fill:37px"), FormSpecs.RELATED_GAP_ROWSPEC, })); { JSplitPane splitPane = new JSplitPane(); getContentPane().add(splitPane, "2, 2, fill, fill"); JPanel panelLeft = new JPanel(); panelLeft.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("150dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); textField = EnhancedTextField.createSearchTextField(); panelLeft.add(textField, "2, 2, fill, default"); textField.setColumns(10); JScrollPane scrollPane = new JScrollPane(); scrollPane.setMinimumSize(new Dimension(200, 23)); panelLeft.add(scrollPane, "2, 4, fill, fill"); splitPane.setLeftComponent(panelLeft); MatcherEditor<TvShowEpisodeChooserModel> textMatcherEditor = new TextComponentMatcherEditor<>(textField, new TvShowEpisodeChooserModelFilterator()); FilterList<TvShowEpisodeChooserModel> textFilteredEpisodes = new FilterList<>(sortedEpisodes, textMatcherEditor); AdvancedTableModel<TvShowEpisodeChooserModel> episodeTableModel = GlazedListsSwing .eventTableModelWithThreadProxyList(textFilteredEpisodes, new EpisodeTableFormat()); DefaultEventSelectionModel<TvShowEpisodeChooserModel> selectionModel = new DefaultEventSelectionModel<>( textFilteredEpisodes); selectedEpisodes = selectionModel.getSelected(); selectionModel.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { return; } // display first selected episode if (!selectedEpisodes.isEmpty()) { TvShowEpisodeChooserModel episode = selectedEpisodes.get(0); taPlot.setText(episode.getOverview()); } else { taPlot.setText(""); } taPlot.setCaretPosition(0); } }); table = new JTable(episodeTableModel); table.setSelectionModel(selectionModel); scrollPane.setViewportView(table); JPanel panelRight = new JPanel(); panelRight.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("150dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); JScrollPane scrollPane_1 = new JScrollPane(); panelRight.add(scrollPane_1, "2, 2, fill, fill"); splitPane.setRightComponent(panelRight); taPlot = new JTextArea(); taPlot.setEditable(false); taPlot.setWrapStyleWord(true); taPlot.setLineWrap(true); scrollPane_1.setViewportView(taPlot); splitPane.setDividerLocation(300); } JPanel bottomPanel = new JPanel(); getContentPane().add(bottomPanel, "2, 4, fill, top"); bottomPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("25px"), FormFactory.RELATED_GAP_ROWSPEC, })); JPanel buttonPane = new JPanel(); bottomPanel.add(buttonPane, "5, 2, fill, fill"); EqualsLayout layout = new EqualsLayout(5); layout.setMinWidth(100); buttonPane.setLayout(layout); final JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ okButton.setToolTipText(BUNDLE.getString("tvshow.change")); okButton.setIcon(IconManager.APPLY); buttonPane.add(okButton); okButton.setActionCommand("OK"); okButton.addActionListener(this); JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ cancelButton.setToolTipText(BUNDLE.getString("edit.discard")); cancelButton.setIcon(IconManager.CANCEL); buttonPane.add(cancelButton); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); // column widths table.getColumnModel().getColumn(0).setMaxWidth(50); table.getColumnModel().getColumn(1).setMaxWidth(50); SearchTask task = new SearchTask(); task.execute(); MouseListener mouseListener = new MouseListener() { @Override public void mouseReleased(MouseEvent e) { } @Override public void mousePressed(MouseEvent e) { } @Override public void mouseExited(MouseEvent e) { } @Override public void mouseEntered(MouseEvent e) { } @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() >= 2 && !e.isConsumed() && e.getButton() == MouseEvent.BUTTON1) { actionPerformed(new ActionEvent(okButton, ActionEvent.ACTION_PERFORMED, "OK")); } } }; table.addMouseListener(mouseListener); }
From source file:org.tinymediamanager.ui.tvshows.dialogs.TvShowEpisodeEditorDialog.java
/** * Instantiates a new tv show episode scrape dialog. * //from w ww . java2 s . co m * @param episode * the episode * @param inQueue * the in queue */ public TvShowEpisodeEditorDialog(TvShowEpisode episode, boolean inQueue) { super(BUNDLE.getString("tvshowepisode.scrape"), "tvShowEpisodeScraper"); //$NON-NLS-1$ setBounds(5, 5, 964, 632); for (MediaFile mf : episode.getMediaFiles()) { mediaFiles.add(new MediaFile(mf)); } this.episodeToEdit = episode; getContentPane().setLayout(new BorderLayout()); { JPanel panelFilename = new JPanel(); getContentPane().add(panelFilename, BorderLayout.NORTH); panelFilename.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("15px"), FormFactory.RELATED_GAP_ROWSPEC, })); JLabel lblFilenameT = new JLabel(BUNDLE.getString("metatag.path")); //$NON-NLS-1$ panelFilename.add(lblFilenameT, "2, 2, left, top"); lblFilename = new JLabel(""); TmmFontHelper.changeFont(lblFilename, 1.166, Font.BOLD); panelFilename.add(lblFilename, "5, 2, left, top"); } JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.NORTH); getContentPane().add(tabbedPane, BorderLayout.CENTER); /** * DetailsPanel */ { JPanel detailsPanel = new JPanel(); tabbedPane.addTab(BUNDLE.getString("metatag.details"), detailsPanel); //$NON-NLS-1$ detailsPanel.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("40dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("7dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("20dlu"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("30dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("7dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu:grow"), FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.LINE_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("35dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); JLabel lblTitle = new JLabel(BUNDLE.getString("metatag.title")); //$NON-NLS-1$ detailsPanel.add(lblTitle, "2, 4, right, default"); tfTitle = new JTextField(); detailsPanel.add(tfTitle, "4, 4, 19, 1"); tfTitle.setColumns(10); JLabel lblSeason = new JLabel(BUNDLE.getString("metatag.season")); //$NON-NLS-1$ detailsPanel.add(lblSeason, "2, 6, right, default"); spSeason = new JSpinner(); detailsPanel.add(spSeason, "4, 6"); JLabel lblEpisode = new JLabel(BUNDLE.getString("metatag.episode")); //$NON-NLS-1$ detailsPanel.add(lblEpisode, "8, 6, right, default"); spEpisode = new JSpinner(); detailsPanel.add(spEpisode, "10, 6"); JLabel lblDvdSeason = new JLabel(BUNDLE.getString("metatag.dvdseason")); //$NON-NLS-1$ detailsPanel.add(lblDvdSeason, "2, 8, right, default"); spDvdSeason = new JSpinner(); detailsPanel.add(spDvdSeason, "4, 8"); JLabel lblDvdEpisode = new JLabel(BUNDLE.getString("metatag.dvdepisode")); //$NON-NLS-1$ detailsPanel.add(lblDvdEpisode, "8, 8, right, default"); spDvdEpisode = new JSpinner(); detailsPanel.add(spDvdEpisode, "10, 8"); JLabel lblDvdOrder = new JLabel(BUNDLE.getString("metatag.dvdorder")); //$NON-NLS-1$ detailsPanel.add(lblDvdOrder, "14, 8, right, default"); cbDvdOrder = new JCheckBox(""); detailsPanel.add(cbDvdOrder, "16, 8"); cbDvdOrder.setSelected(episodeToEdit.isDvdOrder()); JLabel lblDisplaySeason = new JLabel(BUNDLE.getString("metatag.displayseason")); //$NON-NLS-1$ detailsPanel.add(lblDisplaySeason, "2, 10, right, default"); spDisplaySeason = new JSpinner(); detailsPanel.add(spDisplaySeason, "4, 10"); JLabel lblDisplayEpisode = new JLabel(BUNDLE.getString("metatag.displayepisode")); //$NON-NLS-1$ detailsPanel.add(lblDisplayEpisode, "8, 10, right, default"); spDisplayEpisode = new JSpinner(); detailsPanel.add(spDisplayEpisode, "10, 10"); JLabel lblRating = new JLabel(BUNDLE.getString("metatag.rating")); //$NON-NLS-1$ detailsPanel.add(lblRating, "2, 12, right, default"); spRating = new JSpinner(); detailsPanel.add(spRating, "4, 12"); JLabel lblFirstAired = new JLabel(BUNDLE.getString("metatag.aired")); //$NON-NLS-1$ detailsPanel.add(lblFirstAired, "8, 12, right, default"); dpFirstAired = new DatePicker(episode.getFirstAired()); detailsPanel.add(dpFirstAired, "10, 12, 3, 1, fill, default"); JLabel lblWatched = new JLabel(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$ detailsPanel.add(lblWatched, "2, 14, right, default"); chckbxWatched = new JCheckBox(""); detailsPanel.add(chckbxWatched, "4, 14"); JLabel lblDateAdded = new JLabel(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$ detailsPanel.add(lblDateAdded, "8, 14, right, default"); spDateAdded = new JSpinner(new SpinnerDateModel()); detailsPanel.add(spDateAdded, "10, 14, 3, 1, fill, default"); JLabel lblMediasource = new JLabel(BUNDLE.getString("metatag.source")); //$NON-NLS-1$ detailsPanel.add(lblMediasource, "2, 16, right, default"); cbMediaSource = new JComboBox(MediaSource.values()); detailsPanel.add(cbMediaSource, "4, 16, 4, 1, fill, default"); JLabel lblPlot = new JLabel(BUNDLE.getString("metatag.plot")); //$NON-NLS-1$ detailsPanel.add(lblPlot, "2, 18, right, top"); JScrollPane scrollPane = new JScrollPane(); detailsPanel.add(scrollPane, "4, 18, 13, 1, fill, fill"); taPlot = new JTextArea(); taPlot.setLineWrap(true); taPlot.setWrapStyleWord(true); scrollPane.setViewportView(taPlot); lblThumb = new ImageLabel(); lblThumb.setAlternativeText(BUNDLE.getString("image.notfound.thumb")); //$NON-NLS-1$ lblThumb.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { Path file = TmmUIHelper.selectFile(BUNDLE.getString("image.choose")); //$NON-NLS-1$ if (file != null && Utils.isRegularFile(file)) { String fileName = file.toAbsolutePath().toString(); lblThumb.setImageUrl("file:/" + fileName); } } }); lblThumb.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); detailsPanel.add(lblThumb, "20, 6, 3, 13"); JLabel lblDirector = new JLabel(BUNDLE.getString("metatag.director")); //$NON-NLS-1$ detailsPanel.add(lblDirector, "2, 20, right, default"); tfDirector = new JTextField(); tfDirector.setText((String) null); tfDirector.setColumns(10); detailsPanel.add(tfDirector, "4, 20, 13, 1, fill, default"); JLabel lblWriter = new JLabel(BUNDLE.getString("metatag.writer")); //$NON-NLS-1$ detailsPanel.add(lblWriter, "2, 22, right, default"); tfWriter = new JTextField(); tfWriter.setText((String) null); tfWriter.setColumns(10); detailsPanel.add(tfWriter, "4, 22, 13, 1, fill, default"); JLabel lblGuests = new JLabel(BUNDLE.getString("metatag.guests")); //$NON-NLS-1$ detailsPanel.add(lblGuests, "2, 24, right, top"); JScrollPane scrollPaneGuests = new JScrollPane(); detailsPanel.add(scrollPaneGuests, "4, 24, 13, 7, fill, fill"); tableGuests = new JTable(); tableGuests.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); scrollPaneGuests.setViewportView(tableGuests); JLabel lblTags = new JLabel(BUNDLE.getString("metatag.tags")); //$NON-NLS-1$ detailsPanel.add(lblTags, "20, 24, default, top"); JScrollPane scrollPaneTags = new JScrollPane(); detailsPanel.add(scrollPaneTags, "22, 24, 1, 5, fill, fill"); listTags = new JList(); scrollPaneTags.setViewportView(listTags); JButton btnAddActor = new JButton(""); btnAddActor.setMargin(new Insets(2, 2, 2, 2)); btnAddActor.setAction(new AddActorAction()); btnAddActor.setIcon(IconManager.LIST_ADD); detailsPanel.add(btnAddActor, "2, 26, right, top"); JButton btnAddTag = new JButton(""); btnAddTag.setMargin(new Insets(2, 2, 2, 2)); btnAddTag.setAction(new AddTagAction()); btnAddTag.setIcon(IconManager.LIST_ADD); detailsPanel.add(btnAddTag, "20, 26, right, top"); JButton btnRemoveActor = new JButton(""); btnRemoveActor.setMargin(new Insets(2, 2, 2, 2)); btnRemoveActor.setAction(new RemoveActorAction()); btnRemoveActor.setIcon(IconManager.LIST_REMOVE); detailsPanel.add(btnRemoveActor, "2, 28, right, top"); JButton btnRemoveTag = new JButton(""); btnRemoveTag.setMargin(new Insets(2, 2, 2, 2)); btnRemoveTag.setAction(new RemoveTagAction()); btnRemoveTag.setIcon(IconManager.LIST_REMOVE); detailsPanel.add(btnRemoveTag, "20, 28, right, top"); cbTags = new AutocompleteComboBox(tvShowList.getTagsInEpisodes().toArray()); cbTags.setEditable(true); detailsPanel.add(cbTags, "22, 30, fill, default"); } /** * Media Files panel */ { mediaFilesPanel = new MediaFileEditorPanel(mediaFiles); tabbedPane.addTab(BUNDLE.getString("metatag.mediafiles"), null, mediaFilesPanel, null); //$NON-NLS-1$ } { JPanel bottomPanel = new JPanel(); getContentPane().add(bottomPanel, BorderLayout.SOUTH); bottomPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("25px"), FormFactory.RELATED_GAP_ROWSPEC, })); cbScraper = new MediaScraperComboBox(tvShowList.getAvailableMediaScrapers()); MediaScraper defaultScraper = tvShowList.getDefaultMediaScraper(); cbScraper.setSelectedItem(defaultScraper); bottomPanel.add(cbScraper, "2, 2, fill, default"); JButton btnScrape = new JButton(BUNDLE.getString("Button.scrape")); //$NON-NLS-1$ btnScrape.setPreferredSize(new Dimension(100, 23)); btnScrape.setMaximumSize(new Dimension(0, 0)); btnScrape.setMinimumSize(new Dimension(100, 23)); btnScrape.setActionCommand("Scrape"); btnScrape.addActionListener(this); bottomPanel.add(btnScrape, "4, 2, left, fill"); JButton btnSearch = new JButton(BUNDLE.getString("tvshowepisodechooser.search")); //$NON-NLS-1$ btnSearch.setActionCommand("Search"); btnSearch.addActionListener(this); btnSearch.setIcon(IconManager.SEARCH); bottomPanel.add(btnSearch, "6, 2, left, fill"); { JPanel buttonPane = new JPanel(); bottomPanel.add(buttonPane, "8, 2, fill, fill"); EqualsLayout layout = new EqualsLayout(5); layout.setMinWidth(100); buttonPane.setLayout(layout); JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ okButton.setToolTipText(BUNDLE.getString("tvshow.change")); okButton.setIcon(IconManager.APPLY); buttonPane.add(okButton); okButton.setActionCommand("OK"); okButton.addActionListener(this); JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ cancelButton.setToolTipText(BUNDLE.getString("edit.discard")); cancelButton.setIcon(IconManager.CANCEL); buttonPane.add(cancelButton); cancelButton.setActionCommand("Cancel"); cancelButton.addActionListener(this); if (inQueue) { JButton abortButton = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ abortButton.setToolTipText(BUNDLE.getString("tvshow.edit.abortqueue.desc")); //$NON-NLS-1$ abortButton.setIcon(IconManager.PROCESS_STOP); buttonPane.add(abortButton); abortButton.setActionCommand("Abort"); abortButton.addActionListener(this); } } } initDataBindings(); // fill data { MediaFile mediaFile = episodeToEdit.getMediaFiles().get(0); lblFilename.setText(mediaFile.getFileAsPath().toString()); tfTitle.setText(episodeToEdit.getTitle()); spSeason.setModel(new SpinnerNumberModel(episodeToEdit.getAiredSeason(), -1, Integer.MAX_VALUE, 1)); spEpisode.setModel(new SpinnerNumberModel(episodeToEdit.getAiredEpisode(), -1, Integer.MAX_VALUE, 1)); spDvdSeason.setModel(new SpinnerNumberModel(episodeToEdit.getDvdSeason(), -1, Integer.MAX_VALUE, 1)); spDvdEpisode.setModel(new SpinnerNumberModel(episodeToEdit.getDvdEpisode(), -1, Integer.MAX_VALUE, 1)); spDisplaySeason .setModel(new SpinnerNumberModel(episodeToEdit.getDisplaySeason(), -1, Integer.MAX_VALUE, 1)); spDisplayEpisode .setModel(new SpinnerNumberModel(episodeToEdit.getDisplayEpisode(), -1, Integer.MAX_VALUE, 1)); spDateAdded.setValue(episodeToEdit.getDateAdded()); lblThumb.setImagePath(episodeToEdit.getArtworkFilename(MediaFileType.THUMB)); spRating.setModel(new SpinnerNumberModel(episodeToEdit.getRating(), 0.0, 10.0, 0.1)); spRating.addChangeListener(new ChangeListener() { @Override public void stateChanged(ChangeEvent e) { voteCount = 1; } }); voteCount = episodeToEdit.getVotes(); chckbxWatched.setSelected(episodeToEdit.isWatched()); taPlot.setText(episodeToEdit.getPlot()); taPlot.setCaretPosition(0); tfDirector.setText(episodeToEdit.getDirector()); tfWriter.setText(episodeToEdit.getWriter()); cbMediaSource.setSelectedItem(episodeToEdit.getMediaSource()); for (TvShowActor origCast : episodeToEdit.getGuests()) { TvShowActor actor = new TvShowActor(); actor.setName(origCast.getName()); actor.setCharacter(origCast.getCharacter()); actor.setThumbUrl(origCast.getThumbUrl()); cast.add(actor); } for (String tag : episodeToEdit.getTags()) { tags.add(tag); } } // adjust table columns tableGuests.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$ tableGuests.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.role")); //$NON-NLS-1$ }
From source file:org.tinymediamanager.ui.tvshows.dialogs.TvShowExporterDialog.java
/** * Create the dialog./*ww w . j a v a2 s. co m*/ * * @param tvShowsToExport * the movies to export */ public TvShowExporterDialog(List<TvShow> tvShowsToExport) { super(BUNDLE.getString("tvshow.export"), "tvShowExporter"); //$NON-NLS-1$ setBounds(5, 5, 600, 300); getContentPane().setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("300dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("100dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, })); JSplitPane splitPane = new JSplitPane(); splitPane.setResizeWeight(0.7); getContentPane().add(splitPane, "2, 2, fill, fill"); JScrollPane scrollPane = new JScrollPane(); splitPane.setLeftComponent(scrollPane); list = new JList(); scrollPane.setViewportView(list); JPanel panelExporterDetails = new JPanel(); splitPane.setRightComponent(panelExporterDetails); panelExporterDetails.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("default:grow"), })); lblTemplateName = new JLabel(""); panelExporterDetails.add(lblTemplateName, "2, 2, 3, 1"); lblUrl = new JLabel(""); panelExporterDetails.add(lblUrl, "2, 4, 3, 1"); chckbxTemplateWithDetail = new JCheckBox(""); chckbxTemplateWithDetail.setEnabled(false); panelExporterDetails.add(chckbxTemplateWithDetail, "2, 6"); JLabel lblDetails = new JLabel(BUNDLE.getString("export.detail")); //$NON-NLS-1$ panelExporterDetails.add(lblDetails, "4, 6"); JScrollPane scrollPaneDescription = new JScrollPane(); panelExporterDetails.add(scrollPaneDescription, "2, 8, 3, 1, fill, fill"); tpDescription = new JTextPane(); scrollPaneDescription.setViewportView(tpDescription); splitPane.setDividerLocation(300); JPanel panel = new JPanel(); getContentPane().add(panel, "2, 4, fill, fill"); panel.setLayout( new FormLayout(new ColumnSpec[] { ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, })); tfExportDir = new JTextField(); panel.add(tfExportDir, "1, 1, fill, default"); tfExportDir.setColumns(10); JButton btnSetDestination = new JButton(BUNDLE.getString("export.setdestination")); //$NON-NLS-1$ panel.add(btnSetDestination, "3, 1"); btnSetDestination.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { Path file = TmmUIHelper.selectDirectory(BUNDLE.getString("export.selectdirectory")); //$NON-NLS-1$ if (file != null) { tfExportDir.setText(file.toAbsolutePath().toString()); } } }); JPanel panelButtons = new JPanel(); panelButtons.setLayout(new EqualsLayout(5)); getContentPane().add(panelButtons, "2, 6, fill, fill"); JButton btnExport = new JButton("Export"); btnExport.setIcon(IconManager.EXPORT); btnExport.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { if (StringUtils.isBlank(tfExportDir.getText())) { return; } // check selected template int index = list.getSelectedIndex(); if (index < 0) { return; } ExportTemplate selectedTemplate = templatesFound.get(index); if (selectedTemplate != null) { try { TvShowExporter exporter = new TvShowExporter(Paths.get(selectedTemplate.getPath())); exporter.export(tvShows, Paths.get(tfExportDir.getText())); } catch (Exception e) { LOGGER.error("Error exporting tv shows: ", e); } setVisible(false); } } }); panelButtons.add(btnExport); JButton btnCancel = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ btnCancel.setIcon(IconManager.CANCEL); btnCancel.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { setVisible(false); } }); panelButtons.add(btnCancel); tvShows = tvShowsToExport; templatesFound = TvShowExporter.findTemplates(TemplateType.TV_SHOW); initDataBindings(); }
From source file:org.tinymediamanager.ui.tvshows.dialogs.TvShowSubtitleChooserDialog.java
private void initComponents() { getContentPane().setLayout(new BorderLayout()); final JPanel panelContent = new JPanel(); getContentPane().add(panelContent, BorderLayout.CENTER); panelContent.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("120dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); final JLabel lblEpisodeTitle = new JLabel(episodeToScrape.getTitle()); TmmFontHelper.changeFont(lblEpisodeTitle, 1.33, Font.BOLD); panelContent.add(lblEpisodeTitle, "2, 2, 9, 1"); JLabel lblSeasonT = new JLabel(BUNDLE.getString("metatag.season")); //$NON-NLS-1$ panelContent.add(lblSeasonT, "2, 4, right, default"); JLabel lblSeason = new JLabel(String.valueOf(episodeToScrape.getSeason())); panelContent.add(lblSeason, "4, 4"); JLabel lblEpisodeT = new JLabel(BUNDLE.getString("metatag.episode")); //$NON-NLS-1$ panelContent.add(lblEpisodeT, "2, 6, right, default"); JLabel lblEpisode = new JLabel(String.valueOf(episodeToScrape.getEpisode())); panelContent.add(lblEpisode, "4, 6"); final JLabel lblMediaFileNameT = new JLabel(BUNDLE.getString("metatag.filename")); //$NON-NLS-1$ panelContent.add(lblMediaFileNameT, "2, 8, right, default"); final JLabel lblMediaFileName = new JLabel(fileToScrape.getFilename()); panelContent.add(lblMediaFileName, "4, 8, 7, 1"); final JLabel lblScraperT = new JLabel(BUNDLE.getString("scraper")); //$NON-NLS-1$ panelContent.add(lblScraperT, "2, 10, right, default"); cbScraper = new MediaScraperCheckComboBox(); panelContent.add(cbScraper, "4, 10, fill, default"); final JLabel lblLanguageT = new JLabel(BUNDLE.getString("metatag.language")); //$NON-NLS-1$ panelContent.add(lblLanguageT, "2, 12, right, default"); cbLanguage = new JComboBox<>(); panelContent.add(cbLanguage, "4, 12, fill, default"); final JButton btnSearch = new JButton(BUNDLE.getString("Button.search")); //$NON-NLS-1$ btnSearch.addActionListener(new ActionListener() { @Override/*w w w.ja v a 2s . c o m*/ public void actionPerformed(ActionEvent e) { searchSubtitle(fileToScrape.getFileAsPath().toFile(), episodeToScrape.getTvShow().getImdbId(), episodeToScrape.getSeason(), episodeToScrape.getEpisode()); } }); panelContent.add(btnSearch, "8, 12"); final JScrollPane scrollPaneSubs = new JScrollPane(); panelContent.add(scrollPaneSubs, "2, 14, 9, 1, fill, fill"); tableSubs = new JTable(subtitleTableModel); scrollPaneSubs.setViewportView(tableSubs); { JPanel panelBottom = new JPanel(); getContentPane().add(panelBottom, BorderLayout.SOUTH); panelBottom.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("max(82dlu;default)"), FormFactory.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormFactory.DEFAULT_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC })); progressBar = new JProgressBar(); panelBottom.add(progressBar, "2, 2"); lblProgressAction = new JLabel(""); panelBottom.add(lblProgressAction, "4, 2"); { final JPanel panelButtons = new JPanel(); EqualsLayout layout = new EqualsLayout(5); layout.setMinWidth(100); panelButtons.setLayout(layout); panelBottom.add(panelButtons, "5, 2, fill, fill"); JButton btnDone = new JButton(BUNDLE.getString("Button.done")); //$NON-NLS-1$ btnDone.setIcon(IconManager.APPLY); btnDone.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); panelButtons.add(btnDone); if (inQueue) { JButton btnAbortQueue = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ btnAbortQueue.setIcon(IconManager.PROCESS_STOP); btnAbortQueue.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { continueQueue = false; setVisible(false); } }); panelButtons.add(btnAbortQueue); } } } }