use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.
the class FieldConfigGeometryFieldTest method testCreateCopy.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigGeometryField#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
class TestFieldConfigGeometryField extends FieldConfigGeometryField {
public TestFieldConfigGeometryField(FieldConfigCommonData commonData) {
super(commonData);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigGeometryField field = new TestFieldConfigGeometryField(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", true));
FieldConfigGeometryField copy = (FieldConfigGeometryField) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigGeometryField) 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 FieldConfigIntegerTest method testCreateCopy.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigInteger#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
boolean valueOnly = true;
class TestFieldConfigInteger extends FieldConfigInteger {
public TestFieldConfigInteger(FieldConfigCommonData commonData) {
super(commonData);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigInteger field = new TestFieldConfigInteger(new FieldConfigCommonData(Integer.class, FieldIdEnum.NAME, "label", valueOnly));
FieldConfigInteger copy = (FieldConfigInteger) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigInteger) 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 FieldConfigRangeTest method testCreateCopy.
/**
* Test method for {@link com.sldeditor.ui.detail.config.FieldConfigRange#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
boolean valueOnly = true;
class TestFieldConfigRange extends FieldConfigRange {
public TestFieldConfigRange(FieldConfigCommonData commonData, Class<?> rangeClass) {
super(commonData, rangeClass);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigRange field = new TestFieldConfigRange(new FieldConfigCommonData(Double.class, FieldIdEnum.NAME, "label", valueOnly), org.jaitools.numeric.Range.class);
FieldConfigRange copy = (FieldConfigRange) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigRange) 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 FieldConfigMarkerTest method testCreateCopy.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#createCopy(com.sldeditor.ui.detail.config.FieldConfigBase)}.
*/
@Test
public void testCreateCopy() {
boolean valueOnly = true;
class TestFieldConfigMarker extends FieldConfigMarker {
public TestFieldConfigMarker(FieldConfigCommonData commonData, ColourFieldConfig fillFieldConfig, ColourFieldConfig strokeFieldConfig, FieldIdEnum symbolSelectionField) {
super(commonData, fillFieldConfig, strokeFieldConfig, symbolSelectionField);
}
public FieldConfigPopulate callCreateCopy(FieldConfigBase fieldConfigBase) {
return createCopy(fieldConfigBase);
}
}
TestFieldConfigMarker field = new TestFieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
FieldConfigMarker copy = (FieldConfigMarker) field.callCreateCopy(null);
assertNull(copy);
copy = (FieldConfigMarker) 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 FieldConfigMarkerTest method testSetValue.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker#setValue(com.sldeditor.ui.detail.GraphicPanelFieldManager, com.sldeditor.ui.detail.config.FieldConfigSymbolType, org.opengis.style.GraphicalSymbol)}.
*/
@Test
public void testSetValue() {
GraphicPanelFieldManager fieldConfigManager = null;
Class<?> panelId = PointFillDetails.class;
fieldConfigManager = new GraphicPanelFieldManager(panelId);
// Test it with non null values
FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;
FieldConfigColour colourField = new FieldConfigColour(new FieldConfigCommonData(panelId, colourFieldId, "", false));
colourField.createUI();
String expectedColourValue = "#012345";
colourField.setTestValue(null, expectedColourValue);
double expectedOpacityValue = 0.72;
FieldConfigSlider opacityField = new FieldConfigSlider(new FieldConfigCommonData(panelId, colourFieldId, "", false));
opacityField.createUI();
opacityField.populateField(expectedOpacityValue);
FieldConfigBase symbolSelectionField = new FieldConfigSymbolType(new FieldConfigCommonData(panelId, colourFieldId, "", false));
symbolSelectionField.createUI();
fieldConfigManager.add(colourFieldId, colourField);
FieldIdEnum opacityFieldId = FieldIdEnum.OVERALL_OPACITY;
fieldConfigManager.add(opacityFieldId, opacityField);
FieldIdEnum symbolSelectionFieldId = FieldIdEnum.SYMBOL_TYPE;
fieldConfigManager.add(symbolSelectionFieldId, symbolSelectionField);
boolean valueOnly = true;
ColourFieldConfig fillConfig = new ColourFieldConfig(GroupIdEnum.FILL, FieldIdEnum.FILL_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_WIDTH);
ColourFieldConfig strokeConfig = new ColourFieldConfig(GroupIdEnum.STROKE, FieldIdEnum.STROKE_STROKE_COLOUR, FieldIdEnum.OVERALL_OPACITY, FieldIdEnum.STROKE_FILL_WIDTH);
FieldConfigMarker field2 = new FieldConfigMarker(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), fillConfig, strokeConfig, null);
field2.setValue(null, null, null, null, null);
field2.setValue(null, fieldConfigManager, null, null, null);
StyleBuilder styleBuilder = new StyleBuilder();
Mark marker = styleBuilder.createMark("star");
field2.setValue(null, null, null, null, marker);
field2.setValue(null, fieldConfigManager, null, null, marker);
}
Aggregations