org.mozilla.jrex.selection
Class JRexSelectionImpl

java.lang.Object
  |
  +--org.mozilla.jrex.selection.JRexSelectionImpl
All Implemented Interfaces:
JRexSelection

public class JRexSelectionImpl
extends Object
implements JRexSelection

JRexSelectionImpl implements JRexSelection interface.

Version:
1.0
Author:
C.N.Medappa

Constructor Summary
JRexSelectionImpl()
           
 
Method Summary
 void addRange(Range range)
          Adds a range to the current selection.
 void collapse(Node parentNode, int offset)
          Collapses the selection to a single point, at the specified offset in the given DOM node.
 void collapseToEnd()
          Collapses the whole selection to a single point at the end of the current selection (irrespective of direction).
 void collapseToStart()
          Collapses the whole selection to a single point at the start of the current selection (irrespective of direction).
 boolean containsNode(Node node, boolean entirelyContained)
          The value of entirelyContained determines the detail of the search to determine if the selection contains the node.
 void deleteFromDocument()
          Deletes this selection from document the nodes belong to.
 void extend(Node parentNode, int offset)
          Extends the selection by moving the focus to the specified node and offset, preserving the anchor postion.
 Node getAnchorNode()
          Returns the node representing one end of the selection.
 int getAnchorOffset()
          Returns the offset within the (text) node where the selection begins.
 Node getFocusNode()
          Returns the node with keyboard focus.
 int getFocusOffset()
          Returns the offset within the (text) node where focus starts.
 boolean getIsCollapsed()
          Indicates if the selection is collapsed or not.
 Range getRangeAt(int index)
          Returns the range at given index.
 int getRangeCount()
          Returns the number of ranges in the selection.
 void removeAllRanges()
          Removes all ranges from the current selection.
 void removeRange(Range range)
          Removes a range from the current selection.
 void selectAllChildren(Node parentNode)
          Adds all children of the specified node to the selection.
 void selectionLanguageChange(boolean langRTL)
          Modifies the cursor Bidi level after a change in keyboard direction
 void setJRexPeer(int jrexPeer)
          The peer JREX Window on which to select
 String toString()
          Returns the whole selection into a plain text string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JRexSelectionImpl

public JRexSelectionImpl()
Method Detail

setJRexPeer

public void setJRexPeer(int jrexPeer)
Description copied from interface: JRexSelection
The peer JREX Window on which to select

Specified by:
setJRexPeer in interface JRexSelection
Parameters:
jrexPeer - jrex peer window associated with browser component

getAnchorNode

public Node getAnchorNode()
                   throws JRexException
Description copied from interface: JRexSelection
Returns the node representing one end of the selection.

Specified by:
getAnchorNode in interface JRexSelection
JRexException

getAnchorOffset

public int getAnchorOffset()
                    throws JRexException
Description copied from interface: JRexSelection
Returns the offset within the (text) node where the selection begins.

Specified by:
getAnchorOffset in interface JRexSelection
JRexException

getFocusNode

public Node getFocusNode()
                  throws JRexException
Description copied from interface: JRexSelection
Returns the node with keyboard focus.

Specified by:
getFocusNode in interface JRexSelection
JRexException

getFocusOffset

public int getFocusOffset()
                   throws JRexException
Description copied from interface: JRexSelection
Returns the offset within the (text) node where focus starts.

Specified by:
getFocusOffset in interface JRexSelection
JRexException

getIsCollapsed

public boolean getIsCollapsed()
                       throws JRexException
Description copied from interface: JRexSelection
Indicates if the selection is collapsed or not.

Specified by:
getIsCollapsed in interface JRexSelection
JRexException

getRangeCount

public int getRangeCount()
                  throws JRexException
Description copied from interface: JRexSelection
Returns the number of ranges in the selection.

Specified by:
getRangeCount in interface JRexSelection
JRexException

getRangeAt

public Range getRangeAt(int index)
                 throws JRexException
