Package org.eclipse.swt.layout

Examples of org.eclipse.swt.layout.GridData


  public Composite configSectionCreate(final Composite parent) {
    ImageLoader imageLoader = ImageLoader.getInstance();
    Image imgOpenFolder = imageLoader.getImage("openFolderButton");

    GridData gridData;
    GridLayout layout;

    // Sub-Section: File -> Torrent
    // ----------------------------
    Composite cTorrent = new Composite(parent, SWT.NULL);

    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    cTorrent.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 2;
    cTorrent.setLayout(layout);
   
    int userMode = COConfigurationManager.getIntParameter("User Mode");
   
   
    // Save .Torrent files to..
    BooleanParameter saveTorrents = new BooleanParameter(cTorrent, "Save Torrent Files",
                                                         "ConfigView.label.savetorrents");

    Composite gSaveTorrents = new Composite(cTorrent, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalIndent = 25;
    gridData.horizontalSpan = 2;
    gSaveTorrents.setLayoutData(gridData);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 3;
    gSaveTorrents.setLayout(layout);

    Label lSaveDir = new Label(gSaveTorrents, SWT.NULL);
    Messages.setLanguageText(lSaveDir, "ConfigView.label.savedirectory");

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    final StringParameter torrentPathParameter = new StringParameter(gSaveTorrents,
                                                                     "General_sDefaultTorrent_Directory");
    torrentPathParameter.setLayoutData(gridData);

    Button browse2 = new Button(gSaveTorrents, SWT.PUSH);
    browse2.setImage(imgOpenFolder);
    imgOpenFolder.setBackground(browse2.getBackground());
    browse2.setToolTipText(MessageText.getString("ConfigView.button.browse"));

    browse2.addListener(SWT.Selection, new Listener() {
      /* (non-Javadoc)
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event event) {
        DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
        dialog.setFilterPath(torrentPathParameter.getValue());
        dialog.setText(MessageText.getString("ConfigView.dialog.choosedefaulttorrentpath"));
        String path = dialog.open();
        if (path != null) {
          torrentPathParameter.setValue(path);
        }
      }
    });
    browse2.setLayoutData(new GridData());

    gridData = new GridData();
    gridData.horizontalSpan = 2;
    new BooleanParameter(gSaveTorrents, "Save Torrent Backup",
                        "ConfigView.label.savetorrentbackup").setLayoutData(gridData);

    Control[] controls = new Control[]{ gSaveTorrents };
    IAdditionalActionPerformer grayPathAndButton1 = new ChangeSelectionActionPerformer(controls);
    saveTorrents.setAdditionalActionPerformer(grayPathAndButton1);

    gridData = new GridData();
    gridData.horizontalSpan = 2;
    new BooleanParameter(
        cTorrent,
      "Default Start Torrents Stopped",
        "ConfigView.label.defaultstarttorrentsstopped").setLayoutData(gridData);


    // Watch Folder
    BooleanParameter watchFolder = new BooleanParameter(cTorrent, "Watch Torrent Folder",
                                                        "ConfigView.label.watchtorrentfolder");

    Composite gWatchFolder = new Composite(cTorrent, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalIndent = 25;
    gridData.horizontalSpan = 2;
    gWatchFolder.setLayoutData(gridData);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 3;
    gWatchFolder.setLayout(layout);

    Label lImportDir = new Label(gWatchFolder, SWT.NULL);
    Messages.setLanguageText(lImportDir, "ConfigView.label.importdirectory");

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    final StringParameter watchFolderPathParameter = new StringParameter(gWatchFolder,
                                                                         "Watch Torrent Folder Path", "");
    watchFolderPathParameter.setLayoutData(gridData);

    Button browse4 = new Button(gWatchFolder, SWT.PUSH);
    browse4.setImage(imgOpenFolder);
    imgOpenFolder.setBackground(browse4.getBackground());
    browse4.setToolTipText(MessageText.getString("ConfigView.button.browse"));

    browse4.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
        dialog.setFilterPath(watchFolderPathParameter.getValue());
        dialog.setText(MessageText.getString("ConfigView.dialog.choosewatchtorrentfolderpath"));
        String path = dialog.open();
        if (path != null) {
          watchFolderPathParameter.setValue(path);
        }
      }
    });

    Label lWatchTorrentFolderInterval = new Label(gWatchFolder, SWT.NULL);
    Messages.setLanguageText(lWatchTorrentFolderInterval, "ConfigView.label.watchtorrentfolderinterval");
    String  min = " " + MessageText.getString("ConfigView.section.stats.minutes");
    String  hr  = " " + MessageText.getString("ConfigView.section.stats.hours");
   
    int  []  watchTorrentFolderIntervalValues =
      { 1, 2, 3, 4, 5, 10, 15, 30, 60, 2*60, 4*60, 6*60, 8*60, 12*60, 16*60, 20*60, 24*60 };
   
    final String watchTorrentFolderIntervalLabels[] = new String[watchTorrentFolderIntervalValues.length];

    for (int i = 0; i < watchTorrentFolderIntervalValues.length; i++) {
      int mins   = watchTorrentFolderIntervalValues[i];
      int hrs  = mins/60;
     
      watchTorrentFolderIntervalLabels[i] = " " + (hrs==0?(mins + min):(hrs + hr ));
    }
   
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    new IntListParameter(gWatchFolder, "Watch Torrent Folder Interval", 1,
                         watchTorrentFolderIntervalLabels,
                         watchTorrentFolderIntervalValues).setLayoutData(gridData);

    gridData = new GridData();
    gridData.horizontalSpan = 3;
    new BooleanParameter(gWatchFolder, "Start Watched Torrents Stopped",
                         "ConfigView.label.startwatchedtorrentsstopped").setLayoutData(gridData);

    controls = new Control[]{ gWatchFolder };
View Full Code Here


  }

  public Composite configSectionCreate(final Composite parent) {
    Label label;
    GridLayout layout;
    GridData gridData;
    Composite cMain = new Composite( parent,  SWT.NULL );
    cMain.setLayoutData( new GridData( GridData.FILL_BOTH ) );
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    cMain.setLayout( layout );
   
    label = new Label( cMain, SWT.NULL );
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    label.setLayoutData(gridData);
    Messages.setLanguageText( label, "MainWindow.menu.language" )//old name path, but already translated

    Locale[] locales = MessageText.getLocales(true);
   
    String[] drop_labels = new String[ locales.length ];
    String[] drop_values = new String[ locales.length ];
    int iUsingLocale = -1;
    for( int i=0; i < locales.length; i++ ) {
      Locale locale = locales[ i ];
      String sName = locale.getDisplayName(locale);
      String sName2 = locale.getDisplayName();
      if (!sName.equals(sName2)) {
        sName += " - " + sName2;
      }
      drop_labels[ i ] = sName + " - " + locale;
      drop_values[ i ] = locale.toString();
      if (MessageText.isCurrentLocale(locale))
        iUsingLocale = i;
    }
   
    StringListParameter locale_param = new StringListParameter(cMain, "locale",
        drop_labels, drop_values, false);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.minimumHeight = 50;
    locale_param.setLayoutData(gridData);
    // There may be no "locale" setting stored in config, so set it to
    // what we are using now.  Don't automatically write it to config, because
    // the user may switch languages (or a new language file may become avail
View Full Code Here

  }

  public void initialize(Composite parent) {
    cParent = parent;
    Label label;
    GridData gridData;
    final Display display = parent.getDisplay();

    if (cScrapeInfoView == null || cScrapeInfoView.isDisposed()) {
      cScrapeInfoView = new Composite(parent, SWT.NONE);
    }

    gridData = new GridData(GridData.FILL_BOTH);
    cScrapeInfoView.setLayoutData(gridData);

    GridLayout layoutInfo = new GridLayout();
    layoutInfo.numColumns = 4;
    cScrapeInfoView.setLayout(layoutInfo);

    label = new Label(cScrapeInfoView, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.trackerurl"); //$NON-NLS-1$
    label.setCursor(display.getSystemCursor(SWT.CURSOR_HAND));
    label.setForeground(Colors.blue);
    label.addMouseListener(new MouseAdapter() {
      public void mouseDoubleClick(MouseEvent arg0) {
        String announce = trackerUrlValue.getText();
        if (announce != null && announce.length() != 0) {
          new Clipboard(display).setContents(new Object[] {
            announce
          }, new Transfer[] {
            TextTransfer.getInstance()
          });
        }
      }

      public void mouseDown(MouseEvent arg0) {
        String announce = trackerUrlValue.getText();
        if (announce != null && announce.length() != 0) {
          new Clipboard(display).setContents(new Object[] {
            announce
          }, new Transfer[] {
            TextTransfer.getInstance()
          });
        }
      }
    });

    menuTracker = new Menu(parent.getShell(), SWT.POP_UP);
    itemSelect = new MenuItem(menuTracker, SWT.CASCADE);
    Messages.setLanguageText(itemSelect, "GeneralView.menu.selectTracker");
    MenuItem itemEdit = new MenuItem(menuTracker, SWT.NULL);
    Messages.setLanguageText(itemEdit, "MyTorrentsView.menu.editTracker");

    cScrapeInfoView.addDisposeListener(new DisposeListener() {
      public void widgetDisposed(DisposeEvent e) {
        menuTracker.dispose();
      }
    });

    itemEdit.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        final TOTorrent torrent = manager.getTorrent();

        if (torrent == null) {
          return;
        }

        List group = TorrentUtils.announceGroupsToList(torrent);

        new MultiTrackerEditor(null, group, new TrackerEditorListener() {
          public void trackersChanged(String str, String str2, List _group) {
            TorrentUtils.listToAnnounceGroups(_group, torrent);

            try {
              TorrentUtils.writeToFile(torrent);
            } catch (Throwable e2) {

              Debug.printStackTrace(e2);
            }

            TRTrackerAnnouncer tc = manager.getTrackerClient();

            if (tc != null) {

              tc.resetTrackerUrl(true);
            }
          }
        }, true);
      }
    });

    final Listener menuListener = new Listener() {
      public void handleEvent(Event e) {
        if (e.widget instanceof MenuItem) {

          String text = ((MenuItem) e.widget).getText();

          TOTorrent torrent = manager.getTorrent();

          TorrentUtils.announceGroupsSetFirst(torrent, text);

          try {
            TorrentUtils.writeToFile(torrent);

          } catch (TOTorrentException f) {

            Debug.printStackTrace(f);
          }

          TRTrackerAnnouncer tc = manager.getTrackerClient();

          if (tc != null) {

            tc.resetTrackerUrl(false);
          }
        }
      }
    };

    menuTracker.addListener(SWT.Show, new Listener() {
      public void handleEvent(Event e) {
        Menu menuSelect = itemSelect.getMenu();
        if (menuSelect != null && !menuSelect.isDisposed()) {
          menuSelect.dispose();
        }
        if (manager == null || cScrapeInfoView == null
            || cScrapeInfoView.isDisposed()) {
          return;
        }
        List groups = TorrentUtils.announceGroupsToList(manager.getTorrent());
        menuSelect = new Menu(cScrapeInfoView.getShell(), SWT.DROP_DOWN);
        itemSelect.setMenu(menuSelect);
        Iterator iterGroups = groups.iterator();
        while (iterGroups.hasNext()) {
          List trackers = (List) iterGroups.next();
          MenuItem menuItem = new MenuItem(menuSelect, SWT.CASCADE);
          Messages.setLanguageText(menuItem, "wizard.multitracker.group");
          Menu menu = new Menu(cScrapeInfoView.getShell(), SWT.DROP_DOWN);
          menuItem.setMenu(menu);
          Iterator iterTrackers = trackers.iterator();
          while (iterTrackers.hasNext()) {
            String url = (String) iterTrackers.next();
            MenuItem menuItemTracker = new MenuItem(menu, SWT.CASCADE);
            menuItemTracker.setText(url);
            menuItemTracker.addListener(SWT.Selection, menuListener);
          }
        }
      }
    });

    trackerUrlValue = new BufferedTruncatedLabel(cScrapeInfoView, SWT.LEFT, 70);

    trackerUrlValue.addMouseListener(new MouseAdapter() {
      public void mouseDown(MouseEvent event) {
        if (event.button == 3
            || (event.button == 1 && event.stateMask == SWT.CONTROL)) {
          menuTracker.setVisible(true);
        } else if (event.button == 1) {
          String url = trackerUrlValue.getText();
          if (url.startsWith("http://") || url.startsWith("https://")) {
            int pos = -1;
            if ((pos = url.indexOf("/announce")) != -1) {
              url = url.substring(0, pos + 1);
            }
            Utils.launch(url);
          }
        }
      }
    });

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    trackerUrlValue.setLayoutData(gridData);

    ////////////////////////

    label = new Label(cScrapeInfoView, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.tracker");
    tracker_status = new BufferedTruncatedLabel(cScrapeInfoView, SWT.LEFT, 150);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    tracker_status.setLayoutData(gridData);

    label = new Label(cScrapeInfoView, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.updatein");
    trackerUpdateIn = new BufferedLabel(cScrapeInfoView, SWT.LEFT);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
    trackerUpdateIn.setLayoutData(gridData);

    updateButton = new Button(cScrapeInfoView, SWT.PUSH);
    Messages.setLanguageText(updateButton, "GeneralView.label.trackerurlupdate");
    updateButton.setLayoutData(new GridData());
    updateButton.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        new AEThread2( "SIV:async" )
        {
          public void
View Full Code Here

    layout.numColumns = 2;
    shell.setLayout(layout);

    Label label = new Label(shell, SWT.NONE);
    if (sMessageID != null) label.setText(MessageText.keyExists(sMessageID)?MessageText.getString(sMessageID):sMessageID);
    GridData gridData = new GridDataGridData.FILL_HORIZONTAL );
    gridData.widthHint = 200;
    gridData.horizontalSpan = 2;
    label.setLayoutData(gridData);

    txtInfo = new Text(shell, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
    gridData = new GridDataGridData.FILL_BOTH );
    gridData.widthHint = 500;
    gridData.heightHint = 400;
    gridData.horizontalSpan = 2;
    txtInfo.setLayoutData(gridData);
    txtInfo.setText(sText);

    label = new Label(shell, SWT.NONE);
    gridData = new GridData( GridData.FILL_HORIZONTAL );
    label.setLayoutData(gridData);
   
    Button ok = new Button(shell, SWT.PUSH);
    ok.setText(MessageText.getString("Button.ok"));
    gridData = new GridData();
    gridData.widthHint = 70;
    ok.setLayoutData(gridData);
    shell.setDefaultButton(ok);
    ok.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
View Full Code Here

     * @return your configuration panel
     */

    public Composite configSectionCreate(final Composite parent) {

        GridData gridData;

        Composite cSection = new Composite(parent, SWT.NULL);
       
        if (!AzureusCoreFactory.isCoreRunning()) {
          cSection.setLayout(new FillLayout());
          Label lblNotAvail = new Label(cSection, SWT.WRAP);
          Messages.setLanguageText(lblNotAvail, "core.not.available");
          return cSection;
        }
       
        gridData = new GridData(GridData.VERTICAL_ALIGN_FILL|GridData.HORIZONTAL_ALIGN_FILL);
        cSection.setLayoutData(gridData);
        GridLayout subPanel = new GridLayout();
        subPanel.numColumns = 3;
        cSection.setLayout(subPanel);

        //V1, V2 ... drop down.

        //enable auto-speed beta
        ///////////////////////////////////
        // AutoSpeed Beta mode group
        ///////////////////////////////////
        //Beta-mode grouping.
        Group modeGroup = new Group(cSection, SWT.NULL);
        Messages.setLanguageText(modeGroup,"ConfigTransferAutoSpeed.algorithm.selector");
        GridLayout modeLayout = new GridLayout();
        modeLayout.numColumns = 3;
        modeGroup.setLayout(modeLayout);
       
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        modeGroup.setLayoutData(gridData);

        //Need a drop down to select which method will be used.
        Label label = new Label(modeGroup, SWT.NULL);
        Messages.setLanguageText(label,"ConfigTransferAutoSpeed.algorithm");
        gridData = new GridData();
        label.setLayoutData(gridData);

        String AutoSpeedClassic = MessageText.getString("ConfigTransferAutoSpeed.auto.speed.classic");
        String AutoSpeedBeta = MessageText.getString("ConfigTransferAutoSpeed.auto.speed.beta");
        String AutoSpeedNeural = MessageText.getString("ConfigTransferAutoSpeed.auto.speed.neural");
       
        String[] modeNames = {
                AutoSpeedClassic,
                AutoSpeedBeta,
                AutoSpeedNeural,
               };
       
        String[] modes = {
                "1",
                "2",
                "3",
        };

        //versionList = new StringListParameter(modeGroup,
        //        SpeedManagerImpl.CONFIG_VERSION_STR,
        //        "1",
        //        modeNames,modes,true);
        versionList = new StringListParameter(modeGroup,SpeedManagerImpl.CONFIG_VERSION_STR, modeNames, modes);
        long verNum = COConfigurationManager.getLongParameter( SpeedManagerImpl.CONFIG_VERSION );
        if( verNum==1 ){
            //SpeedManagerAlgorithmProviderV1
            versionList.setValue(modes[0]);
        }else if( verNum==2 ){
            //SpeedManagerAlgorithmProviderV2
            versionList.setValue(modes[1]);
        }else if( verNum==3 ){
            //SpeedManagerAlgorithmProviderV2
            versionList.setValue(modes[2]);
        }else{
            //Default is currently version ...V1.
            versionList.setValue(modes[0]);
            //ToDo: log this condition.
        }

        versionList.addChangeListener( new ConvertToLongChangeListener() );


        //spacer
        Label spacer = new Label(modeGroup, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan=3;
        spacer.setLayoutData(gridData);

        //To enable the beta.
        gridData = new GridData();
        gridData.horizontalIndent = 20;
        gridData.horizontalSpan = 2;
        enableAutoSpeed = new BooleanParameter(modeGroup,
                TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY,CFG_PREFIX+"enableauto");
        enableAutoSpeed.setLayoutData(gridData);

        //enableAutoSpeed.addChangeListener( new GroupModeChangeListener() );

        spacer = new Label(modeGroup, SWT.NULL);

        //AutoSpeed while seeding enabled.
        enableAutoSpeedWhileSeeding = new BooleanParameter(modeGroup,
                "Auto Upload Speed Seeding Enabled",CFG_PREFIX+"enableautoseeding");
        gridData = new GridData();
        gridData.horizontalIndent = 20;
        gridData.horizontalSpan = 2;
        enableAutoSpeedWhileSeeding.setLayoutData(gridData);

    enableAutoSpeed.setAdditionalActionPerformer(
          new ChangeSelectionActionPerformer( enableAutoSpeedWhileSeeding.getControls(), true ));      


        spacer = new Label(modeGroup, SWT.NULL);

        spacer = new Label(cSection, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan=3;
        spacer.setLayoutData(gridData);

          // NETWORK GROUP
       
        Group networkGroup = new Group(cSection, SWT.NULL);
        //networkGroup.addControlListener(new Utils.LabelWrapControlListener());

        Messages.setLanguageText(networkGroup,CFG_PREFIX+"networks");   
        GridLayout networksLayout = new GridLayout();
        networksLayout.numColumns = 5;
        networkGroup.setLayout(networksLayout);

        gridData = new GridData(GridData.FILL_HORIZONTAL);
        networkGroup.setLayoutData(gridData);

          // asn
       
        label = new Label(networkGroup, SWT.NULL);
        Messages.setLanguageText(label,"SpeedView.stats.asn");   
   
        final Label asn_label = new Label(networkGroup, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan = 4;
        gridData.grabExcessHorizontalSpace = true;
        asn_label.setLayoutData(gridData);

          // up cap
       
        label = new Label(networkGroup, SWT.NULL);
        Messages.setLanguageText(label,"SpeedView.stats.estupcap");   
        gridData = new GridData();
        gridData.horizontalIndent = 20;
        label.setLayoutData(gridData);

        final Label up_cap = new Label(networkGroup, SWT.NULL);
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 4;
        up_cap.setLayoutData(gridData);

          // down cap

        label = new Label(networkGroup, SWT.NULL);
        Messages.setLanguageText(label,"SpeedView.stats.estdowncap");   
        gridData = new GridData();
        gridData.horizontalIndent = 20;
        label.setLayoutData(gridData);
       
        final Label down_cap = new Label(networkGroup, SWT.NULL);
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 4;
        down_cap.setLayoutData(gridData);

        // Core avail: We check at top
        final SpeedManager sm = AzureusCoreFactory.getSingleton().getSpeedManager()
       
        final TransferStatsView.limitToTextHelper  limit_to_text = new TransferStatsView.limitToTextHelper();
       
        asn_label.setText( sm.getASN());
        up_cap.setText( limit_to_text.getLimitText( sm.getEstimatedUploadCapacityBytesPerSec()));
        down_cap.setText( limit_to_text.getLimitText( sm.getEstimatedDownloadCapacityBytesPerSec()));
      
          // space
       
       spacer = new Label(networkGroup, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan=5;
        spacer.setLayoutData(gridData);
       
          // info
       
      Label info_label = new Label(networkGroup, SWT.WRAP );
      Messages.setLanguageText(
          info_label, CFG_PREFIX + "network.info",
          new String[]{ DisplayFormatters.getRateUnit( DisplayFormatters.UNIT_KB )});
      info_label.setLayoutData(Utils.getWrappableLabelGridData(5, 0));
       
        // up set
     
      label = new Label(networkGroup, SWT.NULL);
      Messages.setLanguageText(label,"SpeedView.stats.estupcap");   
      gridData = new GridData();
      gridData.horizontalIndent = 20;
      label.setLayoutData(gridData);

        String co_up    = "AutoSpeed Network Upload Speed (temp)";
        String co_up_type   = "AutoSpeed Network Upload Speed Type (temp)";

        SpeedManagerLimitEstimate up_lim = sm.getEstimatedUploadCapacityBytesPerSec();
       
        COConfigurationManager.setParameter( co_up, up_lim.getBytesPerSec()/1024 );
    COConfigurationManager.setParameter( co_up_type, limit_to_text.getSettableType( up_lim ));
   
    final IntParameter max_upload = new IntParameter(networkGroup, co_up );
       
    final Label upload_bits = new Label(networkGroup, SWT.NULL);
      gridData = new GridData();
      upload_bits.setLayoutData(gridData);
      upload_bits.setText(getMBitLimit(limit_to_text,(up_lim.getBytesPerSec()/1024)*1024));
   
    final StringListParameter max_upload_type =
      new StringListParameter(networkGroup, co_up_type, limit_to_text.getSettableTypes(),limit_to_text.getSettableTypes() );
     
    max_upload_type.addChangeListener(
      new ParameterChangeAdapter()
      {
        public void
        parameterChanged(
          Parameter   p,
          boolean   caused_internally )
        {
          if ( max_upload_type.isDisposed()){
         
            return;
          }
         
          float type = limit_to_text.textToType( max_upload_type.getValue());
             
          SpeedManagerLimitEstimate existing = sm.getEstimatedUploadCapacityBytesPerSec();
         
          if ( existing.getEstimateType() != type ){
         
            sm.setEstimatedUploadCapacityBytesPerSec( existing.getBytesPerSec(), type );
          }
        }
      });
     
    max_upload.addChangeListener(
      new ParameterChangeAdapter()
      {
        public void
        parameterChanged(
          Parameter   p,
          boolean   caused_internally )
        {
          if ( max_upload.isDisposed()){
         
            return;
          }
                   
          int  value = max_upload.getValue() * 1024;
               
          SpeedManagerLimitEstimate existing = sm.getEstimatedUploadCapacityBytesPerSec();
         
          if ( existing.getBytesPerSec() != value ){
         
            sm.setEstimatedUploadCapacityBytesPerSec( value, existing.getEstimateType());
          }
        }
      });     
   
      label = new Label(networkGroup, SWT.NULL);

        // down set
     
      label = new Label(networkGroup, SWT.NULL);
      Messages.setLanguageText(label,"SpeedView.stats.estdowncap");   
      gridData = new GridData();
      gridData.horizontalIndent = 20;
      label.setLayoutData(gridData);

        SpeedManagerLimitEstimate down_lim = sm.getEstimatedDownloadCapacityBytesPerSec();

        String co_down      = "AutoSpeed Network Download Speed (temp)";
    String co_down_type   = "AutoSpeed Network Download Speed Type (temp)";
        COConfigurationManager.setParameter( co_down, down_lim.getBytesPerSec()/1024 );
        COConfigurationManager.setParameter( co_down_type, limit_to_text.getSettableType( down_lim ));

    final IntParameter max_download = new IntParameter(networkGroup, co_down );
     
    final Label download_bits = new Label(networkGroup, SWT.NULL);
      gridData = new GridData();
      download_bits.setLayoutData(gridData);
      download_bits.setText(getMBitLimit(limit_to_text,(down_lim.getBytesPerSec()/1024)*1024));
     
    final StringListParameter max_download_type =
      new StringListParameter(networkGroup, co_down_type, limit_to_text.getSettableTypes(),limit_to_text.getSettableTypes() );

    max_download_type.addChangeListener(
      new ParameterChangeAdapter()
      {
        public void
        parameterChanged(
          Parameter   p,
          boolean   caused_internally )
        {
          if ( max_download_type.isDisposed()){
         
            return;
          }
         
          float type = limit_to_text.textToType( max_download_type.getValue());
             
          SpeedManagerLimitEstimate existing = sm.getEstimatedDownloadCapacityBytesPerSec();
         
          if ( existing.getEstimateType() != type ){
         
            sm.setEstimatedDownloadCapacityBytesPerSec( existing.getBytesPerSec(), type );
          }
        }
      });
   
    max_download.addChangeListener(
      new ParameterChangeAdapter()
      {
        public void
        parameterChanged(
          Parameter   p,
          boolean   caused_internally )
        {
          if ( max_download.isDisposed()){
         
            return;
          }
                   
          int  value = max_download.getValue() * 1024;
               
          SpeedManagerLimitEstimate existing = sm.getEstimatedDownloadCapacityBytesPerSec();
         
          if ( existing.getBytesPerSec() != value ){
         
            sm.setEstimatedDownloadCapacityBytesPerSec( value, existing.getEstimateType());
          }
        }
      });
   
      label = new Label(networkGroup, SWT.NULL);

        // reset
     
      Label reset_label = new Label(networkGroup, SWT.NULL );
      Messages.setLanguageText(reset_label, CFG_PREFIX + "resetnetwork");

      Button reset_button = new Button(networkGroup, SWT.PUSH);

      Messages.setLanguageText(reset_button, CFG_PREFIX + "reset.button" );

      reset_button.addListener(SWT.Selection,
        new Listener()
      {
            public void
        handleEvent(Event event)
            {
              sm.reset();
            }
        });
       
     sm.addListener(
             new SpeedManagerListener()
             {
               private final SpeedManagerListener  listener = this;
              
               public void
               propertyChanged(
                 final int property
               {
                 Utils.execSWTThread(
                   new Runnable()
                   {
                     public void
                     run()
                     {
                       if ( asn_label.isDisposed()){
                        
                         sm.removeListener( listener );
                        
                       }else{
                        
                         if ( property == SpeedManagerListener.PR_ASN ){
                          
                           asn_label.setText( sm.getASN());
                          
                          }else if ( property == SpeedManagerListener.PR_UP_CAPACITY ){
                            
                            SpeedManagerLimitEstimate limit = sm.getEstimatedUploadCapacityBytesPerSec();
                           
                           up_cap.setText( limit_to_text.getLimitText( limit ));
                            
                           upload_bits.setText(getMBitLimit(limit_to_text, limit.getBytesPerSec()));
                          
                           max_upload.setValue( limit.getBytesPerSec()/1024 );
                          
                           max_upload_type.setValue( limit_to_text.getSettableType( limit ));
                          
                          }else if ( property == SpeedManagerListener.PR_DOWN_CAPACITY ){
                        
                            SpeedManagerLimitEstimate limit = sm.getEstimatedDownloadCapacityBytesPerSec();

                         down_cap.setText( limit_to_text.getLimitText( limit ));
                        
                         download_bits.setText(getMBitLimit(limit_to_text, limit.getBytesPerSec()));
                          
                           max_download.setValue( limit.getBytesPerSec()/1024 );
                          
                           max_download_type.setValue( limit_to_text.getSettableType( limit ));
              
                         }
                       }
                     }
                   });
               }
             });
            
        //Add listeners to disable setting when needed.
               

        //spacer
      
     spacer = new Label(cSection, SWT.NULL);
     gridData = new GridData();
     gridData.horizontalSpan=3;
     spacer.setLayoutData(gridData);
      
    BooleanParameter debug_au = new BooleanParameter(
        cSection, "Auto Upload Speed Debug Enabled",
        CFG_PREFIX + "enabledebug" );
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    debug_au.setLayoutData(gridData)
   
        //spacer
       
        spacer = new Label(cSection, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan=3;
        spacer.setLayoutData(gridData);

        /////////////////////////////////////////
        //Add group to link to Azureus Wiki page.
        /////////////////////////////////////////
        Group azWiki = new Group(cSection, SWT.WRAP);
        gridData = new GridData();
        azWiki.setLayoutData(gridData);
        GridLayout layout = new GridLayout();
        layout.numColumns = 1;
        layout.marginHeight = 1;
        layout.marginWidth = 20;
        azWiki.setLayout(layout);

        azWiki.setText(MessageText.getString("Utils.link.visit"));

        final Label linkLabel = new Label(azWiki, SWT.NULL);
        linkLabel.setText( Constants.APP_NAME + " Wiki AutoSpeed (beta)" );
        linkLabel.setData("http://wiki.vuze.com/w/Auto_Speed");
        linkLabel.setCursor(linkLabel.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
        linkLabel.setForeground(Colors.blue);
        gridData = new GridData();
        linkLabel.setLayoutData( gridData );
      linkLabel.addMouseListener(new MouseAdapter() {
        public void mouseDoubleClick(MouseEvent arg0) {
          Utils.launch((String) ((Label) arg0.widget).getData());
        }
View Full Code Here

    Utils.setShellIcon(shell);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    shell.setLayout(layout);
   
    GridData gridData;
   
    if ( !anonymous ){
     
      Label labelName = new Label(shell,SWT.NULL);
      Messages.setLanguageText(labelName,"wizard.multitracker.edit.name");
     
      textName = new Text(shell,SWT.BORDER);
      textName.setText(currentName);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 2;
      textName.setLayoutData(gridData);
      textName.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent arg0) {
          currentName = textName.getText();
          computeSaveEnable();
        }
      });  
    }
       
    treeGroups = new Tree(shell,SWT.BORDER);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 3;
    gridData.heightHint = 150;
    treeGroups.setLayoutData(gridData);
   
    treeGroups.addMouseListener(
        new MouseAdapter()
        {
          public void
          mouseDoubleClick(
            MouseEvent arg0 )
          {
            if(treeGroups.getSelectionCount() == 1) {
              TreeItem treeItem = treeGroups.getSelection()[0];
              String type = (String) treeItem.getData("type");
              if(type.equals("tracker")) {
                editTreeItem(treeItem);
              }
            }
          }
        });
       
    Label labelSeparator = new Label(shell,SWT.SEPARATOR | SWT.HORIZONTAL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    labelSeparator.setLayoutData(gridData);
   
      // button row
   
    Composite cButtons = new Composite(shell, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    cButtons.setLayoutData(gridData);
    GridLayout layoutButtons = new GridLayout();
    layoutButtons.numColumns = 3;
    cButtons.setLayout(layoutButtons);
    Label label = new Label(cButtons,SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL );
    label.setLayoutData(gridData);
   
    btnSave = new Button(cButtons,SWT.PUSH);
    gridData = new GridData();
    gridData.widthHint = 70;
    gridData.horizontalAlignment = GridData.END;
    btnSave.setLayoutData(gridData);
    Messages.setLanguageText(btnSave,"wizard.multitracker.edit.save");
    btnSave.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        update();
        shell.dispose();
      }
    });
   
    btnCancel = new Button(cButtons,SWT.PUSH);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.END;
    gridData.widthHint = 70;
    btnCancel.setLayoutData(gridData);
    Messages.setLanguageText(btnCancel,"Button.cancel");
    btnCancel.addListener(SWT.Selection, new Listener() {
View Full Code Here

    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    shell.setLayout(layout);

    Composite panel = new Composite(shell, SWT.NULL);
    GridData gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
    panel.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 3;
    panel.setLayout(layout);

    Label label = new Label(panel, SWT.WRAP);
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    gridData.widthHint = 400;
    label.setLayoutData(gridData);
    Messages.setLanguageText(label, "configureWizard.nat.message");

    label = new Label(panel, SWT.NULL);
    label = new Label(panel, SWT.NULL);
    label = new Label(panel, SWT.NULL);
    label = new Label(panel, SWT.NULL);
   
      // TCP
   
    Messages.setLanguageText(label, "configureWizard.nat.server.tcp_listen_port");

    final Text textServerTCPListen = new Text(panel, SWT.BORDER);
    gridData = new GridData();   
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = SWT.FILL;
    textServerTCPListen.setLayoutData(gridData);
    textServerTCPListen.setText("" + serverTCPListenPort);
    textServerTCPListen.addListener(SWT.Verify, new Listener() {
      public void handleEvent(Event e) {
        String text = e.text;
        char[] chars = new char[text.length()];
        text.getChars(0, chars.length, chars, 0);
        for (int i = 0; i < chars.length; i++) {
          if (!('0' <= chars[i] && chars[i] <= '9')) {
            e.doit = false;
            return;
          }
        }
      }
    });
   
    textServerTCPListen.addListener(SWT.Modify, new Listener() {
      public void handleEvent(Event e) {
        final int TCPListenPort = Integer.parseInt(textServerTCPListen.getText());
        serverTCPListenPort = TCPListenPort;
      }
    });

    bTestTCP = new Button(panel, SWT.PUSH);
    Messages.setLanguageText(bTestTCP, "configureWizard.nat.test");
    gridData = new GridData();
    gridData.widthHint = 70;
    bTestTCP.setLayoutData(gridData);

    label = new Label(panel, SWT.NULL);

      // UDP
   
    Messages.setLanguageText(label, "configureWizard.nat.server.udp_listen_port");

    final Text textServerUDPListen = new Text(panel, SWT.BORDER);
    gridData = new GridData();   
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = SWT.FILL;
    textServerUDPListen.setLayoutData(gridData);
    textServerUDPListen.setText("" + serverUDPListenPort);
    textServerUDPListen.addListener(SWT.Verify, new Listener() {
      public void handleEvent(Event e) {
        String text = e.text;
        char[] chars = new char[text.length()];
        text.getChars(0, chars.length, chars, 0);
        for (int i = 0; i < chars.length; i++) {
          if (!('0' <= chars[i] && chars[i] <= '9')) {
            e.doit = false;
            return;
          }
        }
      }
    });
   
    textServerUDPListen.addListener(SWT.Modify, new Listener() {
      public void handleEvent(Event e) {
        final int UDPListenPort = Integer.parseInt(textServerUDPListen.getText());
        serverUDPListenPort =UDPListenPort;
      }
    });

    bTestUDP = new Button(panel, SWT.PUSH);
    Messages.setLanguageText(bTestUDP, "configureWizard.nat.test");
    gridData = new GridData();
    gridData.widthHint = 70;
    bTestUDP.setLayoutData(gridData);
   
      // results
   
    textResults = new StyledText(panel, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.WRAP );
    gridData = new GridData();
    gridData.widthHint = 400;
    gridData.heightHint = 100;
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = SWT.FILL;
    gridData.horizontalSpan = 3;
    textResults.setLayoutData(gridData);
    textResults.setBackground(panel.getDisplay().getSystemColor(SWT.COLOR_WHITE));

    bTestTCP.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        bTestUDP.setEnabled(false);
      bTestTCP.setEnabled(false);
      bApply.setEnabled(false);
        textResults.setText("");

        CoreWaiterSWT.waitForCore(TriggerInThread.ANY_THREAD,
            new AzureusCoreRunningListener() {
              public void azureusCoreRunning(AzureusCore core) {
                CheckerTCP checker = new CheckerTCP(serverTCPListenPort);
                checker.start();
          }
        });
      }
    });
       
     
    bTestUDP.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
          bTestUDP.setEnabled(false);
          bTestTCP.setEnabled(false);
          bApply.setEnabled(false);
          textResults.setText("");

          CoreWaiterSWT.waitForCore(TriggerInThread.ANY_THREAD,
              new AzureusCoreRunningListener() {
                public void azureusCoreRunning(AzureusCore core) {
                  CheckerUDP checker = new CheckerUDP(core,serverUDPListenPort);
                  checker.start();
            }
          });
        }
      });
   
    bApply = new Button(panel,SWT.PUSH);
    bApply.setText(MessageText.getString("Button.apply"));
    gridData = new GridData();
    gridData.widthHint = 70;
    gridData.grabExcessHorizontalSpace = true;
    gridData.horizontalAlignment = SWT.RIGHT;
    gridData.horizontalSpan = 2;
    bApply.setLayoutData(gridData);
   
   
    bApply.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
       int  old_tcp   = COConfigurationManager.getIntParameter( "TCP.Listen.Port" );
       int  old_udp   = COConfigurationManager.getIntParameter( "UDP.Listen.Port" );
       int  old_udp2   = COConfigurationManager.getIntParameter( "UDP.NonData.Listen.Port" );
     
       if ( old_tcp != serverTCPListenPort ){
         COConfigurationManager.setParameter("TCP.Listen.Port",serverTCPListenPort);
       }
       
        if ( old_udp != serverUDPListenPort ){
          COConfigurationManager.setParameter("UDP.Listen.Port",serverUDPListenPort);
    
          if ( old_udp == old_udp2 ){
            COConfigurationManager.setParameter("UDP.NonData.Listen.Port",serverUDPListenPort);
          }
        }
       
        COConfigurationManager.save();
       
        shell.close();
      }
    });
   
    bCancel = new Button(panel,SWT.PUSH);
    bCancel.setText(MessageText.getString("Button.cancel"));
    gridData = new GridData();
    gridData.widthHint = 70;
    bCancel.setLayoutData(gridData);
    bCancel.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        shell.close();
View Full Code Here

        wizard.setErrorMessage(error);
        wizard.setNextEnabled(!((NewTorrentWizard) wizard).directoryPath.equals("") && error.equals(""));
      }
    });
    file.setText(((NewTorrentWizard) wizard).directoryPath);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    file.setLayoutData(gridData);
    Button browse = new Button(panel, SWT.PUSH);
    browse.addListener(SWT.Selection, new Listener() {
      /*
       * (non-Javadoc)
       *
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event arg0) {
        DirectoryDialog fd = new DirectoryDialog(wizard.getWizardWindow());
        if (wizard.getErrorMessage().equals("") && !((NewTorrentWizard) wizard).directoryPath.equals("")) {
          fd.setFilterPath(((NewTorrentWizard) wizard).directoryPath);
        }else{
          String  def = ((NewTorrentWizard) wizard).getDefaultOpenDir();
         
          if ( def.length() > 0 ){
           
            fd.setFilterPath( def );
          }
        }
        String f = fd.open();
        if (f != null){
          file.setText(f);
         
          File  ff = new File(f);
         
          String  parent = ff.getParent();
         
          if ( parent != null ){
           
            ((NewTorrentWizard) wizard).setDefaultOpenDir( parent );
          }
        }
      }
    });
    Messages.setLanguageText(browse, "wizard.browse");

    label = new Label(panel, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);
    label.setText("\n");

    label = new Label(panel, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);
    label.setForeground(Colors.blue);
    Messages.setLanguageText(label, "wizard.hint.directory");
  }
View Full Code Here

  GridLayout layout = new GridLayout();
  layout.numColumns = 1;
  rootPanel.setLayout(layout);

  Composite panel = new Composite(rootPanel, SWT.NULL);
  GridData gridData = new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
  panel.setLayoutData(gridData);
  layout = new GridLayout();
  layout.numColumns = 1;
  panel.setLayout(layout);

  Button bListMode = new Button(panel,SWT.RADIO);
  Messages.setLanguageText(bListMode,"installPluginsWizard.mode.list");
  bListMode.setData("mode",new Integer(MODE_FROM_LIST));
  if(((InstallPluginWizard)wizard).mode == MODE_FROM_LIST) bListMode.setSelection(true);
   
  Button bFileMode = new Button(panel,SWT.RADIO);
  Messages.setLanguageText(bFileMode,"installPluginsWizard.mode.file");
  bFileMode.setData("mode",new Integer(MODE_FROM_FILE));
  if(((InstallPluginWizard)wizard).mode == MODE_FROM_FILE) bFileMode.setSelection(true);
 
  Listener modeListener = new Listener() {
    public void handleEvent(Event e) {
      mode = ((Integer) e.widget.getData("mode")).intValue();
      ((InstallPluginWizard)wizard).mode = mode;
    }
  };

  bListMode.addListener(SWT.Selection,modeListener);
  bFileMode.addListener(SWT.Selection,modeListener);
 
  if(userMode < 2){
      Group cWiki = new Group(panel, SWT.WRAP);
      cWiki.setText(MessageText.getString("installPluginsWizard.installMode.info.title"));
      gridData = new GridData( GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
      gridData.verticalIndent = 15;
      cWiki.setLayoutData(gridData);
      layout = new GridLayout();
      layout.numColumns = 4;
      layout.marginHeight = 0;
      cWiki.setLayout(layout);
     
      gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
      gridData.horizontalIndent = 10;
      gridData.horizontalSpan = 4;
      Label label = new Label(cWiki, SWT.WRAP);
      label.setLayoutData( gridData );
      label.setText(MessageText.getString("installPluginsWizard.installMode.info.text"));
View Full Code Here

    return 2;
  }


  public Composite configSectionCreate(final Composite parent) {
    GridData gridData;

    Composite cSection = new Composite(parent, SWT.NULL);

    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    cSection.setLayoutData(gridData);
    GridLayout advanced_layout = new GridLayout();
    advanced_layout.numColumns = 2;
    cSection.setLayout(advanced_layout);

    int userMode = COConfigurationManager.getIntParameter("User Mode");

   
    Label linfo = new Label(cSection, SWT.WRAP);
    Messages.setLanguageText( linfo, CFG_PREFIX + "info" );
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    linfo.setLayoutData(gridData);
   
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    new LinkLabel(cSection, gridData, "ConfigView.label.please.visit.here",
        "http://wiki.vuze.com/w/Auto_Speed");

   
    String[]  units = { DisplayFormatters.getRateUnit( DisplayFormatters.UNIT_KB )};

      // min up
   
    Label llmux = new Label(cSection, SWT.NULL);
    Messages.setLanguageText( llmux, CFG_PREFIX + "minupload", units );
    IntParameter min_upload = new IntParameter(cSection,
        "AutoSpeed Min Upload KBs");
    gridData = new GridData();
    min_upload.setLayoutData(gridData);
   
      // max up
   
    Label llmdx = new Label(cSection, SWT.NULL);
    Messages.setLanguageText( llmdx, CFG_PREFIX + "maxupload", units );
    IntParameter max_upload = new IntParameter(cSection,
        "AutoSpeed Max Upload KBs");
    gridData = new GridData();
    max_upload.setLayoutData(gridData);

       
        if ( userMode > 0 ){
     
      BooleanParameter enable_down_adj = new BooleanParameter(
          cSection, "AutoSpeed Download Adj Enable",
          CFG_PREFIX + "enabledownadj" );
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      enable_down_adj.setLayoutData(gridData);

     
      Label label = new Label(cSection, SWT.NULL);
      Messages.setLanguageText( label, CFG_PREFIX + "downadjratio" );
     
      FloatParameter down_adj = new FloatParameter( cSection, "AutoSpeed Download Adj Ratio", 0, Float.MAX_VALUE, false, );
      gridData = new GridData();
      down_adj.setLayoutData(gridData);
     

      enable_down_adj.setAdditionalActionPerformer(
            new ChangeSelectionActionPerformer( new Control[]{ down_adj.getControl()}));
    }
   
    if ( userMode > 1 ){
     
        // max inc
     
      Label label = new Label(cSection, SWT.NULL);
      Messages.setLanguageText( label, CFG_PREFIX + "maxinc", units );
     
      final IntParameter max_increase = new IntParameter(cSection,
          "AutoSpeed Max Increment KBs");
      gridData = new GridData();
      max_increase.setLayoutData(gridData);
     
        // max dec
     
      label = new Label(cSection, SWT.NULL);
      Messages.setLanguageText( label, CFG_PREFIX + "maxdec", units );
     
      final IntParameter max_decrease = new IntParameter(cSection,
          "AutoSpeed Max Decrement KBs");
      gridData = new GridData();
      max_decrease.setLayoutData(gridData);
     

        // choking ping
     
      label = new Label(cSection, SWT.NULL);
      Messages.setLanguageText( label, CFG_PREFIX + "chokeping" );

      final IntParameter choke_ping = new IntParameter(cSection,
          "AutoSpeed Choking Ping Millis");
      gridData = new GridData();
      choke_ping.setLayoutData(gridData);
     
        // forced min
     
      label = new Label(cSection, SWT.NULL);
      Messages.setLanguageText( label, CFG_PREFIX + "forcemin", units );
     
      final IntParameter forced_min = new IntParameter(cSection,
          "AutoSpeed Forced Min KBs");
      gridData = new GridData();
      forced_min.setLayoutData(gridData);

        // latency
     
      label = new Label(cSection, SWT.NULL);
      Messages.setLanguageText( label, CFG_PREFIX + "latencyfactor" );

      final IntParameter latency_factor = new IntParameter(cSection,
          "AutoSpeed Latency Factor", 1, Integer.MAX_VALUE);
      gridData = new GridData();
      latency_factor.setLayoutData(gridData);

        Label reset_label = new Label(cSection, SWT.NULL );
        Messages.setLanguageText(reset_label, CFG_PREFIX + "reset");
View Full Code Here

TOP

Related Classes of org.eclipse.swt.layout.GridData

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.