C
- type of the exported componentpublic final class WebComponentBinding<C extends Component> extends Object implements Serializable
Component
instance and property
value hosts tied to the specific web component instance. Facilitates property
updates from the client to the component
.to create
{@code WebComponentBindings}
,
Serialized FormConstructor and Description |
---|
WebComponentBinding(C component)
Constructs a new
WebComponentBinding . |
Modifier and Type | Method and Description |
---|---|
void |
bindProperty(PropertyConfigurationImpl<C,? extends Serializable> propertyConfiguration,
boolean overrideDefault,
elemental.json.JsonValue startingValue)
Adds a property to
this web component binding based on the propertyConfiguration . |
C |
getComponent()
Retrieves the bound
Component instance. |
Class<? extends Serializable> |
getPropertyType(String propertyName)
Retrieve the type of a property's value.
|
boolean |
hasProperty(String propertyName)
Does the component binding have a property identified by given name.
|
void |
updatePropertiesToComponent()
Calls the bound change handlers defined via
PropertyConfiguration.onChange(SerializableBiConsumer)
for each bound property with the current value of the property. |
void |
updateProperty(String propertyName,
elemental.json.JsonValue jsonValue)
Updates a property bound to the
component . |
void |
updateProperty(String propertyName,
Serializable value)
Updates a property bound to the
component . |
public WebComponentBinding(C component)
WebComponentBinding
. The bound Component
is given via component
parameter. The web component properties
are bound by calling
bindProperty(PropertyConfigurationImpl, boolean, elemental.json.JsonValue)
;component
- component which exposes properties
as web component.
Not null
NullPointerException
- if component
is null
public void updateProperty(String propertyName, Serializable value)
component
. If the property has an
attached listener, the value
is also delivered to the listener.
If the value
is null
, the property is set to its default
value (which could be null
).propertyName
- name of the property, not null
value
- new value to set for the propertyNullPointerException
- if propertyName
is null
IllegalArgumentException
- if no bound property can be found for propertyName
public void updateProperty(String propertyName, elemental.json.JsonValue jsonValue)
component
. Converts the jsonValue
into the correct type if able and then calls
updateProperty(String, java.io.Serializable)
.propertyName
- name of the property, not null
jsonValue
- new value to set for the propertyNullPointerException
- if propertyName
is null
IllegalArgumentException
- if no bound property can be found for propertyName
IllegalArgumentException
- if the jsonValue
cannot be converted to the type of
the property identified by propertyName
.public C getComponent()
Component
instance.component
instancepublic Class<? extends Serializable> getPropertyType(String propertyName)
propertyName
- name of the propertypublic boolean hasProperty(String propertyName)
propertyName
- name of the propertypublic void updatePropertiesToComponent()
PropertyConfiguration.onChange(SerializableBiConsumer)
for each bound property with the current value of the property.public void bindProperty(PropertyConfigurationImpl<C,? extends Serializable> propertyConfiguration, boolean overrideDefault, elemental.json.JsonValue startingValue)
this
web component binding based on the propertyConfiguration
. If a property with an existing name is bound, the
previous binding is removed.propertyConfiguration
- property configuration, not null
overrideDefault
- set to true
if the property should be initialized with
startingValue
instead of default value found in
PropertyData
startingValue
- starting value for the property. Can be null
.
overrideDefault
must be true
for this value to
have any effectNullPointerException
- if propertyConfiguration
is null
Copyright © 2021. All rights reserved.