wt.clients.gui
Class WTFolderBrowserDialog

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Dialog
                  extended bywt.clients.gui.WTFolderBrowserDialog
All Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable

public class WTFolderBrowserDialog
extends Dialog

See Also:
Serialized Form

Nested Class Summary
(package private)  class WTFolderBrowserDialog.DelayThread
           
(package private)  class WTFolderBrowserDialog.SymAction
           
(package private)  class WTFolderBrowserDialog.SymItem
           
(package private)  class WTFolderBrowserDialog.SymJCAction
           
(package private)  class WTFolderBrowserDialog.SymKey
           
(package private)  class WTFolderBrowserDialog.SymMouse
           
(package private)  class WTFolderBrowserDialog.SymWindow
           
 
Nested classes inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog
 
Nested classes inherited from class java.awt.Window
Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
(package private)  Label actionLabel
           
protected  Vector allowedClasses
          Vector of Classes to be shown in this browser dialog
(package private)  Panel buttonPanel
           
private static String CABINET_ROOT
          Used as the first entry in the cabinet combobox to allow the user to select the root cabinet.
(package private)  Choice cabinetComboBox
           
protected  Cabinet[] cabinets
          Cabinets which can be browsed
(package private)  Button cancelButton
           
(package private)  WTMultiListTable chooserTable
           
protected  ThreadGroup contextGroup
          ThreadGroup used in getting and setting the appropriate WTContext.
protected  Folder currentFolder
          Folder whose contents are currently displayed
protected  CabinetBased currentlySelectedItem
          Variable used to track the currently selected CabinetBased item
protected  WTFolderBrowserDialog.DelayThread delayThread
          Thread used to track double mouse clicks
protected  Vector disallowedClasses
          Vector of Classes to be excluded from being displayed in this browser dialog
(package private)  boolean fComponentsAdjusted
           
(package private)  long firstClickTime
           
protected  com.objectspace.jgl.HashMap folderEntries
          HashMap which maintains the contents of a folder.
protected  CabinetBased folderEntry
          Maintains the currently selected folder entry
(package private)  Label folderLocationLabel
           
protected  boolean foldersOnly
          Flag indicating whether or not this dialog should display only cabinets and folders.
protected  IconCache iconCache
          Cache of images to be displayed in this browser table
protected  boolean initializeCabinets
          Flag indicating whether or not this dialog should initialize the list of cabinets to be browsed
protected  Vector listeners
          Vector of listeners who are notified when an object is selected or when this dialog is cancelled.
protected static int maximumRows
          Maximum number of folder entries to display per column in this dialog
(package private)  Label nameLabel
           
(package private)  TextField nameTextField
           
(package private)  Button okButton
           
private  Applet parentApplet
          Deprecated. this variable is no longer used nor necessary
protected  String permission
          String permission used in restricting which contents of a folder are displayed
private static String RESOURCES
          String which specifies the absolute class name of the ResourceBundle corresponding to this dialog
private static String RETRIEVED
          Used to form a key for the hashmap whose corresponding value is the time at which a particular object was retrieved.
protected  Folder startingFolder
          Folder whose contents are to be displayed when the dialog is initially displayed.
(package private)  TextField statusTextField
           
private static String UP_IMAGE
          Gif image file used for the up-arrow button.
(package private)  jclass.bwt.JCButton upButton
           
private static boolean VERBOSE
           
 
Fields inherited from class java.awt.Dialog
 
Fields inherited from class java.awt.Window
 
Fields inherited from class java.awt.Container
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
WTFolderBrowserDialog(Component parent, boolean modal)
          Constructor which uses a component as the parent of the dialog.
WTFolderBrowserDialog(Component parent, String title, boolean modal)
          Class constructor
WTFolderBrowserDialog(Frame parent)
           
WTFolderBrowserDialog(Frame parent, boolean modal)
           
WTFolderBrowserDialog(Frame parent, String title, boolean modal)
           
 
Method Summary
 void addAllowedClass(Class allowed_class)
          Method addAllowedClass is used to control which type (Class) of object can be displayed in the table of this dialog.
 void addDisallowedClass(Class disallowed_class)
          Method addDisallowedClass is used to control which type (Class) of object can be displayed in the table of this dialog.
