use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigEnumTest method testCreateCopy.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigEnum#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
boolean valueOnly = true;
class TestFieldConfigEnum extends FieldConfigEnum {
public TestFieldConfigEnum(FieldConfigCommonData commonData) {
super(commonData);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigEnum field = new TestFieldConfigEnum(new FieldConfigCommonData(Integer.class, FieldIdEnum.NAME, "label", valueOnly));
FieldConfigEnum copy = (FieldConfigEnum) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigEnum) field.callCreateCopy(field);
assertEquals(field.getFieldId(), copy.getFieldId());
assertTrue(field.getLabel().compareTo(copy.getLabel()) == 0);
assertEquals(field.isValueOnly(), copy.isValueOnly());
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigGeometryTest method testCreateCopy.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigGeometry#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
boolean valueOnly = true;
class TestFieldConfigGeometry extends FieldConfigGeometry {
public TestFieldConfigGeometry(FieldConfigCommonData commonData, String buttonText) {
super(commonData, buttonText);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigGeometry field = new TestFieldConfigGeometry(new FieldConfigCommonData(Geometry.class, FieldIdEnum.NAME, "label", valueOnly), "button text");
FieldConfigGeometry copy = (TestFieldConfigGeometry) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigGeometry) field.callCreateCopy(field);
assertEquals(field.getFieldId(), copy.getFieldId());
assertTrue(field.getLabel().compareTo(copy.getLabel()) == 0);
assertEquals(field.isValueOnly(), copy.isValueOnly());
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigSliderTest method testCreateCopy.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigSlider#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
boolean valueOnly = true;
class TestFieldConfigSlider extends FieldConfigSlider {
public TestFieldConfigSlider(FieldConfigCommonData commonData) {
super(commonData);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigSlider field = new TestFieldConfigSlider(new FieldConfigCommonData(Double.class, FieldIdEnum.NAME, "label", valueOnly));
FieldConfigSlider copy = (FieldConfigSlider) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigSlider) field.callCreateCopy(field);
assertEquals(field.getFieldId(), copy.getFieldId());
assertTrue(field.getLabel().compareTo(copy.getLabel()) == 0);
assertEquals(field.isValueOnly(), copy.isValueOnly());
}
use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FontDetails method populateField.
/**
* Populate field.
*
* @param emptyList the empty list
* @param showMultipleCheckbox the show multiple checkbox
* @param fieldId the field id
* @param value the value
*/
private void populateField(boolean emptyList, boolean showMultipleCheckbox, FieldIdEnum fieldId, Expression value) {
FieldConfigBase fieldConfig = fieldConfigManager.get(fieldId);
if (fieldConfig != null) {
if (emptyList) {
fieldConfig.showOptionField(false);
fieldConfig.setEnabled(false);
} else {
fieldConfig.setEnabled(true);
fieldConfigVisitor.populateField(fieldId, value);
fieldConfig.showOptionField(showMultipleCheckbox);
boolean isSelected = (value != null);
fieldConfig.setOptionFieldValue(isSelected);
}
}
}
use of com.sldeditor.ui.detail.config.FieldConfigBase 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);
}
}
Aggregations