Package org.apache.tiles

Examples of org.apache.tiles.ComponentAttribute


     * </p>
     *
     * @param nestedTag the put tag desciendent.
     */
    public void processNestedTag(PutAttributeTag nestedTag) {
        ComponentAttribute attribute = new ComponentAttribute(
            nestedTag.getValue(), nestedTag.getRole(),
            nestedTag.getType());

        componentContext.putAttribute(
            nestedTag.getName(),
View Full Code Here


    private void cacheState() {
        originalState = new HashMap<String, ComponentAttribute>();
        Iterator<String> i = componentContext.getAttributeNames();
        while(i.hasNext()) {
            String name = i.next();
            ComponentAttribute original = componentContext.getAttribute(name);
            ComponentAttribute a = new ComponentAttribute(
                original.getValue(), original.getRole(), original.getType()
            );
            originalState.put(name, a);
        }
    }
View Full Code Here

     * Reset member values for reuse. This method calls super.release(),
     * which invokes TagSupport.release(), which typically does nothing.
     */

    public void processNestedTag(PutAttributeTag nestedTag) throws JspException {
        ComponentAttribute attr = new ComponentAttribute(nestedTag.getValue(),
            nestedTag.getRole(), nestedTag.getType());
        attr.setName(nestedTag.getName());
        attributes.put(nestedTag.getName(), attr);
    }
View Full Code Here

        Map defs = new HashMap();
       
        ComponentDefinition def = new ComponentDefinition();
        def.setName("parent.def1");
        def.setTemplate("/test1.jsp");
        ComponentAttribute attr = new ComponentAttribute();
        attr.setName("attr1");
        attr.setValue("value1");
        def.addAttribute(attr);
        defs.put(def.getName(), def);
       
        def = new ComponentDefinition();
        def.setName("child.def1");
        def.setExtends("parent.def1");
        attr = new ComponentAttribute();
        attr.setName("attr1");
        attr.setValue("New value");
        def.addAttribute(attr);
        defs.put(def.getName(), def);
       
        ComponentDefinitions definitions = new ComponentDefinitionsImpl();
        try {
View Full Code Here

    public void testLocalizedResolveInheritances() {
        Map defs = new HashMap();
        ComponentDefinition def = new ComponentDefinition();
        def.setName("parent.def1");
        def.setTemplate("/test1.jsp");
        ComponentAttribute attr = new ComponentAttribute();
        attr.setName("attr1");
        attr.setValue("value1");
        def.addAttribute(attr);
        defs.put(def.getName(), def);
       
        def = new ComponentDefinition();
        def.setName("child.def1");
        def.setExtends("parent.def1");
        attr = new ComponentAttribute();
        attr.setName("attr1");
        attr.setValue("New value");
        def.addAttribute(attr);
        defs.put(def.getName(), def);

        Map localDefs = new HashMap();
        def = new ComponentDefinition();
        def.setName("child.def1");
        def.setExtends("parent.def1");
        attr = new ComponentAttribute();
        attr.setName("attr1");
        attr.setValue("US Value");
        def.addAttribute(attr);
        localDefs.put(def.getName(), def);

        ComponentDefinitions definitions = new ComponentDefinitionsImpl();
        try {
View Full Code Here

        Map defs = new HashMap();
       
        ComponentDefinition def = new ComponentDefinition();
        def.setName("parent.def1");
        def.setTemplate("/test1.jsp");
        ComponentAttribute attr = new ComponentAttribute();
        attr.setName("attr1");
        attr.setValue("value1");
        def.addAttribute(attr);
        defs.put(def.getName(), def);
       
        def = new ComponentDefinition();
        def.setName("child.def1");
        def.setExtends("parent.def1");
        attr = new ComponentAttribute();
        attr.setName("attr1");
        attr.setValue("New value");
        def.addAttribute(attr);
        defs.put(def.getName(), def);
       
        ComponentDefinitions definitions = new ComponentDefinitionsImpl();
        try {
View Full Code Here

        Map defs = new HashMap();
       
        ComponentDefinition def = new ComponentDefinition();
        def.setName("parent.def1");
        def.setTemplate("/test1.jsp");
        ComponentAttribute attr = new ComponentAttribute();
        attr.setName("attr1");
        attr.setValue("tiles.def2");
        attr.setType("definition");
        def.addAttribute(attr);
        defs.put(def.getName(), def);
       
        def = new ComponentDefinition();
        def.setName("parent.notype.def1");
        def.setTemplate("/test1.jsp");
        attr = new ComponentAttribute();
        attr.setName("attr1");
        attr.setValue("tiles.def2");
        // Don't set the type
        def.addAttribute(attr);
        defs.put(def.getName(), def);
       
        def = new ComponentDefinition();
View Full Code Here

     */
    public void put(String name, Object content, String type, String role) {
        // Is there a type set ?
        // First check direct attribute, and translate it to a valueType.
        // Then, evaluate valueType, and create requested typed attribute.
        ComponentAttribute attribute = new ComponentAttribute(content, role, type);
        putAttribute(name, attribute);
    }
View Full Code Here

        throws IOException, ServletException {

        TilesContainer container = TilesAccess.getContainer(servletContext);
        ComponentContext ctx = container.getComponentContext(request, response);

        ComponentAttribute attr = new ComponentAttribute();
        attr.setType(ComponentAttribute.TEMPLATE);
        attr.setName(targetAttributeName);
        attr.setValue(getTargetResource(request));
        ctx.putAttribute(targetAttributeName, attr);

        try {
            container.render(request, response, definition);
        } catch (TilesException e) {
View Full Code Here

                        "Attribute with null key found.");
                } else if (name == null) {
                    continue;
                }

                ComponentAttribute attr = componentContext.getAttribute(name);

                if ( (attr == null || attr.getValue() == null) && !ignore) {
                    throw new JspException("Error importing attributes. "+
                        "Attribute '"+name+"' has a null value ");
                } else if( attr == null || attr.getValue() == null) {
                    continue;
                }

                pageContext.setAttribute(name, attr.getValue(), scope);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.tiles.ComponentAttribute

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.