Package org.eclipse.swt.layout

Examples of org.eclipse.swt.layout.GridData


     * @param panel -
     * @param label - label
     * @param enabled - is enabled
     */
    private void createStatusLine(Composite panel, String label, boolean enabled){
        GridData gridData;
        Label r3c1 = new Label(panel, SWT.NULL);//label
        gridData = new GridData();
        gridData.horizontalSpan = 1;
        gridData.horizontalAlignment = GridData.END;
        r3c1.setLayoutData(gridData);
        r3c1.setText(label);

        Label c3 = new Label(panel,SWT.NULL);//enabled or disabled
        gridData = new GridData();
        gridData.horizontalSpan = 1;
        gridData.horizontalAlignment = GridData.CENTER;
        c3.setLayoutData(gridData);
        if(enabled){
            c3.setText( MessageText.getString("SpeedTestWizard.finish.panel.enabled","enabled") );
        }else{
            c3.setText( MessageText.getString("SpeedTestWizard.finish.panel.disabled","disabled") );
        }

        Label c2 = new Label(panel,SWT.NULL);//space.
        gridData = new GridData();
        gridData.horizontalSpan = 1;
        gridData.horizontalAlignment = GridData.BEGINNING;
        c2.setLayoutData(gridData);
        String maxUploadBitsSec = "       ";
        c2.setText(maxUploadBitsSec);
View Full Code Here


     * @param label - label
     * @param maxKbps - bits/sec
     * @param estimate -
     */
    private void createDataLine(Composite panel, String label, int maxKbps, SpeedManagerLimitEstimate estimate) {
        GridData gridData;
        Label c1 = new Label(panel, SWT.NULL);//max upload
        gridData = new GridData();
        gridData.horizontalSpan = 1;
        gridData.horizontalAlignment = GridData.END;
        c1.setLayoutData(gridData);
        c1.setText(label+"  ");

        Label c2 = new Label(panel,SWT.NULL);//kbytes/sec
        gridData = new GridData();
        gridData.horizontalSpan = 1;
        gridData.horizontalAlignment = GridData.CENTER;
        c2.setLayoutData(gridData);
        String estString  = helper.getLimitText( estimate );
        c2.setText(estString);

        Label c3 = new Label(panel,SWT.NULL);//kbits/sec
        gridData = new GridData();
        gridData.horizontalSpan = 1;
        gridData.horizontalAlignment = GridData.BEGINNING;
        c3.setLayoutData(gridData);

        String maxBitsPerSec;
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.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
  panel.setLayoutData(gridData);
  layout = new GridLayout();
  layout.numColumns = 1;
  panel.setLayout(layout);
 
  final Label lblStatus = new Label(panel,SWT.NULL);
  Messages.setLanguageText(lblStatus,"uninstallPluginsWizard.list.loaded");
 
  pluginList = new Table(panel,SWT.BORDER | SWT.V_SCROLL | SWT.CHECK | SWT.FULL_SELECTION | SWT.SINGLE);
  pluginList.setHeaderVisible(true);
  GridData data = new GridData(GridData.FILL_HORIZONTAL);
  data.heightHint = 200;
  pluginList.setLayoutData(data);
 
 
  TableColumn tcName = new TableColumn(pluginList,SWT.LEFT);
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);
    panel.setLayoutData(gridData);

        /////////////////////////////////////////
        //Add group to link to Azureus Wiki page.
        /////////////////////////////////////////
        Group azWiki = new Group(panel, SWT.WRAP);
        GridData azwGridData = new GridData();
        azwGridData.widthHint = 350;
        azwGridData.horizontalSpan = 4;
        azWiki.setLayoutData(azwGridData);
        GridLayout azwLayout = new GridLayout();
        azwLayout.numColumns = 1;
        //azwLayout.marginHeight = 1;
        azWiki.setLayout(azwLayout);

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

        final Label linkLabel = new Label(azWiki, SWT.NULL);
        linkLabel.setText( Constants.APP_NAME + " Wiki Speed Test" );
        linkLabel.setData("http://wiki.vuze.com/w/Speed_Test_FAQ");
        linkLabel.setCursor(display.getSystemCursor(SWT.CURSOR_HAND));
        linkLabel.setForeground(Colors.blue);
        azwGridData = new GridData();
        azwGridData.horizontalIndent = 10;
        linkLabel.setLayoutData( azwGridData );
      linkLabel.addMouseListener(new MouseAdapter() {
        public void mouseDoubleClick(MouseEvent arg0) {
          Utils.launch((String) ((Label) arg0.widget).getData());
        }
        public void mouseUp(MouseEvent arg0) {
          Utils.launch((String) ((Label) arg0.widget).getData());
        }
      });

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

        //label explain section.
        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.test.panel.explain");
               

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

        //label type and button section.
        Label ul = new Label(panel, SWT.NULL );
        gridData = new GridData();
        ul.setLayoutData(gridData);
        Messages.setLanguageText(ul,"SpeedTestWizard.test.panel.label");

        testCombo = new Combo(panel, SWT.READ_ONLY);
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        testCombo.setLayoutData(gridData);
          
        int[]  test_types    = NetworkAdminSpeedTester.TEST_TYPES;
        int    up_only_index   = 0;
       
        for (int i=0;i<test_types.length;i++){
         
          int  test_type = test_types[i];
         
          String  resource = null;
                   
            if ( test_type == NetworkAdminSpeedTester.TEST_TYPE_UPLOAD_ONLY ){
            resource = "up";
                up_only_index = i;
            }else if ( test_type == NetworkAdminSpeedTester.TEST_TYPE_DOWNLOAD_ONLY ){
            resource = "down";
          }else{
            Debug.out( "Unknown test type" );
          }
            //List all test in drop-down.
            testCombo.add( "BT " + MessageText.getString( "speedtest.wizard.test.mode." + resource ), i);
        }
       
        testCombo.select( up_only_index );

        test = new Button(panel, SWT.PUSH);
        Messages.setLanguageText(test,"dht.execute");//Run
        gridData = new GridData();
        gridData.widthHint = 70;
        test.setLayoutData(gridData);
        test.addListener(SWT.Selection, new RunButtonListener() );

        abort = new Button(panel, SWT.PUSH);
        Messages.setLanguageText(abort,"SpeedTestWizard.test.panel.abort");//Abort
        gridData = new GridData();
        gridData.widthHint = 70;
        abort.setLayoutData(gridData);
        abort.setEnabled(false);
        abort.addListener(SWT.Selection, new AbortButtonListener() );

        //toggle button line.
        Label enc = new Label( panel, SWT.NULL );
        gridData = new GridData();
        enc.setLayoutData(gridData);
        Messages.setLanguageText(enc,"SpeedTestWizard.test.panel.enc.label");

        encryptToggle = new Button(panel, SWT.TOGGLE);

        String statusString="SpeedTestWizard.test.panel.standard";
        if( encryptToggle.getSelection() ){
            statusString = "SpeedTestWizard.test.panel.encrypted";
        }
        Messages.setLanguageText(encryptToggle,statusString);
        gridData = new GridData();
        gridData.widthHint = 80;
        encryptToggle.setLayoutData(gridData);
        encryptToggle.addListener(SWT.Selection, new EncryptToggleButtonListener() );

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

        //test count down section.
        Label abortCountDown = new Label(panel, SWT.NULL);
        gridData = new GridData();
        abortCountDown.setLayoutData(gridData);
        Messages.setLanguageText(abortCountDown,"SpeedTestWizard.test.panel.abort.countdown");

        testCountDown1 = new Label(panel, SWT.NULL);
        gridData = new GridData();
        testCountDown1.setLayoutData(gridData);
        testCountDown1.setText(START_VALUES);

        Label testFinishCountDown = new Label(panel, SWT.NULL);
        gridData = new GridData();
        testFinishCountDown.setLayoutData(gridData);
        Messages.setLanguageText(testFinishCountDown,"SpeedTestWizard.test.panel.test.countdown");

        testCountDown2 = new Label(panel, SWT.NULL);
        gridData = new GridData();
        testCountDown2.setLayoutData(gridData);
        testCountDown2.setText(START_VALUES);

       
        //progress bar section.
        progress = new ProgressBar(panel, SWT.SMOOTH);
    progress.setMinimum(0);
    progress.setMaximum(100);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 4;
        progress.setLayoutData(gridData);

        //message text section.
        textMessages = new Text(panel, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL );
    textMessages.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    gridData = new GridData(GridData.FILL_BOTH);
        gridData.horizontalSpan = 4;
        gridData.heightHint = 60;
        textMessages.setLayoutData(gridData);

        //this should only be new when returning from a previous panel.
View Full Code Here

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

    GridData gridData;
    Label label;
    String sCurConfigID;
    final ArrayList allConfigIDs = new ArrayList();

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

    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 0;
    gFile.setLayout(layout);

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

    // Default Dir Sction
    Group gDefaultDir = new Group(gFile, SWT.NONE);
    Messages.setLanguageText(gDefaultDir,
        "ConfigView.section.file.defaultdir.section");
    layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginHeight = 2;
    gDefaultDir.setLayout(layout);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    gDefaultDir.setLayoutData(gridData);

    // Save Path
    sCurConfigID = "Default save path";
    allConfigIDs.add(sCurConfigID);
    Label lblDefaultDir = new Label(gDefaultDir, SWT.NONE);
    Messages.setLanguageText(lblDefaultDir,
        "ConfigView.section.file.defaultdir.ask");
    lblDefaultDir.setLayoutData(new GridData());

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    final StringParameter pathParameter = new StringParameter(gDefaultDir,
        sCurConfigID);
    pathParameter.setLayoutData(gridData);

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

    browse.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(pathParameter.getValue());
        dialog.setMessage(MessageText.getString("ConfigView.dialog.choosedefaultsavepath"));
        dialog.setText(MessageText.getString("ConfigView.section.file.defaultdir.ask"));
        String path = dialog.open();
        if (path != null) {
          pathParameter.setValue(path);
        }
      }
    });

    // def dir: autoSave
    sCurConfigID = "Use default data dir";
    allConfigIDs.add(sCurConfigID);
    BooleanParameter autoSaveToDir = new BooleanParameter(gDefaultDir,
        sCurConfigID, "ConfigView.section.file.defaultdir.auto");
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    autoSaveToDir.setLayoutData(gridData);

    if (userMode > 0) {
      // def dir: autoSave -> auto-rename
      sCurConfigID = "DefaultDir.AutoSave.AutoRename";
      allConfigIDs.add(sCurConfigID);
      BooleanParameter autoSaveAutoRename = new BooleanParameter(gDefaultDir,
          sCurConfigID, "ConfigView.section.file.defaultdir.autorename");
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 3;
      gridData.horizontalIndent = 20;
      autoSaveAutoRename.setLayoutData(gridData);
      IAdditionalActionPerformer aapDefaultDirStuff3 = new ChangeSelectionActionPerformer(
          autoSaveAutoRename.getControls(), false);
      autoSaveToDir.setAdditionalActionPerformer(aapDefaultDirStuff3);

      // def dir: best guess
      sCurConfigID = "DefaultDir.BestGuess";
      allConfigIDs.add(sCurConfigID);
      BooleanParameter bestGuess = new BooleanParameter(gDefaultDir,
          sCurConfigID, "ConfigView.section.file.defaultdir.bestguess");
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 3;
      bestGuess.setLayoutData(gridData);

      IAdditionalActionPerformer aapDefaultDirStuff = new ChangeSelectionActionPerformer(
          bestGuess.getControls(), true);
      autoSaveToDir.setAdditionalActionPerformer(aapDefaultDirStuff);

      // def dir: auto update
      sCurConfigID = "DefaultDir.AutoUpdate";
      allConfigIDs.add(sCurConfigID);
      BooleanParameter autoUpdateSaveDir = new BooleanParameter(gDefaultDir,
          sCurConfigID, "ConfigView.section.file.defaultdir.lastused");
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 3;
      autoUpdateSaveDir.setLayoutData(gridData);

      IAdditionalActionPerformer aapDefaultDirStuff2 = new ChangeSelectionActionPerformer(
          autoUpdateSaveDir.getControls(), true);
      autoSaveToDir.setAdditionalActionPerformer(aapDefaultDirStuff2);
    }

    new Label(gFile, SWT.NONE);

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

    sCurConfigID = "XFS Allocation";
    allConfigIDs.add(sCurConfigID);
    if (userMode > 0 && !Constants.isWindows) {
      BooleanParameter xfsAllocation = new BooleanParameter(gFile,
          sCurConfigID, "ConfigView.label.xfs.allocation");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      xfsAllocation.setLayoutData(gridData);
    }

    BooleanParameter zeroNew = null;

    sCurConfigID = "Zero New";
    allConfigIDs.add(sCurConfigID);
    if (userMode > 0) {
      // zero new files
      zeroNew = new BooleanParameter(gFile, sCurConfigID,
          "ConfigView.label.zeronewfiles");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      zeroNew.setLayoutData(gridData);
    }

    BooleanParameter pieceReorder = null;

    sCurConfigID = "Enable reorder storage mode";
    allConfigIDs.add(sCurConfigID);
    if (userMode > 0) {

      pieceReorder = new BooleanParameter(gFile, sCurConfigID,
          "ConfigView.label.piecereorder");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      pieceReorder.setLayoutData(gridData);

      //Make the reorder checkbox (button) deselect when zero new is used
      Button[] btnReorder = {
        (Button) pieceReorder.getControl()
      };
      zeroNew.setAdditionalActionPerformer(new ExclusiveSelectionActionPerformer(
          btnReorder));

      //Make the zero new checkbox(button) deselct when reorder is used
      Button[] btnZeroNew = {
        (Button) zeroNew.getControl()
      };
      pieceReorder.setAdditionalActionPerformer(new ExclusiveSelectionActionPerformer(
          btnZeroNew));
    }

    sCurConfigID = "Reorder storage mode min MB";
    allConfigIDs.add(sCurConfigID);

    if (userMode > 0) {
      Label lblMinMB = new Label(gFile, SWT.NULL);
      Messages.setLanguageText(lblMinMB, "ConfigView.label.piecereorderminmb");
      gridData = new GridData();
      gridData.horizontalIndent = 25;
      lblMinMB.setLayoutData(gridData);

      IntParameter minMB = new IntParameter(gFile, sCurConfigID);
      gridData = new GridData();
      minMB.setLayoutData(gridData);

      pieceReorder.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
          lblMinMB));
      pieceReorder.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
          minMB));
    }

    sCurConfigID = "Enable incremental file creation";
    allConfigIDs.add(sCurConfigID);
    if (userMode > 0) {
      // incremental file creation
      BooleanParameter incremental = new BooleanParameter(gFile, sCurConfigID,
          "ConfigView.label.incrementalfile");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      incremental.setLayoutData(gridData);

      //Make the incremental checkbox (button) deselect when zero new is used
      Button[] btnIncremental = {
        (Button) incremental.getControl()
      };
      zeroNew.setAdditionalActionPerformer(new ExclusiveSelectionActionPerformer(
          btnIncremental));

      //Make the zero new checkbox(button) deselct when incremental is used
      Button[] btnZeroNew = {
        (Button) zeroNew.getControl()
      };
      incremental.setAdditionalActionPerformer(new ExclusiveSelectionActionPerformer(
          btnZeroNew));
    }

    sCurConfigID = "File.truncate.if.too.large";
    allConfigIDs.add(sCurConfigID);
    if (userMode > 0) {
      // truncate too large
      BooleanParameter truncateLarge = new BooleanParameter(gFile,
          sCurConfigID, "ConfigView.section.file.truncate.too.large");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      truncateLarge.setLayoutData(gridData);
    }

    sCurConfigID = "Check Pieces on Completion";
    allConfigIDs.add(sCurConfigID);
    if (userMode > 0) {
      // check on complete
      BooleanParameter checkOnComp = new BooleanParameter(gFile, sCurConfigID,
          "ConfigView.label.checkOncompletion");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      checkOnComp.setLayoutData(gridData);
    }

    sCurConfigID = "Seeding Piece Check Recheck Enable";
    allConfigIDs.add(sCurConfigID);
    if (userMode > 0) {
      // check on complete
      BooleanParameter checkOnSeeding = new BooleanParameter(gFile,
          sCurConfigID, "ConfigView.label.checkOnSeeding");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      checkOnSeeding.setLayoutData(gridData);
    }

    sCurConfigID = "File.strict.locking";
    allConfigIDs.add(sCurConfigID);
    if (userMode > 1) {

      BooleanParameter strictLocking = new BooleanParameter(gFile,
          sCurConfigID, "ConfigView.label.strictfilelocking");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      strictLocking.setLayoutData(gridData);
    }

    if (userMode == 0) {
      allConfigIDs.add("Use Resume");
      sCurConfigID = "Save Resume Interval";
      allConfigIDs.add(sCurConfigID);
      sCurConfigID = "On Resume Recheck All";
      allConfigIDs.add(sCurConfigID);
      sCurConfigID = "File.save.peers.enable";
      allConfigIDs.add(sCurConfigID);
      sCurConfigID = "File.save.peers.max";
      allConfigIDs.add(sCurConfigID);
    } else {
      sCurConfigID = "Use Resume";
      allConfigIDs.add(sCurConfigID);
      // resume data
      final BooleanParameter bpUseResume = new BooleanParameter(gFile,
          sCurConfigID, "ConfigView.label.usefastresume");
      bpUseResume.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));

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

      sCurConfigID = "Save Resume Interval";
      allConfigIDs.add(sCurConfigID);
      Label lblSaveResumeInterval = new Label(cResumeGroup, SWT.NULL);
      Messages.setLanguageText(lblSaveResumeInterval,
          "ConfigView.label.saveresumeinterval");

      IntParameter paramSaveInterval = new IntParameter(cResumeGroup,
          sCurConfigID);
      gridData = new GridData();
      paramSaveInterval.setLayoutData(gridData);

      Label lblMinutes = new Label(cResumeGroup, SWT.NULL);
      Messages.setLanguageText(lblMinutes, "ConfigView.text.minutes");

      // save peers

      sCurConfigID = "On Resume Recheck All";
      allConfigIDs.add(sCurConfigID);
      final BooleanParameter recheck_all = new BooleanParameter(cResumeGroup,
          sCurConfigID, "ConfigView.section.file.resume.recheck.all");
      gridData = new GridData();
      gridData.horizontalSpan = 3;
      recheck_all.setLayoutData(gridData);
      // save peers

      sCurConfigID = "File.save.peers.enable";
      allConfigIDs.add(sCurConfigID);
      final BooleanParameter save_peers = new BooleanParameter(cResumeGroup,
          sCurConfigID, "ConfigView.section.file.save.peers.enable");
      gridData = new GridData();
      gridData.horizontalSpan = 3;
      save_peers.setLayoutData(gridData);

      // save peers max

      sCurConfigID = "File.save.peers.max";
      allConfigIDs.add(sCurConfigID);
      final Label lblSavePeersMax = new Label(cResumeGroup, SWT.NULL);
      Messages.setLanguageText(lblSavePeersMax,
          "ConfigView.section.file.save.peers.max");
      final IntParameter savePeersMax = new IntParameter(cResumeGroup,
          sCurConfigID);
      gridData = new GridData();
      savePeersMax.setLayoutData(gridData);
      final Label lblPerTorrent = new Label(cResumeGroup, SWT.NULL);
      Messages.setLanguageText(lblPerTorrent,
          "ConfigView.section.file.save.peers.pertorrent");

      final Control[] controls = {
        cResumeGroup
      };

      /*
      IAdditionalActionPerformer performer = new ChangeSelectionActionPerformer(controls);
      bpUseResume.setAdditionalActionPerformer(performer);
      */

      IAdditionalActionPerformer f_enabler = new GenericActionPerformer(
          controls) {
        public void performAction() {
          controlsSetEnabled(controls, bpUseResume.isSelected());

          if (bpUseResume.isSelected()) {
            lblSavePeersMax.setEnabled(save_peers.isSelected());
            savePeersMax.getControl().setEnabled(save_peers.isSelected());
            lblPerTorrent.setEnabled(save_peers.isSelected());
          }
        }
      };

      bpUseResume.setAdditionalActionPerformer(f_enabler);
      save_peers.setAdditionalActionPerformer(f_enabler);

    } //end usermode>0

    if (userMode > 0) {
      sCurConfigID = "priorityExtensions";
      allConfigIDs.add(sCurConfigID);

      // Auto-Prioritize
      label = new Label(gFile, SWT.WRAP);
      gridData = new GridData();
      gridData.widthHint = 180;
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "ConfigView.label.priorityExtensions");

      Composite cExtensions = new Composite(gFile, SWT.NULL);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      cExtensions.setLayoutData(gridData);
      layout = new GridLayout();
      layout.marginHeight = 0;
      layout.marginWidth = 0;
      layout.numColumns = 3;
      cExtensions.setLayout(layout);

      gridData = new GridData(GridData.FILL_HORIZONTAL);
      new StringParameter(cExtensions, sCurConfigID).setLayoutData(gridData);

      sCurConfigID = "priorityExtensionsIgnoreCase";
      allConfigIDs.add(sCurConfigID);
      new BooleanParameter(cExtensions, sCurConfigID,
          "ConfigView.label.ignoreCase");
    } else {
      sCurConfigID = "priorityExtensions";
      allConfigIDs.add(sCurConfigID);
      sCurConfigID = "priorityExtensionsIgnoreCase";
      allConfigIDs.add(sCurConfigID);
    }

    // rename incomplete

    if (userMode > 0) {
      sCurConfigID = "Rename Incomplete Files";
      allConfigIDs.add(sCurConfigID);

      gridData = new GridData();
      gridData.horizontalSpan = 1;
      BooleanParameter rename_incomplete = new BooleanParameter(gFile,
          sCurConfigID, "ConfigView.section.file.rename.incomplete");
      rename_incomplete.setLayoutData(gridData);

      sCurConfigID = "Rename Incomplete Files Extension";
      allConfigIDs.add(sCurConfigID);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      StringParameter rename_incomplete_ext = new StringParameter(gFile,
          sCurConfigID);
      rename_incomplete_ext.setLayoutData(gridData);

      IAdditionalActionPerformer incompFileAP = new ChangeSelectionActionPerformer(
          rename_incomplete_ext.getControls(), false);
      rename_incomplete.setAdditionalActionPerformer(incompFileAP);

      Label lIgnoreFiles = new Label(gFile, SWT.NULL);
      Messages.setLanguageText(lIgnoreFiles,
          "ConfigView.section.file.torrent.ignorefiles");

      gridData = new GridData(GridData.FILL_HORIZONTAL);
      new StringParameter(gFile, "File.Torrent.IgnoreFiles",
          TOTorrent.DEFAULT_IGNORE_FILES).setLayoutData(gridData);

    }

    Group gDeletion = new Group(gFile, SWT.NONE);
    Messages.setLanguageText(gDeletion,
        "ConfigView.section.file.deletion.section");
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 5;
    gDeletion.setLayout(layout);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    gDeletion.setLayoutData(gridData);
   
    if (userMode > 0) {
      Composite c = new Composite(gDeletion, SWT.NONE);
      layout = new GridLayout();
      layout.numColumns = 2;
      layout.marginHeight = 0;
      layout.marginWidth = 0;
      c.setLayout(layout);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 2;
      c.setLayoutData(gridData);
     
      sCurConfigID = "tb.confirm.delete.content";
      label = new Label(c, SWT.NULL);
      Messages.setLanguageText(label, "ConfigView.section.file.tb.delete");
      int[] values = {
        0,
        1,
        2,
      };
      String[] labels = {
        MessageText.getString("ConfigView.tb.delete.ask"),
        MessageText.getString("ConfigView.tb.delete.content"),
        MessageText.getString("ConfigView.tb.delete.torrent"),
      };
      new IntListParameter(c, sCurConfigID, labels, values);

     
      sCurConfigID = "def.deletetorrent";
      allConfigIDs.add(sCurConfigID);
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      new BooleanParameter(gDeletion, sCurConfigID, "ConfigView.section.file.delete.torrent").setLayoutData(gridData);
    }

   
    try {
      final PlatformManager platform = PlatformManagerFactory.getPlatformManager();

      if (platform.hasCapability(PlatformManagerCapabilities.RecoverableFileDelete)) {
        sCurConfigID = "Move Deleted Data To Recycle Bin";
        allConfigIDs.add(sCurConfigID);

        gridData = new GridData();
        gridData.horizontalSpan = 2;
        new BooleanParameter(gDeletion, sCurConfigID,
            "ConfigView.section.file.nativedelete").setLayoutData(gridData);

      }
    } catch (Throwable e) {

    }
   
    if (userMode > 0) {
      sCurConfigID = "File.delete.include_files_outside_save_dir";
      allConfigIDs.add(sCurConfigID);

      gridData = new GridData();
      gridData.horizontalSpan = 2;
      new BooleanParameter(gDeletion, sCurConfigID,
          "ConfigView.section.file.delete.include_files_outside_save_dir").setLayoutData(gridData);
    }

    if (userMode > 0) {
      Group gConfigSettings = new Group(gFile, SWT.NONE);
      Messages.setLanguageText(gConfigSettings,
          "ConfigView.section.file.config.section");
      layout = new GridLayout();
      layout.numColumns = 2;
      layout.marginHeight = 5;
      gConfigSettings.setLayout(layout);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 2;
      gConfigSettings.setLayoutData(gridData);

      // Configuration directory information.
      Label config_label = new Label(gConfigSettings, SWT.NULL);
      Messages.setLanguageText(config_label,
          "ConfigView.section.file.config.currentdir");
      config_label.setLayoutData(new GridData());
      Label config_link = new Label(gConfigSettings, SWT.NULL);
      config_link.setText(SystemProperties.getUserPath());
      config_link.setLayoutData(new GridData());
      LinkLabel.makeLinkedLabel(config_link, SystemProperties.getUserPath());

      sCurConfigID = "Use Config File Backups";
      allConfigIDs.add(sCurConfigID);

      // check on complete
      BooleanParameter backupConfig = new BooleanParameter(gConfigSettings,
          sCurConfigID, "ConfigView.label.backupconfigfiles");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      backupConfig.setLayoutData(gridData);
    }
    /*
        Button buttonReset = new Button(gFile, SWT.PUSH);
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.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
  panel.setLayoutData(gridData);
  layout = new GridLayout();
  layout.numColumns = 1;
  panel.setLayout(layout);
 
  Label lblExplanation = new Label(panel,SWT.WRAP);
  GridData data = new GridData(GridData.FILL_BOTH);
  lblExplanation.setLayoutData(data);
  Messages.setLanguageText(lblExplanation,"uninstallPluginsWizard.finish.explanation");
  }
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);
    panel.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 1;
    panel.setLayout(layout);

    final Group gRadio = new Group(panel, SWT.NULL);
    Messages.setLanguageText(gRadio, "speedtest.wizard.select.group");
    gRadio.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 1;
    gRadio.setLayout( layout );
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gRadio.setLayoutData(gridData);


    // general test
View Full Code Here

    return 2;
  }


  public Composite configSectionCreate(final Composite parent) {
    GridData gridData;
    GridLayout layout;
    Label  label;
    int userMode = COConfigurationManager.getIntParameter("User Mode");

    // extensions tab set up
    Composite gMainTab = new Composite(parent, SWT.NULL);
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gMainTab.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 3;
    gMainTab.setLayout(layout);

      //////////////////////SCRAPE GROUP ///////////////////
   
    Group scrapeGroup = new Group(gMainTab,SWT.NULL);
    Messages.setLanguageText(scrapeGroup,"ConfigView.group.scrape");
    GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 1;
    scrapeGroup.setLayout(gridLayout);
   
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    scrapeGroup.setLayoutData( gridData );
   
    label = new Label(scrapeGroup, SWT.WRAP);
    label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
    Messages.setLanguageText(label, "ConfigView.section.tracker.client.scrapeinfo");

    BooleanParameter  scrape =
      new BooleanParameter(scrapeGroup, "Tracker Client Scrape Enable",
                  "ConfigView.section.tracker.client.scrapeenable");
   
    BooleanParameter  scrape_stopped =
      new BooleanParameter(scrapeGroup, "Tracker Client Scrape Stopped Enable",
                  "ConfigView.section.tracker.client.scrapestoppedenable");
   
    scrape.setAdditionalActionPerformer(new ChangeSelectionActionPerformer( scrape_stopped.getControls()));

    new BooleanParameter(scrapeGroup, "Tracker Client Scrape Single Only",
                  "ConfigView.section.tracker.client.scrapesingleonly");
   
    /////////////////////////
   
    // row

    gridData = new GridData();
    gridData.horizontalSpan = 2;
 
    new BooleanParameter(gMainTab, "Tracker Client Send OS and Java Version",
                         "ConfigView.section.tracker.sendjavaversionandos").setLayoutData(gridData);

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

//////////////////////
   
    BooleanParameter enableUDP = new BooleanParameter(gMainTab, "Server Enable UDP", "ConfigView.section.server.enableudp");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    enableUDP.setLayoutData(gridData);
   
    label = new Label(gMainTab, SWT.NULL);
 
//////////////////////
   
    BooleanParameter enableUDPProbe = new BooleanParameter(gMainTab, "Tracker UDP Probe Enable", "ConfigView.section.server.enableudpprobe");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    enableUDPProbe.setLayoutData(gridData);
   
    label = new Label(gMainTab, SWT.NULL);
 
    enableUDP.setAdditionalActionPerformer(new ChangeSelectionActionPerformer( enableUDPProbe.getControls()));

   
//////////////////////
   
    BooleanParameter showWarnings = new BooleanParameter(gMainTab, "Tracker Client Show Warnings", "ConfigView.section.tracker.client.showwarnings" );
    gridData = new GridData();
    gridData.horizontalSpan = 2;
  showWarnings.setLayoutData(gridData);
   
    label = new Label(gMainTab, SWT.NULL);
   
    if (userMode > 0) {
   
//////////////////////OVERRIDE GROUP ///////////////////
   
    Group overrideGroup = new Group(gMainTab,SWT.NULL);
    Messages.setLanguageText(overrideGroup,"ConfigView.group.override");
    gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    overrideGroup.setLayout(gridLayout);
   
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    overrideGroup.setLayoutData( gridData );
   
   
    label = new Label(overrideGroup, SWT.WRAP);
    label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
    Messages.setLanguageText(label, "ConfigView.label.overrideip");
   
    StringParameter overrideip = new StringParameter(overrideGroup, "Override Ip", "");
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = 100;
    overrideip.setLayoutData(data);
   
    label = new Label(overrideGroup, SWT.WRAP);
    label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
    Messages.setLanguageText(label, "ConfigView.label.announceport");
   
    StringParameter tcpOverride = new StringParameter(overrideGroup, "TCP.Listen.Port.Override");
    data = new GridData();
    data.widthHint = 50;
    tcpOverride.setLayoutData(data);
   
    tcpOverride.addChangeListener(new ParameterChangeAdapter() {
      public void stringParameterChanging(Parameter p, String toValue)
      {
        if(toValue == "")
          return;
        try
      {
          int portVal = Integer.parseInt(toValue);
        if(portVal >= 0 && portVal <= 65535)
          return;
      } catch (NumberFormatException e) {}
      p.setValue("");
      }
    });

    label = new Label(overrideGroup, SWT.WRAP);
    label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
    Messages.setLanguageText(label, "ConfigView.label.noportannounce");
   
    BooleanParameter noPortAnnounce = new BooleanParameter(overrideGroup,"Tracker Client No Port Announce");
    data = new GridData();
    noPortAnnounce.setLayoutData(data);
   
    label = new Label(overrideGroup, SWT.WRAP);
    label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
    Messages.setLanguageText(label, "ConfigView.label.maxnumwant");
   
    IntParameter numwant = new IntParameter(overrideGroup, "Tracker Client Numwant Limit",0,100);
    data = new GridData();
    numwant.setLayoutData(data);
   
    label = new Label(overrideGroup, SWT.WRAP);
    label.setLayoutData(Utils.getWrappableLabelGridData(1, GridData.FILL_HORIZONTAL));
    Messages.setLanguageText(label, "ConfigView.label.minannounce");
   
    IntParameter minmininterval = new IntParameter(overrideGroup, "Tracker Client Min Announce Interval");
    data = new GridData();
    minmininterval.setLayoutData(data);

   
    //////////////////////////
   
    if(userMode>1) {
   
    // row
   
    label = new Label(gMainTab, SWT.NULL);
    Messages.setLanguageText(label,  "ConfigView.section.tracker.client.connecttimeout");
    gridData = new GridData();
    IntParameter  connect_timeout = new IntParameter(gMainTab, "Tracker Client Connect Timeout" );
    connect_timeout.setLayoutData(gridData);
    label = new Label(gMainTab, SWT.NULL);

    // row
   
    label = new Label(gMainTab, SWT.NULL);
    Messages.setLanguageText(label,  "ConfigView.section.tracker.client.readtimeout");
    gridData = new GridData();
    IntParameter  read_timeout = new IntParameter(gMainTab, "Tracker Client Read Timeout" );
    read_timeout.setLayoutData(gridData);
    label = new Label(gMainTab, SWT.NULL);

    ////// main tab
   
    // row

    gridData = new GridData();
    gridData.horizontalSpan = 2;
 
    new BooleanParameter(gMainTab, "Tracker Key Enable Client",
                         "ConfigView.section.tracker.enablekey").setLayoutData(gridData);

    label = new Label(gMainTab, SWT.NULL);
   
   
    // row

    gridData = new GridData();
    gridData.horizontalSpan = 2;
    new BooleanParameter(gMainTab, "Tracker Separate Peer IDs",
                         "ConfigView.section.tracker.separatepeerids").setLayoutData(gridData);
 
View Full Code Here

  }

 

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

    Composite gSharing = new Composite(parent, SWT.WRAP);
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gSharing.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight = 0;
    gSharing.setLayout(layout);

      // row
   
  gridData = new GridData();
    Label protocol_lab = new Label(gSharing, SWT.NULL);
    Messages.setLanguageText(protocol_lab, "ConfigView.section.sharing.protocol");
  protocol_lab.setLayoutData( gridData );
 
  String[]  protocols = {"HTTP","HTTPS","UDP","DHT" };
    String[]  descs = {"HTTP","HTTPS (SSL)", "UDP", "Decentralised" };
   
  new StringListParameter(gSharing, "Sharing Protocol", "DHT", descs, protocols );

  // row
   
  GridData grid_data = new GridData();
  grid_data.horizontalSpan = 2;
  final BooleanParameter private_torrent =
    new BooleanParameter(gSharing,   "Sharing Torrent Private",
                               "ConfigView.section.sharing.privatetorrent");
  private_torrent.setLayoutData(grid_data);
 

  // row
    gridData = new GridData();
    gridData.horizontalSpan = 2;
  final BooleanParameter permit_dht =
    new BooleanParameter(gSharing, "Sharing Permit DHT",
                         "ConfigView.section.sharing.permitdht");
  permit_dht.setLayoutData( gridData );

  private_torrent.setAdditionalActionPerformer(new ChangeSelectionActionPerformer( permit_dht.getControls(), true ));

  private_torrent.addChangeListener(
    new ParameterChangeAdapter()
    {
      public void
      parameterChanged(
        Parameter p,
        boolean caused_internally )
      {
        if ( private_torrent.isSelected() ){
         
          permit_dht.setSelected( false );
        }
      }
 
    });
 
      // row
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    new BooleanParameter(gSharing, "Sharing Add Hashes",
                         "wizard.createtorrent.extrahashes").setLayoutData( gridData );
   

      // row
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    BooleanParameter rescan_enable =
      new BooleanParameter(gSharing, "Sharing Rescan Enable",
                "ConfigView.section.sharing.rescanenable");
   
  rescan_enable.setLayoutData( gridData );

      //row
    gridData = new GridData();
  gridData.horizontalIndent = 25;
    Label period_label = new Label(gSharing, SWT.NULL );
    Messages.setLanguageText(period_label, "ConfigView.section.sharing.rescanperiod");
  period_label.setLayoutData( gridData );

    gridData = new GridData();
  IntParameter rescan_period = new IntParameter(gSharing, "Sharing Rescan Period");
    rescan_period.setMinimumValue(1);
    rescan_period.setLayoutData( gridData );
   
    rescan_enable.setAdditionalActionPerformer(new ChangeSelectionActionPerformer( rescan_period.getControls() ));
    rescan_enable.setAdditionalActionPerformer(new ChangeSelectionActionPerformer( new Control[]{period_label} ));
 
      // comment
   
    Label comment_label = new Label(gSharing, SWT.NULL );
    Messages.setLanguageText(comment_label, "ConfigView.section.sharing.torrentcomment");
 
  new Label(gSharing, SWT.NULL);
 
  gridData = new GridData(GridData.FILL_HORIZONTAL);
  gridData.horizontalIndent = 25;
  gridData.horizontalSpan = 2;
    StringParameter torrent_comment = new StringParameter(gSharing, "Sharing Torrent Comment", "" );
    torrent_comment.setLayoutData(gridData);
   
View Full Code Here

    layout.makeColumnsEqualWidth = true;
    shell.setLayout(layout);
   
    Label label = new Label(shell,SWT.NONE);
    label.setText(MessageText.getString("PasswordWindow.passwordprotected"));
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    label.setLayoutData(gridData);
   
    final Text password = new Text(shell,SWT.BORDER);
    password.setEchoChar('*');
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    password.setLayoutData(gridData);
   
    Button ok = new Button(shell,SWT.PUSH);
    ok.setText(MessageText.getString("Button.ok"));
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
    gridData.widthHint = 70;
    ok.setLayoutData(gridData);
    shell.setDefaultButton(ok);
    ok.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        try {
          SHA1Hasher hasher = new SHA1Hasher();
          byte[] passwordText = password.getText().getBytes();
          byte[] encoded = hasher.calculateHash(passwordText);
          byte[] correct = COConfigurationManager.getByteParameter("Password",
              "".getBytes());
          boolean same = true;
          for (int i = 0; i < correct.length; i++) {
            if (correct[i] != encoded[i])
              same = false;
          }
          if (same) {
            bOk = same;
            shell.dispose();
          } else {
            close();
          }
        } catch (Exception e) {
          Debug.printStackTrace(e);
        }
      }
    });   
   
    Button cancel = new Button(shell,SWT.PUSH);
    cancel.setText(MessageText.getString("Button.cancel"));
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_CENTER);
    gridData.widthHint = 70;
    cancel.setLayoutData(gridData);
    cancel.addListener(SWT.Selection,new Listener() {
          /* (non-Javadoc)
           * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
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.