KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > tool > codegen > wizard > CodeGenPage


1
2 /*
3  * Enhydra Java Application Server Project
4  *
5  * The contents of this file are subject to the Enhydra Public License
6  * Version 1.1 (the "License"); you may not use this file except in
7  * compliance with the License. You may obtain a copy of the License on
8  * the Enhydra web site ( http://www.enhydra.org/ ).
9  *
10  * Software distributed under the License is distributed on an "AS IS"
11  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
12  * the License for the specific terms governing rights and limitations
13  * under the License.
14  *
15  * The Initial Developer of the Enhydra Application Server is Lutris
16  * Technologies, Inc. The Enhydra Application Server and portions created
17  * by Lutris Technologies, Inc. are Copyright Lutris Technologies, Inc.
18  * All Rights Reserved.
19  *
20  * Contributor(s):
21  *
22  */

23
24 package org.enhydra.tool.codegen.wizard;
25
26 // ToolBox imports
27
import org.enhydra.tool.ToolBoxInfo;
28 import org.enhydra.tool.common.Browser;
29 import org.enhydra.tool.common.wizard.TBWizardPage;
30 import org.enhydra.tool.codegen.GeneratorException;
31 import org.enhydra.tool.codegen.ValidationException;
32
33 // Standard imports
34
import java.awt.*;
35 import java.beans.*;
36 import java.io.File JavaDoc;
37 import javax.swing.*;
38
39 /**
40  * The CodeGenPage is a panel that you can add to a WizardDialog. It displays
41  * a page title, instructions and a CodeGenPanel.
42  * <P><I>
43  * This class is used when creating a standalone wizard. Use the
44  * OpenTools BasicWizardPage when developing JBuilder add-ins.
45  * </I></P>
46  */

47 public class CodeGenPage extends TBWizardPage {
48     /**
49      * Create a CodeGenPage.
50      */

51     public CodeGenPage() {
52         super();
53     }
54
55     private CodeGenPanel getCodeGenPanel() {
56       return (CodeGenPanel) getWizardPanel();
57     }
58
59
60     /**
61      * Read option set into swing controls.
62      *
63      * @exception GeneratorException
64      * Thrown if unable to set controls to option values.
65      */

66     public void readOptionSet() throws GeneratorException {
67         getCodeGenPanel().readOptionSet();
68     }
69
70     /**
71      * Write option values from Swing controls into the
72      * current option set.
73      *
74      * @exception GeneratorException
75      * Thrown if unable to write a value from a Swing component
76      * into the current option set.
77      */

78     public void writeOptionSet() throws GeneratorException {
79         getCodeGenPanel().writeOptionSet();
80     }
81
82     /**
83      * Check to see if the option values in the Swing controls
84      * are valid for the given option set. Call this when user
85      * attempts to navigate between pages.
86      *
87      * @exception ValidationException
88      * Thrown if a Swing control contains a invalid value. The messge
89      * of the exception can be used to provide feedback to the user.
90      */

91     public void validateOptionSet() throws ValidationException {
92         getCodeGenPanel().validateOptionSet();
93     }
94
95     public void help() {
96       Browser browser = new Browser();
97       StringBuffer JavaDoc buf = new StringBuffer JavaDoc();
98       browser.setOwner(getTopLevelAncestor());
99       buf.append(ToolBoxInfo.getEnhydraRoot());
100       buf.append(File.separatorChar);
101       buf.append("doc"); // nores
102
buf.append(File.separatorChar);
103       buf.append("index.html"); // nores
104
browser.open(buf.toString());
105     }
106 }
107
Popular Tags