Package org.eclipse.swt.widgets

Examples of org.eclipse.swt.widgets.Text


    Messages.setLanguageText(label, "importTorrentWizard.torrentfile.message");
 
    label = new Label(panel,SWT.NULL);
    Messages.setLanguageText(label, "importTorrentWizard.torrentfile.path");
 
    final Text textPath = new Text(panel,SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    textPath.setLayoutData(gridData);
    textPath.setText(((ImportTorrentWizard)wizard).getTorrentFile());
 
    Button browse = new Button(panel,SWT.PUSH);
    Messages.setLanguageText(browse, "importTorrentWizard.torrentfile.browse");
    browse.addListener(SWT.Selection,new Listener() {
     
      public void handleEvent(Event arg0){
       
      FileDialog fd = new FileDialog(wizard.getWizardWindow(), SWT.SAVE);
     
      fd.setFileName(textPath.getText());
     
      fd.setFilterExtensions(new String[]{"*.torrent", "*.tor", Constants.FILE_WILDCARD});
     
      String path = fd.open();
     
      if(path != null) {
       
        textPath.setText(path);
      }    
      }
    });
 
    textPath.addListener(SWT.Modify, new Listener(){
     
      public void handleEvent(Event event) {
      String path = textPath.getText();
     
      pathSet( path );
      }
    });
 
    textPath.setText(((ImportTorrentWizard)wizard).getTorrentFile());
   
    textPath.setFocus();
  }
View Full Code Here


    Messages.setLanguageText(label, "importTorrentWizard.importfile.message");
 
    label = new Label(panel,SWT.NULL);
    Messages.setLanguageText(label, "importTorrentWizard.importfile.path");
 
    final Text textPath = new Text(panel,SWT.BORDER);
    gridData = new GridData(GridData.FILL_HORIZONTAL);
    textPath.setLayoutData(gridData);
    textPath.setText("");
 
    Button browse = new Button(panel,SWT.PUSH);
    Messages.setLanguageText(browse, "importTorrentWizard.importfile.browse");
    browse.addListener(SWT.Selection,new Listener() {
      public void handleEvent(Event arg0) {
       
      FileDialog fd = new FileDialog(wizard.getWizardWindow());
     
      fd.setFileName(textPath.getText());
     
      fd.setFilterExtensions(new String[]{"*.xml", Constants.FILE_WILDCARD});
     
      String path = fd.open();
     
      if(path != null) {
       
        textPath.setText(path);     
      }    
      }
    });
 
    textPath.addListener(SWT.Modify, new Listener(){
     
      public void handleEvent(Event event) {
       
      String path = textPath.getText();
     
      ((ImportTorrentWizard)wizard).setImportFile( path );

      file_valid = false;   
     
      try{
       
        File f = new File(path);
       
        if( f.exists()){
         
          if (f.isFile()){
           
            file_valid = true;
           
          wizard.setErrorMessage("");
          }else{
           
          wizard.setErrorMessage(MessageText.getString("importTorrentWizard.importfile.invalidPath"));
          }           
        }
       
      }catch(Exception e){
        wizard.setErrorMessage(MessageText.getString("importTorrentWizard.importfile.invalidPath"));
      }
     
      wizard.setNextEnabled( file_valid );
      }
    });

    textPath.setText(((ImportTorrentWizard)wizard).getImportFile());
   
    textPath.setFocus();
  }
View Full Code Here

   
    boolean useBigTable = useBigTable();
   
    SWTSkinObjectTextbox soFilter = (SWTSkinObjectTextbox) skin.getSkinObject(
        "library-filter", soParent.getParent());
    Text txtFilter = soFilter == null ? null : soFilter.getTextControl();
   
    SWTSkinObjectContainer soCats = (SWTSkinObjectContainer) skin.getSkinObject(
        "library-categories", soParent.getParent());
    Composite cCats = soCats == null ? null : soCats.getComposite();
View Full Code Here

    panel.setLayoutData(gridData);
    layout = new GridLayout();
    layout.numColumns = 1;
    panel.setLayout(layout);

    tasks = new Text(panel, SWT.BORDER | SWT.MULTI | SWT.READ_ONLY);
    tasks.setBackground(display.getSystemColor(SWT.COLOR_WHITE));
    gridData = new GridData(GridData.FILL_BOTH);
    gridData.heightHint = 120;
    tasks.setLayoutData(gridData);
  }
