Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Label


   
    GridData txtStyle = new GridData(GridData.FILL_HORIZONTAL);
    txtStyle.minimumWidth = convertWidthInCharsToPixels(60);

   
    Label lblSymbolicName = new Label(composite, SWT.None);
    lblSymbolicName.setText("Symbolic name:");
    _lblSymbolicName = new Label(composite, SWT.BORDER);   
    _lblSymbolicName.setLayoutData(txtStyle);
    _lblSymbolicName.setText(_deployment.getName());
     
   
    Label filler = new Label(composite, SWT.None);
    filler.setText("");
   

    Label lblDefaultPlugins = new Label(composite, SWT.None);
    lblDefaultPlugins.setText("Default Plugins:");
    GridData lblLayout = new GridData();
    lblLayout.verticalAlignment = SWT.TOP;
    lblDefaultPlugins.setLayoutData(lblLayout);
   
    _lstDefaultPlugins = new DynamicListControl(composite, SWT.None);
    List<String> pluginNames = _deployment.getDefaultPluginNames();
    Collections.sort(pluginNames);
    _lstDefaultPlugins.init(pluginNames.toArray(new String[0]));

    GridData listLayout = new GridData(GridData.FILL_HORIZONTAL);
    listLayout.horizontalSpan = 2;
    _lstDefaultPlugins.setLayoutData(listLayout);
   
    _lstDefaultPlugins.getButton(DynamicListControl.BUTTON_ADD).addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        handleAddDefaultPlugin();
      }       
    });
   
    _lstDefaultPlugins.getButton(DynamicListControl.BUTTON_REMOVE).addSelectionListener(new SelectionAdapter() {
      @Override
      public void widgetSelected(SelectionEvent e) {
        handleRemoveDefaultPlugin();
      }       
    });
   
   
    Label lblUpdateURL = new Label(composite, SWT.None);
    lblUpdateURL.setText("Update URL:");
    //lblUpdateURL.setLayoutData(GridDataFactory.copyData(txtStyle));
   
    _txtUpdateURL = new Text(composite, SWT.BORDER);
    _txtUpdateURL.setLayoutData(GridDataFactory.copyData(txtStyle));
   
View Full Code Here


    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
    GridLayout layout = new GridLayout(3, false);
    composite.setLayout(layout);

    Label messageLabel = createMessageArea(composite);
    _treeViewer = createTreeViewer(composite);
    GridData gridDataLabel = new GridData(GridData.FILL_HORIZONTAL);
    gridDataLabel.horizontalSpan = 3;

    messageLabel.setLayoutData(gridDataLabel);
    GridData gridDataTree = new GridData(GridData.FILL_BOTH);
    gridDataTree.horizontalSpan = 3;
    gridDataTree.widthHint = convertWidthInCharsToPixels(80);
    gridDataTree.heightHint = convertHeightInCharsToPixels(20);
    Tree treeWidget = _treeViewer.getTree();
    treeWidget.setLayoutData(gridDataTree);

    GridData gridDataText = new GridData(GridData.FILL_HORIZONTAL);   
    new Label(composite, SWT.NONE).setText("Name :");
    _linkNameText = new Text(composite, SWT.BORDER);
    _linkNameText.setLayoutData(gridDataText);
    _linkNameText.addModifyListener(new ModifyListener() {

      public void modifyText(ModifyEvent e) {
View Full Code Here

        GridLayout sectionLayout = new GridLayout();       
        sectionLayout.numColumns = 2;
        sectionClient.setLayout(sectionLayout);
       
       
        Label lblStateDesc = new Label(sectionClient, SWT.NONE);
        lblStateDesc.setText("State:");
       
        _lblState = new Label(sectionClient, SWT.NONE);
       
        Composite buttonGroup = toolkit.createComposite(sectionClient);
        GridLayout buttonGroupLayout = new GridLayout();       
        buttonGroupLayout.numColumns = 3;
        buttonGroup.setLayout(buttonGroupLayout);
        GridData buttonGroupLayoutData = new GridData();
        buttonGroupLayoutData.horizontalSpan = 2;
        buttonGroup.setLayoutData(buttonGroupLayoutData);
       
      _btnStartRuntime = new Button(buttonGroup, SWT.PUSH);
      _btnStartRuntime.setData(SWTBotIDs.WIDGET_KEY, ResourceIDs.SWTBOT_WGARUNTIME_EDITOR_BUTTON_START);
      _btnStartRuntime.setText("Start");

      _btnStartRuntime.setImage(WGADesignerPlugin.getDefault().getImageRegistry().get(WGADesignerPlugin.IMAGE_WGA_SERVER_START));
      _btnStartRuntime.addSelectionListener(new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent e) {
        try {
          StartWGARuntime.call(_model.getWgaRuntime());
          //_btnStartRuntime.setEnabled(false);
        } catch (Exception ex) {         
        }
      }
       
      });

     
      _btnStopRuntime = new Button(buttonGroup, SWT.PUSH);
      _btnStopRuntime.setText("Stop");
      _btnStopRuntime.setData(SWTBotIDs.WIDGET_KEY, ResourceIDs.SWTBOT_WGARUNTIME_EDITOR_BUTTON_STOP);
      _btnStopRuntime.setImage(WGADesignerPlugin.getDefault().getImageRegistry().get(WGADesignerPlugin.IMAGE_WGA_SERVER_STOP));
      _btnStopRuntime.addSelectionListener(new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent e) {
        try {
          StopWGARuntime.call();
          //_btnStopRuntime.setEnabled(false);
        } catch (Exception ex) {         
        }
      }
       
      });
     
     
      _btnRestartRuntime = new Button(buttonGroup, SWT.PUSH);
      _btnRestartRuntime.setText("Restart");

      _btnRestartRuntime.setImage(WGADesignerPlugin.getDefault().getImageRegistry().get(WGADesignerPlugin.IMAGE_WGA_SERVER_RESTART));
      _btnRestartRuntime.addSelectionListener(new SelectionAdapter() {

      @Override
      public void widgetSelected(SelectionEvent e) {
        try {
          RestartWGARuntime.call();
        } catch (Exception ex) {         
        }
      }
       
      });

      HyperlinkGroup group = new HyperlinkGroup(sectionClient.getDisplay());
     
      _linkOpenAdminPage = new Hyperlink(sectionClient, SWT.NONE);
      _linkOpenAdminPage.setText("Open Admin Page");
      _linkOpenAdminPage.addHyperlinkListener(new HyperlinkAdapter() {

      @Override
      public void linkActivated(HyperlinkEvent e) {
        OpenWGAAdminPage.call(_model.getWgaRuntime());
      }
       
      });     
      Label filler = new Label(sectionClient, SWT.NONE);
     
