org.cafesip.gwtcomp.client.ui
Class WizardPanel

java.lang.Object
  extended by com.google.gwt.user.client.ui.UIObject
      extended by com.google.gwt.user.client.ui.Widget
          extended by com.google.gwt.user.client.ui.Composite
              extended by org.cafesip.gwtcomp.client.ui.WizardPanel
All Implemented Interfaces:
com.google.gwt.user.client.EventListener

public class WizardPanel
extends com.google.gwt.user.client.ui.Composite

A panel for creating a wizard. When the user needs enter and submit a lot of information, it is often organized into many screens with next/previous/finish buttons. There are many well-known applications that use this concept of a wizard. The WizardPanel helps you create such widgets for your GWT application. It encompasses the common functions of a widget while allowing you the flexibility to add or remove standard stuff that you do not want in your wizard. Also, you can apply a common style to the wizard panel.

A standard wizard panel comes with a top-level title bar, a message bar, a button bar consisting of Next, Previous, Cancel and Finish buttons and a deck panel where your application can add sub-panels. You can add the data entry panels as sub-panels. Remember that all the bars and the panels are customizable. That is you can remove them, disable them, add new buttons, remove the standard buttons, etc. That is, it is completely flexible.

Examples:

CSS Style Rules:

Screen-Shots:


Nested Class Summary
 
Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject
com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled
 
Field Summary
 
Fields inherited from class com.google.gwt.user.client.ui.UIObject
DEBUG_ID_PREFIX
 
Constructor Summary
WizardPanel()
          A constructor for this class.
WizardPanel(java.lang.String action)
          A constructor for this class.
 
Method Summary
 void addPanel(java.lang.String name, com.google.gwt.user.client.ui.Panel panel)
          Add a panel to the wizard panel.
 void addPanel(java.lang.String name, com.google.gwt.user.client.ui.Panel panel, int atPosition)
          Inserts a panel to the "deck" at a given position.
 void addPanelListener(WizardPanelListener listener)
          Add a listener to listen to panel events.
 void displayNextPanel()
          Display the next panel.
 void displayPanel(java.lang.String name)
          Display a panel with the given name.
 void displayPreviousPanel()
          Display the previous panel.
 ButtonPanel getButtonPanel()
          Returns the button panel.
 com.google.gwt.user.client.ui.Button getCancelButton()
          Get the "Cancel" button.
 java.lang.String getDisplayedPanel()
          Returns the name of the currently-displayed panel.
 com.google.gwt.user.client.ui.Button getFinishButton()
          Get the "Finish" button.
 com.google.gwt.user.client.ui.FormPanel getFormPanel()
          Returns the form panel used as a base widget.
 MessageBar getMessageBar()
          Get the message bar.
 com.google.gwt.user.client.ui.Button getNextButton()
          Get the "Next" button.
 com.google.gwt.user.client.ui.DeckPanel getPanel()
          Get the deck panel.
 com.google.gwt.user.client.ui.Button getPreviousButton()
          Get the "Previous" button.
 TitleBar getTitleBar()
          Get the title bar.
 void removePanelListener(WizardPanelListener listener)
          Remove a listener
 
Methods inherited from class com.google.gwt.user.client.ui.Composite
getWidget, initWidget, isAttached, onAttach, onBrowserEvent, onDetach, setWidget
 
Methods inherited from class com.google.gwt.user.client.ui.Widget
doAttachChildren, doDetachChildren, getParent, onLoad, onUnload, removeFromParent
 
Methods inherited from class com.google.gwt.user.client.ui.UIObject
addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleElement, getStyleName, getStyleName, getStylePrimaryName, getStylePrimaryName, getTitle, isVisible, isVisible, onEnsureDebugId, removeStyleDependentName, removeStyleName, setElement, setElement, setHeight, setPixelSize, setSize, setStyleName, setStyleName, setStyleName, setStylePrimaryName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkEvents, toString, unsinkEvents
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WizardPanel

