KickJava   Java API By Example, From Geeks To Geeks.

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


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 package org.enhydra.kelp.forte.node;
25
26 // ToolBox imports
27
import org.enhydra.tool.common.ToolException;
28 import org.enhydra.tool.common.PathHandle;
29
30 // Kelp imports
31
import org.enhydra.kelp.common.ResUtil;
32 import org.enhydra.kelp.common.PropUtil;
33 import org.enhydra.kelp.common.PathUtil;
34 import org.enhydra.kelp.common.node.OtterProject;
35 import org.enhydra.kelp.common.node.OtterNode;
36 import org.enhydra.kelp.common.node.OtterTemplateNode;
37
38 //netbeans imports:
39
import org.openide.util.NbBundle;
40 import org.openide.loaders.DataNode;
41 import org.openide.nodes.Node;
42
43
44 // Standard imports
45
import java.io.File JavaDoc;
46
47 /**
48  *
49  * @author rees0234
50  * @version
51  */

52 public class ForteTemplateNode extends ForteNode implements OtterTemplateNode{
53     /** Creates new ForteTemplateNode */
54     public ForteTemplateNode(DeployDataObject n) throws ToolException {
55         super(n);
56         if (!PathUtil.isTemplate(this)) {
57             StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
58
59             buf.append(NbBundle.getMessage (ForteTemplateNode.class, "MSG_Invalid_template_node"));
60
61             buf.append('\n');
62             buf.append(NbBundle.getMessage (ForteTemplateNode.class,"Node_file_path_0_"));
63             buf.append(getFilePath());
64
65             buf.append('\n');
66             buf.append(NbBundle.getMessage (ForteTemplateNode.class,"Deploy_input_path_0_"));
67             buf.append(getProject().getDeployInputPath());
68             throw new ToolException(buf.toString());
69         }
70     }
71
72     /** Creates new ForteTemplateNode */
73     public ForteTemplateNode(DodsDataObject n) throws ToolException {
74         super(n);
75         if (!PathUtil.isTemplate(this)) {
76             StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
77
78             buf.append(NbBundle.getMessage (ForteTemplateNode.class, "MSG_Invalid_template_node"));
79
80             buf.append('\n');
81             buf.append(NbBundle.getMessage (ForteTemplateNode.class,"Node_file_path_0_"));
82             buf.append(getFilePath());
83
84             buf.append('\n');
85             buf.append(NbBundle.getMessage (ForteTemplateNode.class,"Deploy_input_path_0_"));
86             buf.append(getProject().getDeployInputPath());
87             throw new ToolException(buf.toString());
88         }
89     }
90
91     /**
92      * Constructor declaration
93      *
94      *
95      * @param otterNode
96      * @param file
97      */

98     public ForteTemplateNode(OtterNode otterNode, String JavaDoc file) {
99        super(otterNode, file);
100     }
101
102     public boolean isSelected()
103     {
104         String JavaDoc in = getProperty(NAME_SELECTED);
105         return PropUtil.stringToBoolean(in, false);
106     }
107
108     public void setSelected(boolean b) {
109         setProperty(NAME_SELECTED, PropUtil.booleanToString(b));
110     }
111
112     public String JavaDoc getProperty(String JavaDoc property)
113     {
114         String JavaDoc out = "";
115
116         if (nativeNode != null) {
117               out = ((DeployDataObject)nativeNode).getProperty(property);
118         }
119
120         return out;
121     }
122
123     /**
124      * Method declaration
125      *
126      *
127      * @param property
128      * @param value
129      */

130     public void setProperty(String JavaDoc property, String JavaDoc value)
131     {
132         if (nativeNode != null) {
133             ((DeployDataObject)nativeNode).setProperty(property, value);
134         }
135     }
136
137     // implements OtterTemplateNode
138
public String JavaDoc getOutputPath() {
139         return PathUtil.getOutputPath(this);
140     }
141
142
143 }
144
Popular Tags