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