Class XItemRenderCtx


  • public class XItemRenderCtx
    extends Object
    • Constructor Detail

      • XItemRenderCtx

        @Deprecated
        public XItemRenderCtx​(XItemRenderData renderData,
                              HashMap<String,​com.hp.gagawa.java.FertileNode> parents,
                              boolean designerPreview,
                              boolean attributeW3CMode,
                              boolean elementClassNameMode)
        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)
      • 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 object XM_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()
      • 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.
      • 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, see ordinal 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 a JSONArray of strings with the values for that repetition. Furthermore, the map must also contain the special key size, 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 the getDynValues() map.
        Parameters:
        item - A form item for which to add value.
        suffix - Suffix that is added to the ID 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 the getDynFieldMap(). When none is found there, takes a look at the form 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.