ilog.views.appframe.docview
Class IlvRecentFileList

java.lang.Object
  extended by ilog.views.appframe.docview.IlvRecentFileList

public class IlvRecentFileList
extends Object

Defines objects that handle a list of Most Recently Used files.
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.


Nested Class Summary
static interface IlvRecentFileList.FileHandler
          Defines objects that open files.
static class IlvRecentFileList.FileInfo
          Stores information for a file listed by a recent file list.
 
Field Summary
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 Summary
IlvRecentFileList(IlvRecentFileList.FileHandler openFile, String settingsName, IlvApplication application)
          Constructs a new IlvRecentFileList instance.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_FILE_COUNT

public static final int MAX_FILE_COUNT
Default maximum number of files that a recent file list can manage. This value can be overridden in the settings element defining the recent file list by setting the max_files_count attribute to the new desired value.

See Also:
Constant Field Values

RECENT_FILES_CMD

public static final String RECENT_FILES_CMD
Command for the action that manages the main recent file list of the application.

See Also:
Constant Field Values

SETTINGS_TYPE

public static final String SETTINGS_TYPE
Type of settings element that provides the settings of recent file lists.

See Also:
Constant Field Values

APPLICATION_MRU_NAME

public static final String APPLICATION_MRU_NAME
Name of the settings element that provides the settings for the recent file list of the application.

See Also:
Constant Field Values
Constructor Detail

IlvRecentFileList

public IlvRecentFileList(IlvRecentFileList.FileHandler openFile,
                         String settingsName,
                         IlvApplication application)
Constructs a new IlvRecentFileList instance.

Parameters:
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.
Method Detail

readSettings

public void readSettings(IlvSettingsElement element)
Reads the settings of the recent file list.

Parameters:
element - The settings element that provides the settings.
See Also:
writeSettings(ilog.views.appframe.settings.IlvSettingsElement), readFileInfo(ilog.views.appframe.settings.IlvSettingsElement)

readFileInfo

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.

Parameters:
element - The settings to read file information from.
Returns:
The new read FileInfo instance.
See Also:
writeFileInfo(ilog.views.appframe.settings.IlvSettingsElement, ilog.views.appframe.docview.IlvRecentFileList.FileInfo)

writeFileInfo

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.
If this method is overridden to write specific user data, the corresponding readFileInfo(ilog.views.appframe.settings.IlvSettingsElement) method should also be overridden to read that data.

Parameters:
element - The settings element to write the file information to.
info - The file information to write.
See Also:
readFileInfo(ilog.views.appframe.settings.IlvSettingsElement)

getRecentFileCount

public int getRecentFileCount()
Returns the number of files currently listed by this object.

Returns:
The number of files.
See Also:
getRecentFileURL(int)

getRecentFileURL

public URL getRecentFileURL(int index)
Returns the URL of the file listed at the specified index position.
If this recent file list does not list pathnames but key names, this method may return null.

Returns:
The URL of the file or null for specific uses.
See Also:
getRecentFile(int)

getRecentFile

public String getRecentFile(int index)
Returns the pathname of the file listed at the specified index position.
If this recent file list does not list pathnames, it may return a key name to be interpreted by the user of this object.

Returns:
The pathname of the file at the specified index or a key name for specific uses.
See Also:
getRecentFileURL(int)

addRecentFileURL

public void addRecentFileURL(URL url)
Adds a file to the list of files managed by this object.

Parameters:
url - The URL of the file to add.
See Also:
addRecentFileInfo(ilog.views.appframe.docview.IlvRecentFileList.FileInfo)

addRecentFileInfo

public void addRecentFileInfo(IlvRecentFileList.FileInfo fileInfo)
Adds the specified fileInfo to the list of files managed by this instance.
This method is called by the 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.

See Also:
addRecentFileURL(java.net.URL)

setMaximumFileCount

public int setMaximumFileCount(int count)
Changes the maximum number of files the recent file list can handle.

Parameters:
count - The new maximum number of files.
Returns:
The previous maximum number of files.
See Also:
getMaximumFileCount()

getMaximumFileCount

public int getMaximumFileCount()
Returns the maximum number of files that this recent file list can stores.

Returns:
The maximum number of files of this recent file list.
See Also:
setMaximumFileCount(int)

moveRecentFileToTop

public void moveRecentFileToTop(int index)
Moves the file listed at the specified storage index to the top of the list. This file becomes the most recently used file of the list of files.

