Package org.foray.fotree

Examples of org.foray.fotree.PropertyException


                        DtColor.SRGB_BLUE_COMPONENT, true);
            } else {
                red = 0;
                green = 0;
                blue = 0;
                throw new PropertyException("Unknown color format. Must "
                        + "be #RGB or #RRGGBB");
            }
        } else if (value.startsWith("rgb(")) {
            final int poss = value.indexOf("(");
            final int pose = value.indexOf(")");
            if (poss != -1 && pose != -1) {
                value = value.substring(poss + 1, pose);
                final StringTokenizer st = new StringTokenizer(value, ",");
                if (st.hasMoreTokens()) {
                    final String str = st.nextToken().trim();
                    if (str.endsWith("%")) {
                        red =
                            Integer.parseInt(str.substring(0, str.length()
                                    - 1))
                            * WKConstants.MAX_8_BIT_UNSIGNED_INT
                            / WKConstants.PERCENT_CONVERSION;
                    } else {
                        red = Integer.parseInt(str)
                        / WKConstants.MAX_8_BIT_UNSIGNED_INT;
                    }
                }
                if (st.hasMoreTokens()) {
                    final String str = st.nextToken().trim();
                    if (str.endsWith("%")) {
                        green =
                            Integer.parseInt(str.substring(0, str.length()
                                    - 1))
                            * WKConstants.MAX_8_BIT_UNSIGNED_INT
                            / WKConstants.PERCENT_CONVERSION;
                    } else {
                        green = Integer.parseInt(str)
                        / WKConstants.MAX_8_BIT_UNSIGNED_INT;
                    }
                }
                if (st.hasMoreTokens()) {
                    final String str = st.nextToken().trim();
                    if (str.endsWith("%")) {
                        blue =
                            Integer.parseInt(str.substring(0, str.length()
                                    - 1))
                            * WKConstants.MAX_8_BIT_UNSIGNED_INT
                            / WKConstants.PERCENT_CONVERSION;
                    } else {
                        blue = Integer.parseInt(str)
                        / WKConstants.MAX_8_BIT_UNSIGNED_INT;
                    }
                }
            }
        } else if (value.startsWith("url(")) {
            // refers to a gradient
        } else {
            if (value.toLowerCase().equals("transparent")) {
                red = 0;
                green = 0;
                blue = 0;
                alpha = 1;
            } else {
                final DtColor foundColor = mapNameToColorRGB(
                        value.toLowerCase());
                if (foundColor == null) {
                    red = 0;
                    green = 0;
                    blue = 0;
                    throw new PropertyException("Unknown colour name: "
                                           + value);
                }
                return foundColor;
            }
        }
View Full Code Here


         * TODO: This is not right. It needs to return the inherited value
         * regardless of whether the Property was explicitly set or not.
         */
        final Property ps = parent.getPropertyList().getProperty(propertyType);
        if (ps == null) {
            throw new PropertyException("Invalid operand: "
                    + "'inherited-property-value' function");
        }
        return ps.value();
    }
View Full Code Here

         * TODO: This is not right. It needs to return the PropertyValue
         * regardless of whether the Property was explicitly set or not.
         */
        final Property ps = parent.getPropertyList().getProperty(propertyType);
        if (ps == null) {
            throw new PropertyException("Invalid operand: 'from-parent' "
                    + "function");
        }
        return ps.value();
    }
View Full Code Here

    /**
     * Throws an exception indicating that the parameters are invalid.
     * @throws PropertyException Always, as that is the purpose of this method.
     */
    protected void invalidParameters() throws PropertyException {
        throw new PropertyException("Invalid Parameters, function "
                + getFunctionName());
    }
View Full Code Here

TOP

Related Classes of org.foray.fotree.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.