Package net.sf.gridarta.action
Class AbstractMapCursorAction<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
- java.lang.Object
-
- net.sf.gridarta.action.AbstractMapCursorAction<G,A,R>
-
- All Implemented Interfaces:
java.util.EventListener,MapViewManagerListener<G,A,R>,MapCursorListener<G,A,R>
- Direct Known Subclasses:
AbstractSelectionAction,DeleteArchAction,GoLocationAction,InsertArchAction,ReleaseDragAction,SelectArchAboveAction,SelectArchBelowAction,StartStopDragAction
public abstract class AbstractMapCursorAction<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends java.lang.Object implements MapCursorListener<G,A,R>, MapViewManagerListener<G,A,R>
Abstract base class for actions that have to track the current map cursor.
-
-
Constructor Summary
Constructors Constructor Description AbstractMapCursorAction()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidactiveMapViewChanged(@Nullable MapView<G,A,R> mapView)This event handler is called when the current map view has changed.protected @Nullable MapCursor<G,A,R>getActiveMapCursor()Return the map cursor of the current map view if it is active.protected @Nullable MapView<G,A,R>getActiveMapView()Return the current map view.voidmapCursorChangedGameObject(@Nullable MapSquare<G,A,R> mapSquare, G gameObject)Called whenever the selected game object has changed.voidmapCursorChangedMode()This event handler is called whenMapCursorchanges mode (drag, select).voidmapCursorChangedPos(@NotNull java.awt.Point location)This event handler is called whenMapCursorhas moved.voidmapCursorChangedSize()Called whenever the map cursor's map grid size has changed.voidmapViewClosing(@NotNull MapView<G,A,R> mapView)This event handler is called when a map view is to be closed.voidmapViewCreated(@NotNull MapView<G,A,R> mapView)This event handler is called when a map view was created.protected abstract voidupdateAction()Called whenever the current map cursor has changed.
-
-
-
Method Detail
-
getActiveMapCursor
@Nullable protected @Nullable MapCursor<G,A,R> getActiveMapCursor()
Return the map cursor of the current map view if it is active.- Returns:
- the map cursor, or
nullif the cursor is not active, or if no map view exists
-
getActiveMapView
@Nullable protected @Nullable MapView<G,A,R> getActiveMapView()
Return the current map view.- Returns:
- the current map view or
null
-
updateAction
protected abstract void updateAction()
Called whenever the current map cursor has changed.
-
activeMapViewChanged
public void activeMapViewChanged(@Nullable @Nullable MapView<G,A,R> mapView)Description copied from interface:MapViewManagerListenerThis event handler is called when the current map view has changed.- Specified by:
activeMapViewChangedin interfaceMapViewManagerListener<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
mapView- the new map view ornullif no opened map view exists
-
mapViewCreated
public void mapViewCreated(@NotNull @NotNull MapView<G,A,R> mapView)Description copied from interface:MapViewManagerListenerThis event handler is called when a map view was created.- Specified by:
mapViewCreatedin interfaceMapViewManagerListener<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
mapView- the created map view- No Inspection:
- NoopMethodInAbstractClass
-
mapViewClosing
public void mapViewClosing(@NotNull @NotNull MapView<G,A,R> mapView)Description copied from interface:MapViewManagerListenerThis event handler is called when a map view is to be closed.- Specified by:
mapViewClosingin interfaceMapViewManagerListener<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
mapView- the map view that is to be closed- No Inspection:
- NoopMethodInAbstractClass
-
mapCursorChangedPos
public void mapCursorChangedPos(@NotNull @NotNull java.awt.Point location)Description copied from interface:MapCursorListenerThis event handler is called whenMapCursorhas moved.- Specified by:
mapCursorChangedPosin interfaceMapCursorListener<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
location- the new location
-
mapCursorChangedMode
public void mapCursorChangedMode()
Description copied from interface:MapCursorListenerThis event handler is called whenMapCursorchanges mode (drag, select).- Specified by:
mapCursorChangedModein interfaceMapCursorListener<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
-
mapCursorChangedGameObject
public void mapCursorChangedGameObject(@Nullable @Nullable MapSquare<G,A,R> mapSquare, @Nullable G gameObject)Description copied from interface:MapCursorListenerCalled whenever the selected game object has changed. This function is not called ifMapCursorListener.mapCursorChangedPos(Point)occurs concurrently.- Specified by:
mapCursorChangedGameObjectin interfaceMapCursorListener<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- Parameters:
mapSquare- the newly selected map square ornullif no map square is selectedgameObject- the newly selected game object ornullif no game object is selected- No Inspection:
- NoopMethodInAbstractClass
-
mapCursorChangedSize
public void mapCursorChangedSize()
Description copied from interface:MapCursorListenerCalled whenever the map cursor's map grid size has changed.- Specified by:
mapCursorChangedSizein interfaceMapCursorListener<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>- No Inspection:
- NoopMethodInAbstractClass
-
-