Class View.Builder<B extends View.Builder<B>>

Type Parameters:
B - the type of the Builder that is returned
All Implemented Interfaces:
Accessible.Builder<B>, Scrollable.Builder<B>, BuilderInterface
Direct Known Subclasses:
Map.Builder
Enclosing class:
View

public static class View.Builder<B extends View.Builder<B>> extends TextView.Builder<B> implements Accessible.Builder<B>, Scrollable.Builder<B>
Inner class implementing a builder pattern to construct a GObject with properties.
  • Constructor Details

    • Builder

      protected Builder()
      Default constructor for a Builder object.
  • Method Details

    • build

      public View build()
      Finish building the View object. This will call GObject.withProperties(Type, String[], Value[]) to create a new GObject instance, which is then cast to View.
      Overrides:
      build in class TextView.Builder<B extends View.Builder<B>>
      Returns:
      a new instance of View with the properties that were set in the Builder object.
    • setAutoIndent

      public B setAutoIndent(boolean autoIndent)
    • setBackgroundPattern

      public B setBackgroundPattern(BackgroundPatternType backgroundPattern)
      Draw a specific background pattern on the view.
      Parameters:
      backgroundPattern - the value for the background-pattern property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setEnableSnippets

      public B setEnableSnippets(boolean enableSnippets)

      The property denotes if snippets should be expanded when the user presses Tab after having typed a word matching the snippets found in SnippetManager.

      The user may tab through focus-positions of the snippet if any are available by pressing Tab repeatedly until the desired focus position is selected.

      Parameters:
      enableSnippets - the value for the enable-snippets property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setHighlightCurrentLine

      public B setHighlightCurrentLine(boolean highlightCurrentLine)
    • setIndentOnTab

      public B setIndentOnTab(boolean indentOnTab)
    • setIndentWidth

      public B setIndentWidth(int indentWidth)
      Width of an indentation step expressed in number of spaces.
      Parameters:
      indentWidth - the value for the indent-width property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setIndenter

      public B setIndenter(Indenter indenter)
      The property is a Indenter to use to indent as the user types into the View.
      Parameters:
      indenter - the value for the indenter property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setInsertSpacesInsteadOfTabs

      public B setInsertSpacesInsteadOfTabs(boolean insertSpacesInsteadOfTabs)
    • setRightMarginPosition

      public B setRightMarginPosition(int rightMarginPosition)
      Position of the right margin.
      Parameters:
      rightMarginPosition - the value for the right-margin-position property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setShowLineMarks

      public B setShowLineMarks(boolean showLineMarks)
      Whether to display line mark pixbufs
      Parameters:
      showLineMarks - the value for the show-line-marks property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setShowLineNumbers

      public B setShowLineNumbers(boolean showLineNumbers)
      Whether to display line numbers
      Parameters:
      showLineNumbers - the value for the show-line-numbers property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setShowRightMargin

      public B setShowRightMargin(boolean showRightMargin)
      Whether to display the right margin.
      Parameters:
      showRightMargin - the value for the show-right-margin property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSmartBackspace

      public B setSmartBackspace(boolean smartBackspace)
      Whether smart Backspace should be used.
      Parameters:
      smartBackspace - the value for the smart-backspace property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setSmartHomeEnd

      public B setSmartHomeEnd(SmartHomeEndType smartHomeEnd)
      Set the behavior of the HOME and END keys.
      Parameters:
      smartHomeEnd - the value for the smart-home-end property
      Returns:
      the Builder instance is returned, to allow method chaining
    • setTabWidth

      public B setTabWidth(int tabWidth)
      Width of a tab character expressed in number of spaces.
      Parameters:
      tabWidth - the value for the tab-width property
      Returns:
      the Builder instance is returned, to allow method chaining
    • onChangeCase

      public B onChangeCase(View.ChangeCaseCallback handler)
      Keybinding signal to change case of the text at the current cursor position.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onChangeNumber

      public B onChangeNumber(View.ChangeNumberCallback handler)
      Keybinding signal to edit a number at the current cursor position.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onJoinLines

      public B onJoinLines(View.JoinLinesCallback handler)
      Keybinding signal to join the lines currently selected.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onLineMarkActivated

      public B onLineMarkActivated(View.LineMarkActivatedCallback handler)

      Emitted when a line mark has been activated (for instance when there was a button press in the line marks gutter).

      You can use iter to determine on which line the activation took place.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onMoveLines

      public B onMoveLines(View.MoveLinesCallback handler)

      The signal is a keybinding which gets emitted when the user initiates moving a line.

      The default binding key is Alt+Up/Down arrow. And moves the currently selected lines, or the current line up or down by one line.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onMoveToMatchingBracket

      public B onMoveToMatchingBracket(View.MoveToMatchingBracketCallback handler)
      Keybinding signal to move the cursor to the matching bracket.
      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onMoveWords

      public B onMoveWords(View.MoveWordsCallback handler)

      The signal is a keybinding which gets emitted when the user initiates moving a word.

      The default binding key is Alt+Left/Right Arrow and moves the current selection, or the current word by one word.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onPushSnippet

      public B onPushSnippet(View.PushSnippetCallback handler)

      The signal is emitted to insert a new snippet into the view.

      If another snippet was active, it will be paused until all focus positions of snippet have been exhausted.

      location will be updated to point at the end of the snippet.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onShowCompletion

      public B onShowCompletion(View.ShowCompletionCallback handler)

      The signal is a key binding signal which gets emitted when the user requests a completion, by pressing Controlspace.

      This will create a CompletionContext with the activation type as CompletionActivation.USER_REQUESTED.

      Applications should not connect to it, but may emit it with GObjects#signalEmitByName if they need to activate the completion by another means, for example with another key binding or a menu entry.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also:
    • onSmartHomeEnd

      public B onSmartHomeEnd(View.SmartHomeEndCallback handler)

      Emitted when a the cursor was moved according to the smart home end setting.

      The signal is emitted after the cursor is moved, but during the Gtk.TextView::move-cursor action. This can be used to find out whether the cursor was moved by a normal home/end or by a smart home/end.

      Parameters:
      handler - the signal handler
      Returns:
      the Builder instance is returned, to allow method chaining
      See Also: