Package org.gudy.azureus2.core3.category

Examples of org.gudy.azureus2.core3.category.Category


      return all_dms;
    }else{
      List result = new ArrayList();
      for (int i=0;i<all_dms.size();i++){
        DownloadManager dm = (DownloadManager)all_dms.get(i);
        Category cat = dm.getDownloadState().getCategory();
        if ( cat == null || cat.getType() == Category.TYPE_UNCATEGORIZED){
          result.add( dm );
        }
      }
     
      return( result );
View Full Code Here


              Debug.printStackTrace(e);
            }
          }
 
          if (sCategory != null) {
            Category cat = CategoryManager.getCategory(sCategory);
            if (cat != null) download_manager.getDownloadState().setCategory(cat);
          }
         
          download_manager.requestAssumedCompleteMode();
         
View Full Code Here

     
      Iterator<Category>  it = category_map.keySet().iterator();
     
      while( it.hasNext()){
       
        Category c = it.next();
       
        if ( !active_map.containsKey( c )){
         
          c.removeCategoryListener( category_listener );
         
          it.remove();
        }
      }
     
      for ( final Category c: active_map.keySet()){
       
        if ( !category_map.containsKey( c )){
         
          to_process.put( c, active_map.get(c));
         
          c.addCategoryListener( category_listener );
         
          category_map.put( c, active_map.get(c));
         
          if ( c.getType() == Category.TYPE_UNCATEGORIZED ){
           
            if ( category_dl_listener == null ){
           
                // new downloads don't get a category-change event fired when added
                // we also want to delay things a bit to allow other components
                // to set an initial category. there's no hurry anyways
             
              category_dl_listener =
                new GlobalManagerAdapter()
                {
                  public void
                  downloadManagerAdded(
                    final DownloadManager  dm )
                  {
                    new DelayedEvent(
                      "TM:cat-check",
                      10*1000,
                      new AERunnable()
                      {
                        public void
                        runSupport()
                        {
                          Category dm_c = dm.getDownloadState().getCategory();
                         
                          if ( dm_c == null || dm_c == c ){
                           
                              // still uncategorised
                         
                            Object[]  details;
                           
                            synchronized( category_map ){
 
                              details = category_map.get( c );
                            }
                           
                            if ( details != null ){
                             
                              processCategory( c, details, dm );
                            }
                          }
                        }
                      });
                  }
                  public void
                  downloadManagerRemoved(
                    DownloadManager  dm )
                  {
                  }
                };
           
               
              azureus_core.getGlobalManager().addListener( category_dl_listener, false );
            }
          }
        }
      }
    }
   
    if ( to_process.size() > 0 ){
     
      List<DownloadManager> downloads = azureus_core.getGlobalManager().getDownloadManagers();
     
      for ( Map.Entry<Category, Object[]> entry: to_process.entrySet()){
       
        Category   c     = entry.getKey();
        Object[]  details = entry.getValue();
       
        List<DownloadManager> list = c.getDownloadManagers( downloads );
       
        for( DownloadManager dm: list ){
         
          processCategory( c, details, dm );
        }
View Full Code Here

  public String getTorrentFileName() {
    return download_manager.getTorrentFileName();
  }
 
  public String getCategoryName() {
    Category category = download_manager.getDownloadState().getCategory();
    if (category == null)
      category = CategoryManager.getCategory(Category.TYPE_UNCATEGORIZED);

    if (category == null)
      return null;
    return category.getName();
  }
View Full Code Here

      return( null );
    }
  }
 
  public void setCategory(String sName) {
    Category category = CategoryManager.getCategory(sName);
    if (category == null)
      category = CategoryManager.createCategory(sName);
    download_manager.getDownloadState().setCategory(category);
  }
View Full Code Here

    if ( categories.length > 0 ){
     
      String  assigned_category = subs.getCategory();
     
      final Category uncat = CategoryManager.getCategory( Category.TYPE_UNCATEGORIZED );
           
      if ( uncat != null ){
       
        m = menu_manager.addMenuItem( menu, uncat.getName());
       
        m.setStyle( MenuItem.STYLE_RADIO );
               
        m.setData( new Boolean( assigned_category == null ));
       
        m.addListener(
          new MenuItemListener()
          {
            public void
            selected(
              MenuItem      menu,
              Object         target )
            {
              assignSelectedToCategory( uncat );
            }
          });
       

        m = menu_manager.addMenuItem( menu, "sep1" );
       
        m.setStyle( MenuItem.STYLE_SEPARATOR );
      }

      for ( int i=0; i<categories.length; i++ ){
       
        final Category cat = categories[i];
       
        if ( cat.getType() == Category.TYPE_USER) {
         
          m = menu_manager.addMenuItem( menu, "!" + cat.getName() + "!" );
         
          m.setStyle( MenuItem.STYLE_RADIO );
                   
          m.setData( new Boolean( assigned_category != null && assigned_category.equals( cat.getName())));
         
          m.addListener(
            new MenuItemListener()
            {
              public void
View Full Code Here

  private void
  addCategory() 
  {
    CategoryAdderWindow adderWindow = new CategoryAdderWindow(Display.getDefault());
   
    Category newCategory = adderWindow.getNewCategory();
   
    if ( newCategory != null ){
   
      assignSelectedToCategory( newCategory );
    }
View Full Code Here

                String.valueOf(stats.numIncomplete - stats.numDownloading),
              });
              soLibraryInfo.setText(s);
            } else if (torrentFilterMode == TORRENTS_ALL) {
              if (datasource instanceof Category) {
                Category cat = (Category) datasource;
               
                String id = "library.category.header";
                String s = MessageText.getString(id,
                    new String[] {
                  cat.getName()
                });
                soLibraryInfo.setText(s);

              } else {
                String id = "library.all.header";
View Full Code Here

    Category[] categories = CategoryManager.getCategories();
    Arrays.sort(categories);

    if (categories.length > 0) {
      Category catUncat = CategoryManager.getCategory(Category.TYPE_UNCATEGORIZED);
      if (catUncat != null) {
        final MenuItem itemCategory = new MenuItem(menu_category, SWT.PUSH);
        Messages.setLanguageText(itemCategory, catUncat.getName());
        itemCategory.setData("Category", catUncat);
        itemCategory.addListener(SWT.Selection, new Listener() {
          public void handleEvent(Event event) {
            MenuItem item = (MenuItem)event.widget;
            assignSelectedToCategory((Category)item.getData("Category"),files);
View Full Code Here

  private void
  addCategory(
    TranscodeFile[]    files
  {
    CategoryAdderWindow adderWindow = new CategoryAdderWindow(Display.getDefault());
    Category newCategory = adderWindow.getNewCategory();
    if (newCategory != null)
      assignSelectedToCategory(newCategory,files);
  }
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.category.Category

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.