StaticCodeTemplate
Date: 2017-02-11

org.fife.ui.rsyntaxtextarea.templates

## Class StaticCodeTemplate

- java.lang.Object
- - org.fife.ui.rsyntaxtextarea.templates.AbstractCodeTemplate
  - - org.fife.ui.rsyntaxtextarea.templates.StaticCodeTemplate

- All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Comparable<CodeTemplate>, CodeTemplate

      public class StaticCodeTemplate
      extends AbstractCodeTemplate

  A code template that inserts static text before and after the caret.

  For example, you can associate the identifier `forb` (short for "for-block") with the following code:

         for (<caret>) {

         }

  Then, whenever you type `forb` followed by a trigger (e.g., a space) into a text area with this `CodeTemplate`, the code snippet is added in place of `forb`. Further, the caret is placed at the position denoted by `<caret>`.
  See Also:
    `CodeTemplate`, Serialized Form

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `StaticCodeTemplate()` Constructor.
    `StaticCodeTemplate(java.lang.String id, java.lang.String beforeCaret, java.lang.String afterCaret)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `getAfterCaretText()` Returns the text that will be placed after the caret.
    `java.lang.String` | `getBeforeCaretText()` Returns the text that will be placed before the caret.
    `void` | `invoke(RSyntaxTextArea textArea)` Invokes this code template.
    `void` | `setAfterCaretText(java.lang.String afterCaret)` Sets the text to place after the caret.
    `void` | `setBeforeCaretText(java.lang.String beforeCaret)` Sets the text to place before the caret.
    `java.lang.String` | `toString()` Returns a string representation of this template for debugging purposes.

    - ### Methods inherited from class org.fife.ui.rsyntaxtextarea.templates.AbstractCodeTemplate

      `clone, compareTo, equals, getID, hashCode, setID`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### StaticCodeTemplate

          public StaticCodeTemplate()

      Constructor. This constructor only exists to support persistance through serialization.

    - #### StaticCodeTemplate

          public StaticCodeTemplate(java.lang.String id,
                            java.lang.String beforeCaret,
                            java.lang.String afterCaret)

      Constructor.
      Parameters:
        `id` - The ID of this code template.
        `beforeCaret` - The text to place before the caret.
        `afterCaret` - The text to place after the caret.

  - ### Method Detail

    - #### getAfterCaretText

          public java.lang.String getAfterCaretText()

      Returns the text that will be placed after the caret.
      Returns:
        The text.
      See Also:
        `setAfterCaretText(java.lang.String)`

    - #### getBeforeCaretText

          public java.lang.String getBeforeCaretText()

      Returns the text that will be placed before the caret.
      Returns:
        The text.
      See Also:
        `setBeforeCaretText(java.lang.String)`

    - #### invoke

          public void invoke(RSyntaxTextArea textArea)
                      throws javax.swing.text.BadLocationException

      Invokes this code template. The changes are made to the given text area.
      Parameters:
        `textArea` - The text area to operate on.
      Throws:
        `javax.swing.text.BadLocationException` - If something bad happens.

    - #### setAfterCaretText

          public void setAfterCaretText(java.lang.String afterCaret)

      Sets the text to place after the caret.
      Parameters:
        `afterCaret` - The text.
      See Also:
        `getAfterCaretText()`

    - #### setBeforeCaretText

          public void setBeforeCaretText(java.lang.String beforeCaret)

      Sets the text to place before the caret.
      Parameters:
        `beforeCaret` - The text.
      See Also:
        `getBeforeCaretText()`

    - #### toString

          public java.lang.String toString()

      Returns a string representation of this template for debugging purposes.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        A string representation of this template.