public interface ValueModelBindingBuilder
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);
| Modifier and Type | Interface and Description |
|---|---|
static class |
ValueModelBindingBuilder.Commit
Describes the commit types used for text field and text area bindings.
|
| Modifier and Type | Method and Description |
|---|---|
<E> SelectionInListBindingBuilder |
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.
|
<E> SelectionInListBindingBuilder |
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. |
<E> SelectionInListBindingBuilder |
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.
|
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 versaNullPointerException - if converter is nullValueModelBindingBuilder formatted(Format format)
Example:
binder.bindBeanProperty("count").formatted(percentFormat).to(percentField);
format - implements the String conversion via #format and #parseNullPointerException - 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 SelectionInListNullPointerException - 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 SelectionInListNullPointerException - 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 SelectionInListNullPointerException - if listModel is nullvoid to(AbstractButton toggleButton)
Example:
binder.bindBeanProperty("classical").to(classicalBox);
toggleButton - the button to be bound to this builder's ValueModelNullPointerException - if checkBox is nullBindings.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 selectedNullPointerException - if checkBox is nullBindings.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 selectedNullPointerException - if radioButton is nullBindings.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 ValueModelNullPointerException - if formattedTextField is nullBindings.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 ValueModelNullPointerException - if label is nullBindings.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 ValueModelNullPointerException - if textArea is nullBindings.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_LOSTNullPointerException - if textArea
or commitType is nullBindings.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 ValueModelNullPointerException - if textField is nullBindings.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_LOSTNullPointerException - if textField or commitType
is nullBindings.bind(JTextField, com.jgoodies.binding.value.ValueModel)Copyright © 2002-2015 JGoodies Software GmbH. All Rights Reserved.