Interface AuthorSchemaAwareEditingHandler

All Known Implementing Classes:
AuthorSchemaAwareEditingHandlerAdapter, DITAMapSchemaAwareEditingHandler, DITASchemaAwareEditingHandler, Docbook5SchemaAwareEditingHandler, DocbookSchemaAwareEditingHandler, TEISchemaAwareEditingHandler

@API(type=EXTENDABLE, src=PUBLIC) public interface AuthorSchemaAwareEditingHandler
If Schema Aware mode is active in Oxygen, all actions that can generate invalid content will be redirected toward this handler. The handler can either resolve a specific case, let the default implementation take place or reject the edit entirely by throwing an InvalidEditException.

It is recommended to extend class AuthorSchemaAwareEditingHandlerAdapter in order to be protected from any API additions that may occur in interface AuthorSchemaAwareEditingHandler.

  • Field Details

    • ACTION_ID_TYPING

      static final int ACTION_ID_TYPING
      Typing action.
      See Also:
    • ACTION_ID_DELETE

      static final int ACTION_ID_DELETE
      Delete action through delete key.
      See Also:
    • ACTION_ID_BACKSPACE

      static final int ACTION_ID_BACKSPACE
      Delete action through backspace key.
      See Also:
    • ACTION_ID_PASTE

      static final int ACTION_ID_PASTE
      Paste action.
      See Also:
    • ACTION_ID_CUT

      static final int ACTION_ID_CUT
      Cut action.
      See Also:
    • ACTION_ID_DND

      static final int ACTION_ID_DND
      DND action.
      See Also:
    • ACTION_ID_INSERT_FRAGMENT

      static final int ACTION_ID_INSERT_FRAGMENT
      Insert document fragment action by an action other than PASTE or DND.
      See Also:
    • CREATE_FRAGMENT_PURPOSE_COPY

      static final int CREATE_FRAGMENT_PURPOSE_COPY
      Create a fragment for copy.
      See Also:
    • CREATE_FRAGMENT_PURPOSE_CUT

      static final int CREATE_FRAGMENT_PURPOSE_CUT
      Create a fragment for cut.
      See Also:
    • CREATE_FRAGMENT_PURPOSE_DND_COPY

      static final int CREATE_FRAGMENT_PURPOSE_DND_COPY
      Create a fragment for DND copy.
      See Also:
    • CREATE_FRAGMENT_PURPOSE_DND_MOVE

      static final int CREATE_FRAGMENT_PURPOSE_DND_MOVE
      Create a fragment for DND move.
      See Also:
  • Method Details

    • handleDelete

      boolean handleDelete(int offset, int deleteType, AuthorAccess authorAccess, boolean wordLevel) throws InvalidEditException
      Handle a keyboard delete event at the given offset (using Delete or Backspace keys) in the Author edit area.
      Parameters:
      offset - Offset where the delete event happened.
      deleteType - ACTION_ID_DELETE if Delete key was used or ACTION_ID_BACKSPACE for Backspace.
      authorAccess - Access class to the author functions.
      wordLevel - true if the user requested a delete for a whole word.
      Returns:
      true if the event was handled.
      Throws:
      InvalidEditException - This is an invalid edit and must be rejected.
    • handleDeleteNodes

      boolean handleDeleteNodes(AuthorNode[] nodes, int deleteType, AuthorAccess authorAccess) throws InvalidEditException
      Handle a delete nodes event coming from the Outline or Bread crumb.
      Parameters:
      nodes - The nodes to delete.
      deleteType - ACTION_ID_DELETE if the nodes were deleted directly by the user or ACTION_ID_DND if the nodes were deleted as a result of a drag and drop move operation in the Outline.
      authorAccess - Access class to the author functions.
      Returns:
      true if the event was handled.
      Throws:
      InvalidEditException - This is an invalid edit and must be rejected.
      Since:
      12.1
    • handleDeleteSelection

      boolean handleDeleteSelection(int selectionStart, int selectionEnd, int generatedByActionId, AuthorAccess authorAccess) throws InvalidEditException
      Handle a delete selection event in the Author edit area. The event is generated when a selection exists inside the document and one of following actions takes place:
      • typing (insert a new character in document by typing);
      • cut;
      • DND move;
      • delete or backspace.
      Parameters:
      selectionStart - Selection start offset, inclusive.
      selectionEnd - Selection end offset, inclusive.
      generatedByActionId - An id identifying the action that generated this event. One of the following constants are possible: ACTION_ID_TYPING, ACTION_ID_DELETE, ACTION_ID_PASTE, ACTION_ID_CUT, ACTION_ID_DND, ACTION_ID_INSERT_FRAGMENT.
      authorAccess - Access class to the author functions.
      Returns:
      true if the event was handled.
      Throws:
      InvalidEditException - This is an invalid edit and must be rejected.
    • handlePasteFragment

      boolean handlePasteFragment(int offset, AuthorDocumentFragment[] fragmentsToInsert, int actionId, AuthorAccess authorAccess) throws InvalidEditException
      Handle an insert fragment event generated by:
      • a Paste action. In this case, selection removal is handled before calling this method.
      • a DND action. In this case source removal is handled after calling this method (unless an exception was thrown).
      • an insert fragment event occurred as a result of an schema aware insert event, like AuthorDocumentController.insertXMLFragmentSchemaAware(String, int). Selection removal is handled before calling this method.
      Parameters:
      offset - Offset where the event occurred.
      fragmentsToInsert - Fragments to be inserted.
      actionId - ACTION_ID_PASTE if event was generated by paste action, ACTION_ID_DND if it was generated by a DND event or ACTION_ID_INSERT_FRAGMENT if the event was generated by an AuthorDocumentController schema aware insert method.
      authorAccess - Access class to the author functions.
      Returns:
      true if the insertion was handled.
      Throws:
      InvalidEditException - This is an invalid edit and must be rejected.
    • handleTyping

      boolean handleTyping(int offset, char ch, AuthorAccess authorAccess) throws InvalidEditException
      Handle a typing event. If the event is not handled, the default implementation of a handler will be given a chance to handle the event. If that fails to provide a solution, handleTypingFallback(int, char, AuthorAccess) will get called.
      Parameters:
      offset - Offset where the typing occurred.
      ch - The typed character.
      authorAccess - Access class to the author functions.
      Returns:
      true if the typing was handled.
      Throws:
      InvalidEditException - This is an invalid edit and must be rejected.
    • handleCodePointTyping

      default boolean handleCodePointTyping(int offset, int codePoint, AuthorAccess authorAccess) throws InvalidEditException
      Handle a typing event. If the event is not handled, the default implementation of a handler will be given a chance to handle the event. If that fails to provide a solution, handleCodePointTypingFallback(int, int, AuthorAccess) will get called.
      Parameters:
      offset - Offset where the typing occurred.
      codePoint - The typed Unicode code point.
      authorAccess - Access class to the author functions.
      Returns:
      true if the typing was handled.
      Throws:
      InvalidEditException - This is an invalid edit and must be rejected.
      Since:
      26.1
    • handleTypingFallback

      boolean handleTypingFallback(int offset, char ch, AuthorAccess authorAccess) throws InvalidEditException
      Give a fallback solution for a typing event. This call comes when this object's handleTyping(int, char, AuthorAccess) method did not handle the typing event and neither did the handleTyping(int, char, AuthorAccess) from the default implementation.

      As a fallback solution, a paragraph can be inserted at the given offset (if allowed) and then the typed character can be inserted inside it.

      Parameters:
      offset - Offset where the typing occurred.
      ch - The typed character.
      authorAccess - Access class to the author functions.
      Returns:
      true if the typing was handled.
      Throws:
      InvalidEditException - This is an invalid edit and must be rejected.
      Since:
      13.2
    • handleCodePointTypingFallback

      default boolean handleCodePointTypingFallback(int offset, int codePoint, AuthorAccess authorAccess) throws InvalidEditException
      Give a fallback solution for a typing event. This call comes when this object's handleCodePointTyping(int, int, AuthorAccess) method did not handle the typing event and neither did the handleCodePointTyping(int, int, AuthorAccess) from the default implementation.

      As a fallback solution, a paragraph can be inserted at the given offset (if allowed) and then the typed character can be inserted inside it.

      Parameters:
      offset - Offset where the typing occurred.
      codePoint - The typed Unicode code point.
      authorAccess - Access class to the author functions.
      Returns:
      true if the typing was handled.
      Throws:
      InvalidEditException - This is an invalid edit and must be rejected.
      Since:
      26.1
    • handleDeleteElementTags

      boolean handleDeleteElementTags(AuthorNode nodeToUnwrap, AuthorAccess authorAccess) throws InvalidEditException
      Handle delete element tags event. (Unwrapping)
      Parameters:
      nodeToUnwrap - The node to delete element tags.
      authorAccess - Access class to the author functions.
      Returns:
      true if the event was handled.
      Throws:
      InvalidEditException - This is an invalid edit and must be rejected.
    • handleJoinElements

      boolean handleJoinElements(AuthorNode targetNode, List<AuthorNode> nodesToJoin, AuthorAccess authorAccess) throws InvalidEditException
      Handle a join event between the given nodes.
      Parameters:
      targetNode - The node where the content of the other nodes must migrate.
      nodesToJoin - The nodes that must be joined in the target node.
      authorAccess - Access class to the author functions.
      Returns:
      true if the event was handled.
      Throws:
      InvalidEditException - This is an invalid edit and must be rejected.
    • handleCreateDocumentFragment

      AuthorDocumentFragment handleCreateDocumentFragment(int startOffset, int endOffset, int creationPurposeID, AuthorAccess authorAccess) throws BadLocationException
      Create an AuthorDocumentFragment for a purpose
      Parameters:
      authorAccess - Access to the Author API.
      startOffset - Start offset of fragment
      endOffset - End offset of fragment
      creationPurposeID - One of the CREATE_FRAGMENT_* constants in this class.
      Returns:
      The created fragment or null if the event was not handled.
      Throws:
      BadLocationException
      Since:
      12.1