Class URLDialog
java.lang.Object
|
+----java.awt.Component
|
+----java.awt.Container
|
+----java.awt.Window
|
+----java.awt.Dialog
|
+----URLDialog
- public class URLDialog
- extends Dialog
- implements ActionListener
Class definition for a dialog that allows a user to choose a URL
to be opened.
- Version:
- $Revision: 1.7 $, $Date: 2000/10/12 14:08:01 $
- Author:
- John Cavanaugh
-
CANCEL
-
-
currDir
- Text field for displaying the current directory name.
-
DIR_SEPARATOR
-
-
DIR_SEPARATOR_STR
-
-
dirList
- List of directories the user can select from.
-
fileList
- List of files the user can select from.
-
isDirectory
-
-
OK
-
-
PARENT_DIR
-
-
parentFrame
- The frame the dialog is associated with.
-
URLBase
- Prefix of the URL; passed in by the parent.
-
URLFile
- The file part of the URL the user selected.
-
URLPath
- Vector whose elements are the directories
in the path name of the selected file.
-
URLDialog(Frame, String, String)
- Constructs a dialog window.
-
actionPerformed(ActionEvent)
- Action for ActionListener interface; invoked when the user
presses button or double-clicks on a file or directory name.
-
buildName(String, Vector, String)
- Assemble a URL from the base name and a vector containing
the path name components.
-
charMatch(char[], char[])
- Look for a character array as a substring in another character
array.
-
charScan(char[], int, char)
- Assemble a string from a character array, starting at the
indicated position and stopping when we come to the
indicated character.
-
getDirectory()
- Get the directory chosen by the user.
-
getFile()
- Get the file chosen by the user.
-
getFileLists(List, List)
- Read a directory and put the directory and file names into the
given lists.
-
getURL()
- Get the full URL chosen by the user.
-
parseLine(char[])
- Parse a line from a directory, determining the type and file
or directory name.
-
readLine(InputStreamReader)
- Read a line from an input stream.
-
setDirectory(String)
- Set the directory.
OK
private static final String OK
CANCEL
private static final String CANCEL
DIR_SEPARATOR
private static final char DIR_SEPARATOR
DIR_SEPARATOR_STR
private static final String DIR_SEPARATOR_STR
URLBase
protected String URLBase
- Prefix of the URL; passed in by the parent.
URLPath
protected Vector URLPath
- Vector whose elements are the directories
in the path name of the selected file.
PARENT_DIR
private static final String PARENT_DIR
URLFile
protected String URLFile
- The file part of the URL the user selected.
parentFrame
protected Frame parentFrame
- The frame the dialog is associated with.
currDir
protected TextField currDir
- Text field for displaying the current directory name.
dirList
protected List dirList
- List of directories the user can select from.
fileList
protected List fileList
- List of files the user can select from.
isDirectory
boolean isDirectory
URLDialog
public URLDialog(Frame owner,
String title,
String dataAddr) throws MalformedURLException, IOException
- Constructs a dialog window.
- Parameters:
- owner - The frame the dialog is associated with.
- title - A title for the dialog window.
- dataAddr - Starting point for the URL specification.
getDirectory
public String getDirectory()
- Get the directory chosen by the user.
- Returns:
- The name of the directory chosen by the user.
setDirectory
public void setDirectory(String name) throws MalformedURLException, IOException
- Set the directory.
- Parameters:
- name - The directory name.
getFile
public String getFile()
- Get the file chosen by the user.
- Returns:
- The name of the file chosen by the user.
getURL
public String getURL()
- Get the full URL chosen by the user.
- Returns:
- The name of the full URL chosen by the user.
getFileLists
private void getFileLists(List dList,
List fList) throws MalformedURLException, IOException
- Read a directory and put the directory and file names into the
given lists.
- Parameters:
- dList - A list of directory names.
- fList - A list of file names.
readLine
private char[] readLine(InputStreamReader reader) throws IOException
- Read a line from an input stream.
- Parameters:
- reader - The input stream reader to read from.
- Returns:
- A buffer containing the line of data read;
null if end of file was reached.
- Throws: IOException
- If an I/O error occurs while reading
the input stream.
parseLine
private String parseLine(char buffer[])
- Parse a line from a directory, determining the type and file
or directory name.
- Parameters:
- buffer - The line to be parsed.
- Returns:
- The name of the file or directory; a directory
name will have a slash appended.
charMatch
private int charMatch(char buffer[],
char str[])
- Look for a character array as a substring in another character
array.
- Parameters:
- buffer - The buffer to search.
- str - The substring to search for.
- Returns:
- The index of the first character past the end of
the substring, or -1 if it was not found.
charScan
private String charScan(char buffer[],
int start,
char endChar)
- Assemble a string from a character array, starting at the
indicated position and stopping when we come to the
indicated character.
- Parameters:
- buffer - Buffer to take string from.
- start - Character position to start the string.
- endChar - Character which ends the string.
- Returns:
- The assembled string.
buildName
private String buildName(String base,
Vector path,
String file)
- Assemble a URL from the base name and a vector containing
the path name components.
- Parameters:
- base - The base name for the URL.
- path - The path name components.
- file - The file name.
- Returns:
- The assembled URL.
actionPerformed
public void actionPerformed(ActionEvent e)
- Action for ActionListener interface; invoked when the user
presses button or double-clicks on a file or directory name.
- Parameters:
- e - The event which triggered the action.