/** @return ItemManager associated with selected element in combo box */
 ItemManager getItemManager() {
   ItemManager im = null;
   switch (jcbItemChoice.getSelectedIndex()) {
     case 0:
       im = TrackManager.getInstance();
       break;
     case 1:
       im = FileManager.getInstance();
       break;
     case 2:
       im = StyleManager.getInstance();
       break;
     case 3:
       im = AuthorManager.getInstance();
       break;
     case 4:
       im = AlbumManager.getInstance();
       break;
     case 5:
       im = DeviceManager.getInstance();
       break;
     case 6:
       im = DirectoryManager.getInstance();
       break;
     case 7:
       im = PlaylistFileManager.getInstance();
       break;
     case 8:
       im = YearManager.getInstance();
       break;
   }
   return im;
 }
Ejemplo n.º 2
0
 /** Load properties from in file Format: jajuk.ambience.<ID>/<name>=style1,style2,... */
 public void load() {
   // if first startup, define default ambiences
   if (UpgradeManager.isFirstSesion()) {
     createDefaultAmbiences();
     return;
   }
   Properties properties = Conf.getProperties();
   Enumeration<Object> e = properties.keys();
   while (e.hasMoreElements()) {
     String sKey = (String) e.nextElement();
     if (sKey.matches(Const.AMBIENCE_PREFIX + ".*")) {
       Set<Style> styles = new HashSet<Style>(10);
       StringTokenizer st = new StringTokenizer((String) properties.get(sKey), ",");
       while (st.hasMoreTokens()) {
         Style style = StyleManager.getInstance().getStyleByID(st.nextToken());
         if (style != null) {
           styles.add(style);
         }
       }
       String ambienceDesc = sKey.substring(Const.AMBIENCE_PREFIX.length());
       int index = ambienceDesc.indexOf('/');
       if (index == -1) {
         continue;
       }
       String ambienceID = ambienceDesc.substring(0, index);
       String ambienceName = ambienceDesc.substring(index + 1);
       Ambience ambience = new Ambience(ambienceID, ambienceName, styles);
       ambiences.put(ambienceID, ambience);
     }
   }
   // If none ambience, means ambience can have been reset after a style
   // hashcode computation change, reset to defaults
   if (ambiences.size() == 0) {
     createDefaultAmbiences();
   }
 }