Class ChoiceBoxBinder
java.lang.Object
io.github.snoopy137.languagemanager.binding.ChoiceBoxBinder
- All Implemented Interfaces:
ControlBinder
A binder for
ChoiceBox controls containing String items.
This binder updates the text of each item in the ChoiceBox by binding
its language key to the appropriate entry in the resource bundle.
The keys are expected to follow the format: key.0, key.1,
etc., based on the item's index in the list.
Example:
For a ChoiceBox<String> field named genderBox with 2 items,
the expected keys in the resource bundle are
genderBox.0, genderBox.1, etc.
This binder only works if all items are String instances.
- Since:
- 1.1.0
- Author:
- alan
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ChoiceBoxBinder
public ChoiceBoxBinder()
-
-
Method Details
-
supports
Checks if the given control is aChoiceBox<String>.- Specified by:
supportsin interfaceControlBinder- Parameters:
control- the UI control to check- Returns:
trueif the control is aChoiceBox<String>,falseotherwise
-
bind
Binds each item in theChoiceBoxto a corresponding language key in the resource bundle.- Specified by:
bindin interfaceControlBinder- Parameters:
control- theChoiceBoxto bindkey- the base key used to look up each item (with index suffix)
-