C - type of the component exported as web componentpublic final class WebComponent<C extends Component> extends Object implements Serializable
Component is added. Allows updating web component properties and
firing custom events on the client-side.| Constructor and Description |
|---|
WebComponent(WebComponentBinding binding,
Element componentHost)
Constructs a
WebComponent. |
| Modifier and Type | Method and Description |
|---|---|
void |
fireEvent(String eventName)
Fires a custom event on the client-side originating from the web
component.
|
void |
fireEvent(String eventName,
elemental.json.JsonValue objectData)
Fires a custom event on the client-side originating from the web
component with custom event data.
|
void |
fireEvent(String eventName,
elemental.json.JsonValue objectData,
EventOptions options)
Fires a custom event on the client-side originating from the web
component with custom event data.
|
<P extends Serializable> |
setProperty(PropertyConfiguration<C,P> propertyConfiguration,
P value)
Sets property value on the client-side to the given
value. |
public WebComponent(WebComponentBinding binding, Element componentHost)
WebComponent. WebComponentBinding provides
the instance of the Component exported as a web component. Binding also defines the properties the web component has.
Element is the host element which contains the exported component instance (provided by the binding).binding - binds web component configuration to component XcomponentHost - host component X on the embedding pagefor the
web component hostpublic void fireEvent(String eventName)
eventName - name of the event, not nullfor full set of optionspublic void fireEvent(String eventName, elemental.json.JsonValue objectData)
eventName - name of the event, not nullobjectData - data the event should carry. This data is placed as the detail property of the event, nullablefor full set of optionspublic void fireEvent(String eventName, elemental.json.JsonValue objectData, EventOptions options)
EventOptions.eventName - name of the event, not nullobjectData - data the event should carry. This data is placed as the detail property of the event, nullableoptions - event options for bubbles, cancelable, and
composed flags, not nullNullPointerException - if either eventName or options is
nullpublic <P extends Serializable> void setProperty(PropertyConfiguration<C,P> propertyConfiguration, P value)
value. The
required PropertyConfigurationImpl is received from
WebComponentExporter when a new
property is added for the web component.P - type of the property value being set. If the type does not
match the original property type, throws an exceptionpropertyConfiguration - identifies the property for which the value is being set, not
nullvalue - new value for the property, can be nullNullPointerException - if propertyConfiguration is nullIllegalArgumentException - if PropertyConfiguration is not a correct
implementationIllegalArgumentException - if the web component does not have a property identified by
propertyConfigurationIllegalArgumentException - the provided value is not of the type expected by the
propertyCopyright © 2025. All rights reserved.