private  void addFolderEntry(int row, int col, FolderEntry object)
          Method addFolderEntry adds the given FolderEntry to the table of folder contents displayed by this dialog.
 void addListener(WTFolderBrowserListener a_listener)
          Method addListener adds the given WTFolderBrowserListener to receive notification when this dialog is closed.
 void addNotify()
           
private  void addSubFolder(int row, int col, Folder folder)
          Method addSubFolder adds the given Folder to the table of folder contents displayed by this dialog.
(package private)  void cabinetComboBox_ItemStateChanged(ItemEvent event)
           
(package private)  void cancelButton_ActionPerformed(ActionEvent event)
           
(package private)  void cancelButton_KeyPressed(KeyEvent event)
           
(package private)  void chooserTable_mouseClicked(MouseEvent event)
           
private  boolean contains(Object item, Vector container)
          Method contains determines whether or not the given Vector contains the class corresponding to the given Object.
private  void displayCabinets()
          Display the cabinets as the contents of the table.
private  void enableActions(boolean enable)
          Method enableActions controls whether or not actions are available in this dialog.
private  Cabinet findCabinet(String cabinet_name)
          Retrieves the Cabinet object from the array of cabinets based upon the given cabinet name.
private  void getCabinetContents()
          Method getCabinetContents is ultimately invoked as a result of the user selecting a Cabinet from the combobox of cabinet names.
 Cabinet[] getCabinets()
          Returns the array of Cabinets which can be browsed and selected in this dialog.
private static Frame getComponentFrame(Component component)
           
private  WTContext getContext()
          Retrieves the WTContext associated with this dialog.
 CabinetBased getFolderEntry()
          Method getFolderEntry returns the CabinetBased object selected in this dialog.
 String getFolderPermission()
          Method getFolderPermission returns the permission which is used in filtering the folder contents which are retrieved.
private static Frame getFrame(Component component)
          Traverse the parent hierarchy of the given Component until a frame is found.
protected  String getLocalizedLabel(String key, Object[] params)
          Convenience method for returing a string message retrieved from the resource bundle associated with this class.
private  String getObjectKey(CabinetBased the_object)
          Method getObjectKey returns a key value to be used as the key associated with the given object in the hashmap of folder contents.
 Applet getParentApplet()
          Deprecated. the Applet is no longer used for context
private  Image getStandardIcon(Object object)
          Method getStandardIcon attempts to retrieve the Image which is associated with the given Object.
private  SortedEnumeration getSubFolders(Folder folder)
           
private  boolean hasPermission()
          Returns a boolean value which indicates whether or not a permission has been set on this dialog to use to control which cabinets, folders and objects to display.
private  void initCabinetCombobox()
          Method to initialize the combobox of Cabinet choices with the names of the cabinets.
private  void initCabinetRoot()
          Initialize the String which represents the root of all cabinets.
private  void initializeCabinets()
          Method to retrieve the initial list of Cabinets to be displayed by this browser.
private  void initializeIconCache()
          Method to initialize the cache of icons displayed in this dialog.
private  void initImages()
          Method to initialize the image displayed on the up-arrow button.
private  boolean isChoosable(Object entry)
          Method isChoosable determines whether a given object can be chosen and consequently displayed in the table of folder contents of this dialog.
 boolean isFoldersOnly()
           
 boolean isInitializeCabinets()
          Returns a boolean value which indicates whether or not this dialog is set to initialize the list of Cabinets to be displayed.
private  void localize()
          Method to translate the field labels and button labels of this dialog according to the Locale of the client.
private  void notifyBrowserListeners(WTFolderBrowserEvent an_event)
          Method to notify all WTFolderBrowserListeners when a WTFolderBrowserEvent has been generated.
(package private)  void okButton_ActionPerformed(ActionEvent event)
           
(package private)  void okButton_KeyPressed(KeyEvent event)
           
private  void processCabinetSelect()
           
protected  void processCancelCommand()
          Method which handles the cancelling, or closing, of this dialog.
protected  void processOkCommand()
          Method which handles the closing of this dialog.
protected  void processTableSelect(MouseEvent event)
           
private  void processUpCommand()
           
 void removeListener(WTFolderBrowserListener a_listener)
          Method removeListener removes the given WTFolderBrowserListener from the list of listeners to WTFolderBrowserEvent events.
