Class SortOperation

    • Field Detail

      • COLUMN

        protected static final java.lang.String COLUMN
        String used in the default name for the sorting criterion.
        See Also:
        Constant Field Values
      • authorAccess

        protected AuthorAccess authorAccess
        The Author access.
    • Constructor Detail

      • SortOperation

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

      • 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 java.util.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 java.lang.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.
      • getTextContentToSort

        protected java.lang.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 java.lang.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.