Class TextInputBinder

java.lang.Object
io.github.snoopy137.languagemanager.binding.TextInputBinder
All Implemented Interfaces:
ControlBinder

public class TextInputBinder extends Object implements ControlBinder
Binds the promptTextProperty of TextInputControl controls (e.g., TextField, TextArea, PasswordField) to language keys.

This binder appends ".prompt" to the provided key to locate the prompt message in the resource bundle. If the key is not found, the current prompt text is used as default.

Since:
1.1.0
Author:
alan
  • Constructor Details

    • TextInputBinder

      public TextInputBinder()
  • Method Details

    • supports

      public boolean supports(Object control)
      Returns true if the control is a TextInputControl.
      Specified by:
      supports in interface ControlBinder
      Parameters:
      control - the control to check
      Returns:
      true if the control is a TextInputControl instance, otherwise false
    • bind

      public void bind(Object control, String key)
      Binds the promptTextProperty of the TextInputControl to the language key.

      The key is modified by appending ".prompt" to fetch the appropriate entry from the language bundle. If the key is not found, the existing prompt text is retained.

      Specified by:
      bind in interface ControlBinder
      Parameters:
      control - the control to bind
      key - the language key used to retrieve localized text from the resource bundle