Class InsertListOperation

    • Field Detail

      • SCHEMA_AWARE_ARGUMENT_DESCRIPTOR

        protected static final ArgumentDescriptor SCHEMA_AWARE_ARGUMENT_DESCRIPTOR
        Schema aware argument.
      • CONVERT_ELEMENT_AT_CARET_ARGUMENT

        public static final java.lang.String CONVERT_ELEMENT_AT_CARET_ARGUMENT
        Argument that controls whether the action inserts a new list or converts the element at caret if no selection is made.
        See Also:
        Constant Field Values
      • CONVERT_ELEMENT_AT_CARET_ARGUMENT_DESCRIPTOR

        protected static final ArgumentDescriptor CONVERT_ELEMENT_AT_CARET_ARGUMENT_DESCRIPTOR
        Schema aware argument.
      • LIST_TYPE_ARGUMENT

        public static final java.lang.String LIST_TYPE_ARGUMENT
        Argument that controls the type of the list that will be inserted.
        See Also:
        Constant Field Values
      • authorAccess

        protected AuthorAccess authorAccess
        The author access.
      • listType

        protected java.lang.String listType
        The new list type.
    • Constructor Detail

      • InsertListOperation

        public InsertListOperation()
    • Method Detail

      • getElementAtCaretToConvert

        public java.util.Optional<AuthorNode> getElementAtCaretToConvert​(AuthorAccess authorAccess,
                                                                         CommonsOperationsUtil.ConversionElementHelper helper)
        Returns the element at caret that is suitable to be converted.
        Parameters:
        authorAccess - The author access.
        helper - Used to check if the elements from selection can be converted in other elements (table cells or list entries)
        Returns:
        The element to convert.
      • isListElement

        protected boolean isListElement​(AuthorNode node)
        Checks if the given node is a list element or list item.
        Parameters:
        node - The element to check.
        Returns:
        true if the node is a list element.
      • isList

        protected abstract boolean isList​(AuthorNode node)
        Checks if the given node is a list.
        Parameters:
        node - The element to check.
        Returns:
        true if the node is a list.
      • getParentListType

        protected abstract java.lang.String getParentListType​(AuthorNode node)
        Get the type of the list in which the new list will be inserted. Can be null.
        Parameters:
        node - The node at offset.
        Returns:
        the type of the list in which the new list will be inserted. Can be null.
      • insertContent

        protected abstract void insertContent​(AuthorAccess authorAccess,
                                              AuthorNode listNode,
                                              java.util.List<CommonsOperationsUtil.SelectedFragmentInfo> selectedFragmentsInfos)
        Insert content.
        Parameters:
        authorAccess - The author access.
        listNode - The list node.
        selectedFragmentsInfos - The fragments to be inserted.
      • getNamespace

        protected abstract java.lang.String getNamespace()
        Get namespace.
        Returns:
        The namespace to be used at insertion.
      • getXMLFragment

        protected abstract java.lang.String getXMLFragment​(AuthorAccess authorAccess,
                                                           java.lang.String listType,
                                                           java.lang.String parentListType)
        Get XML fragment to be inserted when nothing is selected.
        Parameters:
        authorAccess - The author access.
        listType - The type of the list to be inserted.
        parentListType - The type of the parent list, can be null
        Returns:
        the fragment to be inserted.
      • getListXMLFragment

        protected abstract java.lang.StringBuilder getListXMLFragment​(java.lang.String listType,
                                                                      java.util.Map<java.lang.String,​java.lang.String> listAttributes,
                                                                      int numberOfListItems,
                                                                      AuthorAccess authorAccess)
        Get list XML fragment.
        Parameters:
        listType - The list type.
        listAttributes - The attributes to add to list items.
        numberOfListItems - The number of list items.
        authorAccess - The author access.
        Returns:
        The list XML fragment.
      • getListTypeDescription

        protected abstract java.lang.String getListTypeDescription​(java.lang.String listType)
        Obtain the name of every list type.
        Parameters:
        listType - The list type.
        Returns:
        A string representing the name of the given list type.