com.jtechlabs.ui.widget.directorychooser
Class DirectoryChooserDefaultHandler

java.lang.Object
  extended bycom.jtechlabs.ui.widget.directorychooser.DirectoryChooserDefaultHandler
All Implemented Interfaces:
DirectoryChooserConfirmationListener, DirectoryChooserErrorListener, DirectoryChooserNameRequestListener, DirectoryChooserSelectionListener, java.util.EventListener

public class DirectoryChooserDefaultHandler
extends java.lang.Object
implements DirectoryChooserSelectionListener, DirectoryChooserErrorListener, DirectoryChooserNameRequestListener, DirectoryChooserConfirmationListener

Default base class for JDirectoryChooser event handlers.

It provides default implementations for all of the callbacks in the directory chooser event listeners.

Developers can extend this class when they need to implement custom event handling procedure.

Version:
1.0
Author:
Aleksey Prochukhan

Constructor Summary
DirectoryChooserDefaultHandler()
           
 
Method Summary
 void copyError(DirectoryChooserErrorEvent event)
          Recieves notification of the directory copying error.
 void createError(DirectoryChooserErrorEvent event)
          Recieves notification of the directory creating error.
 void deleteConfirmation(DirectoryChooserConfirmationEvent event)
          Called whenever users tries to delete a directory.
 void deleteError(DirectoryChooserErrorEvent event)
          Recieves notification of the directory deleting error.
 void generalError(DirectoryChooserErrorEvent event)
          Recieves notification of all unknown errors occured.
 void getDirectoryName(DirectoryChooserNameRequestEvent event)
          Called when JDirectoryChooser requests for the new directory name in order to proceed with execution of the current operation (For example: when creating the new directory, or renaming the existing directory).
 void moveConfirmation(DirectoryChooserConfirmationEvent event)
          Called whenever users tries to move a directory.
 void moveError(DirectoryChooserErrorEvent event)
          Recieves notification of the directory moving error.
 void renameError(DirectoryChooserErrorEvent event)
          Recieves notification of the directory renaming error.
 void valueChanged(DirectoryChooserSelectionEvent event)
          Called whenever the selection in a JDirectoryChooser changes.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryChooserDefaultHandler

public DirectoryChooserDefaultHandler()
Method Detail

valueChanged

public void valueChanged(DirectoryChooserSelectionEvent event)
Called whenever the selection in a JDirectoryChooser changes.

By default, does nothing. Developers may override this method in a subclass to handle directory selection change event (for example, to display currently selected directory path in the text field).

Specified by:
valueChanged in interface DirectoryChooserSelectionListener
Parameters:
event - the event object that contains information about new selection.

getDirectoryName

public void getDirectoryName(DirectoryChooserNameRequestEvent event)
Called when JDirectoryChooser requests for the new directory name in order to proceed with execution of the current operation (For example: when creating the new directory, or renaming the existing directory).

By default, it asks user to enter the new name of the directory using JOptionPane.showInputDialog() functionality. Developer may override this method in a subclass to handle process of getting the new name for the directory (such as displaying custom input dialog, etc).

Specified by:
getDirectoryName in interface DirectoryChooserNameRequestListener
Parameters:
event - the event object notifies about request to provide the JDirectoryChooser component with new name for the directory. This method should call event.setName("new name") in order to provide JDirectoryChooser component with name of the new subdirectory. If operation should be canceled, the following call should be performed event.setName(null)

deleteConfirmation

public void deleteConfirmation(DirectoryChooserConfirmationEvent event)
Called whenever users tries to delete a directory.

By default, displays confirmation message using JOptionPane.showConfirmDialog() functionality. Developer may override this method in a subclass to control directory deleting process (For example, by displaying custom confirmation message, writing message to the log, etc).

Specified by:
deleteConfirmation in interface DirectoryChooserConfirmationListener
Parameters:
event - the event object that contains information about directory being deleted. This method should call event.setConfirmed(true) in order to confirm delete operation or call event.setConfirmed(false) in order to cancel delete operation.

moveConfirmation

public void moveConfirmation(DirectoryChooserConfirmationEvent event)
Called whenever users tries to move a directory.

Specified by:
moveConfirmation in interface DirectoryChooserConfirmationListener
Parameters:
event - the event object that contains information about directory being moved. This method should call event.setConfirmed(true) in order to confirm move operation or call event.setConfirmed(false) in order to cancel move operation.

createError

public void createError(DirectoryChooserErrorEvent event)
Recieves notification of the directory creating error.

By default, displays error message using JOptionPane.showMessageDialog() functionality. Developer may override this method in a subclass to handle directory creating errors (For example, by displaying custom error message, writing error message to the log...).

Specified by:
createError in interface DirectoryChooserErrorListener
Parameters:
event - the event object that contains information about an error.

deleteError

public void deleteError(DirectoryChooserErrorEvent event)
Recieves notification of the directory deleting error.

By default, displays error message using JOptionPane.showMessageDialog() functionality. Developer may override this method in a subclass to handle directory deleting errors (For example, by displaying custom error message, writing error message to the log...).

Specified by:
deleteError in interface DirectoryChooserErrorListener
Parameters:
event - the event object that contains information about an error.

moveError

public void moveError(DirectoryChooserErrorEvent event)
Recieves notification of the directory moving error.

By default, displays error message using JOptionPane.showMessageDialog() functionality. Developer may override this method in a subclass to handle directory moving errors (For example, by displaying custom error message, writing error message to the log...).

Specified by:
moveError in interface DirectoryChooserErrorListener
Parameters:
event - the event object that contains information about an error.

copyError

public void copyError(DirectoryChooserErrorEvent event)
Recieves notification of the directory copying error.

By default, displays error message using JOptionPane.showMessageDialog() functionality. Developer may override this method in a subclass to handle directory copying errors (For example, by displaying custom error message, writing error message to the log...).

Specified by:
copyError in interface DirectoryChooserErrorListener
Parameters:
event - the event object that contains information about an error.

renameError

public void renameError(DirectoryChooserErrorEvent event)
Recieves notification of the directory renaming error.

By default, displays error message using JOptionPane.showMessageDialog() functionality. Developer may override this method in a subclass to handle directory renaming errors (For example, by displaying custom error message, writing error message to the log...).

Specified by:
renameError in interface DirectoryChooserErrorListener
Parameters:
event - the event object that contains information about an error.

generalError

public void generalError(DirectoryChooserErrorEvent event)
Recieves notification of all unknown errors occured. By default does nothing. Developer may override this method in a subclass to handle general errors himself. This method was developed for debug purposes. Current verions of JDirectoryChooser component is very stable and does not generate unexpected errors.

Specified by:
generalError in interface DirectoryChooserErrorListener
Parameters:
event - the event object that contains information about an error.


Copyright © 2005 JTechLabs.com All Rights Reserved.