Package org.eclipse.swt.layout

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


        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

    // "Display" Sub-Section:
    // ----------------------
    // Any Look & Feel settings that don't really change the way the user
    // normally interacts
    Label label;
    GridLayout layout;
    GridData gridData;
    Composite cSection = new Composite(parent, SWT.NULL);
    cSection.setLayoutData(new GridData(GridData.FILL_BOTH));
    layout = new GridLayout();
    layout.numColumns = 1;
    cSection.setLayout(layout);

    new BooleanParameter(cSection, "Show Download Basket", MSG_PREFIX
        + "showdownloadbasket");

    if (!isAZ3) {
      new BooleanParameter(cSection, "IconBar.enabled", MSG_PREFIX
          + "showiconbar");
    }

    Group cStatusBar = new Group(cSection, SWT.NULL);
    Messages.setLanguageText(cStatusBar, MSG_PREFIX + "status");
    layout = new GridLayout();
    layout.numColumns = 1;
    cStatusBar.setLayout(layout);
    cStatusBar.setLayoutData(new GridData());

    new BooleanParameter(cStatusBar, "Status Area Show SR", MSG_PREFIX  + "status.show_sr");
    new BooleanParameter(cStatusBar, "Status Area Show NAT",  MSG_PREFIX + "status.show_nat");
    new BooleanParameter(cStatusBar, "Status Area Show DDB", MSG_PREFIX + "status.show_ddb");
    new BooleanParameter(cStatusBar, "Status Area Show IPF", MSG_PREFIX + "status.show_ipf");
    new BooleanParameter(cStatusBar, "status.rategraphs", MSG_PREFIX + "status.show_rategraphs");
   
    new BooleanParameter(cSection, "Add URL Silently", MSG_PREFIX  + "addurlsilently");

    new BooleanParameter(cSection, "suppress_file_download_dialog", "ConfigView.section.interface.display.suppress.file.download.dialog");

    new BooleanParameter(cSection, "show_torrents_menu", "Menu.show.torrent.menu");

    if (Constants.isWindowsXP) {
      final Button enableXPStyle = new Button(cSection, SWT.CHECK);
      Messages.setLanguageText(enableXPStyle, MSG_PREFIX + "enableXPStyle");

      boolean enabled = false;
      boolean valid = false;
      try {
        File f = new File(System.getProperty("java.home")
            + "\\bin\\javaw.exe.manifest");
        if (f.exists()) {
          enabled = true;
        }
        f = FileUtil.getApplicationFile("javaw.exe.manifest");
        if (f.exists()) {
          valid = true;
        }
      } catch (Exception e) {
        Debug.printStackTrace(e);
        valid = false;
      }
      enableXPStyle.setEnabled(valid);
      enableXPStyle.setSelection(enabled);
      enableXPStyle.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event arg0) {
          //In case we enable the XP Style
          if (enableXPStyle.getSelection()) {
            try {
              File fDest = new File(System.getProperty("java.home")
                  + "\\bin\\javaw.exe.manifest");
              File fOrigin = new File("javaw.exe.manifest");
              if (!fDest.exists() && fOrigin.exists()) {
                FileUtil.copyFile(fOrigin, fDest);
              }
            } catch (Exception e) {
              Debug.printStackTrace(e);
            }
          } else {
            try {
              File fDest = new File(System.getProperty("java.home")
                  + "\\bin\\javaw.exe.manifest");
              fDest.delete();
            } catch (Exception e) {
              Debug.printStackTrace(e);
            }
          }
        }
      });
    }

    if (Constants.isOSX) {
      new BooleanParameter(cSection, "enable_small_osx_fonts", MSG_PREFIX
          + "osx_small_fonts");
    }

    if (userMode > 0) {
      Group cUnits = new Group(cSection, SWT.NULL);
      Messages.setLanguageText(cUnits, MSG_PREFIX + "units");
      layout = new GridLayout();
      layout.numColumns = 1;
      cUnits.setLayout(layout);
      cUnits.setLayoutData(new GridData());

      new BooleanParameter(cUnits, "config.style.useSIUnits", MSG_PREFIX
          + "useSIUnits");

      new BooleanParameter(cUnits, "config.style.forceSIValues", MSG_PREFIX
          + "forceSIValues");

      new BooleanParameter(cUnits, "config.style.useUnitsRateBits", MSG_PREFIX
          + "useUnitsRateBits");

      new BooleanParameter(cUnits, "config.style.doNotUseGB", MSG_PREFIX
          + "doNotUseGB");

      new BooleanParameter(cUnits, "config.style.dataStatsOnly", MSG_PREFIX
          + "dataStatsOnly");

      new BooleanParameter(cUnits, "config.style.separateProtDataStats",
          MSG_PREFIX + "separateProtDataStats");
    }
   
    if( userMode > 1 ) {
      final BooleanParameter fMoz = new BooleanParameter(cSection, "swt.forceMozilla",MSG_PREFIX + "forceMozilla");
      Composite pArea = new Composite(cSection,SWT.NULL);
      pArea.setLayout(new GridLayout(3,false));
      pArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
      Messages.setLanguageText(new Label(pArea,SWT.NONE), MSG_PREFIX+"xulRunnerPath");
      final Parameter xulDir = new DirectoryParameter(pArea, "swt.xulRunner.path","");
      fMoz.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(xulDir.getControls(), false));
    }
   
    Composite cArea = new Composite(cSection, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    cArea.setLayout(layout);
    cArea.setLayoutData(new GridData());
   
    label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(label, MSG_PREFIX + "guiUpdate");
    int[] values = { 100, 250, 500, 1000, 2000, 5000, 10000, 15000 };
    String[] labels = { "100 ms", "250 ms", "500 ms", "1 s", "2 s", "5 s", "10 s", "15 s" };
    new IntListParameter(cArea, "GUI Refresh", 1000, labels, values);
   
    label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(label, MSG_PREFIX + "inactiveUpdate");
    gridData = new GridData();
    IntParameter inactiveUpdate = new IntParameter(cArea, "Refresh When Inactive", 1,  -1);
    inactiveUpdate.setLayoutData(gridData);

    label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(label, MSG_PREFIX + "graphicsUpdate");
    gridData = new GridData();
    IntParameter graphicUpdate = new IntParameter(cArea, "Graphics Update", 1,  -1);
    graphicUpdate.setLayoutData(gridData);

   
    // Reuse the labels of the other menu actions.
    if (PlatformManagerFactory.getPlatformManager().hasCapability(PlatformManagerCapabilities.ShowFileInBrowser)) {
      BooleanParameter bp = new BooleanParameter(cSection, "MyTorrentsView.menu.show_parent_folder_enabled", MSG_PREFIX
          + "use_show_parent_folder");
      Messages.setLanguageText(bp.getControl(), "ConfigView.section.style.use_show_parent_folder", new String[] {
        MessageText.getString("MyTorrentsView.menu.open_parent_folder"),
        MessageText.getString("MyTorrentsView.menu.explore"),
      });
     
      if (Constants.isOSX) {
        new BooleanParameter(cSection, "FileBrowse.usePathFinder",
            MSG_PREFIX + "usePathFinder");
      }
    }
   
    if ( Constants.isOSX_10_5_OrHigher ){
     
      Composite cSWT = new Composite(cSection, SWT.NULL);
      layout = new GridLayout();
      layout.marginHeight = 0;
      layout.marginWidth = 0;
      layout.numColumns = 2;
      cSWT.setLayout(layout);
      cSWT.setLayoutData(new GridData());
View Full Code Here

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

    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL + GridData.VERTICAL_ALIGN_FILL);
    cSection.setLayoutData(gridData);
    GridLayout advanced_layout = new GridLayout();
    cSection.setLayout(advanced_layout);

    int userMode = COConfigurationManager.getIntParameter("User Mode");
    if (userMode < REQUIRED_MODE) {
      Label label = new Label(cSection, SWT.WRAP);
      gridData = new GridData();
      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;
    }
   
    new LinkLabel(cSection, gridData, CFG_PREFIX
        + "info.link", MessageText.getString(CFG_PREFIX + "url"));

    ///////////////////////   ADVANCED SOCKET SETTINGS GROUP //////////
   
    Group gSocket = new Group(cSection, SWT.NULL);
    Messages.setLanguageText(gSocket, CFG_PREFIX + "socket.group");
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
    gSocket.setLayoutData(gridData);
    GridLayout glayout = new GridLayout();
    glayout.numColumns = 2;
    gSocket.setLayout(glayout);

      // max simultaneous
   
View Full Code Here

    // "Display" Sub-Section:
    // ----------------------
    // Any Look & Feel settings that don't really change the way the user
    // normally interacts
    Label label;
    GridLayout layout;
    GridData gridData;
    Composite cSection = new Composite(parent, SWT.NULL);
    cSection.setLayoutData(new GridData(GridData.FILL_BOTH));
    layout = new GridLayout();
    layout.numColumns = 2;
    cSection.setLayout(layout);

    label = new Label(cSection, SWT.NULL);
    Messages.setLanguageText(label, MSG_PREFIX + "defaultSortOrder");
    int[] sortOrderValues = {
      0,
      1,
      2
    };
    String[] sortOrderLabels = {
      MessageText.getString(MSG_PREFIX + "defaultSortOrder.asc"),
      MessageText.getString(MSG_PREFIX + "defaultSortOrder.desc"),
      MessageText.getString(MSG_PREFIX + "defaultSortOrder.flip")
    };
    new IntListParameter(cSection, "config.style.table.defaultSortOrder",
        sortOrderLabels, sortOrderValues);

    if (userMode > 0) {
      label = new Label(cSection, SWT.NULL);
      Messages.setLanguageText(label, MSG_PREFIX + "guiUpdate");
      int[] values = {
        100,
        250,
        500,
        1000,
        2000,
        5000,
        10000,
        15000
      };
      String[] labels = {
        "100 ms",
        "250 ms",
        "500 ms",
        "1 s",
        "2 s",
        "5 s",
        "10 s",
        "15 s"
      };
      new IntListParameter(cSection, "GUI Refresh", 1000, labels, values);

      label = new Label(cSection, SWT.NULL);
      Messages.setLanguageText(label, MSG_PREFIX + "graphicsUpdate");
      gridData = new GridData();
      IntParameter graphicUpdate = new IntParameter(cSection, "Graphics Update",
          1, -1);
      graphicUpdate.setLayoutData(gridData);

      label = new Label(cSection, SWT.NULL);
      Messages.setLanguageText(label, MSG_PREFIX + "reOrderDelay");
      gridData = new GridData();
      IntParameter reorderDelay = new IntParameter(cSection, "ReOrder Delay");
      reorderDelay.setLayoutData(gridData);

      new BooleanParameter(cSection, "NameColumn.showProgramIcon", MSG_PREFIX
          + "showProgramIcon").setLayoutData(new GridData(SWT.FILL, SWT.LEFT, true, false, 2, 1));
    }

    if (Constants.isWindows) {
      new BooleanParameter(cSection, "Table.extendedErase", MSG_PREFIX
          + "extendedErase").setLayoutData(new GridData(SWT.FILL,
          SWT.LEFT, true, false, 2, 1));
    }

    {
      Group cLibrary = new Group(cSection, SWT.NULL);
      Messages.setLanguageText(cLibrary, MSG_PREFIX + "library");
      layout = new GridLayout();
      layout.numColumns = 2;
      cLibrary.setLayout(layout);
      cLibrary.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 2, 1));

      // double-click
