Package org.apache.fop.fo.expr

Examples of org.apache.fop.fo.expr.PropertyException


                } else if (propEnum == Constants.EN_NO_BLINK) {
                    if (deco != null) {
                        deco.decoration &= UNDERLINE | OVERLINE | LINE_THROUGH;
                    }
                } else {
                    throw new PropertyException("Illegal value encountered: " + prop.getString());
                }
            }
        }
        return deco;
    }
View Full Code Here


            ro = p.getNumeric().getValue();
        }
        if ((Math.abs(ro) % 90) == 0 && (Math.abs(ro) / 90) <= 3) {
            return p;
        } else {
            throw new PropertyException("Illegal property value: "
                    + "reference-orientation=\"" + ro + "\" "
                    + "on " + propertyList.getFObj().getName());
        }
    }
View Full Code Here

                Property ipd = (Property)lst.get(0);
                Property bpd = (Property)lst.get(1);
                return new LengthPairProperty(ipd, bpd);
            }
        }
        throw new PropertyException("list with 1 or 2 length values expected");
    }
View Full Code Here

                        if (spaceIndex == -1
                                || (quoteIndex != -1 && spaceIndex > quoteIndex)) {
                            /* no spaces or first space appears after the first
                             * single/double quote, so malformed value string
                             */
                            throw new PropertyException("Invalid property value: "
                                    + "font=\"" + value + "\"");                       
                        }
                        PropertyMaker m = null;
                        int fromIndex = spaceIndex + 1;
                        int toIndex = specVal.length();
                        /* at least one space that appears before the first
                         * single/double quote, so extract the individual properties
                         */
                        boolean fontFamilyParsed = false;
                        int commaIndex = value.indexOf(',');
                        while (!fontFamilyParsed) {
                            /* value contains a (list of) possibly quoted
                             * font-family name(s)
                             */
                            if (commaIndex == -1) {
                                /* no list, just a single name
                                 * (or first name in the list)
                                 */
                                if (quoteIndex != -1) {
                                    /* a single name, quoted
                                     */
                                    fromIndex = quoteIndex;
                                }
                                m = FObj.getPropertyMakerFor(PROP_IDS[1]);
                                prop = m.make(propertyList, specVal.substring(fromIndex), fo);
                                newProp.addProperty(prop, 1);
                                fontFamilyParsed = true;                           
                            } else {
                                if (quoteIndex != -1 && quoteIndex < commaIndex) {
                                    /* a quoted font-family name as first name
                                     * in the comma-separated list
                                     * fromIndex = index of the first quote
                                     */
                                    fromIndex = quoteIndex;
                                    quoteIndex = -1;
                                } else {
                                    fromIndex = value.lastIndexOf(' ', commaIndex) + 1;
                                }
                                commaIndex = -1;
                            }
                        }
                        toIndex = fromIndex - 1;
                        fromIndex = value.lastIndexOf(' ', toIndex - 1) + 1;
                        value = specVal.substring(fromIndex, toIndex);
                        int slashIndex = value.indexOf('/');
                        String fontSize = value.substring(0,
                                (slashIndex == -1) ? value.length() : slashIndex);
                        m = FObj.getPropertyMakerFor(PROP_IDS[0]);
                        prop = m.make(propertyList, fontSize, fo);
                        /* need to make sure subsequent call to LineHeightPropertyMaker.make()
                         * doesn't generate the default font-size property...
                         */
                        propertyList.putExplicit(PROP_IDS[0], prop);
                        newProp.addProperty(prop, 0);
                        if (slashIndex != -1) {
                            /* line-height */
                            String lineHeight = value.substring(slashIndex + 1);
                            m = FObj.getPropertyMakerFor(PROP_IDS[2]);
                            prop = m.make(propertyList, lineHeight, fo);
                            newProp.addProperty(prop, 2);
                        }
                        if (fromIndex != 0) {
                            toIndex = fromIndex - 1;
                            value = specVal.substring(0, toIndex);
                            fromIndex = 0;
                            spaceIndex = value.indexOf(' ');
                            do {
                                toIndex = (spaceIndex == -1) ? value.length() : spaceIndex;
                                String val = value.substring(fromIndex, toIndex);
                                for (int i = 6; --i >= 3;) {
                                    if (newProp.list.get(i) == null) {
                                        /* not set */
                                        m = FObj.getPropertyMakerFor(PROP_IDS[i]);
                                        val = m.checkValueKeywords(val);
                                        prop = m.checkEnumValues(val);
                                        if (prop != null) {
                                            newProp.addProperty(prop, i);
                                        }
                                    }
                                }
                                fromIndex = toIndex + 1;
                                spaceIndex = value.indexOf(' ', fromIndex);
                            } while (toIndex != value.length());
                        }
                    } else {
                        //TODO: implement enum values
                        log.warn("Enum values other than \"inherit\""
                                + " not yet supported for the font shorthand.");
                        return null;
                    }
                }
                if (newProp.list.get(0) == null || newProp.list.get(1) == null) {
                    throw new PropertyException("Invalid property value: "
                            + "font-size and font-family are required for the font shorthand"
                            + "\nfont=\"" + value + "\"");
                }
                return newProp;
           } catch (PropertyException pe) {
View Full Code Here

                    }
                }
                return new NumberProperty(((TableFObj) fo.getParent())
                                            .getCurrentColumnIndex());
            } else {
                throw new PropertyException(
                        "column-number property is only allowed"
                        + " on fo:table-cell or fo:table-column, not on "
                        + fo.getName());
            }
        }
