Search in sources :

Example 36 with FieldConfigCommonData

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);
}
Also used : FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) JButton(javax.swing.JButton) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) Test(org.junit.Test)

Example 37 with FieldConfigCommonData

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));
}
Also used : JPanel(javax.swing.JPanel) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) Component(java.awt.Component) Test(org.junit.Test)

Example 38 with FieldConfigCommonData

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);
}
Also used : FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) Test(org.junit.Test)

Example 39 with FieldConfigCommonData

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());
}
Also used : AttributeSelection(com.sldeditor.ui.attribute.AttributeSelection) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) Test(org.junit.Test)

Example 40 with FieldConfigCommonData

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());
}
Also used : FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigString(com.sldeditor.ui.detail.config.FieldConfigString) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) Test(org.junit.Test)

Aggregations

FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)322 Test (org.junit.Test)316 Geometry (com.vividsolutions.jts.geom.Geometry)69 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)54 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)44 FieldConfigString (com.sldeditor.ui.detail.config.FieldConfigString)38 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)34 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)24 StyleBuilder (org.geotools.styling.StyleBuilder)24 FieldConfigMarker (com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker)22 UndoEvent (com.sldeditor.common.undo.UndoEvent)20 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)20 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)20 Expression (org.opengis.filter.expression.Expression)20 FieldConfigWindBarbs (com.sldeditor.ui.detail.vendor.geoserver.marker.windbarb.FieldConfigWindBarbs)18 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)17 FieldConfigTTF (com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF)17 FieldConfigFilename (com.sldeditor.ui.detail.config.symboltype.externalgraphic.FieldConfigFilename)16 FieldConfigArrow (com.sldeditor.ui.detail.vendor.geoserver.marker.arrow.FieldConfigArrow)16 FieldConfigWKT (com.sldeditor.ui.detail.vendor.geoserver.marker.wkt.FieldConfigWKT)16