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

Maintains a set of EditorAction instances and calls their event listener callbacks. More...

+ 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)
 Initializes a new action. More...
 
Action createActionOptional (@NotNull final String name, @NotNull final String category, @Nullable final EditorAction editorAction)
 Initializes a new action. More...
 
Action createToggleAction (@NotNull final String name, @NotNull final String category, @NotNull final EditorAction editorAction)
 Initializes a new action. More...
 
 EditorActionManager (@NotNull final MapViewManager< G, A, R > mapViewManager)
 Creates a new instance. More...
 

Private Member Functions

void addEditorAction (@NotNull final EditorAction editorAction)
 Records the event types an EditorAction is interested in. More...
 

Private Attributes

MapView< G, A, R > currentMapView
 The active map view, or. More...
 
final Collection< MapCursorListener< G, A, R > > mapCursorListeners = new ArrayList<>()
 The EditorActions that are interested in MapCursorListener events. More...
 
final MapViewManager< G, A, R > mapViewManager
 The MapViewManager for tracking open maps. More...
 
final MapViewManagerListener< G, A, R > mapViewManagerListener
 The map view manager listener used to detect changed current maps. More...
 

Static Private Attributes

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

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()

◆ createAction()

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

Initializes a new action.

Parameters
namethe name of the action
categorythe category of the action
editorActionthe editor to initialize
Returns
the action

Definition at line 132 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 >.addEditorAction(), and net.sf.gridarta.utils.ActionUtils.newAction().

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

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

◆ createActionOptional()

Action 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
Returns
the action

Definition at line 146 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().

+ Here is the call graph for this function:

◆ createToggleAction()

Action 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 
)

Initializes a new action.

Parameters
namethe name of the action
categorythe category of the action
editorActionthe editor to initialize
Returns
the action

Definition at line 158 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 >.addEditorAction(), and net.sf.gridarta.utils.ActionUtils.newToggleAction().

+ Here is the call graph for this function:

Member Data Documentation

◆ ACTION_BUILDER

final ActionBuilder net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
staticprivate

The ActionBuilder.

Definition at line 58 of file EditorActionManager.java.

◆ currentMapView

MapView<G, A, R> net.sf.gridarta.maincontrol.EditorActionManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.currentMapView
private

The active map view, or.

null

if no map view exists.

Definition at line 77 of file EditorActionManager.java.

◆ 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

The EditorActions that are interested in MapCursorListener events.

Definition at line 71 of file EditorActionManager.java.

◆ 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.

FieldCanBeLocal

Definition at line 84 of file EditorActionManager.java.


The documentation for this class was generated from the following file: