public class ElseTag extends Tag
ElseTag can be chained with IfTag or ForTag to contain the "else" block. In the case
if IfTag, it'll be chained to if the if condition is false. In the case of ForTag, it'll be chained
to if there are no elements in the list to be iterated.
The ElseTag can have an optional "if <expr>" after if, in which case the tag will basically be like
an IfTag that can be chained to. You can then do as many {% if blah %} {% else if blah %}...{% end %}
as you like.
| Constructor and Description |
|---|
ElseTag() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canChain(Tag nextTag)
Return true if we can chain to the given next
Tag. |
boolean |
isBlockTag() |
void |
parseStatement(StatementParser stmtParser)
Parse the statement that appears after the tag in the markup.
|
void |
render(CarrotEngine engine,
java.io.Writer writer,
TagNode tagNode,
Scope scope)
Render this
Tag to the given Writer. |
public boolean isBlockTag()
isBlockTag in class Tagpublic boolean canChain(Tag nextTag)
Tag. If it's another else tag then we can chain to it.public void parseStatement(StatementParser stmtParser) throws CarrotException
TagTag.isBlockTag() or Tag.canChain(Tag).parseStatement in class TagstmtParser - A StatementParser for parsing the statement.CarrotException - if there is an unrecoverable error parsing the statement.public void render(CarrotEngine engine, java.io.Writer writer, TagNode tagNode, Scope scope) throws CarrotException, java.io.IOException
TagTag to the given Writer.render in class Tagengine - The current CarrotEngine.writer - The Writer to render to.tagNode - The TagNode that we're enclosed in. You can use this to render the children, or query
the children or whatever.scope - The current Scope.CarrotException - if there's an error parsing or rendering the templatejava.io.IOException - when there's an error writing to the Writer (basically this is just passed on from
whatever errors the Writer might throw..