Class MapActions<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
- java.lang.Object
-
- net.sf.gridarta.gui.map.mapactions.MapActions<G,A,R>
-
- All Implemented Interfaces:
java.util.EventListener,MapViewManagerListener<G,A,R>,MapCursorListener<G,A,R>,EditorAction
public class MapActions<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends java.lang.Object implements EditorAction, MapCursorListener<G,A,R>, MapViewManagerListener<G,A,R>
Manages actions in the "map" menu.
-
-
Constructor Summary
Constructors Constructor Description MapActions(@NotNull java.awt.Frame helpParent, @NotNull MapManager<G,A,R> mapManager, @NotNull MapViewManager<G,A,R> mapViewManager, @NotNull ExitMatcher<G,A,R> exitMatcher, @NotNull javax.swing.filechooser.FileFilter mapFileFilter, @NotNull SelectedSquareModel<G,A,R> selectedSquareModel, boolean allowRandomMapParameters, @NotNull MapPropertiesDialogFactory<G,A,R> mapPropertiesDialogFactory, @NotNull MapViewSettings mapViewSettings, @NotNull MapViewsManager<G,A,R> mapViewsManager, @NotNull EnterMap<G,A,R> enterMap, @NotNull ProjectSettings projectSettings)Creates a new instance.
-
Method Summary
All Methods Instance 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.voidcreateTileDown()Action method for creating down tiled map.voidcreateTileEast()Action method for creating east tiled map.voidcreateTileNorth()Action method for creating north tiled map.voidcreateTileNorthEast()Action method for creating northeast tiled map.voidcreateTileNorthWest()Action method for creating northwest tiled map.voidcreateTileSouth()Action method for creating south tiled map.voidcreateTileSouthEast()Action method for creating southeast tiled map.voidcreateTileSouthWest()Action method for creating southwest tiled map.voidcreateTileUp()Action method for creating up tiled map.voidcreateTileWest()Action method for creating west tiled map.voiddeleteUnknownObjects()Deletes all game objects referencing unknown archetypes.booleandoEnterMap(boolean performAction, @NotNull Direction direction)Executes the "enter map" action.voidenterDownMap()Action method for entering the down map.voidenterEastMap()Action method for entering the east map.voidenterExit()Tries to load the map where the selected map-exit points to.voidenterMap(@NotNull MapFile mapFile, @Nullable java.awt.Point destinationPoint)Enters a map.voidenterNorthEastMap()Action method for entering the north east map.voidenterNorthMap()Action method for entering the north map.voidenterNorthWestMap()Action method for entering the north west map.voidenterSouthEastMap()Action method for entering the south east map.voidenterSouthMap()Action method for entering the south map.voidenterSouthWestMap()Action method for entering the south west map.voidenterUpMap()Action method for entering the up map.voidenterWestMap()Action method for entering the west map.booleanisAutoJoin()Action method for "autojoin".booleanisDoubleFaces()Action method for "double faces".booleanisGridVisible()Action method for "grid visible".booleanisSmoothing()Action method for "smoothing".booleanisTileShow()Action method for "tile show".booleanisTileStretching()Action method for "tile-stretching".voidmapCreateView()Action method for "create 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.voidmapProperties()Action method for "map properties".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.voidnextExit()Selects the next exit.voidprevExit()Selects the previous exit.voidsetAction(@NotNull javax.swing.Action action, @NotNull java.lang.String name)Sets theActioninstance for this editor action.voidsetAutoJoin(boolean autoJoin)Action method for "autoJoin".voidsetDoubleFaces(boolean doubleFaces)Sets whether double faces on the current map should be shown.voidsetGridVisible(boolean gridVisible)Sets whether the grid of the current map should be visible.voidsetSmoothing(boolean smoothing)Sets whether smoothing of the current map is active.voidsetTileShow(boolean tileShow)Action method for "tile show".voidsetTileStretching(boolean tileStretching)Sets whether tile-stretching of the current map is active.voidshrinkMapSize()Action method for "shrink map size".
-
-
-
Constructor Detail
-
MapActions
public MapActions(@NotNull @NotNull java.awt.Frame helpParent, @NotNull @NotNull MapManager<G,A,R> mapManager, @NotNull @NotNull MapViewManager<G,A,R> mapViewManager, @NotNull @NotNull ExitMatcher<G,A,R> exitMatcher, @NotNull @NotNull javax.swing.filechooser.FileFilter mapFileFilter, @NotNull @NotNull SelectedSquareModel<G,A,R> selectedSquareModel, boolean allowRandomMapParameters, @NotNull @NotNull MapPropertiesDialogFactory<G,A,R> mapPropertiesDialogFactory, @NotNull @NotNull MapViewSettings mapViewSettings, @NotNull @NotNull MapViewsManager<G,A,R> mapViewsManager, @NotNull @NotNull EnterMap<G,A,R> enterMap, @NotNull @NotNull ProjectSettings projectSettings)Creates a new instance.- Parameters:
helpParent- the parent frame for help windowsmapManager- the map managermapViewManager- the map view managerexitMatcher- the exit matcher for selecting exit game objectsmapFileFilter- the Swing file filter to useselectedSquareModel- the selected square model to useallowRandomMapParameters- whether exit paths may point to random mapsmapPropertiesDialogFactory- the map properties dialog factory to usemapViewSettings- the map view settings instance to usemapViewsManager- the map viewsenterMap- the enter map instance to use
-
-
Method Detail
-
isGridVisible
@ActionMethod public boolean isGridVisible()
Action method for "grid visible".- Returns:
trueif the grid is visible, orfalseif the grid is invisible
-
setGridVisible
@ActionMethod public void setGridVisible(boolean gridVisible)
Sets whether the grid of the current map should be visible.- Parameters:
gridVisible- new visibility of grid in current map,trueif the grid should be visible,falseif invisible- See Also:
isGridVisible()
-
isSmoothing
@ActionMethod public boolean isSmoothing()
Action method for "smoothing".- Returns:
trueif smoothing is active, orfalseif smoothing is disabled
-
setSmoothing
@ActionMethod public void setSmoothing(boolean smoothing)
Sets whether smoothing of the current map is active.- Parameters:
smoothing- new smoothing in current map,trueif the smoothing should be active,falseif deactivated- See Also:
()
-
isDoubleFaces
@ActionMethod public boolean isDoubleFaces()
Action method for "double faces".- Returns:
trueif double faces are shown, orfalseif not
-
setDoubleFaces
@ActionMethod public void setDoubleFaces(boolean doubleFaces)
Sets whether double faces on the current map should be shown.- Parameters:
doubleFaces- new value- See Also:
isDoubleFaces()
-
isTileShow
@ActionMethod public boolean isTileShow()
Action method for "tile show".- Returns:
trueif adjacent tiles are shown, orfalseif not- No Inspection:
- MethodMayBeStatic, SameReturnValue
-
isTileStretching
@ActionMethod public boolean isTileStretching()
Action method for "tile-stretching".- Returns:
trueif tile-stretching is active, orfalseif tile-stretching is disabled
-
setTileStretching
@ActionMethod public void setTileStretching(boolean tileStretching)
Sets whether tile-stretching of the current map is active.- Parameters:
tileStretching- new tile-stretching in current map,trueif the tile-stretching should be active,falseif deactivated- See Also:
()
-
setTileShow
@ActionMethod public void setTileShow(boolean tileShow)
Action method for "tile show".- Parameters:
tileShow- if set, show adjacent tiles
-
mapCreateView
@ActionMethod public void mapCreateView()
Action method for "create view".
-
mapProperties
@ActionMethod public void mapProperties()
Action method for "map properties".
-
shrinkMapSize
@ActionMethod public void shrinkMapSize()
Action method for "shrink map size".
-
isAutoJoin
@ActionMethod public boolean isAutoJoin()
Action method for "autojoin".- Returns:
trueif autojoining is enabled, orfalseif autojoining is disabled
-
setAutoJoin
@ActionMethod public void setAutoJoin(boolean autoJoin)
Action method for "autoJoin".- Parameters:
autoJoin- if set, enable autojoining
-
enterExit
@ActionMethod public void enterExit()
Tries to load the map where the selected map-exit points to.
-
nextExit
@ActionMethod public void nextExit()
Selects the next exit.
-
prevExit
@ActionMethod public void prevExit()
Selects the previous exit.
-
enterNorthMap
@ActionMethod public void enterNorthMap()
Action method for entering the north map.
-
enterNorthEastMap
@ActionMethod public void enterNorthEastMap()
Action method for entering the north east map.
-
enterEastMap
@ActionMethod public void enterEastMap()
Action method for entering the east map.
-
enterSouthEastMap
@ActionMethod public void enterSouthEastMap()
Action method for entering the south east map.
-
enterSouthMap
@ActionMethod public void enterSouthMap()
Action method for entering the south map.
-
enterSouthWestMap
@ActionMethod public void enterSouthWestMap()
Action method for entering the south west map.
-
enterWestMap
@ActionMethod public void enterWestMap()
Action method for entering the west map.
-
enterNorthWestMap
@ActionMethod public void enterNorthWestMap()
Action method for entering the north west map.
-
enterUpMap
@ActionMethod public void enterUpMap()
Action method for entering the up map.
-
enterDownMap
@ActionMethod public void enterDownMap()
Action method for entering the down map.
-
createTileNorth
@ActionMethod public void createTileNorth()
Action method for creating north tiled map.
-
createTileEast
@ActionMethod public void createTileEast()
Action method for creating east tiled map.
-
createTileSouth
@ActionMethod public void createTileSouth()
Action method for creating south tiled map.
-
createTileWest
@ActionMethod public void createTileWest()
Action method for creating west tiled map.
-
createTileNorthEast
@ActionMethod public void createTileNorthEast()
Action method for creating northeast tiled map.
-
createTileSouthEast
@ActionMethod public void createTileSouthEast()
Action method for creating southeast tiled map.
-
createTileSouthWest
@ActionMethod public void createTileSouthWest()
Action method for creating southwest tiled map.
-
createTileNorthWest
@ActionMethod public void createTileNorthWest()
Action method for creating northwest tiled map.
-
createTileUp
@ActionMethod public void createTileUp()
Action method for creating up tiled map.
-
createTileDown
@ActionMethod public void createTileDown()
Action method for creating down tiled map.
-
deleteUnknownObjects
@ActionMethod public void deleteUnknownObjects()
Deletes all game objects referencing unknown archetypes.
-
enterMap
public void enterMap(@NotNull @NotNull MapFile mapFile, @Nullable @Nullable java.awt.Point destinationPoint)Enters a map.- Parameters:
mapFile- the map file to enterdestinationPoint- the desired destination point on the map ornullfor default
-
doEnterMap
public boolean doEnterMap(boolean performAction, @NotNull @NotNull Direction direction)Executes the "enter map" action.- Parameters:
performAction- whether the action should be performeddirection- the direction to enter- Returns:
- whether the action was or can be performed
-
setAction
public void setAction(@NotNull @NotNull javax.swing.Action action, @NotNull @NotNull java.lang.String name)Description copied from interface:EditorActionSets theActioninstance for this editor action.- Specified by:
setActionin interfaceEditorAction- Parameters:
action- the action instancename- the name of the action
-
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
-
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
-
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
-
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>>
-
-