Class SortOperation
java.lang.Object
ro.sync.ecss.extensions.commons.sort.SortOperation
- All Implemented Interfaces:
AuthorOperation
,Extension
- Direct Known Subclasses:
DITAListSortOperation
,DocbookListSortOperation
,TableSortOperation
,TEIListSortOperation
,XHTMLListSortOperation
@API(type=INTERNAL,
src=PUBLIC)
public abstract class SortOperation
extends Object
implements AuthorOperation
Sort operations base class.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuthorAccess
The Author access.protected static final String
String used in the default name for the sorting criterion.Fields inherited from interface ro.sync.ecss.extensions.api.AuthorOperation
NAMESPACE_ARGUMENT, NAMESPACE_ARGUMENT_DESCRIPTOR, SCHEMA_AWARE_ARGUMENT, SCHEMA_AWARE_ARGUMENT_DESCRIPTOR
-
Constructor Summary
ConstructorsConstructorDescriptionSortOperation
(String selElementsString, String allElementsString) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionabstract void
canBeSorted
(AuthorElement parent, int[] selectedNonIgnoredChildrenInterval) Check if the parent element selected children can be sorted.void
doOperation
(AuthorAccess authorAccess, ArgumentsMap args) Perform the actual operation.protected boolean
protected String
Get the ID of the help page which will be called by the end user.protected List<AuthorNode>
getNonIgnoredChildren
(AuthorElement parent) Returns a list of non ignored children.int[]
Return the interval of sortable nodes indices covered by selection.abstract List<CriterionInformation>
getSortCriteria
(AuthorElement parent) Obtain the sort criterion.abstract String[]
getSortKeysValues
(AuthorNode node, SortCriteriaInformation sortInfo) Obtain the values of the keys that can be used for sorting.abstract AuthorElement
getSortParent
(int offset, AuthorAccess authorAccess) Obtain the parent node of all the nodes which will be sorted.protected String
Given a node obtain the content to be used during the sort operation.abstract boolean
isIgnored
(AuthorNode node) Checks if a given node is ignored when sorting.
-
Field Details
-
COLUMN
String used in the default name for the sorting criterion.- See Also:
-
authorAccess
The Author access.
-
-
Constructor Details
-
SortOperation
Constructor.- Parameters:
selElementsString
- The name of the "selected elements" radio combo.allElementsString
- The name of the "all elements" radio combo.
-
-
Method Details
-
getDescription
- Specified by:
getDescription
in interfaceExtension
- Returns:
- The description of the extension.
- See Also:
-
doOperation
public 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 theWorkspace
you may use:AuthorAccess.getWorkspaceAccess()
.- Specified by:
doOperation
in 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:
-
canBeSorted
public abstract void canBeSorted(AuthorElement parent, int[] selectedNonIgnoredChildrenInterval) throws AuthorOperationException Check if the parent element selected children can be sorted. For example a table row containing a cell with rowspan cannot be sorted and stops the operation.- Parameters:
parent
- The parent of the elements which will be sorted.selectedNonIgnoredChildrenInterval
- The interval of selected children indices.- Throws:
AuthorOperationException
- When the given node is not sortable. For example a table row containing a cell with multiple rowspan stops the operation.
-
getSelectedNonIgnoredChildrenInterval
Return the interval of sortable nodes indices covered by selection.- Parameters:
parent
- The parent node for the sortable nodes.- Returns:
- An interval of sortable nodes indices that can be sorted.
Typically it returns a non-null interval when the selected sortable nodes from parent are part of a continuous sequence.
If the selection must be ignored or the sequence of selected nodes is discontinuous it returns
null
.
-
forceSortAll
protected boolean forceSortAll()- Returns:
true
if the sort operation should not use the selected element and should always sort all elements.
-
getNonIgnoredChildren
Returns a list of non ignored children.- Parameters:
parent
- The parent node.- Returns:
- A list of non ignored children.
-
getSortParent
public abstract AuthorElement getSortParent(int offset, AuthorAccess authorAccess) throws AuthorOperationException Obtain the parent node of all the nodes which will be sorted.- Parameters:
offset
- The offset where the operation was invoked.authorAccess
- TheAuthorAccess
.- Returns:
- The parent node of the nodes which will be sorted.
- Throws:
AuthorOperationException
- When the offset is negative or greater than the content length.
-
isIgnored
Checks if a given node is ignored when sorting.- Parameters:
node
- The node to be checked.- Returns:
true
if the given node is ignored when sorting.
-
getSortKeysValues
public abstract String[] getSortKeysValues(AuthorNode node, SortCriteriaInformation sortInfo) throws AuthorOperationException Obtain the values of the keys that can be used for sorting.- Parameters:
node
- The element which will be sorted.sortInfo
- The sort information corresponding to the user choice.- Returns:
- an array containing the values of the keys which can be used for sorting.
- Throws:
AuthorOperationException
- If the text content cannot be obtained.
-
getSortCriteria
public abstract List<CriterionInformation> getSortCriteria(AuthorElement parent) throws AuthorOperationException Obtain the sort criterion.- Parameters:
parent
- The parent node of the nodes which will be sorted.- Returns:
- A
SortCriteriaInformation
containing theCriterionInformation
objects. - Throws:
AuthorOperationException
-
getArguments
- Specified by:
getArguments
in interfaceAuthorOperation
- Returns:
- An array of
ArgumentDescriptor
representing the arguments this operation uses. - See Also:
-
getTextContentToSort
Given a node obtain the content to be used during the sort operation. In general this text does not contain the deleted changes and the leading or trailing spaces.- Parameters:
node
- The node to get the value for.- Returns:
- The test to be considered as sort key value.
-
getHelpPageID
Get the ID of the help page which will be called by the end user.- Returns:
- the ID of the help page which will be called by the end user or
null
.
-