Package: groovy.console.ui

## [Groovy] Class AstBrowser

- groovy.console.ui.AstBrowser

-     class AstBrowser
      extends Object

  This object is a GUI for looking at the AST that Groovy generates. Usage: java groovy.console.ui.AstBrowser [filename] where [filename] is an existing Groovy script.

- - ### Properties Summary

    Properties
    Type | Name and description
    --- | ---
    `GeneratedBytecodeAwareGroovyClassLoader` | `classLoader` Class loader used to capture generated bytecode for the selected phase.
    `Object` | `frame` Top-level browser window.
    `Object` | `prefs` Persisted UI preferences for the browser window.
    `Action` | `refreshAction` Refresh action shared by toolbar and menu items.
    `boolean` | `showClosureClasses` Display flags that control which script representations are shown.
    `boolean` | `showScriptClass` Display flags that control which script representations are shown.
    `boolean` | `showScriptFreeForm` Display flags that control which script representations are shown.
    `boolean` | `showTreeView` Display flags that control which script representations are shown.
    `SwingBuilder` | `swing` Swing builder used to create and update the browser UI.

  - ### Constructor Summary

    Constructors
    Constructor and description
    `AstBrowser(Object inputArea, Object rootElement, Object classLoader, Object config)` Creates a browser for the supplied editor state.

  - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `void` | `aboutAction(EventObject evt)` Displays the browser about dialog.
    `` | `void` | `compile(Object jTree, String script, int compilePhase)` Rebuilds the AST tree for the selected compile phase.
    `` | `void` | `copyAction(Object table, MouseEvent me, EventObject evt)` Copies the current tooltip value to the system clipboard.
    `` | `void` | `decompile(Object phaseId, Object source)` Rebuilds the decompiled source view for the selected compile phase.
    `` | `void` | `initAuxViews()` Resets the auxiliary source views to their default placeholder text.
    `` | `void` | `largerFont(EventObject evt)` Increases the font size used by the browser views.
    `` | `void` | `launch(Object table, Object valueCol, Object pathClosure)` Opens the selected value in the object browser.
    `` | `void` | `launchAction(Object table, Object valueCol, Object pathClosure, EventObject evt)` Action handler that delegates to launch(Object, Object, Object).
    `` | `static void` | `main(Object args)` Launches the AST browser for the supplied script file.
    `` | `Object` | `mouseListener(int valueCol, Closure pathClosure)` Creates the table mouse listener used for copy and browse actions.
    `` | `void` | `run(Closure script)` Opens the browser for the supplied script producer.
    `` | `void` | `run(Closure script, String name)` Opens the browser for the supplied script producer.
    `` | `void` | `showClosureClasses(EventObject evt)` Toggles display of generated closure and lambda classes.
    `` | `void` | `showScriptClass(EventObject evt)` Toggles display of the generated script class.
    `` | `void` | `showScriptFreeForm(EventObject evt)` Toggles display of the free-form script body.
    `` | `void` | `showTreeView(EventObject evt)` Toggles visibility of the tree pane.
    `` | `void` | `smallerFont(EventObject evt)` Decreases the font size used by the browser views.

  - ### Inherited Methods Summary

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

- - ### Property Detail

    - #### GeneratedBytecodeAwareGroovyClassLoader classLoader

      Class loader used to capture generated bytecode for the selected phase.

    - #### Object frame

      Top-level browser window.

    - #### Object prefs

      Persisted UI preferences for the browser window.

    - #### Action refreshAction

      Refresh action shared by toolbar and menu items.

    - #### boolean showClosureClasses

      Display flags that control which script representations are shown.

    - #### boolean showScriptClass

      Display flags that control which script representations are shown.

    - #### boolean showScriptFreeForm

      Display flags that control which script representations are shown.

    - #### boolean showTreeView

      Display flags that control which script representations are shown.

    - #### SwingBuilder swing

      Swing builder used to create and update the browser UI.

  - ### Constructor Detail

    - #### AstBrowser(Object inputArea, Object rootElement, Object classLoader, Object config)

      Creates a browser for the supplied editor state.

      Parameters:
        `inputArea` - input component whose selection should track the tree
        `rootElement` - root document element for the input component
        `classLoader` - parent class loader used for compilation
        `config` - optional compiler configuration

  - ### Method Detail

    - #### void aboutAction(EventObject evt)

      Displays the browser about dialog.

    - #### void compile(Object jTree, String script, int compilePhase)

      Rebuilds the AST tree for the selected compile phase.

      Parameters:
        `jTree` - tree component to update
        `script` - current source text
        `compilePhase` - compile phase identifier

    - #### void copyAction(Object table, MouseEvent me, EventObject evt)

      Copies the current tooltip value to the system clipboard.

    - #### void decompile(Object phaseId, Object source)

      Rebuilds the decompiled source view for the selected compile phase.

      Parameters:
        `phaseId` - compile phase identifier
        `source` - current source text

    - #### void initAuxViews()

      Resets the auxiliary source views to their default placeholder text.

    - #### void largerFont(EventObject evt)

      Increases the font size used by the browser views.

      Parameters:
        `evt` - triggering event, if any

    - #### void launch(Object table, Object valueCol, Object pathClosure)

      Opens the selected value in the object browser.

      Parameters:
        `table` - source table
        `valueCol` - column containing the browsable value
        `pathClosure` - closure used to build the browser path

    - #### void launchAction(Object table, Object valueCol, Object pathClosure, EventObject evt)

      Action handler that delegates to launch(Object, Object, Object).

    - #### static void main(Object args)

      Launches the AST browser for the supplied script file.

      Parameters:
        `args` - command-line arguments containing the script file path

    - #### Object mouseListener(int valueCol, Closure pathClosure)

      Creates the table mouse listener used for copy and browse actions.

      Parameters:
        `valueCol` - column index containing the browsable value
        `pathClosure` - closure used to build the browser path for a selected row
      Returns:
        the configured mouse listener

    - #### void run(Closure script)

      Opens the browser for the supplied script producer.

      Parameters:
        `script` - closure that supplies the current script text

    - #### void run(Closure script, String name)

      Opens the browser for the supplied script producer.

      Parameters:
        `script` - closure that supplies the current script text
        `name` - optional source name displayed in the window title

    - #### void showClosureClasses(EventObject evt)

      Toggles display of generated closure and lambda classes.

    - #### void showScriptClass(EventObject evt)

      Toggles display of the generated script class.

    - #### void showScriptFreeForm(EventObject evt)

      Toggles display of the free-form script body.

    - #### void showTreeView(EventObject evt)

      Toggles visibility of the tree pane.

      Parameters:
        `evt` - triggering event, if any

    - #### void smallerFont(EventObject evt)

      Decreases the font size used by the browser views.

      Parameters:
        `evt` - triggering event, if any