private  Cabinet[] retrieveCabinets()
          Retrieves the cabinets that will be displayed in the cabinet drop-down.
 void setCabinets(Cabinet[] cabinets)
          Method setCabinets sets the list of Cabinets which can be browsed in this dialog.
private  void setContext(boolean context_on)
          Sets the WTContext according to the given boolean value.
private  void setCurrentFolder(Folder folder)
           
protected  void setDisplayLocation()
          Attempt to set the location of this dialog to some intelligent position.
private  void setFolderEntry(CabinetBased cabinet_based)
           
 void setFolderPermission(String permission)
          Method setFolderPermission sets a permission which is used in filtering the folder contents which are retrieved.
 void setFoldersOnly(boolean folders_only)
           
 void setInitializeCabinets(boolean initialize_cabinets)
          Method setInitializeCabinets is used to indicate whether or not this dialog should initialize the list of Cabinets to be displayed.
 void setInitializeCabinets(boolean initialize_cabinets, String permission)
          Method setInitializeCabinets is used to indicate whether or not this dialog should initialize the list of Cabinets to be displayed.
 void setParentApplet(Applet parent_applet)
          Deprecated. the Applet is no longer used for context
 void setSelectionLabel(String label)
          Sets the label which is associated with the currently selected value.
 void setStartingFolder(Folder folder)
          Initializes this dialog to be opened to the given Folder.
 void setStartingFolder(String folder_path)
          Initializes this dialog to be opened to the Folder associated with the given folder path.
private  void setStatus(String status)
          Method setStatus is a convenience method used to set the text of the status bar.
 void setVisible(boolean b)
          Shows or hides the component depending on the boolean flag b.
private  void showMessageDialog(String message, boolean modal)
          Display a message dialog with the given string message.
private  Vector sortFolderEntries(Enumeration entries)
          Method sortFolderEntries sorts the given enumeration of CabinetBased objects.
(package private)  void upButton_actionPerformed(jclass.bwt.JCActionEvent event)
           
private  void updateFoldersOnlyFlag()
          Updates the flag indicating whether or not this dialog displays only folders.
private  void updateTable()
          Method updateTable updates the table of Folder contents when a new Folder is chosen as the current Folder.
(package private)  void WTFolderBrowserDialog_WindowClosing(WindowEvent event)
           
 
Methods inherited from class java.awt.Dialog
dispose, getAccessibleContext, getTitle, hide, isModal, isResizable, isUndecorated, paramString, setModal, setResizable, setTitle, setUndecorated, show
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, finalize, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

fComponentsAdjusted

boolean fComponentsAdjusted

actionLabel

Label actionLabel

cabinetComboBox

Choice cabinetComboBox

upButton

jclass.bwt.JCButton upButton

folderLocationLabel

Label folderLocationLabel

chooserTable

WTMultiListTable chooserTable

nameLabel

Label nameLabel

nameTextField

TextField nameTextField

buttonPanel

Panel buttonPanel

okButton

Button okButton

cancelButton

Button cancelButton

statusTextField

TextField statusTextField

parentApplet

private Applet parentApplet
Deprecated. this variable is no longer used nor necessary

The parentApplet was previously used for providing context. This variable is no longer used.


contextGroup

protected ThreadGroup contextGroup
ThreadGroup used in getting and setting the appropriate WTContext. This ThreadGroup replaces the use of a parent applet.


delayThread

protected WTFolderBrowserDialog.DelayThread delayThread
Thread used to track double mouse clicks


currentlySelectedItem

protected CabinetBased currentlySelectedItem
Variable used to track the currently selected CabinetBased item


allowedClasses

protected Vector allowedClasses
Vector of Classes to be shown in this browser dialog


currentFolder

protected Folder currentFolder
Folder whose contents are currently displayed


cabinets

protected Cabinet[] cabinets
Cabinets which can be browsed


startingFolder

protected Folder startingFolder
Folder whose contents are to be displayed when the dialog is initially displayed.


iconCache

protected IconCache iconCache
Cache of images to be displayed in this browser table


listeners

protected Vector listeners
Vector of listeners who are notified when an object is selected or when this dialog is cancelled.


initializeCabinets

protected boolean initializeCabinets
Flag indicating whether or not this dialog should initialize the list of cabinets to be browsed


folderEntry

protected CabinetBased folderEntry
Maintains the currently selected folder entry


