T
- The type of the target model being proxied.public final class BindableProxyAgent<T> extends Object implements HasPropertyChangeHandlers
BindableProxy
to keep the target model and bound
widgets in sync.
An agent will:
DataBinder.DataBinder(Object, InitialState)
)updateWidgetsAndFireEvent(String, Object, Object)
). Works for widgets that either
implement HasValue
or HasText
)updateWidgetsAndFireEvents()
. Works for widgets
that either implement HasValue
or HasText
)HasValue
)Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeHandler(PropertyChangeHandler handler)
Adds a
PropertyChangeHandler that will be notified when any property of the underlying
object changes. |
<P> void |
addPropertyChangeHandler(String property,
PropertyChangeHandler<P> handler)
Adds a
PropertyChangeHandler that will be notified when the given property of the
underlying object changes. |
Binding |
bind(com.google.gwt.user.client.ui.Widget widget,
String property,
Converter converter)
Binds the provided widget to the specified property (or property chain) of the model instance
associated with this proxy (see
DataBinder.setModel(Object, InitialState) ). |
void |
fireChangeEvents(BindableProxyAgent other)
Compares property values between this agent and the provided agent recursively and fires
PropertyChangeEvent s for all differences. |
InitialState |
getInitialState()
Returns the
InitialState configured when the proxy was created. |
PropertyChangeHandlerSupport |
getPropertyChangeHandlers()
Returns the
PropertyChangeHandlerSupport object of this agent containing all change
handlers that have been registered for the corresponding model proxy. |
void |
mergePropertyChangeHandlers(PropertyChangeHandlerSupport pchs)
Merges the provided
PropertyChangeHandler s of the provided agent instance. |
void |
removePropertyChangeHandler(PropertyChangeHandler handler)
Removes a
PropertyChangeHandler , previously registered by a call to
HasPropertyChangeHandlers.addPropertyChangeHandler(PropertyChangeHandler) . |
void |
removePropertyChangeHandler(String property,
PropertyChangeHandler handler)
Removes a
PropertyChangeHandler , previously registered by a call to
HasPropertyChangeHandlers.addPropertyChangeHandler(String, PropertyChangeHandler) for the same property name. |
void |
setInitialState(InitialState initialState)
Configures the
InitialState . |
void |
unbind(Binding binding)
Unbinds the property with the given name.
|
public Binding bind(com.google.gwt.user.client.ui.Widget widget, String property, Converter converter)
DataBinder.setModel(Object, InitialState)
).widget
- the widget to bind to, must not be null.property
- the property of the model to bind the widget to, must not be null.converter
- the converter to use for this binding, null if default conversion should be used.public void unbind(Binding binding)
property
- the name of the model property to unbind, must not be null.public InitialState getInitialState()
InitialState
configured when the proxy was created.public void setInitialState(InitialState initialState)
InitialState
.public PropertyChangeHandlerSupport getPropertyChangeHandlers()
PropertyChangeHandlerSupport
object of this agent containing all change
handlers that have been registered for the corresponding model proxy.public void addPropertyChangeHandler(PropertyChangeHandler handler)
HasPropertyChangeHandlers
PropertyChangeHandler
that will be notified when any property of the underlying
object changes. Multiple handlers can be registered. If the same handler instance is passed
multiple times, it will be notified multiple times.addPropertyChangeHandler
in interface HasPropertyChangeHandlers
handler
- The PropertyChangeHandler
instance, must not be null.public <P> void addPropertyChangeHandler(String property, PropertyChangeHandler<P> handler)
HasPropertyChangeHandlers
PropertyChangeHandler
that will be notified when the given property of the
underlying object changes. Multiple handlers can be registered. If the same handler instance is
passed multiple times, it will be notified multiple times.addPropertyChangeHandler
in interface HasPropertyChangeHandlers
property
- The name of the property or a property chain (e.g. customer.address.street) to receive
events for. A property expression can end in a wildcard to indicate that changes of
any property of the corresponding bean should be observed (e.g customer.address.*). A
double wildcard can be used at the end of a property expression to register a
cascading change handler for any nested property (e.g customer.**). Must not be null.handler
- The PropertyChangeHandler
instance that should receive the events. Must not be
null.public void removePropertyChangeHandler(PropertyChangeHandler handler)
HasPropertyChangeHandlers
PropertyChangeHandler
, previously registered by a call to
HasPropertyChangeHandlers.addPropertyChangeHandler(PropertyChangeHandler)
. If the handler was added more than
once to the same event source, it will be notified one less time after being removed. If the
provided handler is null, or was never added, no exception is thrown and no action is taken.removePropertyChangeHandler
in interface HasPropertyChangeHandlers
handler
- the PropertyChangeHandler
instancepublic void removePropertyChangeHandler(String property, PropertyChangeHandler handler)
HasPropertyChangeHandlers
PropertyChangeHandler
, previously registered by a call to
HasPropertyChangeHandlers.addPropertyChangeHandler(String, PropertyChangeHandler)
for the same property name. If
the handler was added more than once to the same event source and property name, it will be
notified one less time after being removed. If the provided handler is null, or was never added
for the given property, no exception is thrown and no action is taken.removePropertyChangeHandler
in interface HasPropertyChangeHandlers
property
- The name of the property or a property chain expression (e.g.
customer.address.street). Must not be null.handler
- the PropertyChangeHandler
instancepublic void mergePropertyChangeHandlers(PropertyChangeHandlerSupport pchs)
PropertyChangeHandler
s of the provided agent instance. If a handler
instance is already registered on this agent, it will NOT be added again.pchs
- the instance who's change handlers will be merged, must not be null.public void fireChangeEvents(BindableProxyAgent other)
PropertyChangeEvent
s for all differences.other
- the agent to compare against.Copyright © 2013-2015 JBoss, a division of Red Hat. All Rights Reserved.