Package org.apache.fop.fo.expr

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


        if (poss != -1 && pose != -1) {
            try {
                String[] args = value.substring(poss + 1, pose).split(",");

                if (args.length != 6) {
                    throw new PropertyException("cie-lab-color() function must have 6 arguments");
                }

                //Set up fallback sRGB value
                float red = parseComponent255(args[0], value);
                float green = parseComponent255(args[1], value);
                float blue = parseComponent255(args[2], value);
                Color sRGB = new Color(red, green, blue);

                float l = parseComponent(args[3], 0f, 100f, value);
                float a = parseComponent(args[4], -127f, 127f, value);
                float b = parseComponent(args[5], -127f, 127f, value);

                //Assuming the XSL-FO spec uses the D50 white point
                CIELabColorSpace cs = ColorSpaces.getCIELabColorSpaceD50();
                //use toColor() to have components normalized
                Color labColor = cs.toColor(l, a, b, 1.0f);
                //Convert to ColorWithFallback
                parsedColor = new ColorWithFallback(labColor, sRGB);
            } catch (RuntimeException re) {
                throw new PropertyException(re);
            }
        } else {
            throw new PropertyException("Unknown color format: " + value
                    + ". Must be cie-lab-color(r,g,b,Lightness,a-value,b-value)");
        }
        return parsedColor;
    }
View Full Code Here


        if (poss != -1 && pose != -1) {
            value = value.substring(poss + 1, pose);
            String[] args = value.split(",");
            try {
                if (args.length != 4) {
                    throw new PropertyException(
                            "Invalid number of arguments: cmyk(" + value + ")");
                }
                float cyan = parseComponent1(args[0], value);
                float magenta = parseComponent1(args[1], value);
                float yellow = parseComponent1(args[2], value);
                float black = parseComponent1(args[3], value);
                float[] comps = new float[] {cyan, magenta, yellow, black};
                Color cmykColor = DeviceCMYKColorSpace.createCMYKColor(comps);
                float[] rgbComps = cmykColor.getRGBColorComponents(null);
                parsedColor = new ColorWithAlternatives(rgbComps[0], rgbComps[1], rgbComps[2],
                        new Color[] {cmykColor});
            } catch (RuntimeException re) {
                throw new PropertyException(re);
            }
        } else {
            throw new PropertyException("Unknown color format: " + value
                    + ". Must be cmyk(c,m,y,k)");
        }
        return parsedColor;
    }
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 (newProp != null) {
                newProp = convertProperty(newProp, propertyList, fo);
            }
            if (newProp == null) {
                throw new PropertyException("No conversion defined " + pvalue);
            }
            return newProp;
        } catch (PropertyException propEx) {
            if (fo != null) {
                propEx.setLocator(fo.getLocator());
View Full Code Here

                enumValue = prop.getEnum();
            }
            switch (enumValue) {
                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:
                case Constants.EN_OVERLINE:
                case Constants.EN_NO_OVERLINE:
                case Constants.EN_LINE_THROUGH:
                case Constants.EN_NO_LINE_THROUGH:
                case Constants.EN_BLINK:
                case Constants.EN_NO_BLINK:
                    if (none) {
                        throw new PropertyException
                                ("'none' specified, no additional values allowed");
                    }
                    switch (enumValue) {
                        case Constants.EN_UNDERLINE:
                        case Constants.EN_NO_UNDERLINE:
                            if (!under) {
                                under = true;
                                continue;
                            }
                        case Constants.EN_OVERLINE:
                        case Constants.EN_NO_OVERLINE:
                            if (!over) {
                                over = true;
                                continue;
                            }
                        case Constants.EN_LINE_THROUGH:
                        case Constants.EN_NO_LINE_THROUGH:
                            if (!through) {
                                through = true;
                                continue;
                            }
                        case Constants.EN_BLINK:
                        case Constants.EN_NO_BLINK:
                            if (!blink) {
                                blink = true;
                                continue;
                            }
                        default:
                            throw new PropertyException("Invalid combination of values");
                    }
                default:
                    throw new PropertyException("Invalid value specified: " + p);
            }
        }
        return listProp;
    }
View Full Code Here

                        p = new URIProperty(xmlBase.resolvedURI.resolve(specifiedURI));
                        p.setSpecifiedValue(value);
                    }
                } catch (URISyntaxException use) {
                    // Let PropertyList propagate the exception
                    throw new PropertyException("Invalid URI specified");
                }
            }
            return p;
        }
View Full Code Here

                } 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

        numberColumnsSpanned = pList.get(PR_NUMBER_COLUMNS_SPANNED)
                                    .getNumeric().getValue();
        super.bind(pList);
       
        if (numberColumnsRepeated <= 0) {
            throw new PropertyException("number-columns-repeated must be 1 or bigger, "
                    + "but got " + numberColumnsRepeated);
        }
        if (numberColumnsSpanned <= 0) {
            throw new PropertyException("number-columns-spanned must be 1 or bigger, "
                    + "but got " + numberColumnsSpanned);
        }
       
        /* check for unspecified width and replace with default of
         * proportional-column-width(1), in case of fixed table-layout
View Full Code Here

            if (value.startsWith("#")) {
                parsedColor = parseWithHash(value);
            } else if (value.startsWith("rgb(")) {
                parsedColor = parseAsRGB(value);
            } else if (value.startsWith("url(")) {
                throw new PropertyException(
                        "Colors starting with url( are not yet supported!");
            } else if (value.startsWith("java.awt.Color")) {
                parsedColor = parseAsJavaAWTColor(value);
            } else if (value.startsWith("system-color(")) {
                parsedColor = parseAsSystemColor(value);
            } else if (value.startsWith("fop-rgb-icc")) {
                parsedColor = parseAsFopRgbIcc(foUserAgent, value);
            } else if (value.startsWith("cmyk")) {
                parsedColor = parseAsCMYK(value);
            }
           
            if (parsedColor == null) {
                throw new PropertyException("Unknown Color: " + value);
            }
           
            colorMap.put(value, parsedColor);
        }
View Full Code Here

        int poss = value.indexOf("(");
        int pose = value.indexOf(")");
        if (poss != -1 && pose != -1) {
            value = value.substring(poss + 1, pose);
        } else {
            throw new PropertyException("Unknown color format: " + value
                    + ". Must be system-color(x)");
        }
        return (Color) colorMap.get(value);
    }
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.