Class Field<Type>

java.lang.Object
pt.tecnico.uilib.forms.Field<Type>
Type Parameters:
Type - is the type of the data to be read in the field.
Direct Known Subclasses:
FieldNone

public abstract class Field<Type> extends Object
This class represents an input field in a form.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected Type
    value to be read
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Build an Input without a title
    protected
    Field​(String prompt)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Mark the Input as unread
    boolean
     
    protected void
    Mark the Input as read
    boolean
    Is the input field read-only.
    abstract boolean
    parse​(String in)
    Each Input must parse its own specific type of value, written in accordance with the specific regular expression.
     
    void
    set​(Type value)
     
     
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • _value

      protected Type _value
      value to be read
  • Constructor Details

    • Field

      protected Field()
      Build an Input without a title
    • Field

      protected Field(String prompt)
      Parameters:
      prompt - the prompt for the requested value
      regex - the regular expression to be matched
  • Method Details

    • prompt

      public String prompt()
      Returns:
      the description of the request
    • set

      public void set(Type value)
      Parameters:
      value - the new value
    • value

      public Type value()
      Returns:
      the value
    • clear

      public void clear()
      Mark the Input as unread
    • dirty

      protected void dirty()
      Mark the Input as read
    • cleared

      public boolean cleared()
      Returns:
      true if the Input is cleared
    • isReadOnly

      public boolean isReadOnly()
      Is the input field read-only.
    • parse

      public abstract boolean parse(String in)
      Each Input must parse its own specific type of value, written in accordance with the specific regular expression.
      Parameters:
      in - the string to be parsed
      Returns:
      the status of parsing success
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also:
      Object.toString()