 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.action;
22 import java.awt.Point;
23 import java.util.IdentityHashMap;
24 import java.util.List;
26 import javax.swing.Action;
39 import net.
sf.japi.swing.action.ActionMethod;
40 import org.jetbrains.annotations.NotNull;
41 import org.jetbrains.annotations.Nullable;
70 public void mapGridChanged(@NotNull
final MapGridEvent e) {
75 public void mapGridResized(@NotNull
final MapGridEvent e) {
121 if (selectedSquares.isEmpty()) {
128 final Point point =
new Point();
131 final Map<MapSquare<G, A, R>, Void> mapSquaresToShrink =
new IdentityHashMap<>();
134 for (
int dy = -1; dy <= 1; dy++) {
135 for (
int dx = -1; dx <= 1; dx++) {
136 if (dx != 0 || dy != 0) {
137 mapSquare.getMapLocation(point, dx, dy);
139 mapSquaresToShrink.put(mapSquare,
null);
147 mapSquare.getMapLocation(point);
void addMapGridListener(@NotNull final MapGridListener listener)
Registers a MapGridListener.
A MapModel reflects the data of a map.
int getFlags(final int x, final int y)
Returns the flags of a square.
void endTransaction()
Ends a transaction.
MapGrid getMapGrid()
Returns the MapGrid of this view.
A getMapArchObject()
Returns the Map Arch Object with the meta information about the map.
MapControl< G, A, R > getMapControl()
Return the controller of this view.
Base package of all Gridarta classes.
void setAction(@NotNull final Action action, @NotNull final String name)
Sets the Action instance for this editor action.
static final int GRID_FLAG_SELECTION
Selection - marks all selected squares.
boolean isPointValid(@Nullable Point pos)
Checks whether the given coordinate is within map bounds.
void mapViewCreated(@NotNull final MapView< G, A, R > mapView)
This event handler is called when a map view was created.
Interface for listeners interested in events related to {} instances.
SUB
All squares that are preselected get unselected.
Rectangle getSelectedRec()
Returns the smallest rectangle containing selection.
Reflects a game object (object on a map).
final MapGridListener mapGridListener
The MapGridListener attached to currentMapView.
void updateAction()
Updates the action's enabled state.
Graphical User Interface of Gridarta.
void beginTransaction()
Starts a new transaction.
void activeMapViewChanged(@Nullable final MapView< G, A, R > mapView)
This event handler is called when the current map view has changed.
GameObjects are the objects based on Archetypes found on maps.
Interface for MapArchObjects.
MapView< G, A, R > currentMapView
The active map view, or.
A map view consists of a map grid and a map cursor, and is attached to a map control.
Modes that describe how squares get selected.
Action action
The action associated with this editor action.
void removeMapGridListener(@NotNull final MapGridListener listener)
Removes a MapGridListener.
void select(@NotNull final Point pos, @NotNull final SelectionMode selectionMode)
Selects or deselects a single square.
2D-Grid containing flags for selection, pre-selection, cursor, warnings and errors.
Base classes for rendering maps.
Interface for listeners listening to MapGridEvents.
MapModel< G, A, R > getMapModel()
Returns the map model.
List< MapSquare< G, A, R > > getSelectedSquares()
Returns the selected squares.
This event is created by MapGrid.
void mapViewClosing(@NotNull final MapView< G, A, R > mapView)
This event handler is called when a map view is to be closed.
boolean doShrinkSelection(final boolean performAction)
Shrinks the current map selection by one map square.
An EditorAction that shrinks the current selection by one map square.
void shrinkSelection()
Grows the current map selection by one map square.