All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.wizards.core.WizardTreeManager

java.lang.Object
   |
   +----com.sun.wizards.core.WizardTreeManager

public class WizardTreeManager
extends Object
implements ActionListener, Runnable
The WizardTreeManager class manages the creation and navigation of a wizard tree.

The WizardTreeManager is the core of the wizard client classes. Each WizardComponent wizard panel maintains a reference to the WizardTreeManager, and uses it to call methods on the wizard server. All wizard archive resources are available to the client objects through the WizardTreeManager.

The WizardTreeManager communicates with the root WizardState object either directly (in the case of a wizard running locally), or through RMI (in the case of a wizard running remotely).


Variable Index

 o BACK_BUTTON
A value identifying the back button.
 o CANCEL_BUTTON
A value identifying the cancel button.
 o EXIT_BUTTON
A value identifying the exit button.
 o NEXT_BUTTON
A value identifying the next button.

Constructor Index

 o WizardTreeManager(AppConsole, WizardState)
Creates a WizardTreeManager object with the specified WizardState.

Method Index

 o actionPerformed(ActionEvent)
Implementation of the ActionListener interface.
 o addInitializationListener(InitializationListener)
Add an initialization listener.
 o backButtonPressed()
Invoked when the back button has been pressed.
 o callClientObjectMethod(Route, String, String[], Object[])
Call a method on the client.
 o callObjectMethod(Object, String, String[], Object[])
Call an object method through reflection.
 o callServerObjectMethod(Route, String, String[], Object[])
Call a method on the server.
 o cancelButtonPressed()
Invoked when the cancel button has been pressed.
 o cancelConfirmed()
Invoked when the cancel operation is confirmed by the user.
 o continueConfirmed()
Invoked when the continue operation is confirmed by the user.
 o createBaselinePanel()
Creates the wizard's baseline panel.
 o createImagePanel()
Creates the image panel.
 o createNavigationPanel()
Creates the navigation panel.
 o createObject(String, Class[], Object[])
Create an object through reflection.
 o createSubTree(Route, String)
Create a subtree with the specified name and the specified route to a server side object.
 o createWizardPanel()
Creates the wizard panel.
 o displayCorrectButtons()
Set the visibility of the buttons requested by the currently displayed panel.
 o displayQuery(Object, String, String, String[], String[])
Display a query to the user.
 o displayQuery(Object, String, String[], String[])
Display a query to the user.
 o doReboot()
Invoked when the reboot operation is confirmed by the user.
 o exit(int)
Exits the server and client VMs with the specified exit code.
 o exitButtonPressed()
Invoked when the exit button has been pressed.
 o exitConfirmed()
Invoked when the exit operation is confirmed by the user.
 o getBaselineImage()
Get the baseline image shown on the left
 o getBaselinePanel()
Returns the baseline panel created through a call to createBaselinePanel
 o getCurrentPanel()
Returns the current wizard panel.
 o getFirstComponent()
Get the first component in this wizard
 o getImage()
Get the main image shown on the left
 o getImage(Route, String)
This method gets the specified image from the archive identified by the specified route.
 o getImagePanel()
Returns the image panel created through a call to createImagePanel
 o getNamedResource(Route, String, String)
This method returns the bytes of the named resource of the specified type.
 o getNavigationPanel()
Returns the navigation panel created through a call to createNavigationPanel.
 o getWizardInitState()
Returns the state of the WizardState.
 o getWizardPanel()
Returns the wizard panel created through a call to createWizardPanel.
 o getWizardSize()
Gets the size of the wizard frame.
 o getWizardState()
Gets the WizardState for this wizard.
 o hasConsole()
Returns true if this Iterator object has a text console that can display text and return user text input.
 o hasGUI()
Returns true if this AppConsole object has a gui that can display images.
 o initialize()
This method should be called when the window containing the wizard tree is opened.
 o isTraversingForward()
Says whether we are currently traversing forward or not.
 o nextButtonPressed()
Invoked when the next button has been pressed.
 o removeInitializationListener(InitializationListener)
Remove the specified initialization listener from the notification list.
 o run()
Display the buttons when the WizardState has initialized.
 o setBaselineImage(String)
Set the baseline image shown on the left
 o setButtonEnabled(String, boolean)
Enables or disables the navigation button specified by the button's function.
 o setButtonLabel(String, String)
Change the label of the specified navigation button.
 o setFrameTitle(String)
Sets the title of the window comtaining the wizard.
 o setIconImage(Image)
Set the icon image of the wizard frame.
 o setImage(String)
Set the main image shown on the left
 o setWizardSize(Dimension)
Sets the size of the wizard frame.
 o setWizardState(WizardState)
Sets the Wizard State that controls this wizard.
 o warpToLeaf(WizardComponent)
Visits the specified WizardComponent.

