Gridarta Editor
net.sf.gridarta.gui.mapmenu.MapMenuLoader Class Reference

Saves or restores MapMenu contents to Preferences. More...

+ Collaboration diagram for net.sf.gridarta.gui.mapmenu.MapMenuLoader:

Classes

class  Result
 Result value consisting of a MapMenuEntry and its location (directory). More...
 
enum  Type
 Preferences values for entries. More...
 

Public Member Functions

Result loadEntry (final int index) throws IOException
 Loads an entry from preferences. More...
 
int loadNumEntries ()
 Returns the number of entries present in the preferences. More...
 
 MapMenuLoader (@NotNull final String key, @NotNull final PathManager pathManager)
 Creates a new instance. More...
 
void removeEntry (final int index)
 Removes an entry. More...
 
void saveEntry (final int index, @NotNull final String title, @NotNull final String filename, @NotNull final String directory, @NotNull final Type type)
 Saves an entry to preferences. More...
 
void saveNumEntries (final int num)
 Sets the number of entries present in the preferences. More...
 

Private Attributes

final String key
 The preferences key prefix. More...
 
final PathManager pathManager
 The global path manager instance. More...
 
final Preferences preferences = Preferences.userNodeForPackage(MainControl.class)
 The Preferences. More...
 

Static Private Attributes

static final Category LOG = Logger.getLogger(MapMenuLoader.class)
 The Logger for printing log messages. More...
 

Detailed Description

Saves or restores MapMenu contents to Preferences.

Author
Andreas Kirschbaum

Definition at line 35 of file MapMenuLoader.java.

Constructor & Destructor Documentation

◆ MapMenuLoader()

net.sf.gridarta.gui.mapmenu.MapMenuLoader.MapMenuLoader ( @NotNull final String  key,
@NotNull final PathManager  pathManager 
)

Creates a new instance.

Parameters
keythe preferences key prefix
pathManagerthe global path manager instance

Definition at line 84 of file MapMenuLoader.java.

References net.sf.gridarta.gui.mapmenu.MapMenuLoader.key, and net.sf.gridarta.gui.mapmenu.MapMenuLoader.pathManager.

Member Function Documentation

◆ loadEntry()

Result net.sf.gridarta.gui.mapmenu.MapMenuLoader.loadEntry ( final int  index) throws IOException

Loads an entry from preferences.

Parameters
indexthe preference index
Returns
the entry or
null
Exceptions
IOExceptionif the entry cannot be loaded

Definition at line 123 of file MapMenuLoader.java.

References net.sf.gridarta.model.io.PathManager.getMapFile(), and net.sf.gridarta.gui.mapmenu.MapMenuLoader.Type.MAP.

Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.load(), and net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test1().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loadNumEntries()

int net.sf.gridarta.gui.mapmenu.MapMenuLoader.loadNumEntries ( )

Returns the number of entries present in the preferences.

Returns
the number of entries

Definition at line 97 of file MapMenuLoader.java.

Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.load(), net.sf.gridarta.gui.mapmenu.MapMenu.saveAlways(), and net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test1().

+ Here is the caller graph for this function:

◆ removeEntry()

void net.sf.gridarta.gui.mapmenu.MapMenuLoader.removeEntry ( final int  index)

Removes an entry.

Parameters
indexthe preference index

Definition at line 209 of file MapMenuLoader.java.

Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.saveAlways(), and net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test1().

+ Here is the caller graph for this function:

◆ saveEntry()

void net.sf.gridarta.gui.mapmenu.MapMenuLoader.saveEntry ( final int  index,
@NotNull final String  title,
@NotNull final String  filename,
@NotNull final String  directory,
@NotNull final Type  type 
)

Saves an entry to preferences.

Parameters
indexthe preference index
titlethe entry's title
filenamethe entry's file name
directorythe entry's directory
typethe entry's type

Definition at line 186 of file MapMenuLoader.java.

References net.sf.gridarta.gui.mapmenu.MapMenuLoader.Type.MAP.

Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.saveEntries(), and net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test1().

+ Here is the caller graph for this function:

◆ saveNumEntries()

void net.sf.gridarta.gui.mapmenu.MapMenuLoader.saveNumEntries ( final int  num)

Sets the number of entries present in the preferences.

Parameters
numthe number of entries

Definition at line 109 of file MapMenuLoader.java.

Referenced by net.sf.gridarta.gui.mapmenu.MapMenu.saveAlways(), and net.sf.gridarta.gui.mapmenu.MapMenuPreferencesTest.test1().

+ Here is the caller graph for this function:

Member Data Documentation

◆ key

final String net.sf.gridarta.gui.mapmenu.MapMenuLoader.key
private

The preferences key prefix.

Definition at line 71 of file MapMenuLoader.java.

Referenced by net.sf.gridarta.gui.mapmenu.MapMenuLoader.MapMenuLoader().

◆ LOG

final Category net.sf.gridarta.gui.mapmenu.MapMenuLoader.LOG = Logger.getLogger(MapMenuLoader.class)
staticprivate

The Logger for printing log messages.

Definition at line 59 of file MapMenuLoader.java.

◆ pathManager

final PathManager net.sf.gridarta.gui.mapmenu.MapMenuLoader.pathManager
private

The global path manager instance.

Definition at line 77 of file MapMenuLoader.java.

Referenced by net.sf.gridarta.gui.mapmenu.MapMenuLoader.MapMenuLoader().

◆ preferences

final Preferences net.sf.gridarta.gui.mapmenu.MapMenuLoader.preferences = Preferences.userNodeForPackage(MainControl.class)
private

The Preferences.

Definition at line 65 of file MapMenuLoader.java.


The documentation for this class was generated from the following file: