com.jgoodies.binding.binder
Class SelectionInListBindingBuilderImpl

java.lang.Object
  extended by com.jgoodies.binding.binder.SelectionInListBindingBuilderImpl
All Implemented Interfaces:
SelectionInListBindingBuilder

public class SelectionInListBindingBuilderImpl
extends Object
implements SelectionInListBindingBuilder

A binding builder that holds a SelectionInList that can be bound to combo boxes, lists, and tables.

Examples:

 binder.bind(countrySelectionInList).to(countryCombo);
 binder.bind(countrySelectionInList).to(countryFilterCombo, "(None)");
 binder.bind(contactSelectionInList).to(contactList);
 binder.bind(contactSelectionInList).to(contactTable);
 

Since:
2.3
Version:
$Revision: 1.2 $
Author:
Karsten Lentzsch

Constructor Summary
SelectionInListBindingBuilderImpl(SelectionInList<?> selectionInList)
          Creates a SelectionInListBindingBuilderImpl for the given selection in list.
SelectionInListBindingBuilderImpl(SelectionInList<?> selectionInList, String propertyName)
          Creates a SelectionInListBindingBuilderImpl for the given selection in list.
 
Method Summary
protected  String getPropertyName()
           
protected  SelectionInList getSelectionInList()
           
protected  void setValidationMessageKey(JComponent comp)
          Sets this builder's property name - if any - as the component's validation message key.
 void to(JComboBox comboBox)
          Binds this builder's SelectionInList to the given combo box.
 void to(JComboBox comboBox, String nullText)
          Binds this builder's SelectionInList to the given combo box where null values are mapped to a special null element that is displayed using the given nullElementText.
 void to(JList list)
          Binds this builder's SelectionInList to the given list.
 void to(JTable table)
          Binds this builder's SelectionInList to the given table.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionInListBindingBuilderImpl

public SelectionInListBindingBuilderImpl(SelectionInList<?> selectionInList)
Creates a SelectionInListBindingBuilderImpl for the given selection in list.

Parameters:
selectionInList - provides both the data and the selection
Throws:
NullPointerException - if selectionInList is null

SelectionInListBindingBuilderImpl

public SelectionInListBindingBuilderImpl(SelectionInList<?> selectionInList,
                                         String propertyName)
Creates a SelectionInListBindingBuilderImpl for the given selection in list.

Parameters:
selectionInList - provides both the data and the selection
propertyName - an optional bean property name that has been used to create selectionInList. Used to set a validation message key for combo boxes.
Throws:
NullPointerException - if selectionInList is null
IllegalArgumentException - if propertyName is empty or whitespace
Method Detail

to

public void to(JComboBox comboBox)
Description copied from interface: SelectionInListBindingBuilder
Binds this builder's SelectionInList to the given combo box.

Example:
binder.bind(countrySelectionInList).to(countryCombo);

Specified by:
to in interface SelectionInListBindingBuilder
Parameters:
comboBox - the combo box where the SelectionInList is set as both data and selection model.

to

public void to(JComboBox comboBox,
               String nullText)
Description copied from interface: SelectionInListBindingBuilder
Binds this builder's SelectionInList to the given combo box where null values are mapped to a special null element that is displayed using the given nullElementText.

Note that the Microsoft User Experience Guide (UX Guide) recommends to enclose meta-options in parentheses, e.g. "(None)".

Example:
binder.bind(countrySelectionInList).to(countryCombo, "(None)");

Specified by:
to in interface SelectionInListBindingBuilder
Parameters:
comboBox - the combo box where the SelectionInList is set as both data and selection model.
nullText - the text that represents the null value in the combo box

to

public void to(JList list)
Description copied from interface: SelectionInListBindingBuilder
Binds this builder's SelectionInList to the given list.

Example:
binder.bind(contactSelectionInList).to(contactList);

Specified by:
to in interface SelectionInListBindingBuilder
Parameters:
list - the list where the SelectionInList is set as both data and selection model.

to

public void to(JTable table)
Description copied from interface: SelectionInListBindingBuilder
Binds this builder's SelectionInList to the given table.

Example:
binder.bind(contactSelectionInList).to(contactTable);

Specified by:
to in interface SelectionInListBindingBuilder
Parameters:
table - the table where the SelectionInList is set as both data and selection model.

getSelectionInList

protected final SelectionInList getSelectionInList()
Returns:
this builder's SelectionInList

getPropertyName

protected final String getPropertyName()
Returns:
the property name - if any - that has been used to create this builder, e.g. in binder.bindBeanProperty("title").to(...)

setValidationMessageKey

protected final void setValidationMessageKey(JComponent comp)
Sets this builder's property name - if any - as the component's validation message key.

Parameters:
comp - the component where the validation message key shall be set


Copyright © 2002-2013 JGoodies Software GmbH. All Rights Reserved.