View Full Code Here

            }
            if (newProp != null) {
                newProp = convertProperty(newProp, propertyList, fo);
            }
            if (newProp == null) {
                throw new PropertyException("No conversion defined " + pvalue);
            }
            return newProp;
        } catch (PropertyException propEx) {
            propEx.setLocator(fo.getLocator());
            propEx.setPropertyName(getName());
View Full Code Here

                        if (spaceIndex == -1
                                || (quoteIndex != -1 && spaceIndex > quoteIndex)) {
                            /* no spaces or first space appears after the first
                             * single/double quote, so malformed value string
                             */
                            throw new PropertyException("Invalid property value: "
                                    + "font=\"" + value + "\"");
                        }
                        PropertyMaker m = null;
                        int fromIndex = spaceIndex + 1;
                        int toIndex = specVal.length();
                        /* at least one space that appears before the first
                         * single/double quote, so extract the individual properties
                         */
                        boolean fontFamilyParsed = false;
                        int commaIndex = value.indexOf(',');
                        while (!fontFamilyParsed) {
                            /* value contains a (list of) possibly quoted
                             * font-family name(s)
                             */
                            if (commaIndex == -1) {
                                /* no list, just a single name
                                 * (or first name in the list)
                                 */
                                if (quoteIndex != -1) {
                                    /* a single name, quoted
                                     */
                                    fromIndex = quoteIndex;
                                }
                                m = FObj.getPropertyMakerFor(PROP_IDS[1]);
                                prop = m.make(propertyList, specVal.substring(fromIndex), fo);
                                newProp.addProperty(prop, 1);
                                fontFamilyParsed = true;
                            } else {
                                if (quoteIndex != -1 && quoteIndex < commaIndex) {
                                    /* a quoted font-family name as first name
                                     * in the comma-separated list
                                     * fromIndex = index of the first quote
                                     */
                                    fromIndex = quoteIndex;
                                    quoteIndex = -1;
                                } else {
                                    fromIndex = value.lastIndexOf(' ', commaIndex) + 1;
                                }
                                commaIndex = -1;
                            }
                        }
                        toIndex = fromIndex - 1;
                        fromIndex = value.lastIndexOf(' ', toIndex - 1) + 1;
                        value = specVal.substring(fromIndex, toIndex);
                        int slashIndex = value.indexOf('/');
                        String fontSize = value.substring(0,
                                (slashIndex == -1) ? value.length() : slashIndex);
                        m = FObj.getPropertyMakerFor(PROP_IDS[0]);
                        prop = m.make(propertyList, fontSize, fo);
                        /* need to make sure subsequent call to LineHeightPropertyMaker.make()
                         * doesn't generate the default font-size property...
                         */
                        propertyList.putExplicit(PROP_IDS[0], prop);
                        newProp.addProperty(prop, 0);
                        if (slashIndex != -1) {
                            /* line-height */
                            String lineHeight = value.substring(slashIndex + 1);
                            m = FObj.getPropertyMakerFor(PROP_IDS[2]);
                            prop = m.make(propertyList, lineHeight, fo);
                            newProp.addProperty(prop, 2);
                        }
                        if (fromIndex != 0) {
                            toIndex = fromIndex - 1;
                            value = specVal.substring(0, toIndex);
                            fromIndex = 0;
                            spaceIndex = value.indexOf(' ');
                            do {
                                toIndex = (spaceIndex == -1) ? value.length() : spaceIndex;
                                String val = value.substring(fromIndex, toIndex);
                                for (int i = 6; --i >= 3;) {
                                    if (newProp.list.get(i) == null) {
                                        /* not set */
                                        m = FObj.getPropertyMakerFor(PROP_IDS[i]);
                                        val = m.checkValueKeywords(val);
                                        prop = m.checkEnumValues(val);
                                        if (prop != null) {
                                            newProp.addProperty(prop, i);
                                        }
                                    }
                                }
                                fromIndex = toIndex + 1;
                                spaceIndex = value.indexOf(' ', fromIndex);
                            } while (toIndex != value.length());
                        }
                    } else {
                        //TODO: implement enum values
                        log.warn("Enum values other than \"inherit\""
                                + " not yet supported for the font shorthand.");
                        return null;
                    }
                }
                if (newProp.list.get(0) == null || newProp.list.get(1) == null) {
                    throw new PropertyException("Invalid property value: "
                            + "font-size and font-family are required for the font shorthand"
                            + "\nfont=\"" + value + "\"");
                }
                return newProp;
           } catch (PropertyException pe) {
View Full Code Here

        while (i.hasNext()) {
            Property prop = (Property)i.next();
            switch (prop.getEnum()) {
                case Constants.EN_NONE:
                    if (under | over | through | blink) {
                        throw new PropertyException(
                                "Invalid combination of values");
                    }
                    none = true;
                    break;
                case Constants.EN_UNDERLINE:
                case Constants.EN_NO_UNDERLINE:
                    if (none) {
                        throw new PropertyException("'none' specified, no additional values allowed");
                    }
                    if (under) {
                        throw new PropertyException("Invalid combination of values");
                    }
                    under = true;
                    break;
                case Constants.EN_OVERLINE:
                case Constants.EN_NO_OVERLINE:
                    if (none) {
                        throw new PropertyException("'none' specified, no additional values allowed");
                    }
                    if (over) {
                        throw new PropertyException("Invalid combination of values");
                    }
                    over = true;
                    break;
                case Constants.EN_LINE_THROUGH:
                case Constants.EN_NO_LINE_THROUGH:
                    if (none) {
                        throw new PropertyException("'none' specified, no additional values allowed");
                    }
                    if (through) {
                        throw new PropertyException("Invalid combination of values");
                    }
                    through = true;
                    break;
                case Constants.EN_BLINK:
                case Constants.EN_NO_BLINK:
                    if (none) {
                        throw new PropertyException("'none' specified, no additional values allowed");
                    }
                    if (blink) {
                        throw new PropertyException("Invalid combination of values");
                    }
                    blink = true;
                    break;
                default:
                    throw new PropertyException("Invalid value specified: " + prop);
            }
            addProperty(prop);
        }
    }
View Full Code Here

                    return new TextDecorationProperty((ListProperty)p);
                } else if (p instanceof EnumProperty) {
                    ListProperty lst = new ListProperty(p);
                    return new TextDecorationProperty(lst);
                } else {
                    throw new PropertyException("Cannot convert anything other "
                            + "than a list property, got a " + p.getClass().getName());
                }
            }
        }
View Full Code Here

                if (prop instanceof EnumProperty) {
                    //skip
                } else if (prop instanceof NCnameProperty) {
                    Property prop_enum = checkEnumValues(((NCnameProperty)prop).getString());
                    if (prop_enum == null) {
                        throw new PropertyException("Illegal enum value: " + prop.getString());
                    }
                    l.set(i, prop_enum);
                } else {
                    throw new PropertyException("Invalid content for text-decoration "
                            + "property: " + prop);
                }
            }
            return lst;
        }
View Full Code Here

TOP

Related Classes of org.apache.fop.fo.expr.PropertyException

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.