Class JavaScriptWriter

java.lang.Object
org.ujorm.tools.web.ajax.JavaScriptWriter
All Implemented Interfaces:
CharSequence, Injector

public class JavaScriptWriter extends Object implements Injector
A prototype of ES6 Vanilla Javascript Writer of the Ujorm framework.
Author:
Pavel Ponec
  • Field Details

    • DEFAULT_AJAX_REQUEST_PARAM

      public static final HttpParameter DEFAULT_AJAX_REQUEST_PARAM
      Default AJAX request parameter name
    • DEFAULT_SORT_REQUEST_PARAM

      public static final HttpParameter DEFAULT_SORT_REQUEST_PARAM
      Default AJAX request parameter name
    • DEFAULT_DELAY

      public static final Duration DEFAULT_DELAY
      Default duration
    • DEFAULT_TIMEOUT

      public static final Duration DEFAULT_TIMEOUT
      Default timeou
    • ajaxRequestParam

      protected final HttpParameter ajaxRequestParam
      Javascript ajax request parameter
    • sortRequestParam

      protected final HttpParameter sortRequestParam
      Javascript ajax request parameter
    • inputCssSelectors

      protected final CharSequence[] inputCssSelectors
      Input selectors
    • idleDelay

      @NotNull protected @NotNull Duration idleDelay
      An AJAX delay to the input request
    • ajaxTimeout

      @NotNull protected @NotNull Duration ajaxTimeout
      An AJAX timeout of the input response
    • formCssSelector

      protected String formCssSelector
      Form selector
    • onLoadSubmit

      protected boolean onLoadSubmit
      On load submit request
    • newLine

      protected CharSequence newLine
      New line characters
    • errorSelector

      @Nullable protected @Nullable CharSequence errorSelector
      An error message selector
    • errorMessage

      @NotNull protected @NotNull CharSequence errorMessage
      A subtitle selector
    • version

      protected int version
      JavaScript version number
    • ajaxRequestPath

      protected String ajaxRequestPath
      Javascript ajax request parameter
    • fceOrder

      protected int fceOrder
      Function order of name
    • isAjax

      protected boolean isAjax
      Ajax support
  • Constructor Details

    • JavaScriptWriter

      public JavaScriptWriter()
    • JavaScriptWriter

      public JavaScriptWriter(@NotNull @NotNull CharSequence... inputSelectors)
    • JavaScriptWriter

      public JavaScriptWriter(@NotNull @NotNull Duration idleDelay, @NotNull @NotNull HttpParameter ajaxRequestParam, @NotNull @NotNull HttpParameter sortRequestParam, @NotNull @NotNull CharSequence... inputSelectors)
  • Method Details

    • setFormSelector

      public JavaScriptWriter setFormSelector(String formSelector)
    • setOnLoadSubmit

      public JavaScriptWriter setOnLoadSubmit(boolean onLoadSubmit)
    • setNewLine

      public JavaScriptWriter setNewLine(@NotNull @NotNull CharSequence newLine)
    • setSubtitleSelector

      public JavaScriptWriter setSubtitleSelector(CharSequence errorSelector)
      Assign error message CSS selector
    • setErrorMessage

      public JavaScriptWriter setErrorMessage(@Nullable @Nullable CharSequence errorMessage)
      Assign an AJAX error message
    • setAjaxTimeout

      public JavaScriptWriter setAjaxTimeout(@NotNull @NotNull Duration ajaxTimeout)
      An AJAX timeout to get a response
    • setIdleDelay

      public JavaScriptWriter setIdleDelay(@NotNull @NotNull Duration idleDelay)
      An AJAX delay to the input request
    • setAjaxRequestPath

      public JavaScriptWriter setAjaxRequestPath(@NotNull @NotNull String ajaxRequestPath)
      Assign an AJAX timeout
    • setVersion

      public JavaScriptWriter setVersion(int version)
      Assign an AJAX timeout
    • setSortable

      public JavaScriptWriter setSortable(int fceOrder)
      Set a function order
    • getFceOrder

      public int getFceOrder()
      Set a function order name
    • setAjax

      public JavaScriptWriter setAjax(boolean ajax)
      Set a function order
    • isAjax

      public boolean isAjax()
      Set a function order name
    • write

      public void write(@NotNull @NotNull Element parent)
      Description copied from interface: Injector
      Performs this operation on the given argument.
      Specified by:
      write in interface Injector
      Parameters:
      parent - An element to write
    • scriptTemplate

      protected String scriptTemplate()
    • write

      public void write(@NotNull @NotNull Element parent, Map<String,String> functionMap)
      Write Javascript body for the AJAX support.