Package com.simsilica.lemur.value
Class TextFieldValueEditor<T>
java.lang.Object
com.simsilica.lemur.value.TextFieldValueEditor<T>
- All Implemented Interfaces:
VersionedObject<T>
,ValueEditor<T>
Uses a text field and a pair of object-string and string-object
transform functions to implement a ValueEditor.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
configureStyle
(ElementId elementId, String style) Called by the using component to set the preferred ElementId and style for the editor.Creates a new VersionedReference that can be used to monitor when this object changes.protected TextField
Returns the GUI element that is providing editing support.Returns the current committed value of the editor.getStyle()
long
Returns the current version of the versioned object.protected void
boolean
isActive()
Returns true if this editor is still active.protected void
Resets the text field to reflect the current model value.void
Sets the document model for this editor.void
setElementId
(ElementId elementId) Sets a preconfigured ElementId for created editors.void
Sets the initial value of the object to be edited.void
Sets a preconfigured style for created editors.startEditing
(T initialValue) Starts editing and returns the Panel that should be added to the parent to facilitate that editing.protected void
stopEditing
(boolean canceled) boolean
updateState
(float tpf) Called to update the state of the editor and returns true or false if editing should continue.
-
Constructor Details
-
TextFieldValueEditor
-
-
Method Details
-
incrementVersion
protected void incrementVersion() -
createReference
Description copied from interface:VersionedObject
Creates a new VersionedReference that can be used to monitor when this object changes.- Specified by:
createReference
in interfaceVersionedObject<T>
-
getVersion
public long getVersion()Description copied from interface:VersionedObject
Returns the current version of the versioned object.- Specified by:
getVersion
in interfaceVersionedObject<T>
-
setObject
Description copied from interface:ValueEditor
Sets the initial value of the object to be edited.- Specified by:
setObject
in interfaceValueEditor<T>
-
getObject
Description copied from interface:ValueEditor
Returns the current committed value of the editor. If the editor holds-and-modifies that value then this will return the unedited value until editing is complete. If the editor is a 'live' editor then this will always return the current value. The versioned reference for this editor can be used to watch for value changes.- Specified by:
getObject
in interfaceValueEditor<T>
- Specified by:
getObject
in interfaceVersionedObject<T>
-
updateState
public boolean updateState(float tpf) Description copied from interface:ValueEditor
Called to update the state of the editor and returns true or false if editing should continue. This should be called once per frame as part of the parent's own updates.- Specified by:
updateState
in interfaceValueEditor<T>
-
isActive
public boolean isActive()Description copied from interface:ValueEditor
Returns true if this editor is still active.- Specified by:
isActive
in interfaceValueEditor<T>
-
setElementId
Sets a preconfigured ElementId for created editors. If this is non-null then the default implementation of configureStyle() will ignore the configureStyle() elementId argument. -
getElementId
-
setStyle
Sets a preconfigured style for created editors. If this is non-null then the default implementation of configureStyle() will ignore the configureStyle() style argument. -
getStyle
-
configureStyle
Description copied from interface:ValueEditor
Called by the using component to set the preferred ElementId and style for the editor. Implementations can ignore this if they wish to override the default element ID or style.- Specified by:
configureStyle
in interfaceValueEditor<T>
-
setDocumentModelFilter
Sets the document model for this editor. Note: this should not be called while a value is being edited as it will cause the old editor to be invalidated. -
getDocumentModelFilter
-
createTextField
-
startEditing
Description copied from interface:ValueEditor
Starts editing and returns the Panel that should be added to the parent to facilitate that editing.- Specified by:
startEditing
in interfaceValueEditor<T>
-
getEditor
Description copied from interface:ValueEditor
Returns the GUI element that is providing editing support.- Specified by:
getEditor
in interfaceValueEditor<T>
-
resetText
protected void resetText()Resets the text field to reflect the current model value. -
stopEditing
protected void stopEditing(boolean canceled)
-