Search in sources :

Example 26 with FieldConfigBase

use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.

the class GraphicPanelFieldManager method getData.

/**
 * Gets the data.
 *
 * @param requestedPanelId the requested panel id
 * @param requestedField the requested field
 * @return the data
 */
public FieldConfigBase getData(Class<?> requestedPanelId, FieldIdEnum requestedField) {
    FieldConfigBase retVal = null;
    Map<FieldIdEnum, FieldConfigBase> panelMap = fieldConfigMap.get(requestedPanelId);
    if (panelMap != null) {
        retVal = panelMap.get(requestedField);
    }
    return retVal;
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum)

Example 27 with FieldConfigBase

use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.

the class PointFillDetails method setSymbolTypeVisibility.

/**
 * Sets the symbol type visibility.
 *
 * @param panelId the panel id
 * @param selectedItem the selected item
 */
private void setSymbolTypeVisibility(Class<?> panelId, String selectedItem) {
    Map<GroupIdEnum, Boolean> groupList = fieldEnableState.getGroupIdList(panelId.getName(), selectedItem);
    for (GroupIdEnum groupId : groupList.keySet()) {
        boolean groupEnabled = groupList.get(groupId);
        GroupConfigInterface groupConfig = fieldConfigManager.getGroup(this.getClass(), groupId);
        if (groupConfig != null) {
            groupConfig.setGroupStateOverride(groupEnabled);
        } else {
            ConsoleManager.getInstance().error(this, "Failed to find group : " + groupId.toString());
        }
    }
    Map<FieldIdEnum, Boolean> fieldList = fieldEnableState.getFieldIdList(panelId.getName(), selectedItem);
    for (FieldIdEnum fieldId : fieldList.keySet()) {
        boolean fieldEnabled = fieldList.get(fieldId);
        FieldConfigBase fieldConfig = fieldConfigManager.get(fieldId);
        if (fieldConfig != null) {
            CurrentFieldState fieldState = fieldConfig.getFieldState();
            fieldState.setFieldEnabled(fieldEnabled);
            fieldConfig.setFieldState(fieldState);
        } else {
            ConsoleManager.getInstance().error(this, "Failed to find field : " + fieldId.toString());
        }
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) CurrentFieldState(com.sldeditor.ui.detail.config.base.CurrentFieldState) GroupConfigInterface(com.sldeditor.ui.detail.config.base.GroupConfigInterface) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) GroupIdEnum(com.sldeditor.common.xml.ui.GroupIdEnum)

Example 28 with FieldConfigBase

use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.

the class PointFillDetails method optionSelected.

/**
 * Option selected.
 *
 * @param fieldPanelId the field panel id
 * @param selectedItem the selected item
 */
@Override
public void optionSelected(Class<?> fieldPanelId, String selectedItem) {
    setSymbolTypeVisibility(fieldPanelId, selectedItem);
    selectedFillPanelId = fieldPanelId;
    FieldConfigBase fieldConfig = fieldConfigManager.get(FieldIdEnum.SIZE);
    if (fieldConfig.isEnabled()) {
        Expression expression = fieldConfig.getExpression();
        if (expression instanceof LiteralExpressionImpl) {
            LiteralExpressionImpl l = (LiteralExpressionImpl) expression;
            Double d = (Double) l.getValue();
            if (d <= 0.0) {
                fieldConfigVisitor.populateField(FieldIdEnum.SIZE, getFilterFactory().literal(1));
            }
        }
    }
    dataHasChanged();
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) Expression(org.opengis.filter.expression.Expression) LiteralExpressionImpl(org.geotools.filter.LiteralExpressionImpl)

Example 29 with FieldConfigBase

use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.

the class RuleDetails method createFilter.

/**
 * Creates the filter.
 *
 * @return the j panel
 */
