KickJava   Java API By Example, From Geeks To Geeks.

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


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  *
21  */

22 package org.enhydra.kelp.jbuilder.properties;
23
24 // JBuilder imports
25
import com.borland.jbuilder.node.JBProject;
26 import com.borland.primetime.help.HelpTopic;
27 import com.borland.primetime.help.ZipHelpTopic;
28 import com.borland.primetime.properties.PropertyPage;
29
30 // ToolBox imports
31
import org.enhydra.tool.common.DataValidationException;
32
33 // AddinCore imports
34
import org.enhydra.kelp.KelpInfo;
35 import org.enhydra.kelp.common.node.OtterProject;
36 import org.enhydra.kelp.common.dods.DodsInnerPanel;
37
38 // AddinJBuilder
39
import org.enhydra.kelp.jbuilder.node.PrimeProject;
40
41 // Standard imports
42
import java.awt.BorderLayout JavaDoc;
43 import java.awt.Dimension JavaDoc;
44 import java.beans.Beans JavaDoc;
45 import javax.swing.JOptionPane JavaDoc;
46
47 //
48
public class DodsProjectPropertyPage extends PropertyPage {
49
50     // string not to be resourced
51
private final String JavaDoc HELP_LINK = KelpInfo.getAddinHelpURL(); // nores
52

53     //
54
private OtterProject otterProject;
55     private DodsInnerPanel propertyPanel;
56     private BorderLayout JavaDoc layoutMain;
57
58     public DodsProjectPropertyPage(Object JavaDoc topic) {
59         if (topic instanceof JBProject) {
60             JBProject nativeProject = null;
61             PrimeProject primeProject = null;
62
63             nativeProject = (JBProject) topic;
64             otterProject = new PrimeProject(nativeProject);
65             try {
66                 jbInit();
67             } catch (Exception JavaDoc e) {
68                 e.printStackTrace();
69             }
70         }
71     }
72
73     public void readProperties() {
74         propertyPanel.read(otterProject);
75         enableUI(true);
76     }
77
78     public HelpTopic getHelpTopic() {
79         ZipHelpTopic t = new ZipHelpTopic(null, HELP_LINK);
80
81         return t;
82     }
83
84     public void writeProperties() {
85         try {
86             propertyPanel.write(otterProject);
87         } catch (DataValidationException e) {
88             e.printStackTrace(System.err);
89             JOptionPane.showMessageDialog(this, e.getValidationMessage());
90         }
91     }
92
93     public DodsProjectPropertyPage() {
94         try {
95             jbInit();
96         } catch (Exception JavaDoc e) {
97             e.printStackTrace();
98         }
99     }
100
101     private void enableUI(boolean enabled) {}
102
103     private void jbInit() throws Exception JavaDoc {
104         layoutMain =
105             (BorderLayout JavaDoc) Beans.instantiate(getClass().getClassLoader(),
106                                              BorderLayout JavaDoc.class.getName());
107         propertyPanel =
108             (DodsInnerPanel) Beans.instantiate(getClass().getClassLoader(),
109                                                  DodsInnerPanel.class.getName());
110         propertyPanel.setPreferredSize(new Dimension JavaDoc(0, 0));
111         this.setLayout(layoutMain);
112         this.add(propertyPanel, BorderLayout.CENTER);
113     }
114
115 }
116
Popular Tags