001: /*
002: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003: *
004: * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
005: *
006: * The contents of this file are subject to the terms of either the GNU
007: * General Public License Version 2 only ("GPL") or the Common
008: * Development and Distribution License("CDDL") (collectively, the
009: * "License"). You may not use this file except in compliance with the
010: * License. You can obtain a copy of the License at
011: * http://www.netbeans.org/cddl-gplv2.html
012: * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the
013: * specific language governing permissions and limitations under the
014: * License. When distributing the software, include this License Header
015: * Notice in each file and include the License file at
016: * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this
017: * particular file as subject to the "Classpath" exception as provided
018: * by Sun in the GPL Version 2 section of the License file that
019: * accompanied this code. If applicable, add the following below the
020: * License Header, with the fields enclosed by brackets [] replaced by
021: * your own identifying information:
022: * "Portions Copyrighted [year] [name of copyright owner]"
023: *
024: * Contributor(s):
025: *
026: * The Original Software is NetBeans. The Initial Developer of the Original
027: * Software is Sun Microsystems, Inc. Portions Copyright 1997-2007 Sun
028: * Microsystems, Inc. All Rights Reserved.
029: *
030: * If you wish your version of this file to be governed by only the CDDL
031: * or only the GPL Version 2, indicate your decision by adding
032: * "[Contributor] elects to include this software in this distribution
033: * under the [CDDL or GPL Version 2] license." If you do not indicate a
034: * single choice of license, a recipient has the option to distribute
035: * your version of this file under either the CDDL, the GPL Version 2 or
036: * to extend the choice of license to its licensees as provided above.
037: * However, if you add GPL Version 2 code and therefore, elected the GPL
038: * Version 2 license, then the option applies only if the new code is
039: * made subject to such option by the copyright holder.
040: */
041:
042: package com.sun.rave.designtime.markup;
043:
044: import org.w3c.dom.Node;
045: import com.sun.rave.designtime.Position;
046:
047: /**
048: * The MarkupPosition extends the Position class to include specifics about DOM coordinates. This
049: * class is used when creating children, moving them, etc.
050: *
051: * @author Carl Quinn
052: * @version 1.0
053: */
054: public class MarkupPosition extends Position {
055:
056: /**
057: * storage for the 'underParent' property
058: */
059: protected Node underParent;
060:
061: /**
062: * storage for the 'beforeSibling' property
063: */
064: protected Node beforeSibling;
065:
066: /**
067: * Constructs a default MarkupPosition with no settings
068: */
069: public MarkupPosition() {
070: }
071:
072: /**
073: * Constructs a MarkupPosition with the specified index
074: *
075: * @param index the desired index
076: */
077: public MarkupPosition(int index) {
078: super (index);
079: }
080:
081: /**
082: * Constructs a MarkupPosition with the specified index and beforeSibling. The 'beforeSibling'
083: * denotes the immediate next sibling of the desired position.
084: *
085: * @param index The desired index
086: * @param beforeSibling The desired beforeSibling - denotes the immediate next sibling of the
087: * desired position
088: */
089: public MarkupPosition(int index, Node beforeSibling) {
090: super (index);
091: this .beforeSibling = beforeSibling;
092: }
093:
094: /**
095: * Constructs a MarkupPosition with the specified underParent and beforeSibling. The
096: * 'underParent' denotes the desired parent for the position. The 'beforeSibling' denotes the
097: * immediate next sibling of the desired position.
098: *
099: * @param underParent The desired underParent - denotes the desired parent for the position
100: * @param beforeSibling The desired beforeSibling - denotes the immediate next sibling of the
101: * desired position
102: */
103: public MarkupPosition(Node underParent, Node beforeSibling) {
104: this .underParent = underParent;
105: this .beforeSibling = beforeSibling;
106: }
107:
108: /**
109: * Constructs a MarkupPosition with the specified beforeSibling. The 'beforeSibling' denotes the
110: * immediate next sibling of the desired position.
111: *
112: * @param beforeSibling The desired beforeSibling - denotes the immediate next sibling of the
113: * desired position
114: */
115: public MarkupPosition(Node beforeSibling) {
116: this .beforeSibling = beforeSibling;
117: }
118:
119: /**
120: * @return Returns the underParent. The 'underParent' denotes the desired parent for the
121: * position.
122: */
123: public Node getUnderParent() {
124: return underParent;
125: }
126:
127: /**
128: * @param underParent The underParent to set. The 'underParent' denotes the desired parent for
129: * the position.
130: */
131: public void setUnderParent(Node underParent) {
132: this .underParent = underParent;
133: }
134:
135: /**
136: * @return Returns the beforeSibling. The 'beforeSibling' denotes the immediate next sibling of
137: * the desired position.
138: */
139: public Node getBeforeSibling() {
140: return beforeSibling;
141: }
142:
143: /**
144: * @param beforeSibling The beforeSibling to set. The 'beforeSibling' denotes the
145: * immediate next sibling of the desired position.
146: */
147: public void setBeforeSibling(Node beforeSibling) {
148: this .beforeSibling = beforeSibling;
149: }
150:
151: public String toString() {
152: return "[MarkupPosition under:[" + underParent + "] before:["
153: + beforeSibling + "] index:[" + getIndex() + "]]"; // NOI18N
154: }
155: }
|