Exemplo n.º 1
0
  public void setPreferencesProxyDTO(PreferencesProxyDTO preferencesProxyDTO) {
    switch (preferencesProxyDTO.getProxySettingType()) {
      case 0:
        noProxyRadioButton.setSelected(true);
        break;
      case 1:
        systemProxyRadioButton.setSelected(true);
        break;
      case 2:
        manualProxyRadioButton.setSelected(true);
    }

    if (preferencesProxyDTO.isUseProxyNotSocks()) useProxyRadioButton.setSelected(true);
    else useSocksRadioButton.setSelected(true);

    // for http
    httpProxyAddressTextField.setText(preferencesProxyDTO.getHttpProxyAddress());
    httpProxyPortSpinner.setValue(preferencesProxyDTO.getHttpProxyPort());
    httpProxyUserNameTextField.setText(preferencesProxyDTO.getHttpProxyUserName());
    httpProxyPasswordField.setText(preferencesProxyDTO.getHttpProxyPassword());

    // for https
    httpsProxyAddressTextField.setText(preferencesProxyDTO.getHttpsProxyAddress());
    httpsProxyPortSpinner.setValue(preferencesProxyDTO.getHttpsProxyPort());
    httpsProxyUserNameTextField.setText(preferencesProxyDTO.getHttpsProxyUserName());
    httpsProxyPasswordField.setText(preferencesProxyDTO.getHttpsProxyPassword());

    // for ftp
    ftpProxyAddressTextField.setText(preferencesProxyDTO.getFtpProxyAddress());
    ftpProxyPortSpinner.setValue(preferencesProxyDTO.getFtpProxyPort());
    ftpProxyUserNameTextField.setText(preferencesProxyDTO.getFtpProxyUserName());
    ftpProxyPasswordField.setText(preferencesProxyDTO.getFtpProxyPassword());

    // for ftp
    socksProxyAddressTextField.setText(preferencesProxyDTO.getSocksProxyAddress());
    socksProxyPortSpinner.setValue(preferencesProxyDTO.getSocksProxyPort());
    socksProxyUserNameTextField.setText(preferencesProxyDTO.getSocksProxyUserName());
    socksProxyPasswordField.setText(preferencesProxyDTO.getSocksProxyPassword());

    this.preferencesProxyDTO = preferencesProxyDTO;
  }
Exemplo n.º 2
0
  public PreferencesProxyDTO getPreferencesProxyDTO() {
    String proxySettingType = proxySettingGroup.getSelection().getActionCommand();
    switch (proxySettingType) {
      case "noProxy":
        preferencesProxyDTO.setProxySettingType(0);
        break;
      case "systemProxy":
        preferencesProxyDTO.setProxySettingType(1);
        break;
      case "manualProxy":
        preferencesProxyDTO.setProxySettingType(2);
    }

    if (useProxyRadioButton.isSelected()) preferencesProxyDTO.setUseProxyNotSocks(true);
    else preferencesProxyDTO.setUseProxyNotSocks(false);

    // for http
    preferencesProxyDTO.setHttpProxyAddress(httpProxyAddressTextField.getText());
    preferencesProxyDTO.setHttpProxyPort((Integer) httpProxyPortSpinner.getValue());
    preferencesProxyDTO.setHttpProxyUserName(httpProxyUserNameTextField.getText());
    preferencesProxyDTO.setHttpProxyPassword(new String(httpProxyPasswordField.getPassword()));

    // for https
    preferencesProxyDTO.setHttpsProxyAddress(httpsProxyAddressTextField.getText());
    preferencesProxyDTO.setHttpsProxyPort((Integer) httpsProxyPortSpinner.getValue());
    preferencesProxyDTO.setHttpsProxyUserName(httpsProxyUserNameTextField.getText());
    preferencesProxyDTO.setHttpsProxyPassword(new String(httpsProxyPasswordField.getPassword()));

    // for ftp
    preferencesProxyDTO.setFtpProxyAddress(ftpProxyAddressTextField.getText());
    preferencesProxyDTO.setFtpProxyPort((Integer) ftpProxyPortSpinner.getValue());
    preferencesProxyDTO.setFtpProxyUserName(ftpProxyUserNameTextField.getText());
    preferencesProxyDTO.setFtpProxyPassword(new String(ftpProxyPasswordField.getPassword()));

    // for ftp
    preferencesProxyDTO.setSocksProxyAddress(socksProxyAddressTextField.getText());
    preferencesProxyDTO.setSocksProxyPort((Integer) socksProxyPortSpinner.getValue());
    preferencesProxyDTO.setSocksProxyUserName(socksProxyUserNameTextField.getText());
    preferencesProxyDTO.setSocksProxyPassword(new String(socksProxyPasswordField.getPassword()));

    return preferencesProxyDTO;
  }