001: /*
002: * Licensed to the Apache Software Foundation (ASF) under one or more
003: * contributor license agreements. See the NOTICE file distributed with
004: * this work for additional information regarding copyright ownership.
005: * The ASF licenses this file to You under the Apache License, Version 2.0
006: * (the "License"); you may not use this file except in compliance with
007: * the License. You may obtain a copy of the License at
008: *
009: * http://www.apache.org/licenses/LICENSE-2.0
010: *
011: * Unless required by applicable law or agreed to in writing, software
012: * distributed under the License is distributed on an "AS IS" BASIS,
013: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014: * See the License for the specific language governing permissions and
015: * limitations under the License.
016: */
017: package org.apache.wicket.examples.wizard;
018:
019: import org.apache.wicket.extensions.wizard.StaticContentStep;
020: import org.apache.wicket.extensions.wizard.Wizard;
021: import org.apache.wicket.extensions.wizard.WizardModel;
022: import org.apache.wicket.extensions.wizard.WizardStep;
023:
024: /**
025: * This is kind of the hello world example for wizards. It doesn't do anything
026: * useful, except displaying some static text and following static flow.
027: * <p>
028: * {@link StaticContentStep static content steps} are useful when you have some
029: * text to display that you don't want to define seperate panels for. E.g. when
030: * the contents come from a database, this is a convenient class to use.
031: * </p>
032: *
033: * @author Eelco Hillenius
034: */
035: public class StaticWizardWithPanels extends Wizard {
036:
037: /**
038: * The first step of this wizard.
039: */
040: private static final class Step1 extends WizardStep {
041: /**
042: * Construct.
043: */
044: public Step1() {
045: super ("One", "The first step");
046: }
047: }
048:
049: /**
050: * The second step of this wizard.
051: */
052: private static final class Step2 extends WizardStep {
053: /**
054: * Construct.
055: */
056: public Step2() {
057: super ("Two", "The second step");
058: }
059: }
060:
061: /**
062: * The third step of this wizard.
063: */
064: private static final class Step3 extends WizardStep {
065: /**
066: * Construct.
067: */
068: public Step3() {
069: super ("Three", "The third step");
070: }
071: }
072:
073: /**
074: * Construct.
075: *
076: * @param id
077: * The component id
078: */
079: public StaticWizardWithPanels(String id) {
080: super (id);
081:
082: // create a model with a couple of custom panels
083: // still not that spectacular, but at least it
084: // will give you a hint of how nice it is to
085: // be able to work with custom panels
086: WizardModel model = new WizardModel();
087: model.add(new Step1());
088: model.add(new Step2());
089: model.add(new Step3());
090:
091: // initialize the wizard
092: init(model);
093: }
094:
095: /**
096: * @see org.apache.wicket.extensions.wizard.Wizard#onCancel()
097: */
098: public void onCancel() {
099: setResponsePage(Index.class);
100: }
101:
102: /**
103: * @see org.apache.wicket.extensions.wizard.Wizard#onFinish()
104: */
105: public void onFinish() {
106: setResponsePage(Index.class);
107: }
108: }
|