public class MapFolderTree<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends java.lang.Object implements java.lang.Iterable<MapFolder<G,A,R>>
MapFiles
. The map files are grouped
into MapFolders
. One of these folder can be the "active
folder"; this is the folder the GUI operates on.Constructor and Description |
---|
MapFolderTree(java.io.File baseDir)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addMapFolder(MapFolder<G,A,R> mapFolder)
Adds a map folder to this model.
|
void |
addModelListener(MapFolderTreeListener<G,A,R> listener)
Adds a
MapFolderTreeListener to be informed about changes. |
MapFolder<G,A,R> |
getActiveMapFolder()
Returns the active map folder.
|
java.io.File |
getBaseDir()
Returns the base directory for creating new map folders.
|
void |
getUnsavedPickmaps(java.util.Collection<MapControl<G,A,R>> unsavedMaps)
Returns all unsaved map controls of this model.
|
java.util.Iterator<MapFolder<G,A,R>> |
iterator()
Returns an
Iterator returning all map folders. |
void |
removeMapFolder(MapFolder<G,A,R> mapFolder,
boolean deleteFile)
Removes a map folder from this model.
|
void |
removeModelListener(MapFolderTreeListener<G,A,R> listener)
Removes a
MapFolderTreeListener to be informed about changes. |
void |
setActiveMapFolder(MapFolder<G,A,R> mapFolder)
Sets the active map folder.
|
public MapFolderTree(@NotNull java.io.File baseDir)
baseDir
- the base directory for creating new map folders@NotNull public java.io.File getBaseDir()
public void addMapFolder(@NotNull MapFolder<G,A,R> mapFolder) throws DuplicateMapFolderException
mapFolder
- the map folder to addDuplicateMapFolderException
- if the map folder's name is not
uniquepublic void removeMapFolder(@NotNull MapFolder<G,A,R> mapFolder, boolean deleteFile) throws MapFolderNotEmptyException
mapFolder
- the map folder to removedeleteFile
- if set, also remove the map filesMapFolderNotEmptyException
- if the map folder contains
sub-folders@Nullable public MapFolder<G,A,R> getActiveMapFolder()
null
if no folder is activepublic void setActiveMapFolder(@NotNull MapFolder<G,A,R> mapFolder)
mapFolder
- the active map folder or null
if no folder
should be activepublic java.util.Iterator<MapFolder<G,A,R>> iterator()
Iterator
returning all map folders. The folders are
sorted by folder name.public void addModelListener(@NotNull MapFolderTreeListener<G,A,R> listener)
MapFolderTreeListener
to be informed about changes.listener
- the listener to addpublic void removeModelListener(@NotNull MapFolderTreeListener<G,A,R> listener)
MapFolderTreeListener
to be informed about changes.listener
- the listener to removepublic void getUnsavedPickmaps(@NotNull java.util.Collection<MapControl<G,A,R>> unsavedMaps)
unsavedMaps
- the collection to add the unsaved pickmaps to