Package net.sf.gridarta.gui.mapmenu
Class MapMenuLoader
- java.lang.Object
-
- net.sf.gridarta.gui.mapmenu.MapMenuLoader
-
public class MapMenuLoader extends java.lang.ObjectSaves or restoresMapMenucontents toPreferences.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classMapMenuLoader.ResultResult value consisting of aMapMenuEntryand its location (directory).static classMapMenuLoader.TypePreferences values for entries.
-
Constructor Summary
Constructors Constructor Description MapMenuLoader(@NotNull java.lang.String key, @NotNull PathManager pathManager)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description @NotNull MapMenuLoader.ResultloadEntry(int index)Loads an entry from preferences.intloadNumEntries()Returns the number of entries present in the preferences.voidremoveEntry(int index)Removes an entry.voidsaveEntry(int index, @NotNull java.lang.String title, @NotNull java.lang.String filename, @NotNull java.lang.String directory, @NotNull MapMenuLoader.Type type)Saves an entry to preferences.voidsaveNumEntries(int num)Sets the number of entries present in the preferences.
-
-
-
Constructor Detail
-
MapMenuLoader
public MapMenuLoader(@NotNull @NotNull java.lang.String key, @NotNull @NotNull PathManager pathManager)Creates a new instance.- Parameters:
key- the preferences key prefixpathManager- the global path manager instance
-
-
Method Detail
-
loadNumEntries
public int loadNumEntries()
Returns the number of entries present in the preferences.- Returns:
- the number of entries
-
saveNumEntries
public void saveNumEntries(int num)
Sets the number of entries present in the preferences.- Parameters:
num- the number of entries
-
loadEntry
@NotNull public @NotNull MapMenuLoader.Result loadEntry(int index) throws java.io.IOException
Loads an entry from preferences.- Parameters:
index- the preference index- Returns:
- the entry or
null - Throws:
java.io.IOException- if the entry cannot be loaded
-
saveEntry
public void saveEntry(int index, @NotNull @NotNull java.lang.String title, @NotNull @NotNull java.lang.String filename, @NotNull @NotNull java.lang.String directory, @NotNull @NotNull MapMenuLoader.Type type)Saves an entry to preferences.- Parameters:
index- the preference indextitle- the entry's titlefilename- the entry's file namedirectory- the entry's directorytype- the entry's type
-
removeEntry
public void removeEntry(int index)
Removes an entry.- Parameters:
index- the preference index
-
-