Class FxTextComponentDelegate

All Implemented Interfaces:
Function<javafx.scene.control.TextFormatter.Change,javafx.scene.control.TextFormatter.Change>, UnaryOperator<javafx.scene.control.TextFormatter.Change>, ErrorPopupSupported, FxComponent, FxControl, FxTextComponent, InfoPopupSupported
Direct Known Subclasses:
AbstractTextFieldDelegate, FxComboBoxDelegate, FxDatePickerDelegate, FxHTMLEditorDelegate

public abstract class FxTextComponentDelegate extends FxComponentDelegate implements FxTextComponent, UnaryOperator<javafx.scene.control.TextFormatter.Change>
Delegate implementing FxComponent.
Author:
harald
  • Constructor Details

    • FxTextComponentDelegate

      public FxTextComponentDelegate()
      Creates a text component delegate.
  • Method Details

    • getTextComponent

      protected FxTextComponent getTextComponent()
      Gets the text component.
      Returns:
      the text component
    • updateChangeable

      protected void updateChangeable(boolean changeable)
      Description copied from class: FxControlDelegate
      Updates other properties if changeable is bound to something else.
      Overrides:
      updateChangeable in class FxComponentDelegate
      Parameters:
      changeable - the flag
    • updateMandatoryStyle

      protected void updateMandatoryStyle(boolean mandatory)
      Description copied from class: FxComponentDelegate
      Does the physical update of the style. See resources/org/tentackle/fx/tentackle.css
      Overrides:
      updateMandatoryStyle in class FxComponentDelegate
      Parameters:
      mandatory - true if mandatory
    • createChangeableProperty

      protected javafx.beans.property.ReadOnlyBooleanWrapper createChangeableProperty(boolean changeable)
      Description copied from class: FxControlDelegate
      Creates the changeable property.
      Overrides:
      createChangeableProperty in class FxComponentDelegate
      Parameters:
      changeable - the initial value
      Returns:
      the property
    • setContainerChangeable

      public void setContainerChangeable(boolean containerChangeable)
      Description copied from interface: FxControl
      Invoked when setChangeable() is invoked on the container of this component.
      Specified by:
      setContainerChangeable in interface FxControl
      Overrides:
      setContainerChangeable in class FxComponentDelegate
      Parameters:
      containerChangeable - true if container is changeable, false if all components readonly
    • getErrorOffset

      public Integer getErrorOffset()
      Description copied from interface: FxTextComponent
      Gets the error offset.
      Specified by:
      getErrorOffset in interface FxTextComponent
      Returns:
      the offset, null if no offset
    • setErrorOffset

      public void setErrorOffset(Integer errorOffset)
      Description copied from interface: FxTextComponent
      Sets the error offset.
      Specified by:
      setErrorOffset in interface FxTextComponent
      Parameters:
      errorOffset - null to clear
    • setError

      public void setError(String errorMessage)
      Description copied from interface: ErrorPopupSupported
      Sets the error message.
      Notice that an empty string will set the style but does not show any popup.
      Specified by:
      setError in interface ErrorPopupSupported
      Overrides:
      setError in class FxComponentDelegate
      Parameters:
      errorMessage - the error message, null to clear
    • showErrorPopup

      public void showErrorPopup()
      Description copied from interface: ErrorPopupSupported
      Shows the error popup.
      Requires the error message set.
      Specified by:
      showErrorPopup in interface ErrorPopupSupported
      Overrides:
      showErrorPopup in class FxComponentDelegate
    • triggerViewModified

      public void triggerViewModified()
      Description copied from interface: FxControl
      Walks up the component hierarchy and updates the viewModified property.
      This is done by comparing the saved view value with the current view.
      Specified by:
      triggerViewModified in interface FxControl
      Overrides:
      triggerViewModified in class FxComponentDelegate
    • updateView

      public void updateView()
      Description copied from interface: FxControl
      Updates the view according to the model.
      Specified by:
      updateView in interface FxControl
      Overrides:
      updateView in class FxComponentDelegate
    • updateModel

      public void updateModel()
      Description copied from interface: FxControl
      Updates the model according to the view.
      Specified by:
      updateModel in interface FxControl
      Overrides:
      updateModel in class FxComponentDelegate
    • saveView

      public void saveView()
      Description copied from interface: FxControl
      Creates a copy of the value shown to the user.
      Specified by:
      saveView in interface FxControl
      Overrides:
      saveView in class FxComponentDelegate
    • setValidChars

      public void setValidChars(String validChars)
      Description copied from interface: FxTextComponent
      Sets allowed characters.
      Specified by:
      setValidChars in interface FxTextComponent
      Parameters:
      validChars - the valid characters, null = all (default)
    • getValidChars

      public String getValidChars()
      Description copied from interface: FxTextComponent
      Gets allowed characters.
      Specified by:
      getValidChars in interface FxTextComponent
      Returns:
      the valid characters, null = all (default)
    • setInvalidChars

      public void setInvalidChars(String invalidChars)
      Description copied from interface: FxTextComponent
      Sets invalid characters.
      Specified by:
      setInvalidChars in interface FxTextComponent
      Parameters:
      invalidChars - the invalid characters, null = none (default)
    • getInvalidChars

      public String getInvalidChars()
      Description copied from interface: FxTextComponent
      Gets invalid characters.
      Specified by:
      getInvalidChars in interface FxTextComponent
      Returns:
      the invalid characters, null = none (default)
    • setTextConverter

      public void setTextConverter(Function<String,String> textConverter)
      Description copied from interface: FxTextComponent
      Sets a text converter.
      Converts input text to the view's text.
      Specified by:
      setTextConverter in interface FxTextComponent
      Parameters:
      textConverter - the converter
    • getTextConverter

      public Function<String,String> getTextConverter()
      Description copied from interface: FxTextComponent
      Gets the text converter.
      Specified by:
      getTextConverter in interface FxTextComponent
      Returns:
      the converter
    • apply

      public javafx.scene.control.TextFormatter.Change apply(javafx.scene.control.TextFormatter.Change t)
      Specified by:
      apply in interface Function<javafx.scene.control.TextFormatter.Change,javafx.scene.control.TextFormatter.Change>
    • filter

      public String filter(String text)
      Filters input characters.
      Parameters:
      text - the input text, never null
      Returns:
      the filtered text, never null
    • setTextAlignment

      public void setTextAlignment(javafx.geometry.Pos textAlignment)
      Description copied from interface: FxTextComponent
      Sets the text alignment.
      Specified by:
      setTextAlignment in interface FxTextComponent
      Parameters:
      textAlignment - the alignment, null if component's default
    • getTextAlignment

      public javafx.geometry.Pos getTextAlignment()
      Description copied from interface: FxTextComponent
      Gets the text alignment.
      Specified by:
      getTextAlignment in interface FxTextComponent
      Returns:
      the alignment, null if component's default
    • setType

      public void setType(Class<?> type)
      Description copied from interface: FxComponent
      Sets the type for this component.

      Notice that the type can be applied only once. This is because previously installed listeners could cause memory leaks.

      Specified by:
      setType in interface FxComponent
      Overrides:
      setType in class FxComponentDelegate
      Parameters:
      type - the type
    • createValueTranslator

      protected ValueTranslator<?,?> createValueTranslator(Class<?> type)
    • setMaxColumns

      public void setMaxColumns(int maxColumns)
      Description copied from interface: FxTextComponent
      Sets the maximum number of columns.
      The number of columns will be enforced by the model.
      Specified by:
      setMaxColumns in interface FxTextComponent
      Parameters:
      maxColumns - the maximum number of columns, 0 if unlimited (default)
    • getMaxColumns

      public int getMaxColumns()
      Description copied from interface: FxTextComponent
      Gets the maximum number of columns.
      Specified by:
      getMaxColumns in interface FxTextComponent
      Returns:
      the maximum number of columns, 0 if unlimited (default)
    • setAutoSelect

      public void setAutoSelect(boolean autoSelect)
      Description copied from interface: FxTextComponent
      Sets the auto-select feature.
      A component with autoselect enabled will automatically select all characters if the component gets the keyboard focus. Useful for numerical fields, for example.
      Specified by:
      setAutoSelect in interface FxTextComponent
      Parameters:
      autoSelect - true if autoselect enabled, false if disabled (default)
    • isAutoSelect

      public boolean isAutoSelect()
      Description copied from interface: FxTextComponent
      Returns whether the auto-select feature is enabled.
      Specified by:
      isAutoSelect in interface FxTextComponent
      Returns:
      true if autoselect enabled, false if disabled (default)
    • setPattern

      public void setPattern(String pattern)
      Description copied from interface: FxTextComponent
      Sets the format pattern.
      The format pattern is used to format the view of the data.
      Specified by:
      setPattern in interface FxTextComponent
      Parameters:
      pattern - the format pattern
    • getPattern

      public String getPattern()
      Description copied from interface: FxTextComponent
      Gets the format pattern.
      Specified by:
      getPattern in interface FxTextComponent
      Returns:
      the format pattern
    • isLenient

      public boolean isLenient()
      Description copied from interface: FxTextComponent
      Returns whether parsing to model should be lenient.
      Specified by:
      isLenient in interface FxTextComponent
      Returns:
      true if lenient, false is default
    • setLenient

      public void setLenient(boolean lenient)
      Description copied from interface: FxTextComponent
      Sets whether parsing to model should be lenient.
      Specified by:
      setLenient in interface FxTextComponent
      Parameters:
      lenient - true if lenient
    • setScale

      public void setScale(int scale)
      Description copied from interface: FxTextComponent
      Changes the format according to the given scale.
      Specified by:
      setScale in interface FxTextComponent
      Parameters:
      scale - the number of digits after the comma
    • getScale

      public int getScale()
      Description copied from interface: FxTextComponent
      Gets the current scale.
      Specified by:
      getScale in interface FxTextComponent
      Returns:
      the scale
    • isUnsigned

      public boolean isUnsigned()
      Description copied from interface: FxTextComponent
      Returns whether a numeric field is unsigned or signed.
      Specified by:
      isUnsigned in interface FxTextComponent
      Returns:
      true if unsigned
    • setUnsigned

      public void setUnsigned(boolean unsigned)
      Description copied from interface: FxTextComponent
      Sets whether a numeric field is unsigned or signed.
      Specified by:
      setUnsigned in interface FxTextComponent
      Parameters:
      unsigned - true if unsigned
    • isUTC

      public boolean isUTC()
      Description copied from interface: FxTextComponent
      Returns whether this is a UTC timestamp.
      Specified by:
      isUTC in interface FxTextComponent
      Returns:
      true if UTC
    • setUTC

      public void setUTC(boolean utc)
      Description copied from interface: FxTextComponent
      Sets whether this is a UTC timestamp.
      Specified by:
      setUTC in interface FxTextComponent
      Parameters:
      utc - true if UTC
    • setCaseConversion

      public void setCaseConversion(CaseConversion caseConversion)
      Description copied from interface: FxTextComponent
      Sets the case conversion.
      Specified by:
      setCaseConversion in interface FxTextComponent
      Parameters:
      caseConversion - the conversion, null if no conversion (default)
    • getCaseConversion

      public CaseConversion getCaseConversion()
      Description copied from interface: FxTextComponent
      Gets the case conversion.
      Specified by:
      getCaseConversion in interface FxTextComponent
      Returns:
      the conversion, null if no conversion (default)
    • setFiller

      public void setFiller(char filler)
      Description copied from interface: FxTextComponent
      Sets the filler character.
      The default is space.
      Specified by:
      setFiller in interface FxTextComponent
      Parameters:
      filler - the filler
    • getFiller

      public char getFiller()
      Description copied from interface: FxTextComponent
      Gets the filler character.
      Specified by:
      getFiller in interface FxTextComponent
      Returns:
      the filler
    • autoSelect

      public void autoSelect()
      Description copied from interface: FxTextComponent
      Selects or deselects all text in the text input.
      Specified by:
      autoSelect in interface FxTextComponent
      See Also: