Class AbstractInputBuilder<T extends AbstractInputBuilder,​VT>

    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected abstract Object _getInput()  
      T addOrUpdateInput​(CalculableLineItemCollectionBuilder clicBuilder, String lineId)
      Adds (or updates) this input field (defined by this builder) to the specified header line item.
      T addToConfiguratorEntry​(ConfiguratorEntry ce)
      Adds the input field (defined by this builder) to the specified form field set/section (ConfiguratorEntry).
      T addToConfiguratorEntry​(ConfiguratorEntry ce, Closure defaultValue)
      Adds the input field (defined by this builder) to the specified form field set/section (ConfiguratorEntry).
      ContextParameter buildContextParameter()
      Builds and returns the input field definition object.
      Map<String,​Object> buildMap()
      Builds a map with input field definition.
      Object getInput()
      Builds the input field definition (ContextParameter) - the object representation of the input field.
      T setAccessCode​(String accessCode)
      N/A - the method has not been implemented in the user interface yet.
      T setAlign​(String align)
      N/A - the method has not been implemented in the user interface yet.
      T setAlwaysEditable​(Boolean ae)
      Sets the input field as always editable.
      Always editable input fields are supported in Unity UI only (not supported in Classic UI).
      Enables a user to update the input field after the Quote, Contract, or Rebate Agreement have been submitted.
      T setAppearance​(String appearance)
      N/A - the method has not been implemented in the user interface yet.
      T setAutoComplete​(boolean autoComplete)
      N/A - the method has not been implemented in the user interface yet.
      T setAutoFocus​(boolean autoFocus)
      If this is set to true, browser scrolls to the element when the page is loaded and automatically focuses it (places a cursor into the input field).
      On the given page the autofocus should be placed in only one input.
      T setCaption​(String caption)
      N/A - the method has not been implemented in the user interface yet.
      T setConfigValues​(List<String> configValues)
      Adds values to the input field (parameter).
      T setCustomAttributeName​(String name)
      Creates the custom name data attribute in the form's HTML.
      T setCustomAttributeValue​(String value)
      Creates the custom value data attribute in the form's HTML.
      T setDisabled​(boolean disabled)
      N/A - the method has not been implemented in the user interface yet.
      T setDisplayMode​(String displayMode)
      N/A - the method has not been implemented in the user interface yet.
      T setErrorMessage​(String msg)
      N/A - the method has not been implemented in the user interface yet.
      T setExportable​(boolean exportable)
      N/A - the method has not been implemented in the user interface yet.
      T setFlex​(int flex)
      When more input fields are placed side by side (using the row layout, via RowInputBuilder), the "flex" value sets how much space should this input field occupy (proportionally) with respect to the other inputs on the same row.
      T setHelpLink​(String helpLink)
      Displays a question mark icon next to the field label and displays the "Learn more" link when a user hovers the mouse over the icon.
      T setHelpText​(String helpText)
      Displays a question mark icon next to the input field label and displays the specified helpText when a user hovers the mouse over this icon.
      T setIcon​(String icon)
      N/A - the method has not been implemented in the user interface yet.
      T setIconPosition​(String iconPosition)
      N/A - the method has not been implemented in the user interface yet.
      T setImportable​(boolean importable)
      N/A - the method has not been implemented in the user interface yet.
      T setLabel​(String label)
      Sets the specified text as a label of the input field.
      T setLabelPlacement​(String labelPlacement)
      N/A - the method has not been implemented in the user interface yet.
      T setLabelStyle​(String labelStyle)
      N/A - the method has not been implemented in the user interface yet.
      T setLabelTranslations​(Map<String,​String> translations)
      Sets the translation of the label.
      T setLayoutGridName​(String layoutGridName)
      N/A - the method has not been implemented in the user interface yet.
      T setNoRefresh​(boolean noRefresh)
      Prevents the Configurator refresh when the value of the field is changed.
      By default, the Configurator form will refresh every time when some input value is changed by the user, i.e.
      T setParameterGroup​(String pg)
      Creates collapsible sections to organize input fields in the UI.
      T setPlaceholderText​(String text)
      Places the specified text to the input field as a placeholder.
      T setReadOnly​(Boolean ro)
      Sets the input field as read-only.
      T setRequired​(Boolean required)
      Sets the input field as mandatory.
      T setSize​(String size)
      N/A - the method has not been implemented in the user interface yet.
      T setSuccessMessage​(String msg)
      N/A - the method has not been implemented in the user interface yet.
      T setTheme​(String theme)
      N/A - the method has not been implemented in the user interface yet.
      T setTitle​(String title)
      Displays the specified text as a tooltip when a user hovers mouse over the input field label.
      T setUserGroupEdit​(String uge)
      N/A - the method has not been implemented in the user interface yet.
      T setUserGroupView​(String ugv)
      N/A - the method has not been implemented in the user interface yet.
      T setValue​(VT value)
      Prefills the input field with the specified value.
      For line item logics (on Quotes, Rebates, Price Lists,...) works in the syntax-check mode only and has no effect in the regular execution mode.
      Warning: if used on headers or configurators the value prefilled by the setValue will overwrite a user-entered value when the user clicks the Recalculate button (Header), or jumps to another line/closes the dialog (Configurator).
      T setValueHint​(String valueHint)
      Adds the specified hint next to the input field.
      T setWarningMessage​(String msg)
      N/A - the method has not been implemented in the user interface yet.
    • Method Detail

      • _getInput

        protected abstract Object _getInput()
      • getInput

        public final Object getInput()

        Builds the input field definition (ContextParameter) - the object representation of the input field. This should be called as last operation, after you did set all the various properties of the input field.

        When executed in Syntax Check mode, this method also puts the input field definition to logic context, and once the logic finishes, the engine reads the definitions of the input fields from that context. Then they're usually rendered on the UI.

        When executed in regular execution, it returns the value entered by user in UI - so you could potentially use this function also to read the entered value. But we suggest to use the binding variable input or method api.input()

        Use this method only in line items logics ( quote/contract/rebate item, price list/live price list logic, calculated field set logic, dataload row context logic ), and dashboards logic to build filters.

        Do not use it in header logics, and configurator forms, because those are using different methods to build/add the input field.

        Example:

         if (api.isSyntaxCheck()) {
             api.inputBuilderFactory()
                     .createMultiTierEntryInputBuilder("MultiTier")
                     .setLabel("MultiTier")
                     .setValue([
                         "10" : "20",
                         "20" : "40"
                     ])
                     .getInput()
         } else {
             api.input("MultiTier")
         }
         
        Returns:
        In Syntax Check mode, the returned value is a random value. In regular execution, it returns the value of the input field (which is usually entered by user in UI). The value could be stored in a special object.
        Since:
        5.1 - Collins
      • setLabel

        public T setLabel​(String label)
        Sets the specified text as a label of the input field. The label is usually displayed above, or next to the input field.

        Example:

          def userEntry = api.inputBuilderFactory()
                             .createOptionEntry("Country")
                             .setLabel("Select Country")
                             .setOptions(["CZ", "DE", "UK"])
                             .getInput()
         
        Parameters:
        label - The text that is displayed as a label of the input field.
        Since:
        5.1 - Collins
      • setLabelTranslations

        public T setLabelTranslations​(Map<String,​String> translations)
        Sets the translation of the label.

        If the label translation is specified for a specific language then this translation is used when the UI is switched into that language.

        If the 2-letter language code string is left empty, it will be used as default translation in case the UI is switched to a language, for which you did not supply the corresponding translation.

        Example:

         def ce = api.createConfiguratorEntry()
        
         api.inputBuilderFactory()
              .createStringUserEntry("InputFieldName")
              .setLabel("English label")
              .setLabelTranslations(
              [
              "de": "Deutsche Bezeichnung",
              "es": "Etiqueta espaƱola"
              ]
              )
              .addToConfiguratorEntry(ce)
         return ce
         
        Parameters:
        translations - The map that defines language codes (2-letter ISO 639-1) and input field labels.
        Since:
        5.2 - Collins
        See Also:
        Supported languages, How to Set Locale via URL
      • setRequired

        public T setRequired​(Boolean required)
        Sets the input field as mandatory.

        The field is marked with an asterisk (*) in the user interface. The user must enter a value to this input field otherwise the form (in any location - e.g., header, dashboard, line item, etc.) cannot be submitted (or settings applied, where applicable).
        If a pop-up Configurator includes a required input and the user does not open it, the user will be able to save the document even though the input is not filled in. The reason is that the application is not able to check if there is a required input until the user opens the Configurator.

        The default value: false

        Parameters:
        required - Set to true to mark the input field as required in the user interface.
        Since:
        6.2 - Vesper
      • setReadOnly

        public T setReadOnly​(Boolean ro)
        Sets the input field as read-only.

        The user cannot enter or edit the value in this field.

        The default value: false

        Parameters:
        ro - Set to true to set the input field as read-only.
        Since:
        6.2 - Vesper
      • setAlwaysEditable

        public T setAlwaysEditable​(Boolean ae)
        Sets the input field as always editable.
        Always editable input fields are supported in Unity UI only (not supported in Classic UI).
        Enables a user to update the input field after the Quote, Contract, or Rebate Agreement have been submitted.

        Note: If the user has the DataIntegration user role assigned, this method may not work correctly.

        The default value: false

        Parameters:
        ae - Set to true to set the input field as always editable.
        Since:
        6.2 - Vesper
      • setValue

        public T setValue​(VT value)
        Prefills the input field with the specified value.
        For line item logics (on Quotes, Rebates, Price Lists,...) works in the syntax-check mode only and has no effect in the regular execution mode.
        Warning: if used on headers or configurators the value prefilled by the setValue will overwrite a user-entered value when the user clicks the Recalculate button (Header), or jumps to another line/closes the dialog (Configurator).

        Parameters:
        value - The value to be set as default in the input field.
        Since:
        5.1 - Collins
      • setValueHint

        public T setValueHint​(String valueHint)
        Adds the specified hint next to the input field.

        Note: This method is available only for MultiTierEntry.

        Parameters:
        valueHint - The text content of the hint.
      • setNoRefresh

        public T setNoRefresh​(boolean noRefresh)
        Prevents the Configurator refresh when the value of the field is changed.
        By default, the Configurator form will refresh every time when some input value is changed by the user, i.e. the Configurator logic will be executed again and the content of the form will be refreshed. If this is an issue for you (e.g., slowing down your work), you can disable the auto-refresh using the setNoRefresh method.
        This option is supported by all input types.

        The default value: false - the form is refreshed every time when the user changes the input value.

        Parameters:
        noRefresh - Set to true to prevent the form refresh.
        Since:
        5.1 - Collins
      • setConfigValues

        public T setConfigValues​(List<String> configValues)
        Adds values to the input field (parameter).

        This can be used for example, for setting values of the drop-down input field.

        Parameters:
        configValues - The list of values you want to add to the input field (parameter).
      • setParameterGroup

        public T setParameterGroup​(String pg)
        Creates collapsible sections to organize input fields in the UI.

        You can assign parameterGroup to each parameter (input field) to categorize them into sections. The order of parameter groups (sections) is based on the order in which they are "created" (declared) when the logic is executed. There is one default group for all those that do not have parameterGroup assigned.

        Parameters:
        pg - The name of the parameterGroup
        Since:
        6.2 - Vesper
      • setPlaceholderText

        public T setPlaceholderText​(String text)
        Places the specified text to the input field as a placeholder.

        The placeholder text disappears once the user starts typing to this input field. This gives a user the hint of the expected value.

        Parameters:
        text - The text of the placeholder.
        Since:
        7.1 - Bijou
      • setImportable

        public T setImportable​(boolean importable)
        N/A - the method has not been implemented in the user interface yet.

        The default value: false

        Parameters:
        importable -
      • setExportable

        public T setExportable​(boolean exportable)
        N/A - the method has not been implemented in the user interface yet.

        The default value: false

        Parameters:
        exportable -
      • setTheme

        public T setTheme​(String theme)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        theme -
      • setAppearance

        public T setAppearance​(String appearance)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        appearance -
      • setSize

        public T setSize​(String size)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        size -
      • setTitle

        public T setTitle​(String title)
        Displays the specified text as a tooltip when a user hovers mouse over the input field label.

        Example:

         def ce = api.createConfiguratorEntry()
         api.inputBuilderFactory()
                                .createStringUserEntry("InputFieldName")
                                .setLabel("The Label")
                                .setTitle("The Title")
                                .addToConfiguratorEntry(ce)
         return ce
         
        Parameters:
        title - The text of the tooltip.
      • setCaption

        public T setCaption​(String caption)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        caption -
      • setHelpText

        public T setHelpText​(String helpText)
        Displays a question mark icon next to the input field label and displays the specified helpText when a user hovers the mouse over this icon.

        Parameters:
        helpText - The text to be displayed when a user hovers over the icon.
        Since:
        7.1 - Bijou
      • setHelpLink

        public T setHelpLink​(String helpLink)
        Displays a question mark icon next to the field label and displays the "Learn more" link when a user hovers the mouse over the icon.

        Clicking on the "Learn more" text will open the specified helpLink destination. We recommend using this function together with setHelpText(String)

        Parameters:
        helpLink - The target URL.
        Since:
        7.1 - Bijou
      • setIcon

        public T setIcon​(String icon)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        icon -
      • setIconPosition

        public T setIconPosition​(String iconPosition)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        iconPosition -
      • setLabelPlacement

        public T setLabelPlacement​(String labelPlacement)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        labelPlacement -
      • setLayoutGridName

        public T setLayoutGridName​(String layoutGridName)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        layoutGridName -
      • setErrorMessage

        public T setErrorMessage​(String msg)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        msg -
        Returns:
      • setWarningMessage

        public T setWarningMessage​(String msg)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        msg -
        Returns:
      • setSuccessMessage

        public T setSuccessMessage​(String msg)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        msg -
        Returns:
      • setUserGroupView

        public T setUserGroupView​(String ugv)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        ugv -
        Returns:
      • setUserGroupEdit

        public T setUserGroupEdit​(String uge)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        uge -
        Returns:
      • setDisplayMode

        public T setDisplayMode​(String displayMode)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        displayMode -
        Returns:
      • setAccessCode

        public T setAccessCode​(String accessCode)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        accessCode -
        Returns:
      • setAlign

        public T setAlign​(String align)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        align -
        Returns:
      • setLabelStyle

        public T setLabelStyle​(String labelStyle)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        labelStyle -
        Returns:
      • setAutoComplete

        public T setAutoComplete​(boolean autoComplete)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        autoComplete -
        Returns:
      • setAutoFocus

        public T setAutoFocus​(boolean autoFocus)
        If this is set to true, browser scrolls to the element when the page is loaded and automatically focuses it (places a cursor into the input field).
        On the given page the autofocus should be placed in only one input. For the radio group, the first element will be focused. If the input is in the read-only mode, autofocus will not be applied.

        The default value: false

        Parameters:
        autoFocus - Set to true to enable autofocusing the element.
        Since:
        8.0 - Godfather
      • setDisabled

        public T setDisabled​(boolean disabled)
        N/A - the method has not been implemented in the user interface yet.

        Parameters:
        disabled -
        Returns:
      • setCustomAttributeName

        public T setCustomAttributeName​(String name)
        Creates the custom name data attribute in the form's HTML.

        The resulting HTML: data-custom-AttributeName="AttributeValue".

        Parameters:
        name - The name of the custom attribute.
        Since:
        7.1 - Bijou
      • setCustomAttributeValue

        public T setCustomAttributeValue​(String value)
        Creates the custom value data attribute in the form's HTML.

        For example, data-custom-AttributeName="AttributeValue".

        Parameters:
        value - The value of the custom attribute.
        Since:
        7.1 - Bijou
      • setFlex

        public T setFlex​(int flex)

        When more input fields are placed side by side (using the row layout, via RowInputBuilder), the "flex" value sets how much space should this input field occupy (proportionally) with respect to the other inputs on the same row.

        For example, if you place 3 inputs side by side, all with the same flex (e.g. value 1), they will have the same width. If you make two inputs with flex=1 and one input with flex=2, then the input with flex=2 will occupy half of the space, and the other 2 inputs one quarter each.

        If you do not set any value to an input field, it will use value 1.

        Set this value only for inputs, which are placed to the side by side layout. Otherwise the value is ignored.

        Note: not supported in Ember and Classic UI.
        Parameters:
        flex - value to define width of the input field, with respect to the other input fields placed side by side in the same row.
        See Also:
        RowInputBuilder, Layout and Formatting of Input Fields Reference
      • buildMap

        public Map<String,​Object> buildMap()

        Builds a map with input field definition. It is a ContextParameter definition converted to a map.

        This is used in header logic, to build the map (input field definition), which is then added to the header using addOrUpdateInput(CalculableLineItemCollectionBuilder, String).

        Example:

             def deliveryType = api.inputBuilderFactory()
                 .createOptionEntry("DeliveryType")
                 .setLabel("Delivery Type")
                 .setRequired(true)
                 .setOptions(["Express", "Standard"])
                 .setLabels(["Express": "Express Delivery", "Standard": "Standard Delivery"])
                 .buildMap()
        
         quoteProcessor.addOrUpdateInput(deliveryType)
         
        Returns:
        The input field definition as map.
        Since:
        5.1 - Collins
      • buildContextParameter

        public ContextParameter buildContextParameter()
        Builds and returns the input field definition object.

        This is used only in Configurator form logics.

        Example:

        
         def formFieldSet = api.createConfiguratorEntry()
        
         def meatInputField = api.inputBuilderFactory().createOptionEntry("Meat")
                                      .setOptions(["Beef", "Lamb", "Pork"])
                                      .buildContextParameter()
        
         formFieldSet.inputs = [meatInputField]
         return formFieldSet
         
        Returns:
        The input field definition object (ContextParameter).
        Since:
        5.1 - Collins
        See Also:
        addToConfiguratorEntry(ConfiguratorEntry)
      • addOrUpdateInput

        public T addOrUpdateInput​(CalculableLineItemCollectionBuilder clicBuilder,
                                  String lineId)

        Adds (or updates) this input field (defined by this builder) to the specified header line item.

        It is used only on document header logics. Available for Quotes, RebateAgreements and Contracts.

        Example - adds the input to the QuoteBuilder at the root level:

         api.inputBuilderFactory().createOptionEntry("Meat")
                                     .setOptions(["Beef", "Lamb", "Pork"])
                                     .addOrUpdateInput(quoteProcessor, "ROOT")
         

        Parameters:
        clicBuilder - The clicBuilder object (quoteProcessor, raProcessor, cProcessor).
        lineId - The lineId.
        Since:
        5.1 - Collins
      • addToConfiguratorEntry

        public T addToConfiguratorEntry​(ConfiguratorEntry ce)
        Adds the input field (defined by this builder) to the specified form field set/section (ConfiguratorEntry).

        It is used only in Configurator form logics.

        Example:

         def ce = api.createConfiguratorEntry()
         api.inputBuilderFactory()
             .createStringUserEntry("StringUserEntry")
             .setLabel("String User Entry")
             .addToConfiguratorEntry(ce)
         return ce
         
        Parameters:
        ce - The ConfiguratorEntry where you want to add the created input field object.
        Returns:
        the input builder itself
        Since:
        5.1 - Collins
        See Also:
        buildContextParameter(), addToConfiguratorEntry(ConfiguratorEntry, Closure)
      • addToConfiguratorEntry

        public T addToConfiguratorEntry​(ConfiguratorEntry ce,
                                        Closure defaultValue)
        Adds the input field (defined by this builder) to the specified form field set/section (ConfiguratorEntry).

        It is used only in Configurator form logics.

        Example:

         def ce = api.createConfiguratorEntry()
         api.inputBuilderFactory()
             .createStringUserEntry("StringUserEntry")
             .setLabel("String User Entry")
             .addToConfiguratorEntry(ce, { "some default value" })
         return ce
         
        Parameters:
        ce - The ConfiguratorEntry where you want to add the created input field object.
        defaultValue - the value to be used if nothing is selected in the input
        Returns:
        the input builder itself
        Since:
        8.3 - Godfather
        See Also:
        buildContextParameter(), addToConfiguratorEntry(ConfiguratorEntry)