コード例 #1
0
 public static PlaylistTableModel create(RobonoboFrame frame, Playlist p, boolean canEdit) {
   List<Track> trax = new ArrayList<Track>();
   for (String sid : p.getStreamIds()) {
     trax.add(frame.ctrl.getTrack(sid));
   }
   EventList<Track> el = GlazedLists.eventList(trax);
   return new PlaylistTableModel(frame, p, canEdit, el, null);
 }
コード例 #2
0
 /**
  * If any of these streams are already in this playlist, they will be removed before being added
  * in their new position
  */
 public void addStreams(List<String> streamIds, int position) {
   if (!canEdit) throw new SeekInnerCalmException();
   updateLock.lock();
   try {
     // Rather than buggering about inside our eventlist, we re-order the playlist and then just
     // re-add the whole
     // list again
     // First, scan through our playlist and remove any that are in this
     // list (they're being moved)
     for (Iterator<String> iter = p.getStreamIds().iterator(); iter.hasNext(); ) {
       String pStreamId = iter.next();
       if (streamIds.contains(pStreamId)) iter.remove();
     }
     if (position > p.getStreamIds().size()) position = p.getStreamIds().size();
     // Put the new streams in the right spot
     p.getStreamIds().addAll(position, streamIds);
     // Now regenerate our tracks
     regenEventList();
   } finally {
     updateLock.unlock();
   }
   runPlaylistUpdate();
 }