Gridarta Editor
net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R > Class Template Reference

The JDesktopPane containing all map views. More...

+ Inheritance diagram for net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:
+ Collaboration diagram for net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >:

Classes

class  MapViewFrameListener
 The listener attached to map views. More...
 

Public Member Functions

void addWindowAction (@NotNull final JMenu menu, @NotNull final MapView< G, A, R > mapView, final int index)
 Adds an action for selecting this window to a menu. More...
 
 MapDesktop (@NotNull final MapViewManager< G, A, R > mapViewManager, @NotNull final MapManager< G, A, R > mapManager, @NotNull final MapImageCache< G, A, R > mapImageCache, @NotNull final MapViewsManager< G, A, R > mapViewsManager)
 Creates a new instance. More...
 
void nextWindow ()
 Gives focus to the previous window. More...
 
void prevWindow ()
 Gives focus to the next window. More...
 
void setAction (@NotNull final Action action, @NotNull final String name)
 Sets the Action instance for this editor action. More...
 
void setCurrentMapView (@NotNull final MapView< G, A, R > mapView)
 Sets the given level view as the current one. More...
 

Private Member Functions

void activateAndRaiseMapView (@NotNull final MapView< G, A, R > mapView)
 Activates and raises the given map view. More...
 
void addMapView (@NotNull final MapView< G, A, R > mapView)
 Adds the map view. More...
 
boolean doNextWindow (final boolean performAction)
 Performs or checks availability of the "next window" action. More...
 
boolean doPrevWindow (final boolean performAction)
 Performs or checks availability of the "prev window" action. More...
 
void mapViewFocusGainedNotify (@NotNull final MapView< G, A, R > mapView)
 Notifies that the given map view is now set as the current one. More...
 
void mapViewFocusLostNotify (@NotNull final MapView< G, A, R > mapView)
 Notifies that the map views focus is lost it is inserted as the second in line to the map view vector. More...
 
void refreshMenus ()
 Enables/disables the actions according to the current state. More...
 
void removeMapView (@NotNull final MapView< G, A, R > mapView)
 Removes (closes) the map view. More...
 
void updateFocus (final boolean careAboutIconification)
 Updates the focus to the first non-iconified map window. More...
 
void updateFrameIcon (@NotNull final MapView< G, A, R > mapView)
 Updates the frame icon to the current icon image. More...
 

Private Attributes

Action aNextWindow
 The action for "next window". More...
 
Action aPrevWindow
 The action for "prev window". More...
 
final MapImageCache< G, A, R > mapImageCache
 The MapImageCache to use. More...
 
final MapImageCacheListener< G, A, R > mapImageCacheListener
 The MapImageCacheListener registered to mapImageCache. More...
 
final MapManager< G, A, R > mapManager
 The MapManager to use. More...
 
final MapManagerListener< G, A, R > mapManagerListener
 The MapManagerListener attached to mapManager. More...
 
final Map< MapView< G, A, R >, MapViewFrameListenermapViewFrameListeners = new IdentityHashMap<>()
 The MapViewFrameListeners associated with MapViews. More...
 
final MapViewManager< G, A, R > mapViewManager
 All open map views. More...
 
final MapViewsListener< G, A, R > mapViewsListener
 The MapViewsListener attached to all existing MapControls for maps. More...
 
final MapViewsManager< G, A, R > mapViewsManager
 The MapViewsManager. More...
 
final Map< MapView< G, A, R >, WindowAction< G, A, R > > windowActions = new IdentityHashMap<>()
 The actions to select windows. More...
 

Static Private Attributes

static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta")
 The action builder. More...
 
static final Category LOG = Logger.getLogger(MapDesktop.class)
 The Logger for printing log messages. More...
 
static final long serialVersionUID = 1L
 The serial version UID. More...
 

Detailed Description

The JDesktopPane containing all map views.

Author
Christian Hujer
Andreas Kirschbaum

Definition at line 60 of file MapDesktop.java.

Constructor & Destructor Documentation

◆ MapDesktop()

net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.MapDesktop ( @NotNull final MapViewManager< G, A, R >  mapViewManager,
@NotNull final MapManager< G, A, R >  mapManager,
@NotNull final MapImageCache< G, A, R >  mapImageCache,
@NotNull final MapViewsManager< G, A, R >  mapViewsManager 
)

Creates a new instance.

Parameters
mapViewManagerall open map views
mapManagerthe map manager to use
mapImageCachethe map image cache to use
mapViewsManagerthe map views

Definition at line 199 of file MapDesktop.java.

