public class TextFieldValueEditor<T> extends java.lang.Object implements ValueEditor<T>
Modifier and Type | Class and Description |
---|---|
protected class |
TextFieldValueEditor.FocusObserver |
Constructor and Description |
---|
TextFieldValueEditor(com.google.common.base.Function<java.lang.Object,java.lang.String> toString,
com.google.common.base.Function<java.lang.String,T> toObject) |
Modifier and Type | Method and Description |
---|---|
void |
configureStyle(com.simsilica.lemur.style.ElementId elementId,
java.lang.String style)
Called by the using component to set the preferred ElementId
and style for the editor.
|
com.simsilica.lemur.core.VersionedReference<T> |
createReference() |
protected com.simsilica.lemur.TextField |
createTextField() |
com.simsilica.lemur.text.DocumentModelFilter |
getDocumentModelFilter() |
com.simsilica.lemur.Panel |
getEditor()
Returns the GUI element that is providing editing support.
|
com.simsilica.lemur.style.ElementId |
getElementId() |
T |
getObject()
Returns the current committed value of the editor.
|
java.lang.String |
getStyle() |
long |
getVersion() |
protected void |
incrementVersion() |
boolean |
isActive()
Returns true if this editor is still active.
|
protected void |
resetText()
Resets the text field to reflect the current model value.
|
void |
setDocumentModelFilter(com.simsilica.lemur.text.DocumentModelFilter model)
Sets the document model for this editor.
|
void |
setElementId(com.simsilica.lemur.style.ElementId elementId)
Sets a preconfigured ElementId for created editors.
|
void |
setObject(T object)
Sets the initial value of the object to be edited.
|
void |
setStyle(java.lang.String style)
Sets a preconfigured style for created editors.
|
com.simsilica.lemur.Panel |
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.
|
public TextFieldValueEditor(com.google.common.base.Function<java.lang.Object,java.lang.String> toString, com.google.common.base.Function<java.lang.String,T> toObject)
protected void incrementVersion()
public com.simsilica.lemur.core.VersionedReference<T> createReference()
createReference
in interface com.simsilica.lemur.core.VersionedObject<T>
public long getVersion()
getVersion
in interface com.simsilica.lemur.core.VersionedObject<T>
public void setObject(T object)
ValueEditor
setObject
in interface ValueEditor<T>
public T getObject()
ValueEditor
getObject
in interface com.simsilica.lemur.core.VersionedObject<T>
getObject
in interface ValueEditor<T>
public boolean updateState(float tpf)
ValueEditor
updateState
in interface ValueEditor<T>
public boolean isActive()
ValueEditor
isActive
in interface ValueEditor<T>
public void setElementId(com.simsilica.lemur.style.ElementId elementId)
public com.simsilica.lemur.style.ElementId getElementId()
public void setStyle(java.lang.String style)
public java.lang.String getStyle()
public void configureStyle(com.simsilica.lemur.style.ElementId elementId, java.lang.String style)
ValueEditor
configureStyle
in interface ValueEditor<T>
public void setDocumentModelFilter(com.simsilica.lemur.text.DocumentModelFilter model)
public com.simsilica.lemur.text.DocumentModelFilter getDocumentModelFilter()
protected com.simsilica.lemur.TextField createTextField()
public com.simsilica.lemur.Panel startEditing(T initialValue)
ValueEditor
startEditing
in interface ValueEditor<T>
public com.simsilica.lemur.Panel getEditor()
ValueEditor
getEditor
in interface ValueEditor<T>
protected void resetText()
protected void stopEditing(boolean canceled)