disallowedClasses

protected Vector disallowedClasses
Vector of Classes to be excluded from being displayed in this browser dialog


folderEntries

protected com.objectspace.jgl.HashMap folderEntries
HashMap which maintains the contents of a folder. Used for more efficient retrieval of folder contents


foldersOnly

protected boolean foldersOnly
Flag indicating whether or not this dialog should display only cabinets and folders.


permission

protected String permission
String permission used in restricting which contents of a folder are displayed


maximumRows

protected static int maximumRows
Maximum number of folder entries to display per column in this dialog


UP_IMAGE

private static String UP_IMAGE
Gif image file used for the up-arrow button.


RETRIEVED

private static String RETRIEVED
Used to form a key for the hashmap whose corresponding value is the time at which a particular object was retrieved. While not implemented yet, this could be used in an algorithm to re-retrieve folder contents after a certain period of time has elapsed.


CABINET_ROOT

private static String CABINET_ROOT
Used as the first entry in the cabinet combobox to allow the user to select the root cabinet.


RESOURCES

private static String RESOURCES
String which specifies the absolute class name of the ResourceBundle corresponding to this dialog


VERBOSE

private static boolean VERBOSE

firstClickTime

long firstClickTime
Constructor Detail

WTFolderBrowserDialog

public WTFolderBrowserDialog(Frame parent)

WTFolderBrowserDialog

public WTFolderBrowserDialog(Frame parent,
                             boolean modal)

WTFolderBrowserDialog

public WTFolderBrowserDialog(Frame parent,
                             String title,
                             boolean modal)

WTFolderBrowserDialog

public WTFolderBrowserDialog(Component parent,
                             boolean modal)
Constructor which uses a component as the parent of the dialog. This constructor will attempt to find a parent frame associated with the given component and use that as the parent of the dialog. This constructor is useful for launching this dialog from an Applet.

Parameters:
parent - the parent Component of this dialog
modal - a boolean value indicating whether or not this dialog should be modal.

WTFolderBrowserDialog

public WTFolderBrowserDialog(Component parent,
                             String title,
                             boolean modal)
Class constructor

Parameters:
parent - the component for which the parent frame is found
title - the String title of this dialog
modal - a boolean value indicating whether or not this dialog should be modal.
Method Detail

addNotify

public void addNotify()

setVisible

public void setVisible(boolean b)
Shows or hides the component depending on the boolean flag b.

Parameters:
b - if true, show the component; otherwise, hide the component.
See Also:
Component.isVisible()

setDisplayLocation

protected void setDisplayLocation()
Attempt to set the location of this dialog to some intelligent position.


getFrame

private static Frame getFrame(Component component)
Traverse the parent hierarchy of the given Component until a frame is found. If no Frame is found, null is returned.

Parameters:
component - the Component for which an associated Frame is to be returned
Returns:
the Frame associated with the given component.

getComponentFrame

private static Frame getComponentFrame(Component component)

initImages

private void initImages()
Method to initialize the image displayed on the up-arrow button. This method uses a MediaTracker to wait until the image has completed loading.

See Also:
MediaTracker

localize

private void localize()
Method to translate the field labels and button labels of this dialog according to the Locale of the client.

See Also:
#initResources

WTFolderBrowserDialog_WindowClosing

void WTFolderBrowserDialog_WindowClosing(WindowEvent event)

getContext

private WTContext getContext()
Retrieves the WTContext associated with this dialog. This method uses the ThreadGroup captured when this dialog was constructed to retrieve the WTContext. If no WTContext is found using the ThreadGroup, this method creates a new WTContext.

Returns:
the WTContext associate with this dialog
See Also:
WTContext

setContext

private void setContext(boolean context_on)
Sets the WTContext according to the given boolean value. If the given boolean value is true, the WTContext is set using the ThreadGroup captured when this dialog was constructed. If the given boolean value is false, the WTContext is set to null. This method is used in AWT event-handlers or separate threads launched to perform some actions. When a separate thread is launched (either explicitly or via an AWT event-handler), it is good practice to explicitly set the WTContext using the ThreadGroup captured in the constructor of this dialog.

Parameters:
context_on - if true, the WTContext is set using the ThreadGroup captured in the constructor of this dialog; otherwise, the WTContext is set to null.
See Also:
getContext(), WTContext

setParentApplet

