Package com.sun.faces.config.beans

Examples of com.sun.faces.config.beans.AttributeBean


                                       digester.getMatch() +
                                       "} Push " + CLASS_NAME);
        }
        Class clazz =
            digester.getClassLoader().loadClass(CLASS_NAME);
        AttributeBean ab = (AttributeBean) clazz.newInstance();
        digester.push(ab);

    }


     * @exception IllegalStateException if the popped object is not
     *  of the correct type
     */
    public void end(String namespace, String name) throws Exception {

        AttributeBean top = null;
        try {
            top = (AttributeBean) digester.pop();
        } catch (Exception e) {
            throw new IllegalStateException("Popped object is not a " +
                                            CLASS_NAME + " instance");
        }
        AttributeHolder ah = (AttributeHolder) digester.peek();
        AttributeBean old = ah.getAttribute(top.getAttributeName());
        if (old == null) {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[AttributeRule]{" +
                                           digester.getMatch() +
                                           "} New(" +


    // Merge "top" into "old"
    static void mergeAttributes(AttributeHolder top, AttributeHolder old) {

        AttributeBean ab[] = top.getAttributes();
        for (int i = 0; i < ab.length; i++) {
            AttributeBean abo = old.getAttribute(ab[i].getAttributeName());
            if (abo == null) {
                old.addAttribute(ab[i]);
            } else {
                mergeAttribute(ab[i], abo);
            }


                // Renderer Attributes Next...
                //
                AttributeBean[] attributes = renderer.getAttributes();
                AttributeBean attribute;
                for (int i = 0, len = attributes.length; i < len; i++) {
                    if (null == (attribute = attributes[i])) {
                        continue;
                    }
                    if (!attribute.isTagAttribute()) {
                        continue;
                    }
                    if (attributeShouldBeExcluded(renderer,
                        attribute.getAttributeName())) {
                        continue;
                    }

                    writer.startElement("attribute");

                    description = attribute.getDescription("");
                    if (description != null) {
                        String descriptionText =
                        description.getDescription().trim();

                        if (descriptionText != null) {
                            writer.startElement("description");
                            StringBuffer sb = new StringBuffer();
                            sb.append("<![CDATA[");
                            sb.append(descriptionText);
                            sb.append("]]>\n");
                            writer.writeText(sb.toString());
                            writer.closeElement();
                        }
                    }

                    String attributeName = attribute.getAttributeName();

                    writer.startElement("name");
                    writer.writeText(attributeName);
                    writer.closeElement();

                    writer.startElement("required");
                    writer.writeText(attribute.isRequired() ?
                                     Boolean.TRUE.toString() :
                                     Boolean.FALSE.toString());
                    writer.closeElement();

                    if (!"id".equals(attributeName)) {
                        // PENDING FIX ME
                        String type = attribute.getAttributeClass();
                        //String wrapperType = (String)
                        //  GeneratorUtil.convertToPrimitive(type);
                        //if (wrapperType != null) {
                        //    type = wrapperType;
                        //}

                                       digester.getMatch() +
                                       "} Push " + CLASS_NAME);
        }
        Class clazz =
            digester.getClassLoader().loadClass(CLASS_NAME);
        AttributeBean ab = (AttributeBean) clazz.newInstance();
        digester.push(ab);

    }

     * @exception IllegalStateException if the popped object is not
     *  of the correct type
     */
    public void end(String namespace, String name) throws Exception {

        AttributeBean top = null;
        try {
            top = (AttributeBean) digester.pop();
        } catch (Exception e) {
            throw new IllegalStateException("Popped object is not a " +
                                            CLASS_NAME + " instance");
        }
        AttributeHolder ah = (AttributeHolder) digester.peek();
        AttributeBean old = ah.getAttribute(top.getAttributeName());
        if (old == null) {
            if (digester.getLogger().isDebugEnabled()) {
                digester.getLogger().debug("[AttributeRule]{" +
                                           digester.getMatch() +
                                           "} New(" +


    // Merge "top" into "old"
    static void mergeAttributes(AttributeHolder top, AttributeHolder old) {

        AttributeBean ab[] = top.getAttributes();
        for (int i = 0; i < ab.length; i++) {
            AttributeBean abo = old.getAttribute(ab[i].getAttributeName());
            if (abo == null) {
                old.addAttribute(ab[i]);
            } else {
                mergeAttribute(ab[i], abo);
            }

        // Generate from renderer attributes..
        //
        AttributeBean[] attributes = renderer.getAttributes();

        for (int i = 0, len = attributes.length; i < len; i++) {
            AttributeBean attribute = attributes[i];

            if (attribute == null) {
                continue;
            }
            if (!attribute.isTagAttribute()) {
                continue;
            }

            String attributeName = attribute.getAttributeName();

            writer.fwrite("this." + mangle(attributeName) + " = null;\n");
        }

        writer.outdent();

        // Generate from renderer attributes..
        //
        AttributeBean[] attributes = renderer.getAttributes();
        for (int i = 0, len = attributes.length; i < len; i++) {
            AttributeBean attribute = attributes[i];

            if (attribute == null) {
                continue;
            }
            if (!attribute.isTagAttribute()) {
                continue;
            }
            String attributeName = attribute.getAttributeName();

            writer.writeWriteOnlyProperty(attributeName,
                "java.lang.String");

        }

        // Generate "setProperties" method contents from renderer attributes
        //
        AttributeBean[] attributes = renderer.getAttributes();
        for (int i = 0, len = attributes.length; i < len; i++) {
            AttributeBean attribute = attributes[i];
            if (attribute == null) {
                continue;
            }
            if (!attribute.isTagAttribute()) {
                continue;
            }
            String attributeName = attribute.getAttributeName();
            String attributeType = attribute.getAttributeClass();

            String ivar = mangle(attributeName);
            String vbKey = ivar;
            String comp =
                GeneratorUtil.stripJavaxFacesPrefix(componentType).toLowerCase();

TOP

Related Classes of com.sun.faces.config.beans.AttributeBean

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.