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 TypeMethodDescriptionvoidconfigureStyle(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 TextFieldReturns the GUI element that is providing editing support.Returns the current committed value of the editor.getStyle()longReturns the current version of the versioned object.protected voidbooleanisActive()Returns true if this editor is still active.protected voidResets the text field to reflect the current model value.voidSets the document model for this editor.voidsetElementId(ElementId elementId) Sets a preconfigured ElementId for created editors.voidSets the initial value of the object to be edited.voidSets 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 voidstopEditing(boolean canceled) booleanupdateState(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:VersionedObjectCreates a new VersionedReference that can be used to monitor when this object changes.- Specified by:
createReferencein interfaceVersionedObject<T>
-
getVersion
public long getVersion()Description copied from interface:VersionedObjectReturns the current version of the versioned object.- Specified by:
getVersionin interfaceVersionedObject<T>
-
setObject
Description copied from interface:ValueEditorSets the initial value of the object to be edited.- Specified by:
setObjectin interfaceValueEditor<T>
-
getObject
Description copied from interface:ValueEditorReturns 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:
getObjectin interfaceValueEditor<T>- Specified by:
getObjectin interfaceVersionedObject<T>
-
updateState
public boolean updateState(float tpf) Description copied from interface:ValueEditorCalled 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:
updateStatein interfaceValueEditor<T>
-
isActive
public boolean isActive()Description copied from interface:ValueEditorReturns true if this editor is still active.- Specified by:
isActivein 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:ValueEditorCalled 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:
configureStylein 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:ValueEditorStarts editing and returns the Panel that should be added to the parent to facilitate that editing.- Specified by:
startEditingin interfaceValueEditor<T>
-
getEditor
Description copied from interface:ValueEditorReturns the GUI element that is providing editing support.- Specified by:
getEditorin interfaceValueEditor<T>
-
resetText
protected void resetText()Resets the text field to reflect the current model value. -
stopEditing
protected void stopEditing(boolean canceled)
-