Search in sources :

Example 1 with PropertyExistsFunction

use of org.geotools.filter.function.PropertyExistsFunction in project sldeditor by robward-scisys.

the class FieldConfigGeometryField method populateExpression.

/**
 * Populate expression.
 *
 * @param objValue the obj value
 */
/*
     * (non-Javadoc)
     *
     * @see com.sldeditor.ui.detail.config.FieldConfigBase#populateExpression(java.lang.Object)
     */
@Override
public void populateExpression(Object objValue) {
    String propertyName = null;
    if (objValue instanceof PropertyExistsFunction) {
        Expression e = ((PropertyExistsFunction) objValue).getParameters().get(0);
        propertyName = e.toString();
    } else if (objValue instanceof AttributeExpressionImpl) {
        propertyName = ((AttributeExpressionImpl) objValue).getPropertyName();
    } else if (objValue instanceof LiteralExpressionImpl) {
        propertyName = AttributeUtils.extract((String) ((LiteralExpressionImpl) objValue).getValue());
    }
    populateField(propertyName);
}
Also used : PropertyExistsFunction(org.geotools.filter.function.PropertyExistsFunction) Expression(org.opengis.filter.expression.Expression) AttributeExpressionImpl(org.geotools.filter.AttributeExpressionImpl) LiteralExpressionImpl(org.geotools.filter.LiteralExpressionImpl)

Example 2 with PropertyExistsFunction

use of org.geotools.filter.function.PropertyExistsFunction in project sldeditor by robward-scisys.

the class DataSourceAttributePanel method setAttribute.

/**
 * Sets the attribute.
 *
 * @param expression the new attribute
 */
public void setAttribute(Expression expression) {
    String propertyName = null;
    if (expression instanceof PropertyExistsFunction) {
        Expression e = ((PropertyExistsFunction) expression).getParameters().get(0);
        Object value = ((LiteralExpressionImpl) e).getValue();
        propertyName = ((AttributeExpressionImpl) value).getPropertyName();
    } else if (expression instanceof AttributeExpressionImpl) {
        propertyName = ((AttributeExpressionImpl) expression).getPropertyName();
    } else if (expression instanceof LiteralExpressionImpl) {
        propertyName = AttributeUtils.extract((String) ((LiteralExpressionImpl) expression).getValue());
    }
    if (propertyName != null) {
        oldValueObj = propertyName;
        attributeComboBox.setSelectedItem(propertyName);
    } else {
        oldValueObj = propertyName;
        attributeComboBox.setSelectedIndex(-1);
    }
}
Also used : PropertyExistsFunction(org.geotools.filter.function.PropertyExistsFunction) Expression(org.opengis.filter.expression.Expression) AttributeExpressionImpl(org.geotools.filter.AttributeExpressionImpl) LiteralExpressionImpl(org.geotools.filter.LiteralExpressionImpl)

Aggregations

AttributeExpressionImpl (org.geotools.filter.AttributeExpressionImpl)2 LiteralExpressionImpl (org.geotools.filter.LiteralExpressionImpl)2 PropertyExistsFunction (org.geotools.filter.function.PropertyExistsFunction)2 Expression (org.opengis.filter.expression.Expression)2