KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > kelp > jbuilder > properties > XMLCNodePropertyPage


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  * Paul Mahar
21  *
22  */

23 package org.enhydra.kelp.jbuilder.properties;
24
25 // JBuilder imports
26
import com.borland.jbuilder.node.HTMLFileNode;
27 import com.borland.primetime.help.HelpTopic;
28 import com.borland.primetime.help.ZipHelpTopic;
29 import com.borland.primetime.node.TextFileNode;
30 import com.borland.primetime.properties.PropertyPage;
31
32 // AddinCore
33
import org.enhydra.kelp.KelpInfo;
34 import org.enhydra.kelp.common.node.OtterDocumentNode;
35 import org.enhydra.kelp.common.node.OtterXMLCNode;
36 import org.enhydra.kelp.common.properties.XMLCNodePropertyPanel;
37
38 // AddinJBuilder
39
import org.enhydra.kelp.jbuilder.node.PrimeDocumentNode;
40
41 // JDK
42
import java.awt.BorderLayout JavaDoc;
43 import java.lang.ref.WeakReference JavaDoc;
44
45 /**
46  * Class declaration
47  *
48  *
49  * @author Paul Mahar
50  */

51 public class XMLCNodePropertyPage extends PropertyPage {
52
53     // string not to be resourced
54
private final String JavaDoc HELP_LINK = KelpInfo.getAddinHelpURL(); // nores
55

56     //
57
private XMLCNodePropertyPanel nodePanel = new XMLCNodePropertyPanel();
58     private BorderLayout JavaDoc layoutMain = new BorderLayout JavaDoc();
59     private WeakReference JavaDoc nodeRef = null;
60
61     /**
62      * Constructor declaration
63      *
64      * @param topic
65      */

66     public XMLCNodePropertyPage(Object JavaDoc topic) {
67         if (topic instanceof TextFileNode) {
68             OtterXMLCNode xmlcNode = null;
69             OtterDocumentNode docNode = null;
70             TextFileNode nativeText = (TextFileNode) topic;
71
72             docNode = new PrimeDocumentNode(nativeText);
73             xmlcNode = new OtterXMLCNode(docNode);
74             nodeRef = new WeakReference JavaDoc(xmlcNode);
75             try {
76                 nodePanel.read(xmlcNode);
77                 jbInit();
78             } catch (Exception JavaDoc e) {
79                 e.printStackTrace();
80             }
81         }
82     }
83
84     /**
85      * Method declaration
86      *
87      */

88     public void readProperties() {
89         OtterXMLCNode node = null;
90
91         if (nodeRef != null) {
92             node = (OtterXMLCNode) nodeRef.get();
93             nodePanel.read(node);
94         }
95     }
96
97     /**
98      * Method declaration
99      *
100      *
101      * @return
102      */

103     public HelpTopic getHelpTopic() {
104         ZipHelpTopic t = new ZipHelpTopic(null, HELP_LINK);
105
106         return t;
107     }
108
109     /**
110      * Method declaration
111      *
112      */

113     public void writeProperties() {
114         nodePanel.save();
115     }
116
117     /**
118      * Constructor declaration
119      *
120      */

121     public XMLCNodePropertyPage() {
122         try {
123             jbInit();
124         } catch (Exception JavaDoc e) {
125             e.printStackTrace();
126         }
127     }
128
129     //
130
// PRIVATE
131
//
132

133     /**
134      * Method declaration
135      *
136      *
137      * @exception Exception
138      */

139     private void jbInit() throws Exception JavaDoc {
140         this.setLayout(layoutMain);
141         this.add(nodePanel, BorderLayout.CENTER);
142     }
143
144 }
145
Popular Tags