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 Summary
FieldsModifier and TypeFieldDescriptionstatic final ArgumentDescriptorArgument descriptor for change tracking behavior.static final ArgumentDescriptorArgument descriptor for a table info argument.static final StringThe name of the table info argument.protected AuthorTableHelperTable helper, has methods specific to each document type.Fields inherited from interface ro.sync.ecss.extensions.api.AuthorOperation
NAMESPACE_ARGUMENT, NAMESPACE_ARGUMENT_DESCRIPTOR, SCHEMA_AWARE_ARGUMENT, SCHEMA_AWARE_ARGUMENT_DESCRIPTOR -
Constructor Summary
ConstructorsConstructorDescriptionAbstractTableOperation(AuthorTableHelper authorTableHelper) Constructor.AbstractTableOperation(AuthorTableHelper authorTableHelper, boolean markAsChange) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected AuthorDocumentFragmentcreateEmptyCell(AuthorAccess authorAccess, AuthorElement cell, String[] skippedAttributes) Create anAuthorDocumentFragmentrepresenting an empty cell by duplicating the given cell without its content and skipping the specified attributes.final voiddoOperation(AuthorAccess authorAccess, ArgumentsMap args) Perform the actual operation.protected abstract voiddoOperationInternal(AuthorAccess authorAccess, ArgumentsMap args) Perform the actual operation.protected intfindCellInsertionOffset(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.protected AuthorElementgetElementAncestor(AuthorNode node, int type) Search for an ancestorAuthorNodewith the specified type.protected booleanisElement(AuthorNode node, String elemLocalName) Test if a givenAuthorNodeis an element and has the a specific local name.protected booleanisTableElement(AuthorNode node, int type) Test if anAuthorNodeis an element and it has one of the following types:AuthorTableHelper.TYPE_CELL,AuthorTableHelper.TYPE_ROWorAuthorTableHelper.TYPE_TABLE.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ro.sync.ecss.extensions.api.AuthorOperation
getArgumentsMethods inherited from interface ro.sync.ecss.extensions.api.Extension
getDescription
-
Field Details
-
CHANGE_TRACKING_BEHAVIOR_ARGUMENT
Argument descriptor for change tracking behavior. -
TABLE_INFO_ARGUMENT_NAME
The name of the table info argument.- See Also:
-
TABLE_INFO_ARGUMENT_DESCRIPTOR
Argument descriptor for a table info argument. -
tableHelper
Table helper, has methods specific to each document type.
-
-
Constructor Details
-
AbstractTableOperation
Constructor.- Parameters:
authorTableHelper- Table helper, has methods specific to each document type.
-
AbstractTableOperation
Constructor.- Parameters:
authorTableHelper- Table helper, has methods specific to each document type.markAsChange-trueif the operation result is marked as a change.
-
-
Method Details
-
getElementAncestor
Search for an ancestorAuthorNodewith the specified type.- Parameters:
node- The starting node.type- The type of the ancestor.- Returns:
- The ancestor node of the given
nodeor thenodeitself if the type matches.
-
isElement
Test if a givenAuthorNodeis an element and has the a specific local name.- Parameters:
node- TheAuthorNodeto be checked.elemLocalName- The local name of the element.- Returns:
trueif the givenAuthorNodeis an element and its local name matches the given string.
-
isTableElement
Test if anAuthorNodeis an element and it has one of the following types:AuthorTableHelper.TYPE_CELL,AuthorTableHelper.TYPE_ROWorAuthorTableHelper.TYPE_TABLE.- Parameters:
node- The node to be checked.type- The type to search for.- Returns:
trueif thenodeis 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, utilitytableElement- 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 anAuthorDocumentFragmentrepresenting 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, utilitycell- 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:AuthorOperationPerform 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 theWorkspaceyou may use:AuthorAccess.getWorkspaceAccess().- Specified by:
doOperationin interfaceAuthorOperation- 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 methodAuthorOperation.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 methodAuthorOperation.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.
-