public void setParentApplet(Applet parent_applet)
Deprecated. the Applet is no longer used for context

setParentApplet was previously used to set the Applet which provided context for this dialog. Since the Applet is no longer used by this dialog, this method is deprecated.


getParentApplet

public Applet getParentApplet()
Deprecated. the Applet is no longer used for context

getParentApplet was previously used to return the Applet which provided context for this dialog. Since the applet is no longer used by this dialog, this method is deprecated.

Returns:
the Applet which formerly provided context for this dialog

setSelectionLabel

public void setSelectionLabel(String label)
Sets the label which is associated with the currently selected value.

Parameters:
label - the String label to use as the label associated with the currently selected value.

initializeCabinets

private void initializeCabinets()
Method to retrieve the initial list of Cabinets to be displayed by this browser. This method retrieves, but does not display the cabinets.

See Also:
Cabinet

showMessageDialog

private void showMessageDialog(String message,
                               boolean modal)
Display a message dialog with the given string message. The given boolean indicates whether or not the dialog should be displayed as modal.

Parameters:
message - the String message to display
modal - a boolean indicating whether or not the dialog should be displayed as modal

setStatus

private void setStatus(String status)
Method setStatus is a convenience method used to set the text of the status bar.

Parameters:
status - the String value to display in the status bar.

enableActions

private void enableActions(boolean enable)
Method enableActions controls whether or not actions are available in this dialog.

Parameters:
enable - if true, actions are enabled; if false, actions are disabled.

getLocalizedLabel

protected String getLocalizedLabel(String key,
                                   Object[] params)
Convenience method for returing a string message retrieved from the resource bundle associated with this class. The given string specifies the key in the resource bundle, and the given array of objects contains any parameters for formatting the message.

Parameters:
key - the String resource bundle key
params - and parameters to be used in formatting the string
Returns:
the string message retrieved from the resource bundle.

retrieveCabinets

private Cabinet[] retrieveCabinets()
                            throws WTException
Retrieves the cabinets that will be displayed in the cabinet drop-down. If a permission has been set on this dialog, that permission is used to control which cabinets are retrieved.

Throws:
WTException

hasPermission

private boolean hasPermission()
Returns a boolean value which indicates whether or not a permission has been set on this dialog to use to control which cabinets, folders and objects to display.

Returns:
true, if a permission has been set to control the objects to display

setCabinets

public void setCabinets(Cabinet[] cabinets)
Method setCabinets sets the list of Cabinets which can be browsed in this dialog. This method initializes the combobox of Cabinet names with the given list of Cabinets.

Parameters:
cabinets - the array of Cabinet items to be displayed and browsed in this dialog.
See Also:
getCabinets()

getCabinets

public Cabinet[] getCabinets()
Returns the array of Cabinets which can be browsed and selected in this dialog.

See Also:
setCabinets(wt.folder.Cabinet[])

getFolderEntry

public CabinetBased getFolderEntry()
Method getFolderEntry returns the CabinetBased object selected in this dialog.

See Also:
CabinetBased

initCabinetCombobox

private void initCabinetCombobox()
Method to initialize the combobox of Cabinet choices with the names of the cabinets. The names of the cabinets are sorted alphabetically before being added to the combobox.

See Also:
Cabinet, Sorting

initCabinetRoot

private void initCabinetRoot()
Initialize the String which represents the root of all cabinets.


initializeIconCache

private void initializeIconCache()
Method to initialize the cache of icons displayed in this dialog. The IconCache must be initialized before being used.

See Also:
IconCache

findCabinet

private Cabinet findCabinet(String cabinet_name)
Retrieves the Cabinet object from the array of cabinets based upon the given cabinet name.

Parameters:
cabinet_name - the String name of the cabinet to retrieve
Returns:
the Cabinet with the given name, or null if no cabinet matching the given name if found.

sortFolderEntries

private Vector sortFolderEntries(Enumeration entries)
Method sortFolderEntries sorts the given enumeration of CabinetBased objects. The objects are sorted based upon their type (i.e. Folder, Part) and returned as a vector of CabinetBased objects. All objects of type Folder are separated out and placed first in the sorting order.

Parameters:
entries - an Enumeration containing objects of type FolderEntry to be sorted.
Returns:
a Vector of CabinetBased objects in which the objects are in sorted order based upon their type.
See Also:
Enumeration, CabinetBased

