All Implemented Interfaces:
KeyEventListener
Direct Known Subclasses:
ErrorDialog, InputDialog, MessageDialog

public abstract class Dialog
extends Window
General abstraction for a dialog window
  • Field Details

    • title

      protected final java.lang.String title
      The dialog title
    • message

      protected final java.lang.String message
      The dialog message
  • Constructor Details

    • Dialog

      protected Dialog​(java.lang.String title, java.lang.String message, Window parent, java.lang.String id)
      Default constructor

      Creates a standard size dialog 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
      parent - the window which invoked this
      id - the object id
    • Dialog

      protected Dialog​(java.lang.String title, java.lang.String message, int width, int height, Window caller, java.lang.String id)
      Custom constructor

      Creates a custom size 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
    • Dialog

      protected Dialog​(java.lang.String title, java.lang.String message, int width, int height, CursorPosition position, Window caller, java.lang.String id)
      Custom constructor

      Creates a custom size 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
      id - the object id
  • Method Details

    • getBackgroundColor

      public java.lang.String getBackgroundColor()
      background getter
      Overrides:
      getBackgroundColor in class Rectangle
      Returns:
      the parent's background color
    • canBeClosed

      public boolean canBeClosed()
      Determines if the dialog can be closed; by default, a dialog can be closed anytime
      Returns:
      true if the dialog can be closed, false otherwise
    • onQuit

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

      protected void drawTitle()
      Draws the dialog title
    • drawMessage

      protected void drawMessage()
      Draws the dialog message, splitting it on multiple lines if necessary
    • drawBackground

      protected void drawBackground()
      Draws the dialog background
      Overrides:
      drawBackground in class Rectangle
    • drawShadows

      protected void drawShadows()
      Draws right and bottom shadows
      Uses the caller's color as background, because it looks better
      Overrides:
      drawShadows in class WindowItem
    • show

      public void show()
      Draws itself
      Overrides:
      show in class Window
    • remove

      public void remove()
      Removes itself and eventually re-enables the console input
      Overrides:
      remove in class WindowItem