Examples of AttributeContext


Examples of org.apache.tiles.AttributeContext

     */
    private Map<String, Object> getImportedAttributes(String name,
            String toName, boolean ignore, Request request) {
        TilesContainer container = TilesAccess.getCurrentContainer(request);
        Map<String, Object> retValue = new HashMap<String, Object>();
        AttributeContext attributeContext = container
                .getAttributeContext(request);
        // Some tags allow for unspecified attributes. This
        // implies that the tag should use all of the attributes.
        if (name != null) {
            importSingleAttribute(container, attributeContext, name, toName,
                    ignore, retValue, request);
        } else {
            importAttributes(attributeContext.getCascadedAttributeNames(),
                    container, attributeContext, retValue, ignore, request);
            importAttributes(attributeContext.getLocalAttributeNames(),
                    container, attributeContext, retValue, ignore, request);
        }
        return retValue;
    }
View Full Code Here

Examples of org.apache.tiles.AttributeContext

        HttpServletRequest httpServletRequest = createMock(HttpServletRequest.class);
        HttpServletResponse httpServletResponse = createMock(HttpServletResponse.class);
        @SuppressWarnings("unchecked")
        Map<String, Object> applicationScope = createMock(Map.class);
        TilesContainer container = createMock(TilesContainer.class);
        AttributeContext attributeContext = createMock(AttributeContext.class);
        Attribute attribute = createMock(Attribute.class);
        expect(pageContext.getAttribute(
                ApplicationAccess.APPLICATION_CONTEXT_ATTRIBUTE,
                PageContext.APPLICATION_SCOPE)).andReturn(applicationContext);
        expect(applicationContext.getApplicationScope()).andReturn(applicationScope).anyTimes();
        expect(pageContext.getRequest()).andReturn(httpServletRequest);
        expect(pageContext.getResponse()).andReturn(httpServletResponse);
        expect(pageContext.getAttribute(TilesAccess.CURRENT_CONTAINER_ATTRIBUTE_NAME, PageContext.REQUEST_SCOPE)).andReturn(container);
        expect(container.getAttributeContext(isA(JspRequest.class))).andReturn(attributeContext);
        expect(attributeContext.getAttribute("name")).andReturn(attribute);
        expect(container.evaluate(isA(Attribute.class), isA(JspRequest.class))).andReturn(new Integer(1));
        pageContext.setAttribute("id", new Integer(1), PageContext.PAGE_SCOPE);
        replay(jspBody, pageContext, parent,
               applicationContext, httpServletRequest, httpServletResponse,
               applicationScope, container, attributeContext, attribute);
View Full Code Here

Examples of org.apache.tiles.AttributeContext

     */
    private void renderTemplate(TilesContainer container, String template,
            String templateType, String templateExpression, String role,
            String preparer, boolean flush, Request request) throws IOException {
        try {
            AttributeContext attributeContext = container
                    .getAttributeContext(request);
            Attribute templateAttribute = Attribute.createTemplateAttribute(template,
                    templateExpression, templateType, role);
            attributeContext.setPreparer(preparer);
            attributeContext.setTemplateAttribute(templateAttribute);
            container.renderContext(request);
            if (flush) {
                request.getWriter().flush();
            }
        } finally {
View Full Code Here

Examples of org.apache.tiles.AttributeContext

    /** {@inheritDoc} */
    public Attribute computeAttribute(TilesContainer container, Attribute attribute,
            String name, String role, boolean ignore,
            Object defaultValue, String defaultValueRole, String defaultValueType, Request request) {
        if (attribute == null) {
            AttributeContext evaluatingContext = container
                    .getAttributeContext(request);
            attribute = evaluatingContext.getAttribute(name);
            if (attribute == null) {
                attribute = computeDefaultAttribute(defaultValue,
                        defaultValueRole, defaultValueType);
                if (attribute == null && !ignore) {
                    throw new NoSuchAttributeException("Attribute '" + name
View Full Code Here

Examples of org.apache.tiles.AttributeContext

     */
    private AttributeEvaluatorFactory attributeEvaluatorFactory;

    /** {@inheritDoc} */
    public AttributeContext startContext(Request request) {
        AttributeContext context = new BasicAttributeContext();
        Deque<AttributeContext>  stack = getContextStack(request);
        if (!stack.isEmpty()) {
            AttributeContext parent = stack.peek();
            context.inheritCascadedAttributes(parent);
        }
        stack.push(context);
        return context;
    }
View Full Code Here

Examples of org.apache.tiles.AttributeContext

        popContext(request);
    }

    /** {@inheritDoc} */
    public void renderContext(Request request) {
        AttributeContext attributeContext = getAttributeContext(request);

        render(request, attributeContext);
    }
View Full Code Here

Examples of org.apache.tiles.AttributeContext

        this.context = context;
    }

    /** {@inheritDoc} */
    public AttributeContext getAttributeContext(Request request) {
        AttributeContext context = getContext(request);
        if (context == null) {
            context = new BasicAttributeContext();
            pushContext(context, request);
        }
        return context;
View Full Code Here

Examples of org.apache.tiles.AttributeContext

     * @param definition The definition to render.
     * @param request The request context.
     * @since 2.1.3
     */
    public void render(Definition definition, Request request) {
        AttributeContext originalContext = getAttributeContext(request);
        BasicAttributeContext subContext = new BasicAttributeContext(originalContext);
        subContext.inherit(definition);

        pushContext(subContext, request);

View Full Code Here

Examples of org.apache.tiles.AttributeContext

        if (preparer == null) {
            throw new NoSuchPreparerException("Preparer '" + preparerName + " not found");
        }

        AttributeContext attributeContext = getContext(context);

        preparer.execute(context, attributeContext);
    }
View Full Code Here

Examples of org.apache.tiles.AttributeContext

        listAttribute.setInherit(inherit);
        composeStack.push(listAttribute);
        modelBody.evaluateWithoutWriting();
        TilesContainer container = TilesAccess.getCurrentContainer(request);
        listAttribute = (ListAttribute) composeStack.pop();
        AttributeContext attributeContext = null;
        if (!composeStack.isEmpty()) {
            Object obj = composeStack.peek();
            if (obj instanceof Definition) {
                attributeContext = (AttributeContext) obj;
            }
        }
        if (attributeContext == null) {
            attributeContext = container.getAttributeContext(request);
        }
        attributeContext.putAttribute(name, listAttribute, cascade);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.