Class WebXElement
java.lang.Object
webx.WebXElement
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds an attribute to the elementThe class global attribute is a list of the classes of the element, separated by ASCII whitespace.hxBoost(boolean activate) The hxBoost attribute allows you to “boost” normal anchors and form tags to use AJAX instead.The hxConfirm method allows you to confirm an action before issuing a request.Submits a file uploaded via a form to the server.hxEncoding(String type) Submits a file uploaded via a form to the serverThe hxExt attribute enables an htmx extension for an element and all its children.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 strategyThe 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 hxPost method will cause an element to issue a POST to the specified URL and swap the HTML into the DOM using a swap strategyhxSend()Sends a message to the nearest websocket based on the trigger value for the elementThe hx-swap attribute allows you to specify how the response will be swapped in relative to the target of an AJAX request.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”.The hx-target attribute allows you to target a different element for swapping than the one issuing the AJAX request.The hx-trigger attribute allows you to specify what triggers an AJAX request.The hx-vals attribute allows you to add to the parameters that will be submitted with an AJAX request.The WebSockets extension enables easy, bi-directional communication with Web Sockets servers directly from HTML.The id global attribute defines an identifier (ID) which must be unique in the whole document.abstract Stringrender()Converts the Any webx element into its html representation, including all its children, recursively.
-
Field Details
-
attributes
-
-
Constructor Details
-
WebXElement
public WebXElement()
-
-
Method Details
-
attr
Adds an attribute to the element- Parameters:
key- The attribute identifier or namevalue- The attribute value- Returns:
- A modified element
-
hxVals
The hx-vals attribute allows you to add to the parameters that will be submitted with an AJAX request.- 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:
-
hxTrigger
The hx-trigger attribute allows you to specify what triggers an AJAX request.- Parameters:
trigger- The event that triggers the http request- Returns:
- A modified element
- See Also:
-
hxTarget
The hx-target attribute allows you to target a different element for swapping than the one issuing the AJAX request.- Parameters:
target- The target element to be replaced with the response html- Returns:
- A modified element
- See Also:
-
hxSwap
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).- Parameters:
strategy- The swap strategy to be used- Returns:
- A modified element
- See Also:
-
hxSwapOob
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.- Parameters:
value- Activation (true) or a swap strategy- Returns:
- A modified element
- See Also:
-
hxEncoding
Submits a file uploaded via a form to the server- 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
Submits a file uploaded via a form to the server. Sets the the type to "multipart/form-data"- Returns:
- A modified element
- See Also:
-
hxOn
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- Parameters:
event- Event which triggers the requests- Returns:
- A modified element
- See Also:
-
hxPost
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- Parameters:
path- Server endpoint to make the request to- Returns:
- A modified element
- See Also:
-
hxGet
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- Parameters:
path- Server endpoint to make the request to- Returns:
- A modified element
- See Also:
-
hxBoost
The hxBoost attribute allows you to “boost” normal anchors and form tags to use AJAX instead.- Parameters:
activate- The boolean value used to enable or disable the boost- Returns:
- A modified element
- See Also:
-
hxConfirm
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.- Parameters:
message- Text to be used as a confirmation message- Returns:
- A modified element
- See Also:
-
hxExt
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.- Parameters:
ext- The extension to be used- Returns:
- A modified element
- See Also:
-
hxWs
The WebSockets extension enables easy, bi-directional communication with Web Sockets servers directly from HTML.- Parameters:
url- Url for the websocket server- Returns:
- A modified element
- See Also:
-
hxSend
Sends a message to the nearest websocket based on the trigger value for the element- Returns:
- A modified element
- See Also:
-
id
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.- Parameters:
id- The identifier for the element- Returns:
- A modified element
- See Also:
-
className
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().- Parameters:
names- Whitespace separated list of classes- Returns:
- A modified element
- See Also:
-
render
Converts the Any webx element into its html representation, including all its children, recursively.- Returns:
- The String representation of the element along with the children.
-