예제 #1
0
 /*
  * (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);
       }
     }
   }
 }
예제 #2
0
 /*
  * (non-Javadoc)
  *
  * @see org.jajuk.base.Observer#update(org.jajuk.base.Event)
  */
 public void update(JajukEvent event) {
   if (event.getSubject() == JajukEvents.FILE_LAUNCHED) {
     // Compute album max rating every 10 tracks launches
     if (comp % 10 == 0) {
       refreshMaxRating();
     }
     comp++;
   }
 }
예제 #3
0
 /*
  * (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);
         }
       }
     }
   }
 }
 /*
  * (non-Javadoc)
  *
  * @see org.jajuk.ui.Observer#update(java.lang.String)
  */
 @Override
 public void update(JajukEvent event) {
   JajukEvents subject = event.getSubject();
   if (subject.equals(JajukEvents.FILE_LAUNCHED)) {
     comp++;
     // Change local collection suggestions every 10 track plays
     if (comp % 10 == 0) {
       refreshLocalCollectionTabs();
     }
     // update last.fm panels
     refreshLastFMCollectionTabs();
   } else if (subject.equals(JajukEvents.PARAMETERS_CHANGE) && isLastFMTabsVisible()) {
     // The show/hide unmounted may have changed, refresh local
     // collection panels
     refreshLastFMCollectionTabs();
   } else if (subject.equals(JajukEvents.COVER_DEFAULT_CHANGED)
       || subject.equals(JajukEvents.SUGGESTIONS_REFRESH)) {
     // New default cover, refresh the view
     refreshLocalCollectionTabs();
   }
 }