Example #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();
 }
Example #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);
  }
Example #3
0
 public TagPluginContext getParentContext() {
   Node parent = node.getParent();
   if (!(parent instanceof Node.CustomTag)) {
     return null;
   }
   return ((Node.CustomTag) parent).getTagPluginContext();
 }
Example #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;
 }
Example #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();
 }
Example #6
0
 public void dontUseTagPlugin() {
   node.setUseTagPlugin(false);
 }
Example #7
0
 public void generateAttribute(String attributeName) {
   curNodes.add(new Node.AttributeGenerator(node.getStart(), attributeName, node));
 }
Example #8
0
 public void generateJavaSource(String sourceCode) {
   curNodes.add(new Node.Scriptlet(sourceCode, node.getStart(), null));
 }
Example #9
0
 public void generateDeclaration(String id, String text) {
   if (pageInfo.isPluginDeclared(id)) {
     return;
   }
   curNodes.add(new Node.Declaration(text, node.getStart(), null));
 }
Example #10
0
 public boolean isScriptless() {
   return node.getChildInfo().isScriptless();
 }