Gridarta Editor
net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R > Class Template Reference
+ Collaboration diagram for net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:

Public Member Functions

Action createAction (@NotNull final String name, @NotNull final String category, @NotNull final EditorAction editorAction)
 
void createActionOptional (@NotNull final String name, @NotNull final String category, @Nullable final EditorAction editorAction)
 
void createToggleAction (@NotNull final String name, @NotNull final String category, @NotNull final EditorAction editorAction)
 
 EditorActionManager (@NotNull final MapViewManager< G, A, R > mapViewManager)
 

Private Member Functions

void addEditorAction (@NotNull final EditorAction editorAction)
 

Private Attributes

MapView< G, A, R > currentMapView
 
final Collection< MapCursorListener< G, A, R > > mapCursorListeners = new ArrayList<>()
 
final MapViewManager< G, A, R > mapViewManager
 
final MapViewManagerListener< G, A, R > mapViewManagerListener
 

Static Private Attributes

static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
 

Detailed Description

Maintains a set of EditorAction instances and calls their event listener callbacks. The following event listener interfaces may be implemented by an editor action:

MapViewManagerListener: The editor action is registered in the global MapViewManager instance and receives events related to the current map view.

MapCursorListener: The editor action receives map cursor related events for the current map view.

Author
Andreas Kirschbaum

Definition at line 52 of file EditorActionManager.java.

Constructor & Destructor Documentation

◆ EditorActionManager()

Member Function Documentation

◆ addEditorAction()

void net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addEditorAction ( @NotNull final EditorAction  editorAction)
private

◆ createAction()

◆ createActionOptional()

void net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.createActionOptional ( @NotNull final String  name,
@NotNull final String  category,
@Nullable final EditorAction  editorAction 
)

Initializes a new action.

Parameters
namethe name of the action
categorythe category of the action
editorActionthe editor to initialize or
null
to do nothing

Definition at line 144 of file EditorActionManager.java.

References net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.createAction().

Referenced by net.sf.gridarta.maincontrol.GUIMainControl< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.GUIMainControl().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createToggleAction()

void net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.createToggleAction ( @NotNull final String  name,
@NotNull final String  category,
@NotNull final EditorAction  editorAction 
)

Member Data Documentation

◆ ACTION_BUILDER

◆ currentMapView

◆ mapCursorListeners

final Collection<MapCursorListener<G, A, R> > net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapCursorListeners = new ArrayList<>()
private

◆ mapViewManager

◆ mapViewManagerListener

final MapViewManagerListener<G, A, R> net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapViewManagerListener
private
Initial value:
= new MapViewManagerListener<G, A, R>() {
@Override
public void activeMapViewChanged(@Nullable final MapView<G, A, R> mapView) {
final MapView<G, A, R> tmpMapView = currentMapView;
if (tmpMapView != null) {
for (final MapCursorListener<G, A, R> mapCursorListener : mapCursorListeners) {
tmpMapView.getMapCursor().removeMapCursorListener(mapCursorListener);
}
}
currentMapView = mapView;
if (mapView != null) {
for (final MapCursorListener<G, A, R> mapCursorListener : mapCursorListeners) {
mapView.getMapCursor().addMapCursorListener(mapCursorListener);
}
}
}
@Override
public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) {
}
@Override
public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) {
}
}

The map view manager listener used to detect changed current maps. @noinspection FieldCanBeLocal

Definition at line 84 of file EditorActionManager.java.

Referenced by net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addEditorAction(), and net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.EditorActionManager().


The documentation for this class was generated from the following file:
net.sf.gridarta.maincontrol.EditorActionManager.mapCursorListeners
final Collection< MapCursorListener< G, A, R > > mapCursorListeners
Definition: EditorActionManager.java:71
net.sf.gridarta.gui.map.mapview.MapView.getMapCursor
MapCursor< G, A, R > getMapCursor()
net.sf.gridarta.model.mapcursor.MapCursor.removeMapCursorListener
void removeMapCursorListener(@NotNull final MapCursorListener< G, A, R > listener)
Definition: MapCursor.java:427
net.sf.gridarta.model.mapcursor.MapCursor.addMapCursorListener
void addMapCursorListener(@NotNull final MapCursorListener< G, A, R > listener)
Definition: MapCursor.java:419
net.sf.gridarta.maincontrol.EditorActionManager.currentMapView
MapView< G, A, R > currentMapView
Definition: EditorActionManager.java:77