Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Label


      cWiki.setLayout(layout);
     
      gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
      gridData.horizontalIndent = 10;
      gridData.horizontalSpan = 4;
      Label label = new Label(cWiki, SWT.WRAP);
      label.setLayoutData( gridData );
      label.setText(MessageText.getString("installPluginsWizard.installMode.info.text"));
  }
}
View Full Code Here



  public Composite configSectionCreate(final 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 = 2;
    layout.marginHeight = 0;
    cSection.setLayout(layout);

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

    //  store the initial d/l speed so we can do something sensible later
    final int[] manual_max_download_speed = { COConfigurationManager
        .getIntParameter("Max Download Speed KBs") };

    //  max upload speed
    gridData = new GridData();
    label = new Label(cSection, SWT.NULL);
    label.setLayoutData(gridData);
    Messages.setLanguageText(label, "ConfigView.label.maxuploadspeed");

    gridData = new GridData();
    final IntParameter paramMaxUploadSpeed = new IntParameter(cSection,
        "Max Upload Speed KBs", 0, -1);
    paramMaxUploadSpeed.setLayoutData(gridData);

    //  max upload speed when seeding
    final Composite cMaxUploadSpeedOptionsArea = new Composite(cSection, SWT.NULL);
    layout = new GridLayout();
    layout.numColumns = 3;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    cMaxUploadSpeedOptionsArea.setLayout(layout);
    gridData = new GridData();
    gridData.horizontalIndent = 15;
    gridData.horizontalSpan = 2;
    cMaxUploadSpeedOptionsArea.setLayoutData(gridData);

    ImageLoader imageLoader = ImageLoader.getInstance();
    Image img = imageLoader.getImage("subitem");

    label = new Label(cMaxUploadSpeedOptionsArea, SWT.NULL);
    img.setBackground(label.getBackground());
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    label.setLayoutData(gridData);
    label.setImage(img);

    gridData = new GridData();
    final BooleanParameter enable_seeding_rate = new BooleanParameter(
        cMaxUploadSpeedOptionsArea, "enable.seedingonly.upload.rate",
        "ConfigView.label.maxuploadspeedseeding");
    enable_seeding_rate.setLayoutData(gridData);

    gridData = new GridData();
    final IntParameter paramMaxUploadSpeedSeeding = new IntParameter(
        cMaxUploadSpeedOptionsArea, "Max Upload Speed Seeding KBs", 0, -1);
    paramMaxUploadSpeedSeeding.setLayoutData(gridData);
    enable_seeding_rate
        .setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
            paramMaxUploadSpeedSeeding.getControl()));

    if (userMode < 2) {
      // wiki link

      Composite cWiki = new Composite(cSection, SWT.COLOR_GRAY);
      gridData = new GridData(GridData.VERTICAL_ALIGN_FILL
          | GridData.HORIZONTAL_ALIGN_FILL);
      gridData.horizontalSpan = 2;
      cWiki.setLayoutData(gridData);
      layout = new GridLayout();
      layout.numColumns = 4;
      layout.marginHeight = 0;
      cWiki.setLayout(layout);

      gridData = new GridData();
      gridData.horizontalIndent = 6;
      gridData.horizontalSpan = 2;
      label = new Label(cWiki, SWT.NULL);
      label.setLayoutData(gridData);
      label.setText(MessageText.getString("Utils.link.visit") + ":");

      gridData = new GridData();
      gridData.horizontalIndent = 10;
      gridData.horizontalSpan = 2;
      new LinkLabel(cWiki, gridData, "ConfigView.section.transfer.speeds.wiki",
          "http://wiki.vuze.com/w/Good_settings");
    }

    if ( userMode > 1 ){
   
      gridData = new GridData();
      label = new Label(cSection, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "ConfigView.label.maxuploadswhenbusymin" );

      gridData = new GridData();
      new IntParameter(cSection, "max.uploads.when.busy.inc.min.secs", 0, -1).setLayoutData(gridData);
    }
   
    // max download speed
    gridData = new GridData();
    label = new Label(cSection, SWT.NULL);
    label.setLayoutData(gridData);
    Messages.setLanguageText(label, "ConfigView.label.maxdownloadspeed");
   
    gridData = new GridData();
    final IntParameter paramMaxDownSpeed = new IntParameter(cSection,
        "Max Download Speed KBs", 0, -1);
    paramMaxDownSpeed.setLayoutData(gridData);
       
      // max upload/download limit dependencies
   
    Listener l = new Listener() {
 
      public void handleEvent(Event event) {
        boolean disableAuto = false;
        boolean disableAutoSeeding = false;
       
        if(enable_seeding_rate.isSelected())
        {
          disableAutoSeeding = event.widget == paramMaxUploadSpeedSeeding.getControl();
          disableAuto = event.widget == paramMaxDownSpeed.getControl() || event.widget == paramMaxUploadSpeed.getControl();
        } else
        {
          disableAuto = true;
          disableAutoSeeding = true;
        }
         
         
        if(disableAuto)
          COConfigurationManager.setParameter(TransferSpeedValidator.AUTO_UPLOAD_ENABLED_CONFIGKEY, false);
        if(disableAutoSeeding)
          COConfigurationManager.setParameter(TransferSpeedValidator.AUTO_UPLOAD_SEEDING_ENABLED_CONFIGKEY, false);
      }
    };
   
    paramMaxDownSpeed.getControl().addListener(SWT.Selection, l);
    paramMaxUploadSpeed.getControl().addListener(SWT.Selection, l);
    paramMaxUploadSpeedSeeding.getControl().addListener(SWT.Selection, l);
   
   
    paramMaxUploadSpeed.addChangeListener(new ParameterChangeAdapter() {
      ParameterChangeAdapter me = this;

      public void parameterChanged(Parameter p, boolean internal) {
        CoreWaiterSWT.waitForCoreRunning(new AzureusCoreRunningListener() {

          public void azureusCoreRunning(AzureusCore core) {
            if (paramMaxUploadSpeed.isDisposed()) {
              paramMaxUploadSpeed.removeChangeListener(me);
              return;
            }

            // we don't want to police these limits when auto-speed is running as
            // they screw things up bigtime

            if (TransferSpeedValidator.isAutoSpeedActive(core.getGlobalManager())) {

              return;
            }

            int up_val = paramMaxUploadSpeed.getValue();
            int down_val = paramMaxDownSpeed.getValue();

            if (up_val != 0
                && up_val < COConfigurationManager.CONFIG_DEFAULT_MIN_MAX_UPLOAD_SPEED) {

              if ((down_val == 0) || down_val > (up_val * 2)) {

                paramMaxDownSpeed.setValue(up_val * 2);
              }
            } else {

              if (down_val != manual_max_download_speed[0]) {

                paramMaxDownSpeed.setValue(manual_max_download_speed[0]);
              }
            }
          }

        });
      };
    });

    paramMaxDownSpeed.addChangeListener(new ParameterChangeAdapter() {
      ParameterChangeAdapter me = this;

      public void parameterChanged(Parameter p, boolean internal) {
        CoreWaiterSWT.waitForCoreRunning(new AzureusCoreRunningListener() {

          public void azureusCoreRunning(AzureusCore core) {
            if (paramMaxDownSpeed.isDisposed()) {
              paramMaxDownSpeed.removeChangeListener(me);
              return;
            }

            // we don't want to police these limits when auto-speed is running as
            // they screw things up bigtime

            if (TransferSpeedValidator.isAutoSpeedActive(core.getGlobalManager())) {

              return;
            }

            int up_val = paramMaxUploadSpeed.getValue();
            int down_val = paramMaxDownSpeed.getValue();

            manual_max_download_speed[0] = down_val;

            if (up_val < COConfigurationManager.CONFIG_DEFAULT_MIN_MAX_UPLOAD_SPEED) {

              if (up_val != 0 && up_val < (down_val * 2)) {

                paramMaxUploadSpeed.setValue((down_val + 1) / 2);

              } else if (down_val == 0) {

                paramMaxUploadSpeed.setValue(0);
              }
            }
          }
        });
      }
    });
   
    if (userMode > 0) {
     
        // bias upload to incomplete
     
      BooleanParameter bias_upload = new BooleanParameter(
          cSection,
          "Bias Upload Enable",
          "ConfigView.label.xfer.bias_up" );
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      bias_upload.setLayoutData(gridData);
     

      final Composite bias_slack_area = new Composite(cSection, SWT.NULL);
      layout = new GridLayout();
      layout.numColumns = 3;
      layout.marginWidth = 0;
      layout.marginHeight = 0;
      bias_slack_area.setLayout(layout);
      gridData = new GridData();
      gridData.horizontalIndent = 15;
      gridData.horizontalSpan = 2;
      bias_slack_area.setLayoutData(gridData);

      label = new Label(bias_slack_area, SWT.NULL);
      gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      label.setLayoutData(gridData);
      label.setImage(img);
     
      label = new Label(bias_slack_area, SWT.NULL);
      Messages.setLanguageText(label, "ConfigView.label.xfer.bias_slack");

      IntParameter bias_slack = new IntParameter(
          bias_slack_area, "Bias Upload Slack KBs", 1, -1);
     
     
      final Composite bias_unlimited_area = new Composite(cSection, SWT.NULL);
      layout = new GridLayout();
      layout.numColumns = 2;
      layout.marginWidth = 0;
      layout.marginHeight = 0;
      bias_unlimited_area.setLayout(layout);
      gridData = new GridData();
      gridData.horizontalIndent = 15;
      gridData.horizontalSpan = 2;
      bias_unlimited_area.setLayoutData(gridData);

      label = new Label(bias_unlimited_area, SWT.NULL);
      gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      label.setLayoutData(gridData);
      label.setImage(img);

     
      BooleanParameter bias_no_limit = new BooleanParameter(
          bias_unlimited_area,
          "Bias Upload Handle No Limit",
          "ConfigView.label.xfer.bias_no_limit" );
           
      bias_upload.setAdditionalActionPerformer(
          new ChangeSelectionActionPerformer(
          new Parameter[]{ bias_slack, bias_no_limit} ));
    }

    if (userMode > 0) {
     
        // AUTO GROUP
     
      Group auto_group = new Group(cSection, SWT.NULL);
     
      Messages.setLanguageText(auto_group, "group.auto");
     
      GridLayout auto_layout = new GridLayout();
     
      auto_layout.numColumns = 2;

      auto_group.setLayout(auto_layout);

      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 2;
      auto_group.setLayoutData(gridData);

      BooleanParameter auto_adjust = new BooleanParameter(
          auto_group,
          "Auto Adjust Transfer Defaults",
          "ConfigView.label.autoadjust" );
     
      gridData = new GridData();
      gridData.horizontalSpan = 2;

      auto_adjust.setLayoutData( gridData );

      // max uploads
      gridData = new GridData();
      label = new Label(auto_group, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "ConfigView.label.maxuploads");

      gridData = new GridData();
      IntParameter paramMaxUploads = new IntParameter(auto_group, "Max Uploads",
          2, -1);
      paramMaxUploads.setLayoutData(gridData);

        // max uploads when seeding
     
      final Composite cMaxUploadsOptionsArea = new Composite(auto_group, SWT.NULL);
      layout = new GridLayout();
      layout.numColumns = 3;
      layout.marginWidth = 0;
      layout.marginHeight = 0;
      cMaxUploadsOptionsArea.setLayout(layout);
      gridData = new GridData();
      gridData.horizontalIndent = 15;
      gridData.horizontalSpan = 2;
      cMaxUploadsOptionsArea.setLayoutData(gridData);
      label = new Label(cMaxUploadsOptionsArea, SWT.NULL);
      img.setBackground(label.getBackground());
      gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      label.setLayoutData(gridData);
      label.setImage(img);
     
      gridData = new GridData();
      BooleanParameter enable_seeding_uploads = new BooleanParameter(
          cMaxUploadsOptionsArea, "enable.seedingonly.maxuploads",
          "ConfigView.label.maxuploadsseeding");
      enable_seeding_uploads.setLayoutData(gridData);

      gridData = new GridData();
      final IntParameter paramMaxUploadsSeeding = new IntParameter(
          cMaxUploadsOptionsArea, "Max Uploads Seeding", 2, -1);
      paramMaxUploadsSeeding.setLayoutData(gridData);

     
     
      ////

      gridData = new GridData();
      label = new Label(auto_group, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "ConfigView.label.max_peers_per_torrent");

      gridData = new GridData();
      IntParameter paramMaxClients = new IntParameter(auto_group,
          "Max.Peer.Connections.Per.Torrent");
      paramMaxClients.setLayoutData(gridData);

     
      /////
     
        // max peers when seeding
     
      final Composite cMaxPeersOptionsArea = new Composite(auto_group, SWT.NULL);
      layout = new GridLayout();
      layout.numColumns = 3;
      layout.marginWidth = 0;
      layout.marginHeight = 0;
      cMaxPeersOptionsArea.setLayout(layout);
      gridData = new GridData();
      gridData.horizontalIndent = 15;
      gridData.horizontalSpan = 2;
      cMaxPeersOptionsArea.setLayoutData(gridData);
      label = new Label(cMaxPeersOptionsArea, SWT.NULL);
      img.setBackground(label.getBackground());
      gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
      label.setLayoutData(gridData);
      label.setImage(img);
     
      gridData = new GridData();
      BooleanParameter enable_max_peers_seeding = new BooleanParameter(
          cMaxPeersOptionsArea, "Max.Peer.Connections.Per.Torrent.When.Seeding.Enable",
          "ConfigView.label.maxuploadsseeding");
      enable_max_peers_seeding.setLayoutData(gridData);

      gridData = new GridData();
      final IntParameter paramMaxPeersSeeding = new IntParameter(
          cMaxPeersOptionsArea, "Max.Peer.Connections.Per.Torrent.When.Seeding", 0, -1);
      paramMaxPeersSeeding.setLayoutData(gridData)
     
      /////

      gridData = new GridData();
      label = new Label(auto_group, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "ConfigView.label.max_peers_total");

      gridData = new GridData();
      IntParameter paramMaxClientsTotal = new IntParameter(auto_group,
          "Max.Peer.Connections.Total");
      paramMaxClientsTotal.setLayoutData(gridData);
     
      gridData = new GridData();
      label = new Label(auto_group, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "ConfigView.label.maxseedspertorrent");

      gridData = new GridData();
      IntParameter max_seeds_per_torrent = new IntParameter(auto_group,"Max Seeds Per Torrent");
      max_seeds_per_torrent.setLayoutData(gridData);

      final Parameter[] parameters = {
          paramMaxUploads, enable_seeding_uploads, paramMaxUploadsSeeding,
          paramMaxClients, enable_max_peers_seeding, paramMaxPeersSeeding,
          paramMaxClientsTotal, max_seeds_per_torrent,
      };
     
        IAdditionalActionPerformer f_enabler =
            new GenericActionPerformer( new Control[0])
          {
              public void
              performAction()
              {
                boolean auto = COConfigurationManager.getBooleanParameter( "Auto Adjust Transfer Defaults" );
               
                for ( Parameter p: parameters ){
                 
                  Control[] c = p.getControls();
                 
                  for ( Control x: c ){
                   
                    x.setEnabled( !auto );
                  }
                }
                 
                if ( !auto ){
                 
                  paramMaxUploadsSeeding.getControl().setEnabled( COConfigurationManager.getBooleanParameter( "enable.seedingonly.maxuploads" ));
                 
                  paramMaxPeersSeeding.getControl().setEnabledCOConfigurationManager.getBooleanParameter( "Max.Peer.Connections.Per.Torrent.When.Seeding.Enable" ));
                }
              }
            };
     
        f_enabler.performAction();
       
      enable_seeding_uploads.setAdditionalActionPerformer( f_enabler );
      enable_max_peers_seeding.setAdditionalActionPerformer( f_enabler );
      auto_adjust.setAdditionalActionPerformer( f_enabler );
     
        // END AUTO GROUP
     
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter useReqLimiting = new BooleanParameter(cSection, "Use Request Limiting",
        "ConfigView.label.userequestlimiting");
      useReqLimiting.setLayoutData(gridData);

      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter useReqLimitingPrios = new BooleanParameter(cSection, "Use Request Limiting Priorities",
        "ConfigView.label.userequestlimitingpriorities");
      useReqLimitingPrios.setLayoutData(gridData);
      useReqLimiting
      .setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
          useReqLimitingPrios.getControl()));
     
     

      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter allowSameIP = new BooleanParameter(cSection,
          "Allow Same IP Peers", "ConfigView.label.allowsameip");
      allowSameIP.setLayoutData(gridData);

      // lazy bit field
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter lazybf = new BooleanParameter(cSection,
          "Use Lazy Bitfield", "ConfigView.label.lazybitfield");
      lazybf.setLayoutData(gridData);

      // prioritise first/last pieces
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter firstPiece = new BooleanParameter(cSection,
          "Prioritize First Piece",
          "ConfigView.label.prioritizefirstpiece");
      firstPiece.setLayoutData(gridData);

      // Further prioritize High priority files according to % complete and size of file
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter mostCompletedFiles = new BooleanParameter(cSection,
          "Prioritize Most Completed Files",
          "ConfigView.label.prioritizemostcompletedfiles");
      mostCompletedFiles.setLayoutData(gridData);

      // ignore ports

      Composite cMiniArea = new Composite(cSection, SWT.NULL);
      layout = new GridLayout();
      layout.numColumns = 2;
      layout.marginHeight = 0;
      layout.marginWidth = 0;
      cMiniArea.setLayout(layout);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 2;
      cMiniArea.setLayoutData(gridData);

      gridData = new GridData();
      label = new Label(cMiniArea, SWT.NULL);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label,
          "ConfigView.label.transfer.ignorepeerports");

      gridData = new GridData();
      gridData.widthHint = 125;
