Class ComboBoxBinder
java.lang.Object
io.github.snoopy137.languagemanager.binding.ComboBoxBinder
- All Implemented Interfaces:
ControlBinder
Binds the items of
ComboBox
controls to language keys.
This binder checks whether a given control is an instance of ComboBox
and binds each item (assumed to be a String
) to a language key using
the given prefix and an index.
For example, a ComboBox with three items and a prefix gender
will
expect keys gender.0
, gender.1
, gender.2
.
- Since:
- 1.1.0
- Author:
- alan
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
ComboBoxBinder
public ComboBoxBinder()
-
-
Method Details
-
supports
Returnstrue
if the control is aComboBox
.- Specified by:
supports
in interfaceControlBinder
- Parameters:
control
- the control to check- Returns:
true
if the control is a ComboBox, otherwisefalse
-
bind
Binds each item in theComboBox
(assumed to be aString
) to a language key.Items will be bound using the provided prefix and an index. The original values will be replaced with the translated ones.
- Specified by:
bind
in interfaceControlBinder
- Parameters:
control
- the control to bindkey
- the language key used to retrieve localized text from the resource bundle
-