View Full Code Here

    license_tab.setControl(content);
    license_tab.setText(_._("aboutwindow.tab.license"));
   
    content.setLayout(new FillLayout());
   
    Text license_text = new Text(content,SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.BORDER | SWT.READ_ONLY);
    Font font_license = new Font(SWTThread.getDisplay(),"Courier",10,SWT.NONE );
    license_text.setFont(font_license);
      license_text.setText(UIConstants.GNU_LICENSE);
      license_text.setBackground(SWTThread.getDisplay().getSystemColor(SWT.COLOR_WHITE));
     
    tab_list.setSelection(general_tab);
   
    Composite button_bar = new Composite(shell,SWT.NONE);
    button_bar.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
View Full Code Here

    file_size_options.setLayoutData(layout_data);
   
    label = new Label(file_size_options,SWT.NONE);
    label.setText(_._("advancedsearchwindow.label.min_size") + " : ");
   
    min_file_size = new Text(file_size_options,SWT.BORDER);
    min_file_size.addVerifyListener(new VerifyListener() {     
      public void verifyText(VerifyEvent e) {
        try {
          String str = min_file_size.getText().substring(0, e.start)+e.text+min_file_size.getText().substring(e.end);
          double value = Double.parseDouble(str);
          double x = (100 * value) / 1024D;
          if (x>100) {
            e.doit = false;
            return ;
          }
          long min_unit = (Long)min_file_size_units.getData(min_file_size_units.getText());
          long max_unit = (Long)max_file_size_units.getData(max_file_size_units.getText());
          double min = formatSize(x, min_unit);
          double max = formatSize(file_size_slider.getUpValue(), max_unit);
          if (min>max) { e.doit = false; return ;}
          e.doit = true;
          file_size_slider.setDownValue(x);       
        }catch(Exception t) {
          e.doit = false;
        }
      }
    });
   
    min_file_size_units = new Combo(file_size_options,SWT.READ_ONLY);
   
    min_file_size_units.add("Bytes");
    min_file_size_units.add("KB");
    min_file_size_units.add("MB");
    min_file_size_units.add("GB");
   
    min_file_size_units.setData("Bytes", 1024L);
    min_file_size_units.setData("KB", 1024 * 1024L);
    min_file_size_units.setData("MB", 1024 * 1024 * 1024L);
    min_file_size_units.setData("GB", 1024 * 1024 * 1024 * 1024L);
    min_file_size_units.select(0);
   
    min_file_size_units.addSelectionListener(new SelectionAdapter() {

      public void widgetSelected(SelectionEvent arg0) {
        updated_file_size = true;
      }
     
    });
   
    layout_data = new GridData();
    layout_data.grabExcessHorizontalSpace = true;
    layout_data.horizontalAlignment = GridData.FILL;
    new Label(file_size_options,SWT.NONE).setLayoutData(layout_data);
   
    label = new Label(file_size_options,SWT.NONE);
    label.setText(_._("advancedsearchwindow.label.max_size") + " : ");
   
    max_file_size = new Text(file_size_options,SWT.BORDER);
   
    max_file_size.addVerifyListener(new VerifyListener() {     
      public void verifyText(VerifyEvent e) {
        try {
          String str = max_file_size.getText().substring(0, e.start)+e.text+max_file_size.getText().substring(e.end);
          double value = Double.parseDouble(str);
          double x = (100 * value) / 1024D;
         
          if (x>100) {
            e.doit = false;
            return ;
          }
         
          long min_unit = (Long)min_file_size_units.getData(min_file_size_units.getText());
          long max_unit = (Long)max_file_size_units.getData(max_file_size_units.getText());
          double min = formatSize(file_size_slider.getDownValue(), min_unit);
          double max = formatSize(x, max_unit);
          if (min>max) { e.doit = false; return ;}
          e.doit = true;
          file_size_slider.setUpValue(x);       
        }catch(Exception t) {
          e.doit = false;
        }
      }
    });
   
    max_file_size_units = new Combo(file_size_options,SWT.READ_ONLY);
    max_file_size_units.add("Bytes");
    max_file_size_units.add("KB");
    max_file_size_units.add("MB");
    max_file_size_units.add("GB");
   
    max_file_size_units.setData("Bytes", 1024L);
    max_file_size_units.setData("KB", 1024 * 1024L);
    max_file_size_units.setData("MB", 1024 * 1024 * 1024L);
    max_file_size_units.setData("GB", 1024 * 1024 * 1024 * 1024L);
    max_file_size_units.select(0);
   
    max_file_size_units.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent arg0) {
        updated_file_size = true;
      }
    });
   
    Composite slider_composite = new Composite(shell,SWT.NONE);
    layout_data = new GridData();
    layout_data.grabExcessHorizontalSpace = true;
    layout_data.horizontalAlignment = GridData.FILL;
    slider_composite.setLayoutData(layout_data);
    slider_composite.setLayout(new GridLayout(1,true));
    file_size_slider = new ExSlider(slider_composite){
      public boolean validate(double upValue, double downValue) {
        long min_unit = (Long)min_file_size_units.getData(min_file_size_units.getText());
        long max_unit = (Long)max_file_size_units.getData(max_file_size_units.getText());
        double min = formatSize(downValue, min_unit);
        double max = formatSize(upValue, max_unit);
       
        return max>min;
      }
    };
   
    file_size_slider.setBarBackgroundColor(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLUE));
    file_size_slider.setBarUsedSegmentColor(SWTThread.getDisplay().getSystemColor(SWT.COLOR_RED));
    file_size_slider.setPointerColor(SWTThread.getDisplay().getSystemColor(SWT.COLOR_BLACK));
   
    file_size_slider.setUpValue(0);
    file_size_slider.setUpValue(100);
   
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.heightHint = 30;
    file_size_slider.setLayoutData(layout_data);
   
    file_size_slider.addModifyListener(new ExSliderModifyListener() {

      public void downValueChanged(double downValue) {
        updated_file_size = true;
        DecimalFormat formatter = new DecimalFormat("0.00");
       
        downValue = Math.round(downValue);
        double u = 1024 / 100D;
       
        min_file_size.setText(formatter.format(u * downValue));
       
      }

      public void upValueChanged(double upValue) {
        updated_file_size = true;
        DecimalFormat formatter = new DecimalFormat("0.00");
       
        upValue = Math.round(upValue);
        double u = 1024 / 100D;
       
        max_file_size.setText(formatter.format(u * upValue));
      }
    });
       
    Composite options_composite = new Composite(shell,SWT.NONE);
    layout_data = new GridData();
    layout_data.grabExcessHorizontalSpace = true;
    layout_data.horizontalAlignment = GridData.FILL;
    options_composite.setLayoutData(layout_data);
    options_composite.setLayout(new GridLayout(4,false));
   
    label = new Label(options_composite,SWT.NONE);
    label.setText("File type : ");
    layout_data = new GridData();
    layout_data.horizontalAlignment = SWT.RIGHT;
    label.setLayoutData(layout_data);
   
    file_type = new Combo(options_composite,SWT.READ_ONLY);
    // must be same order as filetypes
    file_type.add(_._("advancedsearchwindow.file_type.any"));
    file_type.add(_._("advancedsearchwindow.file_type.archive"));
    file_type.add(_._("advancedsearchwindow.file_type.audio"));
    file_type.add(_._("advancedsearchwindow.file_type.cd_image"));
    file_type.add(_._("advancedsearchwindow.file_type.document"));
    file_type.add(_._("advancedsearchwindow.file_type.pictures"));
    file_type.add(_._("advancedsearchwindow.file_type.program"));
    file_type.add(_._("advancedsearchwindow.file_type.video"));
   
    file_type.select(0);
    file_type.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    layout_data = new GridData();
    file_type.setLayoutData(layout_data);
       
    label = new Label(options_composite,SWT.NONE);
    label.setText(_._("advancedsearchwindow.label.extension") + " : ");
    layout_data = new GridData();
    layout_data.horizontalAlignment = SWT.RIGHT;
    label.setLayoutData(layout_data);
   
    file_extension = new Text(options_composite,SWT.BORDER);
   
    label = new Label(options_composite,SWT.NONE);
    label.setText(_._("advancedsearchwindow.label.availability") + " : ");
    layout_data = new GridData();
    layout_data.horizontalAlignment = SWT.RIGHT;
