// TODO use annotation to create a guiwrapper so isModified could be simplified
  public boolean isModified(
      JenkinsAppSettings jenkinsAppSettings, JenkinsSettings jenkinsSettings) {
    boolean credentialModified =
        !(jenkinsSettings.getUsername().equals(username.getText())) || isPasswordModified();

    boolean statusToIgnoreModified =
        successOrStableCheckBox.isSelected() != jenkinsAppSettings.shouldDisplaySuccessOrStable()
            || unstableOrFailCheckBox.isSelected()
                != jenkinsAppSettings.shouldDisplayFailOrUnstable()
            || abortedCheckBox.isSelected() != jenkinsAppSettings.shouldDisplayAborted();

    return !jenkinsAppSettings.getServerUrl().equals(serverUrl.getText())
        || !(jenkinsAppSettings.getBuildDelay() == getBuildDelay())
        || !(jenkinsAppSettings.getJobRefreshPeriod() == getJobRefreshPeriod())
        || !(jenkinsAppSettings.getRssRefreshPeriod() == getRssRefreshPeriod())
        || !(jenkinsSettings.getCrumbData().equals(crumbDataField.getText()))
        || credentialModified
        || statusToIgnoreModified
        || (!jenkinsAppSettings.getSuffix().equals(replaceWithSuffix.getText()));
  }
  // TODO use annotation to create a guiwrapper so isModified could be simplified
  public void applyConfigurationData(
      JenkinsAppSettings jenkinsAppSettings, JenkinsSettings jenkinsSettings)
      throws ConfigurationException {
    formValidator.validate();

    if (!StringUtils.equals(jenkinsAppSettings.getServerUrl(), serverUrl.getText())) {
      jenkinsSettings.getFavoriteJobs().clear();
      jenkinsSettings.setLastSelectedView(null);
    }

    jenkinsAppSettings.setServerUrl(serverUrl.getText());
    jenkinsAppSettings.setDelay(getBuildDelay());
    jenkinsAppSettings.setJobRefreshPeriod(getJobRefreshPeriod());
    jenkinsAppSettings.setRssRefreshPeriod(getRssRefreshPeriod());
    jenkinsSettings.setCrumbData(crumbDataField.getText());

    jenkinsAppSettings.setIgnoreSuccessOrStable(successOrStableCheckBox.isSelected());
    jenkinsAppSettings.setDisplayUnstableOrFail(unstableOrFailCheckBox.isSelected());
    jenkinsAppSettings.setDisplayAborted(abortedCheckBox.isSelected());
    jenkinsAppSettings.setSuffix(replaceWithSuffix.getText());

    if (StringUtils.isNotBlank(username.getText())) {
      jenkinsSettings.setUsername(username.getText());
    } else {
      jenkinsSettings.setUsername("");
    }

    if (isPasswordModified()) {
      jenkinsSettings.setPassword(getPassword());
      resetPasswordModification();
    }
  }
  public void loadConfigurationData(
      JenkinsAppSettings jenkinsAppSettings, JenkinsSettings jenkinsSettings) {
    serverUrl.setText(jenkinsAppSettings.getServerUrl());
    buildDelay.setText(String.valueOf(jenkinsAppSettings.getBuildDelay()));

    jobRefreshPeriod.setText(String.valueOf(jenkinsAppSettings.getJobRefreshPeriod()));

    rssRefreshPeriod.setText(String.valueOf(jenkinsAppSettings.getRssRefreshPeriod()));

    username.setText(jenkinsSettings.getUsername());
    if (StringUtils.isNotBlank(jenkinsSettings.getUsername())) {
      passwordField.setText(jenkinsSettings.getPassword());
      resetPasswordModification();
    }

    crumbDataField.setText(jenkinsSettings.getCrumbData());

    successOrStableCheckBox.setSelected(jenkinsAppSettings.shouldDisplaySuccessOrStable());
    unstableOrFailCheckBox.setSelected(jenkinsAppSettings.shouldDisplayFailOrUnstable());
    abortedCheckBox.setSelected(jenkinsAppSettings.shouldDisplayAborted());

    replaceWithSuffix.setText(String.valueOf(jenkinsAppSettings.getSuffix()));
  }