JIDE 3.5.15

com.jidesoft.editor.selection
Interface SelectionModel

All Known Implementing Classes:
DefaultSelectionModel

public interface SelectionModel

An interface to represent the selection in CodeEditor.


Method Summary
 void addSelectionListener(SelectionListener selectionListener)
          Adds a SelectionListener to the SelectionModel to receive any selection change event.
 void clearSelection()
          Clears the selection.
 String getSelectedText()
          Gets the selected text.
 int getSelectionEnd()
          Gets the offset of the selection end.
 int getSelectionEndLine()
          Gets the line number of the selection end.
 CaretPosition getSelectionEndViewPosition()
          Gets the view position of the selection end.
 SelectionListener[] getSelectionListeners()
          Gets all the SelectionListeners added to this SelectionModel.
 int getSelectionStart()
          Gets the offset of the selection start.
 int getSelectionStartLine()
          Gets the line number of the selection start.
 CaretPosition getSelectionStartViewPosition()
          Gets the view position of the selection start.
 boolean hasSelection()
          Checks if the SelectionModel has any selection.
 boolean isColumnSelectionMode()
          Checks if the SelectionModel is in column selection mode, a.k.a vertical selection.
 int offsetInDocumentToOffsetInSelection(int offsetInSDocument)
          Gets the offset in the selection based on the offset in the document.
 int offsetInSelectionToOffsetInDocument(int offsetInSelection)
          Gets the offset in the document based on the offset in the selection.
 void removeSelectionListener(SelectionListener selectionListener)
          Removes the SelectionListener from the SelectionModel that was added before.
 void setColumnSelectionMode(boolean columnSelectionMode)
          Sets the SelectionModel to column selection mode.
 void setSelection(CaretPosition startPosition, CaretPosition endPosition)
          Sets the selection.
 void setSelection(int start, int end)
          Sets the selection.
 

Method Detail

getSelectionStart

int getSelectionStart()
Gets the offset of the selection start.

Returns:
the offset of the selection start.

getSelectionEnd

int getSelectionEnd()
Gets the offset of the selection end.

Returns:
the offset of the selection end.

getSelectionStartViewPosition

CaretPosition getSelectionStartViewPosition()
Gets the view position of the selection start.

Returns:
the view position of the selection start.
Since:
3.3.3

getSelectionEndViewPosition

CaretPosition getSelectionEndViewPosition()
Gets the view position of the selection end.

Returns:
the view position of the selection end.
Since:
3.3.3

getSelectionStartLine

int getSelectionStartLine()
Gets the line number of the selection start.

Returns:
the line number of the selection start.

getSelectionEndLine

int getSelectionEndLine()
Gets the line number of the selection end.

Returns:
the line number of the selection end.

getSelectedText

String getSelectedText()
Gets the selected text.

Returns:
the selected text.

setSelection

void setSelection(int start,
                  int end)
Sets the selection.

Parameters:
start - the start of the selection
end - the end of the selection

setSelection

void setSelection(CaretPosition startPosition,
                  CaretPosition endPosition)
Sets the selection.

Parameters:
startPosition - the start of the selection
endPosition - the end of the selection
Since:
3.3.3

offsetInSelectionToOffsetInDocument

int offsetInSelectionToOffsetInDocument(int offsetInSelection)
Gets the offset in the document based on the offset in the selection.

Parameters:
offsetInSelection - the offset in the selection
Returns:
the offset in the document. -1 if the offset does not exist in the document.
Since:
3.3.3

offsetInDocumentToOffsetInSelection

int offsetInDocumentToOffsetInSelection(int offsetInSDocument)
Gets the offset in the selection based on the offset in the document.

Parameters:
offsetInSDocument - the offset in the document
Returns:
the offset in the selection.
Since:
3.3.3

clearSelection

void clearSelection()
Clears the selection.


hasSelection

boolean hasSelection()
Checks if the SelectionModel has any selection.

Returns:
true if it has selection. Otherwise false.

isColumnSelectionMode

boolean isColumnSelectionMode()
Checks if the SelectionModel is in column selection mode, a.k.a vertical selection.

Returns:
true if in column selection mode.

setColumnSelectionMode

void setColumnSelectionMode(boolean columnSelectionMode)
Sets the SelectionModel to column selection mode.

Parameters:
columnSelectionMode - the flag

addSelectionListener

void addSelectionListener(SelectionListener selectionListener)
Adds a SelectionListener to the SelectionModel to receive any selection change event.

Parameters:
selectionListener - the selection listener

removeSelectionListener

void removeSelectionListener(SelectionListener selectionListener)
Removes the SelectionListener from the SelectionModel that was added before.

Parameters:
selectionListener - the selection listener

getSelectionListeners

SelectionListener[] getSelectionListeners()
Gets all the SelectionListeners added to this SelectionModel.

Returns:
all the SelectionListeners added to this SelectionModel.

JIDE 3.5.15