|
|||||||||
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.CommandGroup
org.pietschy.command.file.AbstractRecentFileGroup
public abstract class AbstractRecentFileGroup
Provides a custom group implementation that manages a list of recently used files. Subclasses
must override openFile(java.io.File)
and implement the required behaviour.
getClearCommand()
.setVisible(true);
The methods store(java.util.prefs.Preferences)
and load(java.util.prefs.Preferences)
are
also provided to allow easy persistence of the groups file list.
Field Summary |
---|
Fields inherited from class org.pietschy.command.CommandGroup |
---|
memberList |
Fields inherited from class org.pietschy.command.Command |
---|
internalLog, listenerList, pcs |
Constructor Summary | |
---|---|
|
AbstractRecentFileGroup(CommandManager commandManager)
Creates a new anonymous group. |
|
AbstractRecentFileGroup(CommandManager commandManager,
java.lang.String id)
Creates a new group with the specified id. |
protected |
AbstractRecentFileGroup(java.lang.String id)
Constructs a new group with the specified Id that is bound to the default command manager. |
Method Summary | |
---|---|
void |
add(java.io.File file)
Adds a file to the list. |
void |
addAll(java.io.File[] files)
Adds all the specified files to the list. |
protected javax.swing.KeyStroke |
getAcceleratorForIndex(int 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 org.pietschy.command.file.AbstractRecentFileGroup.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[] |
getExcludedFile()
Gets the file that is currently excluded from the list or null if all the files are included. |
java.io.File[] |
getFiles()
Gets all files in the group. |
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 |
load(java.util.prefs.Preferences prefs)
Loads the groups file list from the specified preference node. |
abstract void |
openFile(java.io.File file)
Called to open the selected file. |
void |
refresh()
|
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.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 |
store(java.util.prefs.Preferences prefs)
Stores the groups file list to the specified preference node. |
Methods inherited from class org.pietschy.command.CommandGroup |
---|
acceptVisitor, add, add, addGlue, addGlue, addGroupListener, addInline, addInline, addSeparator, addSeparator, bindMembers, bindMembers, commandRegistered, contains, createButton, createButton, createMenuBar, createMenuBar, createMenuBar, createMenuBar, createMenuItem, createPopupMenu, createPopupMenu, createToolBar, createToolBar, createToolBar, createToolBar, fireMembersChanged, getMemberCount, getMemberFactory, getMemberList, isAllowableMember, isInlineMember, isMember, rebuildAllPopups, remove, remove, removeGroupListener, reset, reset, visit, visitChildren |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AbstractRecentFileGroup(CommandManager commandManager)
commandManager
- the CommandManager
to which the group will belong.protected AbstractRecentFileGroup(java.lang.String id)
id
- the id of the group.CommandManager.defaultInstance()
public AbstractRecentFileGroup(CommandManager commandManager, java.lang.String id)
id
- the commands id.commandManager
- the CommandManager
to which the group will belong.Method Detail |
---|
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[] getExcludedFile()
public void setExcludedFile(java.io.File excludedFile)
excludedFile
- the file to exclude from the list, or null.public void setExcludedFiles(java.io.File[] excludedFiles)
excludedFiles
- the file to exclude from the list, or null.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.public void add(java.io.File file)
file
- the file to add to the list.public void addAll(java.io.File[] files)
files
- the files to add to the list.public java.io.File[] getFiles()
setDisplaySize(int)
protected org.pietschy.command.file.AbstractRecentFileGroup.OpenCommand getCommandFor(java.io.File file)
file
- the file of interest.
public abstract void openFile(java.io.File file)
file
- the file to be opened.public void store(java.util.prefs.Preferences prefs) throws java.util.prefs.BackingStoreException
prefs
- the preference node in which to save the groups file list.
java.util.prefs.BackingStoreException
- if the store operation fails.load(java.util.prefs.Preferences)
public void load(java.util.prefs.Preferences prefs)
prefs
- the preference node in which to retrieve the groups file list.store(java.util.prefs.Preferences)
public void refresh()
protected javax.swing.KeyStroke getAcceleratorForIndex(int index)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |