@Override public Charset getCharset() { return Charset.forName(charsetProperty.getValue()); }
@VisibleForTesting void initConfigurationTab() { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { view.addConfigurationProperty(configurationProperty.getName(), configurationProperty.getDescription()); view.setConfigurationPropertyValue(configurationProperty.getName(), configurationProperty.getValue()); } }
public void setValue(String value) { String errorMessage = validate(value); if (!"".equals(errorMessage)) { throw new IllegalArgumentException("The value \"" + value + "\" did not pass validation: " + errorMessage); } this.value = value; }
public void onConfigurationPropertyFocusLost(String name) { ConfigurationProperty configurationProperty = getConfigurationPropertyByName(name); Preconditions.checkArgument(configurationProperty != null, "No such configuration property: " + name); String newValueCandidate = view.getConfigurationPropertyValue(name); String errorMessage = configurationProperty.validate(newValueCandidate); view.setConfigurationPropertyErrorMessage(configurationProperty.getName(), errorMessage); if ("".equals(errorMessage)) { configurationProperty.setValue(newValueCandidate); configurationModel.setUpdatedFlag(); } else { view.setFocusOnConfigurationPropertyField(name); view.setFocusOnConfigurationView(); } }
@Test public void getConfiguration_charset() { PerlConfigurationModel model = new PerlConfigurationModel(); model.charsetProperty.setValue("UTF-8"); assertThat(model.getCharset()).isEqualTo(Charsets.UTF_8); assertThat(model.getConfiguration().getCharset()).isEqualTo(Charsets.UTF_8); model.charsetProperty.setValue("ISO-8859-1"); assertThat(model.getCharset()).isEqualTo(Charsets.ISO_8859_1); assertThat(model.getConfiguration().getCharset()).isEqualTo(Charsets.ISO_8859_1); }
private ConfigurationProperty getConfigurationPropertyByName(String name) { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { if (name.equals(configurationProperty.getName())) { return configurationProperty; } } return null; }
public void onConfigurationPropertyFocusLost(String name) { ConfigurationProperty configurationProperty = getConfigurationPropertyByName(name); if (configurationProperty == null) { throw new IllegalArgumentException("No such configuration property: " + name); } String newValueCandidate = view.getConfigurationPropertyValue(name); String errorMessage = configurationProperty.validate(newValueCandidate); view.setConfigurationPropertyErrorMessage(configurationProperty.getName(), errorMessage); if ("".equals(errorMessage)) { configurationProperty.setValue(newValueCandidate); configurationModel.setUpdatedFlag(); } else { view.setFocusOnConfigurationPropertyField(name); view.setFocusOnConfigurationView(); } }
private ConfigurationProperty getConfigurationPropertyByName(String name) { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { if (name.equals(configurationProperty.getName())) { return configurationProperty; } } return null; }
@Override public Charset getCharset() { return Charset.forName(charsetProperty.getValue()); }
void initConfigurationTab() { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { view.addConfigurationProperty(configurationProperty.getName(), configurationProperty.getDescription()); view.setConfigurationPropertyValue(configurationProperty.getName(), configurationProperty.getValue()); } }
public void onConfigurationPropertyFocusLost(String name) { ConfigurationProperty configurationProperty = getConfigurationPropertyByName(name); if (configurationProperty == null) { throw new IllegalArgumentException("No such configuration property: " + name); } String newValueCandidate = view.getConfigurationPropertyValue(name); String errorMessage = configurationProperty.validate(newValueCandidate); view.setConfigurationPropertyErrorMessage(configurationProperty.getName(), errorMessage); if ("".equals(errorMessage)) { configurationProperty.setValue(newValueCandidate); configurationModel.setUpdatedFlag(); } else { view.setFocusOnConfigurationPropertyField(name); view.setFocusOnConfigurationView(); } }
private ConfigurationProperty getConfigurationPropertyByName(String name) { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { if (name.equals(configurationProperty.getName())) { return configurationProperty; } } return null; }
public void setValue(String value) { String errorMessage = validate(value); Preconditions.checkArgument("".equals(errorMessage), "The value \"" + value + "\" did not pass validation: " + errorMessage); this.value = value; }
@Override public Charset getCharset() { return Charset.forName(charsetProperty.getValue()); }
void initConfigurationTab() { for (ConfigurationProperty configurationProperty : configurationModel.getProperties()) { view.addConfigurationProperty(configurationProperty.getName(), configurationProperty.getDescription()); view.setConfigurationPropertyValue(configurationProperty.getName(), configurationProperty.getValue()); } }
public void setValue(String value) { String errorMessage = validate(value); if (!"".equals(errorMessage)) { throw new IllegalArgumentException("The value \"" + value + "\" did not pass validation: " + errorMessage); } this.value = value; }
@Override public Charset getCharset() { return Charset.forName(charsetProperty.getValue()); }
@Override public Charset getCharset() { return Charset.forName(charsetProperty.getValue()); }
@Override public Charset getCharset() { return Charset.forName(charsetProperty.getValue()); }