Examples of PdCountry


Examples of org.foray.fotree.fo.prop.PdCountry

            final String propertyFullName, final String value)
            throws PropertyException {
        final PropertyCollection collection = new PropertyCollection();
        final PropertyValue pv = checkKeywords(this.getValidKeywords(), value);
        if (pv != null) {
            collection.addItem(new PdCountry(pv));
            collection.addItem(new PdLanguage(pv));
            return collection;
        }
        // There are 2 properties which can be explicitly set
        final byte maxTokens = 2;
        // Tokenize the input & put the tokens into an ArrayList
        final StringTokenizer st = new StringTokenizer(value);
        final List<String> tokenList = new ArrayList<String>(st.countTokens());
        while (st.hasMoreTokens()) {
            tokenList.add(st.nextToken());
        }
        if (tokenList.size() < 1 || tokenList.size() > maxTokens) {
            throw unexpectedValue(value, fobj);
        }
        // Create an array indicating which property is in each position
        final FoProperty[] positionArray = new FoProperty[tokenList.size()];
        for (int i = 0; i < tokenList.size(); i++) {
            final FoProperty contentType = getContentType(tokenList.get(i));
            if (contentType == null) {
                throw unexpectedValue(value, fobj);
            }
            positionArray[i] = contentType;
        }
        boolean countryFound = false;
        boolean languageFound = false;
        for (int i = 0; i < positionArray.length; i++) {
            switch (positionArray[i]) {
            case COUNTRY: {
                if (countryFound) {
                    throw unexpectedValue(value, fobj);
                }
                collection.addItem(new PdCountry(fobj, propertyFullName,
                        tokenList.get(i)));
                countryFound = true;
                break;
            }
            case LANGUAGE: {
View Full Code Here

Examples of org.foray.fotree.fo.prop.PdCountry

     * @param context An object that knows how to resolve FO Tree context
     * issues.
     * @return The country property.
     */
    public Country getCountry(final FObj fobj, final FoContext context) {
        PdCountry property = (PdCountry) getProperty(FoProperty.COUNTRY);
        if (property != null) {
            return property.getValue(context, fobj);
        }

        /* Try the xml:lang shorthand. */
        final Lang langProperty = (Lang) getProperty(XmlProperty.LANG);
        if (langProperty != null) {
            property = langProperty.getCountry();
            if (property != null) {
                return property.getValue(context, fobj);
            }
        }
        return PdCountry.getValueNoInstance(context, fobj);
    }
View Full Code Here

Examples of org.foray.fotree.fo.prop.PdCountry

        }
        case CONTENT_WIDTH: {
            return new PdContentWidth(fobj, propertyFullName, attributeValue);
        }
        case COUNTRY: {
            return new PdCountry(fobj, propertyFullName, attributeValue);
        }
        case CUE: {
            return new PdCue(fobj, propertyFullName, attributeValue);
        }
        case CUE_AFTER: {
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.