Class HtmlItem

java.lang.Object
jp.ecuacion.splib.web.bean.HtmlItem
Direct Known Subclasses:
HtmlItemNumber, HtmlItemString

public class HtmlItem extends Object
Stores attributes of an html component which control the behaviors of the component in html pages.

HtmlItem is a kind of "item"s. See naming-convention.md

  • Field Details

    • itemPropertyPath

      @Nonnull protected String itemPropertyPath
      Is the ID string of htmlItem.

      rootRecordName part (= far left part) can be omitted. Namely it can be "name" or "dept.name" when the propertyPath with rootRecordName added (= also called "recordPropertyPath") is "acc.name" or "acc.dept.name" where "acc" is the rootRecordName.

    • itemKindIdClass

      protected String itemKindIdClass
      Is a class part (= left part) of itemKindId. (like "acc" from itemKindId: "acc.name")

      It can be null, then rootRecordName obtained from context is used.

    • itemKindIdField

      @Nonnull protected String itemKindIdField
      Is a field part (= right part) of itemKindId. (like "name" from itemKindId: "acc.name")
    • itemNameKeyClass

      protected String itemNameKeyClass
      Is a class part (= left part) of itemNameKey. (like "acc" from itemKindId: "acc.name")

      The display name can be obtained by referring item_names.properties with it.

    • itemNameKeyField

      protected String itemNameKeyField
      Is a field part (= right part) of itemNameKey. (like "name" from itemKindId: "acc.name")

      The display name can be obtained by referring item_names.properties with it.

    • isRequired

      Shows whether the field allows empty.

      When this value is true, required validation is executed on server side, and shows "required" mark on the component in the html page.

      It doesn't depend on the data type.

      The default value is preset: false. So the value becomes false if you don't set this value.

    • isRequiredOnSearch

      protected HtmlItem.HtmlItemConditionContainer<Boolean> isRequiredOnSearch
  • Constructor Details

    • HtmlItem

      public HtmlItem(@RequireNonempty String itemPropertyPath)
      Constructs a new instance with itemPropertyPath.

      Generally propertyPath starts with a rootRecord (a record field name which is directly defined in a form), which should be like user.name or user.dept.name. (It's called recordPropertyPath in the library.)
      But here you need to set itemPropertyPath, which is a propertyPath with rootRecordName + "." removed at the start part of it.

      You cannot set recordPropertyPath here. Setting it is considered as a duplication of rootRecordName.

      Parameters:
      itemPropertyPath - itemPropertyPath
  • Method Details

    • getItemPropertyPath

      public String getItemPropertyPath()
    • getItemKindId

      public String getItemKindId(String rootRecordName)
      Returns itemKindId.

      itemKindId is built from itemKindIdClass and itemKindIdField.
      When itemKindIdClass is null, rootRecordName is used as itemKindIdClass instead.

      Parameters:
      rootRecordName - rootRecordName
      Returns:
      itemKindId
    • itemNameKey

      public HtmlItem itemNameKey(@RequireNonempty String itemNameKey)
      Sets itemNameKey and returns this for method chain.

      The format of itemNameKey is the same as itemKindId, which is like "acc.name", always has one dot (not more than one) in the middle of the string.
      But the argument of the method can be like "name". In that case itemKindIdClass is used instead. When itemKindIdClass is null, rootRecordName is used instead.

      Parameters:
      itemNameKey - itemNameKey
      Returns:
      HtmlItem
    • getItemNameKey

      public String getItemNameKey(String rootRecordName)
      Returns itemNameKey value.

      Its value is null means the item's original itemKindId is equal to itemNameKey.

      Returns:
      itemKindIdFieldForName
    • required

      public HtmlItem required()
      Sets required = true.
      Returns:
      HtmlItem
    • required

      public HtmlItem required(boolean isRequired)
      Sets required.
      Returns:
      HtmlItem
    • required

      public HtmlItem required(HtmlItem.HtmlItemConditionKeyEnum authKind, String authString, boolean isRequired)
      Sets isRequired with the conditions of HtmlItemConditionKeyEnum, authString.

      When you set multiple conditions to it, the order matters. First condition prioritized.

      Parameters:
      authKind - authKind
      authString - authString
      isRequired - isRequired
      Returns:
      HtmlItem
    • requiredOnSearch

      public HtmlItem requiredOnSearch(boolean isRequired)
      Sets required.
      Returns:
      HtmlItem
    • requiredOnSearch

      public HtmlItem requiredOnSearch(HtmlItem.HtmlItemConditionKeyEnum authKind, String authString, boolean isRequired)
      Sets isRequiredOnSearch with the conditions of HtmlItemConditionKeyEnum, authString.

      When you set multiple conditions to it, the order matters. First condition prioritized.

      Parameters:
      authKind - authKind
      authString - authString
      isRequired - isRequired
      Returns:
      HtmlItem
    • getRequiredOnSearch

      public boolean getRequiredOnSearch(String loginState, SplibSecurityUtil.RolesAndAuthoritiesBean bean)
      Obtains isNotEmpty.
      Parameters:
      loginState - loginState
      bean - bean
      Returns:
      boolean
    • isNotEmpty

      @Deprecated public HtmlItem isNotEmpty(boolean isNotEmpty)
      Deprecated.
      Sets isNotEmpty.

      Set true when you want to the item is required.

      Parameters:
      isNotEmpty - isNotEmpty
      Returns:
      HtmlItem
    • isNotEmpty

      @Deprecated public HtmlItem isNotEmpty(HtmlItem.HtmlItemConditionKeyEnum authKind, String authString, boolean isNotEmpty)
      Deprecated.
      Sets isNotEmpty with the conditions of HtmlItemConditionKeyEnum, authString.

      When you set multiple conditions to it, the order matters. First condition prioritized.

      Parameters:
      authKind - authKind
      authString - authString
      isNotEmpty - isNotEmpty
      Returns:
      HtmlItem
    • getIsNotEmpty

      public boolean getIsNotEmpty(String loginState, SplibSecurityUtil.RolesAndAuthoritiesBean bean)
      Obtains isNotEmpty.
      Parameters:
      loginState - loginState
      bean - bean
      Returns:
      boolean