All Downloads are FREE. Search and download functionalities are using the official Maven repository.

elemental.ranges.Range Maven / Gradle / Ivy

Go to download

Vaadin is a web application framework for Rich Internet Applications (RIA). Vaadin enables easy development and maintenance of fast and secure rich web applications with a stunning look and feel and a wide browser support. It features a server-side architecture with the majority of the logic running on the server. Ajax technology is used at the browser-side to ensure a rich and interactive user experience.

There is a newer version: 8.25.2
Show newest version
/*
 * Copyright 2012 Google Inc.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package elemental.ranges;
import elemental.dom.Node;
import elemental.html.ClientRect;
import elemental.html.ClientRectList;
import elemental.dom.DocumentFragment;

import elemental.events.*;
import elemental.util.*;
import elemental.dom.*;
import elemental.html.*;
import elemental.css.*;
import elemental.stylesheets.*;

import java.util.Date;

/**
  * 

The Range object represents a fragment of a document that can contain nodes and parts of text nodes in a given document.

A range can be created using the Document.createRange  method of the Document  object. Range objects can also be retrieved by using the Selection.getRangeAt  method of the Selection  object.

*/ public interface Range { static final int END_TO_END = 2; static final int END_TO_START = 3; static final int NODE_AFTER = 1; static final int NODE_BEFORE = 0; static final int NODE_BEFORE_AND_AFTER = 2; static final int NODE_INSIDE = 3; static final int START_TO_END = 1; static final int START_TO_START = 0; /** * Returns a boolean indicating whether the range's start and end points are at the same position. */ boolean isCollapsed(); /** * Returns the deepest Node  that contains the startContainer and endContainer Nodes. */ Node getCommonAncestorContainer(); /** * Returns the Node  within which the Range ends. */ Node getEndContainer(); /** * Returns a number representing where in the endContainer the Range ends. */ int getEndOffset(); /** * Returns the Node  within which the Range starts. */ Node getStartContainer(); /** * Returns a number representing where in the startContainer the Range starts. */ int getStartOffset(); /** * Returns a DocumentFragment  copying the nodes of a Range. */ DocumentFragment cloneContents(); /** * Returns a Range object with boundary points identical to the cloned Range. */ Range cloneRange(); /** * Collapses the Range to one of its boundary points. */ void collapse(boolean toStart); /** * Returns a constant representing whether the Node is before, after, inside, or surrounding the range. */ short compareNode(Node refNode); /** * Returns -1, 0, or 1 indicating whether the point occurs before, inside, or after the range. */ short comparePoint(Node refNode, int offset); /** * Returns a DocumentFragment  created from a given string of code. */ DocumentFragment createContextualFragment(String html); /** * Removes the contents of a Range from the Document . */ void deleteContents(); /** * Releases Range from use to improve performance. */ void detach(); void expand(String unit); /** * Moves contents of a Range from the document tree into a DocumentFragment . */ DocumentFragment extractContents(); /** * Returns a ClientRect object which bounds the entire contents of the range; this would be the union of all the rectangles returned by range.getClientRects() . */ ClientRect getBoundingClientRect(); /** * Returns a list of ClientRect objects that aggregates the results of Element.getClientRects() for all the elements in the range. */ ClientRectList getClientRects(); /** * Insert a Node  at the start of a Range. */ void insertNode(Node newNode); /** * Returns a boolean indicating whether the given node intersects the range. */ boolean intersectsNode(Node refNode); /** * Returns a boolean indicating whether the given point is in the range. */ boolean isPointInRange(Node refNode, int offset); /** * Sets the Range to contain the Node  and its contents. */ void selectNode(Node refNode); /** * Sets the Range to contain the contents of a Node . */ void selectNodeContents(Node refNode); /** * Sets the end position of a Range. */ void setEnd(Node refNode, int offset); /** * Sets the end position of a Range relative to another Node . */ void setEndAfter(Node refNode); /** * Sets the end position of a Range relative to another Node . */ void setEndBefore(Node refNode); /** * Sets the start position of a Range. */ void setStart(Node refNode, int offset); /** * Sets the start position of a Range relative to another Node . */ void setStartAfter(Node refNode); /** * Sets the start position of a Range relative to another Node . */ void setStartBefore(Node refNode); /** * Moves content of a Range into a new Node . */ void surroundContents(Node newParent); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy