use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigBaseTest method testAddUI.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBase#addUI(java.awt.Component,int, int, int)}.
*/
@Test
public void testAddUI() {
FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
String expectedLabel = "test label";
TestFieldConfigBase field = new TestFieldConfigBase(new FieldConfigCommonData(String.class, expectedFieldId, expectedLabel, false));
field.addUI(null, 10, 10, 10);
field.createUI();
field.addUI(new JButton(), 10, 10, 10);
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigBaseTest method testGetCustomPanels.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBase#addCustomPanel(javax.swing.JPanel)}.
* Test method for {@link com.sldeditor.ui.detail.config.FieldConfigBase#getCustomPanels()}.
*/
@Test
public void testGetCustomPanels() {
boolean valueOnly = true;
FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
String expectedLabel = "test label";
TestFieldConfigBase field = new TestFieldConfigBase(new FieldConfigCommonData(String.class, expectedFieldId, expectedLabel, valueOnly));
assertNull(field.getCustomPanels());
JPanel expectedPanel = new JPanel();
field.testAddCustomPanel(expectedPanel);
List<Component> customPanelList = field.getCustomPanels();
assertEquals(1, customPanelList.size());
assertEquals(expectedPanel, customPanelList.get(0));
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigBaseTest method testDuplicate.
/**
* Test method for {@link com.sldeditor.ui.detail.config.FieldConfigBase#duplicate()}.
*/
@Test
public void testDuplicate() {
FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
String expectedLabel = "test label";
TestFieldConfigBase field = new TestFieldConfigBase(new FieldConfigCommonData(String.class, expectedFieldId, expectedLabel, false));
TestUpdateSymbolInterface listener = new TestUpdateSymbolInterface();
field.addDataChangedListener(listener);
FieldConfigString copy = (FieldConfigString) field.duplicate();
assertNotNull(copy);
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigBaseTest method testSetValueFieldState.
/**
* Test method for {@link com.sldeditor.ui.detail.config.FieldConfigBase#setValueFieldState()}.
*/
@Test
public void testSetValueFieldState() {
boolean valueOnly = true;
FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
String expectedLabel = "test label";
TestFieldConfigBase field = new TestFieldConfigBase(new FieldConfigCommonData(String.class, expectedFieldId, expectedLabel, valueOnly));
AttributeSelection attributeSelectionPanel = AttributeSelection.createAttributes(String.class, field, false);
attributeSelectionPanel.setEnabled(true);
field.testAttributeSelectionPanel(attributeSelectionPanel);
field.testSetValueFieldState();
assertFalse(field.isEnabled());
assertTrue(field.getAttributeSelectionPanel().isEnabled());
boolean fieldEnabledFlag = false;
field.testSetValueFieldState();
assertEquals(fieldEnabledFlag, field.isEnabled());
field.attributeUpdated("");
assertEquals(fieldEnabledFlag, field.isEnabled());
}
use of com.sldeditor.ui.detail.config.FieldConfigCommonData in project sldeditor by robward-scisys.
the class FieldConfigBaseTest method testFireExpressionUpdated.
/**
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBase#setExpressionUpdateListener(com.sldeditor.ui.iface.ExpressionUpdateInterface)}.
* Test method for
* {@link com.sldeditor.ui.detail.config.FieldConfigBase#fireExpressionUpdated(org.opengis.filter.expression.Expression)}.
*/
@Test
public void testFireExpressionUpdated() {
FieldIdEnum expectedFieldId = FieldIdEnum.NAME;
String expectedLabel = "test label";
TestFieldConfigBase field = new TestFieldConfigBase(new FieldConfigCommonData(String.class, expectedFieldId, expectedLabel, false));
TestExpressionUpdateInterface testExpressionUpdate = new TestExpressionUpdateInterface();
field.setExpressionUpdateListener(null);
field.testFireExpressionUpdated(null);
field.setExpressionUpdateListener(testExpressionUpdate);
field.testFireExpressionUpdated(null);
assertTrue(testExpressionUpdate.hasExpressionBeenCalled());
}
Aggregations