KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > jbuilder > node > PrimeFolderNode


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  *
21  */

22
23 package org.enhydra.kelp.jbuilder.node;
24
25 // JBuilder imports
26
import com.borland.jbuilder.node.JBProject;
27 import com.borland.primetime.node.Node;
28 import com.borland.primetime.node.FolderNode;
29 import com.borland.primetime.node.LightweightNode;
30
31 // Kelp imports
32
import org.enhydra.kelp.common.node.OtterFolderNode;
33 import org.enhydra.kelp.common.node.OtterNode;
34
35 /**
36  * Class declaration
37  *
38  *
39  * @author Paul Mahar
40  */

41 public class PrimeFolderNode extends PrimeNode implements OtterFolderNode {
42
43     public PrimeFolderNode(FolderNode nativeNode) {
44       super(nativeNode);
45     }
46
47
48     /**
49      * Constructor declaration
50      *
51      *
52      * @param otterNode
53      * @param name
54      */

55     public PrimeFolderNode(OtterNode otterNode,
56                String JavaDoc name) {
57
58         JBProject nativeProject = null;
59         Node containerNode = null;
60
61         if (otterNode.getProject().getNativeProject() instanceof JBProject) {
62             nativeProject =
63                 (JBProject) otterNode.getProject().getNativeProject();
64         }
65         if (otterNode.getNativeNode() instanceof Node) {
66             containerNode = (Node) otterNode.getNativeNode();
67         }
68         if (nativeProject != null && containerNode != null) {
69             LightweightNode[] found = new LightweightNode[0];
70
71             found = nativeProject.findNodes(name);
72             if (found == null || found.length == 0) {
73                 FolderNode newNode = null;
74             newNode = new FolderNode(nativeProject, containerNode, name);
75                 setNativeNode(newNode);
76             } else {
77                 setNativeNode(found[0]);
78             }
79         }
80     }
81
82 }
83
Popular Tags