20 package net.sf.gridarta.gui.mapdesktop;
22 import java.awt.event.ActionEvent;
24 import javax.swing.AbstractAction;
25 import javax.swing.KeyStroke;
38 import org.jetbrains.annotations.NotNull;
39 import org.jetbrains.annotations.Nullable;
86 public void mapCreated(@NotNull
final MapControl<G, A, R> mapControl,
final boolean interactive) {
111 public void mapSizeChanged(@NotNull
final Size2D newSize) {
121 public void mapObjectsChanged(@NotNull
final Set<G> gameObjects, @NotNull
final Set<G> transientGameObjects) {
131 public void mapFileChanged(@Nullable
final MapFile oldMapFile) {
136 public void modifiedChanged() {
152 putValue(SHORT_DESCRIPTION,
"Switches to map " + mapView.getInternalFrame().getTitle());
153 mapView.getMapControl().getMapModel().addMapModelListener(mapModelListener);
165 if (0 <= index && index <= 10) {
166 putValue(MNEMONIC_KEY, KeyStroke.getKeyStroke(Integer.toString(index % 10)).getKeyCode());
167 putValue(ACCELERATOR_KEY, KeyStroke.getKeyStroke(
"ctrl pressed " + index % 10));
169 putValue(MNEMONIC_KEY, null);
170 putValue(ACCELERATOR_KEY, null);
180 if (0 <= index && index <= 10) {
181 putValue(NAME, index +
": " + windowTitle);
183 putValue(NAME, windowTitle);
196 return super.clone();
197 }
catch (
final CloneNotSupportedException ex) {
198 throw new AssertionError(ex);
void updateName()
Updates the action's name to the current map state.
final MapManagerListener< G, A, R > mapManagerListener
The MapManagerListener to detect closed maps.
void removeMapManagerListener(@NotNull MapManagerListener< G, A, R > listener)
Removes a MapManagerListener to be notified.
A MapManager manages all opened maps.
Graphical User Interface of Gridarta.
This package contains the framework for validating maps.
final MapView< G, A, R > mapView
The associated map view.
Interface for listeners listening on MapModel events.
void actionPerformed(@NotNull final ActionEvent e)
MapControl< G, A, R > getMapControl()
Return the controller of this view.
MapModel< G, A, R > getMapModel()
Returns the map model.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
Action class for selecting this window.
String getWindowTitle()
Returns the title for the map window.
static final long serialVersionUID
The serial version UID.
Interface for listeners listening to MapManager changes.
GameObjects are the objects based on Archetypes found on maps.
WindowAction(@NotNull final MapDesktop< G, A, R > mapDesktop, @NotNull final MapView< G, A, R > mapView, @NotNull final MapManager< G, A, R > mapManager)
Create a new instance.
Base classes for rendering maps.
final void setIndex(final int index)
Set the index of this action so this Action knows what Mnemonic and Accelerator to use...
void removeMapModelListener(@NotNull MapModelListener< G, A, R > listener)
Unregister a map listener.
void addMapManagerListener(@NotNull MapManagerListener< G, A, R > listener)
Adds a MapManagerListener to be notified.
void setCurrentMapView(@NotNull final MapView< G, A, R > mapView)
Sets the given level view as the current one.
Currently nothing more than a marker interface for unification.
A map view consists of a map grid and a map cursor, and is attached to a map control.
final MapManager< G, A, R > mapManager
The MapManager to use.
An interface for classes that collect errors.
final MapModelListener< G, A, R > mapModelListener
The MapModelListener to detect modified maps.
int index
The index of this action.
The location of a map file with a map directory.
Interface for MapArchObjects.
final MapDesktop< G, A, R > mapDesktop
The map desktop.
The class Size2D represents a 2d rectangular area.