@API(type=EXTENDABLE, src=PUBLIC) public class AuthorSchemaAwareEditingHandlerAdapter extends java.lang.Object implements AuthorSchemaAwareEditingHandler
Modifier and Type | Class and Description |
---|---|
static class |
AuthorSchemaAwareEditingHandlerAdapter.WrapInAncestorsOptions
One of the default smart paste strategies involves detecting an path o ancestors
from the context element to the inserted one.
|
Modifier and Type | Field and Description |
---|---|
protected SchemaAwareHandlerResult |
lastHandlerResult
Last handler result.
|
ACTION_ID_BACKSPACE, ACTION_ID_CUT, ACTION_ID_DELETE, ACTION_ID_DND, ACTION_ID_INSERT_FRAGMENT, ACTION_ID_PASTE, ACTION_ID_TYPING, CREATE_FRAGMENT_PURPOSE_COPY, CREATE_FRAGMENT_PURPOSE_CUT, CREATE_FRAGMENT_PURPOSE_DND_COPY, CREATE_FRAGMENT_PURPOSE_DND_MOVE
Constructor and Description |
---|
AuthorSchemaAwareEditingHandlerAdapter() |
Modifier and Type | Method and Description |
---|---|
boolean |
canBeReplaced(AuthorNode nodeToReplace)
When pasting an element inside an empty element with the same name, a
possible solution is to replace the empty node with the new one.
|
boolean |
changeElementsToMoveUpDown(java.util.List<AuthorNode> selectedElements)
Determine the elements that should be moved by the Move Up/Down operation.
|
AuthorSchemaAwareEditingHandlerAdapter.WrapInAncestorsOptions |
getAncestorDetectionOptions()
One of the default smart paste strategies involves detecting an path o ancestors
from the context element to the inserted one.
|
SchemaAwareHandlerResult |
getLastResult()
Deprecated.
Will be removed in a future version
|
AuthorDocumentFragment |
handleCreateDocumentFragment(int startOffset,
int endOffset,
int creationPurposeID,
AuthorAccess authorAccess)
Create an AuthorDocumentFragment for a paste or DnD purpose
|
boolean |
handleDelete(int offset,
int deleteType,
AuthorAccess authorAccess,
boolean wordLevel)
Handle a keyboard delete event at the given offset (using Delete or Backspace keys) in the Author edit area.
|
boolean |
handleDeleteElementTags(AuthorNode nodeToUnwrap,
AuthorAccess authorAccess)
Handle delete element tags event.
|
boolean |
handleDeleteNodes(AuthorNode[] nodes,
int deleteType,
AuthorAccess authorAccess)
Handle a delete nodes event coming from the Outline or Bread crumb.
|
boolean |
handleDeleteSelection(int selectionStart,
int selectionEnd,
int generatedByActionId,
AuthorAccess authorAccess)
Handle a delete selection event in the Author edit area.
|
boolean |
handleJoinElements(AuthorNode targetNode,
java.util.List<AuthorNode> nodesToJoin,
AuthorAccess authorAccess)
Handle a join event between the given nodes.
|
boolean |
handlePasteFragment(int offset,
AuthorDocumentFragment[] fragmentsToInsert,
int actionId,
AuthorAccess authorAccess)
Handle an insert fragment event generated by:
a Paste action.
|
boolean |
handleTyping(int offset,
char ch,
AuthorAccess authorAccess)
Handle a typing event.
|
boolean |
handleTypingFallback(int offset,
char ch,
AuthorAccess authorAccess)
Give a fallback solution for a typing event.
|
protected SchemaAwareHandlerResult lastHandlerResult
public AuthorSchemaAwareEditingHandlerAdapter()
public boolean handleDelete(int offset, int deleteType, AuthorAccess authorAccess, boolean wordLevel) throws InvalidEditException
AuthorSchemaAwareEditingHandler
handleDelete
in interface AuthorSchemaAwareEditingHandler
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.true
if the event was handled.InvalidEditException
- This is an invalid edit and must be rejected.AuthorSchemaAwareEditingHandler.handleDelete(int, int, ro.sync.ecss.extensions.api.AuthorAccess, boolean)
public boolean handleDeleteElementTags(AuthorNode nodeToUnwrap, AuthorAccess authorAccess) throws InvalidEditException
AuthorSchemaAwareEditingHandler
handleDeleteElementTags
in interface AuthorSchemaAwareEditingHandler
nodeToUnwrap
- The node to delete element tags.authorAccess
- Access class to the author functions.true
if the event was handled.InvalidEditException
- This is an invalid edit and must be rejected.AuthorSchemaAwareEditingHandler.handleDeleteElementTags(ro.sync.ecss.extensions.api.node.AuthorNode, ro.sync.ecss.extensions.api.AuthorAccess)
public boolean handleDeleteSelection(int selectionStart, int selectionEnd, int generatedByActionId, AuthorAccess authorAccess) throws InvalidEditException
AuthorSchemaAwareEditingHandler
handleDeleteSelection
in interface AuthorSchemaAwareEditingHandler
selectionStart
- Selection start offset.selectionEnd
- Selection end offset.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.true
if the event was handled.InvalidEditException
- This is an invalid edit and must be rejected.AuthorSchemaAwareEditingHandler.handleDeleteSelection(int, int, int, ro.sync.ecss.extensions.api.AuthorAccess)
public boolean handleJoinElements(AuthorNode targetNode, java.util.List<AuthorNode> nodesToJoin, AuthorAccess authorAccess) throws InvalidEditException
AuthorSchemaAwareEditingHandler
handleJoinElements
in interface AuthorSchemaAwareEditingHandler
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.true
if the event was handled.InvalidEditException
- This is an invalid edit and must be rejected.AuthorSchemaAwareEditingHandler.handleJoinElements(ro.sync.ecss.extensions.api.node.AuthorNode, java.util.List, ro.sync.ecss.extensions.api.AuthorAccess)
public boolean handlePasteFragment(int offset, AuthorDocumentFragment[] fragmentsToInsert, int actionId, AuthorAccess authorAccess) throws InvalidEditException
AuthorSchemaAwareEditingHandler
AuthorDocumentController.insertXMLFragmentSchemaAware(String, int)
. Selection removal is handled
before calling this method.handlePasteFragment
in interface AuthorSchemaAwareEditingHandler
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.true
if the insertion was handled.InvalidEditException
- This is an invalid edit and must be rejected.AuthorSchemaAwareEditingHandler.handlePasteFragment(int, ro.sync.ecss.extensions.api.node.AuthorDocumentFragment[], int, ro.sync.ecss.extensions.api.AuthorAccess)
public boolean handleTyping(int offset, char ch, AuthorAccess authorAccess) throws InvalidEditException
AuthorSchemaAwareEditingHandler
AuthorSchemaAwareEditingHandler.handleTypingFallback(int, char, AuthorAccess)
will get called.handleTyping
in interface AuthorSchemaAwareEditingHandler
offset
- Offset where the typing occurred.ch
- The typed character.authorAccess
- Access class to the author functions.true
if the typing was handled.InvalidEditException
- This is an invalid edit and must be rejected.AuthorSchemaAwareEditingHandler.handleTyping(int, char, ro.sync.ecss.extensions.api.AuthorAccess)
@Deprecated public SchemaAwareHandlerResult getLastResult()
null
if event was not handled.public AuthorDocumentFragment handleCreateDocumentFragment(int startOffset, int endOffset, int creationPurposeID, AuthorAccess authorAccess) throws javax.swing.text.BadLocationException
handleCreateDocumentFragment
in interface AuthorSchemaAwareEditingHandler
startOffset
- Start offset of fragmentendOffset
- End offset of fragmentcreationPurposeID
- One of the CREATE_FRAGMENT_* constants in this class.authorAccess
- Access to the Author API.javax.swing.text.BadLocationException
AuthorSchemaAwareEditingHandler.handleCreateDocumentFragment(int, int, int, ro.sync.ecss.extensions.api.AuthorAccess)
public boolean handleDeleteNodes(AuthorNode[] nodes, int deleteType, AuthorAccess authorAccess) throws InvalidEditException
AuthorSchemaAwareEditingHandler
handleDeleteNodes
in interface AuthorSchemaAwareEditingHandler
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.true
if the event was handled.InvalidEditException
- This is an invalid edit and must be rejected.AuthorSchemaAwareEditingHandler.handleDeleteNodes(ro.sync.ecss.extensions.api.node.AuthorNode[], int, ro.sync.ecss.extensions.api.AuthorAccess)
public boolean handleTypingFallback(int offset, char ch, AuthorAccess authorAccess) throws InvalidEditException
AuthorSchemaAwareEditingHandler
AuthorSchemaAwareEditingHandler.handleTyping(int, char, AuthorAccess)
method did not handle the
typing event and neither did the AuthorSchemaAwareEditingHandler.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.
handleTypingFallback
in interface AuthorSchemaAwareEditingHandler
offset
- Offset where the typing occurred.ch
- The typed character.authorAccess
- Access class to the author functions.true
if the typing was handled.InvalidEditException
- This is an invalid edit and must be rejected.AuthorSchemaAwareEditingHandler.handleTypingFallback(int, char, ro.sync.ecss.extensions.api.AuthorAccess)
public boolean changeElementsToMoveUpDown(java.util.List<AuthorNode> selectedElements)
title
then the element
that should actually be moved is its parent (e.g. section
for DocBook).selectedElements
- the selected elements in the author page. This list should be altered
depending on the framework specific structure.
title
then the element
that should actually be present in this list is its parent (e.g. section
for DocBook).true
if the list of elements to be moved was altered by the framework specific handler.public AuthorSchemaAwareEditingHandlerAdapter.WrapInAncestorsOptions getAncestorDetectionOptions()
Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.
public boolean canBeReplaced(AuthorNode nodeToReplace)
nodeToReplace
- The node to replace.true
if this node can be replaced by the strategy with a
similar one. false
if this node is important and must be kept in the document.Please note that this API is not marked as final and it can change in one of the next versions of the application. If you have suggestions, comments about it, please let us know.
© Copyright SyncRO Soft SRL 2002 - 2016. All rights reserved.