org.apache.tiles.Definition.putAttribute()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(199)

本文整理了Java中org.apache.tiles.Definition.putAttribute()方法的一些代码示例,展示了Definition.putAttribute()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Definition.putAttribute()方法的具体详情如下:
包路径:org.apache.tiles.Definition
类名称:Definition
方法名:putAttribute

Definition.putAttribute介绍

暂无

代码示例

代码示例来源:origin: org.apache.tiles/com.springsource.org.apache.tiles

/**
 * Add an attribute to this definition.
 * <p/>
 * This method is used by Digester to load definitions.
 *
 * @param attribute Attribute to add.
 * @deprecated Use {@link Definition#putAttribute(String, Attribute)}.
 */
@Deprecated
public void addAttribute(Attribute attribute) {
  putAttribute(attribute.getName(), attribute);
}

代码示例来源:origin: org.apache.tiles/com.springsource.org.apache.tiles

/**
 * Put an attribute in template definition.
 * Attribute can be used as content for tag get.
 *
 * @param name    Attribute name
 * @param content Attribute value
 * @param role    Determine if content is used by get tag. If user is in role, content is used.
 * @deprecated Use {@link AttributeContext#putAttribute(String, Attribute)}
 * or {@link AttributeContext#putAttribute(String, Attribute, boolean)}.
 */
@Deprecated
public void put(String name, Object content, String role) {
  Attribute attribute = new Attribute(content, null, role, (String) null);
  putAttribute(name, attribute);
}

代码示例来源:origin: org.apache.tiles/com.springsource.org.apache.tiles

/**
 * Put an attribute in template definition.
 * Attribute can be used as content for tag get.
 *
 * @param name    Attribute name
 * @param content Attribute value
 * @param type    attribute type: template, string, definition
 * @param role    Determine if content is used by get tag. If user is in role, content is used.
 * @deprecated Use {@link AttributeContext#putAttribute(String, Attribute)}
 * or {@link AttributeContext#putAttribute(String, Attribute, boolean)}.
 */
@Deprecated
public void put(String name, Object content,
    org.apache.tiles.Attribute.AttributeType 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.
  Attribute attribute = new Attribute(content, role, type);
  putAttribute(name, attribute);
}

代码示例来源:origin: org.apache.tiles/tiles-core

/** {@inheritDoc} */
  @Override
  public void begin(String namespace, String name, Attributes attributes) {
    Attribute attribute = (Attribute) digester.peek(0);
    Definition definition = (Definition) digester.peek(1);
    definition.putAttribute(attributes.getValue("name"), attribute,
        "true".equals(attributes.getValue("cascade")));
  }
}

代码示例来源:origin: org.apache.tiles/com.springsource.org.apache.tiles.core

/** {@inheritDoc} */
  @Override
  public void begin(String namespace, String name, Attributes attributes)
      throws Exception {
    Attribute attribute = (Attribute) digester.peek(0);
    Definition definition = (Definition) digester.peek(1);
    definition.putAttribute(attributes.getValue("name"), attribute,
        "true".equals(attributes.getValue("cascade")));
  }
}

代码示例来源:origin: org.apache.tiles/tiles-test-db

/** {@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;
}

代码示例来源:origin: org.apache.tiles/com.springsource.org.apache.tiles.jsp

/**
 * 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());
}

代码示例来源:origin: org.apache.tiles/com.springsource.org.apache.tiles.jsp

/** {@inheritDoc} */
public void processNestedTag(PutListAttributeTag nestedTag) {
  ListAttribute attribute = new ListAttribute(nestedTag.getAttributes());
  attribute.setRole(nestedTag.getRole());
  attribute.setInherit(nestedTag.getInherit());
  definition.putAttribute(nestedTag.getName(), attribute, nestedTag
      .isCascade());
}

代码示例来源:origin: org.apache.tiles/tiles-core

Attribute nuattr = replaceVarsInAttribute(attr, vars);
nudef.putAttribute(replace(attributeName, vars), nuattr);
Attribute nuattr = replaceVarsInAttribute(attr, vars);
nudef.putAttribute(replace(attributeName, vars), nuattr, true);

代码示例来源:origin: org.apache.struts/struts2-tiles-plugin

definition.putAttribute(putAttribute.name(), attribute, putAttribute.cascade());
definition.putAttribute(putListAttribute.name(), attribute, putListAttribute.cascade());

代码示例来源:origin: org.apache.tiles/com.springsource.org.apache.tiles.core

/**
 * Creates a definition given its representation with wildcards.
 *
 * @param d The definition to replace.
 * @param name The name of the definition to be created.
 * @param vars The variables to be substituted.
 * @return The definition that can be rendered.
 * @since 2.1.0
 */
protected Definition replaceDefinition(Definition d, String name,
    Map<Integer, String> vars) {
  Definition nudef = new Definition();
  nudef.setExtends(replace(d.getExtends(), vars));
  nudef.setName(name);
  nudef.setPreparer(replace(d.getPreparer(), vars));
  nudef.setTemplateAttribute(replaceVarsInAttribute(d
      .getTemplateAttribute(), vars));
  Set<String> localAttributeNames = d.getLocalAttributeNames();
  if (localAttributeNames != null && !localAttributeNames.isEmpty()) {
    for (String attributeName : localAttributeNames) {
      Attribute attr = d.getLocalAttribute(attributeName);
      Attribute nuattr = replaceVarsInAttribute(attr, vars);
      nudef.putAttribute(replace(attributeName, vars), nuattr);
    }
  }
  return nudef;
}

相关文章