Gridarta Editor
net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R > Class Template Referenceabstract

Abstract base class for MapManager implementations. More...

+ Inheritance diagram for net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:
+ Collaboration diagram for net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:

Public Member Functions

void addMapManagerListener (@NotNull final MapManagerListener< G, A, R > listener)
 
void closeMap (@NotNull final MapControl< G, A, R > mapControl)
 
MapControl< G, A, R > getCurrentMap ()
 Returns the current top map we are working with. More...
 
File getLocalMapDir ()
 
List< MapControl< G, A, R > > getOpenedMaps ()
 
MapControl< G, A, R > getOpenMap ()
 
MapControl< G, A, R > newMap (@Nullable final List< G > objects, @NotNull final A mapArchObject, @Nullable final MapFile mapFile, final boolean interactive)
 
MapControl< G, A, R > openMapFile (@NotNull final MapFile mapFile, final boolean interactive) throws IOException
 
MapControl< G, A, R > openMapFile (@NotNull final File file, final boolean interactive) throws IOException
 
void release (@NotNull final MapControl< G, A, R > mapControl)
 
void removeMapManagerListener (@NotNull final MapManagerListener< G, A, R > listener)
 
void revert (@NotNull final MapControl< G, A, R > mapControl) throws IOException
 
void setCurrentMap (@Nullable final MapControl< G, A, R > mapControl)
 
void setFileControl (@NotNull final FileControl< G, A, R > fileControl)
 
- Public Member Functions inherited from net.sf.gridarta.model.mapmanager.MapManager< G, A, R >
void addMapManagerListener ( @NotNull MapManagerListener< G, A, R > listener)
 Adds a MapManagerListener to be notified. More...
 
void closeMap ( @NotNull MapControl< G, A, R > mapControl)
 Closes the given map, ignoring modified status. More...
 
MapControl< G, A, R > getCurrentMap ()
 Returns the current map. More...
 
File getLocalMapDir ()
 Returns a guess for a script directory to use. More...
 
List< MapControl< G, A, R > > getOpenedMaps ()
 Returns all opened maps. More...
 
MapControl< G, A, R > getOpenMap ()
 Returns one open map. More...
 
MapControl< G, A, R > newMap ( @Nullable List< G > objects, @NotNull A mapArchObject, @Nullable MapFile mapFile, boolean interactive)
 Creates a new map control without view. More...
 
MapControl< G, A, R > openMapFile ( @NotNull MapFile mapFile, boolean interactive) throws IOException
 Loads a map file. More...
 
MapControl< G, A, R > openMapFile ( @NotNull File file, boolean interactive) throws IOException
 Loads a map file. More...
 
void release ( @NotNull MapControl< G, A, R > mapControl)
 Releases a MapControl instance. More...
 
void removeMapManagerListener ( @NotNull MapManagerListener< G, A, R > listener)
 Removes a MapManagerListener to be notified. More...
 
void revert ( @NotNull MapControl< G, A, R > mapControl) throws IOException
 Reverts one map. More...
 
void setCurrentMap ( @Nullable MapControl< G, A, R > mapControl)
 Sets the given map as the current one. More...
 

Protected Member Functions

 AbstractMapManager (@NotNull final MapReaderFactory< G, A > mapReaderFactory, @NotNull final ProjectSettings projectSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager)
 Create a new map manager. More...
 
abstract MapControl< G, A, R > createMapControl (@Nullable List< G > objects, @NotNull A mapArchObject, @Nullable MapFile mapFile)
 Creates a new MapControl instance. More...
 

Private Member Functions

MapReader< G, A > decodeMapFile (@NotNull final File file, final boolean interactive) throws IOException
 Load a map file. More...
 

Private Attributes

MapControl< G, A, R > currentMapControl
 The current top map we are working with. More...
 
FileControl< G, A, R > fileControl
 The main control. More...
 
final EventListenerList2< MapManagerListener< G, A, R > > listenerList = new EventListenerList2<>(MapManagerListener.class)
 The MapManagerListeners to inform of changes. More...
 
final List< MapControl< G, A, R > > mapControls = new CopyOnWriteArrayList<>()
 All open maps. More...
 
final MapReaderFactory< G, A > mapReaderFactory
 The gridarta objects factory instance. More...
 
final PathManager pathManager
 The PathManager for converting File instances. More...
 
final ProjectSettings projectSettings
 The project settings instance. More...
 

Static Private Attributes

static final int DELETED_OBJECTS_TO_REPORT = 10
 The maximum number of deleted game objects to report. More...
 

Detailed Description

Abstract base class for MapManager implementations.

Author
Andreas Kirschbaum

Definition at line 48 of file AbstractMapManager.java.

Constructor & Destructor Documentation

◆ AbstractMapManager()

net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.AbstractMapManager ( @NotNull final MapReaderFactory< G, A >  mapReaderFactory,
@NotNull final ProjectSettings  projectSettings,
@NotNull final FaceObjectProviders  faceObjectProviders,
@NotNull final PathManager  pathManager 
)
protected

Create a new map manager.

Parameters
mapReaderFactorythe map reader factory instance
projectSettingsthe project settings instance
faceObjectProvidersthe face object providers
pathManagerthe path manager for converting file instances

Definition at line 102 of file AbstractMapManager.java.

Member Function Documentation

◆ addMapManagerListener()

void net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addMapManagerListener ( @NotNull final MapManagerListener< G, A, R >  listener)

Definition at line 292 of file AbstractMapManager.java.

◆ closeMap()

void net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.closeMap ( @NotNull final MapControl< G, A, R >  mapControl)

