/* * (non-Javadoc) * * @see org.jajuk.ui.Observer#update(java.lang.String) */ public void update(JajukEvent event) { JajukEvents subject = event.getSubject(); if (JajukEvents.STYLE_NAME_CHANGED.equals(subject)) { Properties properties = event.getDetails(); Style old = (Style) properties.get(Const.DETAIL_OLD); Style newStyle = (Style) properties.get(Const.DETAIL_NEW); // replace style into all styles for (Ambience ambience : ambiences.values()) { if (ambience.getStyles().contains(old)) { ambience.removeStyle(old); ambience.addStyle(newStyle); } } } }
/* * (non-Javadoc) * * @see org.jajuk.base.Observer#update(org.jajuk.base.Event) */ public void update(JajukEvent event) { JajukEvents subject = event.getSubject(); if (JajukEvents.FILE_NAME_CHANGED.equals(subject)) { Properties properties = event.getDetails(); File fNew = (File) properties.get(Const.DETAIL_NEW); File fileOld = (File) properties.get(Const.DETAIL_OLD); // search references in playlists ReadOnlyIterator<Playlist> it = getPlaylistsIterator(); while (it.hasNext()) { Playlist plf = 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); } } } } }