Package org.eclipse.swt.layout

Examples of org.eclipse.swt.layout.GridData


  }

 

  public Composite configSectionCreate(final Composite parent) {
    GridData gridData;
    GridLayout layout;
    String initsMode = "";
    final String[] text = {""};
    final String[] messTexts = {"ConfigView.section.mode.beginner.wiki.definitions",
        "ConfigView.section.mode.intermediate.wiki.host",
        "ConfigView.section.mode.advanced.wiki.main",
        "ConfigView.section.mode.intermediate.wiki.publish"
    };
    final String[] links = {"http://wiki.vuze.com/w/This_funny_word",
        "http://wiki.vuze.com/w/HostingFiles",
        "http://wiki.vuze.com/w/Main_Page",
        "http://wiki.vuze.com/w/PublishingFiles"
    };
   
    int userMode = COConfigurationManager.getIntParameter("User Mode");

    final Composite cMode = new Composite(parent, SWT.WRAP);
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    cMode.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 4;
    layout.marginHeight = 0;
    cMode.setLayout(layout);
   
    gridData = new GridData();
    gridData.horizontalSpan = 4;
    final Group gRadio = new Group(cMode, SWT.WRAP);
    Messages.setLanguageText(gRadio, "ConfigView.section.mode.title");
    gRadio.setLayoutData(gridData);
    gRadio.setLayout(new RowLayout(SWT.HORIZONTAL));

    Button button0 = new Button (gRadio, SWT.RADIO);
    Messages.setLanguageText(button0, "ConfigView.section.mode.beginner");
    button0.setData("iMode", "0");
    button0.setData("sMode", "beginner.text");
   
    Button button1 = new Button (gRadio, SWT.RADIO);
    Messages.setLanguageText(button1, "ConfigView.section.mode.intermediate");
    button1.setData("iMode", "1");
    button1.setData("sMode", "intermediate.text");
   
    Button button2 = new Button (gRadio, SWT.RADIO);
    Messages.setLanguageText(button2, "ConfigView.section.mode.advanced");
    button2.setData("iMode", "2");
    button2.setData("sMode", "advanced.text");
   
    if ( userMode == 0) {
      initsMode = "beginner.text";
      button0.setSelection(true);
    } else if ( userMode == 1) {
      initsMode = "intermediate.text";
      button1.setSelection(true);
    } else {
      initsMode = "advanced.text";
      button2.setSelection(true);
    }

   
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    final Label label = new Label(cMode, SWT.WRAP);
    gridData.horizontalSpan = 4;
    label.setLayoutData(gridData);
  text[0] = MessageText.getString("ConfigView.section.mode." + initsMode);
  label.setText(text[0]);
  label.addListener (SWT.Selection, new Listener () {
    public void handleEvent(Event event) {
      Utils.launch(event.text);
    }
  });
 
  Group gWiki = new Group(cMode, SWT.WRAP);
    gridData = new GridData();
    gridData.widthHint = 350;
    gWiki.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 1;
    layout.marginHeight = 1;
    gWiki.setLayout(layout);
   
    gWiki.setText(MessageText.getString("Utils.link.visit"));

      final Label linkLabel = new Label(gWiki, SWT.NULL);
      linkLabel.setText( MessageText.getString( messTexts[userMode] ) );
      linkLabel.setData( links[userMode] );
      linkLabel.setCursor(linkLabel.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
      linkLabel.setForeground(Colors.blue);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalIndent = 10;
      linkLabel.setLayoutData( gridData );
      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());
        }
      });
     
      final Label linkLabel1 = new Label(gWiki, SWT.NULL);
      linkLabel1.setText( (userMode == 1)?MessageText.getString(messTexts[3]):"");
      linkLabel1.setData( links[3] );
      linkLabel1.setCursor(linkLabel1.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
      linkLabel1.setForeground(Colors.blue);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalIndent = 10;
      linkLabel1.setLayoutData( gridData );
      linkLabel1.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());
        }
      });

   
    Listener radioGroup = new Listener () {
      public void handleEvent (Event event) {
       
        Control [] children = gRadio.getChildren ();
       
        for (int j=0; j<children.length; j++) {
           Control child = children [j];
           if (child instanceof Button) {
             Button button = (Button) child;
             if ((button.getStyle () & SWT.RADIO) != 0) button.setSelection (false);
           }
        }

        Button button = (Button) event.widget;
        button.setSelection (true);
        int mode = Integer.parseInt((String)button.getData("iMode"));
        text[0] = MessageText.getString("ConfigView.section.mode." + (String)button.getData("sMode"));
        label.setText(text[0]);
        linkLabel.setText( MessageText.getString(messTexts[mode]) );
        linkLabel.setData( links[mode] );
        if(mode == 1){
          linkLabel1.setText( MessageText.getString(messTexts[3]) );
          linkLabel1.setData( links[3] );
        } else{
          linkLabel1.setText( "" );
          linkLabel1.setData( "" );
        }
        COConfigurationManager.setParameter("User Mode", Integer.parseInt((String)button.getData("iMode")));
        }
    };
   
    button0.addListener (SWT.Selection, radioGroup);
    button1.addListener (SWT.Selection, radioGroup);
    button2.addListener (SWT.Selection, radioGroup);

    Label padding = new Label(cMode, SWT.NULL );
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    padding.setLayoutData( gridData );
   
      // reset to defaults
   
  Composite gReset = new Composite(cMode, SWT.WRAP);
    gridData = new GridData();
    gridData.horizontalSpan = 4;
    gReset.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 3;
    gReset.setLayout(layout);

    Label reset_label = new Label(gReset, SWT.NULL );
    Messages.setLanguageText(reset_label, "ConfigView.section.mode.resetdefaults" );
   
    Button reset_button = new Button(gReset, SWT.PUSH);

    Messages.setLanguageText(reset_button, "Button.reset" );

    reset_button.addListener(SWT.Selection,
    new Listener()
    {
          public void
      handleEvent(Event event)
          {
            MessageBoxShell mb = new MessageBoxShell(
                SWT.ICON_WARNING | SWT.OK | SWT.CANCEL,
                MessageText.getString("resetconfig.warn.title"),
                MessageText.getString("resetconfig.warn"));
           
            mb.setDefaultButtonUsingStyle(SWT.CANCEL);
           
            mb.setParent(parent.getShell());

            mb.open(
              new UserPrompterResultListener()
              {
                public void
                prompterClosed(
                  int returnVal )
                {
              if (returnVal != SWT.OK) {
                return;
              }

              COConfigurationManager.resetToDefaults();
                }
              });
          }
      });
   
    padding = new Label(gReset, SWT.NULL );
    gridData = new GridData();
    padding.setLayoutData( gridData );
   
    return cMode;
  }
