All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.wizards.core.WizardComponent

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----java.awt.Panel
                           |
                           +----com.sun.wizards.core.WizardComponent

public abstract class WizardComponent
extends Panel
WizardComponent defines the interface and implements default behavior common to all classes in the client Wizard tree. The Wizard tree consists of panels that define the user experience of the wizard.

The wizard client panel tree consists of an arrangement of panels (subclassed from WizardLeaf) and nodes (subclassed from WizardComposite). The arrangement of the tree determines the order in which the panels will be visited by the wizard. Nodes can affect the traversal of the panels, which allows advanced panels to be skipped for users that do not wish to use them.

"Component" was chosen as a name for this class from the book "Design Patterns".


Variable Index

 o cancelDirection
The cancel direction is a flag that indicates whether a cancel operation from this panel should traverse backward (false) or forward (true). Deprecated.
 o name
The name of this wizard component. Deprecated.
 o parent
This is the parent of this WizardComponent. Deprecated.
 o route
This is the route object of this WizardComponent. Deprecated.
 o wizardManager
The wizard manager is responsible for creation, display, and navigation of the wizard tree. Deprecated.

Constructor Index

 o WizardComponent()
Creates a WizardComponent with a route to the root of the server object tree.
 o WizardComponent(String, Route, WizardTreeManager)
Creates a WizardComponent with the specified name, the specified route and wizard manager.
 o WizardComponent(WizardState, String)
Creates a WizardComponent with the specified name.

Method Index

 o abortDisplay()
This method is called when this WizardComponent is being displayed, and the user presses the "back" button.
 o addCriticalStateKeys(Vector)
This method declares which wizard state keys get filled with data by this Wizard Component.
 o addRuntimeResources(Vector)
Get the runtime classes required by this WizardComposite.
 o beginDisplay()
This method is called when the WizardComponent is displayed.
 o callback(String, String)
Used in CLI Mode for imediate validations of data
 o cancel()
Cancel this panel.
 o consoleInteraction()
