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(MapViewSettings mapViewSettings,
MapViewFactory<G,A,R> mapViewFactory,
MapManager<G,A,R> mapManager,
MapManager<G,A,R> pickmapManager,
PathManager pathManager)
Creates a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addEditType(int newType)
Calculate a new type for all opened maps.
|
void |
addMapViewsListener(MapControl<G,A,R> mapControl,
MapViewsListener<G,A,R> listener)
Adds a
MapViewsListener to be notified of events. |
void |
closeMapView(MapView<G,A,R> mapView)
Invoked when the user wants to close a map view.
|
void |
closeView(MapView<G,A,R> mapView)
Closes a view of a
MapControl . |
MapView<G,A,R> |
getMapViewFrame(MapControl<G,A,R> mapControl)
Returns the last used view of a
MapControl . |
java.util.Iterator<MapView<G,A,R>> |
getMapViewIterator(MapControl<G,A,R> mapControl)
|
int |
getMapViews(MapControl<G,A,R> mapControl)
Returns the number of views of a
MapControl . |
MapView<G,A,R> |
newMapView(MapControl<G,A,R> mapControl,
java.awt.Point viewPosition,
java.awt.Point centerSquare)
Creates a new map view.
|
void |
newMapWithView(java.util.List<G> objects,
A mapArchObject,
java.awt.Point viewPosition,
MapFile mapFile)
Create a new map control and an initial map view.
|
void |
openMapFileWithView(java.io.File file,
java.awt.Point viewPosition,
java.awt.Point centerSquare)
Load a map file and create a map view.
|
MapView<G,A,R> |
openMapFileWithView(MapFile mapFile,
java.awt.Point viewPosition,
java.awt.Point centerSquare)
Load a map file and create a map view.
|
void |
refreshAllMaps()
Refreshes all map views.
|
void |
removeMapViewsListener(MapControl<G,A,R> mapControl,
MapViewsListener<G,A,R> listener)
Removes a
MapViewsListener to be notified of events. |
void |
repaintAllViews(MapControl<G,A,R> mapControl)
Repaints all
MapViews of a MapControl . |
void |
setFileControl(FileControl<G,A,R> fileControl)
Deprecated.
|
void |
setFocus(MapView<G,A,R> mapView)
Sets a
MapView as the main view. |
public 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)
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 FileControl<G,A,R> fileControl)
public void addMapViewsListener(@NotNull MapControl<G,A,R> mapControl, @NotNull MapViewsListener<G,A,R> listener)
MapViewsListener
to be notified of events.mapControl
- the map control to attach tolistener
- the listenerpublic void removeMapViewsListener(@NotNull MapControl<G,A,R> mapControl, @NotNull MapViewsListener<G,A,R> listener)
MapViewsListener
to be notified of events.mapControl
- the map control to attach tolistener
- the listener@Nullable public MapView<G,A,R> getMapViewFrame(@NotNull MapControl<G,A,R> mapControl)
MapControl
.mapControl
- the map controlpublic int getMapViews(@NotNull MapControl<G,A,R> mapControl)
MapControl
.mapControl
- the map control@NotNull public MapView<G,A,R> newMapView(@NotNull MapControl<G,A,R> mapControl, @Nullable java.awt.Point viewPosition, @Nullable java.awt.Point centerSquare)
mapControl
- the map controlviewPosition
- 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 setpublic void closeView(@NotNull MapView<G,A,R> mapView)
MapControl
.mapView
- the view to be closedpublic void setFocus(@NotNull MapView<G,A,R> mapView)
MapView
as the main view.mapView
- the map viewpublic java.util.Iterator<MapView<G,A,R>> getMapViewIterator(@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 repaintAllViews(@NotNull MapControl<G,A,R> mapControl)
MapViews
of a MapControl
.mapControl
- the map controlpublic void newMapWithView(@Nullable java.util.List<G> objects, @NotNull A mapArchObject, @Nullable java.awt.Point viewPosition, @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 MapView<G,A,R> mapView)
mapView
- the map view to close@NotNull public MapView<G,A,R> openMapFileWithView(@NotNull MapFile mapFile, @Nullable java.awt.Point viewPosition, @Nullable java.awt.Point centerSquare) throws java.io.IOException
mapFile
- 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 occurspublic void openMapFileWithView(@NotNull java.io.File file, @Nullable java.awt.Point viewPosition, @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 occurspublic void refreshAllMaps()
public void addEditType(int newType)
newType
- the new type to add