01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.wicket.examples.wizard;
18:
19: import org.apache.wicket.examples.WicketExamplePage;
20: import org.apache.wicket.markup.html.link.Link;
21:
22: /**
23: * Index page for the wizard example.
24: *
25: * @author Eelco Hillenius
26: */
27: public class Index extends WicketExamplePage {
28: /**
29: * Link to the wizard. It's an internal link instead of a bookmarkable page
30: * to help us with backbutton surpression. Wizards by default do not
31: * partipcate in versioning, which has the effect that whenever a button is
32: * clicked in the wizard, it will never result in a change of the
33: * redirection url. However, though that'll work just fine when you are
34: * already in the wizard, there is still the first access to the wizard. But
35: * if you link to the page that renders it using and internal link, you'll
36: * circumvent that.
37: */
38: private static final class WizardLink extends Link {
39: private final Class wizardClass;
40:
41: /**
42: * Construct.
43: *
44: * @param id
45: * Component id
46: * @param wizardClass
47: * Class of the wizard to instantiate
48: */
49: public WizardLink(String id, Class wizardClass) {
50: super (id);
51: this .wizardClass = wizardClass;
52: }
53:
54: /**
55: * @see org.apache.wicket.markup.html.link.Link#onClick()
56: */
57: public void onClick() {
58: setResponsePage(new WizardPage(wizardClass));
59: }
60: }
61:
62: /**
63: * Construct.
64: */
65: public Index() {
66: add(new WizardLink("staticWizardLink", StaticWizard.class));
67: add(new WizardLink("staticWizardWithPanelsLink",
68: StaticWizardWithPanels.class));
69: add(new WizardLink("newUserWizardLink", NewUserWizard.class));
70: }
71: }
|