public class RecentFilesHandler<M> extends AbstractRecentItemsHandler<M,File>
Modifier and Type | Field and Description |
---|---|
protected int |
m_MinNumParentDirs
the minimum number of parent directories to use.
|
static String |
RECENTFILES_COUNT
the property for storing the number of recent files.
|
static String |
RECENTFILES_PREFIX
the property prefix for a recent file.
|
m_IgnoreChanges, m_Listeners, m_MaxCount, m_Menu, m_PropertiesFile, m_PropertyPrefix, m_RecentItems
Constructor and Description |
---|
RecentFilesHandler(String propsFile,
int maxCount,
M menu)
Initializes the handler.
|
RecentFilesHandler(String propsFile,
M menu)
Initializes the handler with a maximum of 5 items.
|
RecentFilesHandler(String propsFile,
String propPrefix,
int maxCount,
M menu)
Initializes the handler.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
check(File item)
Checks the item after obtaining from the props file.
|
protected String |
createMenuItemText(int index,
File item)
Generates the text for the menuitem.
|
protected int |
determineMinimumNumberOfParentDirs()
Determines the minimum number of parent directories that need to be
included in the filename to make the filenames in the menu distinguishable.
|
protected File |
fromString(String s)
Turns the string obtained from the props into an object again.
|
protected String |
getCountKey()
Returns the key to use for the counts in the props file.
|
protected String |
getItemPrefix()
Returns the key prefix to use for the items in the props file.
|
protected void |
preUpdateMenu()
Hook method which gets executed just before updating the menu.
|
protected String |
toString(File obj)
Turns an object into a string for storing in the props.
|
addRecentItem, addRecentItemListener, doUpdateMenu, expand, getMaxCount, getMenu, getPropertiesFile, getPropertyPrefix, getRecentItems, loadProps, notifyRecentItemListenersOfAdd, notifyRecentItemListenersOfSelect, postUpdateMenu, readProps, removeAll, removeRecentItem, removeRecentItemListener, size, updateMenu, writeProps
public static final String RECENTFILES_COUNT
public static final String RECENTFILES_PREFIX
protected int m_MinNumParentDirs
public RecentFilesHandler(String propsFile, M menu)
propsFile
- the props file to store the files inmenu
- the menu to add the recent files as subitems topublic RecentFilesHandler(String propsFile, int maxCount, M menu)
propsFile
- the props file to store the files inmaxCount
- the maximum number of files to keep in menumenu
- the menu to add the recent files as subitems topublic RecentFilesHandler(String propsFile, String propPrefix, int maxCount, M menu)
propsFile
- the props file to store the files inpropPrefix
- the properties prefix, use null to ignoremaxCount
- the maximum number of files to keep in menumenu
- the menu to add the recent files as subitems toprotected boolean check(File item)
check
in class AbstractRecentItemsHandler<M,File>
item
- the item to checkprotected int determineMinimumNumberOfParentDirs()
protected String getCountKey()
getCountKey
in class AbstractRecentItemsHandler<M,File>
protected String getItemPrefix()
getItemPrefix
in class AbstractRecentItemsHandler<M,File>
protected String toString(File obj)
toString
in class AbstractRecentItemsHandler<M,File>
obj
- the object to convertprotected File fromString(String s)
fromString
in class AbstractRecentItemsHandler<M,File>
s
- the string representationprotected void preUpdateMenu()
preUpdateMenu
in class AbstractRecentItemsHandler<M,File>
protected String createMenuItemText(int index, File item)
createMenuItemText
in class AbstractRecentItemsHandler<M,File>
index
- the index of the itemitem
- the item itselfCopyright © 2017. All Rights Reserved.