KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > tool > archive > wizard > ArchivePanel


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

24 package org.enhydra.tool.archive.wizard;
25
26 // ToolBox imports
27
import org.enhydra.tool.archive.ArchiveException;
28 import org.enhydra.tool.archive.JarPlan;
29 import org.enhydra.tool.common.PathHandle;
30 import org.enhydra.tool.common.wizard.TBWizardPanel;
31
32 // Standard imports
33
import javax.swing.JPanel JavaDoc;
34 import java.io.File JavaDoc;
35 import java.lang.ref.WeakReference JavaDoc;
36 import java.util.ResourceBundle JavaDoc;
37
38 /**
39  * This class defines the type of panel you can add to an
40  * OpenTool's BasicWizardPage or an CodeGenPage. Do to limitations
41  * in the JBuilder UI designer, this class and some of it's methods
42  * are not left as abstract.
43  */

44 public class ArchivePanel extends TBWizardPanel {
45     private WeakReference JavaDoc wizardRef = null;
46
47     /**
48      * Create an CodeGenPanel for use in an OpenTool BasicWizardPage
49      * or an CodeGenPage.
50      */

51     public ArchivePanel() {
52       super();
53     }
54
55     /**
56      * Get the title to use on the current page. Override this
57      * to set a custom title.
58      *
59      * @return
60      * A string to place at the top of a CodeGen wizard panel.
61      */

62     public String JavaDoc getPageTitle() {
63         return "ARCHIVE PAGE TITLE";
64     }
65
66     /**
67      * Populate the Swing control values from the option array.
68      * Not abstract due to limitation of JBuilder designer.
69      *
70      * @exception GeneratorException
71      * Thrown if not child class did not override.
72      */

73     public void readPlan(JarPlan plan) throws ArchiveException {
74         ArchiveException e =
75             new ArchiveException("ArchivePanel::readPlan"); // nores
76

77         e.printStackTrace();
78         throw e;
79     }
80
81     /**
82      * Write values from the swing controls into the option array.
83      * Not abstract due to limitation of JBuilder designer.
84      *
85      * @exception GeneratorException
86      * Thrown if not child class did not override.
87      */

88     public void writePlan(JarPlan plan) throws ArchiveException {
89         ArchiveException e =
90             new ArchiveException("ArchivePanel::writePlan"); // nores
91

92         e.printStackTrace();
93         throw e;
94     }
95
96     /**
97      * Validate values in the swing controls.
98      * Not abstract due to limitation of JBuilder designer.
99      *
100      * @exception ValidationException
101      * Thrown if not child class did not override.
102      */

103     public void validatePlan() throws ArchiveException {
104         ArchiveException e =
105             new ArchiveException("ArchivePanel::validatePlan"); // nores
106

107         e.printStackTrace();
108         throw e;
109     }
110
111     protected String JavaDoc getWorkingRoot() {
112       String JavaDoc root = null;
113       if (getWizard() == null) {
114         root = System.getProperty("user.dir");
115       } else {
116          root = getWizard().getWorkingRoot();
117       }
118       return root;
119     }
120
121     protected void setWorkingRoot(String JavaDoc root) {
122       if (getWizard() != null) {
123          getWizard().setWorkingRoot(root);
124       }
125     }
126
127     protected void preparePanel() {}
128
129     protected ArchiveWizard getWizard() {
130         ArchiveWizard wizard = null;
131
132         if (wizardRef != null) {
133             wizard = (ArchiveWizard) wizardRef.get();
134         }
135         return wizard;
136     }
137
138     protected void setWizard(ArchiveWizard wizard) {
139       wizardRef = new WeakReference JavaDoc(wizard);
140     }
141
142
143 }
144
Popular Tags