Oxygen XML Editor 11.2 Author API

ro.sync.exml.workspace.api.editor.page
Interface WSTextBasedEditorPage

All Superinterfaces:
WSEditorPage
All Known Subinterfaces:
AuthorEditorAccess, WSAuthorEditorPage, WSAuthorEditorPageBase, WSTextEditorPage

public interface WSTextBasedEditorPage
extends WSEditorPage

Provides access to methods related to the editor actions and information for the Text and Author pages.

*********************************
EXPERIMENTAL - Subject to change
*********************************

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.

Since:
11.2

Method Summary
 void deleteSelection()
          Delete the selected text, if any.
 int getCaretOffset()
          The current caret offset.
 Point getLocationOnScreenAsPoint(int x, int y)
          Take relative mouse coordinates and translate then to absolute on-screen coordinates.
 String getSelectedText()
          Get the selected text.
 int getSelectionEnd()
          Get selection end offset.
 int getSelectionStart()
          Get selection start offset.
 int[] getWordAtCaret()
          Compute the offsets of the word that contains the caret position.
 boolean hasSelection()
          Check if the editor page has a selection
 Rectangle modelToViewRectangle(int offset)
          Returns a representation of the caret shape for the specified document offset.
 void select(int startOffset, int endOffset)
          Select the interval between start and end offset.
 void selectWord()
          Select the word at caret, if any.
 void setCaretPosition(int offset)
          Move the caret to the specified offset.
 int viewToModelOffset(int x, int y)
          Get the position in the document corresponding to the point in the editing component.
 

Method Detail

getSelectionStart

int getSelectionStart()
Get selection start offset. It is inclusive.

Returns:
The selection start offset, 0 based.

getSelectionEnd

int getSelectionEnd()
Get selection end offset. It is exclusive.

Returns:
The selection end offset, 0 based.

getSelectedText

String getSelectedText()
Get the selected text. The text does not contain XML tags for the Author page.

Returns:
The selected text or an empty string if no selection is present.

getCaretOffset

int getCaretOffset()
The current caret offset.

Returns:
The caret offset, 0 based.

deleteSelection

void deleteSelection()
Delete the selected text, if any.


hasSelection

boolean hasSelection()
Check if the editor page has a selection

Returns:
true if there is a selection, false otherwise.

selectWord

void selectWord()
Select the word at caret, if any.


setCaretPosition

void setCaretPosition(int offset)
Move the caret to the specified offset.

Parameters:
offset - The offset where the caret should be positioned, 0 based.

select

void select(int startOffset,
            int endOffset)
Select the interval between start and end offset.

Parameters:
startOffset - Inclusive start offset
endOffset - Exclusive end offset

getWordAtCaret

int[] getWordAtCaret()
Compute the offsets of the word that contains the caret position.

Returns:
An array with the start and end offsets of the word at caret or null if the values couldn't be obtained. The start offset is inclusive and greater or equal than 1. The end offset is also inclusive and less or equal than the content length.

getLocationOnScreenAsPoint

Point getLocationOnScreenAsPoint(int x,
                                 int y)
Take relative mouse coordinates and translate then to absolute on-screen coordinates.

Parameters:
x - The "x" coordinate relative to the viewport origin.
y - The "y" coordinate relative to the viewport origin.
Returns:
A point with the "x" and "y" coordinates relative to the screen. It does not return a null Point.

modelToViewRectangle

Rectangle modelToViewRectangle(int offset)
Returns a representation of the caret shape for the specified document offset.

Parameters:
offset - The document offset to get the corresponding caret shape for.
Returns:
The caret rectangle shape. It does not return a null Rectangle.

viewToModelOffset

int viewToModelOffset(int x,
                      int y)
Get the position in the document corresponding to the point in the editing component.

Parameters:
x - The "x" coordinate relative to the editing component origin.
y - The "y" coordinate relative to the editing component origin.
Returns:
The offset corresponding to the given point. The method does not return null, instead an undefined view to model info object is returned if a valid one could not be determined.

Oxygen XML Editor 11.2 Author API

© Copyright SyncRO Soft SRL 2002 - 2010.