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 */ 017package org.apache.wicket.extensions.wizard.dynamic; 018 019import org.apache.wicket.extensions.wizard.IWizardModel; 020import org.apache.wicket.extensions.wizard.IWizardStep; 021 022/** 023 * Wizard step that is intelligent enough to know how to navigate to the next and previous steps. 024 * Using such steps, you can build wizard that consists of steps that are linked on the fly rather 025 * than in a static, pre-determined fashion. The basic idea here is that the wizard step takes over 026 * much of what otherwise would be done by the wizard model. You trade simplicity for flexibility. 027 * 028 * <p> 029 * Warning: only use these steps with the {@link DynamicWizardModel}. 030 * </p> 031 * 032 * @author eelcohillenius 033 */ 034public interface IDynamicWizardStep extends IWizardStep 035{ 036 /** 037 * Gets whether this is the last step in the wizard. 038 * 039 * @return True if its the final step in the wizard, false otherwise. 040 * 041 * @see IWizardModel#isLastStep(IWizardStep) 042 */ 043 boolean isLastStep(); 044 045 /** 046 * Gets whether the previous button should be enabled. 047 * 048 * @return True if the previous button should be enabled, false otherwise. 049 * 050 * @see IWizardModel#isPreviousAvailable() 051 */ 052 boolean isPreviousAvailable(); 053 054 /** 055 * Gets the previous wizard step from here. Can only be called when 056 * {@link #isPreviousAvailable()} returns true. 057 * 058 * @return The next wizard step. May not be null unless this is the first step (in which case it 059 * should never be called). 060 */ 061 IDynamicWizardStep previous(); 062 063 /** 064 * Gets whether the next button should be enabled. 065 * 066 * @return True if the next button should be enabled, false otherwise. 067 * 068 * @see IWizardModel#isNextAvailable() 069 */ 070 boolean isNextAvailable(); 071 072 /** 073 * Gets the next wizard step from here. Can only be called when {@link #isNextAvailable()} 074 * returns true. 075 * 076 * @return The next wizard step. May not be null unless this is the last step ( 077 * {@link #isLastStep()} returns true). 078 */ 079 IDynamicWizardStep next(); 080 081 /** 082 * Checks if the last button should be enabled. 083 * 084 * @return <tt>true</tt> if the last button should be enabled, <tt>false</tt> otherwise. 085 * 086 * @see IWizardModel#isLastAvailable() 087 */ 088 boolean isLastAvailable(); 089 090 /** 091 * Gets the next wizard step from here. Can only be called when 092 * {@link DynamicWizardModel#isLastAvailable()} returns true. 093 * 094 * @return The next wizard step. May not be null. 095 */ 096 IDynamicWizardStep last(); 097 098 /** 099 * Gets whether the finish button should be enabled. 100 * 101 * @return True if the finish button should be enabled, false otherwise. 102 * 103 * @see IWizardModel#isFinishAvailable() 104 */ 105 default boolean isFinishAvailable() { 106 return isLastStep(); 107 } 108}