Interface WSAuthorEditorPageBase
-
- All Superinterfaces:
AuthorTooltipCustomizerProvider
,WSEditorPage
,WSTextBasedEditorPage
- All Known Subinterfaces:
AuthorEditorAccess
,IWebappAuthorEditorAccess
,WSAuthorComponentEditorPage
,WSAuthorEditorPage
@API(type=NOT_EXTENDABLE, src=PUBLIC) public interface WSAuthorEditorPageBase extends WSTextBasedEditorPage, AuthorTooltipCustomizerProvider
Provides access to methods related to the Author editor actions and information.- Since:
- 11.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description void
addAuthorAttributesDisplayFilter(AuthorAttributesDisplayFilter attributesDisplayFilter)
Adds a filter for displaying attributes to the current author page.void
addAuthorCaretListener(AuthorCaretListener caretListener)
Adds a caret listener to the Author page.void
addAuthorMouseListener(AuthorMouseListener mouseListener)
Adds a mouse listener to the current author page.void
addDNDListener(java.lang.Object dndListener)
Add a drag and drop listener in the Author editing mode.void
addPopUpMenuCustomizer(AuthorPopupMenuCustomizer popUpCustomizer)
Add the pop-up menu customizer which can be used to customize the pop-up menu (add/remove actions) before showing it in the Author page.java.net.URL
buildURLForReferencedContent(int caretOffset, boolean shortAnchor)
If the caret offset is somewhere inside an entity reference, an xi:include reference or a DITA content reference, this method will return an URL which when used with Oxygen's API (ro.sync.exml.workspace.api.Workspace.open(URL)) will open the target resource and then place the caret in the opened editor precisely at the location where it was in the original XML document which referenced the content.void
deleteSelection()
Delete the current selected text, if any.void
editAttribute(AuthorElement targetElement, java.lang.String attributeName)
Searches through the in-place editors added on the given element for the first one that edits the given attribute.AuthorActionsProvider
getActionsProvider()
Provides access to actions already defined in the Author page like: Undo, Redo, Display Full Tags, Edit Attributes, etc.java.lang.Object
getAuthorComponent()
Get the internal component on which the Author page is rendered.AuthorFoldManager
getAuthorFoldManager()
Get the fold manager which can be used to expand or collapse a fold.AuthorSelectionModel
getAuthorSelectionModel()
Get the Author selection model containing access to all Author selection intervals and methods for adding simple and multiple selections.int[]
getBalancedSelection(int selectionStart, int selectionEnd)
Usually returns the selection.int
getBalancedSelectionEnd()
Usually returns the same value asgetSelectionEnd()
.int
getBalancedSelectionStart()
Usually returns the same value asgetSelectionStart()
.AuthorSchemaAwareEditingHandler
getDefaultAuthorSchemaAwareEditingHandler()
Get the default schema aware editing handler.AuthorNode
getFullySelectedNode()
Get the node which is fully and perfectly surrounded by the current selection in the Author editor.
If the selection surrounds perfectly the node (the selection starts at the node start offset and ends immediately after the node end offset), the node will be returned, otherwisenull
will be returned.
For example if a node is selected using Outline or the Breadcrumb, the method will return the corresponding node.AuthorNode
getFullySelectedNode(int selectionStart, int selectionEnd)
Get the node which is fully and perfectly surrounded by the given selection in the Author editor.
If the selection surrounds perfectly the node (the selection starts at the node start offset and ends immediately after the node end offset), the node will be returned, otherwisenull
will be returned.
For example if a node is selected using Outline or the Breadcrumb, the method will return the corresponding node.AuthorHighlighter
getHighlighter()
Get the highlighter which can be used to add/remove/manage the custom user highlightsAuthorPersistentHighlighter
getPersistentHighlighter()
Get the persistent highlighter which can be used to add/remove/manage the custom persistent user highlights.java.util.Map<PseudoElementDescriptor,Styles>
getPseudoElementStyles(AuthorParentNode node)
Get the CSS styles used to render the pseudo-elements of an Author node.java.lang.String
getSelectedText()
Get the current selected text.int
getSelectionEnd()
Get end offset of the current selection.int
getSelectionStart()
Get start offset of the current selection.Styles
getStyles(AuthorNode node)
Get the CSS styles which are used to render a particular Author node.int
getTagsDisplayMode()
Get the display mode of the tags in the Author editor.void
goToNextEditablePosition(int startOffset, int endOffset)
Identifies and goes to the next edit position.boolean
hasSelection()
Check if the editor page has a selection
UseAuthorSelectionModel
to get more information and access to the Author editor page selection.boolean
isOffsetInInvisibleBounds(int offset)
Check whether the offset is in a region in the document which is not rendered.int
moveOutOfInvisibleBounds(int offset, boolean forward)
Check whether the offset is in a region in the document which is not rendered.void
refresh()
Reload the CSS files and perform a refresh on the whole document to recompute the layout and the styles for all the nodes based on the new CSS files content.void
refresh(AuthorNode authorNode)
Refresh the rendering layout and CSS styles for this node and all its contents.void
removeAuthorAttributesDisplayFilter(AuthorAttributesDisplayFilter attributesDisplayFilter)
Remove a filter for displaying attributes to the current author page.void
removeAuthorCaretListener(AuthorCaretListener caretListener)
Removes the specified caret listener from the Author page.void
removeAuthorMouseListener(AuthorMouseListener mouseListener)
Removes the specified mouse listener from the current author page.void
removeDNDListener(java.lang.Object dndListener)
Remove a drag and drop listener.void
removePopUpMenuCustomizer(AuthorPopupMenuCustomizer popUpCustomizer)
Add the pop-up menu customizer which can be used to customize the pop-up menu (add/remove actions) before showing it in the Author page.void
scrollToRectangle(Rectangle rectangle)
Scroll the Author viewport to a specific rectangle.void
select(int startOffset, int endOffset)
Select the interval between start and end offset.void
setPopUpMenuCustomizer(AuthorPopupMenuCustomizer popUpCustomizer)
Deprecated.This method removes all pop-up menu customizers already registered, please use the "addPopUpMenuCustomizer" method instead.void
setTagsDisplayMode(int displayMode)
Set the display mode of the tags in the Author editor.AuthorViewToModelInfo
viewToModel(int x, int y)
Get the position in the document corresponding to the point in the author viewport component.-
Methods inherited from interface ro.sync.exml.workspace.api.editor.page.author.tooltip.AuthorTooltipCustomizerProvider
addTooltipCustomizer, removeTooltipCustomizer
-
Methods inherited from interface ro.sync.exml.workspace.api.editor.page.WSEditorPage
getParentEditor, hasFocus, isEditable, requestFocus, setEditable, setReadOnly, setReadOnly
-
Methods inherited from interface ro.sync.exml.workspace.api.editor.page.WSTextBasedEditorPage
createAnchor, getCaretOffset, getLocationOnScreenAsPoint, getLocationRelativeToEditorFromScreen, getOffsetForAnchor, getStartEndOffsets, getWordAtCaret, modelToViewRectangle, scrollCaretToVisible, selectWord, setCaretPosition, viewToModelOffset
-
-
-
-
Method Detail
-
viewToModel
AuthorViewToModelInfo viewToModel(int x, int y)
Get the position in the document corresponding to the point in the author viewport component.- Parameters:
x
- The "x" coordinate relative to the viewport origin.y
- The "y" coordinate relative to the viewport origin.- Returns:
- The
AuthorViewToModelInfo
containing the offset and the node at offset corresponding to the given point. The method does not returnnull
, instead an undefined view to model info object is returned if a valid one could not be determined.
-
setPopUpMenuCustomizer
@Deprecated void setPopUpMenuCustomizer(AuthorPopupMenuCustomizer popUpCustomizer)
Deprecated.This method removes all pop-up menu customizers already registered, please use the "addPopUpMenuCustomizer" method instead.Set the pop-up menu customizer which can be used to customize the pop-up menu (add/remove actions) before showing it in the Author page.- Parameters:
popUpCustomizer
- the pop-up menu customizer.
-
addPopUpMenuCustomizer
void addPopUpMenuCustomizer(AuthorPopupMenuCustomizer popUpCustomizer)
Add the pop-up menu customizer which can be used to customize the pop-up menu (add/remove actions) before showing it in the Author page.- Parameters:
popUpCustomizer
- the pop-up menu customizer. If the customizer is already added, it will not be added again.- Since:
- 14.1
-
removePopUpMenuCustomizer
void removePopUpMenuCustomizer(AuthorPopupMenuCustomizer popUpCustomizer)
Add the pop-up menu customizer which can be used to customize the pop-up menu (add/remove actions) before showing it in the Author page.- Parameters:
popUpCustomizer
- the pop-up menu customizer.- Since:
- 14.1
-
addAuthorMouseListener
void addAuthorMouseListener(AuthorMouseListener mouseListener)
Adds a mouse listener to the current author page.- Parameters:
mouseListener
- TheAuthorMouseListener
to be added.
-
removeAuthorMouseListener
void removeAuthorMouseListener(AuthorMouseListener mouseListener)
Removes the specified mouse listener from the current author page.- Parameters:
mouseListener
- TheAuthorMouseListener
to be removed.
-
addAuthorCaretListener
void addAuthorCaretListener(AuthorCaretListener caretListener)
Adds a caret listener to the Author page.- Parameters:
caretListener
- TheAuthorCaretListener
to be added.
-
removeAuthorCaretListener
void removeAuthorCaretListener(AuthorCaretListener caretListener)
Removes the specified caret listener from the Author page.- Parameters:
caretListener
- TheAuthorCaretListener
to be removed.
-
refresh
void refresh(AuthorNode authorNode)
Refresh the rendering layout and CSS styles for this node and all its contents.Note: This should be called on the AWT thread because it will generate a layout event.
- Parameters:
authorNode
- The node for which the layout and styles will be recomputed.
-
refresh
void refresh()
Reload the CSS files and perform a refresh on the whole document to recompute the layout and the styles for all the nodes based on the new CSS files content.
-
getHighlighter
AuthorHighlighter getHighlighter()
Get the highlighter which can be used to add/remove/manage the custom user highlights- Returns:
- The highlighter which can be used to add/remove/manage the custom user highlights.
-
getPersistentHighlighter
AuthorPersistentHighlighter getPersistentHighlighter()
Get the persistent highlighter which can be used to add/remove/manage the custom persistent user highlights.
Persistent highlights get serialized in the XML as processing instructions with the form:
<?oxy_custom_start prop1="val1"....?> xml content <?oxy_custom_end?>
- Returns:
- The persistent highlighter which can be used to add/remove/manage the custom user highlights.
- Since:
- 12
-
getBalancedSelectionStart
int getBalancedSelectionStart()
Usually returns the same value asgetSelectionStart()
.
If the selection start is immediately to the right of a start tag and the corresponding end tag is contained in the selection, then the balanced selection start will be obtained by extending the selection start to contain the start tag.- Returns:
- The balanced selection start offset, 0 based.
- Since:
- 12
-
getBalancedSelectionEnd
int getBalancedSelectionEnd()
Usually returns the same value asgetSelectionEnd()
. The offset is exclusive
If the selection end is immediately to the left of a end tag and the corresponding start tag is contained in the selection, then the balanced selection end will be obtained by extending the selection end to contain the end tag.- Returns:
- The balanced selection end offset, 0 based.
- Since:
- 12
-
getBalancedSelection
int[] getBalancedSelection(int selectionStart, int selectionEnd)
Usually returns the selection.
If the selection start is immediately to the right of a start tag and the corresponding end tag is contained in the selection, then the balanced selection start will be obtained by extending the selection start to contain the start tag. If the selection end is immediately to the left of a end tag and the corresponding start tag is contained in the selection, then the balanced selection end will be obtained by extending the selection end to contain the end tag.- Parameters:
selectionStart
- The inclusive selection start.selectionEnd
- The exclusive selection end.- Returns:
- The balanced selection obtained from the given selection, 0 based. The first element of the returned array represents the selection start. and the second element represents the selection end.
- Since:
- 16
-
getDefaultAuthorSchemaAwareEditingHandler
AuthorSchemaAwareEditingHandler getDefaultAuthorSchemaAwareEditingHandler()
Get the default schema aware editing handler. This can be used from a custom AuthorSchemaAwareEditingHandler implementation from an ExtensionsBundle to delegate various operations to.- Returns:
- the default schema aware editing handler.
- Since:
- 12.1
-
getActionsProvider
AuthorActionsProvider getActionsProvider()
Provides access to actions already defined in the Author page like: Undo, Redo, Display Full Tags, Edit Attributes, etc.- Returns:
- access to actions already defined in the Author page.
- Since:
- 12.1
-
getAuthorComponent
java.lang.Object getAuthorComponent()
Get the internal component on which the Author page is rendered. Use of this method is discouraged but it may be useful in some cases like: This can be helpful when you want to set a busy cursor on the component for example or when you want to get access to the scroll bars. You can also request focus in the component by casting it to its native equivalent.- Returns:
- for the stand alone version, a javax.swing.JPanel and for the eclipse implementation a org.eclipse.swt.widgets.Canvas.
- Since:
- 12.2
-
getStyles
Styles getStyles(AuthorNode node)
Get the CSS styles which are used to render a particular Author node. This method MUST only be used to query styles. If you want to modify styles please use theStylesFilter
.- Parameters:
node
- The node for which we want to obtain the styles.- Returns:
- the styles associated with the node.
- Since:
- 12.2
-
getPseudoElementStyles
java.util.Map<PseudoElementDescriptor,Styles> getPseudoElementStyles(AuthorParentNode node)
Get the CSS styles used to render the pseudo-elements of an Author node. This method MUST only be used to query styles. If you want to modify styles, use theStylesFilter
.- Parameters:
node
- The node for which we want to obtain the pseudo-element styles.- Returns:
- the styles of the pseudo-elements or an empty map. Never
null
. - Since:
- 23
-
addAuthorAttributesDisplayFilter
void addAuthorAttributesDisplayFilter(AuthorAttributesDisplayFilter attributesDisplayFilter)
Adds a filter for displaying attributes to the current author page.- Parameters:
attributesDisplayFilter
- TheAuthorAttributesDisplayFilter
to be added.- Since:
- 13
-
removeAuthorAttributesDisplayFilter
void removeAuthorAttributesDisplayFilter(AuthorAttributesDisplayFilter attributesDisplayFilter)
Remove a filter for displaying attributes to the current author page.- Parameters:
attributesDisplayFilter
- TheAuthorAttributesDisplayFilter
to be added.- Since:
- 13
-
getFullySelectedNode
AuthorNode getFullySelectedNode()
Get the node which is fully and perfectly surrounded by the current selection in the Author editor.
If the selection surrounds perfectly the node (the selection starts at the node start offset and ends immediately after the node end offset), the node will be returned, otherwisenull
will be returned.
For example if a node is selected using Outline or the Breadcrumb, the method will return the corresponding node.
In such cases the methodAuthorDocumentController.getNodeAtOffset(int)
called for the caret offset always returns the parent of the selected element as the caret is actually outside the selected element. Thus, in order to obtain the context node, this method should be used and if it returnsnull
you can use theAuthorDocumentController.getNodeAtOffset(int)
method.- Returns:
- The selected node if the selection surrounds perfectly the node,
null
otherwise. - Since:
- 13.1
-
getFullySelectedNode
AuthorNode getFullySelectedNode(int selectionStart, int selectionEnd)
Get the node which is fully and perfectly surrounded by the given selection in the Author editor.
If the selection surrounds perfectly the node (the selection starts at the node start offset and ends immediately after the node end offset), the node will be returned, otherwisenull
will be returned.
For example if a node is selected using Outline or the Breadcrumb, the method will return the corresponding node.
In such cases the methodAuthorDocumentController.getNodeAtOffset(int)
called for the caret offset always returns the parent of the selected element as the caret is actually outside the selected element. Thus, in order to obtain the context node, this method should be used and if it returnsnull
you can use theAuthorDocumentController.getNodeAtOffset(int)
method.- Parameters:
selectionStart
- Inclusive start offset.selectionEnd
- Exclusive end offset.- Returns:
- The selected node if the given selection surrounds perfectly the node,
null
otherwise. - Since:
- 16
-
getAuthorSelectionModel
AuthorSelectionModel getAuthorSelectionModel()
Get the Author selection model containing access to all Author selection intervals and methods for adding simple and multiple selections.- Returns:
- The Author selection model.
- Since:
- 14
-
getSelectionStart
int getSelectionStart()
Get start offset of the current selection. It is inclusive.
If the Author editor page has multiple selection intervals, this method returns the start offset of the last selected content interval.
UseAuthorSelectionModel
to get more information and access to the Author editor page selection.
If there is no selection in Author editor page, the caret offset is returned.- Specified by:
getSelectionStart
in interfaceWSTextBasedEditorPage
- Returns:
- The selection start offset, 0 based.
-
getSelectionEnd
int getSelectionEnd()
Get end offset of the current selection. It is exclusive
If the Author editor page has multiple selection intervals, this method returns the end offset of the last selected content interval.
UseAuthorSelectionModel
to get more information and access to the Author editor page selection.
If there is no selection in Author editor page, the caret offset is returned.- Specified by:
getSelectionEnd
in interfaceWSTextBasedEditorPage
- Returns:
- The selection end offset, 0 based.
-
getSelectedText
java.lang.String getSelectedText()
Get the current selected text. The text does not contain XML tags for the Author page.
If the Author editor page has multiple selection intervals, this method returns the text from the last selected content interval.
UseAuthorSelectionModel
to get more information and access to the Author editor page selection.- Specified by:
getSelectedText
in interfaceWSTextBasedEditorPage
- Returns:
- The selected text or an empty string if no selection is present.
-
deleteSelection
void deleteSelection()
Delete the current selected text, if any.
If the Author editor page has multiple selection intervals, this method deletes the content from the last selected interval.
UseAuthorSelectionModel
to get more information and access to the Author editor page selection.- Specified by:
deleteSelection
in interfaceWSTextBasedEditorPage
-
hasSelection
boolean hasSelection()
Check if the editor page has a selection
UseAuthorSelectionModel
to get more information and access to the Author editor page selection.- Specified by:
hasSelection
in interfaceWSTextBasedEditorPage
- Returns:
true
if there is a selection,false
otherwise.
-
select
void select(int startOffset, int endOffset)
Select the interval between start and end offset.
UseAuthorSelectionModel
to get more information and access to the Author editor page selection.- Specified by:
select
in interfaceWSTextBasedEditorPage
- Parameters:
startOffset
- Inclusive start offsetendOffset
- Exclusive end offset
-
isOffsetInInvisibleBounds
boolean isOffsetInInvisibleBounds(int offset) throws javax.swing.text.BadLocationException
Check whether the offset is in a region in the document which is not rendered. For example: oxy-collapse-text nodes, 'display: none' nodes or tracked deleted content which is not presented in 'Final' mode.- Parameters:
offset
- The offset to check.- Returns:
true
if the offset is in an invisible region.- Throws:
javax.swing.text.BadLocationException
- If the offset is outside the document.
-
moveOutOfInvisibleBounds
int moveOutOfInvisibleBounds(int offset, boolean forward) throws javax.swing.text.BadLocationException
Check whether the offset is in a region in the document which is not rendered. If this is the case, this method returns an offset which is outside that region in the specified direction. For example: oxy-collapse-text nodes, 'display: none' nodes or tracked deleted content which is not presented in 'Final' mode are considered invisible.- Parameters:
offset
- The offset to check.forward
-true
if we should move to a position in a forward direction.- Returns:
- an offset that is outside of the invisible region in the specified direction.
- Throws:
javax.swing.text.BadLocationException
- If the offset is outside the document.- Since:
- 17
-
goToNextEditablePosition
void goToNextEditablePosition(int startOffset, int endOffset) throws javax.swing.text.BadLocationException
Identifies and goes to the next edit position. Depending on which is first, this can be:- An offset inside the first leaf element or the first element with mixed content.
- An in-place editor used to edit the value of an attribute (for example a checkbox). In this case the editor will be activated.
- Parameters:
startOffset
- The offset from where to start looking.endOffset
- The offset where to stop looking for.- Throws:
javax.swing.text.BadLocationException
- The given offset is invalid.- Since:
- 14.1
-
editAttribute
void editAttribute(AuthorElement targetElement, java.lang.String attributeName)
Searches through the in-place editors added on the given element for the first one that edits the given attribute. If such an editor is found it will activate the editor to start editing. Hypothetically there could be more than one editor for the same attribute (even though is not a real use case nor is it encouraged) but we'll activate the first one we encounter. The search will first look at the BEFORE styles, then the element styles and finally the AFTER styles.- Parameters:
targetElement
- The parent element of the attribute.attributeName
- The QName of the searched attribute.- Since:
- 14.1
-
scrollToRectangle
void scrollToRectangle(Rectangle rectangle)
Scroll the Author viewport to a specific rectangle. To find the rectangle that corresponds to a specific offset in the Author document you can use theWSTextBasedEditorPage.modelToViewRectangle(int)
method.- Parameters:
rectangle
- The rectangle to scroll to.- Since:
- 14.1
-
getAuthorFoldManager
AuthorFoldManager getAuthorFoldManager()
Get the fold manager which can be used to expand or collapse a fold.- Returns:
- the fold manager.
- Since:
- 17
-
addDNDListener
void addDNDListener(java.lang.Object dndListener)
Add a drag and drop listener in the Author editing mode.- Parameters:
dndListener
- The drag and drop listener. Needs to be an instance of "ro.sync.exml.editor.xmleditor.pageauthor.AuthorDnDListener" for the standalone implementation and com.oxygenxml.editor.editors.author.AuthorDnDListener for the Eclipse implementation.- Since:
- 17.1
-
removeDNDListener
void removeDNDListener(java.lang.Object dndListener)
Remove a drag and drop listener.- Parameters:
dndListener
- The drag and drop listener to remove.- Since:
- 17.1
-
setTagsDisplayMode
void setTagsDisplayMode(int displayMode)
Set the display mode of the tags in the Author editor.- Parameters:
displayMode
- The tags display mode, one ofDisplayModeConstants
constants.- Since:
- 17.1
-
getTagsDisplayMode
int getTagsDisplayMode()
Get the display mode of the tags in the Author editor.- Returns:
- The tags display mode (one of
DisplayModeConstants
constants). - Since:
- 17.1
-
buildURLForReferencedContent
java.net.URL buildURLForReferencedContent(int caretOffset, boolean shortAnchor)
If the caret offset is somewhere inside an entity reference, an xi:include reference or a DITA content reference, this method will return an URL which when used with Oxygen's API (ro.sync.exml.workspace.api.Workspace.open(URL)) will open the target resource and then place the caret in the opened editor precisely at the location where it was in the original XML document which referenced the content.- Parameters:
caretOffset
- The offset at which the caret is currently located.shortAnchor
- Flag telling whether to build a short version of the referenced content URL or not. This format is used in Web Author.- Returns:
- A URL with a precise localization anchor included or
null
if the caret position is not inside a reference. - Since:
- 19.1
-
-