Class DefaultAuthorActionEventHandler

    • Constructor Detail

      • DefaultAuthorActionEventHandler

        public DefaultAuthorActionEventHandler()
    • Method Detail

      • getPreferredXMLElementContent

        protected java.lang.String getPreferredXMLElementContent​(AuthorAccess authorAccess)
        Get the preferred XML element content to be inserted. Can be null.
        Parameters:
        authorAccess - The author access.
        Returns:
        the preferred XML element content to be inserted. Can be null
      • getParagraphElement

        protected java.lang.String getParagraphElement​(AuthorAccess authorAccess)
        Get the preferred XML element content to be inserted. Can be null.
        Parameters:
        authorAccess - The author access.
        Returns:
        the preferred XML element content to be inserted.
      • isMovableListItem

        protected boolean isMovableListItem​(AuthorAccess authorAccess,
                                            AuthorNode candidate)
        Checks if this node represents a list item that can be promoted/demoted.
        Parameters:
        authorAccess - The Author access.
        candidate - The node that candidates for promotion/demotion.
        Returns:
        true if the list item can be promoted/demoted.
      • promote

        protected ContentInterval promote​(AuthorDocumentController controller,
                                          int offset,
                                          java.util.List<AuthorNode> candidates,
                                          boolean hasSelection)
                                   throws javax.swing.text.BadLocationException,
                                          AuthorOperationException
        Unwraps these list items from the list. Moves them up one level in the hierarchy of nested lists.
        Parameters:
        controller - Author document controller.
        offset - If there is no selection, this is the offset where the action is invoked. Otherwise, this represents the end offset of the selection, needed for restoring caret position.
        candidates - The list items to promote.
        hasSelection - true if the promotion is performed on a selection.
        Returns:
        If there was no selection, return an interval from the next caret position to itself. Otherwise, if the selection was forward, return an interval from the lower offset to the higher one, or if the selection was backward, return an interval from the higher offset to the lower one. "From" means start offset and "to" means end offset.
        Throws:
        javax.swing.text.BadLocationException
        AuthorOperationException
      • promoteSubListItems

        protected void promoteSubListItems​(AuthorDocumentController controller,
                                           AuthorNode theDemotedCandidate,
                                           AuthorNode listElement)
                                    throws javax.swing.text.BadLocationException,
                                           AuthorOperationException
        Sometimes, when we demote a list item, we want it to become the sibling of its children. To obtain this, after demoting the item along with its children, we promote the children. This method promotes the children.
        Parameters:
        controller - The Author document controller.
        theDemotedCandidate - The candidate which was demoted.
        listElement - The parent list of the demoted item.
        Throws:
        AuthorOperationException
        javax.swing.text.BadLocationException
      • isList

        protected boolean isList​(AuthorNode node)
        Check if the given node is a list.
        Parameters:
        node - The node.
        Returns:
        true if the node is a list.
      • areCompatibleLists

        protected boolean areCompatibleLists​(AuthorNode node1,
                                             AuthorNode node2)
        Check if two given nodes are compatible lists (i.e. if we accept items from one list to migrate into the other one).
        Returns:
        true if the two given nodes are compatible lists.
      • getDescription

        public java.lang.String getDescription()
        Returns:
        The description of the extension.
        See Also:
        Extension.getDescription()
      • getContentCompletionActions

        public java.util.List<IAuthorExtensionAction> getContentCompletionActions​(AuthorAccess authorAccess,
                                                                                  int caretOffset)
        Intercepts action events in the Author mode and provides them in the content completion lists.
        Overrides:
        getContentCompletionActions in class AuthorActionEventHandlerBase
        Parameters:
        authorAccess - The author access.
        caretOffset - The caret offset.
        Returns:
        The content completion actions.