public class PickmapState<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
extends java.lang.Object
Pickmap
is part of a MapFolder
which is part of MapFolderTree
. A pickmap has an
underlying file from which a MapControl
instance may be created.Constructor and Description |
---|
PickmapState(@NotNull MapFolder<G,A,R> mapFolder,
@NotNull java.lang.String name,
@NotNull MapReaderFactory<G,A> mapReaderFactory,
@NotNull MapManager<G,A,R> pickmapManager,
@NotNull MapViewsManager<G,A,R> mapViewsManager)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
freePickmap()
Unloads the map file.
|
@NotNull java.io.File |
getFile()
Returns the underlying map file.
|
@Nullable MapView<G,A,R> |
getMapView()
Returns the
MapView instance for this pickmap. |
@Nullable MapControl<G,A,R> |
getPickmap()
Returns the
MapControl representing this pickmap. |
void |
getUnsavedPickmaps(@NotNull java.util.Collection<MapControl<G,A,R>> unsavedPickmaps)
Returns this pickmap if it has been loaded and is modified.
|
static boolean |
isValidPickmapName(@NotNull java.lang.CharSequence name)
Returns whether a pickmap name is valid.
|
void |
loadPickmap()
Loads the pickmap from the underlying map file.
|
void |
remove(boolean deleteFile)
Removes this pickmap from its folder.
|
void |
revert()
Reverts this pickmap to its underlying map file.
|
void |
save()
Saves this pickmap.
|
public PickmapState(@NotNull @NotNull MapFolder<G,A,R> mapFolder, @NotNull @NotNull java.lang.String name, @NotNull @NotNull MapReaderFactory<G,A> mapReaderFactory, @NotNull @NotNull MapManager<G,A,R> pickmapManager, @NotNull @NotNull MapViewsManager<G,A,R> mapViewsManager) throws InvalidNameException
mapFolder
- the folder ths pickmap is part ofname
- the underlying map file namemapReaderFactory
- the map reader factory to usepickmapManager
- the map manager for creating pickmapsmapViewsManager
- the map viewsInvalidNameException
- if name
is not validpublic static boolean isValidPickmapName(@NotNull @NotNull java.lang.CharSequence name)
name
- the name to check@NotNull public @NotNull java.io.File getFile()
@Nullable public @Nullable MapControl<G,A,R> getPickmap()
MapControl
representing this pickmap. Returns null
unless loadPickmap()
was successfully called.MapControl
instance, or null
if the map file
has not been loaded@Nullable public @Nullable MapView<G,A,R> getMapView()
MapView
instance for this pickmap. Returns null
unless loadPickmap()
was successfully called.MapView
instance, or null
if the map file has
not been loadedpublic void loadPickmap() throws java.io.IOException
java.io.IOException
- if the map file cannot be loadedpublic void freePickmap()
loadPickmap()
.public void getUnsavedPickmaps(@NotNull @NotNull java.util.Collection<MapControl<G,A,R>> unsavedPickmaps)
unsavedPickmaps
- the collection to add this
to if modifiedpublic void remove(boolean deleteFile)
deleteFile
- if set, delete the map file as wellpublic void save() throws java.io.IOException
java.io.IOException
- if saving failspublic void revert() throws java.io.IOException
java.io.IOException
- if the pickmap cannot be loaded