Package org.jdesktop.beansbinding
Class BindingGroup
- java.lang.Object
-
- org.jdesktop.beansbinding.BindingGroup
-
public class BindingGroup extends Object
BindingGroupallows you to create a group ofBindingsand operate on and/or track state changes to theBindingsas a group.- Author:
- Shannon Hickey
-
-
Constructor Summary
Constructors Constructor Description BindingGroup()Creates an emptyBindingGroup.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddBinding(Binding binding)Adds aBindingto this group.voidaddBindingListener(BindingListener listener)Adds aBindingListenerto be notified of allBindingListenernotifications fired by anyBindingin the group.voidbind()Callsbindon all unbound bindings in the group.BindinggetBinding(String name)Returns theBindingin this group with the given name, ornullif this group doesn't contain aBindingwith the given name.BindingListener[]getBindingListeners()Returns the list ofBindingListenersregistered on this group.List<Binding>getBindings()Returns a list of allBindingsin this group.voidremoveBinding(Binding binding)Removes aBindingfrom this group.voidremoveBindingListener(BindingListener listener)Removes aBindingListenerfrom the group.voidunbind()Callsunbindon all bound bindings in the group.
-
-
-
Method Detail
-
addBinding
public final void addBinding(Binding binding)
Adds aBindingto this group.- Parameters:
binding- theBindingto add- Throws:
IllegalArgumentException- if the binding is null, is a managed binding, if the group already contains this binding, or if the group already contains a binding with the same (non-null) name
-
removeBinding
public final void removeBinding(Binding binding)
Removes aBindingfrom this group.- Parameters:
binding- theBindingto remove- Throws:
IllegalArgumentException- if the binding is null or if the group doesn't contain this binding
-
getBinding
public final Binding getBinding(String name)
Returns theBindingin this group with the given name, ornullif this group doesn't contain aBindingwith the given name.- Parameters:
name- the name of theBindingto fetch- Returns:
- the
Bindingin this group with the given name, ornull - Throws:
IllegalArgumentException- ifnameisnull
-
getBindings
public final List<Binding> getBindings()
Returns a list of allBindingsin this group. Order is undefined. Returns an empty list if the group contains noBindings.- Returns:
- a list of all
Bindingsin this group.
-
bind
public void bind()
Callsbindon all unbound bindings in the group.
-
unbind
public void unbind()
Callsunbindon all bound bindings in the group.
-
addBindingListener
public final void addBindingListener(BindingListener listener)
Adds aBindingListenerto be notified of allBindingListenernotifications fired by anyBindingin the group. Does nothing if the listener isnull. If a listener is added more than once, notifications are sent to that listener once for every time that it has been added. The ordering of listener notification is unspecified.- Parameters:
listener- the listener to add
-
removeBindingListener
public final void removeBindingListener(BindingListener listener)
Removes aBindingListenerfrom the group. Does nothing if the listener isnullor is not one of those registered. If the listener being removed was registered more than once, only one occurrence of the listener is removed from the list of listeners. The ordering of listener notification is unspecified.- Parameters:
listener- the listener to remove- See Also:
addBindingListener(org.jdesktop.beansbinding.BindingListener)
-
getBindingListeners
public final BindingListener[] getBindingListeners()
Returns the list ofBindingListenersregistered on this group. Order is undefined. Returns an empty array if there are no listeners.- Returns:
- the list of
BindingListenersregistered on this group - See Also:
addBindingListener(org.jdesktop.beansbinding.BindingListener)
-
-