Member Function Documentation

◆ activateAndRaiseMapView()

void net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.activateAndRaiseMapView ( @NotNull final MapView< G, A, R >  mapView)
private

Activates and raises the given map view.

Parameters
mapViewthe map view

Definition at line 313 of file MapDesktop.java.

Referenced by net.sf.gridarta.gui.mapdesktop.MapDesktop< G, A, R >.updateFocus().

+ Here is the caller graph for this function:

◆ addMapView()

void net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addMapView ( @NotNull final MapView< G, A, R >  mapView)
private

Adds the map view.

Parameters
mapViewthe map view to add

Definition at line 260 of file MapDesktop.java.

◆ addWindowAction()

void net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.addWindowAction ( @NotNull final JMenu  menu,
@NotNull final MapView< G, A, R >  mapView,
final int  index 
)

Adds an action for selecting this window to a menu.

Parameters
menuthe menu to add the action to
mapViewthe map view to add
indexthe index of the menu entry

Definition at line 302 of file MapDesktop.java.

Referenced by net.sf.gridarta.gui.mapdesktop.WindowMenuManager< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.rebuildWindowMenu().

+ Here is the caller graph for this function:

◆ doNextWindow()

boolean net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doNextWindow ( final boolean  performAction)
private

Performs or checks availability of the "next window" action.

Parameters
performActionwhether the action should be performed
Returns
whether the action was or can be performed

Definition at line 422 of file MapDesktop.java.

Referenced by net.sf.gridarta.gui.mapdesktop.MapDesktop< G, A, R >.nextWindow(), and net.sf.gridarta.gui.mapdesktop.MapDesktop< G, A, R >.refreshMenus().

+ Here is the caller graph for this function:

◆ doPrevWindow()

boolean net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.doPrevWindow ( final boolean  performAction)
private

Performs or checks availability of the "prev window" action.

Parameters
performActionwhether the action should be performed
Returns
whether the action was or can be performed

Definition at line 405 of file MapDesktop.java.

Referenced by net.sf.gridarta.gui.mapdesktop.MapDesktop< G, A, R >.prevWindow(), and net.sf.gridarta.gui.mapdesktop.MapDesktop< G, A, R >.refreshMenus().

+ Here is the caller graph for this function:

◆ mapViewFocusGainedNotify()

void net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapViewFocusGainedNotify ( @NotNull final MapView< G, A, R >  mapView)
private

Notifies that the given map view is now set as the current one.

Parameters
mapViewthe new current map view

Definition at line 335 of file MapDesktop.java.

Referenced by net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.MapViewFrameListener.internalFrameActivated().

+ Here is the caller graph for this function:

◆ mapViewFocusLostNotify()

void net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapViewFocusLostNotify ( @NotNull final MapView< G, A, R >  mapView)
private

Notifies that the map views focus is lost it is inserted as the second in line to the map view vector.

Parameters
mapViewthe map view who lost the focus

Definition at line 326 of file MapDesktop.java.

Referenced by net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.MapViewFrameListener.internalFrameIconified().

+ Here is the caller graph for this function:

◆ nextWindow()

void net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.nextWindow ( )

Gives focus to the previous window.

Definition at line 382 of file MapDesktop.java.

◆ prevWindow()

void net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.prevWindow ( )

Gives focus to the next window.

Definition at line 374 of file MapDesktop.java.

◆ refreshMenus()

void net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.refreshMenus ( )
private

Enables/disables the actions according to the current state.

Definition at line 389 of file MapDesktop.java.

Referenced by net.sf.gridarta.gui.mapdesktop.MapDesktop< G, A, R >.addMapView(), net.sf.gridarta.gui.mapdesktop.MapDesktop< G, A, R >.removeMapView(), and net.sf.gridarta.gui.mapdesktop.MapDesktop< G, A, R >.setAction().

+ Here is the caller graph for this function:

◆ removeMapView()

void net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.removeMapView ( @NotNull final MapView< G, A, R >  mapView)
private

Removes (closes) the map view.

Parameters
mapViewthe map view to be removed (closed)

Definition at line 235 of file MapDesktop.java.

◆ setAction()

void net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setAction ( @NotNull final Action  action,
@NotNull final String  name 
)

Sets the Action instance for this editor action.

Parameters
actionthe action instance
namethe name of the action

Implements net.sf.gridarta.utils.EditorAction.

Definition at line 435 of file MapDesktop.java.

◆ setCurrentMapView()

void net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.setCurrentMapView ( @NotNull final MapView< G, A, R >  mapView)

