All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.install.panels.DirectorySelectionPanel

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

public class DirectorySelectionPanel
extends WizardLeaf
implements ActionListener, FileBrowser
The DirectorySelectionPanel allows a user to select which directory the product being installed will be relocated to. Typically, software has a base directory and is placed in that directory and any directories below that. As an example, here is a piece of software that wants to go into the "/home/jhf/WebstartSDK" directory as a default, which may be changed by the user at this point. Most of the configurable settings for this panel must be set into the WizardState using setData().

Graphic of a DirectorySelectionPanels

The code to create this panel is:

DirectorySelectionPanel samplePanel = new DirectorySelectionPanel(wizardState, myName, "Select Install Directory", "defaultInstallDir", "currentInstallDir", "installDir"); samplePanel.addDescriptionText("Please enter the location where you want directories for Webstart Wizards SDK to be installed"); samplePanel.addLabelText("This product will be installed into:");


Constructor Index

 o DirectorySelectionPanel()
Creates a DirectorySelectionPanel with no name.
 o DirectorySelectionPanel(String, Route, WizardTreeManager)
Creates a DirectorySelectionPanel with the specified name, the specified route and wizard manager.
 o DirectorySelectionPanel(WizardState, String, String, String, String)
Creates a DirectorySelectionPanel with the specified name, which defaults to the value indexed by the specified key.
 o DirectorySelectionPanel(WizardState, String, String, String, String, boolean)
Creates a DirectorySelectionPanel with the specified name, which defaults to the value indexed by the specified key.
 o DirectorySelectionPanel(WizardState, String, String, String, String, Vector)
Creates a DirectorySelectionPanel with the specified name, which defaults to the value indexed by the specified key.

Method Index

 o actionPerformed(ActionEvent)
Invoked when an action occurs.
 o addCriticalStateKeys(Vector)
Adds the WizardState keys that should be set into the WizardState file.
 o addDescriptionText(Msg)
Add a description to the top of the DirectorySelectionPanel.
 o addLabelText(Msg)
Sets the label for the directory selection text input object.
 o addRuntimeResources(Vector)
Get the runtime classes required by this panel.
 o cancelMake()
 o canRead(String)
Tests if the application can read from the specified file.
 o confirmMake()
 o consoleInteraction()
Prompts user for directory in CLI mode.
 o createDirectory(String)
Creates a directory whose pathname is specified by dir.
 o createUI()
This method creates the user interface.
 o deserialize(DataInput)
Deserialize this WizardComponent from the specified input stream.
 o fileExists(String)
Tests if file exists.
 o getAbsolutePath(String)
Returns the absolute pathname of the file represented by the path.
 o getButtonMask()
Returns information suggesting which buttons should be displayed for this panel.
 o getList(int, String)
Gets a list of files in the supplied directory.
 o getNamedDirectory(String)
Returns the directory for the specified type.
 o getParent(String)
Returns the parent part of the pathname of this File object, or null if the name has no parent part.
 o getParentDirectory(String)
Gets the parent directory of the supplied directory.
 o getSeparator()
Gets the system-dependent file separator
 o isDirectory(String)
Tests if the file represented by dir is a directory.
 o isDisplayComplete()
Returns true if this DirectorySelectionPanel is finished displaying.
 o logEvent(String)
Logs an event to the install logfile for this installer
 o reset(Object)
Reset this component, given the specified information.
 o serialize(DataOutput)
Serialize this DirectorySelectionPanel to the specified output stream.
 o setDirectory()
Normalizes the directory and sets it into the text field.

Constructors

 o DirectorySelectionPanel
 public DirectorySelectionPanel()
Creates a DirectorySelectionPanel with no name.

 o DirectorySelectionPanel
 public DirectorySelectionPanel(WizardState wizardState,
                                String name,
                                String defaultKey,
                                String currentKey,
                                String defaultDirectory)
Creates a DirectorySelectionPanel with the specified name, which defaults to the value indexed by the specified key. The keys passed in are used to lookup the corresponding values in the WizardState at runtime.

