20 package net.sf.gridarta.plugin.parameter;
23 import java.io.IOException;
31 import org.jetbrains.annotations.NotNull;
32 import org.jetbrains.annotations.Nullable;
37 public class MapParameter<G
extends GameObject<G, A, R>, A extends
MapArchObject<A>, R extends
Archetype<G, A, R>> extends
AbstractStringPluginParameter<G, A, R, MapControl<G, A, R>> {
87 return visitor.visit(
this);
94 if (CURRENT_MAP.equals(stringValue)) {
96 if (currentMap == null) {
97 throw new InvalidValueException(
"no map is opened");
106 mapControl = mapManager.
openMapFile(mapFile,
false);
107 }
catch (
final IOException ex) {
108 throw new InvalidValueException(
"map " + stringValue +
" does not exist: " + ex.getMessage(), ex);
final MapManager< G, A, R > mapManager
The MapManager for converting map paths to MapControl instances.
A PluginParameter that holds a MapControl value.
void setValueToCurrent()
Selects the current map.
This class contains methods for converting relative map paths to absolute map paths and vice versa...
A MapManager manages all opened maps.
String stringValue
The current value.
Reading and writing of maps, handling of paths.
final PathManager pathManager
The PathManager instance for converting Files into path names.
Abstract base class for PluginParameter implementations for which the value is calculated from the st...
MapFile getMapFile(@NotNull final AbsoluteMapPath mapPath)
Returns a MapFile instance from an AbsoluteMapPath.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
boolean isCurrentMap()
Returns whether the current map is selected.
MapControl< G, A, R > getValueOrNull()
static final String CURRENT_MAP
The string representation for the current map.
String getParameterType()
GameObjects are the objects based on Archetypes found on maps.
Interface for visitors of PluginParameter instances.
MapControl< G, A, R > getCurrentMap()
Returns the current map.
void acquire()
Increases the use counter.
MapControl< G, A, R > getValue()
Currently nothing more than a marker interface for unification.
An exception that is thrown if the string representation of value in a PluginParameter cannot be conv...
boolean setStringValue( @NotNull final String stringValue)
Updates the parameter value.
MapControl< G, A, R > openMapFile(@NotNull MapFile mapFile, boolean interactive)
Loads a map file.
static final String PARAMETER_TYPE
The string representation of this parameter type.
MapParameter(@NotNull final MapManager< G, A, R > mapManager, @NotNull final PathManager pathManager)
Creates a new instance.
The location of a map file with a map directory.
Interface for MapArchObjects.