//      _linkOpenContentManager = new Hyperlink(sectionClient, SWT.NONE);
//      _linkOpenContentManager.setText("Open Content Manager");     
//      _linkOpenContentManager.addHyperlinkListener(new HyperlinkAdapter() {
//        @Override
//      public void linkActivated(HyperlinkEvent e) {
//          OpenContentManager.call(_model.getWgaRuntime());
//      }
//      });
     
      group.add(_linkOpenAdminPage);
     
      TomcatUtils.getInstance().addListener(this);
     
      //group.add(_linkOpenContentManager);
   
    // web app section
        _webAppSection = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
        _webAppSection.setText("Web Applications");

    List<WebApplication> apps = retrieveWebApplications();
    WGAConfiguration config = null;
    try {
      config = _model.getWgaRuntime().retrieveWGAConfig(false);
    } catch (Exception e2) {
      WGADesignerPlugin.getDefault().logError("Unable to read wga configuration." , e2);
    }
    _webAppModel = new WebApplicationsModel(apps, config);
   
    // register as runtime listener to refresh web app model on wga config changes
    _model.getWgaRuntime().addListener(this);
   
    ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
    ToolBar toolbar = toolBarManager.createControl(_webAppSection);
  
    Action action1 = new Action("refresh", WGADesignerPlugin.getDefault().getImageRegistry().getDescriptor(WGADesignerPlugin.IMAGE_REFRESH)) {
      public void run() {
        refreshWebApplications();       
      }


    };
    toolBarManager.add(action1);

    toolBarManager.update(true);
    _webAppSection.setTextClient(toolbar);



    sectionClient = toolkit.createComposite(_webAppSection);
    _webAppSection.setClient(sectionClient);
        sectionLayout = new GridLayout();
        sectionLayout.verticalSpacing  =0;
        sectionLayout.numColumns = 2;
        sectionClient.setLayout(sectionLayout);

       
        HyperlinkGroup generalHyperLinkGroup = new HyperlinkGroup(sectionClient.getDisplay());
     
      _linkCreateWebApp = new ImageHyperlink(sectionClient, SWT.NONE);
      _linkCreateWebApp.setText("Create new web application");     
      _linkCreateWebApp.setImage(WGADesignerPlugin.getDefault().getImageRegistry().get(WGADesignerPlugin.IMAGE_WGA_DESIGN_ADD));
      _linkCreateWebApp.addHyperlinkListener(new HyperlinkAdapter() {

      @Override
      public void linkActivated(HyperlinkEvent e) {
        try {
          WorkbenchUtils.openWizard(WGADesignerPlugin.getDefault().getWorkbench(), ResourceIDs.WIZARD_NEW_WGA_DESIGN, new SingleStructuredSelection(_model.getWgaRuntime().getProject()));
        } catch (CoreException e1) {
          WorkbenchUtils.showErrorDialog(WGADesignerPlugin.getDefault(), getSite().getShell(), "Unable to open wizard 'New WGADesign'", e1);
        }
      }
       
      });
     
           
      generalHyperLinkGroup.add(_linkCreateWebApp);
      filler = new Label(sectionClient, SWT.NONE);
     
 
     
     
       
        _tblWebApplications = new EditableTableControl<WebApplication>(sectionClient, SWT.NONE,SWT.BORDER|SWT.FULL_SELECTION) {

      @Override
      protected boolean isButtonAreaNeeded() {
        return false;
      }
         
     
        };
       
       
       
       
        GridData tblGridData = new GridData(GridData.FILL_BOTH);     
        tblGridData.minimumHeight = 200;
        tblGridData.verticalSpan = 5;
        _tblWebApplications.setLayoutData(tblGridData);
       
        String[] columnNames = new String[] { "Key", "Title", "Domain", "Design" };       
        _tblWebApplications.init(columnNames, _webAppModel);       
       
        Composite tableActionsContainer = new Composite(sectionClient, SWT.NONE);
        tableActionsContainer.setLayout(new GridLayout(1, false));
        tableActionsContainer.setLayoutData(new GridData(SWT.BEGINNING));
       
        GridData linkGridData = new GridData(SWT.BEGINNING);
        linkGridData.verticalAlignment = SWT.TOP;
        Label lblOpenIn = new Label(tableActionsContainer, SWT.NONE);
        lblOpenIn.setLayoutData(GridDataFactory.copyData(linkGridData));
        lblOpenIn.setText("open selected web application in ...");
       
       
        Hyperlink openInBrowser = new Hyperlink(tableActionsContainer, SWT.NONE);
        openInBrowser.setLayoutData(GridDataFactory.copyData(linkGridData));
        openInBrowser.setText("Browser");
        openInBrowser.addHyperlinkListener(new HyperlinkAdapter() {
          @Override
      public void linkActivated(HyperlinkEvent e) {
            handleOpenInBrowser();
          }
        });
       
        Hyperlink openInDesignEditor = new Hyperlink(tableActionsContainer, SWT.NONE);
        openInDesignEditor.setLayoutData(GridDataFactory.copyData(linkGridData));
        openInDesignEditor.setText("Design Editor");
        openInDesignEditor.addHyperlinkListener(new HyperlinkAdapter() {
          @Override
      public void linkActivated(HyperlinkEvent e) {
            handleOpenInDesignEditor();
          }
        });
       
        Hyperlink openInContentManager = new Hyperlink(tableActionsContainer, SWT.NONE);
        openInContentManager.setLayoutData(GridDataFactory.copyData(linkGridData));
      openInContentManager.setText("Content Manager");
      openInContentManager.addHyperlinkListener(new HyperlinkAdapter() {
          @Override
      public void linkActivated(HyperlinkEvent e) {
            handleOpenInContentManager();
          }
        });
     
      Hyperlink openInAdminClient = new Hyperlink(tableActionsContainer, SWT.NONE);
      openInAdminClient.setLayoutData(GridDataFactory.copyData(linkGridData));
      openInAdminClient.setText("Admin Client");
      openInAdminClient.addHyperlinkListener(new HyperlinkAdapter() {
          @Override
      public void linkActivated(HyperlinkEvent e) {
            handleOpenInAdminClient();
          }
        });
     
      generalHyperLinkGroup.add(openInBrowser);
      generalHyperLinkGroup.add(openInDesignEditor);
      generalHyperLinkGroup.add(openInContentManager);
      generalHyperLinkGroup.add(openInAdminClient);
       
      Label seperator = new Label(tableActionsContainer, SWT.SEPARATOR | SWT.HORIZONTAL);
      seperator.setLayoutData(new GridData(SWT.FILL));
     

        ImageHyperlink exportWebApplication = new ImageHyperlink(tableActionsContainer, SWT.NONE);     
        exportWebApplication.setText("Export web application");
        exportWebApplication.addHyperlinkListener(new HyperlinkAdapter() {
View Full Code Here

    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    container.setLayout(layout);
   
    Label label = new Label(container, SWT.NONE);
    label.setText("Available runtimes:");
   
    _lstRuntimes = new org.eclipse.swt.widgets.List(container, SWT.BORDER|SWT.SINGLE);
    _lstRuntimes.setLayoutData(new GridData(GridData.FILL_BOTH));
    _lstRuntimes.addSelectionListener(new SelectionAdapter() {
View Full Code Here

  protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.None);
    composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
    GridLayout layout = new GridLayout(2, false);
    composite.setLayout(layout);
    new Label(composite, SWT.NONE).setText("Mode name:");
    _text = new Text(composite, SWT.BORDER);
    GridData txtStyle = new GridData(GridData.FILL_HORIZONTAL);
    _text.setLayoutData(txtStyle);
    _text.addModifyListener(this);
    return composite;
View Full Code Here

  public Composite configSectionCreate(Composite parent) {
    // Seeding Automation Setup
    GridData gridData;
    GridLayout layout;
    Label label;

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

    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 0;
    gQR.setLayout(layout);
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gQR.setLayoutData(gridData);


    // ** Begin Rank Type area
    // Rank Type area.  Encompases the 4 (or more) options groups

    Composite cRankType = new Group(gQR, SWT.NULL);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.verticalSpacing = 2;
    cRankType.setLayout(layout);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    cRankType.setLayoutData(gridData);
    Messages.setLanguageText(cRankType, "ConfigView.label.seeding.rankType");

    // Seeds:Peer options
    RadioParameter rparamPeerSeed =
        new RadioParameter(cRankType, "StartStopManager_iRankType",
                           StartStopRulesDefaultPlugin.RANK_SPRATIO);
    Messages.setLanguageText(rparamPeerSeed.getControl(), "ConfigView.label.seeding.rankType.peerSeed");
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    rparamPeerSeed.setLayoutData(gridData);

    new Label(cRankType, SWT.NULL);


    // Seed Count options
    RadioParameter rparamSeedCount =
        new RadioParameter(cRankType, "StartStopManager_iRankType",
                           StartStopRulesDefaultPlugin.RANK_SEEDCOUNT);
    Messages.setLanguageText(rparamSeedCount.getControl(), "ConfigView.label.seeding.rankType.seed");
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    rparamSeedCount.setLayoutData(gridData);

    Group gSeedCount = new Group(cRankType, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 2;
    layout.marginWidth = 2;
    layout.numColumns = 3;
    gSeedCount.setLayout(layout);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.verticalSpan = 1;
    gSeedCount.setLayoutData(gridData);
    Messages.setLanguageText(gSeedCount, "ConfigView.label.seeding.rankType.seed.options");

    label = new Label(gSeedCount, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.label.seeding.rankType.seed.fallback");

    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    IntParameter intParamFallBack = new IntParameter(gSeedCount, "StartStopManager_iRankTypeSeedFallback");
    intParamFallBack.setLayoutData(gridData);

    Label labelFallBackSeeds = new Label(gSeedCount, SWT.NULL);
    label.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    Messages.setLanguageText(labelFallBackSeeds, "ConfigView.label.seeds");

    Control[] controlsSeedCount = { gSeedCount };
    rparamSeedCount.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(controlsSeedCount));

   
    // timed rotation ranking type
    RadioParameter rparamPeer =
        new RadioParameter(cRankType, "StartStopManager_iRankType",
                           StartStopRulesDefaultPlugin.RANK_PEERCOUNT);
    Messages.setLanguageText(rparamPeer.getControl(), "ConfigView.label.seeding.rankType.peer");
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    rparamPeer.setLayoutData(gridData);

    new Label(cRankType, SWT.NULL);

    // timed rotation ranking type
    RadioParameter rparamTimed =
        new RadioParameter(cRankType, "StartStopManager_iRankType",
                           StartStopRulesDefaultPlugin.RANK_TIMED);
    Messages.setLanguageText(rparamTimed.getControl(), "ConfigView.label.seeding.rankType.timedRotation");
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    rparamTimed.setLayoutData(gridData);

    new Label(cRankType, SWT.NULL);


    // No Ranking
    RadioParameter rparamNone =
        new RadioParameter(cRankType, "StartStopManager_iRankType",
                           StartStopRulesDefaultPlugin.RANK_NONE);
    Messages.setLanguageText(rparamNone.getControl(), "ConfigView.label.seeding.rankType.none");
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    rparamNone.setLayoutData(gridData);
   
    new Label(cRankType, SWT.NULL);
   
    // ** End Rank Type area


    Composite cNoTimeNone = new Composite(gQR, SWT.NULL);
    layout = new GridLayout();
    layout.numColumns = 2;
    cNoTimeNone.setLayout(layout);
    gridData = new GridData();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    cNoTimeNone.setLayoutData(gridData);
   
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    new BooleanParameter(cNoTimeNone,
                         "StartStopManager_bPreferLargerSwarms",
                         "ConfigView.label.seeding.preferLargerSwarms").setLayoutData(gridData);



    label = new Label(cNoTimeNone, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.label.minPeersToBoostNoSeeds"); //$NON-NLS-1$
    final String boostQRPeersLabels[] = new String[9];
    final int boostQRPeersValues[] = new int[9];
    String peers = MessageText.getString("ConfigView.text.peers");
    for (int i = 0; i < boostQRPeersValues.length; i++) {
View Full Code Here

   * Create the "Queue" Tab in the Configuration view
   */
  public Composite configSectionCreate(Composite parent) {
    GridData gridData;
    GridLayout layout;
    Label label;

    // main tab set up

    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);

    // row

    label = new Label(cSection, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.label.maxdownloads");
    gridData = new GridData();
    final IntParameter maxDLs = new IntParameter(cSection, "max downloads");
    maxDLs.setLayoutData(gridData);

    // row

    label = new Label(cSection, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.label.maxactivetorrents");
    gridData = new GridData();
    final IntParameter maxActiv = new IntParameter(cSection,
        "max active torrents");
    maxActiv.setLayoutData(gridData);

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

    ImageLoader imageLoader = ImageLoader.getInstance();
    label = new Label(cMaxActiveOptionsArea, SWT.NULL);
    imageLoader.setLabelImage(label, "subitem");
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    label.setLayoutData(gridData);

    gridData = new GridData();
    BooleanParameter maxActiveWhenSeedingEnabled = new BooleanParameter(
        cMaxActiveOptionsArea,
        "StartStopManager_bMaxActiveTorrentsWhenSeedingEnabled",
        "ConfigView.label.queue.maxactivetorrentswhenseeding");
    maxActiveWhenSeedingEnabled.setLayoutData(gridData);

    gridData = new GridData();

    final IntParameter maxActivWhenSeeding = new IntParameter(
        cMaxActiveOptionsArea, "StartStopManager_iMaxActiveTorrentsWhenSeeding");
    maxActivWhenSeeding.setLayoutData(gridData);

    // row

    label = new Label(cSection, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.label.mindownloads");
    gridData = new GridData();
    final IntParameter minDLs = new IntParameter(cSection, "min downloads");
    minDLs.setLayoutData(gridData);
    minDLs.setMaximumValue(maxDLs.getValue() / 2);
   
    // change controllers for above items

    maxActiveWhenSeedingEnabled.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
        maxActivWhenSeeding));

    maxDLs.addChangeListener(new ParameterChangeAdapter() {
      public void parameterChanged(Parameter p, boolean caused_internally) {
        int iMaxDLs = maxDLs.getValue();
        minDLs.setMaximumValue(iMaxDLs / 2);

        int iMinDLs = minDLs.getValue();
        int iMaxActive = maxActiv.getValue();
       
        if ((iMaxDLs == 0 || iMaxDLs > iMaxActive) && iMaxActive != 0) {
          maxActiv.setValue(iMaxDLs);
        }
      }
    });

    maxActiv.addChangeListener(new ParameterChangeAdapter() {
      public void parameterChanged(Parameter p, boolean caused_internally) {
        int iMaxDLs = maxDLs.getValue();
        int iMaxActive = maxActiv.getValue();

        if ((iMaxDLs == 0 || iMaxDLs > iMaxActive) && iMaxActive != 0) {
          maxDLs.setValue(iMaxActive);
        }
      }
    });

   
    // row
   
    final ArrayList values = new ArrayList();
    int exp = 29;
    for(int val = 0; val <= 8*1024*1024;)
    {
      values.add(new Integer(val));
      if(val < 256)
        val+=64;
      else if(val < 1024)
        val+=256;
      else if(val < 16*1024)
        val+=1024;
      else
        val = (int)(Math.pow(2, exp++/2) + (exp % 2 == 0 ? Math.pow(2(exp-3)/2) : 0));
    }
    String[] activeDLLabels = new String[values.size()];
    int[] activeDLValues = new int[activeDLLabels.length];
   

    label = new Label(cSection, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.label.minSpeedForActiveDL");
    for(int i=0;i<activeDLLabels.length;i++)
    {
      activeDLValues[i] = ((Integer)values.get(i)).intValue();
      activeDLLabels[i] = DisplayFormatters.formatByteCountToKiBEtcPerSec(
        activeDLValues[i], true);
     
    }
    new IntListParameter(cSection, "StartStopManager_iMinSpeedForActiveDL",
        activeDLLabels, activeDLValues);

    // row

    label = new Label(cSection, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.label.minSpeedForActiveSeeding");
    String[] activeSeedingLabels = new String[values.size()-4];
    int[] activeSeedingValues = new int[activeSeedingLabels.length];
    System.arraycopy(activeDLLabels, 0, activeSeedingLabels, 0, activeSeedingLabels.length);
    System.arraycopy(activeDLValues, 0, activeSeedingValues, 0, activeSeedingValues.length);

    new IntListParameter(cSection,
        "StartStopManager_iMinSpeedForActiveSeeding", activeSeedingLabels,
        activeSeedingValues);

    // subrow

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

    label = new Label(cMinSpeedActiveCDing, SWT.NULL);
    imageLoader.setLabelImage(label, "subitem");
    gridData = new GridData(GridData.VERTICAL_ALIGN_BEGINNING);
    label.setLayoutData(gridData);

    label = new Label(cMinSpeedActiveCDing, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.label.maxStalledSeeding");

    gridData = new GridData();
    final IntParameter maxStalledSeeding = new IntParameter(
        cMinSpeedActiveCDing, "StartStopManager_iMaxStalledSeeding");
View Full Code Here

  public Composite configSectionCreate(Composite parent) {
    // Seeding Automation Setup
    GridData gridData;
    GridLayout layout;
    Label label;
    Composite cArea, cArea1;

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

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


    label = new Label(cFirstPriorityArea, SWT.WRAP);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    gridData.widthHint = 300;
    label.setLayoutData(gridData);
    Messages.setLanguageText(label, "ConfigView.label.seeding.firstPriority.info");

    // ** Begin No Touch area 
 
// Group FP
 
  Composite cFP = new Group(cFirstPriorityArea, SWT.NULL);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.verticalSpacing = 6;
    cFP.setLayout(layout);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    cFP.setLayoutData(gridData);
  Messages.setLanguageText(cFP, "ConfigView.label.seeding.firstPriority.FP");
 
  // row
  cArea = new Composite(cFP, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 3;
    cArea.setLayout(layout);
  gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 3;
    cArea.setLayoutData(gridData);
  label = new Label(cArea, SWT.NULL);
  Messages.setLanguageText(label, "ConfigView.label.seeding.firstPriority");
  String fpLabels[] = { MessageText.getString("ConfigView.text.all"),
      MessageText.getString("ConfigView.text.any") };
  int fpValues[] = { DefaultRankCalculator.FIRSTPRIORITY_ALL,
      DefaultRankCalculator.FIRSTPRIORITY_ANY };
  new IntListParameter(cArea, "StartStopManager_iFirstPriority_Type",
      fpLabels, fpValues);
  label = new Label(cArea, SWT.NULL);
  Messages.setLanguageText(label, "ConfigView.label.seeding.firstPriority.following");

    // row
    label = new Label(cFP, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.label.seeding.firstPriority.shareRatio");
    String minQueueLabels[] = new String[55];
    int minQueueValues[] = new int[55];
    minQueueLabels[0] = "1:2 (" + 0.5 + ")";
    minQueueValues[0] = 500;
  minQueueLabels[1] = "3:4 (" + 0.75 +")";
  minQueueValues[1] = 750;
  minQueueLabels[2] = "1:1";
  minQueueValues[2] = 1000;
  minQueueLabels[3] = "5:4 (" + 1.25 +")";
  minQueueValues[3] = 1250;
  minQueueLabels[4] = "3:2 (" + 1.50 +")";
  minQueueValues[4] = 1500;
  minQueueLabels[5] = "7:4 (" + 1.75 +")";
  minQueueValues[5] = 1750;
    for (int i = 6; i < minQueueLabels.length; i++) {
      minQueueLabels[i] = i - 4 + ":1";
      minQueueValues[i] = (i - 4) * 1000;
    }
    new IntListParameter(cFP, "StartStopManager_iFirstPriority_ShareRatio",
                         minQueueLabels, minQueueValues);

  String sMinutes = MessageText.getString("ConfigView.text.minutes");
    String sHours = MessageText.getString("ConfigView.text.hours");
 
    // row
    label = new Label(cFP, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.label.seeding.firstPriority.DLMinutes");

    String dlTimeLabels[] = new String[15];
    int dlTimeValues[] = new int[15];
    dlTimeLabels[0] = MessageText.getString("ConfigView.text.ignore");
    dlTimeValues[0] = 0;
    for (int i = 1; i < dlTimeValues.length; i++) {
      dlTimeLabels[i] = "<= " + (i + 2) + " " + sHours ;
      dlTimeValues[i] = (i + 2) * 60;
    }
    new IntListParameter(cFP, "StartStopManager_iFirstPriority_DLMinutes",
                         dlTimeLabels, dlTimeValues);
 
  label = new Label(cFirstPriorityArea, SWT.WRAP);
 
    // row
    label = new Label(cFP, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.label.seeding.firstPriority.seedingMinutes");

    String seedTimeLabels[] = new String[15];
    int seedTimeValues[] = new int[15];
    seedTimeLabels[0] = MessageText.getString("ConfigView.text.ignore");
    seedTimeValues[0] = 0;
    seedTimeLabels[1] = "<= 90 " + sMinutes;
    seedTimeValues[1] = 90;
    for (int i = 2; i < seedTimeValues.length; i++) {
      seedTimeLabels[i] = "<= " + i + " " + sHours ;
      seedTimeValues[i] = i * 60;
    }
    new IntListParameter(cFP, "StartStopManager_iFirstPriority_SeedingMinutes",
                         seedTimeLabels, seedTimeValues);

 
 
//   Group Ignore FP
 
    Composite cIgnoreFP = new Group(cFirstPriorityArea, SWT.NULL);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.verticalSpacing = 6;
  cIgnoreFP.setLayout(layout);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
  cIgnoreFP.setLayoutData(gridData);
    Messages.setLanguageText(cIgnoreFP, "ConfigView.label.seeding.firstPriority.ignore");
 
  // Ignore S:P Ratio
  label = new Label(cIgnoreFP, SWT.NULL);
  Messages.setLanguageText(label, "ConfigView.label.seeding.firstPriority.ignoreSPRatio");
  String ignoreSPRatioLabels[] = new String[15];
    int ignoreSPRatioValues[] = new int[15];
  ignoreSPRatioLabels[0] = MessageText.getString("ConfigView.text.ignore");
  ignoreSPRatioValues[0] = 0;
    for (int i = 1; i < ignoreSPRatioLabels.length; i++) {
    ignoreSPRatioLabels[i] = i * 10 + " " + ":1" ;
    ignoreSPRatioValues[i] = i * 10;
    }
  new IntListParameter(cIgnoreFP, "StartStopManager_iFirstPriority_ignoreSPRatio", 0,
              ignoreSPRatioLabels, ignoreSPRatioValues);

  //   Ignore 0 Peers
    new BooleanParameter(cIgnoreFP,
                         "StartStopManager_bFirstPriority_ignore0Peer",
                         "ConfigView.label.seeding.firstPriority.ignore0Peer");

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

    // Ignore idle hours
    label = new Label(cIgnoreFP, SWT.NULL);
    Messages.setLanguageText(label,
        "ConfigView.label.seeding.firstPriority.ignoreIdleHours");
    int[] availIdleHours = { 2, 3, 4, 5, 6, 7, 8, 12, 18, 24, 48, 72, 168 };
    String ignoreIdleHoursLabels[] = new String[availIdleHours.length + 1];
    int ignoreIdleHoursValues[] = new int[availIdleHours.length + 1];
    ignoreIdleHoursLabels[0] = MessageText.getString("ConfigView.text.ignore");
    ignoreIdleHoursValues[0] = 0;
    for (int i = 0; i < availIdleHours.length; i++) {
      ignoreIdleHoursLabels[i + 1] = availIdleHours[i] + " " + sHours;
      ignoreIdleHoursValues[i + 1] = availIdleHours[i];
    }
    new IntListParameter(cIgnoreFP,
        "StartStopManager_iFirstPriority_ignoreIdleHours", 0,
        ignoreIdleHoursLabels, ignoreIdleHoursValues);

  //   row
  cArea1 = new Composite(cIgnoreFP, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    cArea1.setLayout(layout);
  gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 2;
    cArea1.setLayoutData(gridData);
  label = new Label(cArea1, SWT.NULL);
  Messages.setLanguageText(label, "ConfigView.label.seeding.firstPriority.ignore.info");


    return cFirstPriorityArea;
  }
View Full Code Here

          }
        }
      });
   
   
    Label explain = new Label(shell,SWT.WRAP);
    if(captureMode) {
      explain.setText(MessageText.getString("externalLogin.explanation.capture", new String[]{ name }));
    } else {
      explain.setText(MessageText.getString("externalLogin.explanation", new String[]{ name }));
    }
   
    browser = Utils.createSafeBrowser(shell, SWT.BORDER);
    if (browser == null) {
      shell.dispose();
      return;
    }
    final ExternalLoginCookieListener cookieListener = new ExternalLoginCookieListener(new CookiesListener() {
      public void cookiesFound(String cookies){
        foundCookies( cookies, true );
      }
    },browser);
   
    cookieListener.hook();
       
    Label separator = new Label(shell,SWT.SEPARATOR | SWT.HORIZONTAL);
   
    Button alt_method = null;
   
    if ( isMine ){
     
      alt_method = new Button(shell,SWT.CHECK);
     
      final Button f_alt_method = alt_method;
     
      alt_method.setText(MessageText.getString("externalLogin.auth_method_proxy"));
     
      alt_method.setSelection( authMode == WebEngine.AM_PROXY );
     
      alt_method.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event arg0) {
 
          setCaptureMethod( browser, !f_alt_method.getSelection(), true );
        }
      });
    }
   
    setCaptureMethod( browser, authMode == WebEngine.AM_TRANSPARENT, true );
       
    Button cancel = new Button(shell,SWT.PUSH);
    cancel.setText(MessageText.getString("Button.cancel"));
   
    Button done = new Button(shell,SWT.PUSH);
    done.setText(MessageText.getString("Button.done"));
   
    cancel.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event arg0) {
        if(listener != null) {
          listener.canceled(ExternalLoginWindow.this);
        }
        shell.dispose();
      }
    });
   
    done.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event arg0) {
        if(listener != null) {
          listener.done(ExternalLoginWindow.this,cookiesToString());
        }
        shell.dispose();
      }
    });
   
    FormData data;
   
    data =  new FormData();
    data.left = new FormAttachment(0,5);
    data.right = new FormAttachment(100,-5);
    data.top = new FormAttachment(0,5);
    explain.setLayoutData(data);
   
    data =  new FormData();
    data.left = new FormAttachment(0,5);
    data.right = new FormAttachment(100,-5);
    data.top = new FormAttachment(explain,5);
    data.bottom = new FormAttachment(separator,-5);
    browser.setLayoutData(data);
   
    data =  new FormData();
    data.left = new FormAttachment(0,0);
    data.right = new FormAttachment(100,0);
    data.bottom = new FormAttachment(cancel,-5);
    separator.setLayoutData(data);
   
    if ( isMine ){
     
      data =  new FormData();
      data.width = 100;
View Full Code Here

         
          current_composite.setLayout(layout);     
        }
      }
     
      Label label = null;
     
      String  label_key = param.getLabelKey();
     
      String  label_text = label_key==null?param.getLabelText():MessageText.getString( label_key );
       
        // we can only use the check-box's label form for boolean params if the text
        // doesn't include formatting (it doesn't handle it)
     
      if (   label_text.indexOf('\n') != -1 ||
          label_text.indexOf('\t') != -1 ||
          !(param instanceof BooleanParameterImpl)) {
       
        String hyperlink = null;
        if (param instanceof HyperlinkParameterImpl) {
          hyperlink = ((HyperlinkParameterImpl)param).getHyperlink();
        }

        label = new Label(current_composite, (param instanceof LabelParameterImpl) ? SWT.WRAP : SWT.NULL);
 
        boolean  add_copy;
       
        if ( label_key == null ){ 
          label.setText( param.getLabelText());
          add_copy = true;
        }else{
          Messages.setLanguageText(label, label_key );
          add_copy = label_key.startsWith( "!" );
        }
       
        if ( add_copy ){
          final Label f_label = label;
         
          ClipboardCopy.addCopyToClipMenu(
              label,
              new ClipboardCopy.copyToClipProvider()
              {
                public String
                getText()
                {
                  return( f_label.getText().trim());
                }
              });
        }
       
        if (hyperlink != null) {
          LinkLabel.makeLinkedLabel(label, hyperlink);
        }
       
        if (param instanceof HyperlinkParameterImpl) {
         
          final Label f_label = label;
         
          param.addListener(
              new ParameterListener()
              {
                public void
                parameterChanged(
                  org.gudy.azureus2.plugins.ui.config.Parameter  p )
                {
                  if ( f_label.isDisposed()){
             
                    param.removeListener( this );               
                  }else{
                   
                    final String hyperlink = ((HyperlinkParameterImpl)param).getHyperlink();
                   
                    if (hyperlink != null) {
                     
                      Utils.execSWTThread(
                        new Runnable()
                        {
                          public void
                          run()
                          {
                            LinkLabel.updateLinkedLabel(f_label, hyperlink);
                          }
                        });
                    }
                  }
                }
              });       
          }

      }
 
      String  key = param.getKey();
           
      //System.out.println( "key = " + key );
     
      final Parameter  swt_param;
     
      if ( param instanceof BooleanParameterImpl ){
       
        if ( label == null ){
         
          swt_param = new BooleanParameter(current_composite, key,
              ((BooleanParameterImpl) param).getDefaultValue(), param.getLabelKey());
        }else{
         
          swt_param = new BooleanParameter(current_composite, key, ((BooleanParameterImpl)param).getDefaultValue());
        }
       
        GridData data = new GridData();
        data.horizontalSpan = label==null?2:1;
        swt_param.setLayoutData(data);
         
        param.addListener(
          new ParameterListener()
          {
            public void
            parameterChanged(
              org.gudy.azureus2.plugins.ui.config.Parameter  p )
            {
              if ( swt_param.getControls()[0].isDisposed()){
         
                param.removeListener( this );
               
              }else{
               
                ((BooleanParameter)swt_param).setSelected(((BooleanParameterImpl)param).getValue());
              }
            }
          });
       
      }else if ( param instanceof IntParameterImpl ){
           
        IntParameterImpl int_param = (IntParameterImpl)param;
        swt_param = new IntParameter(current_composite, key,
            int_param.getDefaultValue());
       
        if (int_param.isLimited()) {
          ((IntParameter)swt_param).setMinimumValue(int_param.getMinValue());
          ((IntParameter)swt_param).setMaximumValue(int_param.getMaxValue());
        }
       
        param.addListener(
            new ParameterListener()
            {
              public void
              parameterChanged(
                org.gudy.azureus2.plugins.ui.config.Parameter  p )
              {
                if ( swt_param.getControls()[0].isDisposed()){
           
                  param.removeListener( this );
                 
                }else{
                 
                  ((IntParameter)swt_param).setValue(((IntParameterImpl)param).getValue());
                }
              }
            });
       
       
        GridData gridData = new GridData();
        gridData.widthHint = 100;
       
        swt_param.setLayoutData( gridData );
       
      }else if ( param instanceof ColorParameterImpl ) {
        final Composite area = new Composite(current_composite, SWT.NULL);
        //GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_HORIZONTAL );
        GridData gridData = new GridData();
        area.setLayoutData(gridData);
        layout = new GridLayout();
        layout.numColumns   = 2;
        layout.marginHeight = 0;
        layout.marginWidth   = 0;
        area.setLayout(layout);
       
        final ButtonParameter[] reset_button_holder = new ButtonParameter[1];
        final ColorParameterImpl color_param = (ColorParameterImpl)param;
        swt_param = new org.gudy.azureus2.ui.swt.config.ColorParameter(
            area, key, color_param.getRedValue(),
            color_param.getGreenValue(), color_param.getBlueValue()) {
         
          public void newColorSet() {
            color_param.reloadParamDataFromConfig(true);
            if (reset_button_holder[0] == null) {return;}
            reset_button_holder[0].getControl().setEnabled(true);
          }
        };
       
        // Reuse the same label as defined for Azureus UI reset buttons.
        reset_button_holder[0] = new ButtonParameter(area, "ConfigView.section.style.colorOverrides.reset");
        reset_button_holder[0].getControl().setEnabled(color_param.isOverridden());
        reset_button_holder[0].getControl().addListener(SWT.Selection, new Listener(){
          public void handleEvent(Event event) {
            reset_button_holder[0].getControl().setEnabled(false);
            color_param.resetToDefault();
            color_param.reloadParamDataFromConfig(false);
          }
        });
     
        gridData = new GridData();
        gridData.widthHint = 50;
       
        swt_param.setLayoutData( gridData );
      }else if ( param instanceof StringParameterImpl ){
       
        GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
       
        gridData.widthHint = 150;

        StringParameterImpl s_param = (StringParameterImpl)param;
       
        swt_param = new StringParameter(current_composite, key, s_param.getDefaultValue(), s_param.getGenerateIntermediateEvents());
       
        swt_param.setLayoutData( gridData );
       
      }else if ( param instanceof InfoParameterImpl ){
       
        GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
       
        gridData.widthHint = 150;
       
        swt_param = new InfoParameter(current_composite, key, "" );
       
        swt_param.setLayoutData( gridData );
       
      }else if ( param instanceof StringListParameterImpl ){
       
        StringListParameterImpl  sl_param = (StringListParameterImpl)param;
       
        GridData gridData = new GridData();
       
        gridData.widthHint = 150;

        swt_param = new StringListParameter(current_composite, key, sl_param.getDefaultValue(), sl_param.getLabels(), sl_param.getValues());
       
        swt_param.setLayoutData( gridData );
       
      }else if ( param instanceof PasswordParameterImpl ){
       
        GridData gridData = new GridData();
       
        gridData.widthHint = 150;

        swt_param = new PasswordParameter(current_composite, key, ((PasswordParameterImpl)param).getEncodingType());
       
        swt_param.setLayoutData( gridData );
       
      }else if ( param instanceof DirectoryParameterImpl || param instanceof org.gudy.azureus2.pluginsimpl.local.ui.config.FileParameter){
       
        Composite area = new Composite(current_composite, SWT.NULL);

        GridData gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_HORIZONTAL );
       
        area.setLayoutData(gridData);
       
        layout = new GridLayout();
       
        layout.numColumns   = 2;
        layout.marginHeight = 0;
        layout.marginWidth   = 0;
       
        area.setLayout(layout);
       
        if (param instanceof DirectoryParameterImpl) {
          swt_param = new DirectoryParameter(area, key, ((DirectoryParameterImpl)param).getDefaultValue());
        }
        else {
          org.gudy.azureus2.pluginsimpl.local.ui.config.FileParameter fp = (org.gudy.azureus2.pluginsimpl.local.ui.config.FileParameter)param;
          swt_param = new org.gudy.azureus2.ui.swt.config.FileParameter(area, key, fp.getDefaultValue(), fp.getFileExtensions());
        }
       
      }else if ( param instanceof ActionParameterImpl ){
       
        ActionParameterImpl  _param = (ActionParameterImpl)param;
       
        if ( _param.getStyle() == ActionParameter.STYLE_BUTTON ){
       
          swt_param = new ButtonParameter( current_composite, _param.getActionResource());
       
        }else{
         
          swt_param = new LinkParameter( current_composite, _param.getActionResource());         
        }
       
        swt_param.addChangeListener(
            new ParameterChangeAdapter()
            {
              public void
              parameterChanged(
                Parameter  p,
                boolean    caused_internally )
              {
                try {
                  param.parameterChanged( "" );
                } catch (Throwable t) {
                  Debug.out(t);
                }
              }
            });
      } else if ( param instanceof UIParameterImpl) {
        if (((UIParameterImpl)param).getContext() instanceof UISWTParameterContext) {
          UISWTParameterContext context = (UISWTParameterContext)((UIParameterImpl)param).getContext();
          Composite internal_composite = new Composite(current_composite, SWT.NULL);
          GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
          internal_composite.setLayoutData(gridData);
          boolean initialised_component = true;
          try {context.create(internal_composite);}
          catch (Exception e) {Debug.printStackTrace(e); initialised_component = false;}
         
          if (initialised_component) {
            swt_param = new UISWTParameter(internal_composite, param.getKey());
          }
          else {
            swt_param = null;
           
            // We're only expecting this for plugins which screw up their component generation,
            // so we don't care that this text is not localised.
            if (label != null) {label.setText("Error while generating UI component.");}
          }
        }
        else {
          swt_param = null;
        }
       
      }else{
       
          // label
       
        GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan  = 2;
        // for wrap to work
        gridData.widthHint = 300;
       
        label.setLayoutData( gridData );
       
        swt_param  = null;
      }
     
      if ( swt_param == null ){
       
        if ( label == null ){
          comp_map.put( param, new Object[]{ null });
        }else{
          comp_map.put( param, new Object[]{ null, label });
        }
       
      }else{
       
        Control[]  c = swt_param.getControls();
         
        Object[] moo = new Object[c.length+(label==null?1:2)];
         
        int  pos = 1;
       
        moo[0] = swt_param;
       
        if ( label != null){
          moo[pos++] = label;
        }
       
        for (int j=0;j<c.length;j++){
           
          moo[j+pos] = c[j];
        }
         
        comp_map.put( param, moo );
      }
    }
   
    // Only need one instance
    ParameterImplListener parameterImplListener = new ParameterImplListener() {
     
      public void enabledChanged(final ParameterImpl p) {
        final Object[] stuff = (Object[]) comp_map.get(p);

        if (stuff != null) {

          if (stuff[1] != null && ((Control) stuff[1]).isDisposed()) {
            // lazy tidyup
            p.removeImplListener(this);

          } else {

            Utils.execSWTThread(new AERunnable() {
              public void runSupport() {
                {
                  for (int k = 1; k < stuff.length; k++) {
                    if (stuff[k] instanceof Control)
                      ((Control) stuff[k]).setEnabled(p.isEnabled());
                  }

                }
              }
            });

          }
        }
      }

      public void labelChanged(final ParameterImpl p, final String text,
          final boolean bIsKey) {
        final Object[] stuff = (Object[]) comp_map.get(p);

        if (stuff == null)
          return;

        Label lbl;
        if (stuff[1] instanceof Label)
          lbl = (Label) stuff[1];
        else if (stuff[0] instanceof Label)
          lbl = (Label) stuff[0];
        else
          return;


        if (lbl.isDisposed()) {
          // lazy tidyup
          p.removeImplListener(this);
         
        } else {
          final Label finalLabel = lbl;

          Utils.execSWTThread(new AERunnable() {
            public void runSupport() {
              if (bIsKey)
                Messages.setLanguageText(finalLabel, text);
              else {
                finalLabel.setData("");
                finalLabel.setText(text);
              }
              finalLabel.getParent().layout(true);
            }
          });
        }
      }
    };
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.