Package org.eclipse.swt.layout

Examples of org.eclipse.swt.layout.GridLayout


  protected Control createContents(Composite parent) {
   
   
   
    Composite composite = new Composite(parent, SWT.FILL);
    composite.setLayout(new GridLayout(2, false));

    if (hasMDHeader()) {
      Label label = new Label(composite, SWT.None);
      label.setText("Note:");
      label = new Label(composite, SWT.None);
View Full Code Here


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

    GridData gridData;
    GridLayout layout;

    Composite gLogging = new Composite(parent, SWT.NULL);
    gridData = new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL);
    gLogging.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 2;
    gLogging.setLayout(layout);
   
    int userMode = COConfigurationManager.getIntParameter("User Mode");

   
    BooleanParameter enable_logger = new BooleanParameter(gLogging, "Logger.Enabled", CFG_PREFIX + "loggerenable");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    enable_logger.setLayoutData(gridData);

    // row

    final BooleanParameter enableLogging =
      new BooleanParameter(gLogging,
                           "Logging Enable",
                           CFG_PREFIX + "enable");
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    enableLogging.setLayoutData(gridData);

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


    // row

    Label lStatsPath = new Label(cArea, SWT.NULL);
    Messages.setLanguageText(lStatsPath, CFG_PREFIX + "logdir"); //$NON-NLS-1$

    gridData = new GridData();
    gridData.widthHint = 150;
    final StringParameter pathParameter = new StringParameter(cArea, "Logging Dir"); //$NON-NLS-1$ //$NON-NLS-2$
    pathParameter.setLayoutData(gridData);
    Button browse = new Button(cArea, SWT.PUSH);
    browse.setImage(imgOpenFolder);
    imgOpenFolder.setBackground(browse.getBackground());
    browse.setToolTipText(MessageText.getString("ConfigView.button.browse"));
    browse.addListener(SWT.Selection, new Listener() {
      /* (non-Javadoc)
       * @see org.eclipse.swt.widgets.Listener#handleEvent(org.eclipse.swt.widgets.Event)
       */
      public void handleEvent(Event event) {
      DirectoryDialog dialog = new DirectoryDialog(parent.getShell(), SWT.APPLICATION_MODAL);
        dialog.setFilterPath(pathParameter.getValue());
        dialog.setText(MessageText.getString(CFG_PREFIX + "choosedefaultsavepath")); //$NON-NLS-1$
        String path = dialog.open();
        if (path != null) {
        pathParameter.setValue(path);
        }
      }
    });

    Label lMaxLog = new Label(cArea, SWT.NULL);

    Messages.setLanguageText(lMaxLog, CFG_PREFIX + "maxsize");
    final String lmLabels[] = new String[logFileSizes.length];
    final int lmValues[] = new int[logFileSizes.length];
    for (int i = 0; i < logFileSizes.length; i++) {
      int  num = logFileSizes[i];
      lmLabels[i] = " " + num + " MB";
      lmValues[i] = num;
    }

    IntListParameter paramMaxSize = new IntListParameter(cArea, "Logging Max Size", lmLabels, lmValues);
    gridData = new GridData();
    gridData.horizontalSpan = 2;
    paramMaxSize.setLayoutData(gridData);
   
    if(userMode > 1)
    {
      Label timeStampLbl = new Label(cArea, SWT.NULL);
      Messages.setLanguageText(timeStampLbl, CFG_PREFIX+"timestamp");
      timeStampLbl.setLayoutData(new GridData());
      StringParameter timeStamp = new StringParameter(cArea,"Logging Timestamp");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      gridData.widthHint = 150;
      timeStamp.setLayoutData(gridData);
    }
   
   
   
    /** FileLogging filter, consisting of a List of types (info, warning, error)
     * and a checkbox Table of component IDs.
     */
    final String sFilterPrefix = CFG_PREFIX + "filter";
    Group gLogIDs = new Group(gLogging, SWT.NULL);
    Messages.setLanguageText(gLogIDs, sFilterPrefix);
    layout = new GridLayout();
    layout.numColumns = 2;
    gLogIDs.setLayout(layout);
    gridData = new GridData(SWT.BEGINNING, SWT.BEGINNING, true, true);
    gridData.horizontalSpan = 2;
    gLogIDs.setLayoutData(gridData);
View Full Code Here

  }

  public void show() {
  wizard.setTitle(MessageText.getString("exportTorrentWizard.finish.title"));
  Composite rootPanel = wizard.getPanel();
  GridLayout layout = new GridLayout();
  layout.numColumns = 1;
  rootPanel.setLayout(layout);

  Composite panel = new Composite(rootPanel, SWT.NULL);
  GridData gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
  panel.setLayoutData(gridData);
  layout = new GridLayout();
  layout.numColumns = 3;
  panel.setLayout(layout);

  Label label = new Label(panel, SWT.WRAP);
  gridData = new GridData();
View Full Code Here

      shell =  ShellFactory.createMainShell(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
     
      Utils.setShellIcon(shell);
      shell.setText(MessageText.getString("security.certtruster.title"));
     
      GridLayout layout = new GridLayout();
      layout.numColumns = 3;
     
      shell.setLayout (layout);
     
      GridData gridData;
     
      // info
     
      Label info_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(info_label, "security.certtruster.intro");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 3;
      info_label.setLayoutData(gridData);
     
      // resource
     
      Label resource_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(resource_label, "security.certtruster.resource");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 1;
      resource_label.setLayoutData(gridData);
     
      Label resource_value = new Label(shell,SWT.NULL);
      resource_value.setText(resource.replaceAll("&", "&&"));
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 2;
      resource_value.setLayoutData(gridData);
     
      // issued by
     
      Label issued_by_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(issued_by_label, "security.certtruster.issuedby");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 1;
      issued_by_label.setLayoutData(gridData);
     
      Label issued_by_value = new Label(shell,SWT.NULL);
      issued_by_value.setText(extractCN(cert.getIssuerDN().getName()).replaceAll("&", "&&"));
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 2;
      issued_by_value.setLayoutData(gridData);
     
      // issued to
     
      Label issued_to_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(issued_to_label, "security.certtruster.issuedto");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 1;
      issued_to_label.setLayoutData(gridData);
     
      Label issued_to_value = new Label(shell,SWT.NULL);
      issued_to_value.setText(extractCN(cert.getSubjectDN().getName()).replaceAll("&", "&&"));
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 2;
      issued_to_value.setLayoutData(gridData);
     
      // prompt
     
      Label prompt_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(prompt_label, "security.certtruster.prompt");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 3;
      prompt_label.setLayoutData(gridData);
     
        // line
     
      Label labelSeparator = new Label(shell,SWT.SEPARATOR | SWT.HORIZONTAL);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 3;
      labelSeparator.setLayoutData(gridData);
     
        // buttons
     
      new Label(shell,SWT.NULL);
     
      Composite comp = new Composite(shell,SWT.NULL);
      gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.HORIZONTAL_ALIGN_FILL);
      gridData.grabExcessHorizontalSpace = true;
      gridData.horizontalSpan = 2;
      comp.setLayoutData(gridData);
      GridLayout layoutButtons = new GridLayout();
      layoutButtons.numColumns = 2;
      comp.setLayout(layoutButtons);
     
     
     
View Full Code Here

  }


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

    final 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();
   
    int userMode = COConfigurationManager.getIntParameter("User Mode");
   
      // ***** start group
   
    boolean can_ral = platform.hasCapability(PlatformManagerCapabilities.RunAtLogin );
       
    if ( can_ral ){
     
      Group gStartStop = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gStartStop, LBLKEY_PREFIX + "start");
      layout = new GridLayout(2, false);
      gStartStop.setLayout(layout);
      gStartStop.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));
 
      if ( can_ral ){
 
        gridData = new GridData();
        gridData.horizontalSpan = 2;
        BooleanParameter start_on_login = new BooleanParameter(gStartStop, "Start On Login", LBLKEY_PREFIX + "start.onlogin");
       
        try{
          start_on_login.setSelected( platform.getRunAtLogin());
         
          start_on_login.addChangeListener(
            new ParameterChangeAdapter()
            {
              public void
              booleanParameterChanging(
                Parameter p,
                boolean toValue)
              {
                try{
                  platform.setRunAtLogin( toValue );
                 
                }catch( Throwable e ){
                 
                  Debug.out( e );
                }
              }
            });
         
        }catch( Throwable e ){
         
          start_on_login.setEnabled( false );
         
          Debug.out( e );
        }
       
        start_on_login.setLayoutData(gridData);
      }
     
    }
       
    if ( userMode > 0 ){
       
      Group gPR = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gPR, LBLKEY_PREFIX + "pauseresume");
      layout = new GridLayout(2, false);
      gPR.setLayout(layout);
      gPR.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));

      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter pauseOnExit = new BooleanParameter(gPR,
          "Pause Downloads On Exit", "ConfigView.label.pause.downloads.on.exit");
      pauseOnExit.setLayoutData(gridData);
 
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter resumeOnStart = new BooleanParameter(gPR,
          "Resume Downloads On Start", "ConfigView.label.resume.downloads.on.start");
      resumeOnStart.setLayoutData(gridData);
    }
   
    if ( userMode >= 0 ){
     
      Group gStop = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gStop, LBLKEY_PREFIX + "stop");
      layout = new GridLayout(2, false);
      gStop.setLayout(layout);
      gStop.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));

        // done downloading
     
      gridData = new GridData();
      label = new Label(gStop, SWT.NULL);
        Messages.setLanguageText(label, "ConfigView.label.stop.downcomp");
        label.setLayoutData( gridData );
     
        int  shutdown_types = platform.getShutdownTypes();
       
      List<String>  l_action_values = new ArrayList<String>();
      List<String>  l_action_descs   = new ArrayList<String>();

      l_action_values.add( "Nothing" );
      l_action_values.add( "QuitVuze" );
     
      if (( shutdown_types & PlatformManager.SD_SLEEP ) != 0 ){
       
        l_action_values.add( "Sleep" );
      }
      if (( shutdown_types & PlatformManager.SD_HIBERNATE ) != 0 ){
       
        l_action_values.add( "Hibernate" );
      }
      if (( shutdown_types & PlatformManager.SD_SHUTDOWN ) != 0 ){
       
        l_action_values.add( "Shutdown" );
      }
     
      String[] action_values = l_action_values.toArray( new String[ l_action_values.size()]);
         
      for ( String s: action_values ){
       
        l_action_descs.add( MessageText.getString( "ConfigView.label.stop." + s ));
      }
     
      String[] action_descs = l_action_descs.toArray( new String[ l_action_descs.size()]);

      new StringListParameter(gStop, "On Downloading Complete Do", "Nothing", action_descs, action_values );

        // done seeding
     
      gridData = new GridData();
        label = new Label(gStop, SWT.NULL);
        Messages.setLanguageText(label, "ConfigView.label.stop.seedcomp");
        label.setLayoutData( gridData );
             
      new StringListParameter(gStop, "On Seeding Complete Do", "Nothing", action_descs, action_values );
     
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      BooleanParameter resetOnTrigger =
        new BooleanParameter(
          gStop, "Stop Triggers Auto Reset",
          "!" + MessageText.getString(
            "ConfigView.label.stop.autoreset",
            new String[]{ MessageText.getString( "ConfigView.label.stop.Nothing" )})+ "!");
       
      resetOnTrigger.setLayoutData(gridData);
    }
   
    if ( userMode > 0 && platform.hasCapability( PlatformManagerCapabilities.AccessExplicitVMOptions )){
     
      Group gJVM = new Group(cDisplay, SWT.NULL);
      Messages.setLanguageText(gJVM, LBLKEY_PREFIX + "jvm");
      layout = new GridLayout(2, false);
      gJVM.setLayout(layout);
      gJVM.setLayoutData(new GridData( GridData.FILL_HORIZONTAL ));
     
        // wiki link
     
      gridData = new GridData();
      gridData.horizontalSpan = 2;

      LinkLabel link = new LinkLabelgJVM, gridData, "ConfigView.label.please.visit.here",
                      "http://wiki.vuze.com/w/Java_VM_memory_usage");
     
        // info
     
      label = new Label(gJVM, SWT.NULL);
      Messages.setLanguageText(label, "jvm.info");
      gridData = new GridData();
      gridData.horizontalSpan = 2;
      label.setLayoutData( gridData );
     
      try{
        final File option_file = platform.getVMOptionFile();
        
        final Group gJVMOptions = new Group(gJVM, SWT.NULL);
        layout = new GridLayout(3, false);
        gJVMOptions.setLayout(layout);
        gridData = new GridData( GridData.FILL_HORIZONTAL );
        gridData.horizontalSpan = 2;
        gJVMOptions.setLayoutData( gridData );
       
View Full Code Here

      shell = ShellFactory.createMainShell(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
     
      Utils.setShellIcon(shell);
      Messages.setLanguageText(shell, "security.certcreate.title");
     
      GridLayout layout = new GridLayout();
      layout.numColumns = 3;
     
      shell.setLayout (layout);
     
      GridData gridData;
     
      // info
     
      Label info_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(info_label, "security.certcreate.intro");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 3;
      info_label.setLayoutData(gridData);
     
      // alias
     
      Label alias_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(alias_label, "security.certcreate.alias");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 1;
      alias_label.setLayoutData(gridData);
     
      final Text alias_field =new Text(shell,SWT.BORDER);
     
      alias_field.setText( SESecurityManager.DEFAULT_ALIAS );
     
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 2;
      alias_field.setLayoutData(gridData);
     
      // strength
     
      Label strength_label = new Label(shell,SWT.NULL);
      Messages.setLanguageText(strength_label, "security.certcreate.strength");
      gridData = new GridData(GridData.FILL_BOTH);
      gridData.horizontalSpan = 1;
      strength_label.setLayoutData(gridData);
     
      final Combo strength_combo = new Combo(shell, SWT.SINGLE | SWT.READ_ONLY);
        
      final int[] strengths = { 512, 1024, 1536, 2048 };
                    
      for (int i=0;i<strengths.length;i++){
       
        strength_combo.add(""+strengths[i]);
      }
           
      strength_combo.select(1);
     
      new Label(shell,SWT.NULL);
           
      // first + last name
     
      String[]  field_names = {
                  "security.certcreate.firstlastname",
                  "security.certcreate.orgunit",
                  "security.certcreate.org",
                  "security.certcreate.city",
                  "security.certcreate.state",
                  "security.certcreate.country"
                };
     
      final String[]    field_rns = {"CN", "OU", "O", "L", "ST", "C" };
     
      final Text[]    fields = new Text[field_names.length];
     
      for (int i=0;i<fields.length;i++){
       
        Label resource_label = new Label(shell,SWT.NULL);
        Messages.setLanguageText(resource_label, field_names[i]);
        gridData = new GridData(GridData.FILL_BOTH);
        gridData.horizontalSpan = 1;
        resource_label.setLayoutData(gridData);
       
        Text field = fields[i] = new Text(shell,SWT.BORDER);
        gridData = new GridData(GridData.FILL_BOTH);
        gridData.horizontalSpan = 2;
        field.setLayoutData(gridData);
      }

        // line
     
      Label labelSeparator = new Label(shell,SWT.SEPARATOR | SWT.HORIZONTAL);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      gridData.horizontalSpan = 3;
      labelSeparator.setLayoutData(gridData);
     
        // buttons
     
      new Label(shell,SWT.NULL);
     
      Composite comp = new Composite(shell,SWT.NULL);
      gridData = new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END | GridData.HORIZONTAL_ALIGN_FILL);
      gridData.grabExcessHorizontalSpace = true;
      gridData.horizontalSpan = 2;
      comp.setLayoutData(gridData);
      GridLayout layoutButtons = new GridLayout();
      layoutButtons.numColumns = 2;
      comp.setLayout(layoutButtons);
     
     
     
View Full Code Here

    shellForChildren = shell;

    shell.setText(MessageText.getString("OpenTorrentWindow.title"));
    Utils.setShellIcon(shell);

    GridLayout layout = FixupLayout(new GridLayout(), false);
    shell.setLayout(layout);
    shell.addListener(SWT.Resize, new Listener() {
      public void handleEvent(Event e) {
        resizeTables(3);
      }
    });

    Clipboard clipboard = new Clipboard(shell.getDisplay());

    String sClipText = (String) clipboard.getContents(TextTransfer.getInstance());
    if (sClipText != null)
      bTorrentInClipboard = addTorrentsFromTextList(sClipText, true) > 0;

    //    label = new Label(shell, SWT.BORDER | SWT.WRAP);
    //    Messages.setLanguageText(label, "OpenTorrentWindow.message");
    //    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    //    label.setLayoutData(gridData);

    // Torrents
    // ========

    Composite cButtons = new Composite(shell, SWT.NONE);
    RowLayout rLayout = new RowLayout(SWT.HORIZONTAL);
    rLayout.marginBottom = 0;
    rLayout.marginLeft = 0;
    rLayout.marginRight = 0;
    rLayout.marginTop = 0;
    cButtons.setLayout(rLayout);

    // Buttons for tableTorrents

    Button browseTorrent = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(browseTorrent, "OpenTorrentWindow.addFiles");
    browseTorrent.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        FileDialog fDialog = new FileDialog(shell, SWT.OPEN | SWT.MULTI);
        fDialog.setFilterExtensions(new String[] {
          "*.torrent",
          "*.tor",
          Constants.FILE_WILDCARD
        });
        fDialog.setFilterNames(new String[] {
          "*.torrent",
          "*.tor",
          Constants.FILE_WILDCARD
        });
        fDialog.setFilterPath(TorrentOpener.getFilterPathTorrent());
        fDialog.setText(MessageText.getString("MainWindow.dialog.choose.file"));
        String fileName = TorrentOpener.setFilterPathTorrent(fDialog.open());
        if (fileName != null) {
          addTorrents(fDialog.getFilterPath(), fDialog.getFileNames());
        }
      }
    });

    Utils.setGridData(cButtons, GridData.FILL_HORIZONTAL, browseTorrent,
        MIN_BUTTON_HEIGHT);

    Button browseURL = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(browseURL, "OpenTorrentWindow.addFiles.URL");
    browseURL.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        browseURL();
      }
    });

    Button browseFolder = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(browseFolder, "OpenTorrentWindow.addFiles.Folder");
    browseFolder.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        DirectoryDialog fDialog = new DirectoryDialog(shell, SWT.NULL);
        fDialog.setFilterPath(TorrentOpener.getFilterPathTorrent());
        fDialog.setMessage(MessageText.getString("MainWindow.dialog.choose.folder"));
        String path = TorrentOpener.setFilterPathTorrent(fDialog.open());
        if (path != null) {
          addTorrents(path, null);
        }
      }
    });

    if (bTorrentInClipboard) {
      Button pasteOpen = new Button(cButtons, SWT.PUSH);
      Messages.setLanguageText(pasteOpen,
          "OpenTorrentWindow.addFiles.Clipboard");
      pasteOpen.setToolTipText(sClipText);
      pasteOpen.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event event) {
          Clipboard clipboard = new Clipboard(shell.getDisplay());

          String sClipText = (String) clipboard.getContents(TextTransfer.getInstance());
          if (sClipText != null) {
            addTorrentsFromTextList(sClipText.trim(), false);
          }
        }
      });
    }

    Group gTorrentsArea = new Group(shell, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    gTorrentsArea.setLayoutData(gridData);
    layout = FixupLayout(new GridLayout(), true);
    gTorrentsArea.setLayout(layout);
    Messages.setLanguageText(gTorrentsArea, "OpenTorrentWindow.torrentLocation");

    Composite cTorrentList = new Composite(gTorrentsArea, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cTorrentList.setLayoutData(gridData);

    createTorrentListArea(cTorrentList);

    Composite cTorrentOptions = new Composite(gTorrentsArea, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cTorrentOptions.setLayoutData(gridData);
    layout = FixupLayout(new GridLayout(), true);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    cTorrentOptions.setLayout(layout);

    label = new Label(cTorrentOptions, SWT.NONE);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    label.setLayoutData(gridData);
    Messages.setLanguageText(label, "OpenTorrentWindow.torrent.options");

    int userMode = COConfigurationManager.getIntParameter("User Mode");
    if (userMode > 0) {
      Composite cTorrentModes = new Composite(cTorrentOptions, SWT.NONE);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      cTorrentModes.setLayoutData(gridData);
      layout = new GridLayout();
      layout.numColumns = 4;
      layout.marginWidth = 0;
      layout.marginHeight = 0;
      cTorrentModes.setLayout(layout);

      label = new Label(cTorrentModes, SWT.NONE);
      gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "OpenTorrentWindow.startMode");

      cmbStartMode = new Combo(cTorrentModes, SWT.BORDER | SWT.READ_ONLY);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      cmbStartMode.setLayoutData(gridData);
      updateStartModeCombo();
      cmbStartMode.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
          setSelectedStartMode(cmbStartMode.getSelectionIndex());
        }
      });

      label = new Label(cTorrentModes, SWT.NONE);
      gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER);
      label.setLayoutData(gridData);
      Messages.setLanguageText(label, "OpenTorrentWindow.addPosition");

      cmbQueueLocation = new Combo(cTorrentModes, SWT.BORDER | SWT.READ_ONLY);
      gridData = new GridData(GridData.FILL_HORIZONTAL);
      cmbQueueLocation.setLayoutData(gridData);
      updateQueueLocationCombo();
      cmbQueueLocation.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
          setSelectedQueueLocation(cmbQueueLocation.getSelectionIndex());
        }
      });
    }

    // Save To..
    // =========

    cSaveTo = new Composite(cTorrentOptions, SWT.NONE);
    layout = FixupLayout(new GridLayout(), false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.verticalSpacing = 0;
    layout.numColumns = 2;
    cSaveTo.setLayout(layout);

    Label lblDataDir = new Label(cSaveTo, SWT.NONE);
    gridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gridData.horizontalSpan = 2;
    lblDataDir.setLayoutData(gridData);
    Messages.setLanguageText(lblDataDir, "OpenTorrentWindow.dataLocation");

    cmbDataDir = new Combo(cSaveTo, SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cmbDataDir.setLayoutData(gridData);

    cmbDataDir.addModifyListener(new ModifyListener() {
      public void modifyText(ModifyEvent e) {
        cmbDataDirChanged();
      }
    });
    cmbDataDir.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        cmbDataDirChanged();
      }
    });

    updateDataDirCombo();
    dirList = COConfigurationManager.getStringListParameter("saveTo_list");
    StringIterator iter = dirList.iterator();
    while (iter.hasNext()) {
      String s = iter.next();
      if (!s.equals(sDestDir)) {
        cmbDataDir.add(s);
      }
    }

    Button browseData = new Button(cSaveTo, SWT.PUSH);
    Messages.setLanguageText(browseData, "ConfigView.button.browse");

    browseData.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        String sSavePath;
        String sDefPath = cmbDataDir.getText();

        File f = new File(sDefPath);
        if (sDefPath.length() > 0) {
          while (!f.exists()) {
            f = f.getParentFile();
            if (f == null) {
              f = new File(sDefPath);
              break;
            }
          }
        }

        DirectoryDialog dDialog = new DirectoryDialog(shell, SWT.SYSTEM_MODAL);
        dDialog.setFilterPath(f.getAbsolutePath());
        dDialog.setMessage(MessageText.getString("MainWindow.dialog.choose.savepath_forallfiles"));
        sSavePath = dDialog.open();

        if (sSavePath != null) {
          cmbDataDir.setText(sSavePath);
        }
      }
    });

    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cSaveTo.setLayoutData(gridData);

    // File List
    // =========

    Group gFilesArea = new Group(shell, SWT.NONE);
    gridData = new GridData(GridData.FILL_BOTH);
    gFilesArea.setLayoutData(gridData);
    layout = FixupLayout(new GridLayout(), true);
    gFilesArea.setLayout(layout);
    Messages.setLanguageText(gFilesArea, "OpenTorrentWindow.fileList");

    createTableDataFiles(gFilesArea);

    // Ok, cancel

    cArea = new Composite(shell, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.numColumns = 2;
    cArea.setLayout(layout);

    ok = new Button(cArea, SWT.PUSH);
View Full Code Here

  private void createTorrentListArea(Composite cArea) {
    GridData gridData;
    TableColumn tc;

    GridLayout layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    cArea.setLayout(layout);
View Full Code Here

        changeFileDestination(indexes);
      }
    });

    Composite cBottomArea = new Composite(cArea, SWT.NONE);
    GridLayout gLayout = new GridLayout();
    gLayout.marginHeight = 0;
    gLayout.marginWidth = 0;
    gLayout.numColumns = 2;
    gLayout.verticalSpacing = 0;
    cBottomArea.setLayout(gLayout);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    cBottomArea.setLayoutData(gridData);

    Composite cButtons = new Composite(cBottomArea, SWT.NONE);
    RowLayout rLayout = new RowLayout(SWT.HORIZONTAL);
    rLayout.wrap = false;
    rLayout.marginBottom = 0;
    rLayout.marginLeft = 0;
    rLayout.marginRight = 0;
    rLayout.marginTop = 0;
    cButtons.setLayout(rLayout);
    gridData = new GridData(SWT.END, SWT.BEGINNING, false, false);
    gridData.verticalSpan = 2;
    cButtons.setLayoutData(gridData);

    Button btnSelectAll = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(btnSelectAll, "Button.selectAll");
    btnSelectAll.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        dataFileTable.selectAll();
      }
    });

    Button btnMarkSelected = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(btnMarkSelected, "Button.markSelected");
    btnMarkSelected.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        int[] indexes = dataFileTable.getSelectionIndices();
        for (int i = 0; i < indexes.length; i++) {
          TorrentFileInfo file = (TorrentFileInfo) dataFiles.get(indexes[i]);
          file.bDownload = true;
        }
        dataFileTable.clearAll();
        updateSize();
      }
    });

    Button btnUnmarkSelected = new Button(cButtons, SWT.PUSH);
    Messages.setLanguageText(btnUnmarkSelected, "Button.unmarkSelected");
    btnUnmarkSelected.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event event) {
        int[] indexes = dataFileTable.getSelectionIndices();
        for (int i = 0; i < indexes.length; i++) {
          TorrentFileInfo file = (TorrentFileInfo) dataFiles.get(indexes[i]);
          if (file.okToDisable())
            file.bDownload = false;
        }
        dataFileTable.clearAll();
        updateSize();
      }
    });

    dataFileTableLabel = new Label(cBottomArea, SWT.WRAP);
    dataFileTableLabel.setAlignment(SWT.RIGHT);
    gridData = new GridData(SWT.END, SWT.BEGINNING, true, false);
    dataFileTableLabel.setLayoutData(gridData);

    diskspaceComp = new Composite(cBottomArea, SWT.NONE);
    gLayout = new GridLayout(2, false);
    gLayout.marginHeight = gLayout.marginWidth = 1;
    gLayout.verticalSpacing = 0;
    gLayout.horizontalSpacing = 15;
    diskspaceComp.setLayout(gLayout);
    gridData = new GridData(SWT.END, SWT.BEGINNING, true, false);
View Full Code Here

  public void
  show()
  {
    wizard.setTitle(MessageText.getString("exportTorrentWizard.exportfile.title"));
    Composite rootPanel = wizard.getPanel();
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;
    rootPanel.setLayout(layout);
 
    Composite panel = new Composite(rootPanel, SWT.NULL);
    GridData gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
    panel.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 3;
    panel.setLayout(layout);

    Label label = new Label(panel, SWT.WRAP);
    gridData = new GridData();
View Full Code Here

TOP

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

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.