Package htmlflow
Class HtmlView<T>
- java.lang.Object
-
- htmlflow.HtmlView<T>
-
- Type Parameters:
T- The type of domain object bound to this View.
- All Implemented Interfaces:
HtmlWriter<T>,org.xmlet.htmlapifaster.Element<HtmlView<T>,org.xmlet.htmlapifaster.Element<?,?>>
- Direct Known Subclasses:
DynamicHtml,StaticHtml
public abstract class HtmlView<T> extends Object implements HtmlWriter<T>, org.xmlet.htmlapifaster.Element<HtmlView<T>,org.xmlet.htmlapifaster.Element<?,?>>
The root container for HTML elements. It it responsible for managing theorg.xmlet.htmlapi.ElementVisitorimplementation, which is responsible for printing the tree of elements and attributes. Instances of HtmlView are immutable. Any change to its properties returns a new instance of HtmlView.- Author:
- Miguel Gamboa, Luís Duare created on 29-03-2012
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedHtmlView(Supplier<HtmlVisitorCache> visitorSupplier, boolean threadSafe)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description org.xmlet.htmlapifaster.Element__()<U> voidaddPartial(HtmlView<U> partial)Adds a partial view to this view.<U> voidaddPartial(HtmlView<U> partial, U model)Adds a partial view to this view.protected abstract HtmlView<T>clone(HtmlVisitorCache visitor)Resulting in a non thread safe view.protected abstract HtmlView<T>clone(Supplier<HtmlVisitorCache> visitorSupplier, boolean threadSafe)Since HtmlView is immutable this is the preferred way to create a copy of the existing HtmlView instance with a different threadSafe state.org.xmlet.htmlapifaster.Root<HtmlView<T>>defineRoot()org.xmlet.htmlapifaster.Div<HtmlView<T>>div()StringgetName()org.xmlet.htmlapifaster.ElementgetParent()HtmlVisitorCachegetVisitor()org.xmlet.htmlapifaster.Html<HtmlView<T>>html()HtmlView<T>self()HtmlView<T>setIndented(boolean isIndented)Returns a new instance of HtmlView with the same properties of this object but with indented set to the value of isIndented parameter.HtmlWriter<T>setPrintStream(PrintStream out)Returns a new instance of HtmlView with the same properties of this object but with a new HtmlVisitorCache set with the out PrintStream parameter.HtmlView<T>threadSafe()org.xmlet.htmlapifaster.Tr<HtmlView<T>>tr()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface htmlflow.HtmlWriter
render, render, write, write
-
-
-
-
Constructor Detail
-
HtmlView
protected HtmlView(Supplier<HtmlVisitorCache> visitorSupplier, boolean threadSafe)
-
-
Method Detail
-
setPrintStream
public final HtmlWriter<T> setPrintStream(PrintStream out)
Returns a new instance of HtmlView with the same properties of this object but with a new HtmlVisitorCache set with the out PrintStream parameter.- Specified by:
setPrintStreamin interfaceHtmlWriter<T>
-
setIndented
public final HtmlView<T> setIndented(boolean isIndented)
Returns a new instance of HtmlView with the same properties of this object but with indented set to the value of isIndented parameter.
-
getVisitor
public final HtmlVisitorCache getVisitor()
-
getName
public String getName()
-
__
public org.xmlet.htmlapifaster.Element __()
-
getParent
public org.xmlet.htmlapifaster.Element getParent()
-
addPartial
public final <U> void addPartial(HtmlView<U> partial, U model)
Adds a partial view to this view.- Type Parameters:
U- the type of the domain model of the partial view.- Parameters:
partial- inner view.model- the domain object bound to the partial view.
-
addPartial
public final <U> void addPartial(HtmlView<U> partial)
Adds a partial view to this view.- Type Parameters:
U- the type of the domain model of the partial view.- Parameters:
partial- inner view.
-
clone
protected abstract HtmlView<T> clone(Supplier<HtmlVisitorCache> visitorSupplier, boolean threadSafe)
Since HtmlView is immutable this is the preferred way to create a copy of the existing HtmlView instance with a different threadSafe state.- Parameters:
visitorSupplier-threadSafe-
-
clone
protected abstract HtmlView<T> clone(HtmlVisitorCache visitor)
Resulting in a non thread safe view. Receives an existent visitor. Usually for a parent view to share its visitor with a partial.
-
-