public class IlvRecentFileList extends Object
IlvRecentFileList
objects are automatically instantiated by
the application or a specified document template to manage the recently
used file documents.
This class should only be used for very specific cases, like managing a
list of recently used documents that are not document files.Modifier and Type | Class and Description |
---|---|
static interface |
IlvRecentFileList.FileHandler
Defines objects that open files.
|
static class |
IlvRecentFileList.FileInfo
Stores information for a file listed by a recent file list.
|
Modifier and Type | Field and Description |
---|---|
static String |
APPLICATION_MRU_NAME
Name of the settings element that provides the settings for the recent file
list of the application.
|
static int |
MAX_FILE_COUNT
Default maximum number of files that a recent file list can manage.
|
static String |
RECENT_FILES_CMD
Command for the action that manages the main recent file list of the application.
|
static String |
SETTINGS_TYPE
Type of settings element that provides the settings of recent file lists.
|
Constructor and Description |
---|
IlvRecentFileList(IlvRecentFileList.FileHandler openFile,
String settingsName,
IlvApplication application)
Constructs a new
IlvRecentFileList instance. |
Modifier and Type | Method and Description |
---|---|
void |
addRecentFileInfo(IlvRecentFileList.FileInfo fileInfo)
Adds the specified
fileInfo to the list of files managed
by this instance. |
void |
addRecentFileURL(URL url)
Adds a file to the list of files managed by this object.
|
Action |
getAction()
Returns the action that displays the list of files managed by this recent
file list.
|
String |
getActionCommand()
Returns the action command of the list action that has associated menu items
that display the list of files.
|
IlvApplication |
getApplication()
Returns the application of the recent file list.
|
int |
getMaximumFileCount()
Returns the maximum number of files that this recent file list can
stores.
|
protected String |
getMenuString(String pathname,
boolean atLeastName)
Returns the string that will display the specified
pathname in a menu item. |
String |
getRecentFile(int index)
Returns the pathname of the file listed at the specified
index
position. |
int |
getRecentFileCount()
Returns the number of files currently listed by this object.
|
int |
getRecentFileIndex(IlvRecentFileList.FileInfo fileInfo)
Returns the storage index of the file described by the
specified
fileInfo . |
int |
getRecentFileIndex(URL url)
Returns the storage index of the file with the
specified
url . |
URL |
getRecentFileURL(int index)
Returns the URL of the file listed at the specified
index
position. |
IlvSettings |
getSettings()
Returns the settings that initialize the recent file list.
|
IlvSettingsElement |
getSettingsElement()
Returns the settings element that provides the settings for this
recent file list.
|
String |
getSettingsName()
Returns the name that identifies the recent file list within the settings.
|
IlvSettingsQuery |
getSettingsQuery()
Returns the query that selects the settings element of the recent file list.
|
void |
moveRecentFileToTop(int index)
Moves the file listed at the specified storage
index to the
top of the list. |
void |
openRecentFile(int index)
Opens the file listed at the specified storage
index . |
protected IlvRecentFileList.FileInfo |
readFileInfo(IlvSettingsElement element)
Invoked by the
readSettings(ilog.views.appframe.settings.IlvSettingsElement) method to read a
FileInfo instance from the specified
settings element . |
void |
readSettings(IlvSettingsElement element)
Reads the settings of the recent file list.
|
boolean |
removeRecentFileURL(URL url)
Removes the reference to the specified file
url from the
list of files. |
void |
setAction(Action action)
Sets the list action that displays the list of files managed by this
recent file list.
|
void |
setActionCommand(String name)
The command key of the list action that has associated menu items that display
the list of files.
|
void |
setApplication(IlvApplication application)
Sets the application of this recent file list.
|
int |
setMaximumFileCount(int count)
Changes the maximum number of files the recent file list can handle.
|
void |
setSettings(IlvSettings settings)
Sets the settings of the recent file list.
|
void |
setSettingsElement(IlvSettingsElement element)
Forces the settings of the recent file list to be read and written from the
specified settings element.
|
void |
setSettingsName(String name)
Sets the name that identifies the recent file list in the settings.
|
void |
setSettingsQuery(IlvSettingsQuery query)
Sets the query that selects the settings element that defines the
recent file list.
|
protected void |
writeFileInfo(IlvSettingsElement element,
IlvRecentFileList.FileInfo info)
Invoked by the
writeSettings(ilog.views.appframe.settings.IlvSettingsElement) method to write a
FileInfo instance to the specified settings
element . |
void |
writeSettings(IlvSettingsElement element)
Writes the settings of this recent file list.
|
public static final int MAX_FILE_COUNT
max_files_count
attribute
to the new desired value.public static final String RECENT_FILES_CMD
public static final String SETTINGS_TYPE
public static final String APPLICATION_MRU_NAME
public IlvRecentFileList(IlvRecentFileList.FileHandler openFile, String settingsName, IlvApplication application)
IlvRecentFileList
instance.openFile
- The object that is responsible for opening files in the list.settingsName
- The name of the settings element that stores and
restores the list of pathnames for the recent file list.application
- The application of the recent file list object.public void readSettings(IlvSettingsElement element)
element
- The settings element that provides the settings.writeSettings(ilog.views.appframe.settings.IlvSettingsElement)
,
readFileInfo(ilog.views.appframe.settings.IlvSettingsElement)
protected IlvRecentFileList.FileInfo readFileInfo(IlvSettingsElement element)
readSettings(ilog.views.appframe.settings.IlvSettingsElement)
method to read a
FileInfo
instance from the specified
settings element
.element
- The settings to read file information from.FileInfo
instance.writeFileInfo(ilog.views.appframe.settings.IlvSettingsElement, ilog.views.appframe.docview.IlvRecentFileList.FileInfo)
protected void writeFileInfo(IlvSettingsElement element, IlvRecentFileList.FileInfo info)
writeSettings(ilog.views.appframe.settings.IlvSettingsElement)
method to write a
FileInfo
instance to the specified settings
element
.
readFileInfo(ilog.views.appframe.settings.IlvSettingsElement)
method should also be overridden to
read that data.element
- The settings element to write the file information to.info
- The file information to write.readFileInfo(ilog.views.appframe.settings.IlvSettingsElement)
public int getRecentFileCount()
getRecentFileURL(int)
public URL getRecentFileURL(int index)
index
position.
null
.null
for specific
uses.getRecentFile(int)
public String getRecentFile(int index)
index
position.
getRecentFileURL(int)
public void addRecentFileURL(URL url)
url
- The URL of the file to add.addRecentFileInfo(ilog.views.appframe.docview.IlvRecentFileList.FileInfo)
public void addRecentFileInfo(IlvRecentFileList.FileInfo fileInfo)
fileInfo
to the list of files managed
by this instance.
addRecentFileURL(java.net.URL)
method, but
can be used directly for adding user file information. For example,
this method should be used if this recent file list is not used for
storing the pathname of files, but key names that are interpreted
by the user.addRecentFileURL(java.net.URL)
public int setMaximumFileCount(int count)
count
- The new maximum number of files.getMaximumFileCount()
public int getMaximumFileCount()
setMaximumFileCount(int)
public void moveRecentFileToTop(int index)
index
to the
top of the list. This file becomes the most recently used file of the
list of files.index
- The storage index of the file to change the storage order of.public void openRecentFile(int index)
index
.index
- The storage index of the file to open.public boolean removeRecentFileURL(URL url)
url
from the
list of files.url
- The URL of the file to remove from the list.true
if the specified URL corresponds to a file
listed by this instance; false
otherwise.public int getRecentFileIndex(URL url)
url
.-1
if the file
was not listed in this recent file list.public int getRecentFileIndex(IlvRecentFileList.FileInfo fileInfo)
fileInfo
.-1
if the file
was not listed in this recent file list.getRecentFileIndex(URL)
public void writeSettings(IlvSettingsElement element)
element
- The settings element to write the settings in.readSettings(ilog.views.appframe.settings.IlvSettingsElement)
,
writeFileInfo(ilog.views.appframe.settings.IlvSettingsElement, ilog.views.appframe.docview.IlvRecentFileList.FileInfo)
public void setActionCommand(String name)
getActionCommand()
public String getActionCommand()
setActionCommand(java.lang.String)
protected String getMenuString(String pathname, boolean atLeastName)
pathname
in a menu item.
IlvAction.ACTION_LIST_MENU_MAXLENGTH
.This method can be overridden for specific uses. For example, if the specified pathname does not represent a pathname, but a key name that is interpreted by the user of this recent file list, this pathname may be truncated in a different way.
pathname
- The path to get a display string from.atLeastName
- If true
, the method ensures that
the string to display contains at least the file name of the specified
pathname.public void setApplication(IlvApplication application)
application
- The application of the recent file list.getApplication()
public IlvApplication getApplication()
public void setAction(Action action)
action
- The list action that lists the files of this recent file list.getAction()
public Action getAction()
setAction(javax.swing.Action)
public IlvSettings getSettings()
setSettings(ilog.views.appframe.settings.IlvSettings)
public void setSettings(IlvSettings settings)
settings
- The new settings of the recent file list.public void setSettingsQuery(IlvSettingsQuery query)
query
- The settings query.getSettingsQuery()
public IlvSettingsQuery getSettingsQuery()
setSettingsQuery(ilog.views.appframe.settings.IlvSettingsQuery)
public void setSettingsElement(IlvSettingsElement element)
getSettings()
with the query getSettingsQuery()
.element
- The settings element that provides the settings for the
plug-in manager.getSettingsElement()
public IlvSettingsElement getSettingsElement()
null
if no settings
element could be found.setSettingsElement(ilog.views.appframe.settings.IlvSettingsElement)
,
getSettingsQuery()
public String getSettingsName()
setSettingsName(java.lang.String)
public void setSettingsName(String name)
name
- The new settings name of the menu bar.getSettingsName()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.