Variables

 o BACK_BUTTON
 public static int BACK_BUTTON
A value identifying the back button.

 o NEXT_BUTTON
 public static int NEXT_BUTTON
A value identifying the next button.

 o CANCEL_BUTTON
 public static int CANCEL_BUTTON
A value identifying the cancel button.

 o EXIT_BUTTON
 public static int EXIT_BUTTON
A value identifying the exit button.

Constructors

 o WizardTreeManager
 public WizardTreeManager(AppConsole appConsole,
                          WizardState wizardState)
Creates a WizardTreeManager object with the specified WizardState. The WizardState will facilitate reading the wizard archive.

Parameters:
appConsole - The application console that this wizard manager resides within.
wizardState - The WizardState object responsible for getting client information from the wizard archive.

Methods

 o hasGUI
 public boolean hasGUI()
Returns true if this AppConsole object has a gui that can display images.

 o hasConsole
 public boolean hasConsole()
Returns true if this Iterator object has a text console that can display text and return user text input.

 o getFirstComponent
 public WizardComponent getFirstComponent()
Get the first component in this wizard

 o run
 public void run()
Display the buttons when the WizardState has initialized.

 o isTraversingForward
 public boolean isTraversingForward()
Says whether we are currently traversing forward or not.

Returns:
true if we arrived at the current panel by pressing a "next" method.
 o setImage
 public void setImage(String imageName)
Set the main image shown on the left

Parameters:
imageName - The name of the image to use, in wizard resource form
 o setBaselineImage
 public void setBaselineImage(String baselineImageName)
Set the baseline image shown on the left

Parameters:
baselineImageName - The name of the image to use, in wizard resource form.
 o getImage
 public String getImage()
Get the main image shown on the left

Returns:
The name of the image to use, in wizard resource form
 o getBaselineImage
 public String getBaselineImage()
Get the baseline image shown on the left

Returns:
baselineImageName The name of the image to use, in wizard resource form.
 o setIconImage
 public void setIconImage(Image icon)
Set the icon image of the wizard frame.

Parameters:
icon - The icon image to be displayed.
 o setWizardSize
 public void setWizardSize(Dimension size)
Sets the size of the wizard frame.

Parameters:
size - The new size for the wizard frame.
 o getWizardSize
 public Dimension getWizardSize()
Gets the size of the wizard frame.

Returns:
The current size of the wizard.
 o setWizardState
 public void setWizardState(WizardState state)
Sets the Wizard State that controls this wizard. Use with caution! This replaces the only connection the client has with the server. All subsequent calls to the server-side wizard state will be routed to this new wizard state.

Parameters:
state - The new state to install for this tree.
 o getWizardState
 public WizardState getWizardState()
Gets the WizardState for this wizard.

Returns:
The current WizardState controlling this wizard.
 o createWizardPanel
 protected void createWizardPanel()
Creates the wizard panel. The wizard panel is the container in which the wizard client tree will be displayed. This method also creates the client tree.

 o createNavigationPanel
 protected void createNavigationPanel()
Creates the navigation panel. The navigation panel is a panel that provides buttons with which a user will navigate the wizard client tree.

 o createImagePanel
 protected void createImagePanel()
Creates the image panel. The image panel is the panel that displays the wizard image.

 o createBaselinePanel
 protected void createBaselinePanel()
Creates the wizard's baseline panel. This panel is the panel that displays the wizard's baseline name image.

 o getWizardPanel
 public Panel getWizardPanel()
Returns the wizard panel created through a call to createWizardPanel.

Returns:
The wizard panel.
 o getNavigationPanel
 public Panel getNavigationPanel()
Returns the navigation panel created through a call to createNavigationPanel.

Returns:
The navigation panel.
 o getImagePanel
 public Panel getImagePanel()
Returns the image panel created through a call to createImagePanel

Returns:
The image panel.
 o getBaselinePanel
 public Panel getBaselinePanel()
Returns the baseline panel created through a call to createBaselinePanel

Returns:
The image panel.
 o setFrameTitle
 public void setFrameTitle(String title)
Sets the title of the window comtaining the wizard. Calls setTitle() of the java.awt.Frame.

Parameters:
title - The new title of the Frame.
 o initialize
 public void initialize()
This method should be called when the window containing the wizard tree is opened. This method is responsible for loading images and initialization of components.

 o createSubTree
 public WizardComposite createSubTree(Route route,
                                      String subtreeName)
Create a subtree with the specified name and the specified route to a server side object.

Parameters:
route - The route to the correct server side object.
subtreeName - The name of the desired subtree. If this is set to null, the entire wizard tree is created.
Returns:
The desired tree, or null if the requested tree has not been written into the wizard archive.
 o getNamedResource
 public byte[] getNamedResource(Route route,
                                String type,
                                String name)
This method returns the bytes of the named resource of the specified type.