Parameters:
index - The storage index of the file to change the storage order of.

openRecentFile

public void openRecentFile(int index)
Opens the file listed at the specified storage index.

Parameters:
index - The storage index of the file to open.

removeRecentFileURL

public boolean removeRecentFileURL(URL url)
Removes the reference to the specified file url from the list of files.

Parameters:
url - The URL of the file to remove from the list.
Returns:
true if the specified URL corresponds to a file listed by this instance; false otherwise.

getRecentFileIndex

public int getRecentFileIndex(URL url)
Returns the storage index of the file with the specified url.

Returns:
The storage index of the file or -1 if the file was not listed in this recent file list.

getRecentFileIndex

public int getRecentFileIndex(IlvRecentFileList.FileInfo fileInfo)
Returns the storage index of the file described by the specified fileInfo.

Returns:
The storage index of the file or -1 if the file was not listed in this recent file list.
See Also:
getRecentFileIndex(URL)

writeSettings

public void writeSettings(IlvSettingsElement element)
Writes the settings of this recent file list.

Parameters:
element - The settings element to write the settings in.
See Also:
readSettings(ilog.views.appframe.settings.IlvSettingsElement), writeFileInfo(ilog.views.appframe.settings.IlvSettingsElement, ilog.views.appframe.docview.IlvRecentFileList.FileInfo)

setActionCommand

public void setActionCommand(String name)
The command key of the list action that has associated menu items that display the list of files.

See Also:
getActionCommand()

getActionCommand

public String getActionCommand()
Returns the action command of the list action that has associated menu items that display the list of files.

See Also:
setActionCommand(java.lang.String)

getMenuString

protected String getMenuString(String pathname,
                               boolean atLeastName)
Returns the string that will display the specified pathname in a menu item.
By default, the pathname is truncated to display only the number of characters provided by the action associated with the property 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.

Parameters:
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.
Returns:
The string being displayed by a menu item.

setApplication

public void setApplication(IlvApplication application)
Sets the application of this recent file list.

Parameters:
application - The application of the recent file list.
See Also:
getApplication()

getApplication

public IlvApplication getApplication()
Returns the application of the recent file list.

See Also:
setApplication(ilog.views.appframe.IlvApplication)

setAction

public void setAction(Action action)
Sets the list action that displays the list of files managed by this recent file list.

Parameters:
action - The list action that lists the files of this recent file list.
See Also:
getAction()

getAction

public Action getAction()
Returns the action that displays the list of files managed by this recent file list.

See Also:
setAction(javax.swing.Action)

getSettings

public IlvSettings getSettings()
Returns the settings that initialize the recent file list.

Returns:
The settings of the recent file list.
See Also:
setSettings(ilog.views.appframe.settings.IlvSettings)

setSettings

public void setSettings(IlvSettings settings)
Sets the settings of the recent file list.
By default, the settings are the settings of the application.

Parameters:
settings - The new settings of the recent file list.

setSettingsQuery

public void setSettingsQuery(IlvSettingsQuery query)
Sets the query that selects the settings element that defines the recent file list.

Parameters:
query - The settings query.
See Also:
getSettingsQuery()

getSettingsQuery

public IlvSettingsQuery getSettingsQuery()
Returns the query that selects the settings element of the recent file list.

Returns:
The settings query.
See Also:
setSettingsQuery(ilog.views.appframe.settings.IlvSettingsQuery)

setSettingsElement

public void setSettingsElement(IlvSettingsElement element)
Forces the settings of the recent file list to be read and written from the specified settings element.
This method overrides the settings element that is selected by default within the settings given by the method getSettings() with the query getSettingsQuery().

Parameters:
element - The settings element that provides the settings for the plug-in manager.
See Also:
getSettingsElement()

getSettingsElement

public IlvSettingsElement getSettingsElement()
Returns the settings element that provides the settings for this recent file list.

Returns:
The settings element or null if no settings element could be found.
See Also:
setSettingsElement(ilog.views.appframe.settings.IlvSettingsElement), getSettingsQuery()

getSettingsName

public String getSettingsName()
Returns the name that identifies the recent file list within the settings.

Returns:
The settings name of the menu bar.
See Also:
setSettingsName(java.lang.String)

setSettingsName

public void setSettingsName(String name)
Sets the name that identifies the recent file list in the settings.

Parameters:
name - The new settings name of the menu bar.
See Also:
getSettingsName()


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.