displayCabinets

private void displayCabinets()
Display the cabinets as the contents of the table.


addSubFolder

private void addSubFolder(int row,
                          int col,
                          Folder folder)
Method addSubFolder adds the given Folder to the table of folder contents displayed by this dialog.

Parameters:
row - specifies the row in which to place the given object in the table
col - specifies the column in which to place the given object in the table
folder - the Folder object to be displayed in the table

getStandardIcon

private Image getStandardIcon(Object object)
Method getStandardIcon attempts to retrieve the Image which is associated with the given Object. This method utilizes the IconCache to retrieve the Image.

Parameters:
object - the Object for which an Image is to be retrieved
Returns:
the Image which corresponds to the given Object
See Also:
IconCache

addFolderEntry

private void addFolderEntry(int row,
                            int col,
                            FolderEntry object)
Method addFolderEntry adds the given FolderEntry to the table of folder contents displayed by this dialog.

Parameters:
row - specifies the row in which to place the given object in the table
col - specifies the column in which to place the given object in the table
object - the FolderEntry object to be displayed in the table

isChoosable

private boolean isChoosable(Object entry)
Method isChoosable determines whether a given object can be chosen and consequently displayed in the table of folder contents of this dialog. If the particular class of the given object is an element in the disallowedClasses, then the given object is not choosable. Otherwise, if the list of allowedClasses is not null, but does not contain the class of the given object, then the object is not choosable. If both the list of allowedClasses and disAllowed classes are empty, then the given object is considered to be choosable.

Parameters:
entry - the Object whose ability to be chosen in the table of this dialog is determined
Returns:
true if the object can be chosen; false otherwise
See Also:
addAllowedClass(java.lang.Class), addDisallowedClass(java.lang.Class)

contains

private boolean contains(Object item,
                         Vector container)
Method contains determines whether or not the given Vector contains the class corresponding to the given Object. If the given object is an instance of any of the classes in the given vector, the object is considered to be contained in the given Vector, and true is returned. This method is used by isChoosable to determine whether or not a particular object is available to be selected.

Parameters:
item - the Object whose class is searched for in the given Vector
container - the Vector of classes to be searched for the class of the given Object.
Returns:
true if the given object is an instance of a of the classes contained in the given Vector; false otherwise

getObjectKey

private String getObjectKey(CabinetBased the_object)
Method getObjectKey returns a key value to be used as the key associated with the given object in the hashmap of folder contents.

Parameters:
the_object - the CabinetBased object whose key value is returned.
Returns:
the String key value corresponding to the given object.

addAllowedClass

public void addAllowedClass(Class allowed_class)
Method addAllowedClass is used to control which type (Class) of object can be displayed in the table of this dialog. If the list of allowed classes is not null, then an object is only displayed in the table of folder contents if that object has a class type that is contained in the list of allowed classes.

Note that the list of allowed classes and the list of disallowed classes are mutually exclusive. That is, if the list of disallowed classes is non-empty, a particular folder entry will always be displayed in the table as long as its class type is not in the list of disallowed classes, regardless of the entries in the list of allowed classes. If the list of disallowed classes is empty, and the list of allowed classes is non-empty, then an object will only be displayed if its class type is found in the list of allowed classes. If both the list of allowed classes and the list of disallowed classes are empty, then a particular folder entry will always be displayed.

Parameters:
allowed_class - the Class to be added to the list of classes which can be displayed in the table of folder contents.
See Also:
addDisallowedClass(java.lang.Class)

addDisallowedClass

public void addDisallowedClass(Class disallowed_class)
Method addDisallowedClass is used to control which type (Class) of object can be displayed in the table of this dialog. If the list of disallowed classes is not null, then an object is only displayed in the table of folder contents if that object has a class type that is not contained in the list of disallowed classes.

Note that the list of allowed classes and the list of disallowed classes are mutually exclusive. That is, if the list of disallowed classes is non-empty, a particular folder entry will always be displayed in the table as long as its class type is not in the list of disallowed classes, regardless of the entries in the list of allowed classes. If the list of disallowed classes is empty, and the list of allowed classes is non-empty, then an object will only be displayed if its class type is found in the list of allowed classes. If both the list of allowed classes and the list of disallowed classes are empty, then a particular folder entry will always be displayed.

