Package de.xima.fc.form.common.models
Class XItemRenderCtx
- java.lang.Object
-
- de.xima.fc.form.common.models.XItemRenderCtx
-
public class XItemRenderCtx extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
XItemRenderCtx.XItemRenderCtxBuilder
-
Constructor Summary
Constructors Constructor Description XItemRenderCtx(XItemRenderData renderData, HashMap<String,com.hp.gagawa.java.FertileNode> parents, boolean designerPreview, boolean attributeW3CMode, boolean elementClassNameMode)
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addDynValues(IXItemPropertiesData item, String suffix, Map<String,List<String[]>> valuesMap)
Adds all values from the item with the given ID that are found in the values map to thegetDynValues()
map.void
addHtmlAttributes(com.hp.gagawa.java.Node node)
void
addValidationAttributes(com.hp.gagawa.java.Node node)
Deprecated.Validation rules are not registered with HTML attributes anymore.String
encodeXfAction(XButtonDescriptor buttonDescriptor, XButtonActionDescriptor action, Map<Serializable,Serializable> frqSessionMap)
IFormContainerMetaData
findRepetitionContainerMeta(IXItemPropertiesData item)
Makes a best attempt to find the repetition container for a given item.Map<String,? extends IFormContainerMetaData>
getDynFieldMap()
Note: Usually you should usefindRepetitionContainerMeta(IXItemPropertiesData)
to access the container meta.com.alibaba.fastjson.JSONObject
getDynValues()
The dynValues object contains the values of all repeated elements.XItemConditionProcessor
getItemRenderConditionProcessor()
IXFormRenderCallback
getRenderCallback()
Optional<IXForm>
getXForm()
Gets the form containing the item to be rendered, if such a form is available.boolean
isAttributeW3CMode()
boolean
isDesignerPreview()
boolean
isElementClassNameMode()
boolean
isLegacyUseOptionTextForAutocomplete()
boolean
isValidateSubmitAction()
void
registerParent(com.hp.gagawa.java.FertileNode node)
void
registerParent(String id, com.hp.gagawa.java.FertileNode node)
void
setAttributeW3CMode(boolean attributeW3CMode)
Deprecated.UseXItemRenderCtx.XItemRenderCtxBuilder
to configure an instance, do not mutate existing instances.
-
-
-
Constructor Detail
-
XItemRenderCtx
@Deprecated public XItemRenderCtx(XItemRenderData renderData, HashMap<String,com.hp.gagawa.java.FertileNode> parents, boolean designerPreview, boolean attributeW3CMode, boolean elementClassNameMode)
Deprecated.- Parameters:
renderData
- Item render data for the currently rendered item.parents
- Map between the ID of an element and its immediate parent, if any.designerPreview
- Whether the form is rendered within the form designer preview (as opposed to the live form users can fill in).attributeW3CMode
- Whether to comply with the W3C HTML spec. This is for backwards compatibility only, new elements should always be spec-compliant.elementClassNameMode
- Whether to add the name of the element as a CSS class.
-
-
Method Detail
-
registerParent
public void registerParent(String id, com.hp.gagawa.java.FertileNode node)
-
registerParent
public void registerParent(com.hp.gagawa.java.FertileNode node)
-
addHtmlAttributes
public void addHtmlAttributes(com.hp.gagawa.java.Node node)
-
getRenderCallback
public IXFormRenderCallback getRenderCallback()
-
addValidationAttributes
@Deprecated public void addValidationAttributes(com.hp.gagawa.java.Node node)
Deprecated.Validation rules are not registered with HTML attributes anymore. They are available via the global JSON objectXM_FORM_MODEL.validation.fields
on the client.- Parameters:
node
- HTML element to which to add the attributes.
-
isDesignerPreview
public boolean isDesignerPreview()
-
isValidateSubmitAction
public boolean isValidateSubmitAction()
-
isLegacyUseOptionTextForAutocomplete
public boolean isLegacyUseOptionTextForAutocomplete()
-
setAttributeW3CMode
@Deprecated public void setAttributeW3CMode(boolean attributeW3CMode)
Deprecated.UseXItemRenderCtx.XItemRenderCtxBuilder
to configure an instance, do not mutate existing instances.- Parameters:
attributeW3CMode
- The new value forisAttributeW3CMode()
.
-
isAttributeW3CMode
public boolean isAttributeW3CMode()
-
isElementClassNameMode
public boolean isElementClassNameMode()
- Returns:
true
if the name of the element should be added as a CSS style class,false
otherwise.
-
getDynFieldMap
public Map<String,? extends IFormContainerMetaData> getDynFieldMap()
Note: Usually you should usefindRepetitionContainerMeta(IXItemPropertiesData)
to access the container meta. That method has fallbacks in the map does not contain the metadata directly.- Returns:
- Map between the name of a repeated element and the metadata for the element repetition.
-
getDynValues
public com.alibaba.fastjson.JSONObject getDynValues()
The dynValues object contains the values of all repeated elements. These values are transmitted to the client, so that the values can be restored by the client side JavaScript, after the repeated elements were recreated on the client.The key is the ID of the item, e.g.
xi-tf-1
. The value is another map (JSONObject
) with all values for the repeated element. Each key of that map is a repetition ID (which may NOT start at 0 and may NOT be contiguous, seeordinal index and repetition ID
, with a dash at the beginning:_0
,_1
,_2
, ...). Each value of that map is either a string with the single value for that repetition, or aJSONArray
of strings with the values for that repetition. Furthermore, the map must also contain the special keysize
, which must be mapped to an integer indicating the total number of repetition. For example:{ "xi-tf-1": { "_0": "only one value", "size": 1 }, "xi-tf-2": { "_3": "Value a", "_9": "Value b", "_122": "Value c", "size": 3 }, "xi-tf-3": { "_6": [ "Value a1", "Value a2" ] "_33": [ "Value b1", "Value b2" ] "size": 2 } }
- Returns:
- A map with all repeated values.
-
getXForm
public Optional<IXForm> getXForm()
Gets the form containing the item to be rendered, if such a form is available. Note that items might be rendered in isolation, in which case no form might be available.- Returns:
- The form being rendered, if available.
-
getItemRenderConditionProcessor
public XItemConditionProcessor getItemRenderConditionProcessor()
- Returns:
- The processor for evaluating whether an item is available or disabled based on a state or user group.
-
addDynValues
public void addDynValues(IXItemPropertiesData item, String suffix, Map<String,List<String[]>> valuesMap)
Adds all values from the item with the given ID that are found in the values map to thegetDynValues()
map.- Parameters:
item
- A form item for which to add value.suffix
- Suffix that is added to theID
of the item.valuesMap
- The map with all submitted form element values.
-
findRepetitionContainerMeta
public IFormContainerMetaData findRepetitionContainerMeta(IXItemPropertiesData item)
Makes a best attempt to find the repetition container for a given item. First tries to look in thegetDynFieldMap()
. When none is found there, takes a look at theform model
and tries to find a matching container.- Parameters:
item
- Item to process.- Returns:
- The repetition container metadata, if available and the item is repeated.
-
encodeXfAction
public String encodeXfAction(XButtonDescriptor buttonDescriptor, XButtonActionDescriptor action, Map<Serializable,Serializable> frqSessionMap)
-
-