|
|||||||||
| 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.group.CommandGroup
com.pietschy.command.file.RecentFileList
public class RecentFileList
Provides a group for selecting from a list of recently used files. A
RecentFileListModel must be specified to provide the file list and an
ActionCommandExecutor specified to perform the open operation. The file to be
opened is passed to the executor as the named parameter AbstractFileOpenCommand.FILE_TO_OPEN.
AbstractFileOpenCommand automatically checks for this parameter and
invokes performOpen(File[]) directly with
out displaying the chooser. This allows you to use an existing file open command as the executor
with no additional coding.
The class also includes a command for clearing the list. The text for the clear command is
configured from the clearText property of the group. If the property isn't defined, the
value Clear will be used. The clear command is hidden by default, to make it visible
simply call getClearCommand().setVisible(true);
DefaultRecentFileListModel| Field Summary |
|---|
| Fields inherited from class com.pietschy.command.Command |
|---|
internalLog, PROPERTY_ENABLED, PROPERTY_VISIBLE |
| Constructor Summary | |
|---|---|
RecentFileList(RecentFileListModel model)
Creates a new anonymous instance with the specified RecentFileListModel. |
|
RecentFileList(RecentFileListModel model,
ActionCommandExecutor openExecutor)
Creates a new anonymous instance with the specified RecentFileListModel and
open executor. |
|
RecentFileList(java.lang.String id,
RecentFileListModel model)
Creates a new instance with the specified id and RecentFileListModel. |
|
RecentFileList(java.lang.String id,
RecentFileListModel model,
ActionCommandExecutor openExecutor)
Creates a new instrance with the specified id, RecentFileListModel and
open executor. |
|
| Method Summary | |
|---|---|
void |
clear()
Clears the model backing this instance. |
void |
clearExcludedFiles()
Clears the current list of excluded files. |
protected javax.swing.KeyStroke |
getAcceleratorForIndex(int index)
Returns the accelerator to use for the file at the specified index. |
int |
getAcceleratorModifiers()
Gets the modifiers that are used to create the accelerators. |
ActionCommand |
getClearCommand()
Gets the ActionCommand that clears the files from the group. |
protected com.pietschy.command.file.RecentFileList.OpenCommand |
getCommandFor(java.io.File file)
Gets the command that opens the specified file. |
int |
getDisplaySize()
Gets the number of files the group will display at any one time. |
java.io.File[] |
getExcludedFiles()
Gets the file that is currently excluded from the list or null if all the files are included. |
RecentFileListModel |
getModel()
Gets this commands data model. |
protected void |
initialise()
Initialises the command internals. |
(package private) void |
installAccelerator(Face face,
int index)
Installs an accelerator for the specified index on the specified face. |
boolean |
isAccelerated()
Checks if the list will have accelerator for each entry. |
boolean |
isIncludeNonExistentFiles()
Checks if the group should include files for which File.exists() returns
false. |
void |
setAccelerated(boolean accelerated)
Configures the group to installFace accelerators for the list. |
void |
setAcceleratorModifiers(int acceleratorModifiers)
Sets the modifiers that are used to create the accelerators. |
void |
setDisplaySize(int displaySize)
Configures the number of files to display in the group. |
void |
setExcludedFile(java.io.File excludedFile)
Sets the file to exclude from the list. |
void |
setExcludedFiles(java.util.Collection<java.io.File> excludedFiles)
Sets the file to exclude from the list. |
void |
setExcludedFiles(java.io.File[] excludedFiles)
Sets the file to exclude from the list. |
void |
setIncludeNonExistentFiles(boolean includeNonExistentFiles)
Configures if the group should include files for which File.exists() returns
false. |
void |
setModel(RecentFileListModel model)
Sets the model for this command to use. |
void |
setOpenExecutor(ActionCommandExecutor openExecutor)
Sets the open executor that this command will use to perform the file open operation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public RecentFileList(RecentFileListModel model)
RecentFileListModel.
public RecentFileList(RecentFileListModel model,
ActionCommandExecutor openExecutor)
RecentFileListModel and
open executor.
public RecentFileList(java.lang.String id,
RecentFileListModel model)
RecentFileListModel.
public RecentFileList(java.lang.String id,
RecentFileListModel model,
ActionCommandExecutor openExecutor)
RecentFileListModel and
open executor.
| Method Detail |
|---|
protected void initialise()
public RecentFileListModel getModel()
public void setModel(RecentFileListModel model)
model for this command to use.
model - the model to use.DefaultRecentFileListModelpublic void setOpenExecutor(ActionCommandExecutor openExecutor)
AbstractFileOpenCommand.FILE_TO_OPEN.
Instances of AbstractFileOpenCommand automatically check for this parameter
and bypass the opening of the file chooser.
openExecutor - the ActionCommandExecutor that will handle the file
open operation.public ActionCommand getClearCommand()
public int getDisplaySize()
public void setDisplaySize(int displaySize)
displaySize - the number of files to display in the group.public boolean isIncludeNonExistentFiles()
File.exists() returns
false. The default value is false.
public void setIncludeNonExistentFiles(boolean includeNonExistentFiles)
File.exists() returns
false. The default value is false.
includeNonExistentFiles - true if the group is to include non existant files,
false otherwise.public java.io.File[] getExcludedFiles()
setExcludedFile(File),
setExcludedFiles(File[]),
clearExcludedFiles()public void setExcludedFile(java.io.File excludedFile)
excludedFile - the file to exclude from the list, or null.setExcludedFiles(File[]),
clearExcludedFiles()public void setExcludedFiles(java.io.File[] excludedFiles)
excludedFiles - the file to exclude from the list, or null.setExcludedFile(File),
clearExcludedFiles()public void setExcludedFiles(java.util.Collection<java.io.File> excludedFiles)
excludedFiles - the file to exclude from the list, or null.setExcludedFile(File),
clearExcludedFiles()public void clearExcludedFiles()
setExcludedFile(File),
setExcludedFiles(File[])public void clear()
getModel().clear.
public boolean isAccelerated()
public void setAccelerated(boolean accelerated)
accelerated - true to display accelerators, false to ommit them.setAcceleratorModifiers(int)public int getAcceleratorModifiers()
Toolkit.getMenuShortcutKeyMask().
public void setAcceleratorModifiers(int acceleratorModifiers)
Toolkit.getMenuShortcutKeyMask().
acceleratorModifiers - the modifiers that are used to create the accelerators.protected com.pietschy.command.file.RecentFileList.OpenCommand getCommandFor(java.io.File file)
file - the file of interest.
void installAccelerator(Face face,
int index)
face - the face to configure.index - the index of the file in the list.protected javax.swing.KeyStroke getAcceleratorForIndex(int index)
null.
index - the file index (starting at 0).
null if there is no
accelerator.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||