Parameters:
wizardState - The buildtime WizardState.
name - The name for this DirectorySelectionPanel.
defaultKey - The key to the default directory.
currentKey - The key to the currently selected directory.
defaultDirectory - The default installation directory. Used during panel resets, normally same as directory that defaultKey maps to.
 o DirectorySelectionPanel
 public DirectorySelectionPanel(WizardState wizardState,
                                String name,
                                String defaultKey,
                                String currentKey,
                                String defaultDirectory,
                                boolean singleDirectory)
Creates a DirectorySelectionPanel with the specified name, which defaults to the value indexed by the specified key. The keys passed in are used to lookup the corresponding values in the WizardState at runtime.

Parameters:
wizardState - The buildtime WizardState.
name - The name for this DirectorySelectionPanel.
defaultKey - The key to the default directory.
currentKey - The key to the currently selected directory.
defaultDirectory - The default installation directory. Used during panel resets, normally same as directory that defaultKey maps to.
singleDirectory - If true, only asks once for the directory. The supplied directory is then set into other wizards, and the other directory selection panels are skipped.
 o DirectorySelectionPanel
 public DirectorySelectionPanel(WizardState wizardState,
                                String name,
                                String defaultKey,
                                String currentKey,
                                String defaultDirectory,
                                Vector subDirs)
Creates a DirectorySelectionPanel with the specified name, which defaults to the value indexed by the specified key.

Parameters:
wizardState - The buildtime WizardState.
name - The name for this DirectorySelectionPanel.
defaultKey - The key to the default directory.
currentKey - The key to the currently selected directory.
defaultDirectory - The default installation directory.
subDirs - The subdirs to link for relocation
 o DirectorySelectionPanel
 public DirectorySelectionPanel(String name,
                                Route route,
                                WizardTreeManager wizardManager)
Creates a DirectorySelectionPanel with the specified name, the specified route and wizard manager.

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

Methods

 o getSeparator
 public String getSeparator()
Gets the system-dependent file separator

Returns:
The file separator of the machine that the VM holding this object is running on.
 o getParentDirectory
 public String getParentDirectory(String child)
Gets the parent directory of the supplied directory.

Parameters:
child - The directory to get the parent of
Returns:
The parent directory of the supplied child directory, or the result of "getSeparator()" if the directory is the root directory.
 o getParent
 public String getParent(String child)
Returns the parent part of the pathname of this File object, or null if the name has no parent part. The parent part is generally everything leading up to the last occurrence of the separator character, although the precise definition is system dependent. On UNIX, for example, the parent part of "/usr/lib" is "/usr", whose parent part is "/", which in turn has no parent. On Windows platforms, the parent part of "c:\java" is "c:\", which in turn has no parent.

Parameters:
child - The directory to get the parent of
See Also:
getPath, getCanonicalPath, separator
 o getAbsolutePath
 public String getAbsolutePath(String file)
Returns the absolute pathname of the file represented by the path. If the path represents an absolute pathname, then return the pathname. Otherwise, return a pathname that is a concatenation of the current user directory, the separator character, and the path passed in.

The system property user.dir contains the current user directory.

Parameters:
path - The path to get the absolute path of.
Returns:
a system-dependent absolute pathname for the path.
See Also:
getPath, isAbsolute, getProperty
 o getList
 public String[] getList(int type,
                         String directory)
Gets a list of files in the supplied directory.

Parameters:
type - The type of entries to return in the list.
directory - The directory to get a listing of the contents of.
Returns:
The file separator of the machine that the VM holding this object is running on.
 o fileExists
 public boolean fileExists(String file)
Tests if file exists.

Parameters:
file - The file to test.
Returns:
true if the file specified by this object exists; false otherwise.
Throws: SecurityException
if a security manager exists, its checkRead method is called with the pathname of this File to see if the application is allowed read access to the file.
See Also:
getPath, checkRead
 o createDirectory
 public boolean createDirectory(String dir)
Creates a directory whose pathname is specified by dir.