View Full Code Here


  public void configSectionDelete() {
  }
 

  public Composite configSectionCreate(final Composite parent) {
    GridData gridData;
    GridLayout layout;
    Label label;
   
    // main 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 = 4;
    gMainTab.setLayout(layout);
   
    int userMode = COConfigurationManager.getIntParameter("User Mode");
   
  if (userMode < REQUIRED_MODE) {
    label = new Label(gMainTab, SWT.WRAP);
    gridData = new GridData();
    label.setLayoutData(gridData);

    final String[] modeKeys = { CFG_PREFIX + "mode.beginner",
        CFG_PREFIX + "mode.intermediate",
        CFG_PREFIX + "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 gMainTab;
  }
   
      // MAIN TAB DATA

     // row
   
    if(userMode>0) { // XXX

    label = new Label(gMainTab, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.ip");

    final StringParameter tracker_ip = new StringParameter(gMainTab, "Tracker IP", "" );

    gridData = new GridData();
    gridData.widthHint = 120;
    tracker_ip.setLayoutData( gridData );

    Button check_button = new Button(gMainTab, SWT.PUSH);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    check_button.setLayoutData(gridData);
   
    Messages.setLanguageText(check_button, CFG_PREFIX + "tracker.checkip"); //$NON-NLS-1$

    final Display display = gMainTab.getDisplay();

    check_button.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
          IpCheckerWizard wizard = new IpCheckerWizard();
          wizard.setIpSetterCallBack(new IpSetterCallBack() {
              public void setIp(final String ip) {
                if(display == null || display.isDisposed())
                  return;
                  display.asyncExec(new AERunnable(){
                  public void runSupport() {
                    if(tracker_ip != null)
                      tracker_ip.setValue(ip);
                  }
                });
              }
           }); // setIPSetterCallback
         }
    });


    // row

    final BooleanParameter nonsslEnable =
        new BooleanParameter(gMainTab, "Tracker Port Enable",
                             CFG_PREFIX + "tracker.port");

    IntParameter tracker_port = new IntParameter(gMainTab, "Tracker Port", 0, 65535);

    gridData = new GridData();
    tracker_port.setLayoutData( gridData );

    final StringParameter tracker_port_backup = new StringParameter(gMainTab, "Tracker Port Backups", "" );

    gridData = new GridData();
    gridData.widthHint = 100;
    tracker_port_backup.setLayoutData( gridData );
   
    Label tracker_port_backup_label = new Label(gMainTab, SWT.NULL );
    Messages.setLanguageText(tracker_port_backup_label, CFG_PREFIX + "tracker.portbackup");

    Control[] non_ssl_controls = new Control[3];
    non_ssl_controls[0] = tracker_port.getControl();
    non_ssl_controls[1] = tracker_port_backup.getControl();
    non_ssl_controls[2] = tracker_port_backup_label;

    nonsslEnable.setAdditionalActionPerformer(new ChangeSelectionActionPerformer( non_ssl_controls ));

    // row

    final BooleanParameter sslEnable =
        new BooleanParameter(gMainTab, "Tracker Port SSL Enable",
                             CFG_PREFIX + "tracker.sslport");

    IntParameter tracker_port_ssl = new IntParameter(gMainTab,
          "Tracker Port SSL", 0, 65535);
    gridData = new GridData();
    tracker_port_ssl.setLayoutData( gridData );

    final StringParameter tracker_port_ssl_backup = new StringParameter(gMainTab, "Tracker Port SSL Backups", "" );

    gridData = new GridData();
    gridData.widthHint = 100;
    tracker_port_ssl_backup.setLayoutData( gridData );
   
    Label tracker_port_ssl_backup_label = new Label(gMainTab, SWT.NULL );
    Messages.setLanguageText(tracker_port_ssl_backup_label, CFG_PREFIX + "tracker.portbackup");

      // create cert row

    Label cert_label = new Label(gMainTab, SWT.NULL );
    Messages.setLanguageText(cert_label, CFG_PREFIX + "tracker.createcert");

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

    Messages.setLanguageText(cert_button, CFG_PREFIX + "tracker.createbutton");

    cert_button.addListener(SWT.Selection,
        new Listener()
      {
            public void
        handleEvent(Event event)
            {
              new CertificateCreatorWindow();
            }
        });
   
    Label ssl_faq_label = new Label(gMainTab, SWT.NULL);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    ssl_faq_label.setLayoutData(gridData);
    Messages.setLanguageText(ssl_faq_label, CFG_PREFIX + "tracker.sslport.info");
    final String linkFAQ = "http://plugins.vuze.com/faq.php#19";
    ssl_faq_label.setCursor(ssl_faq_label.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
    ssl_faq_label.setForeground(Colors.blue);
    ssl_faq_label.addMouseListener(new MouseAdapter() {
       public void mouseDoubleClick(MouseEvent arg0) {
         Utils.launch(linkFAQ);
       }
       public void mouseDown(MouseEvent arg0) {
         Utils.launch(linkFAQ);
       }
    });
   
    Control[] ssl_controls = {  
        tracker_port_ssl.getControl(),
        tracker_port_ssl_backup.getControl(),
        tracker_port_ssl_backup_label,
        ssl_faq_label,
        cert_label,
        cert_button };

    sslEnable.setAdditionalActionPerformer(new ChangeSelectionActionPerformer( ssl_controls ));

   
    // row

    gridData = new GridData();
    gridData.horizontalSpan = 1;
    new BooleanParameter(gMainTab, "Tracker Public Enable",
                         CFG_PREFIX + "tracker.publicenable").setLayoutData( gridData );

    label = new Label(gMainTab, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.publicenable.info");
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);
   
    // row
   
    BooleanParameter forcePortDetails =
        new BooleanParameter(gMainTab,  "Tracker Port Force External",
                             CFG_PREFIX + "tracker.forceport");

    label = new Label(gMainTab, SWT.NULL);
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);
   
   
    Control[] f_controls = new Control[1];
    f_controls[0] = forcePortDetails.getControl();

    IAdditionalActionPerformer f_enabler =
      new GenericActionPerformer(f_controls) {
        public void performAction()
        {
          boolean selected =  nonsslEnable.isSelected() ||
          sslEnable.isSelected();
   
          controls[0].setEnabled( selected );
        }
      };

    nonsslEnable.setAdditionalActionPerformer(f_enabler);
    sslEnable.setAdditionalActionPerformer(f_enabler);
   
    // row
      // add announce urls to hosted torrents
    BooleanParameter hostAddURLs =
        new BooleanParameter(gMainTab,  "Tracker Host Add Our Announce URLs",
                             CFG_PREFIX + "tracker.host.addurls");
  
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    hostAddURLs.setLayoutData( gridData );
   
    label = new Label(gMainTab, SWT.NULL);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    label.setLayoutData(gridData);
   
    // row

    gridData = new GridData();
    gridData.horizontalSpan = 1;
    final BooleanParameter passwordEnableWeb =
        new BooleanParameter(gMainTab, "Tracker Password Enable Web",
                             CFG_PREFIX + "tracker.passwordenableweb");
    passwordEnableWeb.setLayoutData( gridData );
   
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    final BooleanParameter passwordWebHTTPSOnly =
        new BooleanParameter(gMainTab, "Tracker Password Web HTTPS Only",
                             CFG_PREFIX + "tracker.passwordwebhttpsonly");
    passwordWebHTTPSOnly.setLayoutData( gridData );

    IAdditionalActionPerformer web_https_enabler =
        new GenericActionPerformer(passwordWebHTTPSOnly.getControls())
            {
              public void performAction()
              {
                boolean selected =    passwordEnableWeb.isSelected() &&
                      sslEnable.isSelected();
 
                for (int i=0;i<controls.length;i++){
                 
                  controls[i].setEnabled( selected );
                }
              }
            };

    passwordEnableWeb.setAdditionalActionPerformer(web_https_enabler);
    sslEnable.setAdditionalActionPerformer(web_https_enabler);

    // row

     final BooleanParameter passwordEnableTorrent =
      new BooleanParameter(gMainTab, "Tracker Password Enable Torrent",
                           CFG_PREFIX + "tracker.passwordenabletorrent");
    label = new Label(gMainTab, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.passwordenabletorrent.info");
    gridData = new GridData();
    gridData.horizontalSpan = 3;
    label.setLayoutData( gridData );

     // row

    label = new Label(gMainTab, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.username");

    final StringParameter tracker_username = new StringParameter(gMainTab, "Tracker Username", "" );

    gridData = new GridData();
    gridData.widthHint = 100;
    tracker_username.setLayoutData( gridData );

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

    label = new Label(gMainTab, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.password");

    final PasswordParameter tracker_password = new PasswordParameter(gMainTab, "Tracker Password" );

    gridData = new GridData();
    gridData.widthHint = 100;
    tracker_password.setLayoutData( gridData );

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

    Control[] x_controls = new Control[2];
    x_controls[0] = tracker_username.getControl();
    x_controls[1] = tracker_password.getControl();

    IAdditionalActionPerformer enabler =
        new GenericActionPerformer(x_controls)
            {
            public void performAction()
            {
              boolean selected =  passwordEnableWeb.isSelected() ||
                        passwordEnableTorrent.isSelected();

              for (int i=0;i<controls.length;i++){

                controls[i].setEnabled( selected );
              }
            }
            };

    passwordEnableWeb.setAdditionalActionPerformer(enabler);
    passwordEnableTorrent.setAdditionalActionPerformer(enabler);
   

   
      // Poll Group //
   
    Group gPollStuff = new Group(gMainTab, SWT.NULL);
    Messages.setLanguageText(gPollStuff, CFG_PREFIX + "tracker.pollinterval");
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 4;
    gPollStuff.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 4;
    gPollStuff.setLayout(layout);

    label = new Label(gPollStuff, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.pollintervalmin");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter pollIntervalMin = new IntParameter(gPollStuff, "Tracker Poll Interval Min");

    gridData = new GridData();
    pollIntervalMin.setLayoutData( gridData );

    label = new Label(gPollStuff, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.pollintervalmax");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter pollIntervalMax = new IntParameter(gPollStuff, "Tracker Poll Interval Max");

    gridData = new GridData();
    pollIntervalMax.setLayoutData( gridData );

    // row

    label = new Label(gPollStuff, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.pollintervalincby");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter pollIntervalIncBy = new IntParameter(gPollStuff, "Tracker Poll Inc By");

    gridData = new GridData();
    pollIntervalIncBy.setLayoutData( gridData );

    label = new Label(gPollStuff, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.pollintervalincper");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter pollIntervalIncPer = new IntParameter(gPollStuff, "Tracker Poll Inc Per");

    gridData = new GridData();
    pollIntervalIncPer.setLayoutData( gridData );

   
    // scrape + cache group

    Group gScrapeCache = new Group(gMainTab, SWT.NULL);
    Messages.setLanguageText(gScrapeCache, CFG_PREFIX + "tracker.scrapeandcache");
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 4;
    gScrapeCache.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 4;
    gScrapeCache.setLayout(layout);
   
    // row
   
    label = new Label(gScrapeCache, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.announcescrapepercentage");

    IntParameter scrapeannouncepercentage = new IntParameter(gScrapeCache, "Tracker Scrape Retry Percentage");

    gridData = new GridData();
    scrapeannouncepercentage.setLayoutData( gridData );
   
    label = new Label(gScrapeCache, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.scrapecacheperiod");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter scrapeCachePeriod = new IntParameter(gScrapeCache, "Tracker Scrape Cache");

    gridData = new GridData();
    scrapeCachePeriod.setLayoutData( gridData );
   
    // row

    label = new Label(gScrapeCache, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.announcecacheminpeers");

    IntParameter announceCacheMinPeers = new IntParameter(gScrapeCache, "Tracker Announce Cache Min Peers");

    gridData = new GridData();
    announceCacheMinPeers.setLayoutData( gridData );
   
    label = new Label(gScrapeCache, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.announcecacheperiod");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter announceCachePeriod = new IntParameter(gScrapeCache, "Tracker Announce Cache");

    gridData = new GridData();
    announceCachePeriod.setLayoutData( gridData );

   
    // main tab again
    // row

    label = new Label(gMainTab, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.maxpeersreturned");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter maxPeersReturned = new IntParameter(gMainTab, "Tracker Max Peers Returned");

    gridData = new GridData();
    maxPeersReturned.setLayoutData( gridData );

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

      // seed retention limit
   
    label = new Label(gMainTab, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.seedretention");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter seedRetentionLimit = new IntParameter(gMainTab, "Tracker Max Seeds Retained");

    gridData = new GridData();
    seedRetentionLimit.setLayoutData( gridData );

    label = new Label(gMainTab, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.seedretention.info");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    label.setLayoutData( gridData );

      // row

    gridData = new GridData();
    gridData.horizontalSpan = 2;
    new BooleanParameter(gMainTab, "Tracker NAT Check Enable",
                         CFG_PREFIX + "tracker.natcheckenable").setLayoutData( gridData );
   
    Composite gNATDetails = new Composite(gMainTab, SWT.NULL);
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 2;
    gNATDetails.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginHeight=0;
    layout.marginWidth=0;
    gNATDetails.setLayout(layout);
   
      // row
   
    label = new Label(gNATDetails, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.natchecktimeout");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter NATTimeout = new IntParameter(gNATDetails, "Tracker NAT Check Timeout");

    gridData = new GridData();
    NATTimeout.setLayoutData( gridData );

    // row
   
    gridData = new GridData();
    gridData.horizontalSpan = 4;
    new BooleanParameter(gMainTab, "Tracker Send Peer IDs",
                         CFG_PREFIX + "tracker.sendpeerids").setLayoutData(gridData);
   
    // row
    gridData = new GridData();
    gridData.horizontalSpan = 4;
    BooleanParameter  enable_udp =
      new BooleanParameter(gMainTab, "Tracker Port UDP Enable",
                         CFG_PREFIX + "tracker.enableudp");

    enable_udp.setLayoutData(gridData);
   
    // row
   
    Label udp_version_label = new Label(gMainTab, SWT.NULL);
    Messages.setLanguageText(udp_version_label,  CFG_PREFIX + "tracker.udpversion");
    gridData = new GridData();
    IntParameter  udp_version = new IntParameter(gMainTab, "Tracker Port UDP Version");
    udp_version.setLayoutData(gridData);
    label = new Label(gMainTab, SWT.NULL);
    label = new Label(gMainTab, SWT.NULL);

    enable_udp.setAdditionalActionPerformer(
        new ChangeSelectionActionPerformer( new Control[]{ udp_version_label, udp_version.getControl() }));

    // row
   
    gridData = new GridData();
    gridData.horizontalSpan = 4;
    new BooleanParameter(gMainTab, "Tracker Compact Enable",
                         CFG_PREFIX + "tracker.enablecompact").setLayoutData(gridData);
   
    // row

    gridData = new GridData();
    gridData.horizontalSpan = 4;
    BooleanParameter log_enable =
      new BooleanParameter(gMainTab, "Tracker Log Enable",
                         CFG_PREFIX + "tracker.logenable");
    log_enable.setLayoutData( gridData );
   
    if(userMode>1) { // XXX
   
    // row

    gridData = new GridData();
    gridData.horizontalSpan = 4;
    new BooleanParameter(gMainTab, "Tracker Key Enable Server",
                         CFG_PREFIX + "tracker.enablekey").setLayoutData(gridData);

    // Networks Group //
   
    Group networks_group = new Group( gMainTab, SWT.NULL );
    Messages.setLanguageText( networks_group, CFG_PREFIX + "tracker.server.group.networks" );
    GridData    networks_layout = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    networks_layout.horizontalSpan = 4;
    networks_group.setLayoutData( networks_layout );
    layout = new GridLayout();
    layout.numColumns = 2;
    networks_group.setLayout(layout);
       
    label = new Label(networks_group, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.server.group.networks.info");
    GridData grid_data = new GridData();
    grid_data.horizontalSpan = 2;
    label.setLayoutData( grid_data );
   
    for (int i=0;i<AENetworkClassifier.AT_NETWORKS.length;i++){
   
    String  nn = AENetworkClassifier.AT_NETWORKS[i];
 
    String  config_name = "Tracker Network Selection Default." + nn;
    String  msg_text  = CFG_PREFIX + "connection.networks." + nn;
    
    BooleanParameter network = new BooleanParameter(networks_group, config_name, msg_text );
       
      grid_data = new GridData();
      grid_data.horizontalSpan = 2;
      network.setLayoutData( grid_data );
  }
   
    // processing limits group //

    Group gProcessing = new Group(gMainTab, SWT.NULL);
    Messages.setLanguageText(gProcessing, CFG_PREFIX + "tracker.processinglimits");
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 4;
    gProcessing.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 3;
    gProcessing.setLayout(layout);
   
      // row annouce/scrape max process time
   
    label = new Label(gProcessing, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.maxgettime");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter maxGetTime = new IntParameter(gProcessing, "Tracker Max GET Time");
    gridData = new GridData();
    maxGetTime.setLayoutData( gridData );

    label = new Label(gProcessing, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.maxgettime.info");
  
    // row post multiplier
   
    label = new Label(gProcessing, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.maxposttimemultiplier");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter maxPostTimeMultiplier = new IntParameter(gProcessing, "Tracker Max POST Time Multiplier");

    gridData = new GridData();
    maxPostTimeMultiplier.setLayoutData( gridData );

    label = new Label(gProcessing, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.maxposttimemultiplier.info");
  
     // row max threads
   
    label = new Label(gProcessing, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.maxthreads");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter maxThreadsTime = new IntParameter(gProcessing, "Tracker Max Threads");
    maxThreadsTime.setMinimumValue(1);
    maxThreadsTime.setMaximumValue(4096);
    gridData = new GridData();
    maxThreadsTime.setLayoutData( gridData );

    label = new Label(gProcessing, SWT.NULL);
   
   
    // non-blocking tracker group //
   
    Group gNBTracker = new Group(gMainTab, SWT.NULL);
    Messages.setLanguageText(gNBTracker, CFG_PREFIX + "tracker.nonblocking");
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 4;
    gNBTracker.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 3;
    gNBTracker.setLayout(layout);
   
      // row

    gridData = new GridData();
    gridData.horizontalSpan = 3;
    BooleanParameter nb_enable =
      new BooleanParameter(gNBTracker, "Tracker TCP NonBlocking",
                         CFG_PREFIX + "tracker.tcpnonblocking");
    nb_enable.setLayoutData(gridData);

   // row max conc connections
   
    label = new Label(gNBTracker, SWT.NULL);
    Messages.setLanguageText(label, CFG_PREFIX + "tracker.nonblockingconcmax");
    gridData = new GridData();
    label.setLayoutData( gridData );

    IntParameter maxConcConn = new IntParameter(gNBTracker, "Tracker TCP NonBlocking Conc Max" );
    gridData = new GridData();
    maxConcConn.setLayoutData( gridData );

    label = new Label(gNBTracker, SWT.NULL);
   
    nb_enable.setAdditionalActionPerformer(new ChangeSelectionActionPerformer( maxConcConn.getControls() ));
View Full Code Here

    return 0;
  }


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

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

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

    final PlatformManager platform = PlatformManagerFactory.getPlatformManager();
   
      // ***** auto open group
   
    Group gAutoOpen = new Group(cDisplay, SWT.NULL);
    Messages.setLanguageText(gAutoOpen, LBLKEY_PREFIX + "autoopen");
    layout = new GridLayout(3, false);
    gAutoOpen.setLayout(layout);
    gAutoOpen.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));


    label = new Label(gAutoOpen, SWT.NULL);
    Messages.setLanguageText(label, LBLKEY_PREFIX + "autoopen.detailstab");
    new BooleanParameter(gAutoOpen, "Open Details", LBLKEY_PREFIX
        + "autoopen.dl");
    new BooleanParameter(gAutoOpen, "Open Seeding Details", LBLKEY_PREFIX
        + "autoopen.cd");


    label = new Label(gAutoOpen, SWT.NULL);
    Messages.setLanguageText(label, LBLKEY_PREFIX + "autoopen.downloadbars");
    new BooleanParameter(gAutoOpen, "Open Bar Incomplete", LBLKEY_PREFIX + "autoopen.dl");
    new BooleanParameter(gAutoOpen, "Open Bar Complete", LBLKEY_PREFIX + "autoopen.cd");
   
      // ****
   
    new BooleanParameter(cDisplay, "Remember transfer bar location", LBLKEY_PREFIX + "transferbar.remember_location");

    Group gSysTray = new Group(cDisplay, SWT.NULL);
    Messages.setLanguageText(gSysTray, LBLKEY_PREFIX + "systray");
    layout = new GridLayout();
    gSysTray.setLayout(layout);
    gSysTray.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));

    BooleanParameter est = new BooleanParameter(gSysTray, "Enable System Tray",
        KEY_PREFIX + "enabletray");

    BooleanParameter ctt = new BooleanParameter(gSysTray, "Close To Tray",
        LBLKEY_PREFIX + "closetotray");
    BooleanParameter mtt = new BooleanParameter(gSysTray, "Minimize To Tray",
        LBLKEY_PREFIX + "minimizetotray");
    BooleanParameter esttt = new BooleanParameter(gSysTray, "ui.systray.tooltip.enable",
        "ConfigView.label.enableSystrayToolTip");

    est.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
        ctt.getControls()));
    est.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
        mtt.getControls()));
    est.setAdditionalActionPerformer(new ChangeSelectionActionPerformer(
        esttt.getControls()));
   
        /**
         * Default download / upload limits available in the UI.
         */
        Group limit_group = new Group(cDisplay, SWT.NULL);
        Messages.setLanguageText(limit_group, LBLKEY_PREFIX + "set_ui_transfer_speeds");
        layout = new GridLayout();
        layout.numColumns = 2;
        limit_group.setLayout(layout);
        limit_group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
       
        Label limit_group_label = new Label(limit_group, SWT.WRAP);
        limit_group_label.setLayoutData(Utils.getWrappableLabelGridData(2, GridData.GRAB_HORIZONTAL));
        Messages.setLanguageText(limit_group_label, LBLKEY_PREFIX + "set_ui_transfer_speeds.description");
       
        String[] limit_types = new String[] {"download", "upload"};
        final String limit_type_prefix = "config.ui.speed.partitions.manual.";
        for (int i=0; i<limit_types.length; i++) {
          final BooleanParameter bp = new BooleanParameter(limit_group, limit_type_prefix + limit_types[i] + ".enabled", false, LBLKEY_PREFIX + "set_ui_transfer_speeds.description." + limit_types[i]);
          final StringParameter sp = new StringParameter(limit_group, limit_type_prefix + limit_types[i] + ".values", "");
          IAdditionalActionPerformer iaap = new GenericActionPerformer(new Control[] {}) {
            public void performAction() {
              sp.getControl().setEnabled(bp.isSelected())
            }
          };
         
            gridData = new GridData();
            gridData.widthHint = 150;
            sp.setLayoutData(gridData);
          iaap.performAction();
          bp.setAdditionalActionPerformer(iaap);
        }

    new BooleanParameter(cDisplay, "Send Version Info", LBLKEY_PREFIX
        + "allowSendVersion");

    Composite cArea = new Composite(cDisplay, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    cArea.setLayout(layout);
    cArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    new LinkLabel(cArea, LBLKEY_PREFIX + "version.info.link",
        "http://wiki.vuze.com/w/Version.azureusplatform.com");

    if (!Constants.isOSX) {

      BooleanParameter confirm = new BooleanParameter(cArea,
          "confirmationOnExit",
          "ConfigView.section.style.confirmationOnExit");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      confirm.setLayoutData(gridData);
    }
   
    cArea = new Composite(cDisplay, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    cArea.setLayout(layout);
    cArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // clear remembered decisions

    final Label clear_label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(clear_label, KEY_PREFIX + "cleardecisions");

    final Button clear_decisions = new Button(cArea, SWT.PUSH);
    Messages.setLanguageText(clear_decisions, KEY_PREFIX
        + "cleardecisionsbutton");

    clear_decisions.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {

        COConfigurationManager.setParameter("MessageBoxWindow.decisions",
            new HashMap());
      }
    });

    final Label clear_tracker_label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(clear_tracker_label, KEY_PREFIX + "cleartrackers");

    final Button clear_tracker_button = new Button(cArea, SWT.PUSH);
    Messages.setLanguageText(clear_tracker_button, KEY_PREFIX
        + "cleartrackersbutton");
   
    clear_tracker_button.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        TrackersUtil.getInstance().clearAllTrackers(true);
      }
    });
   
    final Label clear_save_path_label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(clear_save_path_label, KEY_PREFIX + "clearsavepaths");

    final Button clear_save_path_button = new Button(cArea, SWT.PUSH);
    Messages.setLanguageText(clear_save_path_button, KEY_PREFIX
        + "clearsavepathsbutton");
   
    clear_save_path_button.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        COConfigurationManager.setParameter("saveTo_list", new StringListImpl());
      }
    });
   
    decisions_parameter_listener = new ParameterListener() {
      public void parameterChanged(String parameterName) {
        if (clear_decisions.isDisposed()) {

          // tidy up from previous incarnations

          COConfigurationManager.removeParameterListener(
              "MessageBoxWindow.decisions", this);

        } else {

          boolean enabled = COConfigurationManager.getMapParameter(
              "MessageBoxWindow.decisions", new HashMap()).size() > 0;

          clear_label.setEnabled(enabled);
          clear_decisions.setEnabled(enabled);
        }
      }
    };

    decisions_parameter_listener.parameterChanged(null);

    COConfigurationManager.addParameterListener("MessageBoxWindow.decisions",
        decisions_parameter_listener);

    // drag-drop
    /* gone to comply with whateverooo
    label = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.section.style.dropdiraction");

    String[] drop_options = {
        "ConfigView.section.style.dropdiraction.opentorrents",
        "ConfigView.section.style.dropdiraction.sharefolder",
        "ConfigView.section.style.dropdiraction.sharefoldercontents",
        "ConfigView.section.style.dropdiraction.sharefoldercontentsrecursive", };

    String dropLabels[] = new String[drop_options.length];
    String dropValues[] = new String[drop_options.length];
    for (int i = 0; i < drop_options.length; i++) {

      dropLabels[i] = MessageText.getString(drop_options[i]);
      dropValues[i] = "" + i;
    }
    new StringListParameter(cArea, "config.style.dropdiraction",
        dropLabels, dropValues);
    */
   
    // reset associations

    if (platform.hasCapability(PlatformManagerCapabilities.RegisterFileAssociations)) {

      Composite cResetAssoc = new Composite(cArea, SWT.NULL);
      layout = new GridLayout();
      layout.marginHeight = 0;
      layout.marginWidth = 0;
      layout.numColumns = 2;
      cResetAssoc.setLayout(layout);
      cResetAssoc.setLayoutData(new GridData());

      label = new Label(cResetAssoc, SWT.NULL);
      Messages.setLanguageText(label, KEY_PREFIX + "resetassoc");

      Button reset = new Button(cResetAssoc, SWT.PUSH);
View Full Code Here

    fillPieceInfoSection();
  }

  private Composite createPeerInfoPanel(Composite parent) {
    GridLayout layout;
    GridData gridData;

    // Peer Info section contains
    // - Peer's Block display
    // - Peer's Datarate
    pieceInfoComposite = new Composite(parent, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    pieceInfoComposite.setLayout(layout);
    gridData = new GridData(GridData.FILL, GridData.FILL, true, true);
    pieceInfoComposite.setLayoutData(gridData);

    imageLabel = new Label(pieceInfoComposite, SWT.NULL);
    gridData = new GridData();
    imageLabel.setLayoutData(gridData);

    topLabel = new Label(pieceInfoComposite, SWT.NULL);
    gridData = new GridData(SWT.FILL, SWT.DEFAULT, false, false);
    topLabel.setLayoutData(gridData);

    sc = new ScrolledComposite(pieceInfoComposite, SWT.V_SCROLL);
    sc.setExpandHorizontal(true);
    sc.setExpandVertical(true);
    layout = new GridLayout();
    layout.horizontalSpacing = 0;
    layout.verticalSpacing = 0;
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    sc.setLayout(layout);
    gridData = new GridData(GridData.FILL, GridData.FILL, true, true, 2, 1);
    sc.setLayoutData(gridData);
    sc.getVerticalBar().setIncrement(BLOCK_SIZE);

    pieceInfoCanvas = new Canvas(sc, SWT.NO_REDRAW_RESIZE | SWT.NO_BACKGROUND);
    gridData = new GridData(GridData.FILL, SWT.DEFAULT, true, false);
    pieceInfoCanvas.setLayoutData(gridData);
    pieceInfoCanvas.addPaintListener(new PaintListener() {
      public void paintControl(PaintEvent e) {
        if (e.width <= 0 || e.height <= 0)
          return;
        try {
          Rectangle bounds = (img == null) ? null : img.getBounds();
          if (bounds == null) {
            e.gc.fillRectangle(e.x, e.y, e.width, e.height);
          } else {
            if (e.x + e.width > bounds.width)
              e.gc.fillRectangle(bounds.width, e.y, e.x + e.width
                  - bounds.width + 1, e.height);
            if (e.y + e.height > bounds.height)
              e.gc.fillRectangle(e.x, bounds.height, e.width, e.y + e.height
                  - bounds.height + 1);

            int width = Math.min(e.width, bounds.width - e.x);
            int height = Math.min(e.height, bounds.height - e.y);
            e.gc.drawImage(img, e.x, e.y, width, height, e.x, e.y, width,
                height);
          }
        } catch (Exception ex) {
        }
      }
    });
    Listener doNothingListener = new Listener() {
      public void handleEvent(Event event) {
      }
    };
    pieceInfoCanvas.addListener(SWT.KeyDown, doNothingListener);

    pieceInfoCanvas.addListener(SWT.Resize, new Listener() {
      public void handleEvent(Event e) {
        synchronized (PieceInfoView.this) {
          if (alreadyFilling) {
            return;
          }
         
          alreadyFilling = true;
        }

        // wrap in asyncexec because sc.setMinWidth (called later) doesn't work
        // too well inside a resize (the canvas won't size isn't always updated)
        Utils.execSWTThreadLater(0, new AERunnable() {
          public void runSupport() {
            if (img != null) {
              int iOldColCount = img.getBounds().width / BLOCK_SIZE;
              int iNewColCount = pieceInfoCanvas.getClientArea().width
                  / BLOCK_SIZE;
              if (iOldColCount != iNewColCount)
                refreshInfoCanvas();
            }
            synchronized (PieceInfoView.this) {
              alreadyFilling = false;
            }
          }
        });
      }
    });

    sc.setContent(pieceInfoCanvas);

    Legend.createLegendComposite(pieceInfoComposite,
        blockColors, new String[] {
          "PiecesView.BlockView.Have",
          "PiecesView.BlockView.NoHave",
          "PeersView.BlockView.Transfer",
          "PeersView.BlockView.NextRequest",
          "PeersView.BlockView.AvailCount"
        }, new GridData(SWT.FILL, SWT.DEFAULT, true, false, 2, 1));

    int iFontPixelsHeight = 10;
    int iFontPointHeight = (iFontPixelsHeight * 72)
        / pieceInfoCanvas.getDisplay().getDPI().y;
    Font f = pieceInfoCanvas.getFont();
View Full Code Here

  public void configSectionDelete() {
  }

  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;
    cSection.setLayout(layout);

    int userMode = COConfigurationManager.getIntParameter("User Mode");
    if (userMode < REQUIRED_MODE) {
      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;
    }

    // locale decoder
    label = new Label(cSection, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.section.file.decoder.label");

    LocaleUtilDecoder[] decoders = LocaleUtil.getSingleton().getDecoders();

    String decoderLabels[] = new String[decoders.length + 1];
    String decoderValues[] = new String[decoders.length + 1];

    decoderLabels[0] = MessageText.getString("ConfigView.section.file.decoder.nodecoder");
    decoderValues[0] = "";

    for (int i = 1; i <= decoders.length; i++) {
      decoderLabels[i] = decoderValues[i] = decoders[i - 1].getName();
    }
    new StringListParameter(cSection, "File.Decoder.Default", "",
        decoderLabels, decoderValues);

    // locale always prompt

    gridData = new GridData();
    gridData.horizontalSpan = 2;
    new BooleanParameter(cSection, "File.Decoder.Prompt",
        "ConfigView.section.file.decoder.prompt").setLayoutData(gridData);

    // show lax decodings

    gridData = new GridData();
    gridData.horizontalSpan = 2;
    new BooleanParameter(cSection, "File.Decoder.ShowLax",
        "ConfigView.section.file.decoder.showlax").setLayoutData(gridData);

    // show all decoders

    gridData = new GridData();
    gridData.horizontalSpan = 2;
    new BooleanParameter(cSection, "File.Decoder.ShowAll",
        "ConfigView.section.file.decoder.showall").setLayoutData(gridData);

    return cSection;
View Full Code Here

        wizard.setErrorMessage(error);
        wizard.setNextEnabled(!((NewTorrentWizard) wizard).singlePath.equals("") && error.equals(""));
      }
    });
    file.setText(((NewTorrentWizard) wizard).singlePath);
    GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
    file.setLayoutData(gridData);
   
    Button browse = new Button(panel, SWT.PUSH);
    browse.addListener(SWT.Selection, new Listener() {
      /*
       * (non-Javadoc)
       *
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event arg0) {
        FileDialog fd = new FileDialog(wizard.getWizardWindow());
        if (wizard.getErrorMessage().equals("") && !((NewTorrentWizard) wizard).singlePath.equals("")) {
          fd.setFileName(((NewTorrentWizard) wizard).singlePath);
        }else{
          String  def = ((NewTorrentWizard) wizard).getDefaultOpenDir();
         
          if ( def.length() > 0 & new File(def).isDirectory() ){
           
            fd.setFilterPath( def );
          }
        }
        String f = fd.open();
        if (f != null){
            file.setText(f);
           
            File  ff = new File(f);
           
            String  parent = ff.getParent();
           
            if ( parent != null ){
             
              ((NewTorrentWizard) wizard).setDefaultOpenDir( parent );
            }
          }

      }
    });
    Messages.setLanguageText(browse, "wizard.browse");

    label = new Label(panel, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);
    label.setText("\n");

    label = new Label(panel, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    label.setLayoutData(gridData);
    label.setForeground(Colors.blue);
    Messages.setLanguageText(label, "wizard.hint.file");
  }
View Full Code Here



    public Composite configSectionCreate(final Composite parent) {

        GridData gridData;

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

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

        //add a comment to the debug log.
        ///////////////////////////////////
        // Comment group
        ///////////////////////////////////
        //comment grouping.
        commentGroup = new Group(cSection, SWT.NULL);
        Messages.setLanguageText(commentGroup,"ConfigTransferAutoSpeed.add.comment.to.log.group");
        GridLayout commentLayout = new GridLayout();
        commentLayout.numColumns = 3;
        commentGroup.setLayout(commentLayout);
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        commentGroup.setLayoutData(gridData);

        //Label
        Label commentLabel = new Label(commentGroup,SWT.NULL);
        Messages.setLanguageText(commentLabel,"ConfigTransferAutoSpeed.add.comment.to.log");
        gridData = new GridData();
        gridData.horizontalSpan=1;
        commentLabel.setLayoutData(gridData);

        //Text-Box
        final Text commentBox = new Text(commentGroup, SWT.BORDER);
        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan=1;
        commentBox.setText("");
        commentBox.setLayoutData(gridData);


        //button
        Button commentButton = new Button( commentGroup, SWT.PUSH);
        //Messages.
        gridData = new GridData();
        gridData.horizontalSpan=1;
        commentButton.setLayoutData(gridData);
        Messages.setLanguageText(commentButton,"ConfigTransferAutoSpeed.log.button");
        commentButton.addListener(SWT.Selection, new Listener(){
            public void handleEvent(Event event){
                //Add a file to the log.
                AEDiagnosticsLogger dLog = AEDiagnostics.getLogger("AutoSpeed");
                String comment = commentBox.getText();
                if(comment!=null){
                    if( comment.length()>0){
                        dLog.log( "user-comment:"+comment );
                        commentBox.setText("");
                    }
                }
            }
        });

        //spacer
        Label commentSpacer = new Label(cSection, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan=3;
        commentSpacer.setLayoutData(gridData);

               

        ///////////////////////////
        // Upload Capacity used settings.
        ///////////////////////////
        uploadCapGroup = new Group(cSection, SWT.NULL);
        Messages.setLanguageText(uploadCapGroup,"ConfigTransferAutoSpeed.upload.capacity.usage");

        GridLayout uCapLayout = new GridLayout();
        uCapLayout.numColumns = 2;
        uploadCapGroup.setLayout(uCapLayout);

        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 3;
        uploadCapGroup.setLayoutData(gridData);

        //Label column
        Label upCapModeLbl = new Label(uploadCapGroup, SWT.NULL);
        gridData = new GridData();
        upCapModeLbl.setLayoutData(gridData);
        Messages.setLanguageText(upCapModeLbl,"ConfigTransferAutoSpeed.mode");


        Label ucSetLbl = new Label(uploadCapGroup, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan = 2;
        Messages.setLanguageText(ucSetLbl,"ConfigTransferAutoSpeed.capacity.used");

        Label dlModeLbl = new Label(uploadCapGroup, SWT.NULL);
        gridData = new GridData();
        Messages.setLanguageText(dlModeLbl,"ConfigTransferAutoSpeed.while.downloading");

        //add a drop down.
        String[] downloadModeNames = {
                " 80%",
                " 70%",
                " 60%",
                " 50%"
        };

        int[] downloadModeValues = {
                80,
                70,
                60,
                50
        };

        downloadModeUsedCap = new IntListParameter(uploadCapGroup,
                SpeedLimitMonitor.USED_UPLOAD_CAPACITY_DOWNLOAD_MODE,
                downloadModeNames, downloadModeValues);


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

        //////////////////////////
        // DHT Ping Group
        //////////////////////////

        dhtGroup = new Group(cSection, SWT.NULL);
        Messages.setLanguageText(dhtGroup,"ConfigTransferAutoSpeed.data.update.frequency");
        dhtGroup.setLayout(subPanel);

        gridData = new GridData(GridData.FILL_HORIZONTAL);
        gridData.horizontalSpan = 3;
        dhtGroup.setLayoutData(gridData);

//        //label column for Vivaldi limits
//        Label dhtSetting = new Label(dhtGroup, SWT.NULL);
//        gridData = new GridData();
//        //dhtSetting.setText("DHT Ping Settings: ");
//        Messages.setLanguageText(dhtSetting,"ConfigTransferAutoSpeed.set.dht.ping");
//
//        Label dSet = new Label(dhtGroup,SWT.NULL);
//        gridData = new GridData();
//        dSet.setLayoutData(gridData);
//        //dSet.setText("set point (ms)");
//        Messages.setLanguageText(dSet,"ConfigTransferAutoSpeed.set.point");
//
//        Label dTol = new Label(dhtGroup, SWT.NULL);
//        gridData = new GridData();
//        dTol.setLayoutData(gridData);
//        //dTol.setText("tolerance (ms)");
//        Messages.setLanguageText(dTol,"ConfigTransferAutoSpeed.set.tolerance");
//
//        //good
//        Label dGoodLbl = new Label(dhtGroup, SWT.NULL);
//        gridData = new GridData();
//        dGoodLbl.setLayoutData(gridData);
//        //dGoodLbl.setText("Good: ");
//        Messages.setLanguageText(dGoodLbl,"ConfigTransferAutoSpeed.ping.time.good");
//
//
//        gridData = new GridData();
//        dGood = new IntParameter(dhtGroup, SpeedManagerAlgorithmProviderV2.SETTING_DHT_GOOD_SET_POINT);
//        dGood.setLayoutData( gridData );
//
//        gridData = new GridData();
//        dGoodTol = new IntParameter(dhtGroup, SpeedManagerAlgorithmProviderV2.SETTING_DHT_GOOD_TOLERANCE);
//        dGoodTol.setLayoutData( gridData );
//
//        //bad
//        Label dBadLbl = new Label(dhtGroup, SWT.NULL);
//        gridData = new GridData();
//        dBadLbl.setLayoutData(gridData);
//        //dBadLbl.setText("Bad: ");
//        Messages.setLanguageText(dBadLbl,"ConfigTransferAutoSpeed.ping.time.bad");
//
//
//        gridData = new GridData();
//        dBad = new IntParameter(dhtGroup, SpeedManagerAlgorithmProviderV2.SETTING_DHT_BAD_SET_POINT);
//        dBad.setLayoutData( gridData );
//
//
//        gridData = new GridData();
//        dBadTol = new IntParameter(dhtGroup, SpeedManagerAlgorithmProviderV2.SETTING_DHT_BAD_TOLERANCE);
//        dBadTol.setLayoutData( gridData );
//
//        //spacer
//        cSpacer = new Label(cSection, SWT.NULL);
//        gridData = new GridData();
//        gridData.horizontalSpan=1;
//        cSpacer.setLayoutData(gridData);

        //how much data to accumulate before making an adjustment.
        Label iCount = new Label(dhtGroup, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan=2;
        gridData.horizontalAlignment=GridData.BEGINNING;
        iCount.setLayoutData(gridData);
        //iCount.setText("Adjustment interval: ");
        Messages.setLanguageText(iCount,"ConfigTransferAutoSpeed.adjustment.interval");

        adjustmentInterval = new IntParameter(dhtGroup, SpeedManagerAlgorithmProviderV2.SETTING_INTERVALS_BETWEEN_ADJUST);
        gridData = new GridData();
        adjustmentInterval.setLayoutData(gridData);

        //spacer
        cSpacer = new Label(cSection, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan=1;
        cSpacer.setLayoutData(gridData);

        //how much data to accumulate before making an adjustment.
        Label skip = new Label(dhtGroup, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan=2;
        gridData.horizontalAlignment=GridData.BEGINNING;
        skip.setLayoutData(gridData);
        //skip.setText("Skip after adjustment: ");
        Messages.setLanguageText(skip,"ConfigTransferAutoSpeed.skip.after.adjust");

        skipAfterAdjustment = new BooleanParameter(dhtGroup, SpeedManagerAlgorithmProviderV2.SETTING_WAIT_AFTER_ADJUST);
        gridData = new GridData();
        skipAfterAdjustment.setLayoutData(gridData);

        //spacer
        cSpacer = new Label(cSection, SWT.NULL);
        gridData = new GridData();
        gridData.horizontalSpan=3;
        cSpacer.setLayoutData(gridData);

        return cSection;
    }
View Full Code Here

    Utils.setShellIcon(shell);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    shell.setLayout(layout);
   
    GridData gridData;
   
    if ( !anonymous ){
     
      Label labelName = new Label(shell,SWT.NULL);
      Messages.setLanguageText(labelName,"wizard.multitracker.edit.name");
     
      textName = new Text(shell,SWT.BORDER);
      textName.setText(currentName);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 2;
      textName.setLayoutData(gridData);
      textName.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent arg0) {
          currentName = textName.getText();
          computeSaveEnable();
        }
      });  
    }
       
    treeGroups = new Tree(shell,SWT.BORDER);
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.horizontalSpan = 3;
    gridData.heightHint = 150;
    treeGroups.setLayoutData(gridData);
   
    treeGroups.addMouseListener(
        new MouseAdapter()
        {
          public void
          mouseDoubleClick(
            MouseEvent arg0 )
          {
            if(treeGroups.getSelectionCount() == 1) {
              TreeItem treeItem = treeGroups.getSelection()[0];
              String type = (String) treeItem.getData("type");
              if(type.equals("tracker")) {
                editTreeItem(treeItem);
              }
            }
          }
        });
       
    Label labelSeparator = new Label(shell,SWT.SEPARATOR | SWT.HORIZONTAL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    labelSeparator.setLayoutData(gridData);
   
      // button row
   
    Label label = new Label(shell,SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL );
    label.setLayoutData(gridData);
   
    Composite cButtons = new Composite(shell, SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 3;
    cButtons.setLayoutData(gridData);
    GridLayout layoutButtons = new GridLayout();
    layoutButtons.numColumns = 3;
    cButtons.setLayout(layoutButtons);
    label = new Label(cButtons,SWT.NULL);
    gridData = new GridData(GridData.FILL_HORIZONTAL );
    label.setLayoutData(gridData);
   
    btnSave = new Button(cButtons,SWT.PUSH);
    gridData = new GridData();
    gridData.widthHint = 70;
    gridData.horizontalAlignment = GridData.END;
    btnSave.setLayoutData(gridData);
    Messages.setLanguageText(btnSave,"wizard.multitracker.edit.save");
    btnSave.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event e) {
        update();
        shell.dispose();
      }
    });
   
    btnCancel = new Button(cButtons,SWT.PUSH);
    gridData = new GridData();
    gridData.horizontalAlignment = GridData.END;
    gridData.widthHint = 70;
    btnCancel.setLayoutData(gridData);
    Messages.setLanguageText(btnCancel,"Button.cancel");
    btnCancel.addListener(SWT.Selection, new Listener() {
View Full Code Here

    Label label = new Label(shell, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.section.ipfilter.description");

    final Text textDescription = new Text(shell, SWT.BORDER);
    GridData gridData = new GridData();
    gridData.widthHint = 300;
    textDescription.setLayoutData(gridData);

    label = new Label(shell, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.section.ipfilter.start");

    final Text textStartIp = new Text(shell, SWT.BORDER);
    gridData = new GridData();
    gridData.widthHint = 120;
    textStartIp.setLayoutData(gridData);

    label = new Label(shell, SWT.NULL);
    Messages.setLanguageText(label, "ConfigView.section.ipfilter.end");

    final Text textEndIp = new Text(shell, SWT.BORDER);
    gridData = new GridData();
    gridData.widthHint = 120;
    textEndIp.setLayoutData(gridData);

    final Button ok = new Button(shell, SWT.PUSH);
    Messages.setLanguageText(ok, "Button.ok");
    shell.setDefaultButton(ok);

    gridData = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.FILL_HORIZONTAL);
    gridData.horizontalSpan = 2;
    gridData.widthHint = 100;
    ok.setLayoutData(gridData);
    ok.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event arg0) {
View Full Code Here

  public void configSectionDelete() {
  }

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

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

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

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

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

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

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

      return cSection;
    }

   
    BooleanParameter enable_lan = new BooleanParameter(
        cSection, "LAN Speed Enabled",
        CFG_PREFIX + "enable" );
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    enable_lan.setLayoutData(gridData);
   
    IntParameter lan_max_upload = new IntParameter( cSection, "Max LAN Upload Speed KBs" );
    gridData = new GridData();
    lan_max_upload.setLayoutData(gridData);
    Label llmux = new Label(cSection, SWT.NULL);
    Messages.setLanguageText( llmux, CFG_PREFIX + "uploadrate" );
   
   
    IntParameter lan_max_download = new IntParameter( cSection, "Max LAN Download Speed KBs" );
    gridData = new GridData();
    lan_max_download.setLayoutData(gridData);
    Label llmdx = new Label(cSection, SWT.NULL);
    Messages.setLanguageText( llmdx, CFG_PREFIX + "downloadrate" );
   
    enable_lan.setAdditionalActionPerformer(
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.