Search in sources :

Example 1 with BinaryExpression

use of org.opengis.filter.expression.BinaryExpression in project sldeditor by robward-scisys.

the class FieldConfigBase method populate.

/**
 * Populate.
 *
 * @param expression the expression
 */
public void populate(Expression expression) {
    if (attributeSelectionPanel != null) {
        attributeSelectionPanel.populateAttributeComboxBox(expression);
    }
    if (expression == null) {
        expressionType = ExpressionTypeEnum.E_VALUE;
        revertToDefaultValue();
        valueUpdated();
    } else {
        if (expression instanceof LiteralExpressionImpl) {
            LiteralExpressionImpl lExpression = (LiteralExpressionImpl) expression;
            Object objValue = lExpression.getValue();
            if (objValue instanceof AttributeExpressionImpl) {
                expressionType = ExpressionTypeEnum.E_ATTRIBUTE;
                if (attributeSelectionPanel != null) {
                    attributeSelectionPanel.setAttribute((AttributeExpressionImpl) objValue);
                }
                setCachedExpression((AttributeExpressionImpl) objValue);
            } else {
                expressionType = ExpressionTypeEnum.E_VALUE;
                populateExpression(objValue);
                valueUpdated();
            }
        } else if (expression instanceof ConstantExpression) {
            ConstantExpression cExpression = (ConstantExpression) expression;
            Object objValue = cExpression.getValue();
            expressionType = ExpressionTypeEnum.E_VALUE;
            populateExpression(objValue);
            valueUpdated();
        } else if (expression instanceof NilExpression) {
            Object objValue = null;
            expressionType = ExpressionTypeEnum.E_VALUE;
            populateExpression(objValue);
            valueUpdated();
        } else if (expression instanceof ProcessFunction) {
            ProcessFunction processExpression = (ProcessFunction) expression;
            Object objValue = processExpression;
            expressionType = ExpressionTypeEnum.E_VALUE;
            populateExpression(objValue);
            valueUpdated();
        } else if (expression instanceof AttributeExpressionImpl) {
            expressionType = ExpressionTypeEnum.E_ATTRIBUTE;
            if (attributeSelectionPanel != null) {
                attributeSelectionPanel.setAttribute(expression);
            } else {
                populateExpression(expression);
            }
            setCachedExpression(expression);
        } else if (expression instanceof FunctionExpressionImpl) {
            expressionType = ExpressionTypeEnum.E_EXPRESSION;
            if (attributeSelectionPanel != null) {
                attributeSelectionPanel.populate(expression);
            }
            setCachedExpression(expression);
        } else if (expression instanceof BinaryExpression) {
            expressionType = ExpressionTypeEnum.E_EXPRESSION;
            if (attributeSelectionPanel != null) {
                attributeSelectionPanel.populate(expression);
            }
            setCachedExpression(expression);
        } else {
            expressionType = ExpressionTypeEnum.E_EXPRESSION;
        }
    }
    setValueFieldState();
}
Also used : ProcessFunction(org.geotools.process.function.ProcessFunction) BinaryExpression(org.opengis.filter.expression.BinaryExpression) AttributeExpressionImpl(org.geotools.filter.AttributeExpressionImpl) LiteralExpressionImpl(org.geotools.filter.LiteralExpressionImpl) ConstantExpression(org.geotools.filter.ConstantExpression) NilExpression(org.opengis.filter.expression.NilExpression) FunctionExpressionImpl(org.geotools.filter.FunctionExpressionImpl)

Aggregations

AttributeExpressionImpl (org.geotools.filter.AttributeExpressionImpl)1 ConstantExpression (org.geotools.filter.ConstantExpression)1 FunctionExpressionImpl (org.geotools.filter.FunctionExpressionImpl)1 LiteralExpressionImpl (org.geotools.filter.LiteralExpressionImpl)1 ProcessFunction (org.geotools.process.function.ProcessFunction)1 BinaryExpression (org.opengis.filter.expression.BinaryExpression)1 NilExpression (org.opengis.filter.expression.NilExpression)1