org.argouml.ui.menubar
Class LastRecentlyUsedMenuList

java.lang.Object
  extended byorg.argouml.ui.menubar.LastRecentlyUsedMenuList

public class LastRecentlyUsedMenuList
extends java.lang.Object

menu extension for last recently used files menu functionality: it is created with a link to the (file-)menu, if it is created it is reading its content from config information the add entry method adds a specific filename to the list, ensures that it bubbles at top of list if it is already member of list typically called by SaveFile method LRU is added at the specific position at creation time and all entries are going to be inserted or deletied

Since:
9. November 2003 (0.15.2)

Field Summary
private  ConfigurationKey[] _confKeys
          Array of conf keys for accessing the stored entries
private  javax.swing.JMenu _fileMenu
          menu where the list is bound to
private  int _lruCount
          recent loaded count
private  int _maxCount
          maxcount read from configuration
private  int _maxCountDefault
          default value for maxcount if there is no configuration
private  int _menuIndex
          index where the menu entries should be inserted -1 to be sure (adds at end)
private  javax.swing.JMenuItem[] _menuItems
          menuitems actually created and added to menu
 
Constructor Summary
LastRecentlyUsedMenuList(javax.swing.JMenu filemenu)
          Creates a new instance of LastRecentlyUsedMenuList with respect to the menu where the lru is bound to
 
Method Summary
 void addEntry(java.lang.String filename)
          Adds a new entry to lru list and removes the last one if if it increases maxCount
private  javax.swing.JMenuItem addEventHandler(java.lang.String filename, int addAt)
          Adds the eventhandler to the menu and renames the entry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_maxCountDefault

private final int _maxCountDefault
default value for maxcount if there is no configuration

See Also:
Constant Field Values

_fileMenu

private javax.swing.JMenu _fileMenu
menu where the list is bound to


_lruCount

private int _lruCount
recent loaded count


_maxCount

private int _maxCount
maxcount read from configuration


_menuIndex

private int _menuIndex
index where the menu entries should be inserted -1 to be sure (adds at end)


_menuItems

private javax.swing.JMenuItem[] _menuItems
menuitems actually created and added to menu


_confKeys

private ConfigurationKey[] _confKeys
Array of conf keys for accessing the stored entries

Constructor Detail

LastRecentlyUsedMenuList

public LastRecentlyUsedMenuList(javax.swing.JMenu filemenu)
Creates a new instance of LastRecentlyUsedMenuList with respect to the menu where the lru is bound to

Parameters:
filemenu - at this menu the lru is bound after last entry it is added with a separator
Method Detail

addEventHandler

private javax.swing.JMenuItem addEventHandler(java.lang.String filename,
                                              int addAt)
Adds the eventhandler to the menu and renames the entry


addEntry

public void addEntry(java.lang.String filename)
Adds a new entry to lru list and removes the last one if if it increases maxCount

Parameters:
filename - name of link which is to be used to represent _and_ reopen the file


ArgoUML © 1996-2004 (20040316)ArgoUML HomepageArgoUML Developers' pageArgoUML Cookbook