Class AbstractInputBuilder<T extends AbstractInputBuilder,VT>

Object
AbstractInputBuilder<T,VT>
Direct Known Subclasses:
AbstractDmFilterBuilder, AbstractProductAndCustomerInputBuilder, ButtonInputBuilder, CollapseInputBuilder, ConfiguratorInputBuilder, ConfiguratorTableInputBuilder, CustomFormListPopupInputBuilder, DashboardInputsInputBuilder, DashboardPopupInputBuilder, DateRangeInputBuilder, DMFieldInputBuilder, DmFilter, DmQueryBuilderInputBuilder, DMSourceInputBuilder, FilterBuilderInputBuilder, InputMatrixInputBuilder, MultiTierInputBuilder, OptionInputBuilder, ResultMatrixFilterBuilder, RowInputBuilder, SimpleInputBuilder, SliderInputBuilder, StringInputBuilder, VLookupBuilder

public abstract class AbstractInputBuilder<T extends AbstractInputBuilder,VT> extends Object
  • Field Details

  • Constructor Details

  • Method Details

    • _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 Input Generation 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.

      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.isInputGenerationExecution()) {
           api.inputBuilderFactory()
                   .createMultiTierEntryInputBuilder("MultiTier")
                   .setLabel("MultiTier")
                   .setValue([
                       "10" : "20",
                       "20" : "40"
                   ])
                   .getInput()
       } else {
           input.MultiTier
       }
       
      Returns:
      In Input Generation 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:
    • 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 input generation 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.
      Tip: To add different hints next to the field of each column, use setValueHint("Value^^^%") (see the screenshot below).

      Example:

      
       if (api.isInputGenerationExecution()) {
       def mTier = api.inputBuilderFactory()
                    .createMultiTierEntryInputBuilder("multiTier")
                    .setLabel("Multi Tier")
                    .setValueHint("Value^^^%")
                    .setValue([
                             "1000000" : "20",
                             "2000000" : "50"
                        ])
                    .getInput()
        } else {
            input.multiTier
        }
       
      The input field is rendered as follows:

      Parameters:
      valueHint - The text content of the hint.
      See Also:
    • 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 -
    • setDefaultWidth

      public T setDefaultWidth(AbstractInputBuilder.InputWidth width)
      Sets the default width of the widget. This value is also inherited down to widget’s children.

      Setting of default width is meant to be used with Configurators, and layouts Row and Collapse.

      Accepted values are:

      InputWidth.LARGE - 800px or 100% of available space
      InputWidth.MAX - 100% of available space
      If another value is used or not set, then the default width is assigned to large.

      Example:
      Please note: the InputWidth must be imported at the beginning of your Groovy code, or the full path to the AbstractInputBuilder.InputWidth must be specified in the setDefaultWidth parameter.

      
       import net.pricefx.formulaengine.scripting.inputbuilder.AbstractInputBuilder.InputWidth
      
           if (api.isInputGenerationExecution()) return
      
           def contextParameter = api.inputBuilderFactory()
                   .createStringUserEntry('MyEntry')
                   .setDefaultWidth(InputWidth.MAX)
                   .buildContextParameter()
      
           def rowInputBuilder = api.inputBuilderFactory()
                   .createRowLayout('MyRowLayout')
                   .addInput(contextParameter)
                   .buildMap()
      
           // will create the string user entry 100% of available space long
       
      Parameters:
      width - the default width as InputWidth.LARGE or InputWidth.MAX (other InputWidths will be treated as InputWidth.LARGE)
      Returns:
      The same instance of this class.
      See Also:
    • setWidth

      public T setWidth(AbstractInputBuilder.InputWidth width)
      Sets the width of the input field on the screen. Accepted values are:
      InputWidth.SMALL - 200px or 25% of available space
      InputWidth.MEDIUM - 400px or 50% of available space
      InputWidth.LARGE - 800px or 100% of available space
      InputWidth.MAX - 100% of available space
      If another value is used or not set, then the width is assigned to large.

      Example:
      Please note: the InputWidth must be imported at the beginning of your Groovy code, or the full path to the AbstractInputBuilder.InputWidth must be specified in the setWidth parameter.

      
       import net.pricefx.formulaengine.scripting.inputbuilder.AbstractInputBuilder.InputWidth
      
           if (api.isInputGenerationExecution()) return
      
           def contextParameter = api.inputBuilderFactory()
               .createStringUserEntry('MyEntry')
               .setWidth(InputWidth.SMALL)
               .buildContextParameter()
      
           def rowInputBuilder = api.inputBuilderFactory()
                   .createRowLayout('MyRowLayout')
                   .addInput(contextParameter)
                   .buildMap()
      
           // will create the string user entry 200px (or 25% of available space) long
       
      Parameters:
      width - the InputWidth enum as InputWidth.SMALL, InputWidth.MEDIUM, InputWidth.LARGE or InputWidth.MAX
      Returns:
      The same instance of this class.
      See Also:
    • 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)
      Hides the input from the user interface.

      Supported input types: InputType.CONFIGURATOR (hides the "Open" button)

      Example:

      
       def configurator = api.inputBuilderFactory()
                    .createConfiguratorInputBuilder("configurator", "InputsGenericLogic", false)
                    .setLabel("Configurator")
                    .setDisabled(true)
                    .buildMap()
      
       quoteProcessor.addOrUpdateInput(configurator)
       
      Parameters:
      disabled - Set to true to disable the user input.
      Returns:
      Since:
      11.2.0 - Paper Plane
    • setCustomAttributeName

      public T setCustomAttributeName(String name)
      Creates the custom name data attribute in the form's HTML.
      Must be used together with setCustomAttributeValue(String).

      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.
      Must be used together with setCustomAttributeName(String).

      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:
    • 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:
    • 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:
    • setPreviousValueTracking

      public T setPreviousValueTracking(boolean isPreviousValueTracked)
      Turn on the tracking of previous values for the particular ContextParameter

      Example:

      
       def configuratorEntry = api.createConfiguratorEntry()
      
       api.inputBuilderFactory()
                .createOptionEntry('FirstOrSecond')
                .setOptions(['First', 'Second'])
                .setPreviousValueTracking(true)
                .addToConfiguratorEntry(configuratorEntry)
       
      Parameters:
      isPreviousValueTracked - turn on (true) or off (false) input's previous value tracking
      Returns:
      the input builder itself
    • setDefaultValueTracking

      public T setDefaultValueTracking(boolean isDefaultValueTracked)
      Turn on the tracking of default value for the particular ContextParameter

      Example:

      
       def configuratorEntry = api.createConfiguratorEntry()
      
       api.inputBuilderFactory()
                .createOptionEntry('FirstOrSecond')
                .setOptions(['First', 'Second'])
                .setDefaultValueTracking(true)
                .addToConfiguratorEntry(configuratorEntry)
       
      Parameters:
      isDefaultValueTracked - turn on (true) or off (false) input's default value tracking
      Returns:
      the input builder itself
    • setValueChangeTracking

      public T setValueChangeTracking(boolean isValueChangeTracked)
      Turn on the logic change value tracking for the particular ContextParameter

      Example:

      
       def configuratorEntry = api.createConfiguratorEntry()
      
       api.inputBuilderFactory()
                .createOptionEntry('FirstOrSecond')
                .setOptions(['First', 'Second'])
                .setValueChangeTracking(true)
                .addToConfiguratorEntry(configuratorEntry)
       
      Parameters:
      isValueChangeTracked - turn on (true) or off (false) input's logic change value tracking
      Returns:
      the input builder itself
    • 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:
    • setShowInline

      protected T setShowInline(boolean enable)
    • self

      protected T self()