|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.pietschy.command.Command
com.pietschy.command.ActionCommand
com.pietschy.command.file.AbstractFileCommand
com.pietschy.command.file.AbstractFileOpenCommand
public abstract class AbstractFileOpenCommand
An abstract class that provides generic file open behaviour. On execution, the command will display
a JFileChooser and if the selection is successful performOpen(java.io.File[]) will be
invoked with the selected files. Subclasses must implement performOpen(java.io.File[]) to implement
the required behaviour.
Subclasses can change the default settings by overriding AbstractFileCommand.prepareFileChooser() and configuring
appropriately.
| Field Summary | |
|---|---|
static java.lang.String |
FILE_TO_OPEN
If specified as a parameter the command will bypass the chooser dialog and open the file directly. |
| Fields inherited from class com.pietschy.command.ActionCommand |
|---|
PARAMETER_ACTION_EVENT, PARAMETER_INVOKER, PARAMETER_INVOKER_WINDOW, PARAMETER_MODIFIERS |
| Fields inherited from class com.pietschy.command.Command |
|---|
internalLog, PROPERTY_ENABLED, PROPERTY_VISIBLE |
| Constructor Summary | |
|---|---|
AbstractFileOpenCommand(java.lang.String id,
javax.swing.filechooser.FileFilter... filters)
Creates a new command with the specified id and list of FileFilter |
|
| Method Summary | |
|---|---|
protected void |
handleExecute()
Main entry point for command subclasses that must be implemented to provide command specific behaviour. |
boolean |
isMultiselectionEnabled()
Checks if multiple selection is enabled. |
protected void |
performFileAction(java.io.File[] files,
javax.swing.JFileChooser chooser,
java.awt.Component centerOn)
Simply delegates to performOpen(File[]). |
protected abstract void |
performOpen(java.io.File[] files)
This method is called when the user selects one or more files to open. |
void |
setMultiselectionEnabled(boolean multiselectionEnabled)
Configures if the JFileChooser allows multiple selection. |
protected int |
showChooserDialog(javax.swing.JFileChooser chooser,
java.awt.Component centerOn)
Shows the standard file open chooser. |
| Methods inherited from class com.pietschy.command.file.AbstractFileCommand |
|---|
beforeProceeding, getComponentToCenterOn, getDefaultFileFilter, handleCancel, handleError, isAcceptAllFileFilterUsed, isRememberLastFilter, prepareFileChooser, setAcceptAllFileFilterUsed, setDefaultFileFilter, setRememberLastFilter, setSelectedFile, setSelectedFiles |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.pietschy.command.ActionCommandExecutor |
|---|
addPropertyChangeListener, addPropertyChangeListener, isEnabled, removePropertyChangeListener, removePropertyChangeListener |
| Methods inherited from interface com.pietschy.command.Identifiable |
|---|
getId |
| Field Detail |
|---|
public static final java.lang.String FILE_TO_OPEN
| Constructor Detail |
|---|
public AbstractFileOpenCommand(java.lang.String id,
javax.swing.filechooser.FileFilter... filters)
FileFilter
id - the id of the command.filters - a list of FileFilter instances to use.| Method Detail |
|---|
protected int showChooserDialog(javax.swing.JFileChooser chooser,
java.awt.Component centerOn)
showChooserDialog in class AbstractFileCommandchooser - the chooser instance.centerOn - the component on which to center the chooser.
JFileChooser.showOpenDialog(Component).
protected void performFileAction(java.io.File[] files,
javax.swing.JFileChooser chooser,
java.awt.Component centerOn)
performOpen(File[]).
performFileAction in class AbstractFileCommandfiles - the files selected in the chooser.chooser - the chooser that was used.centerOn - the component on which to center any subsequent dialogs.public boolean isMultiselectionEnabled()
public void setMultiselectionEnabled(boolean multiselectionEnabled)
JFileChooser allows multiple selection.
multiselectionEnabled - true to allow multiple file selection, false
otherwise.protected void handleExecute()
ActionCommand
This method should never be called directly to invoke a command. All
command invocation must be performed using the ActionCommand.execute() and
ActionCommand.execute(Map) methods.
handleExecute in class AbstractFileCommandprotected abstract void performOpen(java.io.File[] files)
If multiple selection is disabled, the file list will
contain only one file.
files - the files that the user has selected.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||