Package org.apache.fop.fo.expr

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


       
        //TODO do we need context for getBPPaddingAndBorder() and getIPPaddingAndBorder()?
        if (getUserAgent().validateStrictly()
                && (getCommonBorderPaddingBackground().getBPPaddingAndBorder(false, null) != 0
                || getCommonBorderPaddingBackground().getIPPaddingAndBorder(false, null) != 0)) {
            throw new PropertyException("Border and padding for region \""
                    + regionName + "\" must be '0' (See 6.4.13 in XSL 1.0).");
        }
    }
View Full Code Here


        numberColumnsSpanned = pList.get(PR_NUMBER_COLUMNS_SPANNED).getNumeric();
        visibility = pList.get(PR_VISIBILITY).getEnum();
        super.bind(pList);
       
        if (getTable().isColumnNumberUsed(columnNumber.getValue())) {
            throw new PropertyException("column-number \"" + columnNumber
                    + "\" has already been assigned to a previous column");
        }
        if (numberColumnsRepeated.getValue() <= 0) {
            throw new PropertyException("number-columns-repeated must be 1 or bigger, "
                    + "but got " + numberColumnsRepeated.getValue());
        }
        if (numberColumnsSpanned.getValue() <= 0) {
            throw new PropertyException("number-columns-spanned must be 1 or bigger, "
                    + "but got " + numberColumnsSpanned.getValue());
        }
        this.pList = new StaticPropertyList(this, pList);
    }
View Full Code Here

                    columnIndex = parent.getCurrentColumnIndex();
                }
            }
            return new NumberProperty(columnIndex);
        } 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 column-number is already in use by another cell
                //in the current row => error!
                if (parent.isColumnNumberUsed(columnIndex + i)) {
                    throw new PropertyException("fo:table-cell overlaps in column "
                            + (columnIndex + i));
                }
            }
        }
       
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

        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

                } 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

                    this.green = Integer.parseInt(value.substring(3, 5), 16)
                    / 255f;
                    this.blue = Integer.parseInt(value.substring(5), 16)
                    / 255f;
                } else {
                    throw new PropertyException("Unknown color format: "
                            + value + ". Must be #RGB or #RRGGBB");
                }
            } catch (NumberFormatException e) {
                throw new PropertyException("Unknown color format: " + value
                        + ". Must be #RGB or #RRGGBB");
            }
        } else if (value.startsWith("rgb(")) {
            int poss = value.indexOf("(");
            int pose = value.indexOf(")");
            if (poss != -1 && pose != -1) {
                value = value.substring(poss + 1, pose);
                StringTokenizer st = new StringTokenizer(value, ",");
                try {
                    if (st.hasMoreTokens()) {
                        String str = st.nextToken().trim();
                        if (str.endsWith("%")) {
                            this.red = Float.parseFloat(str.substring(0, str
                                    .length() - 1)) / 100.0f;
                        } else {
                            this.red = Float.parseFloat(str) / 255f;
                        }
                    }
                    if (st.hasMoreTokens()) {
                        String str = st.nextToken().trim();
                        if (str.endsWith("%")) {
                            this.green = Float.parseFloat(str.substring(0, str
                                    .length() - 1)) / 100.0f;
                        } else {
                            this.green = Float.parseFloat(str) / 255f;
                        }
                    }
                    if (st.hasMoreTokens()) {
                        String str = st.nextToken().trim();
                        if (str.endsWith("%")) {
                            this.blue = Float.parseFloat(str.substring(0, str
                                    .length() - 1)) / 100.0f;
                        } else {
                            this.blue = Float.parseFloat(str) / 255f;
                        }
                    }
                } catch (Exception e) {
                    throw new PropertyException(
                            "Arguments to rgb() must be [0..255] or [0%..100%]");
                }
            } else {
                throw new PropertyException("Unknown color format: " + value
                        + ". Must be rgb(r,g,b)");
            }
        } else if (value.startsWith("url(")) {
            throw new PropertyException(
                    "Colors starting with url( are not yet supported!");
        } else {
            if (value.startsWith("system-color(")) {
                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)");
                }
            }
            if (value.toLowerCase().equals("transparent")) {
                this.red = 0;
                this.green = 0;
                this.blue = 0;
                this.alpha = 0;
            } else {
                boolean found = false;
                for (int count = 0; count < NAMES.length; count++) {
                    if (value.toLowerCase().equals(NAMES[count])) {
                        this.red = VALUES[count][0] / 255f;
                        this.green = VALUES[count][1] / 255f;
                        this.blue = VALUES[count][2] / 255f;
                        found = true;
                        break;
                    }
                }
                if (!found) {
                    throw new PropertyException("Unknown color name: " + value);
                }
            }
        }
        if ((this.red < 0.0 || this.red > 1.0)
                || (this.green < 0.0 || this.green > 1.0)
                || (this.blue < 0.0 || this.blue > 1.0)
                || (this.alpha < 0.0 || this.alpha > 1.0)) {
            throw new PropertyException("Color values out of range");
        }
    }
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.