Class TextPanel

    • Field Detail

      • editor

        public final TextEditor editor
        Text editor.
      • hist

        public final History hist
        Undo history.
      • search

        protected SearchBar search
        Search bar.
    • Constructor Detail

      • TextPanel

        public TextPanel​(BaseXWindow win,
                         boolean editable)
        Default constructor.
        Parameters:
        win - parent window
        editable - editable flag
      • TextPanel

        public TextPanel​(BaseXWindow win,
                         String text,
                         boolean editable)
        Default constructor.
        Parameters:
        win - parent window
        text - initial text
        editable - editable flag
    • Method Detail

      • setText

        public void setText​(String t)
        Sets the output text.
        Parameters:
        t - output text
      • setText

        public void setText​(byte[] t)
        Sets the output text.
        Parameters:
        t - output text
      • searchString

        public final String searchString()
        Returns a currently marked string if it does not extend over more than one line.
        Returns:
        search string
      • pos

        public final int[] pos()
        Returns the line and column of the current caret position.
        Returns:
        line/column
      • setText

        public final void setText​(byte[] text,
                                  int size)
        Sets the output text.
        Parameters:
        text - output text
        size - text size
      • setSyntax

        protected final void setSyntax​(IO file,
                                       boolean opened)
        Sets a syntax highlighter, based on the file format.
        Parameters:
        file - file reference
        opened - indicates if file was opened from disk
      • isEditable

        public final boolean isEditable()
        Returns the editable flag.
        Returns:
        boolean result
      • setSyntax

        public final void setSyntax​(org.basex.gui.text.Syntax syntax)
        Sets a syntax highlighter.
        Parameters:
        syntax - syntax reference
      • setCaret

        public final void setCaret​(int pos)
        Sets the caret to the specified position. A text selection will be removed.
        Parameters:
        pos - caret position
      • getText

        public final byte[] getText()
        Returns the output text.
        Returns:
        output text
      • selected

        public final boolean selected()
        Tests if text has been selected.
        Returns:
        result of check
      • resetError

        public final void resetError()
        Removes the error marker.
      • error

        public final void error​(int pos)
        Sets the error marker.
        Parameters:
        pos - start of optional error mark
      • comment

        public final void comment()
        Adds or removes a comment.
      • toCase

        public final void toCase​(TextEditor.Case cs)
        Case conversion.
        Parameters:
        cs - case type
      • bracket

        public final void bracket()
        Jumps to a matching bracket.
      • sort

        public final void sort()
        Sorts text.
      • format

        public final void format()
        Formats the selected text.
      • setEnabled

        public final void setEnabled​(boolean enabled)
        Overrides:
        setEnabled in class JComponent
      • setLinkListener

        public final void setLinkListener​(LinkListener ll)
        Installs a link listener.
        Parameters:
        ll - link listener
      • getSearch

        public final SearchBar getSearch()
        Returns the search bar.
        Returns:
        search bar
      • jump

        protected final void jump​(SearchBar.SearchDir dir,
                                  boolean select)
        Jumps to the current, next or previous search string.
        Parameters:
        dir - search direction
        select - select hit
      • release

        protected void release​(TextPanel.Action action)
        Releases a key or mouse. Can be overwritten to react on events.
        Parameters:
        action - action
      • refreshLayout

        public final void refreshLayout​(Font f)
        Refreshes the layout.
        Parameters:
        f - used font