Class Wizard

All Implemented Interfaces:
Animatable<Wizard>, CanDrop<Wizard>, Clickable<Wizard>, Draggable<Wizard>, HandleMouseEvents<Wizard>, Touchable<Wizard>

Wizard component

The component leads the user through a process consisting of multiple steps using a series of settngs. The wizard is capable of handling an arbitrary number of steps. You can define an icon, a title and a description for every step. These indicate the progress in the component header. You can track the current step status and the status of each step.

The component enables you to handle the step initialization, enter and exit events. It also handles the events next step, previous step and finish. You have the possibility to disable the individual steps which keeps the user at the specific step until the required data is entered.

Each step is added to the component as a standalone component by using the addStep(WizardStep) component. You can implement a step by instantiating and building the WizardStep. You can add any sort of component to the steps, so that each step has a custom appearance.

Supported events:

AnimationStart AnimationEnd, Click, DoubleClick, MouseDown, MouseDown, MouseLeave, MouseMove, MouseOver, MouseOut, MouseUp, Wheel, TouchCancel, TouchEnd, TouchMove, TouchStart, Drop, DragStart, DragEnd FinishHandler

Since:
4.0
Author:
JBStrap
See Also:
  • Constructor Details

    • Wizard

      public Wizard()
      Creates an empty Wizard component.
    • Wizard

      public Wizard(String language)
      Creates an empty Wizard component according to the specified language code.
      Parameters:
      language - Language code according to which the component is created. If not specified or null is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
    • Wizard

      public Wizard(String id, String language)
      Creates an empty Wizard component according to the specified language code.
      Parameters:
      id - The component ID. The ID specified here will appear in the HTML tag as an ID attribute. If there are multiple components displayed, that have the same ID, the ID numbers will be numbered, in the order they are displayed. (For example, if the ID is 'COMPONENT' then it will be numbered like this: COMPONENT, COMPONENT_1, COMPONENT_2 etc.)
      language - Language code according to which the component is created. If not specified or null is set, the framework’s default language code is used. The default language of the framework is set via the JBStrap parameter JBStrapParamType.DEFAULT_LANGUAGE.
  • Method Details

    • addStep

      public final Wizard addStep(WizardStep step)
      Adds a step to the wizard component.
      Parameters:
      step - Wizard step instance to be added
      Returns:
      Wizard component
      Throws:
      NullPointerException - Thrown if the specified step is null
    • addSteps

      public final Wizard addSteps(WizardStep... steps)
      Adds multiple steps to the grid.
      Parameters:
      steps - An enumeration of wizard steps to be added Steps are added to the wizard in the order the enumeration
      Returns:
      Wizard component
      Throws:
      NullPointerException - Thrown if there is a step within the enumeration that is null
    • getStepByIndex

      public final WizardStep getStepByIndex(int index)
      Gets a wizard step by its index. Start index is 0.
      Parameters:
      index - Step index
      Returns:
      Step identified by the specified index or null if there is no step in the wizard component with the specified index
    • afterDraw

      public void afterDraw()
      Description copied from class: Component
      The operations to be executed after the drawing of the component

      By default, this is an empty method. It has to be overwritten on a component or page if additional operations have to be executed after the drawing process. One such operation is data retrieval, which shouldn't run in constructors so that the user could see results of an operation or navigation process.

      Overrides:
      afterDraw in class Component<Wizard>
    • back

      public final Wizard back()

      Steps back the wizard component.

      The method steps back the wizard component from the current step. When stepping back, the current step’s StepBackHandler is called. If the handler returns true, the framework looks for the previous enabled step and makes it the current one.

      Returns:
      Wizard component
      Throws:
      IllegalArgumentException - Thrown if no enabled steps precedes the enabled step in the wizard component
    • next

      public final Wizard next()

      Steps forward the wizard component.

      The method steps forward the wizard component from the current step. When stepping forward, the current step’s StepNextHandler is called. If the handler returns true, the next enabled step is determined. If there are no enabled steps after the current one, the wizard finishes and the WizardFinishHandler is called.

      Returns:
      Wizard component
    • setStep

      public final Wizard setStep(int index)
      The step with the specified index receives focus.
      Parameters:
      index - Step index
      Returns:
      Wizard component
      Throws:
      IllegalArgumentException - Thrown if the step with the specified index is disabled
      NullPointerException - Thrown if there is no step by the specified index in the wizard component
    • setStep

      public final Wizard setStep(String name)
      The step with the specified name receives focus.
      Parameters:
      name - Step name
      Returns:
      Wizard component
      Throws:
      NullPointerException - Thrown if there is no step with the specified index in the wizard component
      IllegalArgumentException - Thrown if the step with the specified name is disabled
    • reset

      public final Wizard reset()
      Resets the wizard component.
      Returns:
      Wizard component
    • setFinishHandler

      public Wizard setFinishHandler(WizardFinishHandler handler)
      Event handler for the wizard finished event.
      Parameters:
      handler - Event handler implementation for wizard finished event
      Returns:
      Wizard component
    • getFinishHandler

      public final WizardFinishHandler getFinishHandler()
      Gets the event handler for the wizard finished event.
      Returns:
      An instance of the event handler for the wizard finished event or null if there is no event handler set for the event
    • getCurrentStep

      public final WizardStep getCurrentStep()
      Gets the wizard component’s current step.
      Returns:
      An instance of the current step or null if there are no steps in the component
    • getSteps

      public Collection<WizardStep> getSteps()
      Gets all steps of the wizard component.
      Returns:
      All steps of the wizard component in a collection or null if there are no steps in the component
    • getFooter

      public Wizard.WizardFooter getFooter()
      Gets the wizard component’s footer.
      Returns:
      Footer for the wizard component
      See Also:
    • writeHTML

      public boolean writeHTML(StringWriter writer)
      Description copied from class: Component
      Creates the component's HTML equivalent

      This method doesn't need to be used during application development. This method is used when developing a custom component. When creating a custom component, this method needs to be implemented. In the parameter (StringWriter class) the component's HTML equivalent must be specified, and the method has to return with a Boolean value. This boolean value determines if the component was drawn. If the user doesn't have access right to the component, or if the component couldn't be drawn, it should return with false. Otherwise, it must return with true.

      Specified by:
      writeHTML in class Component<Wizard>
      Returns:
      If the componentwas drawn, true, otherwise false
    • setButtonState

      protected void setButtonState()