Class AuthorTableOperationsHandler
- java.lang.Object
-
- ro.sync.ecss.extensions.api.table.operations.AuthorTableOperationsHandler
-
- Direct Known Subclasses:
DITAAuthorTableOperationsHandler
,DITAMapAuthorTableOperationsHandler
,DocbookAuthorTableOperationsHandler
,TEIAuthorTableOperationsHandler
,XHTMLAuthorTableOperationsHandler
@API(type=EXTENDABLE, src=PUBLIC) public class AuthorTableOperationsHandler extends java.lang.Object
Handler for Author table operations. It should be implemented when the author extension being developed offers support for editing data in tabular form.- Since:
- 14
-
-
Constructor Summary
Constructors Constructor Description AuthorTableOperationsHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description TableColumnSpecificationInformation
getColumnSpecification(AuthorAccess access, AuthorElement tableElement, int columnIndex)
Returns the column specification information of a table column.AuthorElement
getTableElementContainingOffset(AuthorAccess access, int offset)
Returns the element representing the table that contains the given offset.boolean
handleAttributeChange(AuthorAccess authorAccess, AuthorElement currentElement, java.lang.String attributeName, AttrValue newValue)
Handle an attribute change.boolean
handleCreateTable(AuthorTableArguments arguments)
Handles how a new table is created from cells selected from other table.boolean
handleDeleteColumn(AuthorTableDeleteColumnArguments arguments)
Handles delete column operation.boolean
handleDeleteRow(AuthorTableDeleteRowArguments arguments)
Deprecated.UsehandleDeleteRows(AuthorTableDeleteRowsArguments)
method instead.boolean
handleDeleteRows(AuthorTableDeleteRowsArguments arguments)
Handles delete rows operation.boolean
handleInsertColumn(AuthorTableInsertColumnArguments arguments)
Handles insert column operation.boolean
handlePasteRows(AuthorTableInsertRowArguments arguments)
Handles paste rows operation.void
handleRemoveInvalidColNamesFromTableCells(AuthorAccess authorAccess, AuthorElement tableElement, java.util.List<AuthorElement> cells)
Remove from each cell attributes pointing to missing column names (usually namest, nameend, colname).
-
-
-
Method Detail
-
handleInsertColumn
public boolean handleInsertColumn(AuthorTableInsertColumnArguments arguments) throws AuthorOperationException
Handles insert column operation.
This method is called when pasting or dropping content for which theSelectionInterpretationMode.TABLE_COLUMN
interpretation mode was imposed.
TheSelectionInterpretationMode.TABLE_COLUMN
interpretation mode is already set by default by the application when a table column is selected. It can be also imposed from theAuthorSelectionModel.setSelectionInterpretationMode(SelectionInterpretationMode)
method, for any selection content.
For instance, when two paragraphs are copied, the clipboard object contains a list with two Author document fragments (one for each paragraph). If the selection interpretation mode is imposed toSelectionInterpretationMode.TABLE_COLUMN
, when pasting the fragments this method is called. The fragments array are included in the argument object.- Parameters:
arguments
- The arguments for insert column operation like: the offset where the column is inserted, the array containing the cells fragments that compose an Author table column, information about column width specification, the Author access.- Returns:
true
if the insert column operation succeeds.- Throws:
AuthorOperationException
- An insert column operation exception. If theAuthorOperationException.isOperationRejectedOnPurpose()
method of this exception returns true, the exception is presented to the user.
-
handleDeleteColumn
public boolean handleDeleteColumn(AuthorTableDeleteColumnArguments arguments) throws AuthorOperationException
Handles delete column operation.
This method is called when deleting content (by drag and drop or cut operations) for which theSelectionInterpretationMode.TABLE_COLUMN
interpretation mode was imposed.
TheSelectionInterpretationMode.TABLE_COLUMN
interpretation mode is already set by default by the application when a table column is selected. It can be also imposed from theAuthorSelectionModel.setSelectionInterpretationMode(SelectionInterpretationMode)
method, for any selection content.
For instance, when two paragraphs are copied, the clipboard object contains a list with two Author document fragments (one for each paragraph). If the selection interpretation mode is imposed toSelectionInterpretationMode.TABLE_COLUMN
, when deleting the fragments this method is called. The fragments array are included in the argument object.- Parameters:
arguments
- The arguments for delete column operation (like the Author access and the column cells start and end offsets).- Returns:
true
if the delete column operation succeeds.- Throws:
AuthorOperationException
- A delete column operation exception. If theAuthorOperationException.isOperationRejectedOnPurpose()
method of this exception returns true, the exception is presented to the user.
-
handleDeleteRow
@Deprecated public boolean handleDeleteRow(AuthorTableDeleteRowArguments arguments) throws AuthorOperationException
Deprecated.UsehandleDeleteRows(AuthorTableDeleteRowsArguments)
method instead.Handles delete row operation.
This method is called when deleting content (by drag and drop or cut operations) for which theSelectionInterpretationMode.TABLE_ROW
interpretation mode was imposed.
TheSelectionInterpretationMode.TABLE_ROW
interpretation mode is already set by default by the application when a table row is selected. It can be also imposed from theAuthorSelectionModel.setSelectionInterpretationMode(SelectionInterpretationMode)
method, for any selection content.
For instance, when two paragraphs are copied, the clipboard object contains a list with two Author document fragments (one for each paragraph). If the selection interpretation mode is imposed toSelectionInterpretationMode.TABLE_ROW
, when deleting the fragments this method is called. The fragments array are included in the argument object.- Parameters:
arguments
- The arguments for delete row operation (like the Author access and the content interval of the row element that must be deleted).- Returns:
true
if the delete row operation succeeds.- Throws:
AuthorOperationException
- A delete row operation exception. If theAuthorOperationException.isOperationRejectedOnPurpose()
method of this exception returns true, the exception is presented to the user.
-
handleDeleteRows
public boolean handleDeleteRows(AuthorTableDeleteRowsArguments arguments) throws AuthorOperationException
Handles delete rows operation. All the rows that intersects the given content intervals will be deleted.
This method is called when deleting content (by drag and drop or cut operations) for which theSelectionInterpretationMode.TABLE_ROW
interpretation mode was imposed.
TheSelectionInterpretationMode.TABLE_ROW
interpretation mode is already set by default by the application when a table row is selected. It can be also imposed from theAuthorSelectionModel.setSelectionInterpretationMode(SelectionInterpretationMode)
method, for any selection content.
For instance, when two paragraphs are copied, the clipboard object contains a list with two Author document fragments (one for each paragraph). If the selection interpretation mode is imposed toSelectionInterpretationMode.TABLE_ROW
, when deleting the fragments this method is called.- Parameters:
arguments
- The arguments for delete rows operation (like the Author access and the content intervals that determine the rows element that must be deleted).- Returns:
true
if the delete rows operation succeeds.- Throws:
AuthorOperationException
- A delete row operation exception. If theAuthorOperationException.isOperationRejectedOnPurpose()
method of this exception returns true, the exception is presented to the user.java.lang.UnsupportedOperationException
- if this method is not implemented. In this case, thehandleDeleteRow(AuthorTableDeleteRowArguments)
operation is called for each content interval.- Since:
- 18
-
getTableElementContainingOffset
public AuthorElement getTableElementContainingOffset(AuthorAccess access, int offset)
Returns the element representing the table that contains the given offset. This method can be used to obtain the closest table that contains the given offset.- Parameters:
access
- Access to Author operations.offset
- The offset to search the parent table element for.- Returns:
- The table node that contains the given offset.
-
getColumnSpecification
public TableColumnSpecificationInformation getColumnSpecification(AuthorAccess access, AuthorElement tableElement, int columnIndex)
Returns the column specification information of a table column.
This information is requested when a column is copied or dragged and it can be used when the column must be inserted in the document (on paste or drop). The column specification is send as an argument to thehandleInsertColumn(AuthorTableInsertColumnArguments)
method.- Parameters:
access
- Access to Author operations.tableElement
- The table that contains the column.columnIndex
- The column index,0
based.- Returns:
- The column specification element. It can be
null
if there is no specification for this column.
-
handleRemoveInvalidColNamesFromTableCells
public void handleRemoveInvalidColNamesFromTableCells(AuthorAccess authorAccess, AuthorElement tableElement, java.util.List<AuthorElement> cells) throws AuthorOperationException
Remove from each cell attributes pointing to missing column names (usually namest, nameend, colname).- Parameters:
authorAccess
- The author access.tableElement
- The table element.cells
- The list of table cells.- Throws:
AuthorOperationException
- Since:
- 19.1
-
handleAttributeChange
public boolean handleAttributeChange(AuthorAccess authorAccess, AuthorElement currentElement, java.lang.String attributeName, AttrValue newValue)
Handle an attribute change.- Parameters:
authorAccess
- The Author Access.currentElement
- The current element.attributeName
- The attribute name.newValue
- The new value.- Returns:
true
if the changed was handled,false
to perform the default bahavior.- Since:
- 19.1
-
handlePasteRows
public boolean handlePasteRows(AuthorTableInsertRowArguments arguments) throws AuthorOperationException
Handles paste rows operation.
This method is called when pasting or dropping content for which theSelectionInterpretationMode.TABLE_ROW
interpretation mode was imposed.
TheSelectionInterpretationMode.TABLE_ROW
interpretation mode is already set by default by the application when a table row is selected. It can be also imposed from theAuthorSelectionModel.setSelectionInterpretationMode(SelectionInterpretationMode)
method, for any selection content.
For instance, when two paragraphs are copied, the clipboard object contains a list with two Author document fragments (one for each paragraph). If the selection interpretation mode is imposed toSelectionInterpretationMode.TABLE_ROW
, when pasting the fragments this method is called. The fragments array are included in the argument object.- Parameters:
arguments
- The arguments for insert column operation like: the offset where the rows are inserted, the array containing the rows fragments, information about column width specification, the Author access.- Returns:
true
if the paste rows operation succeeds.- Throws:
AuthorOperationException
- An insert rows operation exception. If theAuthorOperationException.isOperationRejectedOnPurpose()
method of this exception returns true, the exception is presented to the user.
-
handleCreateTable
public boolean handleCreateTable(AuthorTableArguments arguments) throws AuthorOperationException
Handles how a new table is created from cells selected from other table.- Parameters:
arguments
- The arguments for copied cells like: the offset where the rows are inserted, the array containing the rows fragments, how many rows and columns the new table should have, the Author access.- Returns:
true
of the table was successfully created.- Throws:
AuthorOperationException
- A table creation exception. If theAuthorOperationException.isOperationRejectedOnPurpose()
method of this exception returns true, the exception is presented to the user.- Since:
- 21.1
-
-