Package org.gudy.azureus2.core3.tracker.client.impl.bt

Examples of org.gudy.azureus2.core3.tracker.client.impl.bt.TRTrackerBTAnnouncerImpl


      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

        UIFunctionsManagerSWT.getUIFunctionsSWT().dispose(false, false);
      }
    });

    // let platform decide
    ParameterListener paramListener = new ParameterListener() {
      public void parameterChanged(String parameterName) {
        if (COConfigurationManager.getBooleanParameter("Enable System Tray")
            && COConfigurationManager.getBooleanParameter("Close To Tray")) {
          KeyBindings.removeAccelerator(file_exit, MENU_ID_EXIT);
        } else {
View Full Code Here

                  !isToolbarVisible);
            }
          }
        });

    final ParameterListener listener = new ParameterListener() {
      public void parameterChanged(String parameterName) {
        item.setSelection(COConfigurationManager.getBooleanParameter(parameterName));
      }
    };
View Full Code Here

            new BetaWizard();
      }
    });

    COConfigurationManager.addAndFireParameterListener(
        "Beta Programme Enabled", new ParameterListener() {
          public void parameterChanged(String parameterName) {
            Utils.execSWTThread(new AERunnable() {
              public void runSupport() {
                if ( menuItem.isDisposed()){
                  return;
View Full Code Here

    srStatus = new CLabelPadding(statusBar, borderFlag);
    srStatus.setText(MessageText.getString("SpeedView.stats.ratio"));

    COConfigurationManager.addAndFireParameterListener("Status Area Show SR",
        new ParameterListener() {
          public void parameterChanged(String parameterName) {
            srStatus.setVisible(COConfigurationManager.getBooleanParameter(parameterName));
            statusBar.layout();
          }
        });

    natStatus = new CLabelPadding(statusBar, borderFlag);
    natStatus.setText("");

    COConfigurationManager.addAndFireParameterListener("Status Area Show NAT",
        new ParameterListener() {
          public void parameterChanged(String parameterName) {
            natStatus.setVisible(COConfigurationManager.getBooleanParameter(parameterName));
            statusBar.layout();
          }
        });

    dhtStatus = new CLabelPadding(statusBar, borderFlag);
    dhtStatus.setText("");
    dhtStatus.setToolTipText(MessageText.getString("MainWindow.dht.status.tooltip"));

    COConfigurationManager.addAndFireParameterListener("Status Area Show DDB",
        new ParameterListener() {
          public void parameterChanged(String parameterName) {
            dhtStatus.setVisible(COConfigurationManager.getBooleanParameter(parameterName));
            statusBar.layout();
          }
        });
    ipBlocked = new CLabelPadding(statusBar, borderFlag);
    ipBlocked.setText("{} IPs:"); //$NON-NLS-1$
    Messages.setLanguageText(ipBlocked, "MainWindow.IPs.tooltip");
    ipBlocked.addListener(SWT.MouseDoubleClick, new ListenerNeedingCoreRunning() {
      public void handleEvent(AzureusCore core, Event event) {
        BlockedIpsWindow.showBlockedIps(core, parent.getShell());
      }
    });

    COConfigurationManager.addAndFireParameterListener("Status Area Show IPF",
        new ParameterListener() {
          public void parameterChanged(String parameterName) {
            ipBlocked.setVisible(COConfigurationManager.getBooleanParameter(parameterName));
            statusBar.layout();
          }
        });

    statusDown = new CLabelPadding(statusBar, borderFlag);
    statusDown.setImage(imageLoader.getImage("down"));
    //statusDown.setText(/*MessageText.getString("ConfigView.download.abbreviated") +*/"n/a");
    Messages.setLanguageText(statusDown,
        "MainWindow.status.updowndetails.tooltip");

    Listener lStats = new Listener() {
      public void handleEvent(Event e) {
        uiFunctions.openView(UIFunctions.VIEW_STATS, null);
      }
    };

    statusUp = new CLabelPadding(statusBar, borderFlag);
    statusUp.setImage(imageLoader.getImage("up"));
    //statusUp.setText(/*MessageText.getString("ConfigView.upload.abbreviated") +*/"n/a");
    Messages.setLanguageText(statusUp,
        "MainWindow.status.updowndetails.tooltip");

    statusDown.addListener(SWT.MouseDoubleClick, lStats);
    statusUp.addListener(SWT.MouseDoubleClick, lStats);

    Listener lDHT = new Listener() {
      public void handleEvent(Event e) {
        uiFunctions.openView(UIFunctions.VIEW_STATS, "dht");
      }
    };

    dhtStatus.addListener(SWT.MouseDoubleClick, lDHT);

    Listener lSR = new Listener() {
      public void handleEvent(Event e) {

        uiFunctions.openView(UIFunctions.VIEW_STATS, "transfers");

        OverallStats stats = StatsFactory.getStats();
       
        if (stats == null) {
          return;
        }

        long ratio = (1000 * stats.getUploadedBytes() / (stats.getDownloadedBytes() + 1));

        if (ratio < 900) {

          Utils.launch(Constants.AZUREUS_WIKI + "Share_Ratio");
        }
      }
    };

    srStatus.addListener(SWT.MouseDoubleClick, lSR);

    Listener lNAT = new ListenerNeedingCoreRunning() {
      public void handleEvent(AzureusCore core, Event e) {
        uiFunctions.openView(UIFunctions.VIEW_CONFIG,
            ConfigSection.SECTION_CONNECTION);

        if (PluginInitializer.getDefaultInterface().getConnectionManager().getNATStatus() != ConnectionManager.NAT_OK) {
          Utils.launch(Constants.AZUREUS_WIKI + "NAT_problem");
        }
      }
    };

    natStatus.addListener(SWT.MouseDoubleClick, lNAT);

    boolean bSpeedMenu = COConfigurationManager.getBooleanParameter("GUI_SWT_bOldSpeedMenu");

    if (bSpeedMenu) {
      // Status Bar Menu construction
      final Menu menuUpSpeed = new Menu(statusBar.getShell(), SWT.POP_UP);
      menuUpSpeed.addListener(SWT.Show, new Listener() {
        public void handleEvent(Event e) {
          if (!AzureusCoreFactory.isCoreRunning()) {
            return;
          }
          AzureusCore core = AzureusCoreFactory.getSingleton();
          GlobalManager globalManager = core.getGlobalManager();
         
          SelectableSpeedMenu.generateMenuItems(menuUpSpeed, core,
              globalManager, true);
        }
      });
      statusUp.setMenu(menuUpSpeed);
    } else {

      statusUp.addMouseListener(new MouseAdapter() {
        public void mouseDown(MouseEvent e) {
          if (!(e.button == 3 || (e.button == 1 && e.stateMask == SWT.CONTROL))) {
            return;
          }
          Event event = new Event();
          event.type = SWT.MouseUp;
          event.widget = e.widget;
          event.stateMask = e.stateMask;
          event.button = e.button;
          e.widget.getDisplay().post(event);

          CoreWaiterSWT.waitForCoreRunning(new AzureusCoreRunningListener() {
            public void azureusCoreRunning(AzureusCore core) {
              SelectableSpeedMenu.invokeSlider(core, true);
            }
          });
        }
      });
    }

    if (bSpeedMenu) {
      final Menu menuDownSpeed = new Menu(statusBar.getShell(), SWT.POP_UP);
      menuDownSpeed.addListener(SWT.Show, new Listener() {
        public void handleEvent(Event e) {
          if (!AzureusCoreFactory.isCoreRunning()) {
            return;
          }
          AzureusCore core = AzureusCoreFactory.getSingleton();
          GlobalManager globalManager = core.getGlobalManager();

          SelectableSpeedMenu.generateMenuItems(menuDownSpeed, core,
              globalManager, false);
        }
      });
      statusDown.setMenu(menuDownSpeed);
    } else {
      statusDown.addMouseListener(new MouseAdapter() {
        public void mouseDown(MouseEvent e) {
          if (!(e.button == 3 || (e.button == 1 && e.stateMask == SWT.CONTROL))) {
            return;
          }
          Event event = new Event();
          event.type = SWT.MouseUp;
          event.widget = e.widget;
          event.stateMask = e.stateMask;
          event.button = e.button;
          e.widget.getDisplay().post(event);

          CoreWaiterSWT.waitForCoreRunning(new AzureusCoreRunningListener() {
            public void azureusCoreRunning(AzureusCore core) {
              SelectableSpeedMenu.invokeSlider(core, false);
            }
          });
        }
      });
    }

    statusWarnings = new CLabelPadding(statusBar, borderFlag);
    warningIcon = imageLoader.getImage("image.sidebar.vitality.alert");
    infoIcon   = imageLoader.getImage("image.sidebar.vitality.info");
    updateStatusWarnings();
    Messages.setLanguageText(statusWarnings,
        "MainWindow.status.warning.tooltip");
    Alerts.addMessageHistoryListener(new AlertHistoryListener() {
      public void alertHistoryAdded(LogAlert params) {
        updateStatusWarnings();
      }
      public void alertHistoryRemoved(LogAlert alert) {
        updateStatusWarnings();
      }
    });
    statusWarnings.addMouseListener(new MouseListener() {
      public void mouseUp(MouseEvent e) {
        if (SystemWarningWindow.numWarningWindowsOpen > 0) {
          return;
        }
        ArrayList<LogAlert> alerts = Alerts.getUnviewedLogAlerts();
        if (alerts.size() == 0) {
          return;
        }

        Shell shell = statusWarnings.getShell();
        Rectangle bounds = statusWarnings.getClientArea();
        Point ptBottomRight = statusWarnings.toDisplay(bounds.x + bounds.width, bounds.y);
        new SystemWarningWindow(alerts.get(0), ptBottomRight, shell, 0);
      }
     
      public void mouseDown(MouseEvent e) {
      }
     
      public void mouseDoubleClick(MouseEvent e) {
      }
    });
   
    COConfigurationManager.addAndFireParameterListener("status.rategraphs",
        new ParameterListener() {
      public void parameterChanged(String parameterName) {
        Utils.execSWTThread(new AERunnable() {
          public void runSupport() {
            boolean doRateGraphs = COConfigurationManager.getBooleanParameter("status.rategraphs");
            if (doRateGraphs) {
View Full Code Here

      }
    });

    updateDataDirCombo();
    dirList = COConfigurationManager.getStringListParameter("saveTo_list");
    StringIterator iter = dirList.iterator();
    while (iter.hasNext()) {
      String s = iter.next();
      if (!s.equals(sDestDir)) {
        cmbDataDir.add(s);
      }
    }
View Full Code Here

              String configAutoKey = TransferSpeedValidator.getActiveAutoUploadParameter(globalManager);

              COConfigurationManager.setParameter(configAutoKey, false);
            }

            final int cValue = ((Integer) new TransferSpeedValidator(configKey,
                new Integer(newSpeed)).getValue()).intValue();

            COConfigurationManager.setParameter(configKey, cValue);

            COConfigurationManager.save();
View Full Code Here

                              TransferSpeedValidator.getActiveAutoUploadParameter(globalManager);
              
                            COConfigurationManager.setParameter( configAutoKey, false );
                          }
                         
                          final int cValue = ((Integer)new TransferSpeedValidator(configKey, (Number)items[i].getData("maxkb")).getValue()).intValue();
                          COConfigurationManager.setParameter(configKey, cValue);
                         

                          COConfigurationManager.save();
                      }
View Full Code Here

TOP

Related Classes of org.gudy.azureus2.core3.tracker.client.impl.bt.TRTrackerBTAnnouncerImpl

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.