Interface ICodeeditor

    • Field Detail

      • DEFAULT

        static final ICodeeditor DEFAULT
        Constant for default attributes of this immutable component.
    • Method Detail

      • getWidgetClass

        default java.lang.String getWidgetClass()
        Returns the client widget class.

        Default: "zul.code.Codeeditor"

        Specified by:
        getWidgetClass in interface IComponent<ICodeeditor>
      • getValue

        default java.lang.String getValue()
        Returns the editor content.

        Default: an empty string.

      • withValue

        ICodeeditor withValue​(java.lang.String value)
        Returns a copy of this immutable component with the specified value.

        Sets the editor content.

        Parameters:
        value - the source code.

        Default: "".

        Returns:
        A modified copy of the this object
      • getLanguage

        @Nullable
        default java.lang.String getLanguage()
        Returns the syntax-highlight language, or null when it was reset to the default.

        Default: "plain".

      • withLanguage

        ICodeeditor withLanguage​(@Nullable
                                 java.lang.String language)
        Returns a copy of this immutable component with the specified language.

        Sets the syntax-highlight language.

        Parameters:
        language - one of plain, html, xml, java, javascript, css, json, sql, markdown.

        Default: "plain".

        Returns:
        A modified copy of the this object
        Throws:
        org.zkoss.zk.ui.WrongValueException - if language is not an accepted token.
      • isLineNumbers

        default boolean isLineNumbers()
        Returns whether the gutter line numbers are shown.

        Default: true.

      • withLineNumbers

        ICodeeditor withLineNumbers​(boolean lineNumbers)
        Returns a copy of this immutable component with the specified lineNumbers.

        Sets whether the gutter line numbers are shown.

        Parameters:
        lineNumbers - whether to show the line-number gutter.

        Default: true.

        Returns:
        A modified copy of the this object
      • getTabSize

        default int getTabSize()
        Returns the number of columns a tab character is rendered as.

        Default: 4.

      • withTabSize

        ICodeeditor withTabSize​(int tabSize)
        Returns a copy of this immutable component with the specified tabSize.

        Sets how many columns a tab character is rendered as. The indent character itself is always a tab; this only changes its displayed width.

        Parameters:
        tabSize - a positive column count.

        Default: 4.

        Returns:
        A modified copy of the this object
        Throws:
        org.zkoss.zk.ui.WrongValueException - if tabSize is less than 1.
      • getColorScheme

        @Nullable
        default java.lang.String getColorScheme()
        Returns the editor color scheme, or null when it was reset to the default.

        Default: "light".

      • withColorScheme

        ICodeeditor withColorScheme​(@Nullable
                                    java.lang.String colorScheme)
        Returns a copy of this immutable component with the specified colorScheme.

        Sets the editor color scheme. This is the editor's own light/dark surface, not the page theme selected through Themes.

        Parameters:
        colorScheme - either "light" or "dark".

        Default: "light".

        Returns:
        A modified copy of the this object
        Throws:
        org.zkoss.zk.ui.WrongValueException - if colorScheme is neither.
      • of

        static ICodeeditor of​(java.lang.String value)
        Returns the instance with the given content.
        Parameters:
        value - The source code to edit
      • ofId

        static ICodeeditor ofId​(java.lang.String id)
        Returns the instance with the given id.
        Parameters:
        id - The id to identify this component