Package org.foray.fotree.value

Examples of org.foray.fotree.value.ValueCollection


        /* The remaining case is a comma-delimited list of font-families. */
        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().trim();
            final PropertyValue parsedToken = this.standardParse(fobj, token,
                    PdFontFamily.VALID_TOKEN_KEYWORDS);
            if (parsedToken.canEvalKeyword()
                    || parsedToken instanceof DtName
                    || parsedToken instanceof DtString) {
                collection.addItem(parsedToken);
            } else {
                throw this.unexpectedValue(token, fobj);
            }
        }
        return collection;
View Full Code Here


            /* The only keyword is "inherit". */
            return getValueNoInstance(context, fobj);
        }

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

        /* There should be one or more instances of <color>|transparent.
         * If there is only one, it will not be returned above as a valid
         * property value, because we only test for "inherit" there.
         * Therefore we need to tokenize and parse each item, even if there is
         * only one token. */
        final ValueCollection collection = new ValueCollection();
        final StringTokenizer st = new StringTokenizer(value);
        if (st.countTokens() < 1
                || st.countTokens() > PdBorderColor.MAX_TOKENS) {
            throw this.unexpectedValue(value, fobj);
        }
        while (st.hasMoreTokens()) {
            final String token = st.nextToken();
            final PropertyValue parsedToken = this.standardParse(fobj, token,
                    PdBorderColor.VALID_TOKEN_KEYWORDS);
            if (parsedToken.canEvalColor()
                    || parsedToken.canEvalKeyword()) {
                collection.addItem(parsedToken);
            } else {
                throw this.unexpectedValue(token, fobj);
            }
        }
        return collection;
View Full Code Here

     * issues.
     * @return The value of this property.
     */
    private Color getCollectionValue(final RelativeCompass direction,
            final FObj fobj, final FoContext context) {
        final ValueCollection collection = (ValueCollection) value();
        final int whichElement = PropertyCollection.whichElementForDirectional(
                direction, collection.getCount());
        final PropertyValue insideProperty = collection.getItem(whichElement);
        return insideProperty.evalColor();
    }
View Full Code Here

         * 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);
            }
        }
        return collection;
View Full Code Here

                return returnArray;
            }
            }
        }
        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) {
View Full Code Here

        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);
            }
        }
        return collection;
View Full Code Here

     * @param fobj The FO for which this value is needed.
     * @return The value of this property.
     */
    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();
View Full Code Here

        /* There should be one or more border-width instances. If there is only
         * one, it will not be returned above as a valid property value, because
         * we only test for "inherit" there. Therefore we need to tokenize
         * and parse each item, even if there is only one token. */
        final ValueCollection collection = new ValueCollection();
        final StringTokenizer st = new StringTokenizer(value);
        if (st.countTokens() < 1
                || st.countTokens() > PdBorderWidth.MAX_TOKENS) {
            throw this.unexpectedValue(value, fobj);
        }
        while (st.hasMoreTokens()) {
            final String token = st.nextToken();
            final PropertyValue parsedToken = this.standardParse(fobj, token,
                    DtBorderWidth.VALID_KEYWORDS);
            if (DtBorderWidth.isBorderWidth(parsedToken)) {
                collection.addItem(parsedToken);
            } else {
                throw this.unexpectedValue(token, fobj);
            }
        }
        return collection;
View Full Code Here

     * @param fobj The FO for which this value is needed.
     * @return The value of this property.
     */
    private int getCollectionValue(final FoContext context,
            final RelativeCompass 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.canEvalLength()) {
            return this.convertValueToLength(value, fobj, context);
        }
        if (value.canEvalKeyword()) {
            final FoPropertyKeyword keyword = (FoPropertyKeyword) value;
View Full Code Here

TOP

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

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.