View Full Code Here

    shell.setText(MessageText.getString("TrackerChangerWindow.title"));
    Utils.setShellIcon(shell);
    GridLayout layout = new GridLayout();
    shell.setLayout(layout);

    Label label = new Label(shell, SWT.NONE);
    Messages.setLanguageText(label, "TrackerChangerWindow.newtracker");   
    GridData gridData = new GridData();
    gridData.widthHint = 200;
    label.setLayoutData(gridData);

    final Text url = new Text(shell, SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.widthHint = 300;
    url.setLayoutData(gridData);
View Full Code Here

    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;
    }
   
    Group gCrypto = new Group(cSection, SWT.NULL);
    Messages.setLanguageText(gCrypto, CFG_PREFIX + "encrypt.group");
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gCrypto.setLayoutData(gridData);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    gCrypto.setLayout(layout);
   
    Label lcrypto = new Label(gCrypto, SWT.WRAP);
    Messages.setLanguageText(lcrypto, CFG_PREFIX + "encrypt.info");
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    gridData.widthHint = 200// needed for wrap
    lcrypto.setLayoutData(gridData);

    gridData = new GridData();
    gridData.horizontalSpan = 2;
    new LinkLabel(gCrypto, gridData, CFG_PREFIX
        + "encrypt.info.link",
        "http://wiki.vuze.com/w/Avoid_traffic_shaping");
   
    final BooleanParameter require = new BooleanParameter(gCrypto,  "network.transport.encrypted.require", CFG_PREFIX + "require_encrypted_transport");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    require.setLayoutData(gridData);
   
    String[] encryption_types = { "Plain", "RC4" };
    String dropLabels[] = new String[encryption_types.length];
    String dropValues[] = new String[encryption_types.length];
    for (int i = 0; i < encryption_types.length; i++) {
      dropLabels[i] = encryption_types[i];
      dropValues[i] = encryption_types[i];
    }
   
    Composite cEncryptLevel = new Composite(gCrypto, SWT.NULL);
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 2;
    cEncryptLevel.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    cEncryptLevel.setLayout(layout);
   
    Label lmin = new Label(cEncryptLevel, SWT.NULL);
    Messages.setLanguageText(lmin, CFG_PREFIX + "min_encryption_level");
    final StringListParameter min_level = new StringListParameter(cEncryptLevel,  "network.transport.encrypted.min_level", encryption_types[1], dropLabels, dropValues);
   
    Label lcryptofb = new Label(gCrypto, SWT.WRAP);
    Messages.setLanguageText(lcryptofb, CFG_PREFIX + "encrypt.fallback_info");
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    gridData.widthHint = 200// needed for wrap
    lcryptofb.setLayoutData(gridData);

    BooleanParameter fallback_outgoing = new BooleanParameter(gCrypto, "network.transport.encrypted.fallback.outgoing", CFG_PREFIX + "encrypt.fallback_outgoing");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    fallback_outgoing.setLayoutData(gridData);
