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 Details

    • COLUMN

      protected static final String COLUMN
      String used in the default name for the sorting criterion.
      See Also:
    • authorAccess

      protected AuthorAccess authorAccess
      The Author access.
  • Constructor Details

    • SortOperation

      public SortOperation(String selElementsString, String allElementsString)
      Constructor.
      Parameters:
      selElementsString - The name of the "selected elements" radio combo.
      allElementsString - The name of the "all elements" radio combo.
  • Method Details

    • getDescription

      public String getDescription()
      Specified by:
      getDescription in interface Extension
      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 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:
    • 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

      public int[] getSelectedNonIgnoredChildrenInterval(AuthorElement parent)
      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

      protected List<AuthorNode> getNonIgnoredChildren(AuthorElement parent)
      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 - The AuthorAccess.
      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

      public abstract boolean isIgnored(AuthorNode node)
      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 the CriterionInformation objects.
      Throws:
      AuthorOperationException
    • getArguments

      public ArgumentDescriptor[] getArguments()
      Specified by:
      getArguments in interface AuthorOperation
      Returns:
      An array of ArgumentDescriptor representing the arguments this operation uses.
      See Also:
    • getTextContentToSort

      protected String getTextContentToSort(AuthorNode node)
      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

      protected String 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.