Class FormUtil


  • public class FormUtil
    extends Object
    Utility class
    • Field Detail

      • EOBJECT_TO_FORM

        public static final com.google.common.base.Function<org.eclipse.emf.ecore.EObject,​Form> EOBJECT_TO_FORM
    • Constructor Detail

      • FormUtil

        public FormUtil()
    • Method Detail

      • getFormAttribute

        public static FormAttribute getFormAttribute​(PropertyInfo prop)
        Returns attribute of the root PropertyInfo.
        Parameters:
        prop - - a form property info
        Returns:
        - a attribute of the root PropertyInfo.
      • getTopFormAttribute

        public static FormAttribute getTopFormAttribute​(PropertyInfo prop)
        Returns top attribute
        Parameters:
        prop - - a form property info
        Returns:
        - a top attribute of the root PropertyInfo.
      • getFormAttributeService

        public static FormAttributeService getFormAttributeService()
        Gets FormAttributeService. The service turns out through IoC FormPlugin#getInjector().
          This method is created for support of an old code. Don't use this method when writing a new code.
          
        Returns:
        the FormAttributeService.
      • getRelativeElementDataSourceInfo

        public static AbstractFormDataSourceInfo getRelativeElementDataSourceInfo​(PropertyInfo propertyInfo,
                                                                                  PropertyInfo base)
        The method get relative element data source info.
        Parameters:
        propertyInfo - the property info.
        base - the base of property info.
        Returns:
        the relative element data source info.
      • getParentTableElements

        public static ElementDataSourceInfo getParentTableElements​(PropertyInfo columnPropertyInfo)
        The method find relative paretn elment
        Parameters:
        columnPropertyInfo - the property info
        Returns:
        return relative ElementDataSourceInfo element. Can return null if parent table do not found
      • isColumn

        public static boolean isColumn​(PropertyInfo propertyInfo)
      • arePropertyInfosEqual

        public static boolean arePropertyInfosEqual​(Object a,
                                                    Object b)
        Test whether two potential property infos are equal or not.
        Parameters:
        a - property info A
        b - property info B
        Returns:
        true if they are both property infos and their data paths are not empty and equal, false otherwise.
      • getItemType

        public static TypeItem getItemType​(DataItem dataItem)
        Returns:
        TypeItem for a given dataItem or null, if no information found.
      • getItemTypeName

        public static String getItemTypeName​(DataItem dataItem)
        Returns:
        type name for a given dataItem or null, if no information found.
      • getItemOwnPropertyInfo

        public static PropertyInfo getItemOwnPropertyInfo​(DataItem dataItem)
        Gets the item own property info.
        Parameters:
        dataItem - the data item.
        Returns:
        the item property info
      • isSystemLanguageIsRussian

        public static boolean isSystemLanguageIsRussian()
        Checks whether system language is Russian or not.
        Returns:
        true if system language is Russian, false otherwise.
      • getMainAttribute

        public static FormAttribute getMainAttribute​(Form form)
        Finds main form attribute for a given form.
        Parameters:
        form - form to find main attribute of.
        Returns:
        found main attribute or null if form has no main attribute.
      • getExactAttributeType

        public static TypeItem getExactAttributeType​(FormAttribute attribute)
        Extracts exact type information of a given form attribute.
        Parameters:
        attribute - attribute to extract exact type of.
        Returns:
        extracted type or null if attribute has no type or type is composite.
      • isListForm

        public static boolean isListForm​(Form form,
                                         FormAttribute mainAttribute)
        Determines whether a given form is a list form.
        Parameters:
        form - form to check.
        mainAttribute - main form attribute.
        Returns:
        true if it's a list form, false otherwise.
      • isChoiceForm

        public static boolean isChoiceForm​(Form form,
                                           FormAttribute mainAttribute)
        Determines whether a given form is a choice form.
        Parameters:
        form - form to check.
        mainAttribute - main form attribute.
        Returns:
        true if it's a choice form, false otherwise.
      • getCommandsByTypes

        public static Set<Command> getCommandsByTypes​(CommandInterfaceRoot cmiRoot,
                                                      Collection<TypeItem> types)
        Returns commands by selected types.
        Parameters:
        cmiRoot - the CMI root model, cannot be null
        types - the types, cannot be null
        Returns:
        the commands
      • isDynamicList

        public static boolean isDynamicList​(TypeDescription tdp)
        Determines whether the TypeDescription belongs to the dynamic list.
        Parameters:
        tdp - TypeDescription to be examined, cannot be null
        Returns:
        true if it's a dynamic list
      • isValueTable

        public static boolean isValueTable​(TypeDescription tdp)
        Determines whether the TypeDescription belongs to the value table.
        Parameters:
        tdp - TypeDescription to be examined, cannot be null
        Returns:
        true if it's a value table
      • isValueTree

        public static boolean isValueTree​(TypeDescription tdp)
        Determines whether the TypeDescription belongs to the value tree.
        Parameters:
        tdp - TypeDescription to be examined, cannot be null
        Returns:
        true if it's a value tree
      • isValueList

        public static boolean isValueList​(TypeDescription tdp)
        Determines whether the TypeDescription belongs to the value list.
        Parameters:
        tdp - TypeDescription to be examined, cannot be null
        Returns:
        true if it's a value list
      • isTabularSection

        public static boolean isTabularSection​(TypeDescription tdp)
        Determines whether the TypeDescription belongs to the tabular section.
        Parameters:
        tdp - TypeDescription to be examined, cannot be null
        Returns:
        true if it's a tabular section
      • isTable

        public static boolean isTable​(TypeDescription tdp)
        Determines whether the TypeDescription belongs to one of the table-based types.
        Parameters:
        tdp - TypeDescription to be examined, cannot be null
        Returns:
        true if it's a table-based type