Sets the given level view as the current one.

Parameters
mapViewthe new current level view

Definition at line 213 of file MapDesktop.java.

Referenced by net.sf.gridarta.gui.mapdesktop.WindowAction< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.actionPerformed(), and net.sf.gridarta.gui.mapdesktop.MapDesktop< G, A, R >.addMapView().

+ Here is the caller graph for this function:

◆ updateFocus()

◆ updateFrameIcon()

void net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.updateFrameIcon ( @NotNull final MapView< G, A, R >  mapView)
private

Updates the frame icon to the current icon image.

Parameters
mapViewthe map view to update

Definition at line 288 of file MapDesktop.java.

Referenced by net.sf.gridarta.gui.mapdesktop.MapDesktop< G, A, R >.addMapView().

+ Here is the caller graph for this function:

Member Data Documentation

◆ ACTION_BUILDER

final ActionBuilder net.sf.gridarta.gui.mapdesktop.MapDesktop< 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 action builder.

Definition at line 72 of file MapDesktop.java.

◆ aNextWindow

Action net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.aNextWindow
private

The action for "next window".

Definition at line 113 of file MapDesktop.java.

◆ aPrevWindow

Action net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.aPrevWindow
private

The action for "prev window".

Definition at line 107 of file MapDesktop.java.

◆ LOG

final Category net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.LOG = Logger.getLogger(MapDesktop.class)
staticprivate

The Logger for printing log messages.

Definition at line 66 of file MapDesktop.java.

◆ mapImageCache

final MapImageCache<G, A, R> net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapImageCache
private

◆ mapImageCacheListener

final MapImageCacheListener<G, A, R> net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapImageCacheListener
private
Initial value:
= new MapImageCacheListener<G, A, R>() {
@Override
public void iconChanged(@NotNull final MapControl<G, A, R> mapControl) {
final Iterator<MapView<G, A, R>> it = mapViewsManager.getMapViewIterator(mapControl);
while (it.hasNext()) {
updateFrameIcon(it.next());
}
}
}

The MapImageCacheListener registered to mapImageCache.

Definition at line 180 of file MapDesktop.java.

◆ mapManager

final MapManager<G, A, R> net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapManager
private

◆ mapManagerListener

final MapManagerListener<G, A, R> net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapManagerListener
private
Initial value:
= new MapManagerListener<G, A, R>() {
@Override
public void currentMapChanged(@Nullable final MapControl<G, A, R> mapControl) {
}
@Override
public void mapCreated(@NotNull final MapControl<G, A, R> mapControl, final boolean interactive) {
}
@Override
public void mapClosing(@NotNull final MapControl<G, A, R> mapControl) {
}
@Override
public void mapClosed(@NotNull final MapControl<G, A, R> mapControl) {
}
}

The MapManagerListener attached to mapManager.

Definition at line 133 of file MapDesktop.java.

◆ mapViewFrameListeners

final Map<MapView<G, A, R>, MapViewFrameListener> net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapViewFrameListeners = new IdentityHashMap<>()
private

The MapViewFrameListeners associated with MapViews.

Maps map view to listener. UnnecessarilyQualifiedInnerClassAccess

Definition at line 127 of file MapDesktop.java.

◆ mapViewManager

final MapViewManager<G, A, R> net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapViewManager
private

All open map views.

Definition at line 83 of file MapDesktop.java.

Referenced by net.sf.gridarta.gui.mapdesktop.MapDesktop< G, A, R >.MapDesktop().

◆ mapViewsListener

final MapViewsListener<G, A, R> net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapViewsListener
private
Initial value:
= new MapViewsListener<G, A, R>() {
@Override
public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) {
addMapView(mapView);
}
@Override
public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) {
removeMapView(mapView);
}
}

The MapViewsListener attached to all existing MapControls for maps.

Definition at line 162 of file MapDesktop.java.

◆ mapViewsManager

final MapViewsManager<G, A, R> net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.mapViewsManager
private

◆ serialVersionUID

final long net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.serialVersionUID = 1L
staticprivate

The serial version UID.

Definition at line 77 of file MapDesktop.java.

◆ windowActions

final Map<MapView<G, A, R>, WindowAction<G, A, R> > net.sf.gridarta.gui.mapdesktop.MapDesktop< G extends GameObject< G, A, R, A extends MapArchObject< A, R extends Archetype< G, A, R >.windowActions = new IdentityHashMap<>()
private

The actions to select windows.

Definition at line 119 of file MapDesktop.java.


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