Examples of GridLayout


Examples of org.eclipse.swt.layout.GridLayout

      shell = ShellFactory.createMainShell(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
     
      Utils.setShellIcon(shell);
      Messages.setLanguageText(shell, "security.certcreate.title");
     
      GridLayout layout = new GridLayout();
      layout.numColumns = 3;
     
      shell.setLayout (layout);
     
      GridData gridData;
     
      // info
     
      Label info_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(info_label, "security.certcreate.intro");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 3;
      info_label.setLayoutData(gridData);
     
      // alias
     
      Label alias_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(alias_label, "security.certcreate.alias");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 1;
      alias_label.setLayoutData(gridData);
     
      final Text alias_field =new Text(shell,SWT.BORDER);
     
      alias_field.setText( SESecurityManager.DEFAULT_ALIAS );
     
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 2;
      alias_field.setLayoutData(gridData);
     
      // strength
     
      Label strength_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(strength_label, "security.certcreate.strength");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 1;
      strength_label.setLayoutData(gridData);
     
      final Combo strength_combo = new Combo(shell, SWT.SINGLE | SWT.READ_ONLY);
        
      final int[] strengths = { 512, 1024, 1536, 2048 };
                    
      for (int i=0;i<strengths.length;i++){
       
        strength_combo.add(""+strengths[i]);
      }
           
      strength_combo.select(1);
     
      new Label(shell,SWT.NULL);
           
      // first + last name
     
      String[]  field_names = {
                  "security.certcreate.firstlastname",
                  "security.certcreate.orgunit",
                  "security.certcreate.org",
                  "security.certcreate.city",
                  "security.certcreate.state",
                  "security.certcreate.country"
                };
     
      final String[]    field_rns = {"CN", "OU", "O", "L", "ST", "C" };
     
      final Text[]    fields = new Text[field_names.length];
     
      for (int i=0;i<fields.length;i++){
       
        Label resource_label = new Label(shell,SWT.NULL);
        Messages.setLanguageText(resource_label, field_names[i]);
        gridData = new GridData(GridData.FILL_BOTH);
        gridData.horizontalSpan = 1;
        resource_label.setLayoutData(gridData);
       
        Text field = fields[i] = new Text(shell,SWT.BORDER);
        gridData = new GridData(GridData.FILL_BOTH);
        gridData.horizontalSpan = 2;
        field.setLayoutData(gridData);
      }

        // line
     
      Label labelSeparator = new Label(shell,SWT.SEPARATOR | SWT.HORIZONTAL);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 3;
      labelSeparator.setLayoutData(gridData);
     
        // buttons
     
      new Label(shell,SWT.NULL);
     
      Composite comp = new Composite(shell,SWT.NULL);
      gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.HORIZONTAL_ALIGN_FILL);
      gridData.grabExcessHorizontalSpace = true;
      gridData.horizontalSpan = 2;
      comp.setLayoutData(gridData);
      GridLayout layoutButtons = new GridLayout();
      layoutButtons.numColumns = 2;
      comp.setLayout(layoutButtons);
     
     
     
View Full Code Here

