/** * Sets the list of the attributes that are elements of this attribute. * * @param attributes The attributes. * @since 3.0.0 */ public void setValue(List<Attribute> attributes) { super.setValue(attributes); }
/** * Sets the body of this attribute. * * @param body The attribute body. */ // FIXME Is it necessary? public void setBody(String body) { if (body != null && body.length() != 0) { setValue(body); } }
/** * Sets the value of the template property. * * @param template the new value of the path property * @deprecated Use {@link #getTemplateAttribute()}. */ @Deprecated public void setTemplate(String template) { if (templateAttribute == null) { templateAttribute = Attribute.createTemplateAttribute(template); } else { templateAttribute.setValue(template); } }
/** {@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) throws Exception { Attribute attribute = (Attribute) digester.peek(); attribute.setValue(attributes.getValue("value")); attribute.setExpression(attributes.getValue("expression")); attribute.setRole(attributes.getValue("role")); attribute.setRenderer(attributes.getValue("type")); } }
/** * 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} */ @Override public void begin(String namespace, String name, Attributes attributes) { Attribute attribute = (Attribute) digester.peek(); attribute.setValue(attributes.getValue("value")); String expression = attributes.getValue("expression"); attribute.setExpressionObject(Expression .createExpressionFromDescribedExpression(expression)); attribute.setRole(attributes.getValue("role")); attribute.setRenderer(attributes.getValue("type")); } }
/** {@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); } }
/** * Registers a definition in the container. * * @param definition The definition to register. * @param container The container into which the definition will be * registered. * @param composeStack The compose stack, * @param request The request. */ private void registerDefinition(Definition definition, MutableTilesContainer container, Deque<Object> composeStack, Request request) { container.register(definition, request); if (composeStack.isEmpty()) { return; } Object obj = composeStack.peek(); if (obj instanceof Attribute) { Attribute attribute = (Attribute) obj; attribute.setValue(definition.getName()); if (attribute.getRenderer() == null) { attribute.setRenderer("definition"); } } } }
/** {@inheritDoc} */ @Override public void begin(String namespace, String name, Attributes attributes) { Definition definition = (Definition) digester.peek(0); if (definition.getName() == null) { definition.setName(getNextUniqueDefinitionName(definitions)); } Attribute attribute = (Attribute) digester.peek(1); attribute.setValue(definition.getName()); attribute.setRenderer("definition"); } }
/** {@inheritDoc} */ @Override public void begin(String namespace, String name, Attributes attributes) throws Exception { Definition definition = (Definition) digester.peek(0); if (definition.getName() == null) { definition.setName(getNextUniqueDefinitionName(definitions)); } Attribute attribute = (Attribute) digester.peek(1); attribute.setValue(definition.getName()); attribute.setRenderer("definition"); } }
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; }
/** * Replaces variables into an attribute. * * @param attr The attribute to be used as a basis, containing placeholders * for variables. * @param vars The variables to replace. * @return A new instance of an attribute, whose properties have been * replaced with variables' values. */ private Attribute replaceVarsInAttribute(Attribute attr, Map<Integer, String> vars) { Attribute nuattr = new Attribute(); nuattr.setRole(replace(attr.getRole(), vars)); nuattr.setRenderer(attr.getRenderer()); nuattr.setExpression(attr.getExpression()); Object value = attr.getValue(); if (value instanceof String) { value = replace((String) value, vars); } nuattr.setValue(value); return nuattr; }
/** * Replaces variables into a simple (not list) attribute. * * @param attr The attribute to be used as a basis, containing placeholders * for variables. * @param vars The variables to replace. * @return A new instance of an attribute, whose properties have been * replaced with variables' values. */ private static Attribute replaceVarsInSimpleAttribute(Attribute attr, Object... vars) { Attribute nuattr; nuattr = new Attribute(); nuattr.setRole(replace(attr.getRole(), vars)); nuattr.setRenderer(attr.getRenderer()); Expression expressionObject = attr.getExpressionObject(); if (expressionObject != null) { Expression newExpressionObject = Expression .createExpression(replace(expressionObject.getExpression(), vars), expressionObject.getLanguage()); nuattr.setExpressionObject(newExpressionObject); } Object value = attr.getValue(); if (value instanceof String) { value = replace((String) value, vars); } nuattr.setValue(value); return nuattr; }