KickJava   Java API By Example, From Geeks To Geeks.

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


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
26
import com.borland.primetime.properties.PropertyPage;
27 import com.borland.primetime.help.HelpTopic;
28 import com.borland.primetime.node.TextFileNode;
29 import com.borland.primetime.help.ZipHelpTopic;
30
31 // Toolbox
32
import org.enhydra.tool.common.ToolException;
33
34 // AddinCore
35
import org.enhydra.kelp.KelpInfo;
36 import org.enhydra.kelp.common.node.OtterTemplateNode;
37 import org.enhydra.kelp.common.properties.TemplateNodePropertyPanel;
38
39 // AddinJBuilder
40
import org.enhydra.kelp.jbuilder.node.PrimeTemplateNode;
41
42 // JDK
43
import java.awt.BorderLayout JavaDoc;
44 import java.lang.ref.WeakReference JavaDoc;
45
46 //
47
public class TemplateNodePropertyPage extends PropertyPage {
48
49     // string not to be resourced
50
private final String JavaDoc HELP_LINK = KelpInfo.getAddinHelpURL(); // nores
51

52     //
53
private TemplateNodePropertyPanel nodePanel = null;
54     private WeakReference JavaDoc nodeRef = null;
55     private BorderLayout JavaDoc layoutMain = null;
56
57     public TemplateNodePropertyPage(Object JavaDoc topic) {
58         if (topic instanceof TextFileNode) {
59             try {
60                 jbInit();
61                 pmInit((TextFileNode) topic);
62             } catch (Exception JavaDoc e) {
63                 e.printStackTrace();
64             }
65         }
66     }
67
68     public void readProperties() {
69         if (nodeRef != null) {
70             nodePanel.read((OtterTemplateNode) nodeRef.get());
71         }
72     }
73
74     public HelpTopic getHelpTopic() {
75         ZipHelpTopic t = new ZipHelpTopic(null, HELP_LINK);
76
77         return t;
78     }
79
80     public void writeProperties() {
81         nodePanel.save();
82     }
83
84     public TemplateNodePropertyPage() {
85         try {
86             jbInit();
87         } catch (Exception JavaDoc e) {
88             e.printStackTrace();
89         }
90     }
91
92     //
93
private void pmInit(TextFileNode nativeNode) throws ToolException {
94         OtterTemplateNode otterNode;
95
96         otterNode = new PrimeTemplateNode(nativeNode);
97         nodePanel.read(otterNode);
98         nodeRef = new WeakReference JavaDoc(otterNode);
99     }
100
101     private void jbInit() throws Exception JavaDoc {
102         layoutMain = new BorderLayout JavaDoc();
103         nodePanel = new TemplateNodePropertyPanel();
104         nodePanel.setIconView(true);
105         this.setLayout(layoutMain);
106         this.add(nodePanel, BorderLayout.CENTER);
107     }
108
109 }
110
Popular Tags