All Implemented Interfaces:
TagBase, Serializable, Cloneable
Direct Known Subclasses:
Blank

public class NoTag extends AbstractHtml
It's a tag which makes child content without any opening closing tag.

NB: Nesting NoTag is not recommended and it may cause strange behavior. We recommend TagContent enum for NoTag insertion in a tag instead of creating new NoTag object. insertBefore method in NoTag may not work as expected for now so its use is not recommended.
Since:
1.0.0
See Also:
  • Constructor Details

    • NoTag

      public NoTag(AbstractHtml base, AbstractHtml... children)
      Parameters:
      base - i.e. parent tag of this tag
      children - An array of AbstractHtml
      Since:
      1.0.0
    • NoTag

      public NoTag(AbstractHtml base, Collection<? extends AbstractHtml> children)
      Parameters:
      base - i.e. parent tag of this tag
      children - An array of AbstractHtml
      Since:
      1.0.0
    • NoTag

      public NoTag(AbstractHtml base, String childContent)
      Parameters:
      base - i.e. parent tag of this tag
      childContent -
      Since:
      1.0.0
    • NoTag

      public NoTag(AbstractHtml base, String childContent, boolean contentTypeHtml)
      Parameters:
      base - i.e. parent tag of this tag
      childContent -
      contentTypeHtml - true if the given childContent is HTML. by default it is false.
      Since:
      3.0.2
  • Method Details

    • init

      protected void init()
      invokes only once per object
      Since:
      1.0.0
    • addChildren

      public void addChildren(List<AbstractHtml> children)
      adds AbstractHtmls as children.
      Parameters:
      children -
      Since:
      1.0.0
    • addChild

      public void addChild(AbstractHtml child)
      adds AbstractHtmls as children.
      Parameters:
      child -
      Since:
      1.0.0
    • removeChildren

      public void removeChildren(List<AbstractHtml> children)
      adds AbstractHtmls as children.
      Parameters:
      children -
      Since:
      1.0.0
    • removeChild

      public boolean removeChild(AbstractHtml child)
      adds AbstractHtmls as children.
      Overrides:
      removeChild in class AbstractHtml
      Parameters:
      child -
      Returns:
      true if removed
      Since:
      1.0.0
    • removeChild

      public void removeChild(String child)
      removes the the child content.
      Parameters:
      child -
      Since:
      1.0.0
    • addChild

      public void addChild(String child)
      adds AbstractHtmls as children.
      Parameters:
      child -
      Since:
      1.0.0
    • getChildContent

      public String getChildContent()
      gets child content
      Returns:
      Since:
      1.0.0
    • isChildContentTypeHtml

      public boolean isChildContentTypeHtml()
      Returns:
      true if the child content is considered to be HTML
      Since:
      3.0.2
    • removeSharedTagContent

      @Deprecated public boolean removeSharedTagContent(boolean removeContent)
      Deprecated.
      this method is not allowed in NoTag or Blank class.
      Overrides:
      removeSharedTagContent in class AbstractHtml
      Parameters:
      removeContent - true to remove the inner content of this tag otherwise false. The inner content will be removed only if it contains a ShareTagContent object.
      Returns:
      true if any SharedTagContent object is removed from this tag otherwise false.
    • subscribeTo

      @Deprecated public <T> void subscribeTo(boolean updateClient, SharedTagContent<T> sharedTagContent, SharedTagContent.ContentFormatter<T> formatter)
      Deprecated.
      this method is not allowed in NoTag or Blank class.
      Description copied from class: AbstractHtml
      Subscribes to the given SharedTagContent and listens to its content updates but pushes updates of this tag to client browser page only if there is an active WebSocket connection between server and client browser page and if there is no active WebSocket connection that changes will not be cached for later push. However, it will try to keep the change of this tag (server object) up to date with client browser page. The difference of this method with AbstractHtml.addInnerHtml(SharedTagContent) is that addInnerHtml(SharedTagContent) will push all changes of this tag (server side object) to client browser page and if push is failed it will be cached for retry. AbstractHtml.addInnerHtml(SharedTagContent) will reliably deliver each and every change to client browser page. There are cases where it is discouraged,

      Eg:- printing current time in realtime. Imagine, while printing the time in realtime the websocket communication between the client and server is lost and reconnected after few seconds. In that case we don't have to push the out dated data (time). In such cases AbstractHtml.subscribeTo(SharedTagContent) is more appropriate.
      Overrides:
      subscribeTo in class AbstractHtml
      Parameters:
      updateClient - true to update client browser page if it is available. The default value is true but it will be ignored if there is no client browser page. false will skip updating client browser page only when this method call.
      sharedTagContent - the shared content to be inserted as inner content. Any changes of content in the sharedTagContent will be reflected in this tag and all other consuming tags of this sharedTagContent object.
      formatter - content to be formatted using this formatter before it is embedded in this tag.
    • addInnerHtml

      @Deprecated public <T> void addInnerHtml(boolean updateClient, SharedTagContent<T> sharedTagContent, SharedTagContent.ContentFormatter<T> formatter)
      Deprecated.
      this method is not allowed in NoTag or Blank class.
      Overrides:
      addInnerHtml in class AbstractHtml
      Parameters:
      updateClient - true to update client browser page if it is available. The default value is true but it will be ignored if there is no client browser page. false will skip updating client browser page only when this method call.
      sharedTagContent - the shared content to be inserted as inner content. Any changes of content in the sharedTagContent will be reflected in this tag and all other consuming tags of this sharedTagContent object.
      formatter - content to be formatted using this formatter before it is embedded in this tag.
    • give

      @Deprecated public <T extends AbstractHtml> T give(Consumer<T> consumer)
      Deprecated.
      this method is not allowed in NoTag or Blank class.
      Description copied from class: AbstractHtml
      This method can avoid creating anonymous class coding.
      Eg:
       Div rootDiv = new Div(null, new Id("rootDivId")).<Div>give(parent -> {
           new Div(parent, new Id("parentDivId")).give(nestedTag1 -> {
               new Div(nestedTag1, new Id("child1"));
               new Div(nestedTag1, new Id("child2"));
               new Div(nestedTag1, new Id("child3"));
           });
       });
      
       System.out.println(rootDiv.toHtmlString());
       

      produces

       
       <div id="rootDivId">
          <div id="parentDivId">
               <div id="child1"></div>
               <div id="child2"></div>
               <div id="child3"></div>
           </div>
       </div>
       
       
      Overrides:
      give in class AbstractHtml
      Parameters:
      consumer - the consumer object
      Returns:
      the same object on which give method is called.
    • give

      @Deprecated public <R extends AbstractHtml, C> R give(BiFunction<R,C,R> consumer, C input)
      Deprecated.
      this method is not allowed in NoTag or Blank class.
      Description copied from class: AbstractHtml
      This method can avoid creating anonymous class coding.
      Eg:
       Div div = new Div(null, new Id("rootDivId")).give(TagContent::text, "Hello World");
       System.out.println(div.toHtmlString());
      
       

      produces

       
       <div id="rootDivId">Hello World</div>
       
       

      A mix of give methods will be

       Div div = new Div(null).give(dv -> {
           new Span(dv).give(TagContent::text, "Hello World");
       });
       

      produces

       
       <div>
           <span>Hello World</span>
       </div>
       
       
      Overrides:
      give in class AbstractHtml
      input - the object to be passed as second argument of BiFunction#apply(Object, Object) method.
      Returns:
      the object which BiFunction#apply(Object, Object) returns which will be a subclass of AbstractHtml