Search in sources :

Example 11 with FieldConfigTTF

use of com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF in project sldeditor by robward-scisys.

the class FieldConfigTTFTest method testSetValue.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#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);
    FieldIdEnum colourFieldId = FieldIdEnum.FILL_COLOUR;
    FieldConfigColour colourField = new FieldConfigColour(new FieldConfigCommonData(panelId, colourFieldId, "", false));
    colourField.createUI();
    String expectedColourValue = "#012345";
    colourField.setTestValue(null, expectedColourValue);
    fieldConfigManager.add(colourFieldId, colourField);
    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);
    boolean valueOnly = true;
    FieldConfigTTF field = new FieldConfigTTF(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), fillConfig, strokeConfig, null);
    field.setValue(null, null, null, null, null);
    field.setValue(null, fieldConfigManager, null, null, null);
    field.createUI();
    StyleBuilder styleBuilder = new StyleBuilder();
    Mark marker = styleBuilder.createMark("star", Color.green, Color.black, 2.0);
    field.setValue(null, null, null, null, marker);
    field.setValue(null, fieldConfigManager, null, null, marker);
}
Also used : ColourFieldConfig(com.sldeditor.ui.detail.ColourFieldConfig) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) StyleBuilder(org.geotools.styling.StyleBuilder) FieldConfigTTF(com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF) Mark(org.geotools.styling.Mark) FieldConfigColour(com.sldeditor.ui.detail.config.FieldConfigColour) PointFillDetails(com.sldeditor.ui.detail.PointFillDetails) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GraphicPanelFieldManager(com.sldeditor.ui.detail.GraphicPanelFieldManager) Test(org.junit.Test)

Example 12 with FieldConfigTTF

use of com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF in project sldeditor by robward-scisys.

the class FieldConfigTTFTest method testAccept.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#accept(org.opengis.style.GraphicalSymbol)}.
 */
@Test
public void testAccept() {
    boolean valueOnly = true;
    FieldConfigTTF field = new FieldConfigTTF(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertFalse(field.accept(null));
    StyleBuilder styleBuilder = new StyleBuilder();
    ExternalGraphicImpl externalGraphic = (ExternalGraphicImpl) styleBuilder.createExternalGraphic("test.tmp", "png");
    assertFalse(field.accept(externalGraphic));
    Mark marker1 = styleBuilder.createMark("triangle");
    assertFalse(field.accept(marker1));
    Mark marker2 = styleBuilder.createMark("ttf://Arial");
    assertTrue(field.accept(marker2));
}
Also used : ExternalGraphicImpl(org.geotools.styling.ExternalGraphicImpl) FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) StyleBuilder(org.geotools.styling.StyleBuilder) FieldConfigTTF(com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF) Mark(org.geotools.styling.Mark) Test(org.junit.Test)

Example 13 with FieldConfigTTF

use of com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF in project sldeditor by robward-scisys.

the class FieldConfigTTFTest method testGetBasePanel.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#getBasePanel()}.
 */
@Test
public void testGetBasePanel() {
    boolean valueOnly = true;
    FieldConfigTTF field = new FieldConfigTTF(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertNull(field.getBasePanel());
}
Also used : FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigTTF(com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF) Test(org.junit.Test)

Example 14 with FieldConfigTTF

use of com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF in project sldeditor by robward-scisys.

the class FieldConfigTTFTest method testJustSelected.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#justSelected()}.
 */
@Test
public void testJustSelected() {
    boolean valueOnly = true;
    FieldConfigTTF field = new FieldConfigTTF(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    field.justSelected();
}
Also used : FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigTTF(com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF) Test(org.junit.Test)

Example 15 with FieldConfigTTF

use of com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF in project sldeditor by robward-scisys.

the class FieldConfigTTFTest method testGetSymbolClass.

/**
 * Test method for
 * {@link com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF#getSymbolClass()}.
 */
@Test
public void testGetSymbolClass() {
    boolean valueOnly = true;
    FieldConfigTTF field = new FieldConfigTTF(new FieldConfigCommonData(String.class, FieldIdEnum.NAME, "test label", valueOnly), null, null, null);
    assertEquals(ExternalGraphicImpl.class, field.getSymbolClass());
}
Also used : FieldConfigCommonData(com.sldeditor.ui.detail.config.FieldConfigCommonData) FieldConfigTTF(com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF) Test(org.junit.Test)

Aggregations

FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)17 FieldConfigTTF (com.sldeditor.ui.detail.config.symboltype.ttf.FieldConfigTTF)17 Test (org.junit.Test)17 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)2 ColourFieldConfig (com.sldeditor.ui.detail.ColourFieldConfig)2 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)2 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)2 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)2 Mark (org.geotools.styling.Mark)2 StyleBuilder (org.geotools.styling.StyleBuilder)2 FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)1 File (java.io.File)1 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 ExternalGraphicImpl (org.geotools.styling.ExternalGraphicImpl)1 GraphicalSymbol (org.opengis.style.GraphicalSymbol)1