Class OBViewUtil


  • public class OBViewUtil
    extends Object
    Utility methods used in generating Openbravo view representations.
    Author:
    mtaal
    • Field Detail

      • createdElement

        public static final Element createdElement
      • createdByElement

        public static final Element createdByElement
      • updatedElement

        public static final Element updatedElement
      • updatedByElement

        public static final Element updatedByElement
    • Constructor Detail

      • OBViewUtil

        public OBViewUtil()
    • Method Detail

      • getParameterTitle

        public static String getParameterTitle​(Parameter parameter,
                                               boolean purchaseTrx)
        Returns parameter's title. Because the same Parameter Definition can be used in different windows (some being purchases, some other ones sales), sync terminology is not enough to determine its title. If this process is invoked from a window, it is required to check the window itself to decide if it is sales or purchases. Note this only takes effect in case the parameter is associated with an element and the parameter is centrally maintained.
        Parameters:
        parameter - Parameter to get the title for
        purchaseTrx - Is the window for purchases or sales
        Returns:
        Parameter's title
      • getLabel

        public static String getLabel​(BaseOBObject owner,
                                      List<?> trlObjects)
        Generic method for computing the translated label/title. It assumes that the trlObjects have a property called language and name and the owner object a property called name.
        Parameters:
        owner - the owner of the trlObjects (for example Field)
        trlObjects - the trl objects (for example FieldTrl)
        Returns:
        a translated name if found or otherwise the name of the owner
      • getGridConfigurationSettings

        public static org.codehaus.jettison.json.JSONObject getGridConfigurationSettings​(Optional<GCSystem> sysConf,
                                                                                         Optional<GCTab> tabConf)
        Returns the grid configuration based on the field and tab information
        Returns:
        the grid configuration
      • getGridConfigurationSettings

        public static org.codehaus.jettison.json.JSONObject getGridConfigurationSettings​(Field field,
                                                                                         Optional<GCSystem> sysConf,
                                                                                         Optional<GCTab> tabConf)
        Returns the grid configuration based on the field and tab information
        Parameters:
        field - field whose grid configuration is to be obtained it can be null
        Returns:
        the grid configuration