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())); }
// 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())); }