# Class PureEditor

java.lang.Object
com.codename1.ui.editor.PureEditor

Direct Known Subclasses:
  `CodePureEditor, RichPureEditor`

public class PureEditor extends Object

The pure Codename One editor backend. It owns an `EditorView` and translates the semantic command / query vocabulary spoken by `RichTextArea` and `CodeEditor` (the same strings the `BrowserComponent` backend understands) into operations on the pure text engine.

This base class handles the shared, plain text portion of the vocabulary. The rich text and code feature layers subclass it (and subclass `EditorView`) to add styling, syntax highlighting, the gutter, completion and diagnostics.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `PureEditor(EditorHost host, String editorType)`
  Creates a pure editor backend.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `cmd(String name, String arg)`
  Executes a one way command.
  `protected EditorView`
  `createView(EditorHost host, boolean codeMode)`
  Creates the editor view.
  `Component`
  `getView()`
  Returns the editing surface component to place in the editor container.
  `protected boolean`
  `isCodeMode()`
  True for a code editor backend.
  `String`
  `query(String name, String arg)`
  Executes a query returning a string result.
  `protected EditorView`
  `view()`
  Returns the underlying editor view.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### PureEditor

    public PureEditor(EditorHost host, String editorType)

    Creates a pure editor backend.

    ###### Parameters

    - `host`: the bridge to the owning editor component

    - `editorType`: `"code"` or `"richtext"`

- ## Method Details

  - ### createView

    protected EditorView createView(EditorHost host, boolean codeMode)
    Creates the editor view. Subclasses override to supply a code or rich text view.

  - ### getView

    public Component getView()
    Returns the editing surface component to place in the editor container.

  - ### view

    protected EditorView view()
    Returns the underlying editor view.

  - ### isCodeMode

    protected boolean isCodeMode()
    True for a code editor backend.

  - ### cmd

    public void cmd(String name, String arg)

    Executes a one way command. Unknown commands are ignored so subclasses can add vocabulary without breaking the base.

    ###### Parameters

    - `name`: the command name

    - `arg`: the optional argument, may be null

  - ### query

    public String query(String name, String arg)

    Executes a query returning a string result. Unknown queries return an empty string.

    ###### Parameters

    - `name`: the query name

    - `arg`: the optional argument, may be null