View Full Code Here

    basic_search_controls.setLayout(layout);
   
    Label label = new Label(basic_search_controls,SWT.NONE);
    label.setText(_._("mainwindow.searchtab.label.search") + " : ");
   
    search_query = new Text(basic_search_controls,SWT.SINGLE | SWT.BORDER);
    layout_data = new GridData();
    layout_data.widthHint = 300;
    search_query.setLayoutData(layout_data);
   
    Button search_button = new Button(basic_search_controls,SWT.PUSH);
View Full Code Here

    label = new Label(content,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(_._("settingswindow.tab.general.label.nickname") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    nick_name_text = new Text(content,SWT.BORDER);
    nick_name_text.setFont(skin.getDefaultFont());
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    nick_name_text.setLayoutData(layout_data);
   
    try {
      nick_name_text.setText(_core.getConfigurationManager().getNickName());
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
   
    prompt_on_exit_check = new Button(content,SWT.CHECK);
    prompt_on_exit_check.setText(_._("settingswindow.tab.general.checkbox.prompt_on_exit"));
    prompt_on_exit_check.setSelection(swt_preferences.promptOnExit());
   
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    prompt_on_exit_check.setLayoutData(layout_data);
   
    server_list_update = new Button(content,SWT.CHECK);
    server_list_update.setText(_._("settingswindow.tab.general.checkbox.update_server_list"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    server_list_update.setLayoutData(layout_data);
    boolean update = false;
    try {
      update = config_manager.updateServerListAtConnect();
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
    server_list_update.setSelection(update);

    startup_update_check = new Button(content,SWT.CHECK);
    startup_update_check.setText(_._("settingswindow.tab.general.checkbox.startup_update_check"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    startup_update_check.setLayoutData(layout_data);
    startup_update_check.setSelection(swt_preferences.updateCheckAtStartup());
   
    connect_at_startup = new Button(content,SWT.CHECK);
    connect_at_startup.setText(_._("settingswindow.tab.general.checkbox.connect_at_startup"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    connect_at_startup.setLayoutData(layout_data);
    connect_at_startup.setSelection(swt_preferences.isConnectAtStartup());
   
    kad_enabled = new Button(content,SWT.CHECK);
    kad_enabled.setText(_._("settingswindow.tab.general.checkbox.enable_kad"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    kad_enabled.setLayoutData(layout_data);
    try {
      kad_enabled.setSelection(config_manager.isJKadAutoconnectEnabled());
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
   
   
    if (JMConstants.IS_NIGHTLY_BUILD) {
      show_nightly_build_warning = new Button(content,SWT.CHECK);
      show_nightly_build_warning.setText(_._("settingswindow.tab.general.checkbox.show_nightly_build_warning"));
      layout_data = new GridData(GridData.FILL_HORIZONTAL);
      layout_data.horizontalSpan = 2;
      show_nightly_build_warning.setLayoutData(layout_data);
      show_nightly_build_warning.setSelection(swt_preferences.isNightlyBuildWarning());
    }
   
    Group ports = new Group(content,SWT.NONE);
    ports.setText(_._("settingswindow.tab.general.group.ports"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    ports.setLayoutData(layout_data);
   
    ports.setLayout(new GridLayout(2,false));
   
    label = new Label(ports,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("settingswindow.tab.connection.label.tcp_port") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    tcp_port = new Spinner (ports, SWT.BORDER);
    tcp_port.setMinimum(1);
    tcp_port.setMaximum(65535);
    try {
      tcp_port.setSelection(config_manager.getTCP());
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
    tcp_port.setIncrement(1);
    tcp_port.setPageIncrement(100);

    label = new Label(ports,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("settingswindow.tab.connection.label.udp_port") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    Composite container1 = new Composite(ports,SWT.NONE);
    container1.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    layout = new GridLayout(2,false);
    layout.marginWidth=0;
    layout.marginHeight=0;
    container1.setLayout(layout);
   
    udp_port = new Spinner (container1, SWT.BORDER);
    udp_port.setMinimum(1);
    udp_port.setMaximum(65535);
    try {
      udp_port.setSelection(config_manager.getUDP());
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
    udp_port.setIncrement(1);
    udp_port.setPageIncrement(100);
   
    enable_udp = new Button(container1,SWT.CHECK);
    enable_udp.setText(_._("settingswindow.tab.connection.button.enabled"));
    enable_udp.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        updateUDPControls();
      }
     
    });
    try {
      enable_udp.setSelection(config_manager.isUDPEnabled());
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
   
    updateUDPControls();
   
    Group limits = new Group(content,SWT.NONE);
    limits.setText(_._("settingswindow.tab.general.group.limits"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    limits.setLayoutData(layout_data);
    limits.setLayout(new GridLayout(2,false));
   
    label = new Label(limits,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("settingswindow.tab.connection.label.download_limit") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    Composite container2 = new Composite(limits,SWT.NONE);
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    container2.setLayoutData(layout_data);
    layout = new GridLayout(3,false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container2.setLayout(layout);
   
    download_limit = new Text(container2,SWT.BORDER );
    download_limit.addListener(SWT.Verify, number_filter);
    layout_data = new GridData();
    layout_data.widthHint = EDIT_FIELD_WIDTH;
    download_limit.setLayoutData(layout_data);
    try {
      download_limit.setText((config_manager.getDownloadLimit()/1024)+"");
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
   
    new Label(container2,SWT.NONE).setText(_._("settingswindow.tab.connection.label.kb_s"));
   
    enable_download_limit = new Button(container2,SWT.CHECK);
    enable_download_limit.setText(_._("settingswindow.tab.connection.button.enabled"));
    enable_download_limit.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        updateDownloadLimitControls();
      }
    });
   
    label = new Label(limits,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("settingswindow.tab.connection.label.upload_limit") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    Composite container3 = new Composite(limits,SWT.NONE);
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    container3.setLayoutData(layout_data);
    layout = new GridLayout(3,false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    container3.setLayout(layout);
   
    upload_limit = new Text(container3,SWT.BORDER );
    upload_limit.addListener(SWT.Verify, number_filter);
    layout_data = new GridData();
    layout_data.widthHint = EDIT_FIELD_WIDTH;
    upload_limit.setLayoutData(layout_data);
    try {
      upload_limit.setText((config_manager.getUploadLimit()/1024)+"");
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
   
    new Label(container3,SWT.NONE).setText(_._("settingswindow.tab.connection.label.kb_s"));
   
    enable_upload_limit = new Button(container3,SWT.CHECK);
    enable_upload_limit.setText(_._("settingswindow.tab.connection.button.enabled"));
    enable_upload_limit.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent event) {
        updateUploadLimitControls();
      }
    });
   
    boolean enable = false;
    try {
      enable = config_manager.getDownloadLimit()==0 ? false : true;
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
    enable_download_limit.setSelection(enable);
   
    try {
      enable = config_manager.getUploadLimit() == 0 ? false : true;
    } catch (ConfigurationManagerException e1) {
      e1.printStackTrace();
    }
    enable_upload_limit.setSelection(enable);
   
    updateDownloadLimitControls();
    updateUploadLimitControls();
   
    Group capacities = new Group(content,SWT.NONE);
    capacities.setText(_._("settingswindow.tab.general.group.capacities"));
    layout_data = new GridData(GridData.FILL_HORIZONTAL);
    layout_data.horizontalSpan = 2;
    capacities.setLayoutData(layout_data);
    capacities.setLayout(new GridLayout(2,false));
   
    label = new Label(capacities,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("settingswindow.tab.connection.label.download_capacity") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
   
    download_capacity = new Text(capacities,SWT.BORDER );
    download_capacity.addListener(SWT.Verify, number_filter);
    layout_data = new GridData();
    layout_data.widthHint = EDIT_FIELD_WIDTH;
    download_capacity.setLayoutData(layout_data);
   
    label = new Label(capacities,SWT.NONE);
    label.setFont(skin.getDefaultFont());
    label.setForeground(skin.getDefaultColor());
    label.setText(_._("settingswindow.tab.connection.label.upload_capacity") + " : ");
    label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
   
    upload_capacity = new Text(capacities,SWT.BORDER );
    upload_capacity.addListener(SWT.Verify, number_filter);
   
    layout_data = new GridData();
    layout_data.widthHint = EDIT_FIELD_WIDTH;
    upload_capacity.setLayoutData(layout_data);
View Full Code Here

    group.setLayout(new GridLayout(3,false));
   
    Label label = new Label(group,SWT.NONE);
    label.setText(_._("serverlistimportwindow.label.file_path")+" : ");
   
    file_path = new Text(group,SWT.BORDER );
    file_path.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    browse_button = new Button(group,SWT.NONE);
    browse_button.setFont(skin.getButtonFont());
    browse_button.setText(_._("serverlistimportwindow.button.browse"));
View Full Code Here

   
    Label label = new Label(content,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(Localizer._("serveraddwindow.server_ip_address")+" : ");
   
    final Text text_server_ip = new Text(content,SWT.BORDER);
    text_server_ip.setFont(skin.getDefaultFont());
    text_server_ip.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    text_server_ip.addListener(SWT.Verify,new Listener() {
      public void handleEvent(Event e) {
            String text = e.text;
            char[] chars = new char[text.length()];
            text.getChars(0, chars.length, chars, 0);
            for (int i = 0; i < chars.length; i++) {
              if (!('0' <= chars[i] && chars[i] <= '9'))
                if (chars[i]!='.') {
               
                  e.doit = false;
                  return;
              }
        }
      }
    });
   
    label = new Label(content,SWT.NONE);
    label.setFont(skin.getLabelFont());
    label.setText(Localizer._("serveraddwindow.server_port")+" : ");
   
    final Text text_port = new Text(content,SWT.BORDER);
    text_port.setFont(skin.getDefaultFont());
    text_port.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    text_port.addListener(SWT.Verify,new Listener() {
      public void handleEvent(Event e) {
            String text = e.text;
            char[] chars = new char[text.length()];
            text.getChars(0, chars.length, chars, 0);
            for (int i = 0; i < chars.length; i++) {
              if (!('0' <= chars[i] && chars[i] <= '9')) {
                  e.doit = false;
                  return;
              }
        }
      }
    });
   
    Composite buttons_composite = new Composite(shell,SWT.NONE);
    buttons_composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
   
    buttons_composite.setLayout(new GridLayout(2,false));
   
    Button button_ok = new Button(buttons_composite,SWT.NONE);
    GridData grid_data = new GridData();
    //grid_data.widthHint = 40;
    grid_data.horizontalAlignment = GridData.END;
    grid_data.grabExcessHorizontalSpace = true;
    button_ok.setLayoutData(grid_data);
   
    button_ok.setFont(skin.getButtonFont());
    button_ok.setImage(skin.getButtonImage(SkinConstants.OK_BUTTON_IMAGE));
    button_ok.setText(Localizer._("mainwindow.button.ok"));
    button_ok.addSelectionListener(new SelectionListener() {
    public void widgetDefaultSelected(SelectionEvent arg0) {
      }

      public void widgetSelected(SelectionEvent arg0) {
        String server_ip = text_server_ip.getText();
        if (!AddressUtils.isValidIP(server_ip)) {
          MessageBox dialog = new MessageBox(shell,
                      SWT.OK | SWT.ICON_WARNING);
          dialog.setMessage(Localizer._("serveraddwindow.wrong_server_address"));
          dialog.open();
          return ;
        }
       
        if (!AddressUtils.isValidPort(text_port.getText())) {
          MessageBox dialog = new MessageBox(shell,
          SWT.OK | SWT.ICON_WARNING);
          dialog.setMessage(Localizer._("serveraddwindow.wrong_server_port"));
          dialog.open();
          return ;
        }
        int server_port = Integer.parseInt(text_port.getText());
        try {
          _core.getServerManager().newServer(server_ip, server_port);
        } catch (ServerManagerException e) {
          Utils.showWarningMessage(shell, "", e.getMessage());
        }
View Full Code Here

TOP

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

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.