Package: groovy.console.ui

## [Java] Class ConsoleSupport

- groovy.console.ui.ConsoleSupport

-     public abstract class ConsoleSupport
      extends Object

  Base support class for consoles that evaluate Groovy scripts and render styled output.

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `protected void` | `addStylesToDocument(JTextPane outputArea)` Initializes the styles used by the output document.
    `` | `protected Object` | `evaluate(String text)` Evaluates the supplied text and delegates failures to handleException(String, Exception).
    `` | `public Style` | `getCommandStyle()` Returns the style used for entered commands.
    `` | `public Style` | `getOutputStyle()` Returns the style used for evaluated output.
    `` | `public Style` | `getPromptStyle()` Returns the style used for prompts.
    `` | `public GroovyShell` | `getShell()` Returns the shell used for script evaluation.
    `` | `protected abstract void` | `handleException(String text, Exception e)` Handles an exception raised while evaluating the supplied script text.

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class Object` | `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Method Detail

    - #### protected void addStylesToDocument(JTextPane outputArea)

      Initializes the styles used by the output document.

      Parameters:
        `outputArea` - text pane whose styled document should be configured

    - #### protected Object evaluate(String text)

      Evaluates the supplied text and delegates failures to handleException(String, Exception).

      Parameters:
        `text` - script text to evaluate
      Returns:
        the evaluation result, or `null` when evaluation fails

    - #### public Style getCommandStyle()

      Returns the style used for entered commands.

      Returns:
        the command style

    - #### public Style getOutputStyle()

      Returns the style used for evaluated output.

      Returns:
        the output style

    - #### public Style getPromptStyle()

      Returns the style used for prompts.

      Returns:
        the prompt style

    - #### public GroovyShell getShell()

      Returns the shell used for script evaluation.

      Returns:
        the lazily created shell

    - #### protected abstract void handleException(String text, Exception e)

      Handles an exception raised while evaluating the supplied script text.

      Parameters:
        `text` - script text being evaluated
        `e` - exception raised during evaluation