Module AM37

Class InputDialog

All Implemented Interfaces:
KeyEventListener
Direct Known Subclasses:
ButtonsDialog, MultipleChoiceListDialog, SingleChoiceListDialog, TextInputDialog

public abstract class InputDialog
extends Dialog
  • Field Details

    • inputs

      protected final java.util.HashMap<ActiveItem,​java.lang.String> inputs
      Maps all the activeItems which
  • Constructor Details

    • InputDialog

      public InputDialog​(java.lang.String title, java.lang.String message, Window caller)
      Default constructor

      Creates a standard size inputDialog window, using the properties file, without printing it; if other dialogs are already showing, the new dialog is created at an offset from the already existing one.
      The console echo is disabled as soon as the Dialog is created

      Parameters:
      title - the dialog title
      message - the dialog message
      caller - the window which invoked this
    • InputDialog

      public InputDialog​(java.lang.String title, java.lang.String message, int width, int height, Window caller)
      Custom constructor

      Creates a custom size input dialog window, without printing it; if other dialogs are already showing, the new dialog is created at an offset from the already existing one
      The console echo is disabled as soon as the Dialog is created

      Parameters:
      height - the dialog height
      width - the dialog width
      title - the dialog title
      message - the dialog message
      caller - the window which invoked this
    • InputDialog

      public InputDialog​(java.lang.String title, java.lang.String message, int width, int height, CursorPosition initCoord, Window caller)
      Custom constructor

      Creates a custom size input dialog window, without printing it;
      The console echo is disabled as soon as the Dialog is created

      Parameters:
      height - the dialog height
      width - the dialog width
      title - the dialog title
      message - the dialog message
      caller - the window which invoked this
  • Method Details

    • getInputs

      public java.util.Map<ActiveItem,​java.lang.String> getInputs()
      Provides a map containing active items and their corresponding values to be returned
      Returns:
      the up mentioned map
    • canBeClosed

      public boolean canBeClosed()
      Determines if the dialog can be closed

      For a InputDialog, it can be closed when all the required input fields have been filled

      Overrides:
      canBeClosed in class Dialog
      Returns:
      true if the dialog can be closed, false otherwise
    • onQuit

      public void onQuit()
      Determines the Dialog behaviour when it is asked to close itself

      For an InputDialog, all of its inputs are passed to the inputManager

      Specified by:
      onQuit in class Dialog
    • getTextColor

      public java.lang.String getTextColor()
      Provides the first WindowItem.activeItems textColor
      Overrides:
      getTextColor in class Rectangle
      Returns:
      the first item's text color scheme
    • show

      public void show()
      Draws itself
      Overrides:
      show in class Dialog
    • onArrowRight

      public void onArrowRight()
      Selects the next ActiveItem on the Dialog
    • onArrowLeft

      public void onArrowLeft()
      Selects the previous ActiveItem on the Dialog
    • onCarriageReturn

      public void onCarriageReturn()
      Performs an action based on the currently selected ActiveItem
    • onTab

      public void onTab()
      Selects the next ActiveItem on the Dialog
    • onArrowUp

      public void onArrowUp()
      Selects the previous ActiveItem on the Dialog
    • onArrowDown

      public void onArrowDown()
      Selects the next ActiveItem on the Dialog