Parameters:
disallowed_class - the Class to be added to the list of classes which cannot be displayed in the table of folder contents.
See Also:
addAllowedClass(java.lang.Class)

setFolderPermission

public void setFolderPermission(String permission)
Method setFolderPermission sets a permission which is used in filtering the folder contents which are retrieved. If a permission is given, when the contents of a folder are retrieved, only those folder contents for which the user has this permission are retrieved. For example:
       WTFolderBrowserDialog browser =
                         new WTFolderBrowserDialog( some_frame, true );
       browser.setFolderPermission( WTPermission.MODIFY );
       browser.setInitializeCabinets( true );
       browser.show();
  
will only display those folder contents for which the current user has modify permissions.

Parameters:
permission - the String permission which specifies the permission which the current user must have in order to be able to see a particular object.
See Also:
WTPermission, getFolderPermission()

getFolderPermission

public String getFolderPermission()
Method getFolderPermission returns the permission which is used in filtering the folder contents which are retrieved. If a permission is given, when the contents of a folder are retrieved, only those folder contents for which the user has this permission are retrieved. For example:
       WTFolderBrowserDialog browser =
                         new WTFolderBrowserDialog( some_frame, true );
       browser.setFolderPermission( WTPermission.MODIFY );
       browser.setInitializeCabinets( true );
       browser.show();
  
will only display those folder contents for which the current user has modify permissions.

Returns:
the String permission which specifies the permission which the current user must have in order to be able to see a particular object.
See Also:
WTPermission, setFolderPermission(java.lang.String)

processCancelCommand

protected void processCancelCommand()
Method which handles the cancelling, or closing, of this dialog. This method sets the selected folder entry to null, notifies the WTFolderBrowserListeners that this dialog is being closed, and then closes this dialog.


processOkCommand

protected void processOkCommand()
Method which handles the closing of this dialog. This method is ultimately invoked in response to the user pressing the OK button. This method notifies the WTFolderBrowserListeners that this dialog is being closed and then closes this dialog.


setInitializeCabinets

public void setInitializeCabinets(boolean initialize_cabinets)
Method setInitializeCabinets is used to indicate whether or not this dialog should initialize the list of Cabinets to be displayed. If the given boolean value is true, this dialog will retrieve the list of Cabinets from the database, and will initialize the combobox of cabinet names. If the given value is false, the list of Cabinets will not be initialized and must be explicitly set via setCabinets.

Parameters:
initialize_cabinets - if true, this dialog will initialize the list of Cabinets to be displayed
See Also:
setInitializeCabinets(boolean,String)

setInitializeCabinets

public void setInitializeCabinets(boolean initialize_cabinets,
                                  String permission)
Method setInitializeCabinets is used to indicate whether or not this dialog should initialize the list of Cabinets to be displayed. If the given boolean value is true, this dialog will retrieve the list of Cabinets from the database, and will initialize the combobox of cabinet names. If the given value is false, the list of Cabinets will not be initialized and must be explicitly set via setCabinets.

The String permission is used to filter the Cabinets and Folders which will be displayed to the user. When the contents of a Cabinet or Folder is retrieved, only those contents for which the user has the given permission will be displayed. For example, a frame to create a new document may include a means for invoking a WTFolderBrowserDialog to allow the user to pick the location in which to create the document. However, the dialog should only display those cabinets and folders for which the user has permission to modify, since creating a document in a particular folder may require having modify permissions on that folder. Eg:

    WTFolderBrowserDialog browser = new WTFolderBrowserDialog( my_frame, true );
    browser.setInitializeCabinets( true, WTPermission.MODIFY );
    browser.show();
  

Parameters:
initialize_cabinets - if true, this dialog will initialize the list of Cabinets to be displayed
permission - the String permission. When the contents of a selected Cabinet or Folder are retrieved, only those contents for which the current user has this permission will be retrieved.
See Also:
#setInitializeCabinets(), WTPermission

isInitializeCabinets

public boolean isInitializeCabinets()
Returns a boolean value which indicates whether or not this dialog is set to initialize the list of Cabinets to be displayed.

Returns:
if true, this dialog will initialize the list of Cabinets

updateFoldersOnlyFlag

