KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > forte > node > ForteNodeFactory


1 /*
2  * Enhydra Java Application Server Project
3  *
4  * The contents of this file are subject to the Enhydra Public License
5  * Version 1.1 (the "License"); you may not use this file except in
6  * compliance with the License. You may obtain a copy of the License on
7  * the Enhydra web site ( http://www.enhydra.org/ ).
8  *
9  * Software distributed under the License is distributed on an "AS IS"
10  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
11  * the License for the specific terms governing rights and limitations
12  * under the License.
13  *
14  * The Initial Developer of the Enhydra Application Server is Lutris
15  * Technologies, Inc. The Enhydra Application Server and portions created
16  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
17  * All Rights Reserved.
18  *
19  * Contributor(s):
20  * Lisa Reese
21  *
22  */

23
24
25 /*
26  * ForteNodeFactory.java
27  *
28  * Created on May 3, 2001, 12:29 PM
29  */

30
31 package org.enhydra.kelp.forte.node;
32
33 // ToolBox imports
34
import org.enhydra.tool.common.ToolException;
35 import org.enhydra.kelp.common.node.*;
36
37 import org.openide.nodes.Node;
38 import org.netbeans.modules.text.TXTDataObject;
39 /**
40  *
41  * @author rees0234
42  * @version
43  */

44 public class ForteNodeFactory extends OtterNodeFactory {
45
46     /** Creates new ForteNodeFactory */
47     public ForteNodeFactory() {
48     }
49
50     public OtterFolderNode createFolderNode(OtterNode otterNode, String JavaDoc name) {
51         OtterFolderNode newNode = null;
52
53         newNode = new ForteFolderNode(otterNode, name);
54         return newNode;
55      }
56
57     /**
58      * Method declaration
59      *
60      *
61      * @param otterNode
62      * @param file
63      *
64      * @return
65      */

66     public OtterJavaFileNode createJavaFileNode(OtterNode otterNode,
67                                                 String JavaDoc file) {
68         OtterJavaFileNode newNode = null;
69
70         newNode = new ForteJavaFileNode(otterNode, file);
71         return newNode;
72     }
73
74     /**
75      * Method declaration
76      *
77      *
78      * @param otterNode
79      * @param file
80      *
81      * @return
82      */

83     public OtterDocumentNode createDocumentNode(OtterNode otterNode,
84                                                 String JavaDoc file) {
85         OtterDocumentNode newNode = null;
86
87         newNode = new ForteDocumentNode(otterNode, file);
88         return newNode;
89
90     }
91
92     /**
93      * Method declaration
94      *
95      *
96      * @param otterNode
97      * @param file
98      *
99      * @return
100      */

101     public OtterImageFileNode createImageFileNode(OtterNode otterNode,
102             String JavaDoc file) {
103         OtterImageFileNode newNode = null;
104
105         newNode = new ForteImageFileNode(otterNode, file);
106         return newNode;
107
108     }
109
110     /**
111      * Method declaration
112      *
113      *
114      * @param otterNode
115      * @param file
116      *
117      * @return
118      */

119     public OtterTextFileNode createTextFileNode(OtterNode otterNode,
120                                                 String JavaDoc file) {
121
122         OtterTextFileNode newNode = null;
123
124         newNode = new ForteTextFileNode(otterNode, file);
125         return newNode;
126
127     }
128
129     /**
130      * Method declaration
131      *
132      *
133      * @param otterNode
134      * @param file
135      *
136      * @return
137      */

138     public OtterTemplateNode createTemplateNode(OtterNode otterNode,
139                                                 String JavaDoc file) {
140         OtterTemplateNode newNode = null;
141
142         newNode = new ForteTemplateNode(otterNode, file);
143         return newNode;
144
145
146     }
147
148     /**
149      * Method declaration
150      *
151      * @param otterNode
152      *
153      * @return
154      */

155     public OtterTemplateNode getTemplateNode(OtterNode otterNode) {
156         OtterTemplateNode newNode = null;
157
158         if (otterNode.getNativeNode() instanceof DeployDataObject) {
159             DeployDataObject nativeNode = null;
160
161             nativeNode = (DeployDataObject) otterNode.getNativeNode();
162             try {
163               newNode = new ForteTemplateNode(nativeNode);
164             } catch (ToolException e) {
165               e.printStackTrace();
166             }
167         }
168         return newNode;
169     }
170
171     /**
172      * Method declaration
173      *
174      *
175      * @param project
176      * @param node
177      * @param files
178      *
179      * @return
180      */

181     public synchronized OtterJavaFileNode[] replaceGeneratedSource(OtterProject project,
182             OtterNode node, String JavaDoc[] files) {
183
184                 System.out.println("replace generated source");
185                 return null;
186
187         // Remove previously generated sources and then add
188
/* OtterJavaFileNode[] javaNodes = new OtterJavaFileNode[files.length];
189         Node nativeProject = (Node) project.getNativeProject();
190         Node nativeNode = (Node) node.getNativeNode();
191         Node[] child = nativeNode.getChildren().getNodes();
192         File current = null;
193         boolean keep = false;
194
195         for (int i = 0; i < child.length; i++) {
196             if (child[i] instanceof FileNode) {
197                 FileNode cursor = null;
198
199                 cursor = (FileNode) child[i];
200                 for (int j = 0; j < files.length; j++) {
201                     current = new File(files[j]);
202                     if (cursor.getUrl().getFileObject().getAbsolutePath().equals(current.getAbsolutePath())) {
203                         keep = true;
204                         break;
205                     }
206                 }
207                 if (!keep) {
208                     cursor.setParent(null);
209                     cursor.getUrl().getFileObject().delete();
210                 }
211             }
212         }
213         for (int i = 0; i < files.length; i++) {
214             try {
215                 Thread.sleep(100);
216             } catch (Exception e) {
217                 e.printStackTrace();
218             }
219             javaNodes[i] = createJavaFileNode(node, files[i]);
220         }
221         return javaNodes;*/

222     }
223
224
225 }
226
Popular Tags