01: /*
02: * $Id: org.eclipse.jdt.ui.prefs 5004 2006-03-17 20:47:08 -0800 (Fri, 17 Mar
03: * 2006) eelco12 $ $Revision: 5004 $ $Date: 2006-03-17 20:47:08 -0800 (Fri, 17
04: * Mar 2006) $
05: *
06: * ==============================================================================
07: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
08: * use this file except in compliance with the License. You may obtain a copy of
09: * the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16: * License for the specific language governing permissions and limitations under
17: * the License.
18: */
19: package wicket.examples.wizard;
20:
21: import java.lang.reflect.Constructor;
22:
23: import wicket.examples.WicketExamplePage;
24: import wicket.extensions.wizard.Wizard;
25:
26: /**
27: * Page for displaying a wizard.
28: *
29: * @author Eelco Hillenius
30: */
31: public class WizardPage extends WicketExamplePage {
32: /**
33: * Construct.
34: *
35: * @param wizardClass
36: * class of the wizard component
37: */
38: public WizardPage(Class wizardClass) {
39: if (wizardClass == null) {
40: throw new IllegalArgumentException(
41: "argument wizardClass must be not null");
42: }
43: try {
44: Constructor ctor = wizardClass
45: .getConstructor(new Class[] { String.class });
46: Wizard wizard = (Wizard) ctor
47: .newInstance(new String[] { "wizard" });
48: add(wizard);
49: } catch (Exception e) {
50: throw new RuntimeException(e);
51: }
52: }
53: }
|