|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ValueModelBindingBuilder
Describes a binding builder that holds a ValueModel that can be bound to a variety of components. It also describes methods that operate on the ValueModel (conversion) or create a SelectionInListBuilder that in turn can be bound to combo boxes, lists, and tables. Examples:
binder.bindBeanProperty("classical").to(classicalBox); binder.bindBeanProperty("title") .to(titleField); binder.bind(resultCountValueModel) .converted(aTableHeaderFormat).to(tableHeaderLabel); binder.bindBeanProperty("country") .asSelectionIn(COUNTRY_LIST) .to(countryCombo);
Nested Class Summary | |
---|---|
static class |
ValueModelBindingBuilder.Commit
Describes the commit types used for text field and text area bindings. |
Method Summary | ||
---|---|---|
|
asSelectionIn(E[] array)
Creates and returns a SelectionInListBindingBuilder on a SelectionInList with this builder's ValueModel as selection holder and the given array as list. |
|
|
asSelectionIn(List<E> list)
Creates and returns a SelectionInListBindingBuilder on a SelectionInList with this builder's ValueModel as selection holder and the given list as list elements. |
|
|
asSelectionIn(ListModel listModel)
Creates and returns a SelectionInListBindingBuilder on a SelectionInList with this builder's ValueModel as selection holder and the given ListModel as list data provider. |
|
ValueModelBindingBuilder |
converted(BindingConverter converter)
Wraps this builder's ValueModel with a converting ValueModel and creates and returns another ValueModelBindingBuilder with the wrapped ValueModel. |
|
ValueModelBindingBuilder |
formatted(Format format)
Wraps this builder's ValueModel with a string converter and creates and returns another ValueModelBindingBuilder with the wrapped ValueModel. |
|
void |
to(AbstractButton toggleButton)
Binds this builder's ValueModel to the given toggle button, for example a check box. |
|
void |
to(AbstractButton toggleButton,
Object choice)
Binds this builder's ValueModel to the given toggle button (radio button style) that is selected, if and only if the model's value equals the given choice . |
|
void |
to(AbstractButton toggleButton,
Object selectedValue,
Object deselectedValue)
Binds this builder's ValueModel to the given toggle button, for example a check box. |
|
void |
to(JFormattedTextField formattedTextField)
Binds this builder's ValueModel to the given formatted text field. |
|
void |
to(JLabel label)
Binds this builder's ValueModel to the given text label. |
|
void |
to(JTextArea textArea)
Binds this builder's ValueModel to the given text area and commits text changes on focus lost. |
|
void |
to(JTextArea textArea,
ValueModelBindingBuilder.Commit commitType)
Binds this builder's ValueModel to the given text area using the specified commit type. |
|
void |
to(JTextField textField)
Binds this builder's ValueModel to the given text field and commits text changes on focus lost. |
|
void |
to(JTextField textField,
ValueModelBindingBuilder.Commit commitType)
Binds this builder's ValueModel to the given text field using the specified commit type. |
Method Detail |
---|
ValueModelBindingBuilder converted(BindingConverter converter)
Example:
binder.bindBeanProperty("price").converted(currencyConverter).to(priceField);
The ConverterFactory
provides a bunch of prepared converters.
When binding non-String values to a text UI component, consider
using a JFormattedTextField
. Formatted text fields
provide a powerful means to convert strings to objects and handle
many cases that arise around invalid input.
converter
- converts values from the source to the target
and vice versa
NullPointerException
- if converter
is null
ValueModelBindingBuilder formatted(Format format)
Example:
binder.bindBeanProperty("count").formatted(percentFormat).to(percentField);
format
- implements the String conversion via #format and #parse
NullPointerException
- if format
is null
<E> SelectionInListBindingBuilder asSelectionIn(E[] array)
Example:
binder.bindBeanProperty("country").asSelectionIn(COUNTRIES).to(countryCombo);
E
- the type of the list elementsarray
- the list data for the SelectionInList
NullPointerException
- if array
is null
<E> SelectionInListBindingBuilder asSelectionIn(List<E> list)
list
as list elements.
Example:
binder.bindBeanProperty("country").asSelectionIn(COUNTRIES).to(countryCombo);
E
- the type of the list elementslist
- the list data for the SelectionInList
NullPointerException
- if list
is null
<E> SelectionInListBindingBuilder asSelectionIn(ListModel listModel)
Example:
binder.bindBeanProperty("country").asSelectionIn(COUNTRIES).to(countryCombo);
E
- the type of the list elementslistModel
- the list data for the SelectionInList
NullPointerException
- if listModel
is null
void to(AbstractButton toggleButton)
Example:
binder.bindBeanProperty("classical").to(classicalBox);
toggleButton
- the button to be bound to this builder's ValueModel
NullPointerException
- if checkBox
is null
Bindings.bind(AbstractButton, com.jgoodies.binding.value.ValueModel)
void to(AbstractButton toggleButton, Object selectedValue, Object deselectedValue)
Example:
binder.bindBeanProperty("classical").to(classicalBox, CLASSICAL, PLAIN);
toggleButton
- the button to be bound to this builder's ValueModelselectedValue
- the model's value if the button is selecteddeselectedValue
- the model's value if the button is not selected
NullPointerException
- if checkBox
is null
Bindings.bind(AbstractButton, com.jgoodies.binding.value.ValueModel)
void to(AbstractButton toggleButton, Object choice)
choice
.
Example:
binder.bindBeanProperty("alignment").to(alignmentButton, Alignment.LEFT);
toggleButton
- the button to be bound to this builder's ValueModelchoice
- the model value where radioButton
shall be selected
NullPointerException
- if radioButton
is null
Bindings.bind(AbstractButton, com.jgoodies.binding.value.ValueModel, Object)
void to(JFormattedTextField formattedTextField)
Example:
binder.bindBeanProperty("releaseDate").to(dateField);
formattedTextField
- the formatted text field to be bound to this builder's ValueModel
NullPointerException
- if formattedTextField
is null
Bindings.bind(JFormattedTextField, com.jgoodies.binding.value.ValueModel)
void to(JLabel label)
Example:
binder.binProperty("resultCount").converted(resultFormat).to(tableHeaderLabel);
label
- the label to be bound to this builder's ValueModel
NullPointerException
- if label
is null
Bindings.bind(JLabel, com.jgoodies.binding.value.ValueModel)
void to(JTextArea textArea)
Example:
binder.bindBeanProperty("comment").to(commentArea);
textArea
- the text area to be bound to this builder's ValueModel
NullPointerException
- if textArea
is null
Bindings.bind(JTextArea, com.jgoodies.binding.value.ValueModel)
void to(JTextArea textArea, ValueModelBindingBuilder.Commit commitType)
Examples:
binder.bindBeanProperty("comment").to(commentArea, Commit.ON_KEY_TYPED);
binder.bindBeanProperty("comment").to(commentArea, Commit.ON_FOCUS_LOST);
textArea
- the text area to be bound to this builder's ValueModelcommitType
- the commit type to be used,
either Commit.ON_KEY_TYPED
or Commit.ON_FOCUS_LOST
NullPointerException
- if textArea
or commitType
is null
Bindings.bind(JTextArea, com.jgoodies.binding.value.ValueModel)
void to(JTextField textField)
Example:
binder.bindBeanProperty("title").to(titleField);
textField
- the text field to be bound to this builder's ValueModel
NullPointerException
- if textField
is null
Bindings.bind(JTextField, com.jgoodies.binding.value.ValueModel)
void to(JTextField textField, ValueModelBindingBuilder.Commit commitType)
Examples:
binder.bindBeanProperty("title").to(titleField, Commit.ON_KEY_TYPED);
binder.bindBeanProperty("title").to(titleField, Commit.ON_FOCUS_LOST);
textField
- the text field to be bound to this builder's ValueModelcommitType
- the commit type to be used,
either Commit.ON_KEY_TYPED
or Commit.ON_FOCUS_LOST
NullPointerException
- if textField
or commitType
is null
Bindings.bind(JTextField, com.jgoodies.binding.value.ValueModel)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |