com.sas.visuals
Class DirectoryDialog

com.sas.visuals.DirectoryDialog
All Implemented Interfaces:
ContainerInterface, VisualInterface, com.sas.beans.PropertyChangeSource, com.sas.beans.VetoableChangeSource, com.sas.ComponentInterface, com.sas.DesignTimeDropTargetInterface, com.sas.lang.StringDataInterface, com.sas.LinkPropertiesInterface, com.sas.ModelInterface, ValidatorInterface, com.sas.ViewInterface, MultipleValueEventSourceInterface, java.awt.event.KeyListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.ObjectInputValidation, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

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 (java.awt.FileDialog). 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.visuals.DirectoryList _dirList
           
protected  TextField _name
           
protected  java.awt.Frame _parent
           
protected  boolean _prompt
           
protected  TreeView _tree
           
protected  boolean _wasCancelled
           
protected  java.awt.Button cancelButton
           
protected  java.lang.String NAME
           
protected  java.awt.Button okButton
           
protected static java.lang.String RB_KEY
           
static java.lang.String separator
           
 
Fields inherited from class com.sas.awt.Dialog
_cantUseSASModal, _inApplet, _modal, autoDispose, READY, setVisibleCalled, t
 
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)
          setVisible() is the set accessor method for the Visible attribute.
 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)
          Part of the implementation of the WindowListener interface.
 void windowClosed(java.awt.event.WindowEvent evt)
          Part of the implementation of the WindowListener interface.
 void windowClosing(java.awt.event.WindowEvent evt)
          Part of the implementation of the WindowListener interface.
 void windowDeactivated(java.awt.event.WindowEvent evt)
          Part of the implementation of the WindowListener interface.
 void windowDeiconified(java.awt.event.WindowEvent evt)
          Part of the implementation of the WindowListener interface.
 void windowIconified(java.awt.event.WindowEvent evt)
          Part of the implementation of the WindowListener interface.
 void windowOpened(java.awt.event.WindowEvent evt)
          Part of the implementation of the WindowListener interface.
 
Methods inherited from class com.sas.awt.Dialog
center, centerOver, centerOverWindow, dispose, fireReadySignal, getAutoDispose, getDefaultHeight, getDefaultWidth, getExtendedBeanInfo, getText, hide, isSASModalEnabled, newDispatchThread, processWindowEvent, setAutoDispose, setDefaultHeight, setDefaultWidth, setModal, setResizable, setSASModalEnabled, setText, setTitle, setVisible, show, stopDispatchThread, waitForReadySignal, waitTilReady
 
Methods inherited from class com.sas.awt.DialogContainerComponent
addNotify, clone, dragEnter, dragLeave, dragOver, drop, getContainerInterfaceSupportInfo, getErrorHandler, getValidator, isIDEDnDDropBarrier, isIDEDnDDropTarget, isValid, removeNotify, setContainerInterfaceSupportInfo, setDefaultValues, setErrorHandler, setIDEDnDDropBarrier, setIDEDnDDropTarget, setInsets, setInsets, setValidator, superAddNotify, superGetInsets, superRemoveNotify, superSetDefaultValues
 
Methods inherited from class com.sas.awt.DialogVisualComponent
addLink, addPropertyChangeListener, addVetoableChangeListener, anyPropertyChangeListeners, attachModel, attachView, computePreferredSize, detachModel, detachView, dumpComponent, firePropertyChange, firePropertyChange, fireVetoableChange, getBackgroundColor, getBorder, getComponentDescription, getComponentSupportInfo, getEventMethod, getEventValues, getFont, getForegroundColor, getHeight, getHorizontalPosition, getLinkInfo, getMinimumSize, getModelInterface, getPreferredSize, getPrePainter, getRequiredInterfaces, getVerticalPosition, getViewInterfaceSupportInfo, getVisualInterfaceSupportInfo, getWidth, initialize, initializeComponent, isDesignTime, isEnabled, isFocus, isLinked, isTransparent, isVisible, paint, propertyChange, queryLinks, queryLinks, refresh, removeAllLinks, removeInterfaceTraps, removeLink, removePropertyChangeListener, removeVetoableChangeListener, setBackgroundColor, setBorder, setBounds, setComponentDescription, setComponentSupportInfo, setEnabled, setFocus, setFont, setForegroundColor, setHeight, setHorizontalPosition, setLinkInfo, setModelInterface, setPreferredSize, setPrePainter, setRequiredInterfaces, setTransparent, setVerticalPosition, setViewInterfaceSupportInfo, setVisualInterfaceSupportInfo, setWidth, superGetFont, superGetMinimumSize, superGetPreferredSize, superIsEnabled, superIsVisible, superPaint, superSetBounds, superSetEnabled, superSetFont, superSetVisible, superUpdate, supportsListenerInterface, supportsRequiredInterfaces, trapInterfaceEvents, update, validateObject
 
