List of usage examples for javax.swing JButton setIcon
@BeanProperty(visualUpdate = true, description = "The button's default icon") public void setIcon(Icon defaultIcon)
From source file:org.tinymediamanager.ui.dialogs.BugReportDialog.java
/** * Instantiates a new feedback dialog.//from w ww.ja v a2s . c o m */ public BugReportDialog() { super(BUNDLE.getString("BugReport"), "bugReportdialog"); getContentPane().setLayout(new BorderLayout(0, 0)); JPanel panelContent = new JPanel(); getContentPane().add(panelContent, BorderLayout.CENTER); panelContent.setLayout(new FormLayout( new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.UNRELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.UNRELATED_GAP_ROWSPEC, RowSpec.decode("default:grow"), FormSpecs.UNRELATED_GAP_ROWSPEC, })); final JTextArea taDescription = new JTextArea(); taDescription.setOpaque(false); taDescription.setWrapStyleWord(true); taDescription.setLineWrap(true); taDescription.setEditable(false); taDescription.setText(BUNDLE.getString("BugReport.description")); //$NON-NLS-1$ panelContent.add(taDescription, "2, 2, 6, 1, fill, fill"); final JButton btnSaveLogs = new JButton(BUNDLE.getString("BugReport.createlogs")); //$NON-NLS-1$ btnSaveLogs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // open the log download window try { Path file = TmmUIHelper.saveFile(BUNDLE.getString("BugReport.savelogs"), "tmm_logs.zip", //$NON-NLS-1$ new FileNameExtensionFilter("Zip files", ".zip")); if (file != null) { writeLogsFile(file.toFile()); } } catch (Exception ex) { LOGGER.error("Could not write logs.zip: " + ex.getMessage()); } } }); final JLabel lblStep1 = new JLabel(BUNDLE.getString("BugReport.step1")); //$NON-NLS-1$ panelContent.add(lblStep1, "2, 4, default, top"); final JTextArea taStep1 = new JTextArea(); taStep1.setText(BUNDLE.getString("BugReport.step1.description")); //$NON-NLS-1$ taStep1.setOpaque(false); taStep1.setEditable(false); panelContent.add(taStep1, "5, 4, fill, fill"); panelContent.add(btnSaveLogs, "7, 4"); final JButton btnCreateIssue = new JButton(BUNDLE.getString("BugReport.craeteissue")); //$NON-NLS-1$ btnCreateIssue.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { // create the url for github String baseUrl = "https://github.com/tinyMediaManager/tinyMediaManager/issues/new?body="; String params = "Version: " + ReleaseInfo.getRealVersion(); params += "\nBuild: " + ReleaseInfo.getRealBuildDate(); params += "\nOS: " + System.getProperty("os.name") + " " + System.getProperty("os.version"); params += "\nJDK: " + System.getProperty("java.version") + " " + System.getProperty("os.arch") + " " + System.getProperty("java.vendor"); params += "\n\n__What is the actual behaviour?__\n\n"; params += "\n\n__What is the expected behaviour?__\n\n"; params += "\n\n__Steps to reproduce:__\n\n"; params += "\n\n__Additional__\nHave you attached the logfile from the day it happened?"; String url = ""; try { url = baseUrl + URLEncoder.encode(params, "UTF-8"); TmmUIHelper.browseUrl(url); } catch (Exception e1) { LOGGER.error("FAQ", e1); MessageManager.instance.pushMessage(new Message(MessageLevel.ERROR, url, "message.erroropenurl", new String[] { ":", e1.getLocalizedMessage() })); } } }); final JLabel lblStep2 = new JLabel(BUNDLE.getString("BugReport.step2")); //$NON-NLS-1$ panelContent.add(lblStep2, "2, 6, default, top"); final JTextArea taStep2 = new JTextArea(); taStep2.setOpaque(false); taStep2.setEditable(false); taStep2.setText(BUNDLE.getString("BugReport.step2.description")); //$NON-NLS-1$ panelContent.add(taStep2, "5, 6, fill, fill"); panelContent.add(btnCreateIssue, "7, 6"); final JLabel lblHintIcon = new JLabel(IconManager.HINT); panelContent.add(lblHintIcon, "3, 8"); final JLabel lblHint = new JLabel(BUNDLE.getString("BugReport.languagehint")); //$NON-NLS-1$ panelContent.add(lblHint, "5, 8"); JPanel panelButtons = new JPanel(); getContentPane().add(panelButtons, BorderLayout.SOUTH); JButton btnClose = new JButton(BUNDLE.getString("Button.close")); //$NON-NLS-1$ btnClose.setIcon(IconManager.CANCEL); btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { setVisible(false); } }); panelButtons.setLayout(new FormLayout( new ColumnSpec[] { ColumnSpec.decode("default:grow"), FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("25px"), FormSpecs.RELATED_GAP_ROWSPEC, })); panelButtons.add(btnClose, "2, 2"); }
From source file:org.tinymediamanager.ui.dialogs.ImageChooserDialog.java
/** * Instantiates a new image chooser dialog. * // www .j av a 2 s. co m * @param ids * the ids * @param type * the type * @param artworkScrapers * the artwork providers * @param imageLabel * the image label * @param extraThumbs * the extra thumbs * @param extraFanarts * the extra fanarts * @param mediaType * the media for for which artwork has to be chosen */ public ImageChooserDialog(final HashMap<String, Object> ids, ImageType type, List<MediaScraper> artworkScrapers, ImageLabel imageLabel, List<String> extraThumbs, List<String> extraFanarts, MediaType mediaType) { super("", "imageChooser"); this.imageLabel = imageLabel; this.type = type; this.mediaType = mediaType; this.artworkScrapers = artworkScrapers; this.extraThumbs = extraThumbs; this.extraFanarts = extraFanarts; switch (type) { case FANART: setTitle(BUNDLE.getString("image.choose.fanart")); //$NON-NLS-1$ break; case POSTER: setTitle(BUNDLE.getString("image.choose.poster")); //$NON-NLS-1$ break; case BANNER: setTitle(BUNDLE.getString("image.choose.banner")); //$NON-NLS-1$ break; case SEASON: Object season = ids.get("tvShowSeason"); if (season != null) { setTitle(BUNDLE.getString("image.choose.season") + " - " + BUNDLE.getString("metatag.season") + " " //$NON-NLS-1$ + season); } else { setTitle(BUNDLE.getString("image.choose.season")); //$NON-NLS-1$ } break; case CLEARART: setTitle(BUNDLE.getString("image.choose.clearart")); //$NON-NLS-1$ break; case DISC: setTitle(BUNDLE.getString("image.choose.disc")); //$NON-NLS-1$ break; case LOGO: setTitle(BUNDLE.getString("image.choose.logo")); //$NON-NLS-1$ break; case CLEARLOGO: setTitle(BUNDLE.getString("image.choose.clearlogo")); //$NON-NLS-1$ break; case THUMB: setTitle(BUNDLE.getString("image.choose.thumb")); //$NON-NLS-1$ break; } setBounds(5, 5, 1000, 590); getContentPane().setLayout(new BorderLayout()); getContentPane().add(contentPanel, BorderLayout.CENTER); contentPanel.setLayout(new FormLayout( new ColumnSpec[] { FormFactory.LABEL_COMPONENT_GAP_COLSPEC, ColumnSpec.decode("258px:grow"), FormFactory.RELATED_GAP_COLSPEC, FormFactory.DEFAULT_COLSPEC, FormFactory.LABEL_COMPONENT_GAP_COLSPEC, }, new RowSpec[] { FormFactory.LINE_GAP_ROWSPEC, RowSpec.decode("fill:266px:grow"), FormFactory.RELATED_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.RELATED_GAP_ROWSPEC, })); { scrollPane = new JScrollPane(); scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); contentPanel.add(scrollPane, "2, 2, 3, 1, fill, fill"); { panelImages = new JPanel(); scrollPane.setViewportView(panelImages); scrollPane.getVerticalScrollBar().setUnitIncrement(16); panelImages.setLayout(new WrapLayout(FlowLayout.LEFT)); } } { tfImageUrl = new EnhancedTextField(BUNDLE.getString("image.inserturl")); //$NON-NLS-1$ contentPanel.add(tfImageUrl, "2, 4, fill, default"); tfImageUrl.setColumns(10); JButton btnAddImage = new JButton(BUNDLE.getString("image.downloadimage")); //$NON-NLS-1$ btnAddImage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { if (StringUtils.isNotBlank(tfImageUrl.getText())) { downloadAndPreviewImage(tfImageUrl.getText()); } } }); contentPanel.add(btnAddImage, "4, 4"); } { JPanel bottomPane = new JPanel(); getContentPane().add(bottomPane, BorderLayout.SOUTH); bottomPane.setLayout(new FormLayout( new ColumnSpec[] { 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.NARROW_LINE_GAP_ROWSPEC, FormFactory.DEFAULT_ROWSPEC, FormFactory.NARROW_LINE_GAP_ROWSPEC, RowSpec.decode("23px:grow"), FormFactory.RELATED_GAP_ROWSPEC, })); { if (type == ImageType.FANART && extraFanarts != null && extraThumbs != null) { JPanel panelExtraButtons = new JPanel(); bottomPane.add(panelExtraButtons, "2, 2, fill, bottom"); panelExtraButtons.setLayout(new FlowLayout(FlowLayout.LEFT, 2, 0)); { if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs()) { JLabel labelThumbs = new JLabel("Extrathumbs:"); panelExtraButtons.add(labelThumbs); JButton btnMarkExtrathumbs = new JButton(""); btnMarkExtrathumbs.setMargin(new Insets(0, 0, 0, 0)); btnMarkExtrathumbs.setIcon(IconManager.CHECK_ALL); btnMarkExtrathumbs.setToolTipText(BUNDLE.getString("image.extrathumbs.markall")); //$NON-NLS-1$ btnMarkExtrathumbs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button .getClientProperty("MediaArtworkExtrathumb") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrathumb"); chkbx.setSelected(true); } } } }); panelExtraButtons.add(btnMarkExtrathumbs); JButton btnUnMarkExtrathumbs = new JButton(""); btnUnMarkExtrathumbs.setMargin(new Insets(0, 0, 0, 0)); btnUnMarkExtrathumbs.setIcon(IconManager.UNCHECK_ALL); btnUnMarkExtrathumbs.setToolTipText(BUNDLE.getString("image.extrathumbs.unmarkall")); //$NON-NLS-1$ btnUnMarkExtrathumbs.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button .getClientProperty("MediaArtworkExtrathumb") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrathumb"); chkbx.setSelected(false); } } } }); panelExtraButtons.add(btnUnMarkExtrathumbs); } if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraThumbs() && MovieModuleManager.MOVIE_SETTINGS.isImageExtraFanart()) { JSeparator separator = new JSeparator(SwingConstants.VERTICAL); separator.setPreferredSize(new Dimension(2, 16)); panelExtraButtons.add(separator); } if (mediaType == MediaType.MOVIE && MovieModuleManager.MOVIE_SETTINGS.isImageExtraFanart()) { JLabel labelFanart = new JLabel("Extrafanart:"); panelExtraButtons.add(labelFanart); JButton btnMarkExtrafanart = new JButton(""); btnMarkExtrafanart.setMargin(new Insets(0, 0, 0, 0)); btnMarkExtrafanart.setIcon(IconManager.CHECK_ALL); btnMarkExtrafanart.setToolTipText(BUNDLE.getString("image.extrafanart.markall")); //$NON-NLS-1$ btnMarkExtrafanart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button.getClientProperty( "MediaArtworkExtrafanart") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrafanart"); chkbx.setSelected(true); } } } }); panelExtraButtons.add(btnMarkExtrafanart); JButton btnUnMarkExtrafanart = new JButton(""); btnUnMarkExtrafanart.setMargin(new Insets(0, 0, 0, 0)); btnUnMarkExtrafanart.setIcon(IconManager.UNCHECK_ALL); btnUnMarkExtrafanart.setToolTipText(BUNDLE.getString("image.extrafanart.unmarkall")); //$NON-NLS-1$ btnUnMarkExtrafanart.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { for (JToggleButton button : buttons) { if (button.getClientProperty( "MediaArtworkExtrafanart") instanceof JCheckBox) { JCheckBox chkbx = (JCheckBox) button .getClientProperty("MediaArtworkExtrafanart"); chkbx.setSelected(false); } } } }); panelExtraButtons.add(btnUnMarkExtrafanart); } } } } { progressBar = new JProgressBar(); bottomPane.add(progressBar, "2, 4"); } { lblProgressAction = new JLabel(""); bottomPane.add(lblProgressAction, "4, 4"); } { JPanel buttonPane = new JPanel(); EqualsLayout layout = new EqualsLayout(5); buttonPane.setLayout(layout); layout.setMinWidth(100); bottomPane.add(buttonPane, "6, 4, fill, top"); JButton okButton = new JButton(BUNDLE.getString("Button.ok")); //$NON-NLS-1$ okButton.setAction(actionOK); okButton.setActionCommand("OK"); buttonPane.add(okButton); getRootPane().setDefaultButton(okButton); JButton btnAddFile = new JButton(BUNDLE.getString("Button.addfile")); //$NON-NLS-1$ btnAddFile.setAction(actionLocalFile); buttonPane.add(btnAddFile); JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ cancelButton.setAction(actionCancel); cancelButton.setActionCommand("Cancel"); buttonPane.add(cancelButton); } } task = new DownloadTask(ids, this.artworkScrapers); task.execute(); }
From source file:org.tinymediamanager.ui.movies.dialogs.MovieBatchEditorDialog.java
/** * Instantiates a new movie batch editor. * //from w w w .ja v a 2 s . c o m * @param movies * the movies */ public MovieBatchEditorDialog(final List<Movie> movies) { super(BUNDLE.getString("movie.edit"), "movieBatchEditor"); //$NON-NLS-1$ setBounds(5, 5, 350, 230); getContentPane().setLayout(new BorderLayout(0, 0)); { JPanel panelContent = new JPanel(); getContentPane().add(panelContent, BorderLayout.CENTER); panelContent.setLayout(new FormLayout(new ColumnSpec[] { FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("default:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, 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, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, })); JLabel lblGenres = new JLabel(BUNDLE.getString("metatag.genre")); //$NON-NLS-1$ panelContent.add(lblGenres, "2, 2, 2, 1, right, default"); // cbGenres = new JComboBox(MediaGenres2.values()); cbGenres = new AutocompleteComboBox(MediaGenres.values()); cbGenres.setEditable(true); panelContent.add(cbGenres, "5, 2, fill, default"); JButton btnAddGenre = new JButton(""); btnAddGenre.setIcon(IconManager.LIST_ADD); btnAddGenre.setMargin(new Insets(2, 2, 2, 2)); btnAddGenre.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changed = true; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); MediaGenres genre = null; Object item = cbGenres.getSelectedItem(); // genre if (item instanceof MediaGenres) { genre = (MediaGenres) item; } // newly created genre? if (item instanceof String) { genre = MediaGenres.getGenre((String) item); } // MediaGenres2 genre = (MediaGenres2) cbGenres.getSelectedItem(); if (genre != null) { for (Movie movie : moviesToEdit) { movie.addGenre(genre); } } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); panelContent.add(btnAddGenre, "7, 2"); JButton btnRemoveGenre = new JButton(""); btnRemoveGenre.setIcon(IconManager.LIST_REMOVE); btnRemoveGenre.setMargin(new Insets(2, 2, 2, 2)); btnRemoveGenre.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changed = true; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); MediaGenres genre = (MediaGenres) cbGenres.getSelectedItem(); for (Movie movie : moviesToEdit) { movie.removeGenre(genre); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); panelContent.add(btnRemoveGenre, "9, 2"); JLabel lblTags = new JLabel(BUNDLE.getString("metatag.tags")); //$NON-NLS-1$ panelContent.add(lblTags, "2, 4, 2, 1, right, default"); cbTags = new AutocompleteComboBox(movieList.getTagsInMovies().toArray()); cbTags.setEditable(true); panelContent.add(cbTags, "5, 4, fill, default"); JButton btnAddTag = new JButton(""); btnAddTag.setIcon(IconManager.LIST_ADD); btnAddTag.setMargin(new Insets(2, 2, 2, 2)); btnAddTag.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changed = true; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); String tag = (String) cbTags.getSelectedItem(); if (StringUtils.isBlank(tag)) { return; } for (Movie movie : moviesToEdit) { movie.addToTags(tag); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); panelContent.add(btnAddTag, "7, 4"); JButton btnRemoveTag = new JButton(""); btnRemoveTag.setIcon(IconManager.LIST_REMOVE); btnRemoveTag.setMargin(new Insets(2, 2, 2, 2)); btnRemoveTag.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changed = true; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); String tag = (String) cbTags.getSelectedItem(); for (Movie movie : moviesToEdit) { movie.removeFromTags(tag); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); panelContent.add(btnRemoveTag, "9, 4"); JLabel lblCertification = new JLabel(BUNDLE.getString("metatag.certification")); //$NON-NLS-1$ panelContent.add(lblCertification, "2, 6, 2, 1, right, default"); final JComboBox cbCertification = new JComboBox(); for (Certification cert : Certification .getCertificationsforCountry(MovieModuleManager.MOVIE_SETTINGS.getCertificationCountry())) { cbCertification.addItem(cert); } panelContent.add(cbCertification, "5, 6, fill, default"); JButton btnCertification = new JButton(""); btnCertification.setMargin(new Insets(2, 2, 2, 2)); btnCertification.setIcon(IconManager.APPLY); btnCertification.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changed = true; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); Certification cert = (Certification) cbCertification.getSelectedItem(); for (Movie movie : moviesToEdit) { movie.setCertification(cert); ; } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); panelContent.add(btnCertification, "7, 6"); JLabel lblMovieSet = new JLabel(BUNDLE.getString("metatag.movieset")); //$NON-NLS-1$ panelContent.add(lblMovieSet, "2, 8, 2, 1, right, default"); cbMovieSet = new JComboBox(); panelContent.add(cbMovieSet, "5, 8, fill, default"); JButton btnSetMovieSet = new JButton(""); btnSetMovieSet.setMargin(new Insets(2, 2, 2, 2)); btnSetMovieSet.setIcon(IconManager.APPLY); btnSetMovieSet.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changed = true; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); // movie set Object obj = cbMovieSet.getSelectedItem(); for (Movie movie : moviesToEdit) { if (obj instanceof String) { movie.removeFromMovieSet(); } if (obj instanceof MovieSet) { MovieSet movieSet = (MovieSet) obj; if (movie.getMovieSet() != movieSet) { movie.removeFromMovieSet(); movie.setMovieSet(movieSet); movieSet.insertMovie(movie); } } } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); panelContent.add(btnSetMovieSet, "7, 8"); JButton btnNewMovieset = new JButton(""); btnNewMovieset.setMargin(new Insets(2, 2, 2, 2)); btnNewMovieset.setAction(new MovieSetAddAction(false)); panelContent.add(btnNewMovieset, "9, 8"); JLabel lblWatched = new JLabel(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$ panelContent.add(lblWatched, "2, 10, 2, 1, right, default"); chckbxWatched = new JCheckBox(""); panelContent.add(chckbxWatched, "5, 10"); JButton btnWatched = new JButton(""); btnWatched.setMargin(new Insets(2, 2, 2, 2)); btnWatched.setIcon(IconManager.APPLY); btnWatched.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changed = true; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (Movie movie : moviesToEdit) { movie.setWatched(chckbxWatched.isSelected()); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); panelContent.add(btnWatched, "7, 10"); JLabel lblVideo3D = new JLabel(BUNDLE.getString("metatag.3d")); //$NON-NLS-1$ panelContent.add(lblVideo3D, "2, 12, 2, 1, right, default"); final JCheckBox chckbxVideo3D = new JCheckBox(""); panelContent.add(chckbxVideo3D, "5, 12"); JButton btnVideo3D = new JButton(""); btnVideo3D.setMargin(new Insets(2, 2, 2, 2)); btnVideo3D.setIcon(IconManager.APPLY); btnVideo3D.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changed = true; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (Movie movie : moviesToEdit) { movie.setVideoIn3D(chckbxVideo3D.isSelected()); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); panelContent.add(btnVideo3D, "7, 12"); JLabel lblMediasource = new JLabel(BUNDLE.getString("metatag.source")); //$NON-NLS-1$ panelContent.add(lblMediasource, "2, 14, 2, 1, right, default"); final JComboBox cbMediaSource = new JComboBox(MediaSource.values()); panelContent.add(cbMediaSource, "5, 14, fill, default"); JButton btnMediaSource = new JButton(""); btnMediaSource.setMargin(new Insets(2, 2, 2, 2)); btnMediaSource.setIcon(IconManager.APPLY); btnMediaSource.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changed = true; Object obj = cbMediaSource.getSelectedItem(); if (obj instanceof MediaSource) { MediaSource mediaSource = (MediaSource) obj; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (Movie movie : moviesToEdit) { movie.setMediaSource(mediaSource); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } } }); panelContent.add(btnMediaSource, "7, 14"); JLabel lblLanguage = new JLabel(BUNDLE.getString("metatag.language")); //$NON-NLS-1$ panelContent.add(lblLanguage, "2, 16, 2, 1, right, default"); tfLanguage = new JTextField(); panelContent.add(tfLanguage, "5, 16, fill, default"); tfLanguage.setColumns(10); JButton btnLanguage = new JButton(""); btnLanguage.setMargin(new Insets(2, 2, 2, 2)); btnLanguage.setIcon(IconManager.APPLY); btnLanguage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changed = true; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (Movie movie : moviesToEdit) { movie.setSpokenLanguages(tfLanguage.getText()); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); panelContent.add(btnLanguage, "7, 16"); { JLabel lblSorttitleT = new JLabel(BUNDLE.getString("metatag.sorttitle")); //$NON-NLS-1$ panelContent.add(lblSorttitleT, "2, 18, right, default"); JButton btnSetSorttitle = new JButton(BUNDLE.getString("edit.setsorttitle")); //$NON-NLS-1$ btnSetSorttitle.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changed = true; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (Movie movie : moviesToEdit) { movie.setSortTitle(movie.getTitleSortable()); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); JLabel lblSorttitleInfo = new JLabel(IconManager.HINT); lblSorttitleInfo.setToolTipText(BUNDLE.getString("edit.setsorttitle.desc")); //$NON-NLS-1$ panelContent.add(lblSorttitleInfo, "3, 18"); panelContent.add(btnSetSorttitle, "5, 18"); JButton btnClearSorttitle = new JButton(BUNDLE.getString("edit.clearsorttitle")); //$NON-NLS-1$ btnClearSorttitle.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { changed = true; setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (Movie movie : moviesToEdit) { movie.setSortTitle(""); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } }); panelContent.add(btnClearSorttitle, "5, 20"); } } { JPanel panelButtons = new JPanel(); FlowLayout flowLayout = (FlowLayout) panelButtons.getLayout(); flowLayout.setAlignment(FlowLayout.RIGHT); getContentPane().add(panelButtons, BorderLayout.SOUTH); JButton btnClose = new JButton(BUNDLE.getString("Button.close")); //$NON-NLS-1$ btnClose.setIcon(IconManager.APPLY); btnClose.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent arg0) { // rewrite movies, if anything changed if (changed) { setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); for (Movie movie : moviesToEdit) { movie.writeNFO(); movie.saveToDb(); } setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); } setVisible(false); } }); panelButtons.add(btnClose); // add window listener to write changes (if the window close button "X" is // pressed) addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { // rewrite movies, if anything changed if (changed) { for (Movie movie : moviesToEdit) { movie.writeNFO(); movie.saveToDb(); } // if configured - sync with trakt.tv if (MovieModuleManager.MOVIE_SETTINGS.getSyncTrakt()) { TmmTask task = new SyncTraktTvTask(moviesToEdit, null); TmmTaskManager.getInstance().addUnnamedTask(task); } } } }); } { setMovieSets(); moviesToEdit = movies; PropertyChangeListener listener = new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { if ("addedMovieSet".equals(evt.getPropertyName())) { setMovieSets(); } } }; movieList.addPropertyChangeListener(listener); } }
From source file:org.tinymediamanager.ui.movies.dialogs.MovieEditorDialog.java
/** * Create the dialog./* w w w .jav a 2s . co m*/ * * @param movie * the movie * @param inQueue * the in queue */ public MovieEditorDialog(Movie movie, boolean inQueue) { super(BUNDLE.getString("movie.edit"), "movieEditor"); //$NON-NLS-1$ setBounds(5, 5, 950, 650); movieToEdit = movie; ids = MediaIdTable.convertIdMapToEventList(movieToEdit.getIds()); for (MediaFile mf : movie.getMediaFiles()) { mediaFiles.add(new MediaFile(mf)); } 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 lblMoviePathT = new JLabel(BUNDLE.getString("metatag.path")); //$NON-NLS-1$ panelPath.add(lblMoviePathT, "2, 2, left, top"); lblMoviePath = new JLabel(""); TmmFontHelper.changeFont(lblMoviePath, 1.166, Font.BOLD); panelPath.add(lblMoviePath, "5, 2, left, top"); } JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.NORTH); getContentPane().add(tabbedPane, BorderLayout.CENTER); /** * DetailsPanel 1 */ { 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, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("7dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("25dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("24dlu"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("7dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.UNRELATED_GAP_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("100dlu:grow(2)"), 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, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("50px:grow"), FormSpecs.LABEL_COMPONENT_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.RELATED_GAP_ROWSPEC, RowSpec.decode("15dlu"), FormSpecs.LABEL_COMPONENT_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, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("fill:50dlu:grow"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("50px"), FormSpecs.LABEL_COMPONENT_GAP_ROWSPEC, RowSpec.decode("fill:default:grow"), })); { JLabel lblTitle = new JLabel(BUNDLE.getString("metatag.title")); //$NON-NLS-1$ details1Panel.add(lblTitle, "2, 4, right, default"); } { tfTitle = new JTextField(); details1Panel.add(tfTitle, "4, 4, 15, 1, fill, default"); tfTitle.setColumns(10); } { // JLabel lblPoster = new JLabel(""); 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(movieToEdit.getIds(), ImageType.POSTER, movieList.getDefaultArtworkScrapers(), lblPoster, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblPoster.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); details1Panel.add(lblPoster, "22, 4, 3, 23, fill, fill"); } { JLabel lblOriginalTitle = new JLabel(BUNDLE.getString("metatag.originaltitle")); //$NON-NLS-1$ details1Panel.add(lblOriginalTitle, "2, 6, right, default"); } { tfOriginalTitle = new JTextField(); details1Panel.add(tfOriginalTitle, "4, 6, 15, 1, fill, top"); tfOriginalTitle.setColumns(10); } { JLabel lblSorttitle = new JLabel(BUNDLE.getString("metatag.sorttitle")); //$NON-NLS-1$ details1Panel.add(lblSorttitle, "2, 8, right, default"); } { tfSorttitle = new JTextField(); details1Panel.add(tfSorttitle, "4, 8, 15, 1, fill, default"); tfSorttitle.setColumns(10); } { JLabel lblTagline = new JLabel(BUNDLE.getString("metatag.tagline")); //$NON-NLS-1$ details1Panel.add(lblTagline, "2, 10, right, top"); } { JScrollPane scrollPaneTagline = new JScrollPane(); tpTagline = new JTextPane(); scrollPaneTagline.setViewportView(tpTagline); details1Panel.add(scrollPaneTagline, "4, 10, 15, 1, fill, fill"); } { JLabel lblYear = new JLabel(BUNDLE.getString("metatag.year")); //$NON-NLS-1$ details1Panel.add(lblYear, "2, 12, right, default"); } { spYear = new YearSpinner(); details1Panel.add(spYear, "4, 12, fill, top"); } { JLabel lblRuntime = new JLabel(BUNDLE.getString("metatag.runtime")); //$NON-NLS-1$ details1Panel.add(lblRuntime, "8, 12, right, default"); } { spRuntime = new JSpinner(); details1Panel.add(spRuntime, "10, 12, fill, default"); } { JLabel lblMin = new JLabel(BUNDLE.getString("metatag.minutes")); //$NON-NLS-1$ details1Panel.add(lblMin, "12, 12"); } { JLabel lblRating = new JLabel(BUNDLE.getString("metatag.rating")); //$NON-NLS-1$ details1Panel.add(lblRating, "16, 12, right, default"); } { spRating = new JSpinner(); details1Panel.add(spRating, "18, 12"); } spRating.setModel(new SpinnerNumberModel(movie.getRating(), 0.0, 10.0, 0.1)); { JLabel lblReleaseDate = new JLabel(BUNDLE.getString("metatag.releasedate")); //$NON-NLS-1$ details1Panel.add(lblReleaseDate, "2, 14, right, default"); } { dpReleaseDate = new DatePicker(movie.getReleaseDate()); details1Panel.add(dpReleaseDate, "4, 14"); } { JLabel lblCertification = new JLabel(BUNDLE.getString("metatag.certification")); //$NON-NLS-1$ details1Panel.add(lblCertification, "8, 14, right, default"); } cbCertification = new JComboBox(); details1Panel.add(cbCertification, "10, 14, 3, 1, fill, default"); { JLabel lblTop = new JLabel(BUNDLE.getString("metatag.top250")); //$NON-NLS-1$ details1Panel.add(lblTop, "16, 14, right, default"); } { spTop250 = new JSpinner(); details1Panel.add(spTop250, "18, 14"); } spTop250.setValue(movie.getTop250()); { JLabel lblIds = new JLabel("Ids"); details1Panel.add(lblIds, "2, 16, right, bottom"); } { JScrollPane scrollPaneIds = new JScrollPane(); details1Panel.add(scrollPaneIds, "4, 16, 9, 5, fill, fill"); { tableIds = new MediaIdTable(ids, ScraperType.MOVIE); 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, 18, right, top"); } { JButton btnRemoveId = new JButton(""); btnRemoveId.setAction(new RemoveIdAction()); btnRemoveId.setIcon(IconManager.LIST_REMOVE); btnRemoveId.setMargin(new Insets(2, 2, 2, 2)); details1Panel.add(btnRemoveId, "2, 20, right, top"); } { JLabel lblSpokenLanguages = new JLabel(BUNDLE.getString("metatag.spokenlanguages")); //$NON-NLS-1$ details1Panel.add(lblSpokenLanguages, "2, 22, right, default"); } { tfSpokenLanguages = new JTextField(); details1Panel.add(tfSpokenLanguages, "4, 22, fill, default"); tfSpokenLanguages.setColumns(10); } { JLabel lblCountry = new JLabel(BUNDLE.getString("metatag.country")); //$NON-NLS-1$ details1Panel.add(lblCountry, "8, 22, right, default"); } { tfCountry = new JTextField(); details1Panel.add(tfCountry, "10, 22, 3, 1, fill, default"); tfCountry.setColumns(10); } { JLabel lblMovieSet = new JLabel(BUNDLE.getString("metatag.movieset")); //$NON-NLS-1$ details1Panel.add(lblMovieSet, "2, 24, right, default"); } { cbMovieSet = new JComboBox(); cbMovieSet.addItem(""); details1Panel.add(cbMovieSet, "4, 24, 9, 1, fill, default"); } { JLabel lblDateAdded = new JLabel(BUNDLE.getString("metatag.dateadded")); //$NON-NLS-1$ details1Panel.add(lblDateAdded, "2, 26, right, default"); } { spDateAdded = new JSpinner(new SpinnerDateModel()); // JSpinner.DateEditor timeEditor = new JSpinner.DateEditor(spDateAdded, // "dd.MM.yyyy HH:mm:ss"); // spDateAdded.setEditor(timeEditor); details1Panel.add(spDateAdded, "4, 26"); } spDateAdded.setValue(movie.getDateAdded()); JLabel lblWatched = new JLabel(BUNDLE.getString("metatag.watched")); //$NON-NLS-1$ details1Panel.add(lblWatched, "8, 26, right, default"); { cbWatched = new JCheckBox(""); details1Panel.add(cbWatched, "10, 26"); } cbWatched.setSelected(movie.isWatched()); lblWatched.setLabelFor(cbWatched); { JLabel lblSourceT = new JLabel(BUNDLE.getString("metatag.source")); //$NON-NLS-1$ details1Panel.add(lblSourceT, "2, 28, right, default"); } { cbSource = new JComboBox(MediaSource.values()); details1Panel.add(cbSource, "4, 28, fill, default"); } cbSource.setSelectedItem(movie.getMediaSource()); { final JLabel lblEditionT = new JLabel(BUNDLE.getString("metatag.edition")); //$NON-NLS-1$ details1Panel.add(lblEditionT, "8, 28, right, default"); } { cbEdition = new JComboBox(MovieEdition.values()); details1Panel.add(cbEdition, "10, 28, 3, 1, fill, default"); } { JLabel lblVideod = new JLabel(BUNDLE.getString("metatag.3d")); //$NON-NLS-1$ details1Panel.add(lblVideod, "16, 28, right, default"); } { chckbxVideo3D = new JCheckBox(""); details1Panel.add(chckbxVideo3D, "18, 28"); } chckbxVideo3D.setSelected(movie.isVideoIn3D()); { JLabel lblPlot = new JLabel(BUNDLE.getString("metatag.plot")); //$NON-NLS-1$ details1Panel.add(lblPlot, "2, 30, right, top"); } { JScrollPane scrollPanePlot = new JScrollPane(); details1Panel.add(scrollPanePlot, "4, 30, 15, 1, fill, fill"); { tpPlot = new JTextPane(); scrollPanePlot.setViewportView(tpPlot); } } { 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(movieToEdit.getIds(), ImageType.FANART, movieList.getDefaultArtworkScrapers(), lblFanart, extrathumbs, extrafanarts, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); details1Panel.add(lblFanart, "22, 30, 3, 5, fill, fill"); } lblFanart.setImagePath(movie.getArtworkFilename(MediaFileType.FANART)); { JLabel lblDirector = new JLabel(BUNDLE.getString("metatag.director")); //$NON-NLS-1$ details1Panel.add(lblDirector, "2, 32, right, default"); } { tfDirector = new JTextField(); details1Panel.add(tfDirector, "4, 32, 15, 1, fill, top"); tfDirector.setColumns(10); } { JLabel lblWriter = new JLabel(BUNDLE.getString("metatag.writer")); //$NON-NLS-1$ details1Panel.add(lblWriter, "2, 34, right, default"); } { tfWriter = new JTextField(); details1Panel.add(tfWriter, "4, 34, 15, 1, fill, top"); tfWriter.setColumns(10); } { JLabel lblCompany = new JLabel(BUNDLE.getString("metatag.production")); //$NON-NLS-1$ details1Panel.add(lblCompany, "2, 36, right, top"); } { JScrollPane scrollPaneProduction = new JScrollPane(); details1Panel.add(scrollPaneProduction, "4, 36, 15, 1, fill, fill"); tfProductionCompanies = new JTextPane(); scrollPaneProduction.setViewportView(tfProductionCompanies); } tabbedPane.addTab(BUNDLE.getString("metatag.details"), details1Panel); //$NON-NLS-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("50px:grow"), 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:default"), 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, 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, 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, 11"); tableActors = new JTable(); tableActors.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); scrollPane.setViewportView(tableActors); } { JLabel lblProducers = new JLabel(BUNDLE.getString("metatag.producers")); //$NON-NLS-1$ details2Panel.add(lblProducers, "6, 2, right, default"); } { JScrollPane scrollPane = new JScrollPane(); details2Panel.add(scrollPane, "8, 2, 1, 11"); tableProducers = new JTable(); tableProducers.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); scrollPane.setViewportView(tableProducers); } { JButton btnAddActor = new JButton(BUNDLE.getString("cast.actor.add")); //$NON-NLS-1$ btnAddActor.setMargin(new Insets(2, 2, 2, 2)); btnAddActor.setAction(new AddActorAction()); btnAddActor.setIcon(IconManager.LIST_ADD); details2Panel.add(btnAddActor, "2, 4, right, top"); } { JButton btnAddProducer = new JButton((String) null); btnAddProducer.setMargin(new Insets(2, 2, 2, 2)); btnAddProducer.setAction(new AddProducerAction()); btnAddProducer.setIcon(IconManager.LIST_ADD); details2Panel.add(btnAddProducer, "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 btnRemoveProducer = new JButton((String) null); btnRemoveProducer.setMargin(new Insets(2, 2, 2, 2)); btnRemoveProducer.setAction(new RemoveProducerAction()); btnRemoveProducer.setIcon(IconManager.LIST_REMOVE); details2Panel.add(btnRemoveProducer, "6, 6, right, top"); } { JButton btnMoveActorUp = new JButton((String) null); btnMoveActorUp.setMargin(new Insets(2, 2, 2, 2)); btnMoveActorUp.setAction(new MoveActorUpAction()); btnMoveActorUp.setIcon(IconManager.ARROW_UP); details2Panel.add(btnMoveActorUp, "2, 8, right, top"); } { JButton btnMoveProducerUp = new JButton((String) null); btnMoveProducerUp.setMargin(new Insets(2, 2, 2, 2)); btnMoveProducerUp.setAction(new MoveProducerUpAction()); btnMoveProducerUp.setIcon(IconManager.ARROW_UP); details2Panel.add(btnMoveProducerUp, "6, 8, right, top"); } { JButton btnMoveActorDown = new JButton((String) null); btnMoveActorDown.setMargin(new Insets(2, 2, 2, 2)); btnMoveActorDown.setAction(new MoveActorDownAction()); btnMoveActorDown.setIcon(IconManager.ARROW_DOWN); details2Panel.add(btnMoveActorDown, "2, 10, right, top"); } { JButton btnMoveProducerDown = new JButton((String) null); btnMoveProducerDown.setMargin(new Insets(2, 2, 2, 2)); btnMoveProducerDown.setAction(new MoveProducerDownAction()); btnMoveProducerDown.setIcon(IconManager.ARROW_DOWN); details2Panel.add(btnMoveProducerDown, "6, 10, right, top"); } { JLabel lblGenres = new JLabel(BUNDLE.getString("metatag.genre")); //$NON-NLS-1$ details2Panel.add(lblGenres, "2, 14, right, default"); } { JScrollPane scrollPaneGenres = new JScrollPane(); details2Panel.add(scrollPaneGenres, "4, 14, 1, 5"); { listGenres = new JList(); scrollPaneGenres.setViewportView(listGenres); } } { JLabel lblTags = new JLabel(BUNDLE.getString("metatag.tags")); //$NON-NLS-1$ details2Panel.add(lblTags, "6, 14, right, default"); } { JScrollPane scrollPaneTags = new JScrollPane(); details2Panel.add(scrollPaneTags, "8, 14, 1, 5"); listTags = new JList(); scrollPaneTags.setViewportView(listTags); } { JButton btnAddGenre = new JButton(""); btnAddGenre.setAction(new AddGenreAction()); btnAddGenre.setIcon(IconManager.LIST_ADD); btnAddGenre.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnAddGenre, "2, 16, right, top"); } { JButton btnAddTag = new JButton(""); btnAddTag.setAction(new AddTagAction()); btnAddTag.setIcon(IconManager.LIST_ADD); btnAddTag.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnAddTag, "6, 16, 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, "2, 18, 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, "6, 18, right, top"); } { cbGenres = new AutocompleteComboBox(MediaGenres.values()); details2Panel.add(cbGenres, "4, 20"); } { cbTags = new AutocompleteComboBox(movieList.getTagsInMovies()); details2Panel.add(cbTags, "8, 20"); } { JLabel lblTrailer = new JLabel(BUNDLE.getString("metatag.trailer")); //$NON-NLS-1$ details2Panel.add(lblTrailer, "2, 22, right, default"); } { JScrollPane scrollPaneTrailer = new JScrollPane(); details2Panel.add(scrollPaneTrailer, "4, 22, 5, 5"); tableTrailer = new JTable(); tableTrailer.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); scrollPaneTrailer.setViewportView(tableTrailer); } { JButton btnAddTrailer = new JButton(""); btnAddTrailer.setAction(new AddTrailerAction()); btnAddTrailer.setIcon(IconManager.LIST_ADD); btnAddTrailer.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnAddTrailer, "2, 24, right, top"); } { JButton btnRemoveTrailer = new JButton(""); btnRemoveTrailer.setAction(new RemoveTrailerAction()); btnRemoveTrailer.setIcon(IconManager.LIST_REMOVE); btnRemoveTrailer.setMargin(new Insets(2, 2, 2, 2)); details2Panel.add(btnRemoveTrailer, "2, 26, right, top"); } } /** * 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[] { FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("250px:grow"), FormSpecs.RELATED_GAP_COLSPEC, ColumnSpec.decode("150px:grow"), FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("50px:grow(2)"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("50px:grow(2)"), FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_GAP_ROWSPEC, RowSpec.decode("200px:grow(2)"), FormSpecs.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(movieToEdit.getIds(), ImageType.LOGO, movieList.getDefaultArtworkScrapers(), lblLogo, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblLogo.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblLogo, "2, 4, fill, fill"); } { final JLabel lblClearlogoT = new JLabel(BUNDLE.getString("mediafiletype.clearlogo")); //$NON-NLS-1$ artworkPanel.add(lblClearlogoT, "4, 2"); } { 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(movieToEdit.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 lblBannerT = new JLabel(BUNDLE.getString("mediafiletype.banner")); //$NON-NLS-1$ artworkPanel.add(lblBannerT, "2, 6"); } { 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(movieToEdit.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, "2, 8, 3, 1, fill, fill"); } { JLabel lblClearartT = new JLabel("ClearArt"); artworkPanel.add(lblClearartT, "2, 10"); } { 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(movieToEdit.getIds(), ImageType.CLEARART, movieList.getDefaultArtworkScrapers(), lblClearart, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblClearart.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblClearart, "2, 12, fill, fill"); } { JLabel lblThumbT = new JLabel("Thumb"); artworkPanel.add(lblThumbT, "4, 10"); } { 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(movieToEdit.getIds(), ImageType.THUMB, movieList.getDefaultArtworkScrapers(), lblThumb, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblThumb.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblThumb, "4, 12, fill, fill"); } { JLabel lblDiscT = new JLabel("Disc"); artworkPanel.add(lblDiscT, "6, 10"); } { lblDisc = new ImageLabel(); lblDisc.setAlternativeText(BUNDLE.getString("image.notfound.disc")); //$NON-NLS-1$ lblDisc.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { ImageChooserDialog dialog = new ImageChooserDialog(movieToEdit.getIds(), ImageType.DISC, movieList.getDefaultArtworkScrapers(), lblDisc, null, null, MediaType.MOVIE); dialog.setLocationRelativeTo(MainWindow.getActiveInstance()); dialog.setVisible(true); } }); lblDisc.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); artworkPanel.add(lblDisc, "6, 12, fill, fill"); } } /** * Media Files */ { mediaFilesPanel = new MediaFileEditorPanel(mediaFiles); tabbedPane.addTab(BUNDLE.getString("metatag.mediafiles"), null, mediaFilesPanel, null); //$NON-NLS-1$ } /** * 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, FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_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, "2, 1, fill, top"); okButton.setAction(new ChangeMovieAction()); okButton.setActionCommand("OK"); getRootPane().setDefaultButton(okButton); } { JButton cancelButton = new JButton(BUNDLE.getString("Button.cancel")); //$NON-NLS-1$ buttonPane.add(cancelButton, "4, 1, fill, top"); cancelButton.setAction(new DiscardAction()); cancelButton.setActionCommand("Cancel"); } if (inQueue) { JButton btnAbort = new JButton(BUNDLE.getString("Button.abortqueue")); //$NON-NLS-1$ btnAbort.setAction(new AbortQueueAction()); buttonPane.add(btnAbort, "6, 1, fill, top"); } } initDataBindings(); { int year = 0; try { year = Integer.parseInt(movieToEdit.getYear()); } catch (Exception ignored) { } SimpleDateFormat dateFormat = (SimpleDateFormat) DateFormat.getDateInstance(DateFormat.MEDIUM); for (Certification cert : Certification .getCertificationsforCountry(MovieModuleManager.MOVIE_SETTINGS.getCertificationCountry())) { cbCertification.addItem(cert); } tfTitle.setText(movieToEdit.getTitle()); tfOriginalTitle.setText(movieToEdit.getOriginalTitle()); tfSorttitle.setText(movieToEdit.getSortTitle()); tpTagline.setText(movieToEdit.getTagline()); tpPlot.setText(movieToEdit.getPlot()); tpPlot.setCaretPosition(0); tfDirector.setText(movieToEdit.getDirector()); tfWriter.setText(movieToEdit.getWriter()); lblPoster.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.POSTER)); tfProductionCompanies.setText(movieToEdit.getProductionCompany()); spRuntime.setValue(movieToEdit.getRuntime()); cbEdition.setSelectedItem(movieToEdit.getEdition()); tfSpokenLanguages.setText(movieToEdit.getSpokenLanguages()); tfCountry.setText(movieToEdit.getCountry()); spYear.setValue(year); cbCertification.setSelectedItem(movieToEdit.getCertification()); lblMoviePath.setText(movieToEdit.getPath()); lblLogo.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.LOGO)); lblClearlogo.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.CLEARLOGO)); lblClearart.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.CLEARART)); lblThumb.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.THUMB)); lblDisc.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.DISCART)); lblBanner.setImagePath(movieToEdit.getArtworkFilename(MediaFileType.BANNER)); for (MovieActor origCast : movieToEdit.getActors()) { MovieActor actor = new MovieActor(); actor.setName(origCast.getName()); actor.setCharacter(origCast.getCharacter()); actor.setThumbUrl(origCast.getThumbUrl()); cast.add(actor); } for (MovieProducer origProducer : movieToEdit.getProducers()) { MovieProducer producer = new MovieProducer(); producer.setName(origProducer.getName()); producer.setRole(origProducer.getRole()); producer.setThumbUrl(origProducer.getThumbUrl()); producers.add(producer); } for (MediaGenres genre : movieToEdit.getGenres()) { genres.add(genre); } for (MovieTrailer trailer : movieToEdit.getTrailer()) { trailers.add(trailer); } for (String tag : movieToEdit.getTags()) { if (StringUtils.isNotBlank(tag)) { tags.add(tag); } } extrathumbs.addAll(movieToEdit.getExtraThumbs()); extrafanarts.addAll(movieToEdit.getExtraFanarts()); for (MovieSet movieSet : movieList.getSortedMovieSetList()) { cbMovieSet.addItem(movieSet); if (movieToEdit.getMovieSet() == movieSet) { cbMovieSet.setSelectedItem(movieSet); } } } // 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$ tableProducers.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$ tableProducers.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.role")); //$NON-NLS-1$ tableTrailer.getColumnModel().getColumn(0).setHeaderValue(BUNDLE.getString("metatag.nfo")); //$NON-NLS-1$ tableTrailer.getColumnModel().getColumn(1).setHeaderValue(BUNDLE.getString("metatag.name")); //$NON-NLS-1$ tableTrailer.getColumnModel().getColumn(2).setHeaderValue(BUNDLE.getString("metatag.source")); //$NON-NLS-1$ tableTrailer.getColumnModel().getColumn(3).setHeaderValue(BUNDLE.getString("metatag.quality")); //$NON-NLS-1$ tableTrailer.getColumnModel().getColumn(4).setHeaderValue(BUNDLE.getString("metatag.url")); //$NON-NLS-1$ // adjust table columns tableTrailer.getColumnModel().getColumn(0).setMaxWidth(55); // implement listener to simulate button group tableTrailer.getModel().addTableModelListener(new TableModelListener() { @Override public void tableChanged(TableModelEvent arg0) { // click on the checkbox if (arg0.getColumn() == 0) { int row = arg0.getFirstRow(); MovieTrailer changedTrailer = trailers.get(row); // if flag inNFO was changed, change all other trailers flags if (changedTrailer.getInNfo()) { for (MovieTrailer trailer : trailers) { if (trailer != changedTrailer) { trailer.setInNfo(Boolean.FALSE); } } } } } }); }
From source file:org.tinymediamanager.ui.movies.dialogs.MovieExporterDialog.java
/** * Create the dialog.//w w w. j a v a2s.c o m * * @param moviesToExport * the movies to export */ public MovieExporterDialog(List<Movie> moviesToExport) { super(BUNDLE.getString("movie.export"), "movieExporter"); //$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 panelDestination = new JPanel(); getContentPane().add(panelDestination, "2, 4, fill, fill"); panelDestination .setLayout( new FormLayout( new ColumnSpec[] { ColumnSpec.decode("150dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, }, new RowSpec[] { FormSpecs.DEFAULT_ROWSPEC, })); tfExportDir = new JTextField(); panelDestination.add(tfExportDir, "1, 1, fill, default"); tfExportDir.setColumns(10); JButton btnSetDestination = new JButton(BUNDLE.getString("export.setdestination")); //$NON-NLS-1$ panelDestination.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 { MovieExporter exporter = new MovieExporter(Paths.get(selectedTemplate.getPath())); exporter.export(movies, Paths.get(tfExportDir.getText())); } catch (Exception e) { LOGGER.error("Error exporting movies: ", 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); movies = moviesToExport; templatesFound = MovieExporter.findTemplates(TemplateType.MOVIE); initDataBindings(); }
From source file:org.tinymediamanager.ui.movies.dialogs.MovieSubtitleChooserDialog.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, ColumnSpec.decode("200dlu:grow"), FormSpecs.RELATED_GAP_COLSPEC, FormSpecs.DEFAULT_COLSPEC, FormSpecs.RELATED_GAP_COLSPEC, }, new RowSpec[] { FormSpecs.RELATED_GAP_ROWSPEC, FormSpecs.DEFAULT_ROWSPEC, FormSpecs.RELATED_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, RowSpec.decode("120dlu:grow"), FormSpecs.RELATED_GAP_ROWSPEC, })); final JLabel lblMovieTitle = new JLabel(movieToScrape.getTitle()); TmmFontHelper.changeFont(lblMovieTitle, 1.33, Font.BOLD); panelContent.add(lblMovieTitle, "2, 2, 9, 1"); final JLabel lblMediaFileNameT = new JLabel(BUNDLE.getString("metatag.filename")); //$NON-NLS-1$ panelContent.add(lblMediaFileNameT, "2, 4, right, default"); final JLabel lblMediaFileName = new JLabel(fileToScrape.getFilename()); panelContent.add(lblMediaFileName, "4, 4, 7, 1"); final JLabel lblRuntimeT = new JLabel(BUNDLE.getString("metatag.runtime")); //$NON-NLS-1$ panelContent.add(lblRuntimeT, "2, 6, right, default"); final JLabel lblRuntime = new JLabel(fileToScrape.getDurationHHMMSS()); panelContent.add(lblRuntime, "4, 6"); final JLabel lblImdbIdT = new JLabel(BUNDLE.getString("metatag.imdb")); //$NON-NLS-1$ panelContent.add(lblImdbIdT, "6, 6, right, default"); final JLabel lblImdbId = new JLabel(movieToScrape.getImdbId()); panelContent.add(lblImdbId, "8, 6"); final JLabel lblScraperT = new JLabel(BUNDLE.getString("scraper")); //$NON-NLS-1$ panelContent.add(lblScraperT, "2, 8, right, default"); cbScraper = new MediaScraperCheckComboBox(); panelContent.add(cbScraper, "4, 8, fill, default"); tfSearchQuery = new JTextField(movieToScrape.getTitle()); panelContent.add(tfSearchQuery, "6, 8, 3, 1, fill, default"); tfSearchQuery.setColumns(10);/*from w w w. j a v a 2s.c o m*/ final JButton btnSearch = new JButton(BUNDLE.getString("Button.search")); //$NON-NLS-1$ btnSearch.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { searchSubtitle(null, "", tfSearchQuery.getText()); } }); panelContent.add(btnSearch, "10, 8"); final JLabel lblLanguageT = new JLabel(BUNDLE.getString("metatag.language")); //$NON-NLS-1$ panelContent.add(lblLanguageT, "2, 10, right, default"); cbLanguage = new JComboBox<>(); cbLanguage.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { searchSubtitle(null, "", tfSearchQuery.getText()); } }); panelContent.add(cbLanguage, "4, 10, fill, default"); final JScrollPane scrollPaneSubs = new JScrollPane(); panelContent.add(scrollPaneSubs, "2, 12, 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); } } } }
From source file:org.tinymediamanager.ui.moviesets.dialogs.MovieSetChooserDialog.java
/** * Instantiates a new movie set chooser panel. * /* ww w . java 2 s. com*/ * @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.tvshows.dialogs.TvShowEditorDialog.java
/** * Instantiates a new tv show editor dialog. * /*from w w w. j a va 2 s. co m*/ * @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);//w ww . ja v a 2 s. c o 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 w w . j a va 2 s. c o 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$ }