public WizardPanel(java.lang.String action)
A constructor for this class. Use this construction if the forms include a FileUpload widget.

Parameters:
action - the action to invoke on form submission

WizardPanel

public WizardPanel()
A constructor for this class. Use this construction if the forms do not include any FileUpload widget.

Method Detail

addPanelListener

public void addPanelListener(WizardPanelListener listener)
Add a listener to listen to panel events.

Parameters:
listener - the listener

removePanelListener

public void removePanelListener(WizardPanelListener listener)
Remove a listener

Parameters:
listener - listener to remove

getPreviousButton

public com.google.gwt.user.client.ui.Button getPreviousButton()
Get the "Previous" button. Allows you to control the appearance, enable/disable, etc. You must also add your own click listener to handle the click event. From the listener, you can call the displayPreviousPanel() method to go to the previous page.

Returns:
the previous button

getNextButton

public com.google.gwt.user.client.ui.Button getNextButton()
Get the "Next" button. Allows you to control the appearance, enable/disable, etc. You must also add your own click listener to handle the click event. From the listener, you can call the displayNextPanel() method to go to the next page.

Returns:
the next button

getFinishButton

public com.google.gwt.user.client.ui.Button getFinishButton()
Get the "Finish" button. Allows you to control the appearance, enable/disable, etc. You may want to add your own click listener to handle the Finish action.

Returns:
the finish button

getCancelButton

public com.google.gwt.user.client.ui.Button getCancelButton()
Get the "Cancel" button. Allows you to control the appearance, enable/disable, etc. You may want to add your own click listener to handle the Cancel action.

Returns:
the cancel button

getTitleBar

public TitleBar getTitleBar()
Get the title bar. Allows you to control the appearance, enable/disable, make invisible, etc.

Returns:
the title bar object

getMessageBar

public MessageBar getMessageBar()
Get the message bar. Allows you to control the appearance, enable/disable, make invisible, etc.

Returns:
the message bar object

addPanel

public void addPanel(java.lang.String name,
                     com.google.gwt.user.client.ui.Panel panel)
Add a panel to the wizard panel. One or more panels make up the data entry/information screen for the wizard. The panels are placed in a "deck" and only one of them may be visible at a time. The ordering is important since the wizard panel automatically handles the Next and Previous button actions.

Parameters:
name - name of the panel
panel - the panel itself.

addPanel

public void addPanel(java.lang.String name,
                     com.google.gwt.user.client.ui.Panel panel,
                     int atPosition)
Inserts a panel to the "deck" at a given position.

Parameters:
name - name of the panel
panel - the panel itself
atPosition - position at which the panel is inserted (starting with 0).

displayNextPanel

public void displayNextPanel()
Display the next panel.


displayPreviousPanel

public void displayPreviousPanel()
Display the previous panel.


displayPanel

public void displayPanel(java.lang.String name)
Display a panel with the given name. The first panel is not automatically displayed. So, you must call this after creating the panel object.

Parameters:
name - name of the panel.

getPanel

public com.google.gwt.user.client.ui.DeckPanel getPanel()
Get the deck panel. You can control the appearance, etc. although adding panels to the deck is not recommended. You should use the addPanel() methods for that purpose for things are not going to work.

Returns:
return the panel object

getDisplayedPanel

public java.lang.String getDisplayedPanel()
Returns the name of the currently-displayed panel.

Returns:
the name of the displayed panel

getButtonPanel

public ButtonPanel getButtonPanel()
Returns the button panel. You can control the appearance, add new buttons, remove buttons, etc.

Returns:
the button panel

getFormPanel

public com.google.gwt.user.client.ui.FormPanel getFormPanel()
Returns the form panel used as a base widget. You can control the appearance, etc. Note the use of the FormPanel as it allows you to have panels which include a file upload widget.

Returns:
the form panel


http://www.cafesip.org