示例#1
0
 TagPluginContextImpl(Node.CustomTag n, PageInfo pageInfo) {
   this.node = n;
   this.pageInfo = pageInfo;
   curNodes = new Node.Nodes();
   n.setAtETag(curNodes);
   curNodes = new Node.Nodes();
   n.setAtSTag(curNodes);
   n.setUseTagPlugin(true);
   pluginAttributes = new HashMap();
 }
示例#2
0
  /**
   * Invoke tag plugin for the given custom tag, if a plugin exists for the custom tag's tag
   * handler.
   *
   * <p>The given custom tag node will be manipulated by the plugin.
   */
  private void invokePlugin(Node.CustomTag n) {
    TagPlugin tagPlugin = (TagPlugin) tagPlugins.get(n.getTagHandlerClass().getName());
    if (tagPlugin == null) {
      return;
    }

    TagPluginContext tagPluginContext = new TagPluginContextImpl(n, pageInfo);
    n.setTagPluginContext(tagPluginContext);
    tagPlugin.doTag(tagPluginContext);
  }
示例#3
0
 public TagPluginContext getParentContext() {
   Node parent = node.getParent();
   if (!(parent instanceof Node.CustomTag)) {
     return null;
   }
   return ((Node.CustomTag) parent).getTagPluginContext();
 }
示例#4
0
 private Node.JspAttribute getNodeAttribute(String attribute) {
   Node.JspAttribute[] attrs = node.getJspAttributes();
   for (int i = 0; attrs != null && i < attrs.length; i++) {
     if (attrs[i].getName().equals(attribute)) {
       return attrs[i];
     }
   }
   return null;
 }
示例#5
0
 public void generateBody() {
   // Since we'll generate the body anyway, this is really a nop,
   // except for the fact that it lets us put the Java sources the
   // plugins produce in the correct order (w.r.t the body).
   curNodes = node.getAtETag();
 }
示例#6
0
 public void dontUseTagPlugin() {
   node.setUseTagPlugin(false);
 }
示例#7
0
 public void generateAttribute(String attributeName) {
   curNodes.add(new Node.AttributeGenerator(node.getStart(), attributeName, node));
 }
示例#8
0
 public void generateJavaSource(String sourceCode) {
   curNodes.add(new Node.Scriptlet(sourceCode, node.getStart(), null));
 }
示例#9
0
 public void generateDeclaration(String id, String text) {
   if (pageInfo.isPluginDeclared(id)) {
     return;
   }
   curNodes.add(new Node.Declaration(text, node.getStart(), null));
 }
示例#10
0
 public boolean isScriptless() {
   return node.getChildInfo().isScriptless();
 }