コード例 #1
0
  public void handleActionKey() {
    LibraryFilesTableDataLine line = DATA_MODEL.get(TABLE.getSelectedRow());
    if (line == null || line.getFile() == null) {
      return;
    }
    if (getMediaType().equals(MediaType.getAudioMediaType())
        && MediaPlayer.isPlayableFile(line.getFile())) {
      MediaPlayer.instance()
          .asyncLoadMedia(new MediaSource(line.getFile()), true, false, true, null, getFilesView());
      UXStats.instance().log(UXAction.LIBRARY_PLAY_AUDIO_FROM_FILE);
      return;
    }

    int[] rows = TABLE.getSelectedRows();
    // LibraryTableModel ltm = DATA_MODEL;
    // File file;
    for (int i = 0; i < rows.length; i++) {
      // file = ltm.getFile(rows[i]);
      // if it's a directory try to select it in the library tree
      // if it could be selected return
      //			if (file.isDirectory()
      //				&& LibraryMediator.setSelectedDirectory(file))
      //				return;
    }

    launch(true);
  }
コード例 #2
0
 @Override
 protected MediaSource createMediaSource(LibraryFilesTableDataLine line) {
   if (MediaPlayer.isPlayableFile(line.getInitializeObject())) {
     return new MediaSource(line.getInitializeObject());
   } else {
     return null;
   }
 }
コード例 #3
0
  private JMenu createSearchSubMenu(LibraryFilesTableDataLine dl) {
    SkinMenu menu = new SkinMenu(I18n.tr("Search"));

    if (dl != null) {
      File f = dl.getInitializeObject();
      String keywords = QueryUtils.createQueryString(f.getName());
      if (keywords.length() > 0) menu.add(new SkinMenuItem(new SearchAction(keywords)));
    }

    if (menu.getItemCount() == 0) menu.setEnabled(false);

    return menu;
  }