Methods inherited from interface com.sas.awt.ContainerInterface
getComponents, getLayout, invalidate, setLayout, validate
 
Methods inherited from interface com.sas.awt.VisualInterface
computePreferredSize, getBackgroundColor, getBorder, getFont, getForegroundColor, getHeight, getHorizontalPosition, getMinimumSize, getPreferredSize, getPrePainter, getVerticalPosition, getVisualInterfaceSupportInfo, getWidth, isEnabled, isFocus, isTransparent, isVisible, setBackgroundColor, setBorder, setBounds, setEnabled, setFocus, setFont, setForegroundColor, setHeight, setHorizontalPosition, setPreferredSize, setPrePainter, setTransparent, setVerticalPosition, setVisualInterfaceSupportInfo, setWidth, superGetFont, superGetMinimumSize, superGetPreferredSize, superIsEnabled, superIsVisible, superPaint, superSetBounds, superSetEnabled, superSetFont, superSetVisible, superUpdate
 

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.visuals.DirectoryList _dirList

_tree

protected TreeView _tree

_name

protected TextField _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 java.awt.Button okButton

cancelButton

protected java.awt.Button 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)
Description copied from interface: VisualInterface
setVisible() is the set accessor method for the Visible attribute. Pass in true to show the component. Pass in false to hide the component.

Specified by:
setVisible in interface VisualInterface
Overrides:
setVisible in class Dialog
Parameters:
visible - Whether the component should be visible.
See Also:
VisualInterface.setVisible(boolean)

getInsets

public java.awt.Insets getInsets()
Specified by:
getInsets in interface ContainerInterface
Overrides:
getInsets in class DialogContainerComponent

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)
Description copied from class: Dialog
Part of the implementation of the WindowListener interface. This interface is used to listen for the close event on the window.

Specified by:
windowOpened in interface java.awt.event.WindowListener
Overrides:
windowOpened in class Dialog
Parameters:
evt - windowEvent

windowClosing

public void windowClosing(java.awt.event.WindowEvent evt)
Description copied from class: Dialog
Part of the implementation of the WindowListener interface. This interface is used to listen for the close event on the window.

When the window close button is clicked, the window is destroyed using dispose() and a MessageBoxEvent is sent with the button field as CANCEL.

Specified by:
windowClosing in interface java.awt.event.WindowListener
Overrides:
windowClosing in class Dialog
Parameters:
evt - windowEvent

windowClosed

public void windowClosed(java.awt.event.WindowEvent evt)
Description copied from class: Dialog
Part of the implementation of the WindowListener interface. This interface is used to listen for the close event on the window.

Specified by:
windowClosed in interface java.awt.event.WindowListener
Overrides:
windowClosed in class Dialog
Parameters:
evt - windowEvent

windowIconified

public void windowIconified(java.awt.event.WindowEvent evt)
Description copied from class: Dialog
Part of the implementation of the WindowListener interface. This interface is used to listen for the close event on the window.

Specified by:
windowIconified in interface java.awt.event.WindowListener
Overrides:
windowIconified in class Dialog
Parameters:
evt - windowEvent

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent evt)
Description copied from class: Dialog
Part of the implementation of the WindowListener interface. This interface is used to listen for the close event on the window.

Specified by:
windowDeiconified in interface java.awt.event.WindowListener
Overrides:
windowDeiconified in class Dialog
Parameters:
evt - windowEvent

windowActivated

public void windowActivated(java.awt.event.WindowEvent evt)
Description copied from class: Dialog
Part of the implementation of the WindowListener interface. This interface is used to listen for the close event on the window.

Specified by:
windowActivated in interface java.awt.event.WindowListener
Overrides:
windowActivated in class Dialog
Parameters:
evt - windowEvent

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent evt)
Description copied from class: Dialog
Part of the implementation of the WindowListener interface. This interface is used to listen for the close event on the window.

Specified by:
windowDeactivated in interface java.awt.event.WindowListener
Overrides:
windowDeactivated in class Dialog
Parameters:
evt - windowEvent



Copyright © 2009 SAS Institute Inc. All Rights Reserved.