public class SimpleRange extends Object implements Serializable
Constructor and Description |
---|
SimpleRange ()
Constructs a range without any content.
|
SimpleRange (DomNode node)
Constructs a range for the specified element.
|
SimpleRange (DomNode node,
int offset)
Constructs a range for the provided element and start and end offset.
|
SimpleRange (DomNode startNode,
int startOffset,
DomNode endNode,
int endOffset)
Constructs a range for the provided elements and offsets.
|
Modifier and Type | Method and Description |
---|---|
DomDocumentFragment |
cloneContents ()
Duplicates the contents of this.
|
SimpleRange |
cloneRange ()
Produces a new SimpleRange whose boundary-points are equal to the
boundary-points of this.
|
void |
collapse (boolean toStart)
Collapse this range onto one of its boundary-points.
|
List<DomNode> |
containedNodes () |
void |
deleteContents ()
Removes the contents of this range from the containing document or
document fragment without returning a reference to the removed
content.
|
boolean |
equals (Object obj) |
DomDocumentFragment |
extractContents ()
Moves the contents of a Range from the containing document or document
fragment to a new DocumentFragment.
|
DomNode |
getCommonAncestorContainer () |
DomNode |
getEndContainer () |
int |
getEndOffset () |
DomNode |
getStartContainer () |
int |
getStartOffset () |
int |
hashCode () |
void |
insertNode (DomNode newNode)
Inserts a node into the Document or DocumentFragment at the start of
the Range.
|
boolean |
isCollapsed () |
void |
selectNode (DomNode node)
Select a node and its contents.
|
void |
selectNodeContents (DomNode node)
Select the contents within a node.
|
void |
setEnd (DomNode refNode,
int offset)
Sets the attributes describing the end.
|
void |
setStart (DomNode refNode,
int offset)
Sets the attributes describing the start.
|
void |
surroundContents (DomNode newParent)
Reparents the contents of the Range to the given node and inserts the
node at the position of the start of the Range.
|
String |
toString () |
public SimpleRange()
public SimpleRange(DomNode node)
node
- the node for the rangepublic SimpleRange(DomNode node, int offset)
node
- the node for the rangeoffset
- the start and end offsetpublic DomDocumentFragment cloneContents()
public SimpleRange cloneRange()
public void collapse(boolean toStart)
toStart
- if true, collapses the Range onto its start; else collapses it onto its end.public void deleteContents()
public DomDocumentFragment extractContents() throws DOMException
DOMException
- in case of errorpublic boolean isCollapsed() throws DOMException
DOMException
- in case of errorpublic DomNode getCommonAncestorContainer() throws DOMException
DOMException
- in case of errorpublic DomNode getEndContainer()
public int getEndOffset()
public DomNode getStartContainer()
public int getStartOffset()
public void insertNode(DomNode newNode)
newNode
- The node to insert at the start of the Rangepublic void selectNode(DomNode node)
node
- The node to select.public void selectNodeContents(DomNode node)
node
- Node to select frompublic void setEnd(DomNode refNode, int offset)
refNode
- the refNodeoffset
- offsetpublic void setStart(DomNode refNode, int offset)
refNode
- the refNodeoffset
- offsetpublic void surroundContents(DomNode newParent)
newParent
- The node to surround the contents with.Copyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.