|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.pietschy.command.Command
org.pietschy.command.ActionCommand
org.pietschy.command.file.AbstractFileCommand
org.pietschy.command.file.AbstractFileOpenCommand
public abstract class AbstractFileOpenCommand
The command provides generic file open behaviour. One 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.getFileChooser()
and configuring
appropriately.
Field Summary |
---|
Fields inherited from class org.pietschy.command.ActionCommand |
---|
HINT_ACTION_EVENT, HINT_INVOKER, HINT_INVOKER_WINDOW, HINT_MODIFIERS |
Fields inherited from class org.pietschy.command.Command |
---|
internalLog, listenerList, pcs |
Constructor Summary | |
---|---|
AbstractFileOpenCommand(CommandManager manager,
java.lang.String id,
javax.swing.filechooser.FileFilter filter)
Creates a new command with the specified id and FileFilter |
|
AbstractFileOpenCommand(CommandManager manager,
java.lang.String id,
javax.swing.filechooser.FileFilter[] filters)
Creates a new command with the specified id and list of FileFilter |
|
AbstractFileOpenCommand(java.lang.String id,
javax.swing.filechooser.FileFilter filter)
Creates a new command with the specified id and FileFilter . |
|
AbstractFileOpenCommand(java.lang.String id,
javax.swing.filechooser.FileFilter[] filters)
Creates a new command with the specified id and list of FileFilter . |
Method Summary | |
---|---|
boolean |
isMultiselectionEnabled()
Checks if multiple selection is enabled. |
protected void |
performFileAction(java.io.File[] files,
javax.swing.JFileChooser chooser,
java.awt.Window invoker)
This method is invoked if the AbstractFileCommand.showChooserDialog(javax.swing.JFileChooser, java.awt.Window) returns
JFileChooser.APPROVE_OPTION . |
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.Window invoker)
Called to display the JFileChooser . |
Methods inherited from class org.pietschy.command.file.AbstractFileCommand |
---|
afterExecute, beforeExecute, confirmProceed, getDefaultFileFilter, getFileChooser, handleCancel, handleError, handleExecute, isAcceptAllFileFilterUsed, isCenterOnInvoker, isRememberLastFilter, setAcceptAllFileFilterUsed, setCenterOnInvoker, setDefaultFileFilter, setRememberLastFilter |
Methods inherited from class org.pietschy.command.ActionCommand |
---|
addCommandListener, addInterceptor, areEqual, attach, configureButtonStates, detach, execute, execute, getActionAdapter, getActionAdapter, getActionCommand, getActionEvent, getHint, getHint, getHints, getInvoker, getInvokerWindow, getModifiers, installShortCut, installShortCut, postExecute, preExecute, putHint, putHints, removeCommandListener, removeInterceptor, requestDefautIn, setActionCommand, uninstallShortCut, uninstallShortCut |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.pietschy.command.ActionCommandExecutor |
---|
addPropertyChangeListener, addPropertyChangeListener, isEnabled, removePropertyChangeListener, removePropertyChangeListener |
Constructor Detail |
---|
public AbstractFileOpenCommand(java.lang.String id, javax.swing.filechooser.FileFilter filter)
FileFilter
. This command is bound
to the default command manager.
id
- the id of the command.filter
- the FileFilter
to use.public AbstractFileOpenCommand(java.lang.String id, javax.swing.filechooser.FileFilter[] filters)
FileFilter
. This command is
bound to the default command manager.
id
- the id of the command.filters
- a list of FileFilter
instances to use.public AbstractFileOpenCommand(CommandManager manager, java.lang.String id, javax.swing.filechooser.FileFilter filter)
FileFilter
id
- the id of the command.filter
- the FileFilter
to use.public AbstractFileOpenCommand(CommandManager manager, 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.Window invoker)
AbstractFileCommand
JFileChooser
. Subclasses override to display an appropriate
version of the chooser (such as an open or save dialog). This method must return the result
of the JFileChooser
show method. Eg.
protected int showChooserDialog(JFileChooser chooser, Window invoker) { return chooser.showOpenDialog(invoker); }
showChooserDialog
in class AbstractFileCommand
chooser
- the chooser to display
JFileChooser.showDialog(java.awt.Component, java.lang.String)
, JFileChooser.showOpenDialog(java.awt.Component)
or
JFileChooser.showSaveDialog(java.awt.Component)
.protected void performFileAction(java.io.File[] files, javax.swing.JFileChooser chooser, java.awt.Window invoker)
AbstractFileCommand
AbstractFileCommand.showChooserDialog(javax.swing.JFileChooser, java.awt.Window)
returns
JFileChooser.APPROVE_OPTION
. Subclasses must override to perform the specific file
operation.
performFileAction
in class AbstractFileCommand
files
- the files that were selected in the JFileChooser
chooser
- the JFileChooser
that was displayed.invoker
- the owner window.public boolean isMultiselectionEnabled()
public void setMultiselectionEnabled(boolean multiselectionEnabled)
JFileChooser
allows multiple selection.
multiselectionEnabled
- true to allow multiple file selection, false
otherwise.protected 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 |