Package net.sf.gridarta.model.mapmanager
Interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
-
- All Known Implementing Classes:
AbstractMapManager,DefaultMapManager,DefaultPickmapManager
public interface MapManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>A MapManager manages all opened maps.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddMapManagerListener(@NotNull MapManagerListener<G,A,R> listener)Adds aMapManagerListenerto be notified.voidcloseMap(@NotNull MapControl<G,A,R> mapControl)Closes the given map, ignoring modified status.@Nullable MapControl<G,A,R>getCurrentMap()Returns the current map.java.io.FilegetLocalMapDir()Returns a guess for a script directory to use.@NotNull java.util.List<MapControl<G,A,R>>getOpenedMaps()Returns all opened maps.@Nullable MapControl<G,A,R>getOpenMap()Returns one open map.@NotNull MapControl<G,A,R>newMap(@Nullable java.util.List<G> objects, A mapArchObject, @Nullable MapFile mapFile, boolean interactive)Creates a new map control without view.@NotNull MapControl<G,A,R>openMapFile(@NotNull java.io.File file, boolean interactive)Loads a map file.@NotNull MapControl<G,A,R>openMapFile(@NotNull MapFile mapFile, boolean interactive)Loads a map file.voidrelease(@NotNull MapControl<G,A,R> mapControl)Releases aMapControlinstance.voidremoveMapManagerListener(@NotNull MapManagerListener<G,A,R> listener)Removes aMapManagerListenerto be notified.voidrevert(@NotNull MapControl<G,A,R> mapControl)Reverts one map.voidsetCurrentMap(@Nullable MapControl<G,A,R> mapControl)Sets the given map as the current one.
-
-
-
Method Detail
-
openMapFile
@NotNull @NotNull MapControl<G,A,R> openMapFile(@NotNull @NotNull MapFile mapFile, boolean interactive) throws java.io.IOException
Loads a map file. The returned instance must be freed withrelease(MapControl)when not needed anymore.- Parameters:
mapFile- the map file to loadinteractive- if set, may ask to delete undefined archetypes; if unset, keep undefined archetypes- Returns:
- the map control
- Throws:
java.io.IOException- if an I/O error occurs
-
openMapFile
@NotNull @NotNull MapControl<G,A,R> openMapFile(@NotNull @NotNull java.io.File file, boolean interactive) throws java.io.IOException
Loads a map file. The returned instance must be freed withrelease(MapControl)when not needed anymore.- Parameters:
file- the map file to loadinteractive- if set, may ask to delete undefined archetypes; if unset, keep undefined archetypes- Returns:
- the map control
- Throws:
java.io.IOException- if an I/O error occurs
-
closeMap
void closeMap(@NotNull @NotNull MapControl<G,A,R> mapControl)Closes the given map, ignoring modified status.- Parameters:
mapControl- the map to close
-
newMap
@NotNull @NotNull MapControl<G,A,R> newMap(@Nullable @Nullable java.util.List<G> objects, @NotNull A mapArchObject, @Nullable @Nullable MapFile mapFile, boolean interactive)
Creates a new map control without view. The returned instance must be freed withrelease(MapControl)when not needed anymore.- Parameters:
objects- the game objects to insert; may benullmapArchObject- the map arch object for the new mapmapFile- the map file, ornullif the map was not yet savedinteractive- if set, the new map becomes the current map- Returns:
- the newly created map control
-
setCurrentMap
void setCurrentMap(@Nullable @Nullable MapControl<G,A,R> mapControl)Sets the given map as the current one.- Parameters:
mapControl- theMapControlof the new current map
-
getOpenedMaps
@NotNull @NotNull java.util.List<MapControl<G,A,R>> getOpenedMaps()
Returns all opened maps.- Returns:
- the opened maps
-
getCurrentMap
@Nullable @Nullable MapControl<G,A,R> getCurrentMap()
Returns the current map.- Returns:
- the current map
-
getOpenMap
@Nullable @Nullable MapControl<G,A,R> getOpenMap()
Returns one open map.- Returns:
- the map or
nullif no open maps exist
-
addMapManagerListener
void addMapManagerListener(@NotNull @NotNull MapManagerListener<G,A,R> listener)Adds aMapManagerListenerto be notified.- Parameters:
listener- the listener to add
-
removeMapManagerListener
void removeMapManagerListener(@NotNull @NotNull MapManagerListener<G,A,R> listener)Removes aMapManagerListenerto be notified.- Parameters:
listener- the listener to remove
-
revert
void revert(@NotNull @NotNull MapControl<G,A,R> mapControl) throws java.io.IOExceptionReverts one map.- Parameters:
mapControl- the map to revert- Throws:
java.io.IOException- if an I/O error occurs
-
getLocalMapDir
java.io.File getLocalMapDir()
Returns a guess for a script directory to use.- Returns:
- the directory
-
release
void release(@NotNull @NotNull MapControl<G,A,R> mapControl)Releases aMapControlinstance.- Parameters:
mapControl- the map control instance
-
-