java.lang.Object
org.tentackle.fx.FxControlDelegate
org.tentackle.fx.FxComponentDelegate
org.tentackle.fx.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
-
Property Summary
Properties inherited from class org.tentackle.fx.FxComponentDelegate
mandatoryProperties inherited from class org.tentackle.fx.FxControlDelegate
changeable, viewModifiedProperties inherited from interface org.tentackle.fx.FxComponent
mandatoryProperties inherited from interface org.tentackle.fx.FxControl
changeable, viewModified -
Field Summary
Fields inherited from class org.tentackle.fx.FxComponentDelegate
ERROR_STYLE, INFO_STYLE, MANDATORY_STYLE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionjavafx.scene.control.TextFormatter.Changeapply(javafx.scene.control.TextFormatter.Change t) voidSelects or deselects all text in the text input.protected javafx.beans.property.ReadOnlyBooleanWrappercreateChangeableProperty(boolean changeable) Creates the changeable property.protected ValueTranslator<?,?> createValueTranslator(Class<?> type) Filters input characters.Gets the case conversion.Gets the error offset.charGets the filler character.Gets invalid characters.intGets the maximum number of columns.Gets the format pattern.intgetScale()Gets the current scale.javafx.geometry.PosGets the text alignment.protected FxTextComponentGets the text component.Gets the text converter.Gets allowed characters.booleanReturns whether the auto-select feature is enabled.booleanReturns whether parsing to model should be lenient.booleanReturns whether a numeric field is unsigned or signed.booleanisUTC()Returns whether this is a UTC timestamp.voidsaveView()Creates a copy of the value shown to the user.voidsetAutoSelect(boolean autoSelect) Sets the auto-select feature.
A component with autoselect enabled will automatically select all characters if the component gets the keyboard focus.voidsetCaseConversion(CaseConversion caseConversion) Sets the case conversion.voidsetContainerChangeable(boolean containerChangeable) Invoked when setChangeable() is invoked on the container of this component.voidSets the error message.
Notice that an empty string will set the style but does not show any popup.voidsetErrorOffset(Integer errorOffset) Sets the error offset.voidsetFiller(char filler) Sets the filler character.
The default is space.voidsetInvalidChars(String invalidChars) Sets invalid characters.voidsetLenient(boolean lenient) Sets whether parsing to model should be lenient.voidsetMaxColumns(int maxColumns) Sets the maximum number of columns.
The number of columns will be enforced by the model.voidsetPattern(String pattern) Sets the format pattern.
The format pattern is used to format the view of the data.voidsetScale(int scale) Changes the format according to the given scale.voidsetTextAlignment(javafx.geometry.Pos textAlignment) Sets the text alignment.voidsetTextConverter(Function<String, String> textConverter) Sets a text converter.
Converts input text to the view's text.voidSets the type for this component.voidsetUnsigned(boolean unsigned) Sets whether a numeric field is unsigned or signed.voidsetUTC(boolean utc) Sets whether this is a UTC timestamp.voidsetValidChars(String validChars) Sets allowed characters.voidShows the error popup.
Requires the error message set.voidWalks up the component hierarchy and updates the viewModified property.
This is done by comparing the saved view value with the current view.protected voidupdateChangeable(boolean changeable) Updates other properties if changeable is bound to something else.protected voidupdateMandatoryStyle(boolean mandatory) Does the physical update of the style.voidUpdates the model according to the view.voidUpdates the view according to the model.Methods inherited from class org.tentackle.fx.FxComponentDelegate
getBinding, getBindingPath, getComponent, getComponentPath, getDelegate, getError, getGenericType, getInfo, getLastViewObject, getNode, getParentContainer, getSavedViewObject, getTableCell, getTreeTableCell, getType, getValueTranslator, getViewValue, handleInputFailure, hideErrorPopup, hideInfoPopup, invalidateSavedView, isErrorTemporary, isListenerSuppressedIfModelUnchanged, isListenerSuppressedIfViewUnchanged, isMandatory, isModelUpdated, isSavedViewObjectValid, isUpdatingModel, isUpdatingView, mandatoryProperty, setBinding, setBindingPath, setComponentPath, setErrorTemporary, setGenericType, setInfo, setLastViewObject, setListenerSuppressedIfModelUnchanged, setListenerSuppressedIfViewUnchanged, setMandatory, setTableCell, setTreeTableCell, setValueTranslator, setViewValue, showInfoPopup, toGenericString, toString, updateErrorStyle, updateInfoStyleMethods inherited from class org.tentackle.fx.FxControlDelegate
addModelToViewListener, addViewToModelListener, changeableProperty, fireModelToViewListeners, fireViewToModelListeners, getHelpUrl, getModelToViewListeners, getViewToModelListeners, isBindable, isChangeable, isContainerChangeableIgnored, isControlChangeable, isViewModified, removeModelToViewListener, removeViewToModelListener, setBindable, setChangeable, setContainerChangeableIgnored, setHelpUrl, setViewModified, showHelp, viewModifiedPropertyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.tentackle.fx.ErrorPopupSupported
getError, hideErrorPopup, isErrorTemporary, setErrorTemporaryMethods inherited from interface org.tentackle.fx.FxComponent
getBinding, getBindingPath, getComponentPath, getDelegate, getGenericType, getSavedViewObject, getTableCell, getTreeTableCell, getType, getValueTranslator, getViewObject, getViewValue, isCellEditor, isListenerSuppressedIfModelUnchanged, isListenerSuppressedIfViewUnchanged, isMandatory, isModelUpdated, isSavedViewObjectValid, mandatoryProperty, setBinding, setBindingPath, setComponentPath, setGenericType, setListenerSuppressedIfModelUnchanged, setListenerSuppressedIfViewUnchanged, setMandatory, setTableCell, setTreeTableCell, setValueTranslator, setViewObject, setViewValueMethods inherited from interface org.tentackle.fx.FxControl
addModelToViewListener, addViewToModelListener, changeableProperty, getHelpUrl, getParentContainer, invalidateSavedView, isBindable, isChangeable, isContainerChangeableIgnored, isViewModified, removeModelToViewListener, removeViewToModelListener, setBindable, setChangeable, setContainerChangeableIgnored, setHelpUrl, setViewModified, showHelp, toGenericString, viewModifiedPropertyMethods inherited from interface org.tentackle.fx.FxTextComponent
getColumns, mapErrorOffsetToCaretPosition, setColumnsMethods inherited from interface org.tentackle.fx.InfoPopupSupported
getInfo, hideInfoPopup, setInfo, showInfoPopup
-
Constructor Details
-
FxTextComponentDelegate
public FxTextComponentDelegate()Creates a text component delegate.
-
-
Method Details
-
getTextComponent
Gets the text component.- Returns:
- the text component
-
updateChangeable
protected void updateChangeable(boolean changeable) Description copied from class:FxControlDelegateUpdates other properties if changeable is bound to something else.- Overrides:
updateChangeablein classFxComponentDelegate- Parameters:
changeable- the flag
-
updateMandatoryStyle
protected void updateMandatoryStyle(boolean mandatory) Description copied from class:FxComponentDelegateDoes the physical update of the style. See resources/org/tentackle/fx/tentackle.css- Overrides:
updateMandatoryStylein classFxComponentDelegate- Parameters:
mandatory- true if mandatory
-
createChangeableProperty
protected javafx.beans.property.ReadOnlyBooleanWrapper createChangeableProperty(boolean changeable) Description copied from class:FxControlDelegateCreates the changeable property.- Overrides:
createChangeablePropertyin classFxComponentDelegate- Parameters:
changeable- the initial value- Returns:
- the property
-
setContainerChangeable
public void setContainerChangeable(boolean containerChangeable) Description copied from interface:FxControlInvoked when setChangeable() is invoked on the container of this component.- Specified by:
setContainerChangeablein interfaceFxControl- Overrides:
setContainerChangeablein classFxComponentDelegate- Parameters:
containerChangeable- true if container is changeable, false if all components readonly
-
getErrorOffset
Description copied from interface:FxTextComponentGets the error offset.- Specified by:
getErrorOffsetin interfaceFxTextComponent- Returns:
- the offset, null if no offset
-
setErrorOffset
Description copied from interface:FxTextComponentSets the error offset.- Specified by:
setErrorOffsetin interfaceFxTextComponent- Parameters:
errorOffset- null to clear
-
setError
Description copied from interface:ErrorPopupSupportedSets the error message.
Notice that an empty string will set the style but does not show any popup.- Specified by:
setErrorin interfaceErrorPopupSupported- Overrides:
setErrorin classFxComponentDelegate- Parameters:
errorMessage- the error message, null to clear
-
showErrorPopup
public void showErrorPopup()Description copied from interface:ErrorPopupSupportedShows the error popup.
Requires the error message set.- Specified by:
showErrorPopupin interfaceErrorPopupSupported- Overrides:
showErrorPopupin classFxComponentDelegate
-
triggerViewModified
public void triggerViewModified()Description copied from interface:FxControlWalks up the component hierarchy and updates the viewModified property.
This is done by comparing the saved view value with the current view.- Specified by:
triggerViewModifiedin interfaceFxControl- Overrides:
triggerViewModifiedin classFxComponentDelegate
-
updateView
public void updateView()Description copied from interface:FxControlUpdates the view according to the model.- Specified by:
updateViewin interfaceFxControl- Overrides:
updateViewin classFxComponentDelegate
-
updateModel
public void updateModel()Description copied from interface:FxControlUpdates the model according to the view.- Specified by:
updateModelin interfaceFxControl- Overrides:
updateModelin classFxComponentDelegate
-
saveView
public void saveView()Description copied from interface:FxControlCreates a copy of the value shown to the user.- Specified by:
saveViewin interfaceFxControl- Overrides:
saveViewin classFxComponentDelegate
-
setValidChars
Description copied from interface:FxTextComponentSets allowed characters.- Specified by:
setValidCharsin interfaceFxTextComponent- Parameters:
validChars- the valid characters, null = all (default)
-
getValidChars
Description copied from interface:FxTextComponentGets allowed characters.- Specified by:
getValidCharsin interfaceFxTextComponent- Returns:
- the valid characters, null = all (default)
-
setInvalidChars
Description copied from interface:FxTextComponentSets invalid characters.- Specified by:
setInvalidCharsin interfaceFxTextComponent- Parameters:
invalidChars- the invalid characters, null = none (default)
-
getInvalidChars
Description copied from interface:FxTextComponentGets invalid characters.- Specified by:
getInvalidCharsin interfaceFxTextComponent- Returns:
- the invalid characters, null = none (default)
-
setTextConverter
Description copied from interface:FxTextComponentSets a text converter.
Converts input text to the view's text.- Specified by:
setTextConverterin interfaceFxTextComponent- Parameters:
textConverter- the converter
-
getTextConverter
Description copied from interface:FxTextComponentGets the text converter.- Specified by:
getTextConverterin interfaceFxTextComponent- Returns:
- the converter
-
apply
public javafx.scene.control.TextFormatter.Change apply(javafx.scene.control.TextFormatter.Change t) -
filter
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:FxTextComponentSets the text alignment.- Specified by:
setTextAlignmentin interfaceFxTextComponent- Parameters:
textAlignment- the alignment, null if component's default
-
getTextAlignment
public javafx.geometry.Pos getTextAlignment()Description copied from interface:FxTextComponentGets the text alignment.- Specified by:
getTextAlignmentin interfaceFxTextComponent- Returns:
- the alignment, null if component's default
-
setType
Description copied from interface:FxComponentSets 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:
setTypein interfaceFxComponent- Overrides:
setTypein classFxComponentDelegate- Parameters:
type- the type
-
createValueTranslator
-
setMaxColumns
public void setMaxColumns(int maxColumns) Description copied from interface:FxTextComponentSets the maximum number of columns.
The number of columns will be enforced by the model.- Specified by:
setMaxColumnsin interfaceFxTextComponent- Parameters:
maxColumns- the maximum number of columns, 0 if unlimited (default)
-
getMaxColumns
public int getMaxColumns()Description copied from interface:FxTextComponentGets the maximum number of columns.- Specified by:
getMaxColumnsin interfaceFxTextComponent- Returns:
- the maximum number of columns, 0 if unlimited (default)
-
setAutoSelect
public void setAutoSelect(boolean autoSelect) Description copied from interface:FxTextComponentSets 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:
setAutoSelectin interfaceFxTextComponent- Parameters:
autoSelect- true if autoselect enabled, false if disabled (default)
-
isAutoSelect
public boolean isAutoSelect()Description copied from interface:FxTextComponentReturns whether the auto-select feature is enabled.- Specified by:
isAutoSelectin interfaceFxTextComponent- Returns:
- true if autoselect enabled, false if disabled (default)
-
setPattern
Description copied from interface:FxTextComponentSets the format pattern.
The format pattern is used to format the view of the data.- Specified by:
setPatternin interfaceFxTextComponent- Parameters:
pattern- the format pattern
-
getPattern
Description copied from interface:FxTextComponentGets the format pattern.- Specified by:
getPatternin interfaceFxTextComponent- Returns:
- the format pattern
-
isLenient
public boolean isLenient()Description copied from interface:FxTextComponentReturns whether parsing to model should be lenient.- Specified by:
isLenientin interfaceFxTextComponent- Returns:
- true if lenient, false is default
-
setLenient
public void setLenient(boolean lenient) Description copied from interface:FxTextComponentSets whether parsing to model should be lenient.- Specified by:
setLenientin interfaceFxTextComponent- Parameters:
lenient- true if lenient
-
setScale
public void setScale(int scale) Description copied from interface:FxTextComponentChanges the format according to the given scale.- Specified by:
setScalein interfaceFxTextComponent- Parameters:
scale- the number of digits after the comma
-
getScale
public int getScale()Description copied from interface:FxTextComponentGets the current scale.- Specified by:
getScalein interfaceFxTextComponent- Returns:
- the scale
-
isUnsigned
public boolean isUnsigned()Description copied from interface:FxTextComponentReturns whether a numeric field is unsigned or signed.- Specified by:
isUnsignedin interfaceFxTextComponent- Returns:
- true if unsigned
-
setUnsigned
public void setUnsigned(boolean unsigned) Description copied from interface:FxTextComponentSets whether a numeric field is unsigned or signed.- Specified by:
setUnsignedin interfaceFxTextComponent- Parameters:
unsigned- true if unsigned
-
isUTC
public boolean isUTC()Description copied from interface:FxTextComponentReturns whether this is a UTC timestamp.- Specified by:
isUTCin interfaceFxTextComponent- Returns:
- true if UTC
-
setUTC
public void setUTC(boolean utc) Description copied from interface:FxTextComponentSets whether this is a UTC timestamp.- Specified by:
setUTCin interfaceFxTextComponent- Parameters:
utc- true if UTC
-
setCaseConversion
Description copied from interface:FxTextComponentSets the case conversion.- Specified by:
setCaseConversionin interfaceFxTextComponent- Parameters:
caseConversion- the conversion, null if no conversion (default)
-
getCaseConversion
Description copied from interface:FxTextComponentGets the case conversion.- Specified by:
getCaseConversionin interfaceFxTextComponent- Returns:
- the conversion, null if no conversion (default)
-
setFiller
public void setFiller(char filler) Description copied from interface:FxTextComponentSets the filler character.
The default is space.- Specified by:
setFillerin interfaceFxTextComponent- Parameters:
filler- the filler
-
getFiller
public char getFiller()Description copied from interface:FxTextComponentGets the filler character.- Specified by:
getFillerin interfaceFxTextComponent- Returns:
- the filler
-
autoSelect
public void autoSelect()Description copied from interface:FxTextComponentSelects or deselects all text in the text input.- Specified by:
autoSelectin interfaceFxTextComponent- See Also:
-