Package org.foray.fotree.value

Examples of org.foray.fotree.value.PropertyValue


     * @return The parsed, storable property value.
     * @throws PropertyException For an invalid property value.
     */
    private PropertyValue createPropertyValue(final FObj fobj,
            final String value) throws PropertyException {
        final PropertyValue pv = standardParse(fobj, value);
        if (pv.canEvalKeyword()) {
            return pv;
        }
        if (pv.canEvalInteger()) {
            return pv;
        }
        throw unexpectedValue(value, fobj);
    }
View Full Code Here


     * @return The parsed, storable property value.
     * @throws PropertyException For an invalid property value.
     */
    private PropertyValue createPropertyValue(final FObj fobj,
            final String value) throws PropertyException {
        final PropertyValue pv = standardParse(fobj, value);
        if (pv.canEvalKeyword()) {
            return pv;
        }
        if (pv.canEvalNumeric()) {
            return pv;
        }
        throw unexpectedValue(value, fobj);
    }
View Full Code Here

     * @return The parsed, storable property value.
     * @throws PropertyException For an invalid property value.
     */
    private PropertyValue createPropertyValue(final FObj fobj,
            final String value) throws PropertyException {
        final PropertyValue pv = this.standardParse(fobj, value);
        if (pv.canEvalKeyword()) {
            return pv;
        }

        /* The value is a list of voice families. The above only parses for
         * "inherit", so even if the first token is a keyword, it will not be
         * parsed that way. We need to tokenize and parse each token, even if
         * there is only one token. */
        final StringTokenizer tokenizer = new StringTokenizer(value);
        if (tokenizer.countTokens() < 1) {
            throw this.unexpectedValue(value, fobj);
        }
        final ValueCollection collection = new ValueCollection();
        while (tokenizer.hasMoreTokens()) {
            final String token = tokenizer.nextToken();
            final PropertyValue parsedToken = this.standardParse(fobj, token,
                    PdVoiceFamily.VALID_TOKEN_KEYWORDS);
            if (parsedToken.canEvalKeyword()
                    || parsedToken instanceof DtName) {
                collection.addItem(parsedToken);
            } else {
                throw this.unexpectedValue(token, fobj);
            }
View Full Code Here

        }
        if (value() instanceof ValueCollection) {
            final ValueCollection collection = (ValueCollection) value();
            final String[] returnArray = new String[collection.getCount()];
            for (int i = 0; i < returnArray.length; i++) {
                final PropertyValue innerValue = collection.getItem(i);
                if (innerValue.canEvalKeyword()) {
                    final FoValue foValue = this.convertValueToFoValue(
                            innerValue);
                    returnArray[i] = foValue.toXslFo();
                } else if (innerValue instanceof DtName) {
                    final DtName name = (DtName) innerValue;
View Full Code Here

     * @return The parsed, storable property value.
     * @throws PropertyException For an invalid property value.
     */
    private PropertyValue createPropertyValue(final FObj fobj,
            final String value) throws PropertyException {
        final PropertyValue pv = standardParse(fobj, value);
        if (pv.canEvalKeyword()) {
            return pv;
        }
        if (pv.canEvalInteger()) {
            return pv;
        }
        throw unexpectedValue(value, fobj);
    }
View Full Code Here

     * @return The parsed, storable property value.
     * @throws PropertyException For an invalid property value.
     */
    private PropertyValue createPropertyValue(final FObj fobj,
            final String value) throws PropertyException {
        final PropertyValue pv = this.standardParse(fobj, value);
        if (pv.canEvalKeyword()) {
            return pv;
        }

        /* It is a series of 1-4 tokens. */
        final StringTokenizer st = new StringTokenizer(value);
        if (st.countTokens() < 1
                || st.countTokens() > PdPadding.MAX_TOKENS) {
            throw this.unexpectedValue(value, fobj);
        }
        final ValueCollection collection = new ValueCollection();
        while (st.hasMoreTokens()) {
            final String token = st.nextToken();
            final PropertyValue parsedToken = this.standardParse(fobj, value,
                    null);
            if (parsedToken.canEvalLength()
                    || parsedToken.canEvalPercentage()) {
                collection.addItem(parsedToken);
            } else {
                throw this.unexpectedValue(token, fobj);
            }
        }
View Full Code Here

    private int getCollectionValue(final FoContext context,
            final AbsoluteCompass direction, final FObj fobj) {
        final ValueCollection collection = (ValueCollection) value();
        final int whichElement = PropertyCollection.whichElementForDirectional(
                direction, collection.getCount());
        final PropertyValue value = collection.getItem(whichElement);
        if (value.canEvalPercentage()) {
            int base = 0;
            if (fobj instanceof SimplePageMaster) {
                final SimplePageMaster spm = (SimplePageMaster) fobj;
                base = spm.traitPageHeight();
            } else {
                base = context.widthContainingBlock();
            }
            final float percent = value.evalPercentage();
            return Math.round(base * percent / WKConstants.PERCENT_CONVERSION);
        }
        if (value.canEvalLength()) {
            return this.convertValueToLength(value, fobj, context);
        }
        throw this.unexpectedRetrieval();
    }
View Full Code Here

     * @throws PropertyException For an invalid property value.
     */
    private PropertyValue createPropertyValue(final FObj fobj,
            final String value)
            throws PropertyException {
        PropertyValue pv = standardParse(fobj, value);
        if (pv.canEvalKeyword()) {
            return pv;
        }
        pv = this.standardParse(fobj, value, DtBorderStyle.VALID_KEYWORDS);
        if (this.canEvalBorderStyle(pv)) {
            return pv;
View Full Code Here

     * @return The parsed, storable property value.
     * @throws PropertyException For an invalid property value.
     */
    private PropertyValue createPropertyValue(final FObj fobj,
            final String value) throws PropertyException {
        final PropertyValue pv = standardParse(fobj, value);
        if (pv.canEvalKeyword()) {
            return pv;
        }
        if (pv.canEvalPercentage()) {
            return pv;
        }
        if (pv.canEvalLength()) {
            return pv;
        }
        throw unexpectedValue(value, fobj);
    }
View Full Code Here

     * @throws PropertyException For an invalid property value.
     */
    protected PropertyValue createPropertyValue(final FObj fobj,
            final FoProperty enumeration, final String value)
            throws PropertyException {
        final PropertyValue pv = standardParse(fobj, value);
        if (pv.canEvalColor()) {
            return pv;
        }
        if (pv.canEvalKeyword()) {
            return pv;
        }
        throw unexpectedValue(value, fobj);
    }
View Full Code Here

TOP

Related Classes of org.foray.fotree.value.PropertyValue

Copyright © 2018 www.massapicom. 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.