Parameters:
route - The route to the correct WizardState to resolve the desired resource.
type - The type of resource.
name - The name of the resource.
Returns:
The byte array representing the requested resource.
 o getImage
 public Image getImage(Route route,
                       String name)
This method gets the specified image from the archive identified by the specified route.

Parameters:
route - The route to the correct archive.
name - The name of the desired image.
Returns:
The desired image, or null if the image does not exist in the archive.
 o getCurrentPanel
 public WizardComponent getCurrentPanel()
Returns the current wizard panel. The current panel is the wizard panel currently being displayed by the IteratorLayout.

Returns:
The wizard panel currently being displayed.
 o backButtonPressed
 public synchronized void backButtonPressed()
Invoked when the back button has been pressed.

 o nextButtonPressed
 public synchronized void nextButtonPressed()
Invoked when the next button has been pressed.

 o warpToLeaf
 public synchronized void warpToLeaf(WizardComponent newLeaf)
Visits the specified WizardComponent.

Parameters:
newLeaf - The leaf to visit.
 o cancelButtonPressed
 public synchronized void cancelButtonPressed()
Invoked when the cancel button has been pressed.

 o exitButtonPressed
 public synchronized void exitButtonPressed()
Invoked when the exit button has been pressed.

 o exitConfirmed
 public void exitConfirmed()
Invoked when the exit operation is confirmed by the user.

 o exit
 public void exit(int exitStatus)
Exits the server and client VMs with the specified exit code.

Parameters:
exitStatus - The exit code.
 o doReboot
 public void doReboot()
Invoked when the reboot operation is confirmed by the user.

 o cancelConfirmed
 public void cancelConfirmed()
Invoked when the cancel operation is confirmed by the user.

 o continueConfirmed
 public void continueConfirmed()
Invoked when the continue operation is confirmed by the user.

 o actionPerformed
 public void actionPerformed(ActionEvent e)
Implementation of the ActionListener interface. This method is called when any of the navigation buttons are pressed, and dispatches that event to the appropriate method.

 o displayCorrectButtons
 public void displayCorrectButtons()
Set the visibility of the buttons requested by the currently displayed panel. The button visibility is set by the button mask returned from the current panel.

See Also:
getButtonMask
 o setButtonLabel
 public String setButtonLabel(String buttonFunction,
                              String newLabel)
Change the label of the specified navigation button.

Parameters:
buttonFunction - A string representation of the function the button performs. i.e. "Next" for the next button.
newLabel - The new label for the specified button.
Returns:
The current button label.
 o setButtonEnabled
 public void setButtonEnabled(String buttonFunction,
                              boolean b)
Enables or disables the navigation button specified by the button's function.

Parameters:
buttonFunction - A string representation of the function the button performs. i.e. "Next" for the next button.
b - If true, this button is enabled; otherwise, this button is disabled.
 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.
message - The message to be displayed to the user.
title - The title of the query window, or the title shown to the user in CLI mode.
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 displayQuery
 public void displayQuery(Object target,
                          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.
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 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 callClientObjectMethod
 public Object callClientObjectMethod(Route route,
                                      String methodName,
                                      String argTypes[],
                                      Object args[])
Call a method on the client. The method is sent to the correct object in the Wizard client tree via the specified route object.

Parameters:
route - The route to the desired client object.
methodName - The name of the method to call.
argTypes - The parameter list identifying the correct method.
args - The parameters to pass to the method.
Returns:
The method return value.
 o getWizardInitState
 public int getWizardInitState()
Returns the state of the WizardState. This state is represented as a bit mask in which each bit represents a single step in the WizardState initialization. The mask values have defininitions within the Def object.

 o callServerObjectMethod
 public Object callServerObjectMethod(Route route,
                                      String methodName,
                                      String argTypes[],
                                      Object args[])
Call a method on the server. The method is sent to the correct object in the WizardState tree via the specified route object.

Parameters:
route - The route to the desired server object.
methodName - The name of the method to call.
argTypes - The parameter list identifying the correct method.
args - The parameters to pass to the method.
Returns:
The method return value.
 o callObjectMethod
 public Object callObjectMethod(Object target,
                                String methodName,
                                String argTypes[],
                                Object args[])
Call an object method through reflection.

Parameters:
target - The object to call the method on.
methodName - The name of the method to call.
argTypes - The parameter list identifying the correct method.
args - The parameters to pass to the method.
Returns:
The method return value.
 o addInitializationListener
 public void addInitializationListener(InitializationListener listener)
Add an initialization listener.

Parameters:
listener - The listener to add for notification of initialization events.
 o removeInitializationListener
 public void removeInitializationListener(InitializationListener listener)
Remove the specified initialization listener from the notification list.

Parameters:
listener - The listener to remove.

All Packages  Class Hierarchy  This Package  Previous  Next  Index