Class HtmlItem

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

public class HtmlItem extends Object
Stores attributes of each html component which controls the behaviors of it in html pages.

HtmlItem is a kind of "item". See naming-convention.md So its ID should consist of itemIdClass and itemIdField.
It complies the rule, but itemIdClass can be empty. When it's empty, mainRootRecord in Form is used as itemIdClass as default.

Actually itemId cannot designate a unique location. There can be multiple location as a relation or relation of relation. To have a way to pinpoint the location of the form, it also has propertyPath. It can be empty for normal use, but you can make differences when you want.

  • Field Details

    • propertyPath

      protected String propertyPath
      propertyPath.
    • itemIdField

      @Nonnull protected String itemIdField
      Is an ID which the root record name plus dot (like "acc.") is removed from the itemId.
    • itemIdFieldForName

      protected String itemIdFieldForName
      Is an itemIdField used to display the name of the item.

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

    • isNotEmpty

      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 have to set this value.

  • Constructor Details

    • HtmlItem

      public HtmlItem(String propertyPath)
      Constructs a new instance with ID.

      Generally propertyPath starts with a rootRecord (a record field name which is directly defined in a form) and should be like user.name or user.dept.name. It is allowed that you can omit the top rootRecord part when user is the mainRootRecord, which means name or dept.name is also okay. When creating html htmlItems are searched with propertyPath, and if nothing found, mainRootRecord is automatically added to the top of propertyPath and search again.

      Parameters:
      propertyPath - propertyPath, maybe without top mainRootRecord part. (when "user" is mainRootRecord, both user.name and name are accepted)
  • Method Details

    • getPropertyPath

      public String getPropertyPath()
    • getItemIdField

      public String getItemIdField()
    • itemIdFieldForName

      public HtmlItem itemIdFieldForName(String itemIdFieldForName)
      Sets itemIdFieldForName and returns this for method chain.
      Parameters:
      itemIdFieldForName - itemIdFieldForName
      Returns:
      HtmlItem
    • getItemIdFieldForName

      public String getItemIdFieldForName()
      Returns itemIdFieldForName value.

      Its value is null means the item's original itemId is equal to itemIdFieldForName.

      Returns:
      itemIdFieldForName
    • isNotEmpty

      public HtmlItem isNotEmpty(boolean isNotEmpty)
      Sets isNotEmpty.

      Set true when you want to the item is required.

      Parameters:
      isNotEmpty - isNotEmpty
      Returns:
      HtmlItem
    • isNotEmpty

      public HtmlItem isNotEmpty(HtmlItem.HtmlItemConditionKeyEnum authKind, String authString, boolean isNotEmpty)
      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