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

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

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

Definition.setTemplateAttribute介绍

暂无

代码示例

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

  1. /** {@inheritDoc} */
  2. @Override
  3. public void begin(String namespace, String name, Attributes attributes)
  4. throws Exception {
  5. Definition definition = (Definition) digester.peek();
  6. definition.setName(attributes.getValue("name"));
  7. definition.setPreparer(attributes.getValue("preparer"));
  8. definition.setExtends(attributes.getValue("extends"));
  9. String template = attributes.getValue("template");
  10. Attribute attribute = Attribute.createTemplateAttribute(template);
  11. attribute.setExpression(attributes.getValue("templateExpression"));
  12. attribute.setRole(attributes.getValue("role"));
  13. String templateType = attributes.getValue("templateType");
  14. if (templateType != null) {
  15. attribute.setRenderer(templateType);
  16. }
  17. definition.setTemplateAttribute(attribute);
  18. }
  19. }

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

  1. /** {@inheritDoc} */
  2. @Override
  3. public void begin(String namespace, String name, Attributes attributes) {
  4. Definition definition = (Definition) digester.peek();
  5. definition.setName(attributes.getValue("name"));
  6. definition.setPreparer(attributes.getValue("preparer"));
  7. String extendsAttribute = attributes.getValue("extends");
  8. definition.setExtends(extendsAttribute);
  9. String template = attributes.getValue("template");
  10. Attribute attribute = Attribute.createTemplateAttribute(template);
  11. attribute.setExpressionObject(Expression
  12. .createExpressionFromDescribedExpression(attributes
  13. .getValue("templateExpression")));
  14. attribute.setRole(attributes.getValue("role"));
  15. String templateType = attributes.getValue("templateType");
  16. if (templateType != null) {
  17. attribute.setRenderer(templateType);
  18. } else if (extendsAttribute != null && templateType == null) {
  19. attribute.setRenderer(null);
  20. }
  21. definition.setTemplateAttribute(attribute);
  22. }
  23. }

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

  1. /**
  2. * Creates the definition to store.
  3. *
  4. * @param name The name of the definition to create. If not specified, an
  5. * anonymous definition will be created.
  6. * @param template The template of this definition.
  7. * @param role A comma-separated list of roles. If present, the definition
  8. * will be rendered only if the current user belongs to one of the roles.
  9. * @param extendsParam The definition name that this definition extends.
  10. * @param preparer The preparer to use to invoke before the definition is
  11. * rendered.
  12. * @return The created definition.
  13. */
  14. private Definition createDefinition(String name, String template,
  15. String role, String extendsParam, String preparer) {
  16. Definition definition = new Definition();
  17. definition.setName(name);
  18. Attribute templateAttribute = Attribute
  19. .createTemplateAttribute(template);
  20. templateAttribute.setRole(role);
  21. definition.setTemplateAttribute(templateAttribute);
  22. definition.setExtends(extendsParam);
  23. definition.setPreparer(preparer);
  24. return definition;
  25. }

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

  1. /** {@inheritDoc} */
  2. public int doStartTag() throws TilesJspException {
  3. definition = new Definition();
  4. definition.setName(name);
  5. Attribute templateAttribute = Attribute
  6. .createTemplateAttribute(template);
  7. templateAttribute.setRole(role);
  8. definition.setTemplateAttribute(templateAttribute);
  9. definition.setExtends(extend);
  10. definition.setPreparer(preparer);
  11. TilesContainer c = JspUtil.getCurrentContainer(pageContext);
  12. if (c == null) {
  13. throw new TilesJspException("TilesContainer not initialized");
  14. }
  15. if (!(c instanceof MutableTilesContainer)) {
  16. throw new TilesJspException(
  17. "Unable to define definition for a "
  18. + "container which does not implement MutableTilesContainer");
  19. }
  20. container = (MutableTilesContainer) c;
  21. return EVAL_BODY_INCLUDE;
  22. }

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

  1. /**
  2. * Creates a definition given its representation with wildcards.
  3. *
  4. * @param d The definition to replace.
  5. * @param name The name of the definition to be created.
  6. * @param vars The variables to be substituted.
  7. * @return The definition that can be rendered.
  8. * @since 2.1.0
  9. */
  10. protected Definition replaceDefinition(Definition d, String name,
  11. Map<Integer, String> vars) {
  12. Definition nudef = new Definition();
  13. nudef.setExtends(replace(d.getExtends(), vars));
  14. nudef.setName(name);
  15. nudef.setPreparer(replace(d.getPreparer(), vars));
  16. nudef.setTemplateAttribute(replaceVarsInAttribute(d
  17. .getTemplateAttribute(), vars));
  18. Set<String> localAttributeNames = d.getLocalAttributeNames();
  19. if (localAttributeNames != null && !localAttributeNames.isEmpty()) {
  20. for (String attributeName : localAttributeNames) {
  21. Attribute attr = d.getLocalAttribute(attributeName);
  22. Attribute nuattr = replaceVarsInAttribute(attr, vars);
  23. nudef.putAttribute(replace(attributeName, vars), nuattr);
  24. }
  25. }
  26. return nudef;
  27. }

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

  1. Attribute templateAttribute = d.getTemplateAttribute();
  2. if (templateAttribute != null) {
  3. nudef.setTemplateAttribute(replaceVarsInAttribute(
  4. templateAttribute, vars));

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

  1. definition.setPreparer(preparer);
  2. definition.setTemplateAttribute(buildTemplateAttribute(tilesDefinition));

相关文章