Package org.apache.shale.clay.config.beans

Examples of org.apache.shale.clay.config.beans.ConfigBean$ConfigDefinition


            throw new IllegalArgumentException(messages.getMessage(
                    "missing.attribute", new Object[] { "var", "clayForEach" }));
        }

        // lookup the ConfigBean that handles the bodyJsfid
        ConfigBean config = ConfigBeanFactory.findConfig(bodyJsfid);
        if (config == null) {
            throw new NullPointerException(messages
                    .getMessage("clay.config.notloaded"));
        }

        // make sure it's parsed and cached
        ComponentBean b = config.getElement(bodyJsfid);
        if (b == null) {
            throw new NullPointerException(messages.getMessage(
                    "clay.jsfid.notfound", new Object[] { bodyJsfid }));
        }

        ValueBinding vb = context.getApplication().createValueBinding(value);
        final Object valueList = vb.getValue(context);

        Map beans = new TreeMap();
        int i = 0;
        Iterator vi = null;
        if (valueList == null) {
            vi = Collections.EMPTY_LIST.iterator();
        } else if (valueList instanceof List) {
            vi = ((List) valueList).iterator();
        } else if (valueList instanceof Map) {
            vi = ((Map) valueList).entrySet().iterator();
        } else {
            Object[] anArray = new Object[0];
            if (anArray.getClass().isAssignableFrom(valueList.getClass())) {
                vi = new Iterator() {
                    private int index = 0;

                    private final Object[] list = (Object[]) valueList;

                    public boolean hasNext() {
                        return (index < list.length);
                    }

                    public Object next() {
                        return list[index++];
                    }

                    public void remove() {
                    };

                };
            } else {
                throw new IllegalArgumentException(messages.getMessage(
                        "invalid.collectiontype", new Object[] { value }));
            }
        }

        if (vi != null) {
            while (vi.hasNext()) {
                // create a key for the beans map
                StringBuffer id = new StringBuffer("bean" + ++i);
                // add the subscripted bean to the beans map with the generated
                // key
                beans.put(id.toString(), vi.next());

                // create a naming container to hold the row
                ElementBean namingContainer = new ElementBean();
                namingContainer.setRenderId(i);
                namingContainer.setJsfid("namingContainer");
                namingContainer.setComponentType("javax.faces.NamingContainer");

                // create a new nested bean
                ElementBean target = new ElementBean();
                target.setJsfid(bodyJsfid);
                target.setExtends(bodyJsfid);
                target.setRenderId(i);
                config.assignParent(target);
                config.realizingInheritance(target);

                // prepend the var to the generated key
                id.insert(0, var + ".");
                SymbolBean symbol = new SymbolBean();
                symbol.setName(Globals.MANAGED_BEAN_MNEMONIC);
View Full Code Here


     *
     * @return root config bean used to define the subtree
     */
    protected ComponentBean getRootElement() {

        ConfigBean config = ConfigBeanFactory.findConfig(getJsfid());

        if (config == null) {
            throw new NullPointerException(messages
                    .getMessage("clay.config.notloaded"));
        }

        // find the top-level display element associated with the subtree
        ComponentBean b = config.getElement(getJsfid());
        if (b == null) {
            throw new NullPointerException(messages.getMessage(
                    "clay.jsfid.notfound", new Object[] { getJsfid() }));
        }

View Full Code Here

        target.setId(id);

        // look to see if this node should be bound to a component
        if (target.getJsfid() != null) {
            // lookup the ConfigBean that handles the id
            ConfigBean config = ConfigBeanFactory.findConfig(target.getJsfid());
            // disconnect component type
            target.setComponentType(null);


            try {
               //assign the parent
               config.assignParent(target);
               // resolve inheritance
               config.realizingInheritance(target);
            } catch (RuntimeException e) {
                log.error(e);
                throw new RuntimeException(
                        messages.getMessage("parser.unresolved",
                        new Object[] {node.getToken(), node.getToken().getRawText()}));
View Full Code Here

     * @param node markup
     * @param target child config bean
     */
    protected void realizeComponent(Node node, ComponentBean target) {
        // lookup the ConfigBean that handles the id
        ConfigBean config = ConfigBeanFactory.findConfig(target.getJsfid());

        try {
           //assign the parent
           config.assignParent(target);
           // resolve inheritance
           config.realizingInheritance(target);
        } catch (RuntimeException e) {
            log.error(e);
            throw new RuntimeException(
                    messages.getMessage("parser.unresolved",
                    new Object[] {node.getToken(), node.getToken().getRawText()}));
View Full Code Here

        target.setId(id);

        // look to see if this node should be bound to a component
        if (target.getJsfid() != null) {
            // lookup the ConfigBean that handles the id
            ConfigBean config = ConfigBeanFactory.findConfig(target.getJsfid());
            // disconnect component type
            target.setComponentType(null);


            try {
               //assign the parent
               config.assignParent(target);
               // resolve inheritance
               config.realizingInheritance(target);
            } catch (RuntimeException e) {
                log.error(e);
                throw new RuntimeException(
                        messages.getMessage("parser.unresolved",
                        new Object[] {node.getToken(), node.getToken().getRawText()}));
View Full Code Here

        }

        try {

            // load xml config
            ConfigBean config = new ComponentConfigBean();
            config.init(event.getServletContext());
            ConfigBeanFactory.register(config);

            // load HTML template config
            config = new TemplateConfigBean();
            config.init(event.getServletContext());
            ConfigBeanFactory.register(config);

            // load XML template config
            config = new TemplateComponentConfigBean();
            config.init(event.getServletContext());
            ConfigBeanFactory.register(config);



        } catch (RuntimeException e) {
View Full Code Here

TOP

Related Classes of org.apache.shale.clay.config.beans.ConfigBean$ConfigDefinition

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.