public void addNewSelection(String unnamedSelectionBase) {
   int count = 1;
   IMusicSelection selection =
       getSelectionByName(unnamedSelectionBase + " " + count); // $NON-NLS-1$
   while (selection != null) {
     count++;
     selection = getSelectionByName(unnamedSelectionBase + " " + count); // $NON-NLS-1$
   }
   persister.addSelection(unnamedSelectionBase + " " + count); // $NON-NLS-1$
   selectionChangeControl.fireChangedEvent();
 }
 public MusicSelectionModel(final MusicDatabasePersister persister) {
   this.persister = persister;
   this.trackDetailModel = new TrackDetailModel(persister);
   persister.addTrackDeletionListener(
       new ITrackDeletionListener() {
         public void trackRemoved(DbMp3Track track) {
           persister.pruneSelections(track);
           currentSelection.removeTracks(new IMp3Track[] {track});
           fireTrackSelectionChanged();
           selectionChangeControl.fireChangedEvent();
         }
       });
 }
 public void persistSelection(IMusicSelection selection) {
   persister.updateSelection(selection);
   selectionChangeControl.fireChangedEvent();
 }
 private IMusicSelection getSelectionByName(String name) {
   return persister.getSelectionByName(name);
 }
 public IMusicSelection[] getPersistedSelections() {
   return persister.getAllSelections();
 }
 public void deleteSelection(IMusicSelection selection) {
   persister.removeSelection(selection);
   selectionChangeControl.fireChangedEvent();
 }
Example #7
0
 @Override
 public void removeLibrary(ILibrary library) {
   musicDataBasePersister.removeLibrary(library.getName());
   fireLibraryChanged(null);
 }
 public void updateSelectionName(IMusicSelection selection, String newName) {
   persister.updateSelectionName(selection, newName);
 }
Example #9
0
 @Override
 public void addNewLibrary(String name) {
   musicDataBasePersister.addLibrary(name);
   fireLibraryChanged(name);
 }
Example #10
0
 @Override
 public void addTracks(String name, List<IMp3Track> tracks) {
   musicDataBasePersister.addTracks(name, tracks);
 }
Example #11
0
 @Override
 public boolean containsLibraryName(String name) {
   return musicDataBasePersister.isRegisteredLibrary(name);
 }
Example #12
0
 @Override
 public ILibrary[] getAllLibraries() {
   return musicDataBasePersister.getAllLibraries();
 }
Example #13
0
 @Override
 public void updateLibrary(ILibrary library, String newName) {
   musicDataBasePersister.updateLibaryName(library, newName);
   fireLibraryChanged(newName);
 }
Example #14
0
 @Override
 public void addTrack(String name, Path mp3File) throws AnathemaException, IOException {
   List<IMp3Track> tracks = new ArrayList<>();
   tracks.add(new FileMp3Track(mp3File));
   musicDataBasePersister.addTracks(name, tracks);
 }
Example #15
0
 @Override
 public void removeTracksFromLibrary(ILibrary library, IMp3Track[] tracks) {
   musicDataBasePersister.removeTracksFromLibrary(library.getName(), tracks);
   fireLibraryChanged(library.getName());
 }