Class SplibThymeleafOptionUtil

java.lang.Object
jp.ecuacion.splib.web.util.SplibThymeleafOptionUtil

@Component("optUtil") public class SplibThymeleafOptionUtil extends Object
Analyzes options specified with html components.

It's called from thymeleaf.
Options are in the format of csv and receives multiple optional attributes. It's written like 'readonly,required'.
It also receives key value parameter like 'readonly,a=b,required'.

  • Constructor Details

    • SplibThymeleafOptionUtil

      public SplibThymeleafOptionUtil(jakarta.servlet.http.HttpServletRequest request)
      Constructs a new instance.
      Parameters:
      request - request
  • Method Details

    • getDeleteConfirmMessage

      public String getDeleteConfirmMessage(String rootRecordName, String itemDisplayedOnDelete)
      Provides message string shown when the delete button pressed.

      itemDisplayedOnDeleteには、通常は一つのitemを指定するが、"itemA,itemB"のように複数の項目を指定することも可能。 (natural keyが複数の項目からなる場合に使用) その場合は、(itemA, itemB) : (1, 2) のように括弧で括った形で表現

    • hasKey

      public boolean hasKey(String options, String key)
      Returns if specified key exists in options.
    • getValue

      public String getValue(String options, String key)
      Returns value obtained from the key.
      Parameters:
      options - options
      key - key
      Returns:
      value
    • getValueOrElse

      public String getValueOrElse(String options, String key, String defaultValue)
      Returns value obtained from the key, or defaultValue when the key does not exist in the properties file.
      Parameters:
      options - options
      key - key
      defaultValue - defaultValue
      Returns:
      value
    • isReadOnly

      public boolean isReadOnly(String options)
      Returns whether the options contain readonly.
      Parameters:
      options - options
      Returns:
      boolean
    • isDisabled

      public boolean isDisabled(String options)
      Returns whether the options contain disabled.
      Parameters:
      options - options
      Returns:
      boolean
    • isDeleted

      public boolean isDeleted(String options)
      Returns whether the options contain deleted.
      Parameters:
      options - options
      Returns:
      boolean
    • isForSwitch

      public boolean isForSwitch(String options)
      Returns whether the options contain forSwitch.
      Parameters:
      options - options
      Returns:
      boolean
    • needsEmptyOption

      public boolean needsEmptyOption(String options)
      Returns whether the options contain noEmptyOption.
      Parameters:
      options - options
      Returns:
      boolean
    • needsOnclickJs

      public boolean needsOnclickJs(String options)
      Returns whether the options contain onClickJs.
      Parameters:
      options - options
      Returns:
      boolean
    • hasLinkUrl

      public boolean hasLinkUrl(String options)
      Returns whether the options contain linkUrl.
      Parameters:
      options - options
      Returns:
      boolean
    • getLinkUrl

      public String getLinkUrl(String options)
      Returns linkUrl.
      Parameters:
      options - options
      Returns:
      linkUrl
    • hasThSortable

      public boolean hasThSortable(String options)
      Returns whether the options contain thSortable.
      Parameters:
      options - options
      Returns:
      boolean