This method is called during non-graphical execution (i.e.
 o createObject(String, Class[], Object[])
Create an object through reflection.
 o createUI()
This method creates the user interface.
 o deserialize(DataInput)
Deserialize this WizardComponent from the specified input stream.
 o displayQuery(Object, String, String, String[], String[])
Display a query to the user.
 o getCancelDirection()
Returns the cancel direction.
 o getCancelMessage()
Returns the cancel message. Deprecated.
 o getChild(String)
This is the default implementation of getChild.
 o getName()
Gets the current name of this WizardComponent.
 o getNextChild(WizardComponent)
Get the child that follows the specified child in the WizardComponent tree.
 o getParentComponent()
Gets the parent of this WizardComponent.
 o getPreviousChild(WizardComponent)
Get the child that precedes the specified child in the WizardComponent tree.
 o getRootComponent()
Get the root of the WizardComponent tree.
 o getRoute()
Get the route object that directs messages to the correct WizardState.
 o getRoute(Route)
Get the client side route for this WizardComponent.
 o getTreeManager()
Returns the WizardTreeManager controling the client panel tree.
 o getWizardComponent(Route)
Get the WizardComponent specified by the given route object.
 o isDisplayComplete()
Returns true if this WizardComponent is finished displaying.
 o isFirst()
Returns true if this is the first leaf in the tree.
 o isLast()
Returns true if this is the last leaf in the tree.
 o next()
Get the next WizardComponent in the tree.
 o previous()
Get the previous WizardComponent in the tree.
 o reset(Object)
Reset this component, given the specified information.
 o saveWizardTree(DataOutput)
Save the wizard tree.
 o serialize(DataOutput)
Serialize this WizardComponent to the specified output stream.
 o setCancelDirection(boolean)
Sets the cancel direction.
 o setName(String)
Sets the name of this WizardComponent to the specified name.
 o setParentComponent(WizardComponent)
Sets the parent of this WizardComponent.
 o setRoute(Route)
Set the route to the server-side WizardState.
 o skip()
This method returns true if this WizardComponent wants to be skipped during traversal of this tree.

Variables

 o parent
 protected WizardComponent parent
Note: parent is deprecated.

This is the parent of this WizardComponent. This helps provide a tree in which a child in the tree knows who its parent is.

 o wizardManager
 protected WizardTreeManager wizardManager
Note: wizardManager is deprecated.

The wizard manager is responsible for creation, display, and navigation of the wizard tree. It is also responsible for sending messages to the server.

 o route
 protected Route route
Note: route is deprecated.

This is the route object of this WizardComponent. The route object can route messages from an element in the wizard tree to the appropriate object on the server.

 o name
 protected String name
Note: name is deprecated.

The name of this wizard component. For siblings, it is important that each sibling has a unique name.

 o cancelDirection
 protected boolean cancelDirection
Note: cancelDirection is deprecated.

The cancel direction is a flag that indicates whether a cancel operation from this panel should traverse backward (false) or forward (true).

Constructors

 o WizardComponent
 public WizardComponent()
Creates a WizardComponent with a route to the root of the server object tree.

 o WizardComponent
 public WizardComponent(WizardState wizardState,
                        String name)
Creates a WizardComponent with the specified name.

Parameters:
wizardState - The buildtime WizardState.
name - The name for this WizardComponent.
 o WizardComponent
 public WizardComponent(String name,
                        Route route,
                        WizardTreeManager wizardManager)
Creates a WizardComponent with the specified name, the specified route and wizard manager.

Parameters:
name - The name for this WizardComponent.
route - The route to the appropriate server side object.
wizardManager - The wizardManager responsible for this component.

Methods

 o setName
 public void setName(String name)
Sets the name of this WizardComponent to the specified name.

Parameters:
name - The new name for this WizardComponent.
Overrides:
setName in class Component
 o getName
 public String getName()
Gets the current name of this WizardComponent.

Returns:
The current name.
Overrides:
getName in class Component
 o getChild
 public WizardComponent getChild(String childName)
This is the default implementation of getChild. WizardComposite overrides this method to return a child. This default implementation can be used directly for the WizardLeaf object.

Parameters:
childName - The name of the child to retrieve.
Returns:
The requested child, or null if the child does not exist.
 o getParentComponent
 public WizardComponent getParentComponent()
Gets the parent of this WizardComponent.

Returns:
The parent.
 o setParentComponent
 public void setParentComponent(WizardComponent parent)
Sets the parent of this WizardComponent.

Parameters:
parent - The new parent of this WizardComponent.
 o getTreeManager
 protected WizardTreeManager getTreeManager()
Returns the WizardTreeManager controling the client panel tree.

 o setRoute
 public void setRoute(Route route)
Set the route to the server-side WizardState.

Parameters:
route - The new server route.
 o getRoute
 public Route getRoute()
Get the route object that directs messages to the correct WizardState.

Returns:
The route to the server.
 o getRoute
 public Route getRoute(Route routeInProgress)
Get the client side route for this WizardComponent.

Parameters:
routeInProgress - This method should be called with routeInProgress = null.
Returns:
The route for this WizardComponent.
 o getRootComponent
 public WizardComponent getRootComponent()
Get the root of the WizardComponent tree.

Returns:
The root of the WizardComponent tree.
 o skip
 public boolean skip()
This method returns true if this WizardComponent wants to be skipped during traversal of this tree.

Returns:
true if this object wants to be skipped in the traversal of the tree. false otherwise.
 o beginDisplay
 public void beginDisplay()
This method is called when the WizardComponent is displayed.

 o abortDisplay
 public void abortDisplay()
This method is called when this WizardComponent is being displayed, and the user presses the "back" button. This method provides an opportunity for this WizardComponent to do cleanup before exiting. This method is used when the user presses the "back" button, and the isDisplayComplete method is used when the user presses the "next" button.

 o createUI
 public void createUI()
This method creates the user interface.

 o consoleInteraction
 public void consoleInteraction()
This method is called during non-graphical execution (i.e. the wizard was launched with the -nodisplay command-line option.) In this method, subclasses should interact with the console (System.in and System.out) to collect the same information that the component needs. Note that the information collected should be saved in the same way as the isDisplayComplete() and abortDisplay() methods expect it.

For example: suppose the graphical version of this component presents the user with a CheckBoxGroup, the user makes a selection, and the result is examined in the isDisplayComplete() method by using the getSelectedCheckBox() API from java.awt.CheckBoxGroup. To do this same thing using this method, it should prompt the user with the same strings as used in the graphical version, and set the selections into the checkBoxGroup when the user supplies the information (by using the setSelectedCheckBox() based on user input). In this way, the code already written for isDisplayComplete() does not have to be modified.

 o callback
 public boolean callback(String result,
                         String id)
Used in CLI Mode for imediate validations of data

Parameters:
result - The result of the call that caused the callback.
id - An identifier, for use by the callee during the callback.
Returns:
Whether the result is valid. Subclasses should use this method to validate data that is entered by the user for a particular query, rather than validating ALL data on the panel at once. This method returns false by default.
 o displayQuery
 public void displayQuery(Object target,
                          String title,
                          String message,
                          String buttons[],
                          String methods[])
Display a query to the user. When a selection is made, the corresponding method will be called on the target.

Parameters:
target - The object to call when a selection from the dialog is made.
title - A small title for this query.
message - The message to be displayed to the user.
buttons - The buttons (button labels) offered to the user to select from.
methods - A list of methods (in the same order as the list of buttons) that will be called when a dialog selection is made.
 o isDisplayComplete
 public boolean isDisplayComplete()
Returns true if this WizardComponent is finished displaying. This method can be used to verify user input.

Returns:
true if the display of this WizardComponent is complete; false otherwise.
 o getNextChild
 protected abstract WizardComponent getNextChild(WizardComponent currentChild)
Get the child that follows the specified child in the WizardComponent tree. Applications should use next.

Parameters:
currentChild - The child in the tree that comes before the desired sibling.
Returns:
The next child in the tree.
 o next
 public abstract WizardComponent next()
Get the next WizardComponent in the tree.

Returns:
The next child in the tree.
 o getPreviousChild
 protected abstract WizardComponent getPreviousChild(WizardComponent currentChild)
Get the child that precedes the specified child in the WizardComponent tree. Applications should use previous.

Parameters:
currentChild - The child in the tree that comes after the desired sibling.
Returns:
The previous child in the tree.
 o previous
 public abstract WizardComponent previous()
Get the previous WizardComponent in the tree.

Returns:
The previous child in the tree.
 o isFirst
 public boolean isFirst()
Returns true if this is the first leaf in the tree.

Returns:
true if this is the first leaf in the tree. false otherwise.
 o isLast
 public boolean isLast()
Returns true if this is the last leaf in the tree.

Returns:
true if this is the last leaf in the tree. false otherwise.
 o saveWizardTree
 public void saveWizardTree(DataOutput out)
Save the wizard tree. This method is used by wizard builders to create a wizard archive containing a client tree. This method should only be called on the root of the client tree.

Parameters:
out - The output stream to which the wizard tree should be written.
 o serialize
 protected void serialize(DataOutput out)
Serialize this WizardComponent to the specified output stream. This method does not save its children.

Parameters:
out - The output stream to which this WizardComponent will be serialized.
See Also:
serializeChildren
 o deserialize
 protected void deserialize(DataInput in)
Deserialize this WizardComponent from the specified input stream. This method does not deserialize its children.

Parameters:
in - The input stream from which this WizardComponent will be deserialized.
See Also:
deserializeChildren
 o createObject
 public Object createObject(String classname,
                            Class argTypes[],
                            Object args[])
Create an object through reflection.

Parameters:
classname - The class name of the object to create.
argTypes - The paramater list identifying the correct constructor.
args - The arguments to pass to the constructor.
Returns:
The created object.
 o getWizardComponent
 public WizardComponent getWizardComponent(Route route)
Get the WizardComponent specified by the given route object.

Parameters:
route - The route specifying the desired WizardComponent.
Returns:
The desired WizardComponent, or null if the WizardComponent does not exist.
 o reset
 public void reset(Object info)
Reset this component, given the specified information. This method may be called when a user backtracks in the client wizard tree and changes a fundamental setting. The panel that enabled the modification might traverse subsequent panels and call this method resynchronize all panels with the user's choice.

Parameters:
info - The information required to perform a reset.
 o getCancelDirection
 public boolean getCancelDirection()
Returns the cancel direction. The cancel direction determines whether cancel would visit the previous panel or the following panel. This method returns false if cancel should visit the previous panel, or true if cancel should visit the next panel.

Returns:
The direction within the client wizard tree that a cancel operation should traverse.
 o setCancelDirection
 public void setCancelDirection(boolean cancelDirection)
Sets the cancel direction. The cancel direction determines whether cancel would visit the previous panel or the following panel.

Parameters:
cancelDirection - If true, cancel will cause the next panel to be visited. False causes the previous panel to be visited.
 o getCancelMessage
 public String getCancelMessage()
Note: getCancelMessage() is deprecated. You should Set the cancel message using a localizable resource and the setCancelMsg() method in ArchiveWriter. To set a runtime cancel message from a panel, set it into the WizardState.

Returns the cancel message.

Returns:
A String representing the message to be displayed when a user clicks "cancel".
See Also:
setCancelMsg, Msg
 o cancel
 public WizardComponent cancel()
Cancel this panel. This method is only called after the cancel operation is confirmed by the user.

Returns:
The client panel that should be displayed after the cancel operation.
 o addCriticalStateKeys
 public void addCriticalStateKeys(Vector keys)
This method declares which wizard state keys get filled with data by this Wizard Component. During statefile creation, these keys are written out to the statefile. and can be used with a statefile to set the default settings in subsequent executions of the wizard.

Parameters:
wizardStateKeys - The vector holding the wizard state keys.
 o addRuntimeResources
 public void addRuntimeResources(Vector resourceVector)
Get the runtime classes required by this WizardComposite.

Parameters:
resourceVector - The vector containing resources that this method will add to.

All Packages  Class Hierarchy  This Package  Previous  Next  Index