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(); }
@Override public void removeLibrary(ILibrary library) { musicDataBasePersister.removeLibrary(library.getName()); fireLibraryChanged(null); }
public void updateSelectionName(IMusicSelection selection, String newName) { persister.updateSelectionName(selection, newName); }
@Override public void addNewLibrary(String name) { musicDataBasePersister.addLibrary(name); fireLibraryChanged(name); }
@Override public void addTracks(String name, List<IMp3Track> tracks) { musicDataBasePersister.addTracks(name, tracks); }
@Override public boolean containsLibraryName(String name) { return musicDataBasePersister.isRegisteredLibrary(name); }
@Override public ILibrary[] getAllLibraries() { return musicDataBasePersister.getAllLibraries(); }
@Override public void updateLibrary(ILibrary library, String newName) { musicDataBasePersister.updateLibaryName(library, newName); fireLibraryChanged(newName); }
@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); }
@Override public void removeTracksFromLibrary(ILibrary library, IMp3Track[] tracks) { musicDataBasePersister.removeTracksFromLibrary(library.getName(), tracks); fireLibraryChanged(library.getName()); }