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 org.netbeans.modules.visualweb.gravy.model.project;
043:
044: import java.util.ArrayList;
045: import java.util.List;
046: import javax.swing.tree.TreePath;
047:
048: /**
049: * Class for XML files.
050: */
051:
052: public class XMLFile extends SourceFile implements ProjectEntry {
053:
054: /**
055: * Parent of the xml file.
056: */
057: private ProjectEntry parent;
058:
059: /**
060: * Child project entries of the xml file.
061: */
062: private List childList = new ArrayList();
063:
064: /**
065: * Creates a new instance of web page.
066: * @param path Path to web page in project.
067: * @param name Name of web page.
068: */
069: XMLFile(TreePath path, String name, ProjectEntry parent) {
070: super (path, name);
071: setParent(parent);
072: }
073:
074: /**
075: * Save project entry.
076: */
077: public void save() {
078: }
079:
080: /**
081: * Save project entry as project entry with specified name.
082: */
083: public void saveAs(String name) {
084: }
085:
086: /**
087: * @return Name of the project entry.
088: */
089: public String getName() {
090: return name;
091: }
092:
093: /**
094: * @return TreePath of the project entry.
095: */
096: public TreePath getTreePath() {
097: return path;
098: }
099:
100: /**
101: * @return Parent of the xml file.
102: */
103: public ProjectEntry getParent() {
104: return parent;
105: }
106:
107: /**
108: * Set parent of the xml file.
109: */
110: private void setParent(ProjectEntry parent) {
111: this .parent = parent;
112: }
113:
114: /**
115: * @return Child project entries of the xml file.
116: */
117: public ProjectEntry[] getChildren() {
118: return ((ProjectEntry[]) childList
119: .toArray(new ProjectEntry[childList.size()]));
120: }
121:
122: /**
123: * Remove project entry.
124: */
125: public void delete() {
126: }
127:
128: /**
129: * Gets text from the currently opened xml file.
130: * @return String representing whole content of the xml file.
131: * (including new line characters)
132: */
133: public String getText() {
134: return null;
135: }
136:
137: /**
138: * Gets text from specified line.
139: * @param lineNumber Number of line.
140: * @return String representing content of the line.
141: */
142: public String getText(int lineNumber) {
143: return null;
144: }
145:
146: /**
147: * Checks if xml file contains text specified as parameter text.
148: * @param text Text to compare to.
149: * @return true if text was found, false otherwise.
150: */
151: public boolean contains(String text) {
152: return true;
153: }
154:
155: /**
156: * Replaces first occurence of oldText by newText.
157: * @param oldText Text to be replaced.
158: * @param newText Text to write instead.
159: */
160: public void replace(String oldText, String newText) {
161: }
162:
163: /**
164: * Replaced index-th occurence of oldText by newText.
165: * @param oldText Text to be replaced
166: * @param newText Text to write instead
167: * @param index Tndex of oldText occurence.
168: */
169: public void replace(String oldText, String newText, int index) {
170: }
171:
172: /**
173: * Insert text to current position.
174: * @param text String to be inserted.
175: */
176: public void insert(String text) {
177: }
178:
179: /**
180: * Inserts text to position specified by line number and column.
181: * @param text String to be inserted.
182: * @param lineNumber Number of line.
183: * @param column Column position.
184: */
185: public void insert(String text, int lineNumber, int column) {
186: }
187:
188: /**
189: * Deletes given number of characters from specified possition.
190: * @param offset Position inside document.
191: * @param length Number of characters to be deleted.
192: */
193: public void delete(int offset, int length) {
194: }
195:
196: /**
197: * Deletes given number of characters from current caret possition.
198: * @param length Number of characters to be deleted.
199: */
200: public void delete(int length) {
201: }
202:
203: /**
204: * Delete specified line.
205: * @param line Number of line.
206: */
207: public void deleteLine(int line) {
208: }
209:
210: /**
211: * Deletes characters between column1 and column2 on the specified line.
212: * @param lineNumber Number of line.
213: * @param column1 Column position where to start deleting.
214: * @param column2 Column position where to stop deleting.
215: */
216: public void delete(int lineNumber, int column1, int column2) {
217: }
218: }
|