/** {@inheritDoc} */ @Override public Attribute clone() { return new Attribute(this); } }
/** * Creates a new empty attribute. * * @return The created attribute. * @since 2.2.0 */ public Attribute createAttribute() { return new Attribute(); }
/** * Creates an attribute that is a copy of the one passed as a parameter. * * @param attribute The attribute to copy. * @return The copied attribute. * @since 2.2.0 */ public Attribute clone(Attribute attribute) { return new Attribute(attribute); }
/** {@inheritDoc} */ @Override public Attribute clone() { return new Attribute(this); } }
/** * Inherits the parent template attribute. * * @param parentTemplateAttribute The parent template attribute. */ private void inheritParentTemplateAttribute( Attribute parentTemplateAttribute) { if (parentTemplateAttribute != null) { if (templateAttribute == null) { templateAttribute = new Attribute(parentTemplateAttribute); } else { templateAttribute.inherit(parentTemplateAttribute); } } }
/** {@inheritDoc} */ public Object mapRow(ResultSet rs, int row) throws SQLException { Attribute attribute = new Attribute(); attribute.setRenderer(rs.getString("TYPE")); attribute.setValue(rs.getString("VALUE")); definition.putAttribute(rs.getString("NAME"), attribute, rs .getBoolean("CASCADE_ATTRIBUTE")); return attribute; }
/** {@inheritDoc} */ @Override public void begin(String namespace, String name, Attributes attributes) { Object obj = digester.pop(); Attribute attribute = new Attribute(obj); digester.push(attribute); } }
/** {@inheritDoc} */ public void inheritCascadedAttributes(AttributeContext context) { if (context instanceof BasicAttributeContext) { copyCascadedAttributes((BasicAttributeContext) context); } else { this.cascadedAttributes = new HashMap<String, Attribute>(); for (String name : context.getCascadedAttributeNames()) { cascadedAttributes.put(name, new Attribute(context .getCascadedAttribute(name))); } } }
/** * Creates a template attribute, starting from the name of the template. * * @param template The template that will be rendered. * @return The template attribute. * @since 2.1.2 */ public static Attribute createTemplateAttribute(String template) { Attribute attribute = new Attribute(); attribute.setValue(template); attribute.setRenderer(TEMPLATE_RENDERER); return attribute; }
/** * Creates a template attribute, starting from the name of the template. * * @param template The template that will be rendered. * @return The template attribute. * @since 2.1.2 */ public static Attribute createTemplateAttribute(String template) { Attribute attribute = new Attribute(); attribute.setValue(template); attribute.setRenderer(TEMPLATE_RENDERER); return attribute; }
/** {@inheritDoc} */ public void inheritCascadedAttributes(AttributeContext context) { if (context instanceof BasicAttributeContext) { copyCascadedAttributes((BasicAttributeContext) context); } else { this.cascadedAttributes = new HashMap<String, Attribute>(); Set<String> parentAttributeNames = context.getCascadedAttributeNames(); if (parentAttributeNames != null) { for (String name : parentAttributeNames) { cascadedAttributes.put(name, new Attribute(context .getCascadedAttribute(name))); } } } }
/** * Copies a BasicAttributeContext in an easier way. * * @param context The context to copy. */ private void copyBasicAttributeContext(BasicAttributeContext context) { Attribute parentTemplateAttribute = context.getTemplateAttribute(); if (parentTemplateAttribute != null) { this.templateAttribute = new Attribute(parentTemplateAttribute); } preparer = context.preparer; if (context.attributes != null && !context.attributes.isEmpty()) { attributes = deepCopyAttributeMap(context.attributes); } copyCascadedAttributes(context); }
/** {@inheritDoc} */ public void mutate(AttributeContext ctx, ServletRequest req) { Attribute attr = new Attribute(); attr.setRenderer("template"); attr.setValue(getRequestBase(req)); ctx.putAttribute(definitionAttributeName, attr); } }
/** {@inheritDoc} */ public void mutate(AttributeContext ctx, javax.servlet.ServletRequest req) { Attribute attr = new Attribute(); attr.setRenderer("template"); attr.setValue(getRequestBase(req)); ctx.putAttribute(definitionAttributeName, attr); } }
/** * * @param actionUrl url should be start with "/" * @param request HttpServletRequest * @param response HttpServletResponse * @throws Exception Exception */ public static void render(String actionUrl, HttpServletRequest request, HttpServletResponse response) throws Exception { TilesContainer container = TilesAccess.getContainer( request.getSession().getServletContext()); AttributeContext attributeContext = container.startContext(request, response); Attribute attr = new Attribute(actionUrl); attributeContext.putAttribute("body", attr); container.render("main.layout", request, response); container.endContext(request, response); }
/** * Process nested ≶addAttribute> tag. * <p/> * Places the value of the nested tag within the * {@link org.apache.tiles.AttributeContext}.It is the responsibility * of the descendent to check security. Security will be managed by called * tags. * * @param nestedTag the put tag desciendent. */ public void processNestedTag(AddAttributeTag nestedTag) { Attribute attribute = new Attribute(nestedTag.getValue(), null, nestedTag .getRole(), nestedTag.getType()); this.addValue(attribute); }
/** * Reset member values for reuse. This method calls super.release(), * which invokes TagSupport.release(), which typically does nothing. * * @param nestedTag The nested <code>PutAttributeTag</code> * @throws TilesJspException Never thrown, it's here for API compatibility. */ public void processNestedTag(PutAttributeTag nestedTag) throws TilesJspException { Attribute attr = new Attribute(nestedTag.getValue(), null, nestedTag.getRole(), nestedTag.getType()); definition.putAttribute(nestedTag.getName(), attr, nestedTag .isCascade()); }
public void testRenderFragment_DynamicAttribute() throws Exception { ApplicationContext tilesAppContext = new WildcardServletApplicationContext(servletContext); Request tilesRequest = new ServletRequest(tilesAppContext, request, response); BasicTilesContainer container = (BasicTilesContainer) TilesAccess.getContainer(tilesAppContext); AttributeContext attributeContext = container.startContext(tilesRequest); attributeContext.putAttribute("body", new Attribute("/WEB-INF/dynamicTemplate.jsp")); Map<String, Attribute> resultMap = new HashMap<>(); ajaxTilesView.addRuntimeAttributes(container, tilesRequest, resultMap); assertNotNull(resultMap.get("body")); assertEquals("/WEB-INF/dynamicTemplate.jsp", resultMap.get("body").toString()); container.endContext(tilesRequest); }
protected Attribute buildPutAttribute(TilesPutAttribute putAttribute) { Attribute attribute = new Attribute(); attribute.setValue(getValueOrNull(putAttribute.value())); String expression = getValueOrNull(putAttribute.expression()); attribute.setExpressionObject(Expression.createExpressionFromDescribedExpression(expression)); attribute.setRole(getValueOrNull(putAttribute.role())); attribute.setRenderer(getValueOrNull(putAttribute.type())); return attribute; }
protected Attribute buildAddAttribute(TilesAddAttribute addAttribute) { Attribute attribute = new Attribute(); attribute.setValue(getValueOrNull(addAttribute.value())); String expression = getValueOrNull(addAttribute.expression()); attribute.setExpressionObject(Expression.createExpressionFromDescribedExpression(expression)); attribute.setRole(getValueOrNull(addAttribute.role())); attribute.setRenderer(getValueOrNull(addAttribute.type())); return attribute; }