Class AbstractTableOperation

java.lang.Object
ro.sync.ecss.extensions.commons.table.operations.AbstractTableOperation
All Implemented Interfaces:
AuthorOperation, Extension
Direct Known Subclasses:
DeleteColumnOperationBase, DeleteRowOperationBase, InsertColumnOperationBase, InsertRowOperationBase, InsertTableOperation, JoinCellAboveBelowOperationBase, JoinOperationBase, JoinRowCellsOperationBase, SplitCellAboveBelowOperationBase, SplitLeftRightOperationBase, SplitOperationBase

@API(type=INTERNAL, src=PUBLIC) public abstract class AbstractTableOperation extends Object implements AuthorOperation
Base class for table operations.
  • Field Details

    • 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 String TABLE_INFO_ARGUMENT_NAME
      The name of the table info argument.
      See Also:
    • 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 Details

    • 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 Details

    • 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, 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.
    • isTableElement

      protected boolean isTableElement(AuthorNode node, int type)
      Test if an AuthorNode is an element and it has one of the following types: AuthorTableHelper.TYPE_CELL, AuthorTableHelper.TYPE_ROW or AuthorTableHelper.TYPE_TABLE.
      Parameters:
      node - The node to be checked.
      type - The type to search for.
      Returns:
      true if the node is an element with the specified type.
    • 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, String[] skippedAttributes) throws 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:
      BadLocationException - When the fragment cannot be created.
    • doOperation

      public final void doOperation(AuthorAccess authorAccess, ArgumentsMap args) throws AuthorOperationException
      Description copied from interface: AuthorOperation
      Perform the actual operation. You can check if the operation was invoked from the oXygen standalone application or from the oXygen plugin for Eclipse by using the method: ApplicationInformationAccess.getPlatform(). To get to the Workspace you may use: AuthorAccess.getWorkspaceAccess().
      Specified by:
      doOperation in interface AuthorOperation
      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:
      AuthorOperationException - Thrown when the operation fails.
      See Also:
    • 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:
      IllegalArgumentException - Thrown when one or more arguments are illegal.
      AuthorOperationException - Thrown when the operation fails.