private void updateFoldersOnlyFlag()
Updates the flag indicating whether or not this dialog displays only folders. This flag is updated according to the entries in the vector of Allowed classes and the vector of disallowed classes.


isFoldersOnly

public boolean isFoldersOnly()

setFoldersOnly

public void setFoldersOnly(boolean folders_only)

processCabinetSelect

private void processCabinetSelect()

setFolderEntry

private void setFolderEntry(CabinetBased cabinet_based)

setStartingFolder

public void setStartingFolder(Folder folder)
                       throws WTException
Initializes this dialog to be opened to the given Folder. The given folder is set as the current folder of this dialog, and the contents of that folder are displayed.

Parameters:
folder - the starting folder of this dialog
Throws:
WTException - if an error occurs retrieving the contents of the given folder

setStartingFolder

public void setStartingFolder(String folder_path)
                       throws FolderException,
                              WTException
Initializes this dialog to be opened to the Folder associated with the given folder path. The folder associated with the given folder path is set as the current folder of this dialog, and the contents of that folder are displayed.

Parameters:
folder_path - the String path corresponding to the starting folder of this dialog
Throws:
FolderException - if an error occurs retrieving the contents of the folder
WTException - if an error occurs retrieving the contents of the folder

addListener

public void addListener(WTFolderBrowserListener a_listener)
Method addListener adds the given WTFolderBrowserListener to receive notification when this dialog is closed.

Parameters:
a_listener - the WTFolderBrowserListener interested in receiving notification when this dialog closes
See Also:
removeListener(wt.clients.gui.WTFolderBrowserListener), WTFolderBrowserEvent, WTFolderBrowserListener

removeListener

public void removeListener(WTFolderBrowserListener a_listener)
Method removeListener removes the given WTFolderBrowserListener from the list of listeners to WTFolderBrowserEvent events. The given listener will no longer receive notification when this dialog is closed. If the given listener is not currently contained in the list, no action is taken and the list is not modified.

Parameters:
a_listener - the WTFolderBrowserListener to be removed from receiving notification when this dialog closes
See Also:
addListener(wt.clients.gui.WTFolderBrowserListener), WTFolderBrowserEvent, WTFolderBrowserListener

notifyBrowserListeners

private void notifyBrowserListeners(WTFolderBrowserEvent an_event)
Method to notify all WTFolderBrowserListeners when a WTFolderBrowserEvent has been generated.

Parameters:
an_event - the WTFolderBrowserEvent which the WTFolderBrowserListeners will be notified of
See Also:
addListener(wt.clients.gui.WTFolderBrowserListener), removeListener(wt.clients.gui.WTFolderBrowserListener), WTFolderBrowserEvent, WTFolderBrowserListener

updateTable

private void updateTable()
                  throws WTException
Method updateTable updates the table of Folder contents when a new Folder is chosen as the current Folder. If the contents of the current folder have not yet been retrieved and displayed, this method will retrieve the folder contents. Otherwise, the folder contents will be retrieved from the hashmap maintaining the folder contents. This method will display a message in the status bar while the contents of the folder are being retrieved and displayed.

Throws:
WTException - if an error occurs retrieving the folders from the database.

getSubFolders

private SortedEnumeration getSubFolders(Folder folder)
                                 throws WTException
Throws:
WTException

getCabinetContents

private void getCabinetContents()
Method getCabinetContents is ultimately invoked as a result of the user selecting a Cabinet from the combobox of cabinet names. This method sets the current folder to be the cabinet currently selected in the combobox. The table is updated to display the contents to the selected cabinet.


setCurrentFolder

private void setCurrentFolder(Folder folder)

cabinetComboBox_ItemStateChanged

void cabinetComboBox_ItemStateChanged(ItemEvent event)

upButton_actionPerformed

void upButton_actionPerformed(jclass.bwt.JCActionEvent event)

processUpCommand

private void processUpCommand()

chooserTable_mouseClicked

void chooserTable_mouseClicked(MouseEvent event)

processTableSelect

protected void processTableSelect(MouseEvent event)

okButton_ActionPerformed

void okButton_ActionPerformed(ActionEvent event)

okButton_KeyPressed

void okButton_KeyPressed(KeyEvent event)

cancelButton_ActionPerformed

void cancelButton_ActionPerformed(ActionEvent event)

cancelButton_KeyPressed

void cancelButton_KeyPressed(KeyEvent event)