/* * (non-Javadoc) * * @see org.jajuk.base.Observer#update(org.jajuk.base.Event) */ public void update(Event event) { synchronized (getLock()) { EventSubject subject = event.getSubject(); if (EventSubject.EVENT_FILE_NAME_CHANGED.equals(subject)) { Properties properties = event.getDetails(); File fNew = (File) properties.get(DETAIL_NEW); File fileOld = (File) properties.get(DETAIL_OLD); // search references in playlists Iterator it = hmItems.values().iterator(); for (int i = 0; it.hasNext(); i++) { Playlist plf = (Playlist) it.next(); if (plf.isReady()) { // check only in mounted // playlists, note that we can't // change unmounted playlists try { if (plf.getFiles().contains(fileOld)) { plf.replaceFile(fileOld, fNew); } } catch (Exception e) { Log.error(17, e); } } } } } }
/* * (non-Javadoc) * * @see org.jajuk.ui.Observer#update(java.lang.String) */ public void update(Event event) { EventSubject subject = event.getSubject(); // Make a search after a stop period if (subject.equals(EventSubject.EVENT_FILE_LAUNCHED) || subject.equals(EventSubject.EVENT_PERPECTIVE_CHANGED)) { // Do not perform search if current perspective is not info for // perfs if (!(PerspectiveManager.getCurrentPerspective() instanceof InfoPerspective)) { return; } // If current state is stopped, reset page if (FIFO.getInstance().getCurrentFile() == null) { reset(); return; } // Launch search launchSearch(false); } // Reset the page when stopping else if (subject.equals(EventSubject.EVENT_ZERO)) { reset(); } // User changed current track tags, so we have to reload // new author wikipedia page else if (subject.equals(EventSubject.EVENT_AUTHOR_CHANGED) || subject.equals(EventSubject.EVENT_ALBUM_CHANGED) || subject.equals(EventSubject.EVENT_TRACK_CHANGED)) { update(new Event(EventSubject.EVENT_FILE_LAUNCHED)); } }