Class AbstractTableOperation

    • Field Detail

      • CHANGE_TRACKING_BEHAVIOR_ARGUMENT

        public static final ArgumentDescriptor CHANGE_TRACKING_BEHAVIOR_ARGUMENT
        Argument descriptor for change tracking behavior.
      • TABLE_INFO_ARGUMENT_NAME

        public static final java.lang.String TABLE_INFO_ARGUMENT_NAME
        The name of the table info argument.
        See Also:
        Constant Field Values
      • TABLE_INFO_ARGUMENT_DESCRIPTOR

        public static final ArgumentDescriptor TABLE_INFO_ARGUMENT_DESCRIPTOR
        Argument descriptor for a table info argument.
      • tableHelper

        protected AuthorTableHelper tableHelper
        Table helper, has methods specific to each document type.
    • Constructor Detail

      • AbstractTableOperation

        public AbstractTableOperation​(AuthorTableHelper authorTableHelper)
        Constructor.
        Parameters:
        authorTableHelper - Table helper, has methods specific to each document type.
      • AbstractTableOperation

        public AbstractTableOperation​(AuthorTableHelper authorTableHelper,
                                      boolean markAsChange)
        Constructor.
        Parameters:
        authorTableHelper - Table helper, has methods specific to each document type.
        markAsChange - true if the operation result is marked as a change.
    • Method Detail

      • getElementAncestor

        protected AuthorElement getElementAncestor​(AuthorNode node,
                                                   int type)
        Search for an ancestor AuthorNode with the specified type.
        Parameters:
        node - The starting node.
        type - The type of the ancestor.
        Returns:
        The ancestor node of the given node or the node itself if the type matches.
      • isElement

        protected boolean isElement​(AuthorNode node,
                                    java.lang.String elemLocalName)
        Test if a given AuthorNode is an element and has the a specific local name.
        Parameters:
        node - The AuthorNode to be checked.
        elemLocalName - The local name of the element.
        Returns:
        true if the given AuthorNode is an element and its local name matches the given string.
      • findCellInsertionOffset

        protected int findCellInsertionOffset​(AuthorAccess authorAccess,
                                              AuthorElement tableElement,
                                              int row,
                                              int column)
        Find the offset in the document where a new entry (table cell) should be inserted for the given table row and column.
        Parameters:
        authorAccess - The author access. Provides access to specific informations and actions for editor, document, workspace, tables, change tracking, utility
        tableElement - The element rendered as a table. Its 'display' CSS property is set to 'table'.
        row - The table row where the insertion will occur, 0 based.
        column - The column where the insertion will occur, 0 based.
        Returns:
        The offset where the new entry should be inserted.
      • createEmptyCell

        protected AuthorDocumentFragment createEmptyCell​(AuthorAccess authorAccess,
                                                         AuthorElement cell,
                                                         java.lang.String[] skippedAttributes)
                                                  throws javax.swing.text.BadLocationException
        Create an AuthorDocumentFragment representing an empty cell by duplicating the given cell without its content and skipping the specified attributes.
        Parameters:
        authorAccess - The author access. Provides access to specific informations and actions for editor, document, workspace, tables, change tracking, utility
        cell - The reference cell.
        skippedAttributes - The attributes which should not be copied.
        Returns:
        The document fragment representing the empty cell created starting from the original cell.
        Throws:
        javax.swing.text.BadLocationException - When the fragment cannot be created.
      • doOperationInternal

        protected abstract void doOperationInternal​(AuthorAccess authorAccess,
                                                    ArgumentsMap args)
                                             throws AuthorOperationException
        Perform the actual operation.
        Parameters:
        authorAccess - The author access. Provides access to specific informations and actions for editor, document, workspace, tables, change tracking, utility a.s.o.
        args - The map of arguments. All the arguments defined by method AuthorOperation.getArguments() must be present in the map of arguments.
        Throws:
        java.lang.IllegalArgumentException - Thrown when one or more arguments are illegal.
        AuthorOperationException - Thrown when the operation fails.