|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.hadoop.yarn.webapp.hamlet.HamletSpec
org.apache.hadoop.yarn.webapp.hamlet.HamletImpl
@InterfaceAudience.Private public class HamletImpl
A simple unbuffered generic hamlet implementation. Zero copy but allocation on every element, which could be optimized to use a thread-local element pool. Prints HTML as it builds. So the order is important.
Nested Class Summary | |
---|---|
class |
HamletImpl.EImp<T extends HamletSpec._>
The base class for elements |
static class |
HamletImpl.EOpt
Element options. |
class |
HamletImpl.Generic<T extends HamletSpec._>
|
Constructor Summary | |
---|---|
HamletImpl(PrintWriter out,
int nestLevel,
boolean wasInline)
|
Method Summary | ||
---|---|---|
PrintWriter |
getWriter()
|
|
protected void |
indent(EnumSet<HamletImpl.EOpt> opts)
|
|
int |
nestLevel()
|
|
static String[] |
parseSelector(String selector)
Parse selector into id and classes |
|
protected void |
printAttr(String name,
String value)
|
|
protected void |
printEndTag(String name,
EnumSet<HamletImpl.EOpt> opts)
|
|
protected void |
printStartTag(String name,
EnumSet<HamletImpl.EOpt> opts)
|
|
|
root(String name)
|
|
|
root(String name,
EnumSet<HamletImpl.EOpt> opts)
Create a root-level generic element. |
|
static
|
setLinkHref(E e,
String href)
|
|
static
|
setScriptSrc(E e,
String src)
|
|
static
|
setSelector(E e,
String selector)
Set id and/or class attributes for an element. |
|
void |
setWasInline(boolean state)
|
|
protected void |
subView(Class<? extends SubView> cls)
Sub-classes should override this to do something interesting. |
|
boolean |
wasInline()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public HamletImpl(PrintWriter out, int nestLevel, boolean wasInline)
Method Detail |
---|
public int nestLevel()
public boolean wasInline()
public void setWasInline(boolean state)
public PrintWriter getWriter()
public <T extends HamletSpec._> HamletImpl.Generic<T> root(String name, EnumSet<HamletImpl.EOpt> opts)
T
- type of the parent elementname
- of the elementopts
- element options
public <T extends HamletSpec._> HamletImpl.Generic<T> root(String name)
protected void printStartTag(String name, EnumSet<HamletImpl.EOpt> opts)
protected void indent(EnumSet<HamletImpl.EOpt> opts)
protected void printEndTag(String name, EnumSet<HamletImpl.EOpt> opts)
protected void printAttr(String name, String value)
protected void subView(Class<? extends SubView> cls)
cls
- the sub-view classpublic static String[] parseSelector(String selector)
selector
- in the form of (#id)?(.class)*
WebAppException
- when both are null or syntax error.public static <E extends HamletSpec.CoreAttrs> E setSelector(E e, String selector)
E
- type of the elemente
- the elementselector
- Haml form of "(#id)?(.class)*"
public static <E extends HamletSpec.LINK> E setLinkHref(E e, String href)
public static <E extends HamletSpec.SCRIPT> E setScriptSrc(E e, String src)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |