Class TextFieldValueEditor<T>

java.lang.Object
com.simsilica.lemur.value.TextFieldValueEditor<T>
All Implemented Interfaces:
VersionedObject<T>, ValueEditor<T>

public class TextFieldValueEditor<T> extends Object implements ValueEditor<T>
Uses a text field and a pair of object-string and string-object transform functions to implement a ValueEditor.
  • Constructor Details

  • Method Details

    • incrementVersion

      protected void incrementVersion()
    • createReference

      public VersionedReference<T> createReference()
      Description copied from interface: VersionedObject
      Creates a new VersionedReference that can be used to monitor when this object changes.
      Specified by:
      createReference in interface VersionedObject<T>
    • getVersion

      public long getVersion()
      Description copied from interface: VersionedObject
      Returns the current version of the versioned object.
      Specified by:
      getVersion in interface VersionedObject<T>
    • setObject

      public void setObject(T object)
      Description copied from interface: ValueEditor
      Sets the initial value of the object to be edited.
      Specified by:
      setObject in interface ValueEditor<T>
    • getObject

      public 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 interface ValueEditor<T>
      Specified by:
      getObject in interface VersionedObject<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 interface ValueEditor<T>
    • isActive

      public boolean isActive()
      Description copied from interface: ValueEditor
      Returns true if this editor is still active.
      Specified by:
      isActive in interface ValueEditor<T>
    • setElementId

      public void setElementId(ElementId elementId)
      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

      public ElementId getElementId()
    • setStyle

      public void setStyle(String style)
      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

      public String getStyle()
    • configureStyle

      public void configureStyle(ElementId elementId, String style)
      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 interface ValueEditor<T>
    • setDocumentModelFilter

      public void setDocumentModelFilter(DocumentModelFilter model)
      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

      public DocumentModelFilter getDocumentModelFilter()
    • createTextField

      protected TextField createTextField()
    • startEditing

      public Panel startEditing(T initialValue)
      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 interface ValueEditor<T>
    • getEditor

      public Panel getEditor()
      Description copied from interface: ValueEditor
      Returns the GUI element that is providing editing support.
      Specified by:
      getEditor in interface ValueEditor<T>
    • resetText

      protected void resetText()
      Resets the text field to reflect the current model value.
    • stopEditing

      protected void stopEditing(boolean canceled)