- Direct Known Subclasses:
HtmlItemNumber,HtmlItemString
HtmlItem is a kind of "item". See naming-convention.md
So its ID should consist of itemKindIdClass and itemKindIdField.
It complies the rule, but itemKindIdClass can be empty.
When it's empty,
mainRootRecord in Form is used as itemKindIdClass as default.
Actually itemKindId 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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classStores one HtmlItem condition.static classStores multiple HtmlItem conditions.static enumIs the condition which decides isNotEmpty or not. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected HtmlItem.HtmlItemConditionContainer<Boolean> Shows whether the field allows empty.protected StringIs a class part (= left part) of itemKindId.protected StringIs a field part (= right part) of itemKindId.protected StringIs a class part (= left part) of itemNameKey.protected StringIs a field part (= right part) of itemNameKey.protected StringIs the ID string of htmlItem. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetIsNotEmpty(String loginState, SplibSecurityUtil.RolesAndAuthoritiesBean bean) Obtains isNotEmpty.getItemKindId(String rootRecordName) Returns itemKindId.getItemNameKey(String rootRecordName) ReturnsitemNameKeyvalue.isNotEmpty(boolean isNotEmpty) Sets isNotEmpty.isNotEmpty(HtmlItem.HtmlItemConditionKeyEnum authKind, String authString, boolean isNotEmpty) Sets isNotEmpty with the conditions ofHtmlItemConditionKeyEnum,authString.itemNameKey(String itemNameKey) SetsitemNameKeyand returns this for method chain.
-
Field Details
-
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 real propertyPath is "acc.name" or "acc.dept.name" where "acc" is the rootRecordName.
-
itemKindIdClass
Is a class part (= left part) of itemKindId. (like "acc" from itemKindId: "acc.name")It can be
null, thenrootRecordNameobtained from context is used. -
itemKindIdField
Is a field part (= right part) of itemKindId. (like "name" from itemKindId: "acc.name") -
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.propertieswith it. -
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.propertieswith 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 becomesfalseif you don't set this value.
-
-
Constructor Details
-
HtmlItem
Constructs a new instance withID.Generally propertyPath starts with a rootRecord (a record field name which is directly defined in a form) and should be like
user.nameoruser.dept.name. But it is also allowed that you can omit the top rootRecord part whenuseris the mainRootRecord, which meansnameordept.nameis 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:
itemPropertyPath- propertyPath, maybe without top mainRootRecord part. (when "user" is mainRootRecord, both user.name and name are accepted)
-
-
Method Details
-
getItemPropertyPath
-
getItemKindId
Returns itemKindId.itemKindId is built from itemKindIdClass and itemKindIdField.
When itemKindIdClass isnull, rootRecordName is used instead.- Parameters:
rootRecordName- rootRecordName- Returns:
- itemKindId
-
itemNameKey
SetsitemNameKeyand 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 isnull, rootRecordName is used instead.- Parameters:
itemNameKey- itemNameKey- Returns:
- HtmlItem
-
getItemNameKey
ReturnsitemNameKeyvalue.Its value is
nullmeans the item's original itemKindId is equal to itemNameKey.- Returns:
- itemKindIdFieldForName
-
isNotEmpty
Sets isNotEmpty.Set
truewhen 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 ofHtmlItemConditionKeyEnum,authString.When you set multiple conditions to it, the order matters. First condition prioritized.
- Parameters:
authKind- authKindauthString- authStringisNotEmpty- isNotEmpty- Returns:
- HtmlItem
-
getIsNotEmpty
Obtains isNotEmpty.- Parameters:
loginState- loginStatebean- bean- Returns:
- boolean
-