@API(type=EXTENDABLE, src=PUBLIC) public class DefaultAuthorActionEventHandler extends java.lang.Object implements AuthorActionEventHandler
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.
AuthorActionEventHandler.AuthorActionEventType
Constructor and Description |
---|
DefaultAuthorActionEventHandler() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
areCompatibleLists(AuthorNode node1,
AuthorNode node2)
Check if two given nodes are compatible lists (i.e.
|
boolean |
canHandleEvent(AuthorAccess authorAccess,
AuthorActionEventHandler.AuthorActionEventType type)
Check if an Author action event can be handled.
|
java.lang.String |
getDescription() |
protected java.lang.String |
getPreferredXMLElementContent(AuthorAccess authorAccess)
Get the preferred XML element content to be inserted.
|
boolean |
handleEvent(AuthorAccess authorAccess,
AuthorActionEventHandler.AuthorActionEventType eventType)
An event was generated.
|
protected boolean |
isList(AuthorNode node)
Check if the given node is a list.
|
protected boolean |
isMovableListItem(AuthorAccess authorAccess,
AuthorNode candidate)
Checks if this node represents a list item that can be promoted/demoted.
|
protected ContentInterval |
promote(AuthorDocumentController controller,
int offset,
java.util.List<AuthorNode> candidates,
boolean hasSelection)
Unwraps these list items from the list.
|
protected void |
promoteSubListItems(AuthorDocumentController controller,
AuthorNode theDemotedCandidate,
AuthorNode listElement)
Sometimes, when we demote a list item, we want it to become the sibling
of its children.
|
public boolean handleEvent(AuthorAccess authorAccess, AuthorActionEventHandler.AuthorActionEventType eventType)
AuthorActionEventHandler
handleEvent
in interface AuthorActionEventHandler
authorAccess
- Author access.eventType
- The type of the generated event.true
if the event was handled and the default operation
should be skipped, false
to let the default operation execute.AuthorActionEventHandler.handleEvent(ro.sync.ecss.extensions.api.AuthorAccess, ro.sync.ecss.extensions.api.AuthorActionEventHandler.AuthorActionEventType)
protected java.lang.String getPreferredXMLElementContent(AuthorAccess authorAccess)
null
.authorAccess
- The author access.protected boolean isMovableListItem(AuthorAccess authorAccess, AuthorNode candidate)
authorAccess
- The Author access.candidate
- The node that candidates for promotion/demotion.true
if the list item can be promoted/demoted.protected ContentInterval promote(AuthorDocumentController controller, int offset, java.util.List<AuthorNode> candidates, boolean hasSelection) throws javax.swing.text.BadLocationException, AuthorOperationException
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.javax.swing.text.BadLocationException
AuthorOperationException
protected void promoteSubListItems(AuthorDocumentController controller, AuthorNode theDemotedCandidate, AuthorNode listElement) throws javax.swing.text.BadLocationException, AuthorOperationException
controller
- The Author document controller.theDemotedCandidate
- The candidate which was demoted.listElement
- The parent list of the demoted item.AuthorOperationException
javax.swing.text.BadLocationException
protected boolean isList(AuthorNode node)
node
- The node.true
if the node is a list.protected boolean areCompatibleLists(AuthorNode node1, AuthorNode node2)
true
if the two given nodes are compatible lists.public boolean canHandleEvent(AuthorAccess authorAccess, AuthorActionEventHandler.AuthorActionEventType type)
AuthorActionEventHandler
canHandleEvent
in interface AuthorActionEventHandler
authorAccess
- Access to the Author API.type
- The type of event generated.true
if the Author action event can be handled.AuthorActionEventHandler.canHandleEvent(AuthorAccess, AuthorActionEventType)
public java.lang.String getDescription()
getDescription
in interface Extension
Extension.getDescription()
© Copyright SyncRO Soft SRL 2002 - 2016. All rights reserved.