Definition at line 165 of file AbstractMapManager.java.

Referenced by net.sf.gridarta.model.mapmanager.AbstractMapManager< G, A, R >.release().

+ Here is the caller graph for this function:

◆ createMapControl()

abstract MapControl<G, A, R> net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.createMapControl ( @Nullable List< G >  objects,
@NotNull A  mapArchObject,
@Nullable MapFile  mapFile 
)
abstractprotected

Creates a new MapControl instance.

Parameters
objectsthe objects to insert into the new map
mapArchObjectthe map arch object to use for the new map
mapFilethe associated map file
Returns
the new map control instance

Referenced by net.sf.gridarta.model.mapmanager.AbstractMapManager< G, A, R >.newMap().

+ Here is the caller graph for this function:

◆ decodeMapFile()

MapReader<G, A> net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.decodeMapFile ( @NotNull final File  file,
final boolean  interactive 
) throws IOException
private

Load a map file.

Parameters
filethe map file to load
interactiveif set, may ask to delete undefined archetypes; if unset, keep undefined archetypes
Returns
the decoder objects containing the loaded map data, or
null
if loading failed
Exceptions
IOExceptionif an I/O error occurs

Definition at line 213 of file AbstractMapManager.java.

Referenced by net.sf.gridarta.model.mapmanager.AbstractMapManager< G, A, R >.openMapFile(), and net.sf.gridarta.model.mapmanager.AbstractMapManager< G, A, R >.revert().

+ Here is the caller graph for this function:

◆ getCurrentMap()

MapControl<G, A, R> net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getCurrentMap ( )

Returns the current top map we are working with.

Returns
the current top map we are working with, or
null
if no map is open

Definition at line 287 of file AbstractMapManager.java.

◆ getLocalMapDir()

File net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getLocalMapDir ( )

Definition at line 329 of file AbstractMapManager.java.

◆ getOpenedMaps()

List<MapControl<G, A, R> > net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getOpenedMaps ( )

Definition at line 276 of file AbstractMapManager.java.

◆ getOpenMap()

MapControl<G, A, R> net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getOpenMap ( )

Definition at line 151 of file AbstractMapManager.java.

◆ newMap()

MapControl<G, A, R> net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.newMap ( @Nullable final List< G >  objects,
@NotNull final A  mapArchObject,
@Nullable final MapFile  mapFile,
final boolean  interactive 
)

Definition at line 127 of file AbstractMapManager.java.

Referenced by net.sf.gridarta.model.mapmanager.AbstractMapManager< G, A, R >.openMapFile().

+ Here is the caller graph for this function:

◆ openMapFile() [1/2]

MapControl<G, A, R> net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.openMapFile ( @NotNull final MapFile  mapFile,
final boolean  interactive 
) throws IOException

Definition at line 182 of file AbstractMapManager.java.

Referenced by net.sf.gridarta.model.mapmanager.AbstractMapManager< G, A, R >.openMapFile().

+ Here is the caller graph for this function:

◆ openMapFile() [2/2]

MapControl<G, A, R> net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.openMapFile ( @NotNull final File  file,
final boolean  interactive 
) throws IOException

Definition at line 199 of file AbstractMapManager.java.

◆ release()

void net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.release ( @NotNull final MapControl< G, A, R >  mapControl)

Definition at line 344 of file AbstractMapManager.java.

◆ removeMapManagerListener()

void net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.removeMapManagerListener ( @NotNull final MapManagerListener< G, A, R >  listener)

Definition at line 297 of file AbstractMapManager.java.

◆ revert()

void net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.revert ( @NotNull final MapControl< G, A, R >  mapControl) throws IOException

Definition at line 302 of file AbstractMapManager.java.

◆ setCurrentMap()

void net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setCurrentMap ( @Nullable final MapControl< G, A, R >  mapControl)

◆ setFileControl()

void net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setFileControl ( @NotNull final FileControl< G, A, R >  fileControl)

Definition at line 121 of file AbstractMapManager.java.

Referenced by net.sf.gridarta.model.mapcontrol.TestMapControlCreator.TestMapControlCreator().

+ Here is the caller graph for this function:

Member Data Documentation

◆ currentMapControl

◆ DELETED_OBJECTS_TO_REPORT

final int net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.DELETED_OBJECTS_TO_REPORT = 10
staticprivate

The maximum number of deleted game objects to report.

Definition at line 53 of file AbstractMapManager.java.

◆ fileControl

FileControl<G, A, R> net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.fileControl
private

◆ listenerList

final EventListenerList2<MapManagerListener<G, A, R> > net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.listenerList = new EventListenerList2<>(MapManagerListener.class)
private

The MapManagerListeners to inform of changes.

Definition at line 87 of file AbstractMapManager.java.

◆ mapControls

final List<MapControl<G, A, R> > net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapControls = new CopyOnWriteArrayList<>()
private

All open maps.

Definition at line 82 of file AbstractMapManager.java.

◆ mapReaderFactory

final MapReaderFactory<G, A> net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapReaderFactory
private

The gridarta objects factory instance.

Definition at line 71 of file AbstractMapManager.java.

Referenced by net.sf.gridarta.model.mapmanager.AbstractMapManager< G, A, R >.AbstractMapManager().

◆ pathManager

final PathManager net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.pathManager
private

◆ projectSettings

final ProjectSettings net.sf.gridarta.model.mapmanager.AbstractMapManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.projectSettings
private

The project settings instance.

Definition at line 65 of file AbstractMapManager.java.

Referenced by net.sf.gridarta.model.mapmanager.AbstractMapManager< G, A, R >.AbstractMapManager().


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