 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.panel.pickmapchooser;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.Collections;
26 import java.util.HashMap;
27 import java.util.Iterator;
28 import java.util.LinkedList;
29 import java.util.List;
44 import org.jetbrains.annotations.NotNull;
45 import org.jetbrains.annotations.Nullable;
57 private final List<PickmapState<G, A, R>>
pickmapStates =
new ArrayList<>();
63 private final Collection<PickmapChooserModelListener<G, A, R>>
listeners =
new LinkedList<>();
78 final int index = tmp >= 0 ? tmp : -tmp - 1;
124 if (pickmapState.getFile().equals(file)) {
150 public Iterator<PickmapState<G, A, R>>
iterator() {
151 return Collections.unmodifiableList(
pickmapStates).iterator();
170 pickmapState.freePickmap();
180 listeners.add(pickmapChooserModelListener);
189 listener.pickmapReverted(pickmapState);
199 listener.activePickmapChanged(pickmapState);
210 listener.pickmapModifiedChanged(index, pickmapState);
233 assert mapModelListener !=
null;
234 mapControl.getMapModel().removeMapModelListener(mapModelListener);
267 public void mapObjectsChanged(@NotNull
final Set<G> gameObjects, @NotNull
final Set<G> transientGameObjects) {
285 if (pickmapState.getPickmap().getMapModel() ==
mapModel) {
A MapModel reflects the data of a map.
Base package of all Gridarta classes.
A MapModelListener which tracks a pickmap for modifications.
void errorsChanged(@NotNull final ErrorCollector< G, A, R > errors)
The errors of a map model have changed.
void modifiedChanged()
The modified flag has changed.
PickmapState< G, A, R > getPickmap(@NotNull final File file)
Returns the pickmap by file name.
int indexOf(@NotNull final PickmapState< G, A, R > pickmapState)
Returns the index of a map file.
void addMapModelListener(@NotNull final MapControl< G, A, R > mapControl)
Tracks a MapControl instance for changes.
PickmapChooserMapModelListener(@NotNull final MapModel< G, A, R > mapModel)
Creates a new instance.
void fireActivePickmapChanged(@Nullable final PickmapState< G, A, R > pickmapState)
Notifies all listeners that the active pickmap has changes.
Reflects a game object (object on a map).
int removeMapFile(@NotNull final PickmapState< G, A, R > pickmapState)
Removes a map file.
void addMapModelListener(@NotNull MapModelListener< G, A, R > listener)
Register a map listener.
void mapFileChanged(@Nullable final MapFile oldMapFile)
The map file has changed.
boolean isEmpty()
Returns whether no pickmaps exist in the current folder.
Graphical User Interface of Gridarta.
int revertMapFile(@NotNull final MapControl< G, A, R > oldPickmap, @NotNull final PickmapState< G, A, R > pickmapState)
Reverts a map file.
GameObjects are the objects based on Archetypes found on maps.
A Comparator for comparing MapFiles by pickmap name.
final Collection< PickmapChooserModelListener< G, A, R > > listeners
The listeners to notify.
void mapSquaresChanged(@NotNull final Set< MapSquare< G, A, R >> mapSquares)
Squares of a map have changed.
Interface for MapArchObjects.
An interface for classes that collect errors.
final List< PickmapState< G, A, R > > pickmapStates
All open pickmaps.
final MapModel< G, A, R > mapModel
The tracked MapModel.
Maintains loaded PickmapState instances.
This package contains the framework for validating maps.
The location of a map file with a map directory.
Maintains the state of a pickmap file.
static final Comparator< PickmapState<?, ?, ?> > INSTANCE
A Comparator that compares PickmapState instances by name.
void firePickmapReverted(@NotNull final PickmapState< G, A, R > pickmapState)
Notifies all listeners that the a pickmap has been reverted.
void mapObjectsChanged(@NotNull final Set< G > gameObjects, @NotNull final Set< G > transientGameObjects)
One or more GameObjects on a map have changed.
Interface for listeners listening on MapModel events.
void addPickmapChooserListener(@NotNull final PickmapChooserModelListener< G, A, R > pickmapChooserModelListener)
Adds a PickmapChooserModelListener to be notified.
void removeMapModelListener(@NotNull final MapControl< G, A, R > mapControl)
Stops tracking a MapControl instance for changes.
void clear()
Removes all map files.
void firePickmapModifiedChanged(final int index, @NotNull final PickmapState< G, A, R > pickmapState)
Notifies all listeners that a pickmap has been modified.
int addMapFile(@NotNull final PickmapState< G, A, R > pickmapState)
Adds a map file.
void mapSizeChanged(@NotNull final Size2D newSize)
The size of a map has changed.
Currently nothing more than a marker interface for unification.
The class Size2D represents a 2d rectangular area.
final Map< MapControl< G, A, R >, MapModelListener< G, A, R > > mapModelListeners
Maps MapControl instance to attached MapModelListener.
Iterator< PickmapState< G, A, R > > iterator()