Class FormIdentifierService

    • Constructor Detail

      • FormIdentifierService

        public FormIdentifierService()
    • Method Detail

      • clearCaches

        public void clearCaches​(IBmObject form)
        Clears form id caches.
        Parameters:
        form - the form for clearing id caches, cannot be null
      • getNextItemId

        public int getNextItemId​(Form form)
        The method generate a next form item id in Form
        Parameters:
        form - the form for get next id
        Returns:
        return next an item identifier
      • getNextAttributeId

        public int getNextAttributeId​(Form form)
        The method generate a next form attribute id in Form
        Parameters:
        form - the form for get next id
        Returns:
        return next an attribte identifier
      • getNextCommandId

        public int getNextCommandId​(Form form)
        The method generate a next form command id in Form
        Parameters:
        form - the form for get next id
        Returns:
        return next an command identifier
      • hasValidId

        public boolean hasValidId​(FormItem item)
        Checks whether specified form item has a valid identifier.
        • FormItem.getId() is considered to be invalid if its value is 0 which is a default value for EObject.eGet(EStructuralFeature, boolean) in case of Integer feature.
        • Negative values are not considered to be invalid. That is because such values are perfectly valid at least for some of the cases. For example, AutoCommandBar might have -1 as in identifier. This can be seen in the implementation of com._1c.g5.v8.dt.internal.form.generator.FormGeneratorCore.
        • This method does not check identifier correctness in relation with other form items. For example, all form items identifiers on a form must be unique across this form regarless of how deep they are nested. However, this method checks just the specified form item and does not try to verify if there are other form items with the same identifier.
        Parameters:
        item - Form item whose identifier is to be checked. Must not be null.
        Returns:
        true if specified item has a valid identifier.
      • calculateNewIdFor

        public OptionalInt calculateNewIdFor​(FormItem item)
        Calculates new identifier for the specified form item. Generally, getNextItemId(Form) is used to obtain next identifier. However, some form items have special rules for identifiers. For example, com._1c.g5.v8.dt.internal.form.generator.FormGeneratorCore creates new forms with AutoCommandBar that has identifier of -1. We try to do the same here.
        Parameters:
        item - Form item that needs new identifier. Most not be null.
        Returns:
        New value of identifier for the specified item or an empty holder if unable to determine proper new identifier value (for example, if cannot determine top object or top object is not a Form).
        See Also:
        IBmObject.bmGetTopObject()