public static class AJFileChooser.DefaultDeleter extends AJFileChooser.Deleter
DefaultDeleter
is the default implementation of
Deleter abstract class.
Be careful: this abstract class doesn't provide any way to delete
non-empty subdirectory containing files that are not used
by any choosable file filter. To delete such subdirectories,
canDelete
method should be overrided.Modifier and Type | Field and Description |
---|---|
protected AJFileChooser |
fileChooser |
Constructor and Description |
---|
AJFileChooser.DefaultDeleter(AJFileChooser fileChooser) |
Modifier and Type | Method and Description |
---|---|
boolean |
canDelete(java.io.File f)
Returns true if and only if
f
is a usual file or an empty directory. |
void |
canDeleteStatusChanged(boolean b)
Does nothing in this implementation.
|
boolean |
delete(java.io.File[] files)
Tries to delete files/subdirectories by the recursive delete function.
|
protected boolean |
showConfirmationMessage(java.awt.Component parent,
java.io.File[] files)
Used by
delete method to show confirmation message. |
protected void |
showErrorMessage(java.awt.Component parent,
java.io.File[] errorFiles)
Used by
delete method to show error message. |
canDelete
protected AJFileChooser fileChooser
public AJFileChooser.DefaultDeleter(AJFileChooser fileChooser)
fileChooser
- - an instance of AJFileChooser used together
with this deleter. Is is used as parentComponent
argument for JOptionPane methods.public boolean canDelete(java.io.File f)
f
is a usual file or an empty directory.canDelete
in class AJFileChooser.Deleter
public boolean delete(java.io.File[] files)
canDelete
method returns false.
Before deletion, this method shows confirmation message. If the user answers "No", this method does nothing.
delete
in class AJFileChooser.Deleter
protected boolean showConfirmationMessage(java.awt.Component parent, java.io.File[] files)
delete
method to show confirmation message.
The simplest way to disable confirmation is to override this
method by an empty one.protected void showErrorMessage(java.awt.Component parent, java.io.File[] errorFiles)
delete
method to show error message.public void canDeleteStatusChanged(boolean b)
canDeleteStatusChanged
in class AJFileChooser.Deleter
b
- - new value of AJFileChooser.canDeleteSelectedFiles()
result