示例#1
0
  /** Builds the content pane. */
  @Override
  public void build() {
    initComponents();
    initComponentAnnotations();
    initEventHandling();

    trackPanel = buildTrackPanel();

    FormLayout layout =
        new FormLayout(
            "fill:pref:grow", "max(14dlu;pref), p, p, p, 12px, p, 7px, p, 12px, p, 7px, p");

    setLayout(layout);
    PanelBuilder builder = new PanelBuilder(layout, this);
    builder.setDefaultDialogBorder();
    CellConstraints cc = new CellConstraints();

    builder.add(buildHintAreaPane(), cc.xy(1, 1));
    builder.addSeparator(Resources.getString("label.track"), cc.xy(1, 3));
    builder.add(trackPanel, cc.xy(1, 4));
    builder.addSeparator(Resources.getString("label.taginfo"), cc.xy(1, 6));
    builder.add(buildMusicPanel(), cc.xy(1, 8));
    JComponent audit = buildAuditInfoPanel();
    if (this.getSettings().isAuditInfo()) {
      builder.addSeparator(Resources.getString("label.auditinfo"), cc.xy(1, 10));
      builder.add(audit, cc.xy(1, 12));
    }
  }
示例#2
0
  /**
   * Builds the Music information panel.
   *
   * <p>
   *
   * @return the panel to display the music info
   */
  private JComponent buildMusicPanel() {
    FormLayout layout =
        new FormLayout(
            "right:max(14dlu;pref), 4dlu, left:min(80dlu;pref), 100px, right:max(14dlu;pref),pref:grow, 4px",
            "p, 4px, p, 4px, p, 4px, p, 4px, p, 4px");

    layout.setRowGroups(new int[][] {{1, 3}});
    PanelBuilder builder = new PanelBuilder(layout);
    CellConstraints cc = new CellConstraints();
    builder.addLabel(Resources.getString("label.file") + ": ", cc.xy(1, 1));
    builder.add(location, cc.xyw(3, 1, 5));
    builder.addLabel(Resources.getString("label.duration") + ": ", cc.xy(1, 3));
    builder.add(duration, cc.xy(3, 3));
    builder.addLabel(Resources.getString("label.layer") + ": ", cc.xy(5, 3));
    builder.add(layer, cc.xy(6, 3));
    builder.addLabel(Resources.getString("label.bitrate") + ": ", cc.xy(1, 5));
    builder.add(bitRate, cc.xyw(3, 5, 4));
    builder.addLabel(Resources.getString("label.version") + ": ", cc.xy(5, 5));
    builder.add(version, cc.xy(6, 5));
    builder.addLabel(Resources.getString("label.frequency") + ": ", cc.xy(1, 7));
    builder.add(frequency, cc.xy(3, 7));
    builder.addLabel(Resources.getString("label.mode") + ": ", cc.xy(5, 7));
    builder.add(mode, cc.xy(6, 7));
    builder.addLabel(Resources.getString("label.filesize") + ": ", cc.xy(1, 9));
    builder.add(fileSize, cc.xy(3, 9));
    builder.addLabel(Resources.getString("label.copyright") + ": ", cc.xy(5, 9));
    builder.add(copyrighted, cc.xy(6, 9));

    return builder.getPanel();
  }
示例#3
0
 /** Initializes validation annotations. */
 private void initComponentAnnotations() {
   ValidationComponentUtils.setInputHint(
       titleField, Resources.getString("messages.TitleIsMandatory"));
   ValidationComponentUtils.setMandatory(titleField, true);
   ValidationComponentUtils.setMessageKey(titleField, "Track.Title");
   ValidationComponentUtils.setInputHint(
       trackNumber, Resources.getString("messages.NumberIsMandatory"));
   ValidationComponentUtils.setMandatory(trackNumber, true);
   ValidationComponentUtils.setMessageKey(trackNumber, "Track.Track Number");
   ValidationComponentUtils.setInputHint(comment, Resources.getString("messages.NotesLength254"));
   ValidationComponentUtils.setMessageKey(comment, "Track.Comment");
 }
示例#4
0
  /**
   * Builds the Track editor panel.
   *
   * <p>
   *
   * @return the panel to edit track info. AZ - FormLayout corrections
   */
  private JComponent buildTrackPanel() {
    FormLayout layout =
        new FormLayout(
            "right:max(14dlu;pref), 4dlu, left:20dlu, left:140dlu, 4dlu, left:25px, right:pref:grow",
            "4px, p, 4px, p, 4px, p, " + this.getSettings().getCoverSizeSmall() + "px");
    PanelBuilder builder = new PanelBuilder(layout);
    CellConstraints cc = new CellConstraints();

    builder.addLabel(Resources.getString("label.tracknumber") + ": ", cc.xy(1, 2));
    builder.add(trackNumber, cc.xy(3, 2));
    builder.add(albumImage, cc.xywh(7, 2, 1, 6, "right, top"));
    builder.addLabel(Resources.getString("label.title") + ": ", cc.xy(1, 4));
    builder.add(titleField, cc.xyw(3, 4, 2));
    builder.add(ComponentFactory.createTitleCaseButton(titleField), cc.xy(6, 4));
    builder.addLabel(Resources.getString("label.comment") + ": ", cc.xy(1, 6, "right, top"));
    builder.add(comment, cc.xyw(3, 6, 2));
    return new IconFeedbackPanel(
        getValidationModel().getValidationResultModel(), builder.getPanel());
  }