Parameters:
dir - The directory to create.
Returns:
true if the directory could be created; false otherwise.
Throws: SecurityException
if a security manager exists, its checkWrite method is called with the pathname of this File to see if the application is allowed write access to the file.
See Also:
getPath, checkWrite
 o getNamedDirectory
 public String getNamedDirectory(String name)
Returns the directory for the specified type. See the XXX_DIR fields in the FileBrowser interface for a list of named directories supported.

Parameters:
name - the directory type name
Returns:
s the directory for the specified type.
 o canRead
 public boolean canRead(String file)
Tests if the application can read from the specified file.

Parameters:
path - The path to test.
Returns:
true if the file specified by this object exists and the application can read the file; false otherwise.
Throws: SecurityException
if a security manager exists, its checkRead method is called with the pathname of this File to see if the application is allowed read access to the file.
See Also:
getPath, checkRead
 o isDirectory
 public boolean isDirectory(String file)
Tests if the file represented by dir is a directory.

Parameters:
dir - The directory to test.
Returns:
true if the file exists and is a directory; false otherwise.
Throws: SecurityException
if a security manager exists, its checkRead method is called with the pathname of this File to see if the application is allowed read access to the file.
See Also:
getPath, checkRead
 o logEvent
 public void logEvent(String message)
Logs an event to the install logfile for this installer

Parameters:
message - The message to log
 o addDescriptionText
 public void addDescriptionText(Msg descriptionText)
Add a description to the top of the DirectorySelectionPanel.

Parameters:
descriptionText - The description to be added.
 o addLabelText
 public void addLabelText(Msg labelText)
Sets the label for the directory selection text input object.

Parameters:
labelText - The label text for the input object.
 o createUI
 public void createUI()
This method creates the user interface.

Overrides:
createUI in class WizardLeaf
 o consoleInteraction
 public void consoleInteraction()
Prompts user for directory in CLI mode.

Overrides:
consoleInteraction in class WizardComponent
 o setDirectory
 public String setDirectory()
Normalizes the directory and sets it into the text field. The directory is retrieved from the WizardState data under the key identified in the constructor.

Returns:
A String object representing the directory being set into the text field.
 o isDisplayComplete
 public boolean isDisplayComplete()
Returns true if this DirectorySelectionPanel is finished displaying. This method can be used to verify user input.

Returns:
true if the display of this DirectorySelectionPanel is complete; false otherwise.
Overrides:
isDisplayComplete in class WizardComponent
 o cancelMake
 public void cancelMake()
 o confirmMake
 public void confirmMake()
 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. When this method is called, the user selected "Default" installation. This panel must reset its install directory information.

Parameters:
Object - The information required to perform a reset.
Overrides:
reset in class WizardComponent
 o actionPerformed
 public void actionPerformed(ActionEvent e)
Invoked when an action occurs.

 o serialize
 protected void serialize(DataOutput out)
Serialize this DirectorySelectionPanel to the specified output stream. This method does not save its children.

Parameters:
out - The output stream to which this WizardComponent will be serialized.
Overrides:
serialize in class WizardComponent
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.
Overrides:
deserialize in class WizardComponent
See Also:
deserializeChildren
 o getButtonMask
 public int getButtonMask()
Returns information suggesting which buttons should be displayed for this panel. The DirectorySelectionPanel displays all the navigation buttons.

Returns:
A button mask identifying valid navigation buttons.
Overrides:
getButtonMask in class WizardLeaf
 o addCriticalStateKeys
 public void addCriticalStateKeys(Vector keys)
Adds the WizardState keys that should be set into the WizardState file. The keys added to the specified vector are: defaultKey and currentKey.

Parameters:
keys - The vector of keys that will be added to the WizardState file.
Overrides:
addCriticalStateKeys in class WizardComponent
 o addRuntimeResources
 public void addRuntimeResources(Vector resourceVector)
Get the runtime classes required by this panel.

Parameters:
resourceVector - The vector containing resources that this method will add to.
Overrides:
addRuntimeResources in class WizardLeaf

All Packages  Class Hierarchy  This Package  Previous  Next  Index