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