20 package net.sf.gridarta.action;
22 import java.awt.Point;
23 import java.util.List;
24 import javax.swing.Action;
37 import net.
sf.japi.swing.action.ActionMethod;
38 import org.jetbrains.annotations.NotNull;
39 import org.jetbrains.annotations.Nullable;
67 public void mapGridChanged(@NotNull
final MapGridEvent e) {
72 public void mapGridResized(@NotNull
final MapGridEvent e) {
87 public void setAction(@NotNull
final Action action, @NotNull
final String name) {
109 if (mapView == null) {
119 if (selectedSquares.isEmpty()) {
126 final Point point =
new Point();
130 for (
int dy = -1; dy <= 1; dy++) {
131 for (
int dx = -1; dx <= 1; dx++) {
132 mapSquare.getMapLocation(point, dx, dy);
149 if (currentMapView != null) {
150 currentMapView.
getMapGrid().removeMapGridListener(mapGridListener);
152 currentMapView = mapView;
153 if (currentMapView != null) {
154 currentMapView.
getMapGrid().addMapGridListener(mapGridListener);
Rectangle getSelectedRec()
Returns the smallest rectangle containing selection.
List< MapSquare< G, A, R > > getSelectedSquares()
Returns the selected squares.
boolean isPointValid(@Nullable Point pos)
Checks whether the given coordinate is within map bounds.
A MapModel reflects the data of a map.
Graphical User Interface of Gridarta.
MapView< G, A, R > currentMapView
The active map view, or.
void mapViewCreated(@NotNull final MapView< G, A, R > mapView)
This event handler is called when a map view was created.
MapGrid getMapGrid()
Returns the MapGrid of this view.
MapControl< G, A, R > getMapControl()
Return the controller of this view.
void setAction(@NotNull final Action action, @NotNull final String name)
Sets the Action instance for this editor action.
void growSelection()
Grows the current map selection by one map square.
Action action
The action associated with this editor action.
MapModel< G, A, R > getMapModel()
Returns the map model.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
Interface for listeners listening to MapGridEvents.
GameObjects are the objects based on Archetypes found on maps.
Interface for listeners interested in events related to MapViewManager instances. ...
2D-Grid containing flags for selection, pre-selection, cursor, warnings and errors.
void mapViewClosing(@NotNull final MapView< G, A, R > mapView)
This event handler is called when a map view is to be closed.
Base classes for rendering maps.
void beginTransaction()
Starts a new transaction.
A getMapArchObject()
Returns the Map Arch Object with the meta information about the map.
void select(@NotNull final Point pos, @NotNull final SelectionMode selectionMode)
Selects or deselects a single square.
void endTransaction()
Ends a transaction.
A map view consists of a map grid and a map cursor, and is attached to a map control.
ADD
All squares that are preselected get selected.
Modes that describe how squares get selected.
void activeMapViewChanged(@Nullable final MapView< G, A, R > mapView)
This event handler is called when the current map view has changed.
void updateAction()
Updates the action's enabled state.
An EditorAction that grows the current selection by one map square.
final MapGridListener mapGridListener
The MapGridListener attached to currentMapView.
Interface for MapArchObjects.
This event is created by MapGrid.
boolean doGrowSelection(final boolean performAction)
Grows the current map selection by one map square.