private void createFilter() {
    FieldIdEnum filterFieldId = FieldIdEnum.FILTER;
    FieldConfigBase fieldConfig = fieldConfigManager.get(filterFieldId);
    if (fieldConfig != null) {
        FieldPanel fieldPanel = fieldConfig.getPanel();
        JButton btnEditFilter = new JButton(Localisation.getString(RuleDetails.class, "RuleDetails.edit"));
        btnEditFilter.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                editFilter(filterFieldId);
            }
        });
        btnEditFilter.setBounds(WIDGET_X_START + WIDGET_EXTENDED_WIDTH, 0, WIDGET_BUTTON_WIDTH, WIDGET_HEIGHT);
        fieldPanel.add(btnEditFilter);
        JButton btnClearFilter = new JButton(Localisation.getString(RuleDetails.class, "RuleDetails.clear"));
        btnClearFilter.addActionListener(new ActionListener() {

            public void actionPerformed(ActionEvent e) {
                clearFilter(filterFieldId);
            }
        });
        int x = btnEditFilter.getX() + btnEditFilter.getWidth() + 5;
        btnClearFilter.setBounds(x, 0, WIDGET_BUTTON_WIDTH, WIDGET_HEIGHT);
        fieldPanel.add(btnClearFilter);
    }
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) ActionListener(java.awt.event.ActionListener) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) FieldIdEnum(com.sldeditor.common.xml.ui.FieldIdEnum) FieldPanel(com.sldeditor.ui.widgets.FieldPanel)

Example 30 with FieldConfigBase

use of com.sldeditor.ui.detail.config.FieldConfigBase in project sldeditor by robward-scisys.

the class StandardPanel method getStandardData.

/**
 * Gets the standard data.
 *
 * @return the standard data
 */
protected StandardData getStandardData() {
    StandardData standardData = new StandardData();
    if (fieldConfigVisitor.getFieldConfig(FieldIdEnum.NAME) != null) {
        standardData.name = fieldConfigVisitor.getText(FieldIdEnum.NAME);
    }
    if ((fieldConfigVisitor.getFieldConfig(FieldIdEnum.TITLE) != null) && (fieldConfigVisitor.getFieldConfig(FieldIdEnum.DESCRIPTION) != null)) {
        InternationalString titleString = Text.text(fieldConfigVisitor.getText(FieldIdEnum.TITLE));
        InternationalString descriptionString = Text.text(fieldConfigVisitor.getText(FieldIdEnum.DESCRIPTION));
        standardData.description = (Description) getStyleFactory().description(titleString, descriptionString);
    }
    FieldConfigBase uomFieldConfig = fieldConfigManager.get(FieldIdEnum.UOM);
    if (uomFieldConfig != null) {
        Expression uomExpression = fieldConfigVisitor.getExpression(FieldIdEnum.UOM);
        String uomString = "";
        if (uomExpression instanceof LiteralExpressionImpl) {
            uomString = (String) ((LiteralExpressionImpl) uomExpression).getValue();
        } else {
            if (uomExpression != null) {
                ConsoleManager.getInstance().error(this, Localisation.getString(StandardPanel.class, "StandardPanel.unsupportedUOM") + uomExpression.getClass().getName());
            }
        }
        standardData.unit = UnitsOfMeasure.getInstance().convert(uomString);
    }
    return standardData;
}
Also used : FieldConfigBase(com.sldeditor.ui.detail.config.FieldConfigBase) InternationalString(org.opengis.util.InternationalString) Expression(org.opengis.filter.expression.Expression) LiteralExpressionImpl(org.geotools.filter.LiteralExpressionImpl) InternationalString(org.opengis.util.InternationalString)

Aggregations

FieldConfigBase (com.sldeditor.ui.detail.config.FieldConfigBase)93 FieldConfigCommonData (com.sldeditor.ui.detail.config.FieldConfigCommonData)43 Test (org.junit.Test)42 FieldIdEnum (com.sldeditor.common.xml.ui.FieldIdEnum)27 FieldConfigColour (com.sldeditor.ui.detail.config.FieldConfigColour)22 Expression (org.opengis.filter.expression.Expression)19 Mark (org.geotools.styling.Mark)14 GraphicPanelFieldManager (com.sldeditor.ui.detail.GraphicPanelFieldManager)13 FieldConfigSlider (com.sldeditor.ui.detail.config.FieldConfigSlider)13 FieldConfigSymbolType (com.sldeditor.ui.detail.config.FieldConfigSymbolType)13 GroupConfigInterface (com.sldeditor.ui.detail.config.base.GroupConfigInterface)13 PointFillDetails (com.sldeditor.ui.detail.PointFillDetails)12 ColourFieldConfig (com.sldeditor.ui.detail.ColourFieldConfig)10 ArrayList (java.util.ArrayList)10 Fill (org.geotools.styling.Fill)10 GraphicFill (org.opengis.style.GraphicFill)10 GraphicalSymbol (org.opengis.style.GraphicalSymbol)10 Geometry (com.vividsolutions.jts.geom.Geometry)9 StyleBuilder (org.geotools.styling.StyleBuilder)8 FieldConfigMarker (com.sldeditor.ui.detail.config.symboltype.FieldConfigMarker)7