Class WebXContainerElement

java.lang.Object
webx.WebXElement
webx.WebXContainerElement
  • Field Details

  • Constructor Details

    • WebXContainerElement

      public WebXContainerElement()
  • Method Details

    • addChildren

      @Deprecated public WebXContainerElement addChildren(WebXElement... children)
      Deprecated.
      Appends multiple child nodes to the parent at once.
      Parameters:
      children - Comma separated list of children or an array of child nodes
      Returns:
      A modified element
    • add

      public WebXContainerElement add(WebXElement... children)
      Appends multiple child nodes to the parent at once.
      Parameters:
      children - Comma separated list of children or an array of child nodes
      Returns:
      A modified element
    • add

      public WebXContainerElement add(WebXElement child)
      Appends a child to the parent class
      Parameters:
      child - The actual child node
      Returns:
      A modified element
    • addChild

      @Deprecated public WebXContainerElement addChild(WebXElement child)
      Deprecated.
      Appends a child to the parent class
      Parameters:
      child - The actual child node
      Returns:
      A modified element
    • attr

      public WebXContainerElement attr(String key, String value)
      Description copied from class: WebXElement
      Adds an attribute to the element
      Overrides:
      attr in class WebXElement
      Parameters:
      key - The attribute identifier or name
      value - The attribute value
      Returns:
      A modified element
    • render

      public String render()
      Description copied from class: WebXElement
      Converts the Any webx element into its html representation, including all its children, recursively.
      Specified by:
      render in class WebXElement
      Returns:
      The String representation of the element along with the children.
    • hxVals

      public WebXContainerElement hxVals(String val)
      Description copied from class: WebXElement
      The hx-vals attribute allows you to add to the parameters that will be submitted with an AJAX request.
      Overrides:
      hxVals in class WebXElement
      Parameters:
      val - Custom data to be send to the server along with the request. Useful when sending post requests.
      Returns:
      A modified element
      See Also:
      • htmx docs
         
         	new P()
         		.hxVals("{\"myVal\": 100}");
         	new P()
         		.hxVals("js:{\"compute\": 100 * 5 * somevar}");
         
         
    • hxPost

      public WebXContainerElement hxPost(String path)
      Description copied from class: WebXElement
      The hxPost method will cause an element to issue a POST to the specified URL and swap the HTML into the DOM using a swap strategy
      Overrides:
      hxPost in class WebXElement
      Parameters:
      path - Server endpoint to make the request to
      Returns:
      A modified element
      See Also:
    • hxGet

      public WebXContainerElement hxGet(String path)
      Description copied from class: WebXElement
      The hxGet method will cause an element to issue a GET to the specified URL and swap the HTML into the DOM using a swap strategy
      Overrides:
      hxGet in class WebXElement
      Parameters:
      path - Server endpoint to make the request to
      Returns:
      A modified element
      See Also:
    • hxSwapOob

      public WebXContainerElement hxSwapOob(String value)
      Description copied from class: WebXElement
      The hx-swap-oob attribute allows you to specify that some content in a response should be swapped into the DOM somewhere other than the target, that is “Out of Band”. This allows you to piggy back updates to other element updates on a response.
      Overrides:
      hxSwapOob in class WebXElement
      Parameters:
      value - Activation (true) or a swap strategy
      Returns:
      A modified element
      See Also:
      • htmx docs
         
         	new Button("Click Me")
         		.hxPost("/greet)
         		.hxSwapOob("true");
         
         
    • hxBoost

      public WebXContainerElement hxBoost(boolean activate)
      Description copied from class: WebXElement
      The hxBoost attribute allows you to “boost” normal anchors and form tags to use AJAX instead.
      Overrides:
      hxBoost in class WebXElement
      Parameters:
      activate - The boolean value used to enable or disable the boost
      Returns:
      A modified element
      See Also:
    • hxConfirm

      public WebXContainerElement hxConfirm(String message)
      Description copied from class: WebXElement
      The hxConfirm method allows you to confirm an action before issuing a request. This can be useful in cases where the action is destructive and you want to ensure that the user really wants to do it.
      Overrides:
      hxConfirm in class WebXElement
      Parameters:
      message - Text to be used as a confirmation message
      Returns:
      A modified element
      See Also:
    • hxOn

      public WebXContainerElement hxOn(String event)
      Description copied from class: WebXElement
      The hxOn method allow you to embed scripts inline to respond to events directly on an element; similar to the onevent properties found in HTML, such as onClick. The hx-on* attributes improve upon onevent by enabling the handling of any arbitrary JavaScript event, for enhanced Locality of Behaviour (LoB) even when dealing with non-standard DOM events
      Overrides:
      hxOn in class WebXElement
      Parameters:
      event - Event which triggers the requests
      Returns:
      A modified element
      See Also:
    • hxExt

      public WebXContainerElement hxExt(String ext)
      Description copied from class: WebXElement
      The hxExt attribute enables an htmx extension for an element and all its children. The value can be a single extension name or a comma separated list of extensions to apply. The hxExt tag may be placed on parent elements if you want a plugin to apply to an entire swath of the DOM, and on the body tag for it to apply to all htmx requests.
      Overrides:
      hxExt in class WebXElement
      Parameters:
      ext - The extension to be used
      Returns:
      A modified element
      See Also:
    • hxWs

      public WebXContainerElement hxWs(String url)
      Description copied from class: WebXElement
      The WebSockets extension enables easy, bi-directional communication with Web Sockets servers directly from HTML.
      Overrides:
      hxWs in class WebXElement
      Parameters:
      url - Url for the websocket server
      Returns:
      A modified element
      See Also:
    • hxSend

      public WebXContainerElement hxSend()
      Description copied from class: WebXElement
      Sends a message to the nearest websocket based on the trigger value for the element
      Overrides:
      hxSend in class WebXElement
      Returns:
      A modified element
      See Also:
    • hxEncoding

      public WebXContainerElement hxEncoding(String type)
      Description copied from class: WebXElement
      Submits a file uploaded via a form to the server
      Overrides:
      hxEncoding in class WebXElement
      Parameters:
      type - The type of encoding which must be used. Note custom encoding formats are not yet supported for now.
      Returns:
      A modified element
      See Also:
    • hxEncoding

      public WebXContainerElement hxEncoding()
      Description copied from class: WebXElement
      Submits a file uploaded via a form to the server. Sets the the type to "multipart/form-data"
      Overrides:
      hxEncoding in class WebXElement
      Returns:
      A modified element
      See Also:
    • hxSwap

      public WebXContainerElement hxSwap(String strategy)
      Description copied from class: WebXElement
      The hx-swap attribute allows you to specify how the response will be swapped in relative to the target of an AJAX request. If you do not specify the option, the default is htmx.config.defaultSwapStyle (innerHTML).
      Overrides:
      hxSwap in class WebXElement
      Parameters:
      strategy - The swap strategy to be used
      Returns:
      A modified element
      See Also:
      • htmx docs
         
         	new Button("Click Me")
         		.hxPost("/greet)
         		.hxSwap("outerHTML");
         
         
    • id

      public WebXContainerElement id(String id)
      Description copied from class: WebXElement
      The id global attribute defines an identifier (ID) which must be unique in the whole document. The purpose of the ID attribute is to identify a single element when linking (using a fragment identifier), scripting, or styling (with CSS). Elements with ID attributes are available as global properties. The property name is the ID attribute, and the property value is the element.
      Overrides:
      id in class WebXElement
      Parameters:
      id - The identifier for the element
      Returns:
      A modified element
      See Also:
    • hxTarget

      public WebXContainerElement hxTarget(String target)
      Description copied from class: WebXElement
      The hx-target attribute allows you to target a different element for swapping than the one issuing the AJAX request.
      Overrides:
      hxTarget in class WebXElement
      Parameters:
      target - The target element to be replaced with the response html
      Returns:
      A modified element
      See Also:
      • htmx docs
         
         	new Button("Click Me")
         		.hxPost("/greet)
         		.hxTarget("#parentdiv");
         
         
    • hxTrigger

      public WebXContainerElement hxTrigger(String trigger)
      Description copied from class: WebXElement
      The hx-trigger attribute allows you to specify what triggers an AJAX request.
      Overrides:
      hxTrigger in class WebXElement
      Parameters:
      trigger - The event that triggers the http request
      Returns:
      A modified element
      See Also:
      • htmx docs
         
         	new P("00:00:00")
         		.hxPost("/get_clock")
         		.hxTrigger("every 1s");
         
         
    • className

      public WebXContainerElement className(String names)
      Description copied from class: WebXElement
      The class global attribute is a list of the classes of the element, separated by ASCII whitespace. Classes allow CSS and JavaScript to select and access specific elements via the class selectors or functions like the document.getElementsByClassName().
      Overrides:
      className in class WebXElement
      Parameters:
      names - Whitespace separated list of classes
      Returns:
      A modified element
      See Also: