com.sas.swing.visuals
Class DirectoryDialog

com.sas.swing.visuals.DirectoryDialog
All Implemented Interfaces:
java.awt.event.KeyListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class DirectoryDialog
implements java.awt.event.WindowListener, java.awt.event.KeyListener

The DirectoryDialog allows the user to select a directory, rather than a single file (javax.swing.JFileChooser). It is modeled after the VSS "Set Working Folder" directory chooser

See Also:
Serialized Form

Field Summary
protected  boolean _allowNewDirectories
           
protected  java.lang.String _currentDirectory
           
protected  com.sas.swing.visuals.DirectoryList _dirList
           
protected  javax.swing.JTextField _name
           
protected  java.awt.Frame _parent
           
protected  boolean _prompt
           
protected  TreeView _tree
           
protected  boolean _wasCancelled
           
protected  javax.swing.JButton cancelButton
           
protected  java.lang.String NAME
           
protected  javax.swing.JButton okButton
           
protected static java.lang.String RB_KEY
           
static java.lang.String separator
           
 
Constructor Summary
DirectoryDialog(java.awt.Frame frame, java.lang.String title, java.lang.String startingDirectory)
          creates a directory dialog parent to the given frame, with the specified title and starting directory
DirectoryDialog(java.awt.Frame frame, java.lang.String title, java.lang.String startingDirectory, boolean allowNew)
          creates a directory dialog parent to the given frame, with the specified title and starting directory
DirectoryDialog(java.awt.Frame frame, java.lang.String title, java.lang.String startingDirectory, boolean allowNew, boolean prompt)
          creates a directory dialog parent to the given frame, with the specified title and starting directory
 
Method Summary
 java.lang.String getDirectory()
          return the directory specified by the user in the dialog
 java.awt.Insets getInsets()
           
 void keyPressed(java.awt.event.KeyEvent evt)
           
 void keyReleased(java.awt.event.KeyEvent evt)
           
 void keyTyped(java.awt.event.KeyEvent evt)
           
protected  void onCancel()
           
protected  void onOK()
           
protected  NodeView searchTree(NodeView node, java.lang.String val)
          search tree for expanded text (not currently supported in TreeView)
 void setDirectory(java.lang.String directory)
           
 void setVisible(boolean visible)
           
 boolean verifyDirectory(java.awt.Frame parent, java.lang.String directory)
          verify that the specified directory exists; if the directory does not exist, the user is prompted to create the directory
 boolean wasCancelled()
          return true if dialog wasCancelled
 void windowActivated(java.awt.event.WindowEvent evt)
           
 void windowClosed(java.awt.event.WindowEvent evt)
           
 void windowClosing(java.awt.event.WindowEvent evt)
           
 void windowDeactivated(java.awt.event.WindowEvent evt)
           
 void windowDeiconified(java.awt.event.WindowEvent evt)
           
 void windowIconified(java.awt.event.WindowEvent evt)
           
 void windowOpened(java.awt.event.WindowEvent evt)
           
 

Field Detail

separator

public static java.lang.String separator

RB_KEY

protected static final java.lang.String RB_KEY
See Also:
Constant Field Values

NAME

protected java.lang.String NAME

_dirList

protected com.sas.swing.visuals.DirectoryList _dirList

_tree

protected TreeView _tree

_name

protected javax.swing.JTextField _name

_currentDirectory

protected java.lang.String _currentDirectory

_parent

protected java.awt.Frame _parent

_wasCancelled

protected boolean _wasCancelled

_allowNewDirectories

protected boolean _allowNewDirectories

_prompt

protected boolean _prompt

okButton

protected javax.swing.JButton okButton

cancelButton

protected javax.swing.JButton cancelButton
Constructor Detail

DirectoryDialog

public DirectoryDialog(java.awt.Frame frame,
                       java.lang.String title,
                       java.lang.String startingDirectory,
                       boolean allowNew,
                       boolean prompt)
creates a directory dialog parent to the given frame, with the specified title and starting directory

Parameters:
frame - parent frame; dialog will be centered over this
title - dialog title
startingDirectory - directory that is displayed; tree is initially expanded to show this
allowNew - whether to allow new direcories to be creating by typing in the text field
prompt - if true and allowNew is true, user will be prompted to create a directory if the directory they enter (by typing in the text field) does not exist. if false and allowNew is true, the directory will be created without being prompted if allowNew is false, the user will never be prompted

DirectoryDialog

public DirectoryDialog(java.awt.Frame frame,
                       java.lang.String title,
                       java.lang.String startingDirectory,
                       boolean allowNew)
creates a directory dialog parent to the given frame, with the specified title and starting directory

Parameters:
frame - parent frame; dialog will be centered over this
title - dialog title
startingDirectory - directory that is displayed; tree is initially expanded to show this
allowNew - whether to allow new direcories to be creating by typing in the text field

DirectoryDialog

public DirectoryDialog(java.awt.Frame frame,
                       java.lang.String title,
                       java.lang.String startingDirectory)
creates a directory dialog parent to the given frame, with the specified title and starting directory

Parameters:
frame - parent frame; dialog will be centered over this
title - dialog title
startingDirectory - directory that is displayed; tree is initially expanded to show this
Method Detail

setDirectory

public void setDirectory(java.lang.String directory)

getDirectory

public java.lang.String getDirectory()
return the directory specified by the user in the dialog

Returns:
directory name

searchTree

protected NodeView searchTree(NodeView node,
                              java.lang.String val)
search tree for expanded text (not currently supported in TreeView)


onOK

protected void onOK()

onCancel

protected void onCancel()

wasCancelled

public boolean wasCancelled()
return true if dialog wasCancelled

Returns:
boolean value set to true if dialog was cancelled

setVisible

public void setVisible(boolean visible)
Overrides:
setVisible in class java.awt.Dialog

getInsets

public java.awt.Insets getInsets()
Overrides:
getInsets in class java.awt.Container

verifyDirectory

public boolean verifyDirectory(java.awt.Frame parent,
                               java.lang.String directory)
verify that the specified directory exists; if the directory does not exist, the user is prompted to create the directory

Parameters:
parent - parent Frame that prompts an error message dialogs can be parented to
directory - name of directory to verify
Returns:
true if directory exists or was created, false if directory did not exist and was not created

keyPressed

public void keyPressed(java.awt.event.KeyEvent evt)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent evt)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent evt)
Specified by:
keyTyped in interface java.awt.event.KeyListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent evt)
Specified by:
windowOpened in interface java.awt.event.WindowListener

windowClosing

public void windowClosing(java.awt.event.WindowEvent evt)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent evt)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent evt)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent evt)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent evt)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent evt)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener



Copyright © 2009 SAS Institute Inc. All Rights Reserved.