Class JListWiringHarness
- All Implemented Interfaces:
WiringHarness<Bound,
Field>
Wires up a JList
to a List
in a BindableModel
. Whenever the contents of the bound List change
(and the BindableModel's update is called) the JList's model will be swapped out with a new model with the new
contents. Selection of values is maintained between model swaps.
This bindings is only one way. The JList will modify itself to reflect the contents of the List in the BindableModel. However, changes to the JList's model after that will not be reflected in the model. The idea here is that if the user takes some action to remove an item from the list then that should be accomplished by removing an item from the underlying BindableModel, not the JList.
Implementation notes: a DefaultTableModel
is used to back the JList. Maintaining selection between model
swaps is simply done with Object.equals(Object)
comparisons.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionwire
(Bound bound, BindingContext context, Field field) Performs the wiring of a specific component based on the passed binding annotation.
-
Constructor Details
-
JListWiringHarness
public JListWiringHarness()
-
-
Method Details
-
wire
public Collection<Binding> wire(Bound bound, BindingContext context, Field field) throws IllegalAccessException, IntrospectionException Description copied from interface:WiringHarness
Performs the wiring of a specific component based on the passed binding annotation.- Specified by:
wire
in interfaceWiringHarness<Bound,
Field> - Parameters:
bound
- annotation containing the data needed to wire this component to the context.context
- metadata about the context for wiring.field
- the component to be wired by this harness.- Returns:
- one or more
Binding
objects represent the wirings performed by this harness. - Throws:
IllegalAccessException
IntrospectionException
-