GUI Commands User GuideVersion 2.1 |
||
Recent File ListsThe RecentFileList is a custom group implementation that displays a list of recently
used files. This list automatically insert accelerators and can optionally display
an entry for clearing the list. The responsibility for opening the files is handled
by the open executor. This is just an ActionCommandExecutor that recognises the
The following shows the RecentFileList in use:
Recent File List Example
The following is an example of using a
RecentFileList recentFileList = new RecentFileList("recent-files");
recentFileList.getClearCommand().setVisible(true);
OpenCommand myOpenCommand = new OpenCommand();
recentFileList.setOpenExecutor(myOpenCommand);
The list also allows you to specify a list of excluded files that are to be temporarily removed from the list. You typically use this to exclude the currently open file or files. The list is backed by an instance of The following is an example of using the // create the model and load the previous list. DefaultRecentFileListModel model = new DefaultRecentFileListModel(); model.load(preferenceNode); RecentFileList recentFiles = new RecentFileList("recent-files", model); // when the current file changes.. recentFiles.setExcludedFile(currentFile); // and before we exit... model.store(preferenceNode); |
||