Package org.gudy.azureus2.core3.category

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


      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(menuCategory, 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"));
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

      // It may be the categories array just contains "uncategorised".
      allow_category_selection = user_category_found;
    }

    if (allow_category_selection) {
      final Category catUncat = CategoryManager.getCategory(Category.TYPE_UNCATEGORIZED);
      if (catUncat != null) {
        final MenuItem itemCategory = new MenuItem(menuCategory, SWT.PUSH);
        Messages.setLanguageText(itemCategory, catUncat.getName());
        itemCategory.addListener(SWT.Selection, new DMTask(dms) {
          public void run(DownloadManager dm) {
            dm.getDownloadState().setCategory(catUncat);
          }
        });

        new MenuItem(menuCategory, SWT.SEPARATOR);
      }

      for (i = 0; i < categories.length; i++) {
        final Category category = categories[i];
        if (category.getType() == Category.TYPE_USER) {
          final MenuItem itemCategory = new MenuItem(menuCategory, SWT.PUSH);
          itemCategory.setText(category.getName());
          itemCategory.addListener(SWT.Selection, new DMTask(dms) {
            public void run(DownloadManager dm) {
              dm.getDownloadState().setCategory(category);
            }
          });
        }
      }

      new MenuItem(menuCategory, SWT.SEPARATOR);
    }

    final MenuItem itemAddCategory = new MenuItem(menuCategory, SWT.PUSH);
    Messages.setLanguageText(itemAddCategory, "MyTorrentsView.menu.setCategory.add");

    itemAddCategory.addListener(SWT.Selection, new DMTask(dms) {
      public void run(DownloadManager[] dms) {
        CategoryAdderWindow adderWindow = new CategoryAdderWindow(composite.getDisplay());
        Category newCategory = adderWindow.getNewCategory();
        if (newCategory != null) assignToCategory(dms, newCategory);
      }
    });

  }
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(menuCategory, 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"));
View Full Code Here

  public void categoryChanged(Category category) { 
  }
 
  private void addCategory() {
    CategoryAdderWindow adderWindow = new CategoryAdderWindow(SWTThread.getInstance().getDisplay());
    Category newCategory = adderWindow.getNewCategory();
    if (newCategory != null)
      assignSelectedToCategory(newCategory);
  }
View Full Code Here

      String  cat_str = null;

      if ( dm != null ){
     
          Category cat = dm.getDownloadState().getCategory();  
       
        if (cat != null){
         
          cat_str = cat.getName();
        }
      }else{
       
          // pick up specific torrent category, bit 'o' a hack tis
     
View Full Code Here

   
        String cat_string = getStringAttribute( AT_CATEGORY );

        if ( cat_string != null ){
         
          Category cat = CategoryManager.getCategory( cat_string );
         
          if ( cat != null ){
           
            setCategory( cat );
          }
View Full Code Here

      if ( value == null ){
       
        setCategory( null );
       
      }else{
        Category  cat = CategoryManager.getCategory( value );
     
        if ( cat == null ){
       
          cat = CategoryManager.createCategory( value );
         
View Full Code Here

  getAttribute(
    String    name )
  {
    if ( name.equals( AT_CATEGORY )){
     
      Category  cat = getCategory();
     
      if ( cat == null ){
       
        return( null );
      }
     
      if ( cat == CategoryManager.getCategory( Category.TYPE_UNCATEGORIZED )){
       
        return( null );
      }
     
      return( cat.getName());
     
    }else{
     
      return( getStringAttribute( name ));
    }
View Full Code Here

    if (cat != null && cat.getType() != Category.TYPE_USER){
     
      cat = null;
    }
   
    Category oldCategory = (category == null)?CategoryManager.getCategory(Category.TYPE_UNCATEGORIZED):category;
       
    category = cat;
   
    if (oldCategory != null ){
     
      oldCategory.removeManager( this );
      }
   
    if (category != null ){
     
      category.addManager( this );
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.