Gridarta Editor
net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R > Class Template Reference

Maintains the state of a pickmap file. More...

+ Inheritance diagram for net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:
+ Collaboration diagram for net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:

Public Member Functions

void freePickmap ()
 Unloads the map file. More...
 
File getFile ()
 Returns the underlying map file. More...
 
MapView< G, A, R > getMapView ()
 Returns the MapView instance for this pickmap. More...
 
MapControl< G, A, R > getPickmap ()
 Returns the MapControl representing this pickmap. More...
 
void getUnsavedPickmaps (@NotNull final Collection< MapControl< G, A, R >> unsavedPickmaps)
 Returns this pickmap if it has been loaded and is modified. More...
 
void loadPickmap () throws IOException
 Loads the pickmap from the underlying map file. More...
 
 PickmapState (@NotNull final MapFolder< G, A, R > mapFolder, @NotNull final String name, @NotNull final MapReaderFactory< G, A > mapReaderFactory, @NotNull final MapManager< G, A, R > pickmapManager, @NotNull final MapViewsManager< G, A, R > mapViewsManager) throws InvalidNameException
 Creates a new instance. More...
 
void remove (final boolean deleteFile)
 Removes this pickmap from its folder. More...
 
void revert () throws IOException
 Reverts this pickmap to its underlying map file. More...
 
void save () throws IOException
 Saves this pickmap. More...
 

Static Public Member Functions

static boolean isValidPickmapName (@NotNull final CharSequence name)
 Returns whether a pickmap name is valid. More...
 

Private Attributes

final MapFolder< G, A, R > mapFolder
 The folder this pickmap is part of. More...
 
final MapReaderFactory< G, A > mapReaderFactory
 The MapReaderFactory to use. More...
 
final MapViewsManager< G, A, R > mapViewsManager
 The MapViewsManager. More...
 
final String name
 The underlying map file name. More...
 
MapControl< G, A, R > pickmap
 The MapControl instance representing the map file, or. More...
 
final MapManager< G, A, R > pickmapManager
 The MapManager for creating new pickmaps. More...
 
MapView< G, A, R > pickmapView
 The MapView or pickmap, or. More...
 
final Object sync = new Object()
 The synchronization object for accessed to pickmap and pickmapView. More...
 

Static Private Attributes

static final Pattern PATTERN_VALID_PICKMAP_NAME = Pattern.compile("[-a-zA-Z_+ 0-9,]+")
 The Pattern that matches valid pickmap names. More...
 

Detailed Description

Maintains the state of a pickmap file.

A

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.

Author
Andreas Kirschbaum

Definition at line 45 of file PickmapState.java.

Constructor & Destructor Documentation

◆ PickmapState()

net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.PickmapState ( @NotNull final MapFolder< G, A, R >  mapFolder,
@NotNull final String  name,
@NotNull final MapReaderFactory< G, A >  mapReaderFactory,
@NotNull final MapManager< G, A, R >  pickmapManager,
@NotNull final MapViewsManager< G, A, R >  mapViewsManager 
) throws InvalidNameException

Creates a new instance.

Parameters
mapFolderthe folder ths pickmap is part of
namethe underlying map file name
mapReaderFactorythe map reader factory to use
pickmapManagerthe map manager for creating pickmaps
mapViewsManagerthe map views
Exceptions
InvalidNameExceptionif is not valid

Definition at line 113 of file PickmapState.java.

Member Function Documentation

◆ freePickmap()

void net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.freePickmap ( )

Unloads the map file.

Undoes the effect of loadPickmap().

Definition at line 189 of file PickmapState.java.

Referenced by net.sf.gridarta.gui.mapfiles.PickmapState< G, A, R >.revert().

+ Here is the caller graph for this function:

◆ getFile()

◆ getMapView()

MapView<G, A, R> net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getMapView ( )

Returns the MapView instance for this pickmap.

Returns

null

unless loadPickmap() was successfully called.

Returns
the
MapView
instance, or
null
if the map file has not been loaded

Definition at line 163 of file PickmapState.java.

Referenced by net.sf.gridarta.gui.panel.objectchooser.DefaultObjectChooser< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.updateActivePickmap().

+ Here is the caller graph for this function:

◆ getPickmap()

MapControl<G, A, R> net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getPickmap ( )

◆ getUnsavedPickmaps()