Description copied from interface: JRexSelection
Returns the range at given index.

Specified by:
getRangeAt in interface JRexSelection
Parameters:
index - the index of range to retrived.
JRexException

collapse

public void collapse(Node parentNode,
                     int offset)
              throws JRexException
Description copied from interface: JRexSelection
Collapses the selection to a single point, at the specified offset in the given DOM node. When the selection is collapsed, and the content is focused and editable, the caret will blink there.

Specified by:
collapse in interface JRexSelection
Parameters:
parentNode - The given dom node where the selection will be set
offset - Where in given dom node to place the selection (the offset into the given node)
JRexException

extend

public void extend(Node parentNode,
                   int offset)
            throws JRexException
Description copied from interface: JRexSelection
Extends the selection by moving the focus to the specified node and offset, preserving the anchor postion. The new selection end result will always be from the anchor to the new focus, regardless of direction.

Specified by:
extend in interface JRexSelection
Parameters:
parentNode - The node where the selection will be extended to
offset - Where in node to place the offset in the new focused node
JRexException

collapseToStart

public void collapseToStart()
                     throws JRexException
Description copied from interface: JRexSelection
Collapses the whole selection to a single point at the start of the current selection (irrespective of direction). If content is focused and editable, the caret will blink there.

Specified by:
collapseToStart in interface JRexSelection
JRexException

collapseToEnd

public void collapseToEnd()
                   throws JRexException
Description copied from interface: JRexSelection
Collapses the whole selection to a single point at the end of the current selection (irrespective of direction). If content is focused and editable, the caret will blink there.

Specified by:
collapseToEnd in interface JRexSelection
JRexException

containsNode

public boolean containsNode(Node node,
                            boolean entirelyContained)
                     throws JRexException
Description copied from interface: JRexSelection
The value of entirelyContained determines the detail of the search to determine if the selection contains the node. If entirelyContained is set to PR_TRUE, t or false if

Specified by:
containsNode in interface JRexSelection
Parameters:
node - The node where the selection will be extended to
entirelyContained - Whether
JRexException

selectAllChildren

public void selectAllChildren(Node parentNode)
                       throws JRexException
Description copied from interface: JRexSelection
Adds all children of the specified node to the selection.

Specified by:
selectAllChildren in interface JRexSelection
Parameters:
parentNode - the parent of the children to be added to the selection.
JRexException

addRange

public void addRange(Range range)
              throws JRexException
Description copied from interface: JRexSelection
Adds a range to the current selection.

Specified by:
addRange in interface JRexSelection
Parameters:
range - the range to be added.
JRexException

removeRange

public void removeRange(Range range)
                 throws JRexException
Description copied from interface: JRexSelection
Removes a range from the current selection.

Specified by:
removeRange in interface JRexSelection
Parameters:
range - the range to be removed.
JRexException

removeAllRanges

public void removeAllRanges()
                     throws JRexException
Description copied from interface: JRexSelection
Removes all ranges from the current selection.

Specified by:
removeAllRanges in interface JRexSelection
JRexException

deleteFromDocument

public void deleteFromDocument()
                        throws JRexException
Description copied from interface: JRexSelection
Deletes this selection from document the nodes belong to.

Specified by:
deleteFromDocument in interface JRexSelection
JRexException

selectionLanguageChange

public void selectionLanguageChange(boolean langRTL)
                             throws JRexException
Description copied from interface: JRexSelection
Modifies the cursor Bidi level after a change in keyboard direction

Specified by:
selectionLanguageChange in interface JRexSelection
Parameters:
langRTL - is true if the new language is right-to-left or false if the new language is left-to-right.
JRexException

toString

public String toString()
Description copied from interface: JRexSelection
Returns the whole selection into a plain text string.

Specified by:
toString in interface JRexSelection
Overrides:
toString in class Object


Copyright © 2004 C.N.Medappa. All Rights Reserved.