View Full Code Here

    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();
      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;
    }
View Full Code Here

  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,"installPluginsWizard.finish.explanation");
  }
View Full Code Here

    Control[] controls = new Control[14];

    // row

    Label lStatsPath = new Label(gStats, SWT.NULL);
    Messages.setLanguageText(lStatsPath, "ConfigView.section.stats.defaultsavepath"); //$NON-NLS-1$

    gridData = new GridData();
    gridData.widthHint = 150;
    final StringParameter pathParameter = new StringParameter(gStats, "Stats Dir", ""); //$NON-NLS-1$ //$NON-NLS-2$
    pathParameter.setLayoutData(gridData);
    controls[0] = lStatsPath;
    controls[1] = pathParameter.getControl();
    Button browse = new Button(gStats, SWT.PUSH);
    browse.setImage(imgOpenFolder);
    imgOpenFolder.setBackground(browse.getBackground());
    browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));
    controls[2] = 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.setText(MessageText.getString("ConfigView.section.stats.choosedefaultsavepath")); //$NON-NLS-1$
      String path = dialog.open();
      if (path != null) {
        pathParameter.setValue(path);
      }
      }
    });

    // row

    Label lSaveFile = new Label(gStats, SWT.NULL);
    Messages.setLanguageText(lSaveFile, "ConfigView.section.stats.savefile"); //$NON-NLS-1$
    controls[3] = lSaveFile;
   
    gridData = new GridData();
    gridData.widthHint = 150;
    final StringParameter fileParameter = new StringParameter(gStats, "Stats File", StatsWriterPeriodic.DEFAULT_STATS_FILE_NAME );
    fileParameter.setLayoutData(gridData);
    controls[4] = fileParameter.getControl();
    new Label(gStats, SWT.NULL);

    // row

    Label lxslFile = new Label(gStats, SWT.NULL);
    Messages.setLanguageText(lxslFile, "ConfigView.section.stats.xslfile"); //$NON-NLS-1$
    controls[5] = lxslFile;
   
    gridData = new GridData();
    gridData.widthHint = 150;
    final StringParameter xslParameter = new StringParameter(gStats, "Stats XSL File", "" );
    xslParameter.setLayoutData(gridData);
    controls[6] = xslParameter.getControl();
    Label lxslDetails = new Label(gStats, SWT.NULL);
    Messages.setLanguageText(lxslDetails, "ConfigView.section.stats.xslfiledetails"); //$NON-NLS-1$
    final String linkFAQ = "http://plugins.vuze.com/faq.php#20";
    lxslDetails.setCursor(lxslDetails.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
    lxslDetails.setForeground(Colors.blue);
    lxslDetails.addMouseListener(new MouseAdapter() {
      public void mouseDoubleClick(MouseEvent arg0) {
        Utils.launch(linkFAQ);
      }
      public void mouseDown(MouseEvent arg0) {
        Utils.launch(linkFAQ);
      }
    });
    controls[7] = lxslDetails;
   
    // row

    Label lSaveFreq = new Label(gStats, SWT.NULL);

    Messages.setLanguageText(lSaveFreq, "ConfigView.section.stats.savefreq");
    controls[8] = lSaveFreq;
   
    final String spLabels[] = new String[statsPeriods.length];
    final int spValues[] = new int[statsPeriods.length];
    for (int i = 0; i < statsPeriods.length; i++) {
      int num = statsPeriods[i];

      if ( num%3600 == 0 )
        spLabels[i] = " " + (statsPeriods[i]/3600) + " " +
                             MessageText.getString("ConfigView.section.stats.hours");

      else if ( num%60 == 0 )
        spLabels[i] = " " + (statsPeriods[i]/60) + " " +
                             MessageText.getString("ConfigView.section.stats.minutes");

      else
        spLabels[i] = " " + statsPeriods[i] + " " +
                            MessageText.getString("ConfigView.section.stats.seconds");

      spValues[i] = statsPeriods[i];
    }

    controls[9] = lSaveFreq;
    controls[10] = new IntListParameter(gStats, "Stats Period", defaultStatsPeriod, spLabels, spValues).getControl();
    new Label(gStats, SWT.NULL);

      // ROW
   
    gridData = new GridData();
    gridData.horizontalSpan = 3;
View Full Code Here

    textBlocked.setText(ipsBlocked);
   
   
    // label blocked area
   
    Label  blockedInfo = new Label(window, SWT.NULL);
    Messages.setLanguageText(blockedInfo,"ConfigView.section.ipfilter.blockedinfo");
    formData = new FormData();
    formData.top = new FormAttachment(textBlocked);   
    formData.right = new FormAttachment(btnClear);   
    formData.left = new FormAttachment(0,0);   
    blockedInfo.setLayoutData( formData );
      // clear button
   
   
    Messages.setLanguageText(btnClear,"Button.clear");
    formData = new FormData();
    formData.top = new FormAttachment(textBlocked);   
    formData.right = new FormAttachment(95,0 );   
    //formData.bottom = new FormAttachment(textBanned);
    formData.width = 70;
    btnClear.setLayoutData(formData);
    btnClear.addListener(SWT.Selection,new Listener() {

    public void handleEvent(Event e) {
    
      azureus_core.getIpFilterManager().getIPFilter().clearBlockedIPs();
     
      textBlocked.setText( "" );
    }
    });
   
   
      // text banned area
    formData = new FormData();
    formData.left = new FormAttachment(0,0);
    formData.right = new FormAttachment(100,0);
    formData.top = new FormAttachment(btnClear);  
    formData.bottom = new FormAttachment(btnOk);  
    textBanned.setLayoutData(formData);
    textBanned.setText(ipsBanned);
   
      // label banned area
   
    Label  bannedInfo = new Label(window, SWT.NULL);
    Messages.setLanguageText(bannedInfo,"ConfigView.section.ipfilter.bannedinfo");
    formData = new FormData();
    formData.right = new FormAttachment(btnReset);   
    formData.left = new FormAttachment(0,0);   
    formData.bottom = new FormAttachment(100,0)
    bannedInfo.setLayoutData( formData );
   
      // reset button
   
    Messages.setLanguageText(btnReset,"Button.reset");
    formData = new FormData();
View Full Code Here

  BufferedTruncatedLabel(
    Composite    composite,
    int        attrs,
    int        _width)
  {
    super( new Label( composite, attrs ));
   
    label   = (Label)getWidget();
    width  = _width;
  }
View Full Code Here

    spinImages = ImageLoader.getInstance().getImages("working");
   
    if ( spinImages.length == 0 || spinImages == null ){
     
      new Label( shell, SWT.NULL );
     
    }else{

      final Rectangle spinBounds = spinImages[0].getBounds();
        final Canvas  canvas =
          new Canvas( shell, SWT.NULL )
          {
            public Point computeSize(int wHint, int hHint,boolean changed )
            {
              return( new Point(spinBounds.width, spinBounds.height));
            }
          };
         
          canvas.addPaintListener(new PaintListener() {
            public void paintControl(PaintEvent e) {
              e.gc.drawImage(spinImages[curSpinIndex ], 0, 0);
            }
          });
         
          Utils.execSWTThreadLater(100, new AERunnable() {
            public void runSupport() {
              if (canvas == null || canvas.isDisposed()) {
                return;
              }

              canvas.redraw();
              canvas.update();
              if (curSpinIndex == spinImages.length - 1) {
                curSpinIndex = 0;
              } else {
                curSpinIndex++;
              }
              Utils.execSWTThreadLater(100, this);
            }
          });
                         
    }
   
   
    Label label = new Label(shell, SWT.NONE);
       
    label.setText(MessageText.getString( resource ));
    GridData gridData = new GridData();
    label.setLayoutData(gridData);

    shell.pack();
   
    Composite parent = shell.getParent();
   
View Full Code Here

TOP

Related Classes of org.eclipse.swt.widgets.Label

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.