示例#5
0
  /** Rename the file to a good format. */
  @Override
  public void renameFiles() {
    updateModel();

    // check for validation errors, if any then do no changes
    if (hasErrors()) {
      LOG.error(Resources.getString("messages.editorerrors"));
      MessageUtil.showError(this, Resources.getString("messages.editorerrors")); // AZ
      return;
    }

    if (musicTag == null) {
      LOG.error(Resources.getString("messages.filenotexists"));
      MessageUtil.showError(this, Resources.getString("messages.filenotexists")); // AZ
      return;
    }

    try {
      setBusyCursor(true);
      if (this.musicTag.renameFile(this.getSettings().getFileFormatMusic())) {
        getTrack().setTrackUrl(this.musicTag.getAbsolutePath());
        commit();
      }
    } catch (InfrastructureException ex) {
      LOG.error(ex.getMessage());
      MessageUtil.showError(this, ex.getMessage());
    } catch (Exception ex) {
      LOG.error(Resources.getString("messages.ErrorRenamingFile"), ex);
      MessageUtil.showError(this, Resources.getString("messages.ErrorRenamingFile"));
    } finally {
      setBusyCursor(false);
    }
  }
示例#6
0
  /*
   * (non-Javadoc)
   * @see com.melloware.jukes.gui.view.editor.AbstractEditor#commit()
   */
  @Override
  public void commit() {
    super.commit();
    Track track = getTrack();
    updateModel();

    // check for validation errors, if any then do no changes
    boolean hasErrors = hasErrors();
    if (hasErrors) {
      LOG.error(Resources.getString("messages.editorerrors"));
      MessageUtil.showError(this, Resources.getString("messages.editorerrors")); // AZ
      return;
    }

    // try to persist
    try {
      setBusyCursor(true);
      HibernateUtil.beginTransaction();
      HibernateDao.saveOrUpdate(track);
      HibernateUtil.commitTransaction();

      // now update this editor and the treeview
      updateView();
      this.getMainModule().refreshSelection(track, Resources.NODE_CHANGED);
    } catch (InfrastructureException ex) {
      HibernateUtil.rollbackTransaction();
      final String errorMessage = ResourceUtils.getString("messages.UniqueTrack");
      MessageUtil.showError(this, errorMessage); // AZ
      LOG.error(errorMessage, ex);
      HibernateDao.refresh(track);
      hasErrors = true;
    } catch (Exception ex) {
      HibernateUtil.rollbackTransaction();
      final String errorMessage = ResourceUtils.getString("messages.ErrorUpdatingTrack");
      MessageUtil.showError(this, errorMessage); // AZ
      LOG.error(errorMessage, ex);
      HibernateDao.refresh(track);
      hasErrors = true;
    } finally {
      setBusyCursor(false);
    }
    /** AZ - commit with update flag as specified in Settings * */
    final Boolean aUpdateTags = this.getSettings().isUpdateTags();
    if (!hasErrors) {
      if (aUpdateTags) {
        // now update the ID3 tags
        task = new UpdateTagsTask(track);
        // AZ: Put the Title of Progress Monitor Dialog Box and Cancel
        // button
        UIManager.put("ProgressMonitor.progressText", Resources.getString("label.ProgressTitle"));
        UIManager.put("OptionPane.cancelButtonText", Resources.getString("label.Cancel"));

        progressMonitor =
            new ProgressMonitor(
                getMainFrame(),
                Resources.getString("messages.updatetracks"),
                "",
                0,
                task.getLengthOfTask());
        progressMonitor.setProgress(0);
        progressMonitor.setMillisToDecideToPopup(1);
        task.go();
        timer = new Timer(50, null);
        timer.addActionListener(new TimerListener(progressMonitor, task, timer));
        timer.start();
      } else {
        MessageUtil.showSuccess(this);
      }
      super.commit();
    }
  }
    public BeanBeanInfo() {
      super(Bean.class);
      ExtendedPropertyDescriptor descriptor = null;

      descriptor = addProperty("countArtists");
      descriptor.setCategory("Counts");
      descriptor.setDisplayName(Resources.getString("label.CountArtist"));
      descriptor.setShortDescription(Resources.getString("label.CountArtistMessage"));

      descriptor = addProperty("countDiscs");
      descriptor.setCategory("Counts");
      descriptor.setDisplayName(Resources.getString("label.CountDisc"));
      descriptor.setShortDescription(Resources.getString("label.CountDiscMessage"));

      descriptor = addProperty("countTracks");
      descriptor.setCategory("Counts");
      descriptor.setDisplayName(Resources.getString("label.CountTrack"));
      descriptor.setShortDescription(Resources.getString("label.CountTrackMessage"));

      descriptor = addProperty("timeTotal");
      descriptor.setCategory("Times");
      descriptor.setDisplayName(Resources.getString("label.TimeTotal"));
      descriptor.setShortDescription(Resources.getString("label.TimeTotalMessage"));

      descriptor = addProperty("timeAveragePerDisc");
      descriptor.setCategory("Times");
      descriptor.setDisplayName(Resources.getString("label.TimeAvg"));
      descriptor.setShortDescription(Resources.getString("label.TimeAvgMessage"));

      descriptor = addProperty("fileTotal");
      descriptor.setCategory("File");
      descriptor.setDisplayName(Resources.getString("label.FileTotal"));
      descriptor.setShortDescription(Resources.getString("label.FileTotalMessage"));

      descriptor = addProperty("fileAveragePerDisc");
      descriptor.setCategory("File");
      descriptor.setDisplayName(Resources.getString("label.FileAvg"));
      descriptor.setShortDescription(Resources.getString("label.FileAvgMessage"));
    }