JIDE 3.5.15

com.jidesoft.editor.selection
Class DefaultSelectionModel

java.lang.Object
  extended by com.jidesoft.editor.selection.DefaultSelectionModel
All Implemented Interfaces:
SelectionModel

public class DefaultSelectionModel
extends Object
implements SelectionModel


Constructor Summary
DefaultSelectionModel(CodeEditor editor)
           
 
Method Summary
 void addSelectionListener(SelectionListener selectionlistener)
          Adds a SelectionListener to the SelectionModel to receive any selection change event.
 void clearSelection()
          Clears the selection.
protected  void fireSelectionChangeEvent(int oldSelectionStart, int oldSelectionEnd, int newSelectionStart, int newSelectionEnd)
           
 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 offsetInDocument)
          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.
 void setSelectionEnd(int selectionEnd)
           
 void setSelectionStart(int selectionStart)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSelectionModel

public DefaultSelectionModel(CodeEditor editor)
Method Detail

getSelectionStart

public int getSelectionStart()
Description copied from interface: SelectionModel
Gets the offset of the selection start.

Specified by:
getSelectionStart in interface SelectionModel
Returns:
the offset of the selection start.

getSelectionEnd

public int getSelectionEnd()
Description copied from interface: SelectionModel
Gets the offset of the selection end.

Specified by:
getSelectionEnd in interface SelectionModel
Returns:
the offset of the selection end.

setSelectionStart

public void setSelectionStart(int selectionStart)

setSelectionEnd

public void setSelectionEnd(int selectionEnd)

getSelectionStartLine

public int getSelectionStartLine()
Description copied from interface: SelectionModel
Gets the line number of the selection start.

Specified by:
getSelectionStartLine in interface SelectionModel
Returns:
the line number of the selection start.

getSelectionEndLine

public int getSelectionEndLine()
Description copied from interface: SelectionModel
Gets the line number of the selection end.

Specified by:
getSelectionEndLine in interface SelectionModel
Returns:
the line number of the selection end.

getSelectionStartViewPosition

public CaretPosition getSelectionStartViewPosition()
Description copied from interface: SelectionModel
Gets the view position of the selection start.

Specified by:
getSelectionStartViewPosition in interface SelectionModel
Returns:
the view position of the selection start.

getSelectionEndViewPosition

public CaretPosition getSelectionEndViewPosition()
Description copied from interface: SelectionModel
Gets the view position of the selection end.

Specified by:
getSelectionEndViewPosition in interface SelectionModel
Returns:
the view position of the selection end.

offsetInSelectionToOffsetInDocument

public int offsetInSelectionToOffsetInDocument(int offsetInSelection)
Description copied from interface: SelectionModel
Gets the offset in the document based on the offset in the selection.

Specified by:
offsetInSelectionToOffsetInDocument in interface SelectionModel
Parameters:
offsetInSelection - the offset in the selection
Returns:
the offset in the document. -1 if the offset does not exist in the document.

offsetInDocumentToOffsetInSelection

public int offsetInDocumentToOffsetInSelection(int offsetInDocument)
Description copied from interface: SelectionModel
Gets the offset in the selection based on the offset in the document.

Specified by:
offsetInDocumentToOffsetInSelection in interface SelectionModel
Parameters:
offsetInDocument - the offset in the document
Returns:
the offset in the selection.

getSelectedText

public String getSelectedText()
Description copied from interface: SelectionModel
Gets the selected text.

Specified by:
getSelectedText in interface SelectionModel
Returns:
the selected text.

setSelection

public void setSelection(int start,
                         int end)
Description copied from interface: SelectionModel
Sets the selection.

Specified by:
setSelection in interface SelectionModel
Parameters:
start - the start of the selection
end - the end of the selection

setSelection

public void setSelection(CaretPosition startPosition,
                         CaretPosition endPosition)
Description copied from interface: SelectionModel
Sets the selection.

Specified by:
setSelection in interface SelectionModel
Parameters:
startPosition - the start of the selection
endPosition - the end of the selection

clearSelection

public void clearSelection()
Description copied from interface: SelectionModel
Clears the selection.

Specified by:
clearSelection in interface SelectionModel

hasSelection

public boolean hasSelection()
Description copied from interface: SelectionModel
Checks if the SelectionModel has any selection.

Specified by:
hasSelection in interface SelectionModel
Returns:
true if it has selection. Otherwise false.

isColumnSelectionMode

public boolean isColumnSelectionMode()
Description copied from interface: SelectionModel
Checks if the SelectionModel is in column selection mode, a.k.a vertical selection.

Specified by:
isColumnSelectionMode in interface SelectionModel
Returns:
true if in column selection mode.

setColumnSelectionMode

public void setColumnSelectionMode(boolean columnSelectionMode)
Description copied from interface: SelectionModel
Sets the SelectionModel to column selection mode.

Specified by:
setColumnSelectionMode in interface SelectionModel
Parameters:
columnSelectionMode - the flag

addSelectionListener

public void addSelectionListener(SelectionListener selectionlistener)
Description copied from interface: SelectionModel
Adds a SelectionListener to the SelectionModel to receive any selection change event.

Specified by:
addSelectionListener in interface SelectionModel
Parameters:
selectionlistener - the selection listener

removeSelectionListener

public void removeSelectionListener(SelectionListener selectionlistener)
Description copied from interface: SelectionModel
Removes the SelectionListener from the SelectionModel that was added before.

Specified by:
removeSelectionListener in interface SelectionModel
Parameters:
selectionlistener - the selection listener

getSelectionListeners

public SelectionListener[] getSelectionListeners()
Description copied from interface: SelectionModel
Gets all the SelectionListeners added to this SelectionModel.

Specified by:
getSelectionListeners in interface SelectionModel
Returns:
all the SelectionListeners added to this SelectionModel.

fireSelectionChangeEvent

protected void fireSelectionChangeEvent(int oldSelectionStart,
                                        int oldSelectionEnd,
                                        int newSelectionStart,
                                        int newSelectionEnd)

JIDE 3.5.15