Package org.foray.fotree.value

Examples of org.foray.fotree.value.ValueCollection


        if (pv != null) {
            return pv;
        }
        final List<String> tokenizedList = DtURI.tokenizeURIList(value);
        if (tokenizedList.size() > 0) {
            final ValueCollection collection = new ValueCollection();
            for (int i = 0; i < tokenizedList.size(); i++) {
                final String token = tokenizedList.get(i);
                final DtURI uri = DtURI.makeUriDT(token);
                if (uri != null) {
                    collection.addItem(uri);
                }
            }
            return collection;
        }
        throw unexpectedValue(value, fobj);
View Full Code Here


                return null;
            }
            }
        }
        if (value() instanceof ValueCollection) {
            final ValueCollection theCollection = (ValueCollection) value();
            final String[] returnArray = new String[theCollection.getCount()];
            for (int i = 0; i < theCollection.getCount(); i++) {
                final DtURI value = (DtURI) theCollection.getItem(i);
                returnArray[i] = value.getValue();
            }
            return returnArray;
        }
        throw this.unexpectedRetrieval();
View Full Code Here

     * @return The parsed, storable property.
     * @throws PropertyException For an invalid property value.
     */
    private PropertyValue parseTokens(final FObj fobj,
            final String attributeValue) throws PropertyException {
        final ValueCollection collection = new ValueCollection();
        final StringTokenizer tokenizer = new StringTokenizer(attributeValue);
        if (tokenizer.countTokens() < 1) {
            throw unexpectedValue(attributeValue, fobj);
        }
        while (tokenizer.hasMoreTokens()) {
            final String token = tokenizer.nextToken();
            final PropertyValue pv = parseToken(fobj, token);
            collection.addItem(pv);
        }
        return collection;
    }
View Full Code Here

    public float[] traitValue(final FObj fobj) {
        if (this.value == FoPropertyKeyword.getPropertyKeyword(
                FoValue.INHERIT)) {
            return PdAllowedWidthScale.traitValueNoInstance(fobj);
        }
        final ValueCollection collection = (ValueCollection) this.value;
        final float[] returnValue = new float[collection.getCount()];
        for (int i = 0; i < collection.getCount(); i++) {
            final PropertyValue pv = collection.getItem(i);
            if (pv.canEvalKeyword()) {
                returnValue[i] = java.lang.Float.POSITIVE_INFINITY;
            } else if (pv.canEvalPercentage()) {
                returnValue[i] = pv.evalPercentage();
            }
View Full Code Here

        final StringTokenizer st = new StringTokenizer(value);
        if (st.countTokens() < 1
                || st.countTokens() > PdMargin.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-style 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() > PdBorderStyle.MAX_TOKENS) {
            throw this.unexpectedValue(value, fobj);
        }
        while (st.hasMoreTokens()) {
            final String token = st.nextToken();
            final PropertyValue parsedToken = this.standardParse(fobj, token,
                    DtBorderStyle.VALID_KEYWORDS);
            final FoValue foValue = this.convertValueToFoValue(parsedToken);
            if (DtBorderStyle.isBorderStyle(foValue)) {
                final DtBorderStyle borderStyle = DtBorderStyle.getInstance(
                        foValue);
                collection.addItem(borderStyle);
            } 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 org.axsl.common.value.BorderStyle getCollectionValue(
            final FoContext context, final Compass direction, final FObj fobj) {
        final ValueCollection collection = (ValueCollection) value();
        final int whichElement = PropertyCollection.whichElementForDirectional(
                direction, collection.getCount());
        final PropertyValue insideValue = collection.getItem(whichElement);
        final DtBorderStyle borderStyleProperty = (DtBorderStyle)
                insideValue;
        return borderStyleProperty.getValue();
    }
View Full Code Here

        }
        final StringTokenizer st = new StringTokenizer(value);
        if (st.countTokens() < 1) {
            throw unexpectedValue(value, fobj);
        }
        final ValueCollection collection = new ValueCollection();
        while (st.hasMoreTokens()) {
            final String token = st.nextToken();
            pv = DtName.makeNameDT(token);
            if (pv == null) {
                throw unexpectedValue(value, fobj);
            }
            collection.addItem(pv);
        }
        return collection;
    }
View Full Code Here

     * @return The value of this property if it is a collection of names, or
     * null otherwise.
     */
    public String[] getValueNames() {
        if (value() instanceof ValueCollection) {
            final ValueCollection vc = (ValueCollection) value();
            return vc.toStringArray();
        }
        throw this.unexpectedRetrieval();
    }
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.