KickJava   Java API By Example, From Geeks To Geeks.

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


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.JBProject;
27 import com.borland.primetime.help.HelpTopic;
28 import com.borland.primetime.help.ZipHelpTopic;
29 import com.borland.primetime.properties.PropertyPage;
30
31 // Kelp imports
32
import org.enhydra.kelp.KelpInfo;
33 import org.enhydra.kelp.common.node.OtterProject;
34 import org.enhydra.kelp.common.properties.XMLCProjectPropertyPanel;
35 import org.enhydra.kelp.jbuilder.node.PrimeProject;
36
37 // Standard imports
38
import java.awt.BorderLayout JavaDoc;
39 import java.awt.Dimension JavaDoc;
40 import java.beans.Beans JavaDoc;
41 import java.lang.ref.WeakReference JavaDoc;
42
43 //
44
public class XMLCProjectPropertyPage extends PropertyPage {
45
46     // string not to be resourced
47
private final String JavaDoc HELP_LINK = KelpInfo.getAddinHelpURL(); // nores
48

49     //
50
private WeakReference JavaDoc projectRef = null;
51     private XMLCProjectPropertyPanel propertyPanel = null;
52     private BorderLayout JavaDoc layoutMain = null;
53
54     public XMLCProjectPropertyPage(Object JavaDoc topic) {
55         if (topic instanceof JBProject) {
56             OtterProject otterProject = null;
57
58             otterProject = new PrimeProject((JBProject) topic);
59             projectRef = new WeakReference JavaDoc(otterProject);
60             try {
61                 jbInit();
62                 pmInit();
63             } catch (Exception JavaDoc e) {
64                 e.printStackTrace();
65             }
66         }
67     }
68
69     public void readProperties() {
70         propertyPanel.read(getProject());
71         enableUI(true);
72     }
73
74     public HelpTopic getHelpTopic() {
75         ZipHelpTopic topic = null;
76
77         topic = new ZipHelpTopic(null, HELP_LINK);
78         return topic;
79     }
80
81     public void writeProperties() {
82         propertyPanel.save();
83     }
84
85     public XMLCProjectPropertyPage() {
86         try {
87             jbInit();
88         } catch (Exception JavaDoc e) {
89             e.printStackTrace();
90         }
91     }
92
93     //
94
// PRIVATE
95
//
96
private void enableUI(boolean enabled) {}
97
98     private void jbInit() throws Exception JavaDoc {
99         layoutMain = new BorderLayout JavaDoc();
100         propertyPanel = new XMLCProjectPropertyPanel();
101         propertyPanel.setPreferredSize(new Dimension JavaDoc(0, 0));
102         this.setLayout(layoutMain);
103         this.add(propertyPanel, BorderLayout.CENTER);
104     }
105
106     private void pmInit() {
107         propertyPanel.read(getProject());
108     }
109
110     private OtterProject getProject() {
111         OtterProject otterProject = null;
112
113         if (projectRef != null) {
114             otterProject = (OtterProject) projectRef.get();
115         }
116         return otterProject;
117     }
118
119 }
120
Popular Tags