View Full Code Here

      GridData gridData;

      Composite gSecurity = new Composite(parent, SWT.NULL);
      gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
      gSecurity.setLayoutData(gridData);
      GridLayout layout = new GridLayout();
      layout.numColumns = 3;
      gSecurity.setLayout(layout);

      // row
     
      Label cert_label = new Label(gSecurity, SWT.NULL );
      Messages.setLanguageText(cert_label, "ConfigView.section.tracker.createcert");

      Button cert_button = new Button(gSecurity, SWT.PUSH);

      Messages.setLanguageText(cert_button, "ConfigView.section.tracker.createbutton");

      cert_button.addListener(SWT.Selection,
          new Listener()
        {
              public void
          handleEvent(Event event)
              {
                new CertificateCreatorWindow();
              }
          });
     
      new Label(gSecurity, SWT.NULL );
     
      // row

      Label  info_label = new Label( gSecurity, SWT.WRAP );
      Messages.setLanguageText( info_label, "ConfigView.section.security.toolsinfo" );
      info_label.setLayoutData(Utils.getWrappableLabelGridData(3, 0));
 
      // row
     
      Label lStatsPath = new Label(gSecurity, SWT.NULL);
     
      Messages.setLanguageText(lStatsPath, "ConfigView.section.security.toolsdir"); //$NON-NLS-1$

      ImageLoader imageLoader = ImageLoader.getInstance();
      Image imgOpenFolder = imageLoader.getImage("openFolderButton");     
     
      gridData = new GridData();
     
      gridData.widthHint = 150;
     
      final StringParameter pathParameter = new StringParameter(gSecurity, "Security.JAR.tools.dir", ""); //$NON-NLS-1$ //$NON-NLS-2$
     
      pathParameter.setLayoutData(gridData);
     
      Button browse = new Button(gSecurity, SWT.PUSH);
     
      browse.setImage(imgOpenFolder);
     
      imgOpenFolder.setBackground(browse.getBackground());
     
      browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));
     
      browse.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
          DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
 
          dialog.setFilterPath(pathParameter.getValue());
       
          dialog.setText(MessageText.getString("ConfigView.section.security.choosetoolssavedir")); //$NON-NLS-1$
       
          String path = dialog.open();
       
          if (path != null) {
            pathParameter.setValue(path);
          }
        }
      });
     
    
        // row
     
      Label pw_label = new Label(gSecurity, SWT.NULL );
      Messages.setLanguageText(pw_label, "ConfigView.section.security.clearpasswords");

      Button pw_button = new Button(gSecurity, SWT.PUSH);

      Messages.setLanguageText(pw_button, "ConfigView.section.security.clearpasswords.button");

      pw_button.addListener(SWT.Selection,
          new Listener()
        {
              public void
          handleEvent(Event event)
              {
                SESecurityManager.clearPasswords();
               
                CryptoManagerFactory.getSingleton().clearPasswords();
              }
          });
     
      new Label(gSecurity, SWT.NULL );
 
      if ( userMode >= 2 ){
       
        final CryptoManager crypt_man = CryptoManagerFactory.getSingleton();
       
        final Group crypto_group = new Group(gSecurity, SWT.NULL);
        gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 3;
        crypto_group.setLayoutData(gridData);
        layout = new GridLayout();
        layout.numColumns = 3;
        crypto_group.setLayout(layout);
       
      Messages.setLanguageText(crypto_group,"ConfigView.section.security.group.crypto");
     
View Full Code Here

    parent = composite;

    genComposite = new Canvas(parent, SWT.NULL);


    GridLayout genLayout = new GridLayout();
    genLayout.marginHeight = 0;
    try {
      genLayout.marginTop = 5;
    } catch (NoSuchFieldError e) {
      // pre 3.1
View Full Code Here

    this.display = parent.getDisplay();

    gFile = new Composite(genComposite, SWT.SHADOW_OUT);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gFile.setLayoutData(gridData);
    GridLayout fileLayout = new GridLayout();
    fileLayout.marginHeight = 0;
    fileLayout.marginWidth = 10;
    fileLayout.numColumns = 3;
    gFile.setLayout(fileLayout);

    Label piecesInfo = new Label(gFile, SWT.LEFT);
    Messages.setLanguageText(piecesInfo, "GeneralView.section.downloaded");
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    piecesInfo.setLayoutData(gridData);

    piecesImage = new Canvas(gFile, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint = 150;
    gridData.heightHint = 25;
    piecesImage.setLayoutData(gridData);

    piecesPercent = new BufferedLabel(gFile, SWT.RIGHT);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
    gridData.widthHint = 50;
    piecesPercent.setLayoutData(gridData);

    Label availabilityInfo = new Label(gFile, SWT.LEFT);
    Messages.setLanguageText(availabilityInfo, "GeneralView.section.availability");
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING);
    availabilityInfo.setLayoutData(gridData);

    availabilityImage = new Canvas(gFile, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint = 150;
    gridData.heightHint = 25;
    availabilityImage.setLayoutData(gridData);
    Messages.setLanguageText(availabilityImage, "GeneralView.label.status.pieces_available.tooltip");

    availabilityPercent = new BufferedLabel(gFile, SWT.RIGHT);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END);
    gridData.widthHint = 50;
    availabilityPercent.setLayoutData(gridData);
    Messages.setLanguageText(availabilityPercent.getWidget(), "GeneralView.label.status.pieces_available.tooltip");
   
    gTransfer = new Group(genComposite, SWT.SHADOW_OUT);
    Messages.setLanguageText(gTransfer, "GeneralView.section.transfer"); //$NON-NLS-1$
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gTransfer.setLayoutData(gridData);

    GridLayout layoutTransfer = new GridLayout();
    layoutTransfer.numColumns = 6;
    gTransfer.setLayout(layoutTransfer);

    Label label = new Label(gTransfer, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.timeelapsed"); //$NON-NLS-1$
    timeElapsed = new BufferedLabel(gTransfer, SWT.LEFT);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    timeElapsed.setLayoutData(gridData);
    label = new Label(gTransfer, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.remaining"); //$NON-NLS-1$
    timeRemaining = new BufferedLabel(gTransfer, SWT.LEFT);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    timeRemaining.setLayoutData(gridData);
    label = new Label(gTransfer, SWT.LEFT); //$NON-NLS-1$
    Messages.setLanguageText(label, "GeneralView.label.shareRatio");
    shareRatio = new BufferedLabel(gTransfer, SWT.LEFT); //$NON-NLS-1$
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    shareRatio.setLayoutData(gridData);

    label = new Label(gTransfer, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.downloaded"); //$NON-NLS-1$
    download = new BufferedLabel(gTransfer, SWT.LEFT);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    download.setLayoutData(gridData);
    label = new Label(gTransfer, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.downloadspeed"); //$NON-NLS-1$
    downloadSpeed = new BufferedLabel(gTransfer, SWT.LEFT);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    downloadSpeed.setLayoutData(gridData);
    label = new Label(gTransfer, SWT.LEFT); //$NON-NLS-1$
    Messages.setLanguageText(label, "GeneralView.label.hashfails");
    hashFails = new BufferedLabel(gTransfer, SWT.LEFT); //$NON-NLS-1$
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    hashFails.setLayoutData(gridData);
   
    label = new Label(gTransfer, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.uploaded"); //$NON-NLS-1$
    upload = new BufferedLabel(gTransfer, SWT.LEFT);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    upload.setLayoutData(gridData);   
    label = new Label(gTransfer, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.uploadspeed"); //$NON-NLS-1$
    uploadSpeed = new BufferedLabel(gTransfer, SWT.LEFT);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    uploadSpeed.setLayoutData(gridData);
   
      // blah
   
    label = new Label(gTransfer, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.seeds");
    seeds = new BufferedLabel(gTransfer, SWT.LEFT);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    seeds.setLayoutData(gridData);

    label = new Label(gTransfer, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.peers");
    peers = new BufferedLabel(gTransfer, SWT.LEFT);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    peers.setLayoutData(gridData);
   
    label = new Label(gTransfer, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.completed");
    completedLbl = new BufferedLabel(gTransfer, SWT.LEFT);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    completedLbl.setLayoutData(gridData);


   
    label = new Label(gTransfer, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.totalspeed");
    totalSpeed = new BufferedLabel(gTransfer, SWT.LEFT);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    totalSpeed.setLayoutData(gridData);
   
   
    label = new Label(gTransfer, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.swarm_average_completion");
    ave_completion = new BufferedLabel(gTransfer, SWT.LEFT);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    ave_completion.setLayoutData(gridData);
   
    label = new Label(gTransfer, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.distributedCopies");
    distributedCopies = new BufferedLabel(gTransfer, SWT.LEFT);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    distributedCopies.setLayoutData(gridData);
   

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

    gInfo = new Group(genComposite, SWT.SHADOW_OUT);
    Messages.setLanguageText(gInfo, "GeneralView.section.info");
    gridData = new GridData(GridData.FILL_BOTH);
    gInfo.setLayoutData(gridData);

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

    label = new Label(gInfo, SWT.LEFT);
    Messages.setLanguageText(label, "GeneralView.label.filename"); //$NON-NLS-1$
View Full Code Here

  private final int REQUIRED_MODE = 2;

  // @see org.gudy.azureus2.ui.swt.plugins.UISWTConfigSection#configSectionCreate(org.eclipse.swt.widgets.Composite)
  public Composite configSectionCreate(Composite parent) {
    GridData gridData;
    GridLayout layout;
    Label label;

    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 = 1;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    cSection.setLayout(layout);
View Full Code Here

      style |= SWT.APPLICATION_MODAL;
    }
    wizardWindow = ShellFactory.createMainShell(style);
    this.display   = wizardWindow.getDisplay();

    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    wizardWindow.setLayout(layout);
    Utils.setShellIcon(wizardWindow);

    Composite cTitle = new Composite(wizardWindow, SWT.NULL);
    Color white = display.getSystemColor(SWT.COLOR_WHITE);
    cTitle.setBackground(white);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    cTitle.setLayoutData(gridData);
    GridLayout titleLayout = new GridLayout();
    titleLayout.numColumns = 1;
    cTitle.setLayout(titleLayout);
    title = new Label(cTitle, SWT.NULL);
    title.setBackground(white);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    title.setLayoutData(gridData);
    Font font = title.getFont();
    FontData[] data = font.getFontData();
    for(int i = 0 ; i < data.length ; i++) {
      data[i].setStyle(SWT.BOLD);
    }
    titleFont=new Font(display,data);
    title.setFont(titleFont);
    currentInfo = new Label(cTitle, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    currentInfo.setLayoutData(gridData);
    currentInfo.setBackground(white);
    errorMessage = new Label(cTitle, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    errorMessage.setLayoutData(gridData);
    errorMessage.setBackground(white);
    Color red = display.getSystemColor(SWT.COLOR_RED);
    errorMessage.setForeground(red);

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    new Label(wizardWindow, SWT.SEPARATOR | SWT.HORIZONTAL).setLayoutData(gridData);

    panel = new Composite(wizardWindow, SWT.NULL);
    gridData = new GridData(GridData.FILL_BOTH);
    panel.setLayoutData(gridData);

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    new Label(wizardWindow, SWT.SEPARATOR | SWT.HORIZONTAL).setLayoutData(gridData);

    Composite cButtons = new Composite(wizardWindow, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cButtons.setLayoutData(gridData);
    GridLayout layoutButtons = new GridLayout();
    layoutButtons.numColumns = 5;
    cButtons.setLayout(layoutButtons);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    new Label(cButtons, SWT.NULL).setLayoutData(gridData);
View Full Code Here

TOP

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

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.