Examples of org.eclipse.swt.layout.GridLayout

    shellForChildren = shell;

    shell.setText(MessageText.getString("OpenTorrentWindow.title"));
    Utils.setShellIcon(shell);

    GridLayout layout = FixupLayout(new GridLayout(), false);
    shell.setLayout(layout);
    shell.addListener(SWT.Resize, new Listener() {
      public void handleEvent(Event e) {
        resizeTables(3);
      }
    });

    Clipboard clipboard = new Clipboard(shell.getDisplay());

    String sClipText = (String) clipboard.getContents(TextTransfer.getInstance());
    if (sClipText != null)
      bTorrentInClipboard = addTorrentsFromTextList(sClipText, true) > 0;

    //    label = new Label(shell, SWT.BORDER | SWT.WRAP);
    //    Messages.setLanguageText(label, "OpenTorrentWindow.message");
    //    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    //    label.setLayoutData(gridData);

    // Torrents
    // ========

    Composite cButtons = new Composite(shell, SWT.NONE);
    RowLayout rLayout = new RowLayout(SWT.HORIZONTAL);
    rLayout.marginBottom = 0;
    rLayout.marginLeft = 0;
    rLayout.marginRight = 0;
    rLayout.marginTop = 0;
    cButtons.setLayout(rLayout);

    // Buttons for tableTorrents

    Button browseTorrent = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(browseTorrent, "OpenTorrentWindow.addFiles");
    browseTorrent.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        FileDialog fDialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
        fDialog.setFilterExtensions(new String[] {
          "*.torrent",
          "*.tor",
          Constants.FILE_WILDCARD
        });
        fDialog.setFilterNames(new String[] {
          "*.torrent",
          "*.tor",
          Constants.FILE_WILDCARD
        });
        fDialog.setFilterPath(TorrentOpener.getFilterPathTorrent());
        fDialog.setText(MessageText.getString("MainWindow.dialog.choose.file"));
        String fileName = TorrentOpener.setFilterPathTorrent(fDialog.open());
        if (fileName != null) {
          addTorrents(fDialog.getFilterPath(), fDialog.getFileNames());
        }
      }
    });

    Utils.setGridData(cButtons, GridData.FILL_HORIZONTAL, browseTorrent,
        MIN_BUTTON_HEIGHT);

    Button browseURL = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(browseURL, "OpenTorrentWindow.addFiles.URL");
    browseURL.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        browseURL();
      }
    });

    Button browseFolder = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(browseFolder, "OpenTorrentWindow.addFiles.Folder");
    browseFolder.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        DirectoryDialog fDialog = new DirectoryDialog(shell, SWT.NULL);
        fDialog.setFilterPath(TorrentOpener.getFilterPathTorrent());
        fDialog.setMessage(MessageText.getString("MainWindow.dialog.choose.folder"));
        String path = TorrentOpener.setFilterPathTorrent(fDialog.open());
        if (path != null) {
          addTorrents(path, null);
        }
      }
    });

    if (bTorrentInClipboard) {
      Button pasteOpen = new Button(cButtons, SWT.PUSH);
      Messages.setLanguageText(pasteOpen,
          "OpenTorrentWindow.addFiles.Clipboard");
      pasteOpen.setToolTipText(sClipText);
      pasteOpen.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
          Clipboard clipboard = new Clipboard(shell.getDisplay());

          String sClipText = (String) clipboard.getContents(TextTransfer.getInstance());
          if (sClipText != null) {
            addTorrentsFromTextList(sClipText.trim(), false);
          }
        }
      });
    }

    Group gTorrentsArea = new Group(shell, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gTorrentsArea.setLayoutData(gridData);
    layout = FixupLayout(new GridLayout(), true);
    gTorrentsArea.setLayout(layout);
    Messages.setLanguageText(gTorrentsArea, "OpenTorrentWindow.torrentLocation");

    Composite cTorrentList = new Composite(gTorrentsArea, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cTorrentList.setLayoutData(gridData);

    createTorrentListArea(cTorrentList);

    Composite cTorrentOptions = new Composite(gTorrentsArea, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cTorrentOptions.setLayoutData(gridData);
    layout = FixupLayout(new GridLayout(), true);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    cTorrentOptions.setLayout(layout);

    label = new Label(cTorrentOptions, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    label.setLayoutData(gridData);
    Messages.setLanguageText(label, "OpenTorrentWindow.torrent.options");

    int userMode = COConfigurationManager.getIntParameter("User Mode");
    if (userMode > 0) {
      Composite cTorrentModes = new Composite(cTorrentOptions, SWT.NONE);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      cTorrentModes.setLayoutData(gridData);
      layout = new GridLayout();
      layout.numColumns = 4;
      layout.marginWidth = 0;
      layout.marginHeight = 0;
      cTorrentModes.setLayout(layout);

      label = new Label(cTorrentModes, SWT.NONE);
      gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "OpenTorrentWindow.startMode");

      cmbStartMode = new Combo(cTorrentModes, SWT.BORDER | SWT.READ_ONLY);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      cmbStartMode.setLayoutData(gridData);
      updateStartModeCombo();
      cmbStartMode.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
          setSelectedStartMode(cmbStartMode.getSelectionIndex());
        }
      });

      label = new Label(cTorrentModes, SWT.NONE);
      gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "OpenTorrentWindow.addPosition");

      cmbQueueLocation = new Combo(cTorrentModes, SWT.BORDER | SWT.READ_ONLY);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      cmbQueueLocation.setLayoutData(gridData);
      updateQueueLocationCombo();
      cmbQueueLocation.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
          setSelectedQueueLocation(cmbQueueLocation.getSelectionIndex());
        }
      });
    }

    // Save To..
    // =========

    cSaveTo = new Composite(cTorrentOptions, SWT.NONE);
    layout = FixupLayout(new GridLayout(), false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 0;
    layout.numColumns = 2;
    cSaveTo.setLayout(layout);

    Label lblDataDir = new Label(cSaveTo, SWT.NONE);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 2;
    lblDataDir.setLayoutData(gridData);
    Messages.setLanguageText(lblDataDir, "OpenTorrentWindow.dataLocation");

    cmbDataDir = new Combo(cSaveTo, SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cmbDataDir.setLayoutData(gridData);

    cmbDataDir.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
        cmbDataDirChanged();
      }
    });
    cmbDataDir.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        cmbDataDirChanged();
      }
    });

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

    Button browseData = new Button(cSaveTo, SWT.PUSH);
    Messages.setLanguageText(browseData, "ConfigView.button.browse");

    browseData.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        String sSavePath;
        String sDefPath = cmbDataDir.getText();

        File f = new File(sDefPath);
        if (sDefPath.length() > 0) {
          while (!f.exists()) {
            f = f.getParentFile();
            if (f == null) {
              f = new File(sDefPath);
              break;
            }
          }
        }

        DirectoryDialog dDialog = new DirectoryDialog(shell, SWT.SYSTEM_MODAL);
        dDialog.setFilterPath(f.getAbsolutePath());
        dDialog.setMessage(MessageText.getString("MainWindow.dialog.choose.savepath_forallfiles"));
        sSavePath = dDialog.open();

        if (sSavePath != null) {
          cmbDataDir.setText(sSavePath);
        }
      }
    });

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

    // File List
    // =========

    Group gFilesArea = new Group(shell, SWT.NONE);
    gridData = new GridData(GridData.FILL_BOTH);
    gFilesArea.setLayoutData(gridData);
    layout = FixupLayout(new GridLayout(), true);
    gFilesArea.setLayout(layout);
    Messages.setLanguageText(gFilesArea, "OpenTorrentWindow.fileList");

    createTableDataFiles(gFilesArea);

    // Ok, cancel

    cArea = new Composite(shell, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.numColumns = 2;
    cArea.setLayout(layout);

    ok = new Button(cArea, SWT.PUSH);
View Full Code Here

Examples of org.eclipse.swt.layout.GridLayout

  private void createTorrentListArea(Composite cArea) {
    GridData gridData;
    TableColumn tc;

    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    cArea.setLayout(layout);
View Full Code Here

Examples of org.eclipse.swt.layout.GridLayout

        changeFileDestination(indexes);
      }
    });

    Composite cBottomArea = new Composite(cArea, SWT.NONE);
    GridLayout gLayout = new GridLayout();
    gLayout.marginHeight = 0;
    gLayout.marginWidth = 0;
    gLayout.numColumns = 2;
    gLayout.verticalSpacing = 0;
    cBottomArea.setLayout(gLayout);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cBottomArea.setLayoutData(gridData);

    Composite cButtons = new Composite(cBottomArea, SWT.NONE);
    RowLayout rLayout = new RowLayout(SWT.HORIZONTAL);
    rLayout.wrap = false;
    rLayout.marginBottom = 0;
    rLayout.marginLeft = 0;
    rLayout.marginRight = 0;
    rLayout.marginTop = 0;
    cButtons.setLayout(rLayout);
    gridData = new GridData(SWT.END, SWT.BEGINNING, false, false);
    gridData.verticalSpan = 2;
    cButtons.setLayoutData(gridData);

    Button btnSelectAll = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(btnSelectAll, "Button.selectAll");
    btnSelectAll.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        dataFileTable.selectAll();
      }
    });

    Button btnMarkSelected = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(btnMarkSelected, "Button.markSelected");
    btnMarkSelected.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        int[] indexes = dataFileTable.getSelectionIndices();
        for (int i = 0; i < indexes.length; i++) {
          TorrentFileInfo file = (TorrentFileInfo) dataFiles.get(indexes[i]);
          file.bDownload = true;
        }
        dataFileTable.clearAll();
        updateSize();
      }
    });

    Button btnUnmarkSelected = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(btnUnmarkSelected, "Button.unmarkSelected");
    btnUnmarkSelected.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        int[] indexes = dataFileTable.getSelectionIndices();
        for (int i = 0; i < indexes.length; i++) {
          TorrentFileInfo file = (TorrentFileInfo) dataFiles.get(indexes[i]);
          if (file.okToDisable())
            file.bDownload = false;
        }
        dataFileTable.clearAll();
        updateSize();
      }
    });

    dataFileTableLabel = new Label(cBottomArea, SWT.WRAP);
    dataFileTableLabel.setAlignment(SWT.RIGHT);
    gridData = new GridData(SWT.END, SWT.BEGINNING, true, false);
    dataFileTableLabel.setLayoutData(gridData);

    diskspaceComp = new Composite(cBottomArea, SWT.NONE);
    gLayout = new GridLayout(2, false);
    gLayout.marginHeight = gLayout.marginWidth = 1;
    gLayout.verticalSpacing = 0;
    gLayout.horizontalSpacing = 15;
    diskspaceComp.setLayout(gLayout);
    gridData = new GridData(SWT.END, SWT.BEGINNING, true, false);
