public class SwingRecentFilesPreferenceProperty extends AbstractBasicLocalizableChangeableItem implements StringListPreferenceProperty
| Modifier and Type | Class and Description |
|---|---|
static interface |
SwingRecentFilesPreferenceProperty.RecentFileLoader
Interface for loaders of recent files.
|
| Modifier and Type | Field and Description |
|---|---|
static int |
MAXIMUM_STORE_SIZE
The maximum number of allowd entries.
|
PROPERTY_VALUE| Constructor and Description |
|---|
SwingRecentFilesPreferenceProperty(java.lang.String basicName,
java.lang.String baseTag)
Constructor.
|
SwingRecentFilesPreferenceProperty(java.lang.String basicName,
java.lang.String baseTag,
int maxSize)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addEntry(java.lang.String filepath)
Add a file path which becomes the most recent entry.
|
java.lang.String |
getLatestEntry()
Return the entry which was added most recently.
|
javax.swing.JMenuItem |
getMenuItem(SwingRecentFilesPreferenceProperty.RecentFileLoader loader,
java.util.Locale l)
Get a menu item representing the list of recent files.
|
java.util.List<java.lang.String> |
getStringList()
Get the collection of strings.
|
void |
readFrom(java.util.prefs.Preferences preferences)
Read the property value from the preferences.
|
void |
storeTo(java.util.prefs.Preferences preferences)
Store the current property value in the preferences.
|
getBaseTag, getLabelString, getMenuString, getName, getStringaddValueChangeListener, addValueChangeListenerWeakly, firePropertyChange, fireValueChange, fireValueChange, fireValueChange, getBasicName, getPropertyName, removeValueChangeListener, removeValueChangeListenerWeaklyclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddValueChangeListener, addValueChangeListenerWeakly, removeValueChangeListener, removeValueChangeListenerWeaklypublic static final int MAXIMUM_STORE_SIZE
public SwingRecentFilesPreferenceProperty(@NotNull java.lang.String basicName, @NotNull java.lang.String baseTag)
MAXIMUM_STORE_SIZE as allowed size for list.basicName - basic name (prefix)baseTag - basic i18n tagpublic SwingRecentFilesPreferenceProperty(@NotNull java.lang.String basicName, @NotNull java.lang.String baseTag, int maxSize)
basicName - basic name (prefix)baseTag - basic i18n tagmaxSize - maximum number of recent files stored, must be not more than MAXIMUM_STORE_SIZEpublic void addEntry(@NotNull java.lang.String filepath)
filepath - filepath to addpublic void readFrom(@NotNull java.util.prefs.Preferences preferences)
readFrom in interface PreferencePropertypreferences - preferences from where to read the property valuepublic void storeTo(@NotNull java.util.prefs.Preferences preferences)
storeTo in interface PreferencePropertypreferences - preferences where to store the property value@NotNull public java.util.List<java.lang.String> getStringList()
getStringList in interface StringListPreferenceProperty@Nullable public java.lang.String getLatestEntry()
null if no entry was saved@NotNull public javax.swing.JMenuItem getMenuItem(SwingRecentFilesPreferenceProperty.RecentFileLoader loader, java.util.Locale l)
loader - loader which loads the files if one is selectedl - locale