void net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.getUnsavedPickmaps ( @NotNull final Collection< MapControl< G, A, R >>  unsavedPickmaps)

Returns this pickmap if it has been loaded and is modified.

Parameters
unsavedPickmapsthe collection to add
this
to if modified

Definition at line 205 of file PickmapState.java.

◆ isValidPickmapName()

static boolean net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.isValidPickmapName ( @NotNull final CharSequence  name)
static

Returns whether a pickmap name is valid.

Parameters
namethe name to check
Returns
whether the name is valid

Definition at line 130 of file PickmapState.java.

Referenced by net.sf.gridarta.gui.panel.pickmapchooser.PickmapChooserView< G, A, R >.newPickmap(), and net.sf.gridarta.gui.mapfiles.PickmapState< G, A, R >.PickmapState().

+ Here is the caller graph for this function:

◆ loadPickmap()

void net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.loadPickmap ( ) throws IOException

Loads the pickmap from the underlying map file.

Exceptions
IOExceptionif the map file cannot be loaded

Definition at line 173 of file PickmapState.java.

Referenced by net.sf.gridarta.gui.mapfiles.PickmapState< G, A, R >.revert().

+ Here is the caller graph for this function:

◆ remove()

void net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.remove ( final boolean  deleteFile)

Removes this pickmap from its folder.

Parameters
deleteFileif set, delete the map file as well

Definition at line 217 of file PickmapState.java.

Referenced by net.sf.gridarta.gui.panel.pickmapchooser.PickmapChooserControl<?, ?, ?>.doDeletePickmap().

+ Here is the caller graph for this function:

◆ revert()

void net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.revert ( ) throws IOException

Reverts this pickmap to its underlying map file.

Does nothing if the pickmap is not loaded.

Exceptions
IOExceptionif the pickmap cannot be loaded

Definition at line 238 of file PickmapState.java.

Referenced by net.sf.gridarta.gui.panel.pickmapchooser.PickmapChooserControl<?, ?, ?>.doRevertPickmap(), and net.sf.gridarta.gui.panel.pickmapchooser.PickmapChooserControl<?, ?, ?>.reloadPickmap().

+ Here is the caller graph for this function:

◆ save()

void net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.save ( ) throws IOException

Saves this pickmap.

Does nothing if the pickmap is not loaded or not modified.

Exceptions
IOExceptionif saving fails

Definition at line 226 of file PickmapState.java.

Referenced by net.sf.gridarta.gui.panel.pickmapchooser.PickmapChooserControl<?, ?, ?>.doSavePickmap().

+ Here is the caller graph for this function:

Member Data Documentation

◆ mapFolder

final MapFolder<G, A, R> net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapFolder
private

The folder this pickmap is part of.

Definition at line 57 of file PickmapState.java.

Referenced by net.sf.gridarta.gui.mapfiles.PickmapState< G, A, R >.PickmapState().

◆ mapReaderFactory

final MapReaderFactory<G, A> net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapReaderFactory
private

◆ mapViewsManager

final MapViewsManager<G, A, R> net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapViewsManager
private

◆ name

final String net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.name
private

◆ PATTERN_VALID_PICKMAP_NAME

final Pattern net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.PATTERN_VALID_PICKMAP_NAME = Pattern.compile("[-a-zA-Z_+ 0-9,]+")
staticprivate

The Pattern that matches valid pickmap names.

Definition at line 51 of file PickmapState.java.

◆ pickmap

MapControl<G, A, R> net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.pickmap
private

The MapControl instance representing the map file, or.

null

if the map file is not loaded.

Definition at line 82 of file PickmapState.java.

Referenced by net.sf.gridarta.gui.mapfiles.PickmapState< G, A, R >.getPickmap().

◆ pickmapManager

final MapManager<G, A, R> net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.pickmapManager
private

The MapManager for creating new pickmaps.

Definition at line 69 of file PickmapState.java.

Referenced by net.sf.gridarta.gui.mapfiles.PickmapState< G, A, R >.PickmapState().

◆ pickmapView

MapView<G, A, R> net.sf.gridarta.gui.mapfiles.PickmapState< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.pickmapView
private

The MapView or pickmap, or.

null

if

pickmap == null

.

Definition at line 89 of file PickmapState.java.

Referenced by net.sf.gridarta.gui.mapfiles.PickmapState< G, A, R >.getMapView().

◆ sync


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