public class MapViewsManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
extends java.lang.Object
MapViews
.Constructor and Description |
---|
MapViewsManager(@NotNull MapViewSettings mapViewSettings,
@NotNull MapViewFactory<G,A,R> mapViewFactory,
@NotNull MapManager<G,A,R> mapManager,
@NotNull MapManager<G,A,R> pickmapManager,
@NotNull PathManager pathManager)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addMapViewsListener(@NotNull MapControl<G,A,R> mapControl,
@NotNull MapViewsListener<G,A,R> listener)
Adds a
MapViewsListener to be notified of events. |
void |
closeMapView(@NotNull MapView<G,A,R> mapView)
Invoked when the user wants to close a map view.
|
void |
closeView(@NotNull MapView<G,A,R> mapView)
Closes a view of a
MapControl . |
@Nullable MapView<G,A,R> |
getMapViewFrame(@NotNull MapControl<G,A,R> mapControl)
Returns the last used view of a
MapControl . |
java.util.Iterator<MapView<G,A,R>> |
getMapViewIterator(@NotNull MapControl<G,A,R> mapControl)
|
@NotNull MapView<G,A,R> |
newMapView(@NotNull MapControl<G,A,R> mapControl,
@Nullable java.awt.Point viewPosition)
Creates a new map view.
|
void |
newMapWithView(@Nullable java.util.List<G> objects,
A mapArchObject,
@Nullable java.awt.Point viewPosition,
@Nullable MapFile mapFile)
Creates a new map control and an initial map view.
|
void |
openMapFileWithView(@NotNull java.io.File file,
@Nullable java.awt.Point viewPosition,
@Nullable java.awt.Point centerSquare)
Loads a map file and creates a map view.
|
@NotNull MapView<G,A,R> |
openMapFileWithView(@NotNull MapFile mapFile,
@Nullable java.awt.Point viewPosition)
Loads a map file and creates a map view.
|
void |
removeMapViewsListener(@NotNull MapControl<G,A,R> mapControl,
@NotNull MapViewsListener<G,A,R> listener)
Removes a
MapViewsListener to be notified of events. |
void |
setFileControl(@NotNull FileControl<G,A,R> fileControl)
Deprecated.
|
void |
setFocus(@NotNull MapView<G,A,R> mapView)
Sets a
MapView as the main view. |
public MapViewsManager(@NotNull @NotNull MapViewSettings mapViewSettings, @NotNull @NotNull MapViewFactory<G,A,R> mapViewFactory, @NotNull @NotNull MapManager<G,A,R> mapManager, @NotNull @NotNull MapManager<G,A,R> pickmapManager, @NotNull @NotNull PathManager pathManager)
mapViewSettings
- the map view settings instancemapViewFactory
- the map view factory to usemapManager
- the map manager to usepickmapManager
- the pickmap manager to usepathManager
- the path manager for converting file instance@Deprecated public void setFileControl(@NotNull @NotNull FileControl<G,A,R> fileControl)
public void addMapViewsListener(@NotNull @NotNull MapControl<G,A,R> mapControl, @NotNull @NotNull MapViewsListener<G,A,R> listener)
MapViewsListener
to be notified of events.mapControl
- the map control to attach tolistener
- the listenerpublic void removeMapViewsListener(@NotNull @NotNull MapControl<G,A,R> mapControl, @NotNull @NotNull MapViewsListener<G,A,R> listener)
MapViewsListener
to be notified of events.mapControl
- the map control to attach tolistener
- the listener@Nullable public @Nullable MapView<G,A,R> getMapViewFrame(@NotNull @NotNull MapControl<G,A,R> mapControl)
MapControl
.mapControl
- the map control@NotNull public @NotNull MapView<G,A,R> newMapView(@NotNull @NotNull MapControl<G,A,R> mapControl, @Nullable @Nullable java.awt.Point viewPosition)
mapControl
- the map controlviewPosition
- the view position to show initially; may be null
to show the top left cornerpublic void closeView(@NotNull @NotNull MapView<G,A,R> mapView)
MapControl
.mapView
- the view to be closedpublic void setFocus(@NotNull @NotNull MapView<G,A,R> mapView)
MapView
as the main view.mapView
- the map viewpublic java.util.Iterator<MapView<G,A,R>> getMapViewIterator(@NotNull @NotNull MapControl<G,A,R> mapControl)
Iterator
returning all MapViews
of a
MapControl
. The map views are returns top to bottom.mapControl
- the map controlpublic void newMapWithView(@Nullable @Nullable java.util.List<G> objects, @NotNull A mapArchObject, @Nullable @Nullable java.awt.Point viewPosition, @Nullable @Nullable MapFile mapFile)
objects
- the game objects to insert; may be null
mapArchObject
- the map arch object for the new mapviewPosition
- the view position to show initially; may be null
to show the top left cornermapFile
- the map file, or null
if the map was not yet
savedpublic void closeMapView(@NotNull @NotNull MapView<G,A,R> mapView)
mapView
- the map view to close@NotNull public @NotNull MapView<G,A,R> openMapFileWithView(@NotNull @NotNull MapFile mapFile, @Nullable @Nullable java.awt.Point viewPosition) throws java.io.IOException
mapFile
- the map file to loadviewPosition
- the view position to show initially; may be null
to show the top left cornerjava.io.IOException
- if an I/O error occurspublic void openMapFileWithView(@NotNull @NotNull java.io.File file, @Nullable @Nullable java.awt.Point viewPosition, @Nullable @Nullable java.awt.Point centerSquare) throws java.io.IOException
file
- the map file to loadviewPosition
- the view position to show initially; may be null
to show the top left cornercenterSquare
- the map square that should be in the center of the
view; ignored if viewPosition
is setjava.io.IOException
- if an I/O error occurs