Package htmlflow

Class 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 the org.xmlet.htmlapi.ElementVisitor implementation, 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
    • Method Detail

      • html

        public final org.xmlet.htmlapifaster.Html<HtmlView<T>> html()
      • div

        public final org.xmlet.htmlapifaster.Div<HtmlView<T>> div()
      • tr

        public final org.xmlet.htmlapifaster.Tr<HtmlView<T>> tr()
      • defineRoot

        public final org.xmlet.htmlapifaster.Root<HtmlView<T>> defineRoot()
      • 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:
        setPrintStream in interface HtmlWriter<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.
      • self

        public final HtmlView<T> self()
        Specified by:
        self in interface org.xmlet.htmlapifaster.Element<HtmlView<T>,​org.xmlet.htmlapifaster.Element<?,​?>>
      • threadSafe

        public final HtmlView<T> threadSafe()
      • getVisitor

        public final HtmlVisitorCache getVisitor()
        Specified by:
        getVisitor in interface org.xmlet.htmlapifaster.Element<HtmlView<T>,​org.xmlet.htmlapifaster.Element<?,​?>>
      • getName

        public String getName()
        Specified by:
        getName in interface org.xmlet.htmlapifaster.Element<HtmlView<T>,​org.xmlet.htmlapifaster.Element<?,​?>>
      • __

        public org.xmlet.htmlapifaster.Element __()
        Specified by:
        __ in interface org.xmlet.htmlapifaster.Element<HtmlView<T>,​org.xmlet.htmlapifaster.Element<?,​?>>
      • getParent

        public org.xmlet.htmlapifaster.Element getParent()
        Specified by:
        getParent in interface org.xmlet.htmlapifaster.Element<HtmlView<T>,​org.xmlet.htmlapifaster.Element<?,​?>>
      • 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.