Overview
Package
Class
Use
Tree
Deprecated
Index
All Classes
Help
Prev Class
Next Class
VUtils – Release 1
Interface org.violetlib.util.TextPresentationModel
Inherited members: ShowHide
Deprecated: ShowHide
org.violetlib.util

Interface TextPresentationModel<E>

  • Type Parameters:
    E - The type of model values.

    See also TextViewModel

    public interface TextPresentationModel<E>
    An encapsulation of the knowledge of presenting and (optionally) editing a certain class of values using text.

    Although in most common cases, the text shown in an editor is the same text used to present the value, there are cases where the text to install in a text editor is different from the displayed text. One example is a floating point number that is rounded when presented, but shown at full precision when editied. Another example is a floating point number that is shown using decimal notation when presented, but is converted to integer notation for editing when the value is an integer. These examples demonstrate that the text to edit can be either more specific or less specific than the display representation.

    • Methods 
      Modifier and Type Method and Description
      Ordinary member indicator fromEditorText Reveal DetailHide Detail
      abstract E fromEditorText(String text)
      Attempt to convert text obtained from a text editor to the appropriate value.
      E fromEditorText(String text) throws InvalidTextException, UnsupportedOperationException
      Attempt to convert text obtained from a text editor to the appropriate value.
      Parameters:
      text - The text to be parsed.
      Returns:
      the value.
      Throws:
      InvalidTextException - if the text is not a valid representation.
      UnsupportedOperationException - if this model does not support editing.
      Ordinary member indicator isEditable Reveal DetailHide Detail
      abstract boolean isEditable()
      Indicate whether this presentation model supports editing.
      boolean isEditable()
      Indicate whether this presentation model supports editing.
      Returns:
      true if and only if editing is supported.
      Ordinary member indicator isValidating Reveal DetailHide Detail
      abstract boolean isValidating()
      Indicate whether this presentation model validates supplied editor text.
      boolean isValidating()
      Indicate whether this presentation model validates supplied editor text. If supplied editor text is not validated, then all possible texts must be accepted.
      Returns:
      true if and only if supplied editor text is validated.
      Ordinary member indicator toDisplayText Reveal DetailHide Detail
      abstract String toDisplayText(E value)
      Convert a value to its display representation.
      String toDisplayText(E value)
      Convert a value to its display representation. This method is used for display, not editing.
      Parameters:
      value - The value.
      Returns:
      the corresponding display representation.
      Ordinary member indicator toEditorText Reveal DetailHide Detail
      abstract String toEditorText(E value)
      Convert a value to the text to display in an editor when opening an editor on the value.
      String toEditorText(E value) throws UnsupportedOperationException
      Convert a value to the text to display in an editor when opening an editor on the value.
      Parameters:
      value - The value.
      Returns:
      the corresponding text to show in a text editor.
      Throws:
      UnsupportedOperationException - if this model does not support editing.