use of com.sldeditor.ui.detail.config.FieldConfigString in project sldeditor by robward-scisys.
the class FieldConfigStringTest method testGenerateExpression.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigString#generateExpression()}. Test method
* for
* {@link com.sldeditor.ui.detail.config.FieldConfigString#populateExpression(java.lang.Object, org.opengis.filter.expression.Expression)}.
*/
@Test
public void testGenerateExpression() {
boolean valueOnly = true;
class TestFieldConfigString extends FieldConfigString {
public TestFieldConfigString(FieldConfigCommonData commonData, String buttonText) {
super(commonData, buttonText);
}
public Expression callGenerateExpression() {
return generateExpression();
}
}
TestFieldConfigString field = new TestFieldConfigString(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), "button text");
Expression actualExpression = field.callGenerateExpression();
assertNull(actualExpression);
field.createUI();
String expectedValue = "test string value";
field.setTestValue(null, expectedValue);
actualExpression = field.callGenerateExpression();
assertTrue(expectedValue.compareTo(actualExpression.toString()) == 0);
expectedValue = "test string value as expression";
field.populateExpression(expectedValue);
actualExpression = field.callGenerateExpression();
assertTrue(expectedValue.compareTo(actualExpression.toString()) == 0);
}
use of com.sldeditor.ui.detail.config.FieldConfigString in project sldeditor by robward-scisys.
the class FieldConfigStringTest method testSetTestValueFieldIdString.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigString#setTestValue(com.sldeditor.ui.detail.config.FieldId, java.lang.String)}.
*/
@Test
public void testSetTestValueFieldIdString() {
boolean valueOnly = true;
FieldConfigString field = new FieldConfigString(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), "button text");
String expectedTestValue = "test value";
field.setTestValue(FieldIdEnum.ANCHOR_POINT_V, expectedTestValue);
assertNull(field.getStringValue());
field.createUI();
field.setTestValue(FieldIdEnum.ANCHOR_POINT_V, expectedTestValue);
assertTrue(expectedTestValue.compareTo(field.getStringValue()) == 0);
}
use of com.sldeditor.ui.detail.config.FieldConfigString in project sldeditor by robward-scisys.
the class FieldConfigStringTest method testAddButtonPressedListener.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigString#addButtonPressedListener(com.sldeditor.ui.detail.config.FieldConfigStringButtonInterface)}.
*/
@Test
public void testAddButtonPressedListener() {
boolean valueOnly = true;
FieldConfigString field = new FieldConfigString(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), "button text");
field.addButtonPressedListener(null);
}
use of com.sldeditor.ui.detail.config.FieldConfigString in project sldeditor by robward-scisys.
the class BasePanel method registerForTextFieldButton.
/**
* Register for text field button.
*
* @param fieldId the field id
* @param listener the listener
*/
protected void registerForTextFieldButton(FieldIdEnum fieldId, FieldConfigStringButtonInterface listener) {
FieldConfigBase fieldConfig = fieldConfigManager.get(fieldId);
if (fieldConfig != null) {
FieldConfigString textField = (FieldConfigString) fieldConfig;
textField.addButtonPressedListener(listener);
}
}
use of com.sldeditor.ui.detail.config.FieldConfigString in project sldeditor by robward-scisys.
the class RuleDetails method getMaximumValue.
/**
* Gets the maximum value.
*
* @param field the field
* @return the maximum value
*/
private static double getMaximumValue(FieldConfigBase field) {
double value = Double.POSITIVE_INFINITY;
if (field.isEnabled()) {
FieldConfigString textFieldConfig = (FieldConfigString) field;
value = ScaleUtil.extractValue(textFieldConfig.getStringValue());
}
return value;
}
Aggregations