Class UIDefinition

    • Field Detail

      • log

        protected static final org.apache.logging.log4j.Logger log
    • Constructor Detail

      • UIDefinition

        public UIDefinition()
    • Method Detail

      • getName

        public String getName()
        Unique name used to identify the type.
      • getParentType

        public String getParentType()
        Returns:
        the Smartclient type from which this type inherits.
      • getFormEditorType

        public String getFormEditorType()
        Returns:
        the form item type used for editing this reference in a form.
      • getGridEditorType

        public String getGridEditorType()
        Returns:
        the form item type used for editing this reference in a grid. As a default will return getFormEditorType()
      • getReadOnlyEditorType

        public String getReadOnlyEditorType()
        Returns:
        the read only editor type. As default will return "".
      • getFilterEditorType

        public String getFilterEditorType()
        Returns:
        the form item type used for filtering in grids. As a default will return getFormEditorType()
      • getTypeProperties

        public String getTypeProperties()
        Computes the properties used to define the type, this includes all the Smartclient SimpleType properties.
        Returns:
        a javascript string which can be included in the javascript defining the SimpleType. The default implementation returns an empty string.
      • getFieldProperties

        public String getFieldProperties​(Field field)
        Computes properties to initialize and set the field in a Smartclient form. This can be the default value or the sets of values in the valuemap. NOTE: the field parameter may be null, implementors of subclasses should take this into account.
        Parameters:
        field - the field for which the information should be computed. NOTE: the caller is allowed to pass null for cases where the field properties are needed for a FormItem which is not backed by an Openbravo field.
        Returns:
        a JSONObject string which is used to initialize the formitem.
      • getFieldProperties

        public String getFieldProperties​(Field field,
                                         boolean getValueFromSession)
        Computes properties to initialize and set the field in a Smartclient form. This can be the default value or the sets of values in the valuemap.
        Parameters:
        field - the field for which the information should be computed.
        getValueFromSession -
        Returns:
        a JSONObject string which is used to initialize the formitem.
      • getDefaultValue

        public String getDefaultValue​(VariablesSecureApp vars,
                                      String columnName,
                                      String defaultValueExpression,
                                      String windowId)
        Returns the value for a default value expression which represents a session value or a fixed value. This method is not used to calculate SQL based expressions (those that start with '@SQL=') and NOW expression ('@#Date@').
        Parameters:
        vars - Handler for the session info.
        columnName - String with the name of the column that has the default value.
        defaultValueExpression - String with the default value expression.
        windowId - String with the window id.
        Returns:
        String with the calculated default value.
      • getDefaultValueFromSQLExpression

        public String getDefaultValueFromSQLExpression​(VariablesSecureApp vars,
                                                       Field field,
                                                       String defaultValueExpression)
        Returns the value for a default value expression based on a SQL expression. This kind of expressions start with '@SQL='.
        Parameters:
        vars - Handler for the session info.
        field - Field whose column has the default value.
        defaultValueExpression - String with the default value expression.
        Returns:
        String with the calculated default value.
      • getFieldPropertiesWithoutCombo

        public String getFieldPropertiesWithoutCombo​(Field field,
                                                     boolean getValueFromSession)
        It returns the same as getFieldProperties except in the case of combo UIDefinitions. In combo UI definitions, a call to the super will be done, but the combo computation itself will not be done (so only the default value, or the current request value, will be considered).
      • getFieldPropertiesFirstRecord

        public String getFieldPropertiesFirstRecord​(Field field,
                                                    boolean getValueFromSession)
      • getCellAlign

        public String getCellAlign()
        Returns alignment in grid view. In case it returns null, default alignment for actual data type is used.
        Returns:
        null for default alignment, "left", "center" or "right"
      • convertToClassicString

        public String convertToClassicString​(Object value)
        Creates a classic string which is used by callouts from an object value.
        Parameters:
        value -
        Returns:
        the classic string
      • getDataSourceParameters

        public Map<String,​Object> getDataSourceParameters()
        Parameters passed in to the datasource, for example the JsonConstants.ADDITIONAL_PROPERTIES_PARAMETER can be passed in like this.
        Returns:
        a list of parameters used to drive the datasource generation incorporating this UIDefinition.
      • getFilterEditorProperties

        public String getFilterEditorProperties​(Field field)
        Computes properties to initialize and set the field in a Smartclient grid filter. This can be the default value or the sets of values in the valuemap. Note: the result should be either empty, if not empty then it start with a comma and end without a comma, this to generate correct javascript.
        Parameters:
        field - the field for which the information should be computed.
        Returns:
        a JSONObject string which is used to initialize the formitem.
      • getFilterEditorPropertiesProperty

        protected String getFilterEditorPropertiesProperty​(Field field)
        Returns the filterEditorProperties property set on the gridfield. Note for implementations in the subclass: field maybe null.
        Parameters:
        field - the field to generate the filter editor properties for, note it is allowed to pass null, implementors should gracefully handle this.
      • getGridFieldProperties

        public String getGridFieldProperties​(Field field)
        Computes properties to initialize and set the field in a Smartclient grid cell. This can be the default value or the sets of values in the valuemap. Note: the result should be either empty, if not empty then it start with a comma and end without a comma, this to generate correct javascript.
        Parameters:
        field - the field for which the information should be computed.
        Returns:
        a JSONObject string which is used to initialize the formitem.
      • getParameterProperties

        public String getParameterProperties​(Parameter parameter)
      • getParameterWidth

        public String getParameterWidth​(Parameter parameter)
      • getGridEditorFieldProperties

        public String getGridEditorFieldProperties​(Field field)
        Computes properties to initialize and set the field in a Smartclient grid cell when it is being edited. This can be the default value or the sets of values in the valuemap. Note: the result should be either empty, if not empty then it start with a comma and end without a comma, this to generate correct javascript.
        Parameters:
        field - the field for which the information should be computed.
        Returns:
        a JSONObject string which is used to initialize the formitem.
      • getReference

        public Reference getReference()
      • setReference

        public void setReference​(Reference reference)
      • getDomainType

        public DomainType getDomainType()
      • removeAttributeFromString

        protected String removeAttributeFromString​(String inpString,
                                                   String attr)
      • readGridConfigurationSetting

        protected Object readGridConfigurationSetting​(String setting)
        Reads a particular value from the grid configuration settings
        Parameters:
        setting - the setting whose value is to be returned.
      • establishGridConfigurationSettings

        public void establishGridConfigurationSettings​(Field field,
                                                       Optional<GCSystem> systemGC,
                                                       Optional<GCTab> tabGC)
        Obtains the grid configuration values for the given field and sets them into the 'gridConfigurationSettings' variable. The aim of having all these values in a single variable at once is to make a single call to the database and then be able to use the values stored into 'gridConfigurationSettings' wherever it be needed (without more calls to the database).
        Parameters:
        field - the field for which the information should be computed.
        systemGC -
        tabGC -
      • getShowHoverGridFieldSettings

        protected String getShowHoverGridFieldSettings​(Field field)
      • showHover

        public boolean showHover()
        This method determines if the UI definition should include the showHover property as part of the grid field properties. Returns true by default.
        Returns:
        true if fields using this UI definition should display their text on a hover box, otherwise return false
      • getGridFieldName

        protected String getGridFieldName​(Field fld)
      • getValueInComboReference

        protected String getValueInComboReference​(Field field,
                                                  boolean getValueFromSession,
                                                  String columnValue)
      • getValueInComboReference

        protected String getValueInComboReference​(Field field,
                                                  boolean getValueFromSession,
                                                  String columnValue,
                                                  boolean onlyFirstRecord)
      • getSafeBoolean

        protected boolean getSafeBoolean​(Boolean value)