View Full Code Here

Examples of org.eclipse.swt.layout.GridLayout

  public void
  show()
  {
    wizard.setTitle(MessageText.getString("exportTorrentWizard.exportfile.title"));
    Composite rootPanel = wizard.getPanel();
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    rootPanel.setLayout(layout);
 
    Composite panel = new Composite(rootPanel, 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();
View Full Code Here

Examples of org.eclipse.swt.layout.GridLayout

  public void configSectionDelete() {
  }

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

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

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

    int userMode = COConfigurationManager.getIntParameter("User Mode");
    if (userMode < REQUIRED_MODE) {
      Label label = new Label(cSection, SWT.WRAP);
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      label.setLayoutData(gridData);

      final String[] modeKeys = { "ConfigView.section.mode.beginner",
          "ConfigView.section.mode.intermediate",
          "ConfigView.section.mode.advanced" };

      String param1, param2;
      if (REQUIRED_MODE < modeKeys.length)
        param1 = MessageText.getString(modeKeys[REQUIRED_MODE]);
      else
        param1 = String.valueOf(REQUIRED_MODE);
         
      if (userMode < modeKeys.length)
        param2 = MessageText.getString(modeKeys[userMode]);
      else
        param2 = String.valueOf(userMode);

      label.setText(MessageText.getString("ConfigView.notAvailableForMode",
          new String[] { param1, param2 } ));

      return cSection;
    }

    //////////////////////  PROXY GROUP /////////////////
   
    Group gProxyTracker = new Group(cSection, SWT.NULL);
    Messages.setLanguageText(gProxyTracker, CFG_PREFIX + "group.tracker");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    gProxyTracker.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 2;
    gProxyTracker.setLayout(layout);
   
    final BooleanParameter enableProxy = new BooleanParameter(gProxyTracker,
        "Enable.Proxy", CFG_PREFIX + "enable_proxy");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    enableProxy.setLayoutData(gridData);

    final BooleanParameter enableSocks = new BooleanParameter(gProxyTracker,
        "Enable.SOCKS", CFG_PREFIX + "enable_socks");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    enableSocks.setLayoutData(gridData);

    Label lHost = new Label(gProxyTracker, SWT.NULL);
    Messages.setLanguageText(lHost, CFG_PREFIX + "host");
    StringParameter pHost = new StringParameter(gProxyTracker, "Proxy.Host", "");
    gridData = new GridData();
    gridData.widthHint = 105;
    pHost.setLayoutData(gridData);

    Label lPort = new Label(gProxyTracker, SWT.NULL);
    Messages.setLanguageText(lPort, CFG_PREFIX + "port");
    StringParameter pPort = new StringParameter(gProxyTracker, "Proxy.Port", "");
    gridData = new GridData();
    gridData.widthHint = 40;
    pPort.setLayoutData(gridData);

    Label lUser = new Label(gProxyTracker, SWT.NULL);
    Messages.setLanguageText(lUser, CFG_PREFIX + "username");
    StringParameter pUser = new StringParameter(gProxyTracker, "Proxy.Username" );
    gridData = new GridData();
    gridData.widthHint = 105;
    pUser.setLayoutData(gridData);

    Label lPass = new Label(gProxyTracker, SWT.NULL);
    Messages.setLanguageText(lPass, CFG_PREFIX + "password");
    StringParameter pPass = new StringParameter(gProxyTracker, "Proxy.Password", "");
    gridData = new GridData();
    gridData.widthHint = 105;
    pPass.setLayoutData(gridData);

    ////////////////////////////////////////////////
   
    Group gProxyPeer = new Group(cSection, SWT.NULL);
    Messages.setLanguageText(gProxyPeer, CFG_PREFIX + "group.peer");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    gProxyPeer.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 2;
    gProxyPeer.setLayout(layout);

    final BooleanParameter enableSocksPeer = new BooleanParameter(gProxyPeer,
        "Proxy.Data.Enable", CFG_PREFIX + "enable_socks.peer");
View Full Code Here

Examples of org.eclipse.swt.layout.GridLayout

        wizard.setTitle(MessageText.getString("SpeedTestWizard.set.upload.title"));
        wizard.setCurrentInfo(MessageText.getString("SpeedTestWizard.set.upload.hint"));

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

        Composite panel = new Composite(rootPanel, SWT.NULL);
        GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
        panel.setLayoutData(gridData);

        layout = new GridLayout();
        layout.numColumns = 4;
        panel.setLayout(layout);

        Label explain = new Label(panel, SWT.WRAP);
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 4;
        explain.setLayoutData(gridData);
        Messages.setLanguageText(explain,"SpeedTestWizard.set.upload.panel.explain");

        //spacer line
        Label spacer = new Label(panel, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan = 4;
        spacer.setLayoutData(gridData);

        Label spacer1 = new Label(panel, SWT.NULL);
        gridData = new GridData();
        spacer1.setLayoutData(gridData);

        Label bytesCol = new Label(panel, SWT.NULL);
        gridData = new GridData();
        gridData.widthHint=80;
        bytesCol.setLayoutData(gridData);
        Messages.setLanguageText(bytesCol,"SpeedTestWizard.set.upload.bytes.per.sec");

        Label bitsCol = new Label(panel, SWT.NULL);
        gridData = new GridData();
        gridData.widthHint=80;
        bitsCol.setLayoutData(gridData);
        Messages.setLanguageText(bitsCol,"SpeedTestWizard.set.upload.bits.per.sec");

        Label confLevel = new Label(panel, SWT.NULL);
        gridData = new GridData();
        gridData.widthHint=80;
        confLevel.setLayoutData(gridData);
        Messages.setLanguageText(confLevel,"SpeedTestWizard.set.limit.conf.level");

        //upload limit label.
        Label ul = new Label(panel, SWT.NULL );
        gridData = new GridData();
        ul.setLayoutData(gridData);
        Messages.setLanguageText(
            ul,
                "SpeedView.stats.estupcap",
                new String[] { DisplayFormatters.getRateUnit(DisplayFormatters.UNIT_KB)});

        final Text uploadLimitSetting = new Text(panel, SWT.BORDER );
        gridData = new GridData(GridData.BEGINNING);
        gridData.widthHint=80;
        uploadLimitSetting.setLayoutData(gridData);

        int uploadCapacity = determineRateSettingEx(measuredUploadKbps,uploadTestRan,true);

        //don't accept any value less the 20 kb/s
        if(uploadCapacity<20)
            uploadCapacity=20;

        uploadLimitSetting.setText( ""+uploadCapacity );
        uploadLimitSetting.addListener(SWT.Verify, new NumberListener(uploadLimitSetting));


        //echo
        final Label echo = new Label(panel, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan = 1;
        gridData.widthHint = 80;
        echo.setLayoutData(gridData);
        echo.setText( DisplayFormatters.formatByteCountToBitsPerSec(uploadCapacity*1024) );
        //This space has a change listener the updates in bits/sec.

        //want a change listener to update the echo label which has the value in bits/sec.
        uploadLimitSetting.addListener(SWT.Modify, new ByteConversionListener(echo,uploadLimitSetting));

        //confidence setting.
        final String[] confName = helper.getSettableTypes();
        final String[] confValue = helper.getSettableTypes();

        //upload confidence setting.
        int uploadDropIndex = setDefaultConfidenceLevelEx(measuredUploadKbps,uploadTestRan,true,confValue);
        upConfLevelCombo = new Combo(panel, SWT.READ_ONLY );
        addDropElements(upConfLevelCombo,confName);
        upConfLevelCombo.select(uploadDropIndex);


        //download limit label.
        Label dl = new Label( panel, SWT.NULL );
        gridData = new GridData();
        dl.setLayoutData(gridData);
        Messages.setLanguageText(
                dl,
                "SpeedView.stats.estdowncap",
                new String[] { DisplayFormatters.getRateUnit(DisplayFormatters.UNIT_KB)});

        final Text downloadLimitSetting = new Text(panel, SWT.BORDER);
        gridData = new GridData(GridData.BEGINNING);
        gridData.widthHint=80;
        downloadLimitSetting.setLayoutData(gridData);

        int bestDownloadSetting = determineRateSettingEx(measuredDownloadKbps,downloadTestRan,false);

        downloadLimitSetting.setText( ""+bestDownloadSetting );
        downloadLimitSetting.addListener(SWT.Verify, new NumberListener(downloadLimitSetting) );

        //echo
        final Label downEcho = new Label(panel, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan = 1;
        gridData.widthHint = 80;
        downEcho.setLayoutData(gridData);
        downEcho.setText( DisplayFormatters.formatByteCountToBitsPerSec(bestDownloadSetting*1024) );

        //convert bytes to bits on the fly for user.
        downloadLimitSetting.addListener(SWT.Modify, new ByteConversionListener(downEcho, downloadLimitSetting) );
        int downIndex = setDefaultConfidenceLevelEx(measuredDownloadKbps,downloadTestRan,false,confValue);

        downConfLevelCombo = new Combo(panel, SWT.READ_ONLY );
        addDropElements(downConfLevelCombo,confName);
        downConfLevelCombo.select(downIndex);

        //spacer col
        Label c1 = new Label(panel, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan = 1;
        gridData.widthHint = 80;
        c1.setLayoutData(gridData);

        SpeedManager sm = AzureusCoreFactory.getSingleton().getSpeedManager();

        if ( uploadTestRan ){

            //Since cable modems can over estimate upload need to drop type setting to estimate.
            sm.setEstimatedUploadCapacityBytesPerSec(
              measuredUploadKbps*1024,
              uploadHitLimit?
                SpeedManagerLimitEstimate.TYPE_ESTIMATED :SpeedManagerLimitEstimate.TYPE_ESTIMATED);
        }

        if ( downloadTestRan ){
         
          sm.setEstimatedDownloadCapacityBytesPerSec(
              measuredDownloadKbps*1024,
              downloadHitLimit?
                SpeedManagerLimitEstimate.TYPE_MEASURED_MIN :SpeedManagerLimitEstimate.TYPE_MEASURED);
        }

        apply = new Button(panel, SWT.PUSH);
        Messages.setLanguageText(apply, "SpeedTestWizard.set.upload.button.apply" );
        gridData = new GridData();
        gridData.widthHint = 70;
        apply.setLayoutData(gridData);
        apply.addListener(SWT.Selection, new Listener(){
            public void handleEvent(Event event){

                //Turn the string into an int and make it kbps.
                int uploadLimitKBPS = Integer.parseInt( uploadLimitSetting.getText() );
                int downlaodLimitKBPS = Integer.parseInt( downloadLimitSetting.getText() );
                //No value less then 20 kpbs should be allowed.
                if(uploadLimitKBPS<20){
                    uploadLimitKBPS=20;
                }

                //download value can never be less then upload.
                if( downlaodLimitKBPS < uploadLimitKBPS ){
                    downlaodLimitKBPS = uploadLimitKBPS;
                }

                //set upload limits
                COConfigurationManager.setParameter( "AutoSpeed Max Upload KBs", uploadLimitKBPS );
                COConfigurationManager.setParameter( TransferSpeedValidator.UPLOAD_CONFIGKEY, uploadLimitKBPS );
                COConfigurationManager.setParameter( TransferSpeedValidator.UPLOAD_SEEDING_CONFIGKEY , uploadLimitKBPS );
                // - Do we set these?
                //COConfigurationManager.setParameter( TransferSpeedValidator.DOWNLOAD_CONFIGKEY, downlaodLimitKBPS );

                if(downloadTestRan){
                    int dIndex = downConfLevelCombo.getSelectionIndex();
                    float downEstType = helper.textToType( confValue[dIndex] );
                    speedManager.setEstimatedUploadCapacityBytesPerSec( downlaodLimitKBPS , downEstType );
                }
                if(uploadTestRan){
                    int uIndex = upConfLevelCombo.getSelectionIndex();
                    float upEstType = helper.textToType( confValue[uIndex] );
                    speedManager.setEstimatedUploadCapacityBytesPerSec( uploadLimitKBPS , upEstType );
                }

                wizard.setFinishEnabled(true);
                wizard.setPreviousEnabled(false);
            }
        });


        //spacer col
        Label c3 = new Label(panel, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan = 1;
        c3.setLayoutData(gridData);

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

        //switch column width to 5 columns.
        Composite resultsPanel = new Composite(rootPanel, SWT.NULL);
        gridData = new GridData( GridData.VERTICAL_ALIGN_END | GridData.FILL_HORIZONTAL );
        resultsPanel.setLayoutData(gridData);

        layout = new GridLayout();
        layout.numColumns = 5;
        layout.makeColumnsEqualWidth=true;
        resultsPanel.setLayout(layout);


View Full Code Here

Examples of org.gwt.mosaic.ui.client.layout.GridLayout

    panel = new MosaicPanel(new BoxLayout(BoxLayout.Orientation.VERTICAL));

    this.appContext = Registry.get(ApplicationContext.class);
    panel.add(new HeaderLabel("User Preferences"), new BoxLayoutData(BoxLayoutData.FillStyle.HORIZONTAL));

    MosaicPanel layout = new MosaicPanel(new GridLayout(2,1));
    layout.add(
        new HTML("<b>Default Tool</b><br>" +
            "Select the tool that should be loaded upon login.")
    );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.