 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.mapfiles;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.Collections;
26 import java.util.Iterator;
27 import java.util.List;
28 import java.util.concurrent.CopyOnWriteArrayList;
29 import java.util.regex.Pattern;
37 import org.jetbrains.annotations.NotNull;
38 import org.jetbrains.annotations.Nullable;
58 private final Collection<MapFolderListener<G, A, R>>
listeners =
new CopyOnWriteArrayList<>();
70 private final Object
sync =
new Object();
93 private final List<PickmapState<G, A, R>>
pickmapStates =
new ArrayList<>();
157 synchronized (
sync) {
162 listenerMap.pickmapAdded(pickmapState);
173 synchronized (
sync) {
176 throw new IllegalArgumentException(
"pickmap is not part of this folder: " + pickmapState.getFile());
179 final File file = pickmapState.getFile();
185 listenerMap.pickmapRemoved(pickmapState);
187 pickmapState.freePickmap();
197 synchronized (
sync) {
213 public Iterator<PickmapState<G, A, R>>
iterator() {
214 return Collections.unmodifiableList(
pickmapStates).iterator();
247 pickmapState.getUnsavedPickmaps(unsavedPickmaps);
258 listenerMap.pickmapReverted(pickmapState, oldPickmap);
final File baseDir
The base directory for folder file names.
A MapManager manages all opened maps.
final Collection< MapFolderListener< G, A, R > > listeners
The registered event listeners.
Base package of all Gridarta classes.
A factory for creating MapReader instances.
final List< PickmapState< G, A, R > > pickmapStates
The pickmaps of this folder.
static final Pattern PATTERN_VALID_MAP_FOLDER_NAME
The Pattern that matches valid map folder names.
MapFolder(@Nullable final MapFolder< G, A, R > parent, @NotNull final String name, @NotNull final File baseDir, @NotNull final MapViewsManager< G, A, R > mapViewsManager)
Creates a new instance.
void addFolderListener(@NotNull final MapFolderListener< G, A, R > listenerMap)
Adds a MapFolderListener to be notified of events.
Iterator< PickmapState< G, A, R > > iterator()
Returns an Iterator returning all pickmaps of this folder in arbitrary order.
void removeFolderListener(@NotNull final MapFolderListener< G, A, R > listenerMap)
Removes a MapFolderListener to be notified of events.
Reflects a game object (object on a map).
MapFolder< G, A, R > getParent()
Returns the parent folder.
final String name
The folder's name.
Graphical User Interface of Gridarta.
File getDir()
Returns the base directory.
final Object sync
The synchronization object for accesses to pickmapStates.
GameObjects are the objects based on Archetypes found on maps.
String getName()
Returns the name.
Indicates that a folder or pickmap name is invalid.
void removeAllPickmaps(final boolean deleteFile)
Removes all PickmapState from this folder.
void firePickmapReverted(@NotNull final PickmapState< G, A, R > pickmapState, @NotNull final MapControl< G, A, R > oldPickmap)
Notifies all listeners about a reverted pickmap.
Interface for MapArchObjects.
Model class representing a folder of MapFiles.
PickmapState< G, A, R > addPickmap(@NotNull final String name, @NotNull final MapReaderFactory< G, A > mapReaderFactory, @NotNull final MapManager< G, A, R > pickmapManager)
Adds a new PickmapState to this folder.
void getUnsavedPickmaps(@NotNull final Collection< MapControl< G, A, R >> unsavedPickmaps)
Returns all unsaved MapFiles in this folder.
Reading and writing of maps, handling of paths.
final MapFolder< G, A, R > parent
The parent folder, or.
Base classes for rendering maps.
void removePickmap(@NotNull final PickmapState< G, A, R > pickmapState, final boolean deleteFile)
Removes a PickmapState from this folder.
Currently nothing more than a marker interface for unification.
int getPickmaps()
Returns the number of pickmaps in this folder.
final MapViewsManager< G, A, R > mapViewsManager
The MapViewsManager.
Stores all existing MapViews.