Examples of DtLengthRange


Examples of org.foray.fotree.value.DtLengthRange

        if (pv.canEvalKeyword()) {
            return pv;
        }
        if (pv.canEvalPercentage()
                || pv.canEvalLength()) {
            return new DtLengthRange(true, pv, pv, pv);
        }
        throw unexpectedValue(value, fobj);
    }
View Full Code Here

Examples of org.foray.fotree.value.DtLengthRange

     */
    private PropertyValue createPropertyValueLengthRange(
            final FObj fobj, final String value,
            final String subPropertyName,
            final String propertyFullName) throws PropertyException {
        final DtLengthRange lengthRange = createOrAddLengthRange(null,
                fobj, value, subPropertyName, propertyFullName);
        if (lengthRange != null) {
            return lengthRange;
        }
        throw unexpectedValue(value, fobj);
View Full Code Here

Examples of org.foray.fotree.value.DtLengthRange

     * @return The value of this property.
     */
    public int getValue(final FoContext context, final LengthRange subProperty,
            final FObj fobj) {
        if (value() instanceof DtLengthRange) {
            final DtLengthRange lengthRange = (DtLengthRange) value();
            PropertyValue length = null;
            switch (subProperty) {
            case MINIMUM: {
                length = lengthRange.getLengthMinimum();
                break;
            }
            case OPTIMUM: {
                length = lengthRange.getLengthOptimum();
                break;
            }
            case MAXIMUM: {
                length = lengthRange.getLengthMaximum();
                break;
            }
            default: {
                return 0;
            }
View Full Code Here

Examples of org.foray.fotree.value.DtLengthRange

            final String propertyFullName, final String attributeValue)
            throws PropertyException {
        if (! (value() instanceof DtLengthRange)) {
            return false;
        }
        DtLengthRange lengthRange = (DtLengthRange) value();
        final String subPropertyName = Property.getSubPropertyName(
                propertyFullName);
        lengthRange = createOrAddLengthRange(lengthRange, fobj,
                attributeValue, subPropertyName, propertyFullName);
        return true;
View Full Code Here

Examples of org.foray.fotree.value.DtLengthRange

    private DtLengthRange createOrAddLengthRange(
            final DtLengthRange inputLengthRange,
            final FObj fobj, final String value,
            final String subPropertyName, final String propertyFullName)
            throws PropertyException {
        DtLengthRange lengthRange = inputLengthRange;
        if (lengthRange == null) {
            final DtLength lengthMin = DtLength.ZERO_LENGTH;
            final DtLength lengthOpt = PdLeaderLength.DEFAULT_OPTIMUM_COMPONENT;
            final DtPercentage lengthMax =
                    PdLeaderLength.DEFAULT_MAXIMUM_COMPONENT;
            lengthRange = new DtLengthRange(true, lengthMin, lengthOpt,
                    lengthMax);
        }

        final PropertyValue pv = standardParse(fobj, value);
        if (! pv.canEvalLength()
                && ! pv.canEvalPercentage()) {
            throw unexpectedValue(value, fobj);
        }
        if (subPropertyName.equals("minimum")) {
            lengthRange.setLengthMinimum(pv);
            return lengthRange;
        } else if (subPropertyName.equals("optimum")) {
            lengthRange.setLengthOptimum(pv);
            return lengthRange;
        } else if (subPropertyName.equals("maximum")) {
            lengthRange.setLengthMaximum(pv);
            return lengthRange;
        }
        throw Property.invalidPropertyName(propertyFullName);
    }
View Full Code Here

Examples of org.foray.fotree.value.DtLengthRange

     * @return The value of this property.
     */
    public int getValue(final FoContext context, final LengthRange subProperty,
            final FObj fobj) {
        if (value() instanceof DtLengthRange) {
            final DtLengthRange lengthRange = (DtLengthRange) value();
            PropertyValue length = null;
            switch (subProperty) {
            case MINIMUM: {
                length = lengthRange.getLengthMinimum();
                break;
            }
            case OPTIMUM: {
                length = lengthRange.getLengthOptimum();
                break;
            }
            case MAXIMUM: {
                length = lengthRange.getLengthMaximum();
                break;
            }
            default: {
                return FObj.DIMENSION_AUTO;
            }
View Full Code Here

Examples of org.foray.fotree.value.DtLengthRange

            final String propertyFullName, final String attributeValue)
            throws PropertyException {
        if (! (value() instanceof DtLengthRange)) {
            return false;
        }
        final DtLengthRange lr = (DtLengthRange) value();
        final PropertyValue pv = standardParse(fobj, attributeValue);
        if (! (pv instanceof DtLength)) {
            throw unexpectedValue(attributeValue, fobj);
        }
        final DtLength length = (DtLength) pv;
        final String subPropertyName = getSubPropertyName(propertyFullName);
        final boolean componentAdded = lr.setComponent(subPropertyName, length);
        if (! componentAdded) {
            throw Property.invalidPropertyName(propertyFullName);
        }
        return componentAdded;
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.