KickJava   Java API By Example, From Geeks To Geeks.

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


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.PathHandle;
28
29 // Kelp imports
30
import org.enhydra.kelp.common.Constants;
31 import org.enhydra.kelp.common.PropUtil;
32 import org.enhydra.kelp.common.node.OtterProject;
33 import org.enhydra.kelp.common.node.OtterNode;
34 import org.enhydra.kelp.common.node.OtterDocumentNode;
35 import org.enhydra.kelp.common.node.PropertyKeys;
36
37 // NetBeans imports
38
import org.openide.nodes.Node;
39
40 // Standard imports
41
import java.io.IOException JavaDoc;
42
43 //
44
/**
45  * Class declaration
46  *
47  *
48  * @author
49  */

50 public class ForteDocumentNode extends ForteNode implements OtterDocumentNode {
51
52  // XMLCDataNode nativeNode;
53
//dr
54
// XMLCDataNode nativeNode;
55
//
56
public ForteDocumentNode(XMLCDataObject n) {
57         super(n);
58     }
59
60     /**
61      * Constructor declaration
62      *
63      *
64      * @param otterNode
65      * @param path
66      */

67     public ForteDocumentNode(OtterNode otterNode, String JavaDoc path) {
68         super(otterNode, path);
69     }
70
71     public boolean isSelected()
72     {
73         String JavaDoc in = getProperty(NAME_SELECTED);
74         return PropUtil.stringToBoolean(in, false);
75     }
76
77     public void setSelected(boolean b) {
78         setProperty(NAME_SELECTED, PropUtil.booleanToString(b));
79         if (b) {
80             setStatic(false);
81         }
82     }
83
84     public boolean isStatic() {
85         String JavaDoc in = getProperty(NAME_RESOURCE_STATIC);
86
87         return PropUtil.stringToBoolean(in, false);
88     }
89
90     public void setStatic(boolean b) {
91         setProperty(NAME_RESOURCE_STATIC,
92                     PropUtil.booleanToString(b));
93         if (b) {
94             setSelected(false);
95         }
96     }
97
98     public void preCompile() {
99
100 /* if (getNativeNode() instanceof FileNode) {
101             XMLCDataNode nativeNode = (XMLCDataNode) getNativeNode();
102
103             if (nativeNode.isModified()) {
104                 try {
105                     nativeNode.save();
106                 } catch (InvalidUrlException e) {
107                     e.printStackTrace();
108                 } catch (IOException e) {
109                     e.printStackTrace();
110                 }
111             }
112         } */

113     }
114
115     public String JavaDoc getProperty(String JavaDoc property)
116     {
117         String JavaDoc out = "";
118
119         if (nativeNode != null) {
120                 out = ((XMLCDataObject)nativeNode).getProperty(property);
121         }
122
123         return out;
124     }
125
126     /**
127      * Method declaration
128      *
129      *
130      * @param property
131      * @param value
132      */

133     public void setProperty(String JavaDoc property, String JavaDoc value)
134     {
135         if (nativeNode != null) {
136                 ((XMLCDataObject)nativeNode).setProperty(property, value);
137         }
138     }
139
140     public String JavaDoc getXMLCOptionFilePath()
141     {
142         return getProperty(NAME_XMLC_OPTION_FILEPATH);
143     }
144
145     public void setXMLCOptionFilePath(String JavaDoc in)
146     {
147         setProperty(NAME_XMLC_OPTION_FILEPATH, in); }
148
149     public String JavaDoc getXMLCParameters()
150     {
151         return getProperty(NAME_XMLC_PARAMETERS);
152     }
153
154     public void setXMLCParameters(String JavaDoc in)
155     {
156         setProperty(NAME_XMLC_PARAMETERS, in);
157     }
158 }
159
Popular Tags