Interface IFormItemNamingService


  • public interface IFormItemNamingService
    Represents a service for the form item naming.
    • Method Detail

      • getUniqueName

        String getUniqueName​(String candidate,
                             ItemType itemType,
                             FormVisualEntity context,
                             Form form)
        Generates unique form item name depending on the item type
        Parameters:
        candidate - the candidate for a new name, can be null or empty.
        itemType - the item type, cannot be null
        context - the object in which the current item lies, can not be null.
        form - the form, can not be null.
        Returns:
        unique form item name, never null
      • setUniqueNameWithChildren

        void setUniqueNameWithChildren​(FormItem item,
                                       FormVisualEntity context,
                                       Form form,
                                       String itemName)
        Sets a unique name for the specified form item and for all of it children on all levels of hierarchy.

        The new name will be generated automatically depending on the type of the specified item.

        Parameters:
        item - the form item for set a unique name, can not be null.
        context - the object in which the current item lies, can not be null.
        form - the form, can not be null.
        itemName - the user defined item name, can be null.
        Throws:
        IllegalArgumentException - if the candidate was set for the item of predefined item type because forbidden to change the name of predefined item directly.
      • setUniqueNameWithChildren

        default void setUniqueNameWithChildren​(FormItem item,
                                               FormVisualEntity context,
                                               Form form)
        Sets a unique name for the specified form item and for all of it children on all levels of hierarchy.

        The new name will be generated automatically depending on the type of the specified item.

        Parameters:
        item - the form item for set a unique name, can not be null.
        context - the object in which the current item lies, can not be null.
        form - the form, can not be null.
        Throws:
        IllegalArgumentException - if the candidate was set for the item of predefined item type because forbidden to change the name of predefined item directly.
      • setUniqueNameWithChildren

        void setUniqueNameWithChildren​(String candidate,
                                       FormItem item,
                                       FormVisualEntity context,
                                       Form form)
        Sets a unique name for the specified form item and for all of it children on all levels of hierarchy.
        Parameters:
        candidate - the candidate for a new name, can not be null or empty.
        item - the form item for set a unique name, can not be null.
        context - the object in which the current item lies, can not be null.
        form - the form, can not be null.
        Throws:
        IllegalArgumentException - if the candidate was set for the item of predefined item type because forbidden to change the name of predefined item directly.
      • setUniqueName

        void setUniqueName​(AbstractDataPath path,
                           DataItem item,
                           FormVisualEntity context,
                           Form form,
                           IDataSourceInfoAssociationService associationService,
                           String itemName)
        Sets a unique name for the specified form item and all of it predefined children on first level of hierarchy only.
        Parameters:
        path - the data path, can not be null or empty.
        item - the form item for which a new name will be set, can not be null.
        context - the object in which the current item lies, can not be null.
        form - the form, can not be null.
        associationService - the special information service, can not be null.
        itemName - the use defined item name, can be null.
        Throws:
        IllegalArgumentException - if the item has predefined item type because forbidden to change the name of predefined item directly.
      • rename

        void rename​(String newName,
                    FormItem item)
        Renames the specified form item and all of it predefined children on first level of hierarchy only.
        Parameters:
        newName - the new name, can not be null or empty.
        item - the form item for set a unique name, can not be null.
        Throws:
        IllegalArgumentException - in the following cases:
      • If the specified newName was set for the item of predefined item type because forbidden to change the predefined item name directly.
      • If the specified newName is not unique in context of form.
      • renameDuplicate

        void renameDuplicate​(FormItem item,
                             FormVisualEntity context,
                             Form form)
        Renames the specified form item and all of it children on all levels of hierarchy.

        The unique name will be set for the specified item by the old name of it with updated number in the postfix of name. This works just as if a duplicate was created and would have a new unique name.

        Parameters:
        item - the form item for set a unique name, can not be null.
        context - the context of the specified form item usage, can not be null.
        form - the form, can not be null.
        Throws:
        IllegalArgumentException - if the item has predefined item type because forbidden to copy the predefined item directly.