20 package net.sf.gridarta.gui.mapfiles;
23 import java.util.Arrays;
33 import org.jetbrains.annotations.NotNull;
34 import org.jetbrains.annotations.Nullable;
80 public Loader(@NotNull
final ErrorView errorView, @NotNull
final MapFolderTree<G, A, R> mapFolderTree, @NotNull
final MapReaderFactory<G, A> mapReaderFactory, @NotNull
final MapManager<G, A, R> pickmapManager, @NotNull
final MapViewsManager<G, A, R> mapViewsManager) {
93 if (mapFolder != null) {
107 final File baseDir = mapFolderTree.
getBaseDir();
108 final File dir = parent == null ? baseDir :
new File(parent.getDir(), folderName);
110 final File[] files = dir.listFiles();
132 for (
final File file : files) {
139 }
else if (file.isDirectory()) {
140 if (!file.getName().startsWith(
".")) {
142 if (result == null && tmp != null && tmp.
getPickmaps() > 0) {
149 return mapFolder.
getPickmaps() > 0 ? mapFolder : result;
final ErrorView errorView
The ErrorView for reporting errors.
final MapFolderTree< G, A, R > mapFolderTree
The model to add the loaded pickmaps to.
File getBaseDir()
Returns the base directory for creating new map folders.
Convenience class for adding messages to a ErrorView instance using a fixed category name...
A MapManager manages all opened maps.
Graphical User Interface of Gridarta.
Reading and writing of maps, handling of paths.
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.
A factory for creating MapReader instances.
Stores all existing MapViews.
Defines possible error categories for ErrorView instances.
Interface for classes displaying error messages.
synchronized void addMapFolder(@NotNull final MapFolder< G, A, R > mapFolder)
Adds a map folder to this model.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
Indicates that a folder name is not unique.
int getPickmaps()
Returns the number of pickmaps in this folder.
GameObjects are the objects based on Archetypes found on maps.
final MapViewsManager< G, A, R > mapViewsManager
The MapViewsManager.
Base classes for rendering maps.
Loader(@NotNull final ErrorView errorView, @NotNull final MapFolderTree< G, A, R > mapFolderTree, @NotNull final MapReaderFactory< G, A > mapReaderFactory, @NotNull final MapManager< G, A, R > pickmapManager, @NotNull final MapViewsManager< G, A, R > mapViewsManager)
Creates a new instance.
String getName()
Returns the name.
final MapReaderFactory< G, A > mapReaderFactory
The MapReaderFactory for loading map files.
synchronized void setActiveMapFolder(@NotNull final MapFolder< G, A, R > mapFolder)
Sets the active map folder.
MapFolder< G, A, R > load(@Nullable final MapFolder< G, A, R > parent, @NotNull final String folderName)
Loads all pickmap files from a directory and its sub-directories.
Loader for pickmaps from a directory.
final MapManager< G, A, R > pickmapManager
The MapManager for loading pickmaps.
Interface for MapArchObjects.
Indicates that a folder or pickmap name is invalid.
void load()
Loads all pickmap files from a directory and its sub-directories.