Package net.sf.gridarta.gui.map.mapview
Class MapViewsManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>>
- java.lang.Object
-
- net.sf.gridarta.gui.map.mapview.MapViewsManager<G,A,R>
-
public class MapViewsManager<G extends GameObject<G,A,R>,A extends MapArchObject<A>,R extends Archetype<G,A,R>> extends java.lang.ObjectStores all existingMapViews.
-
-
Constructor Summary
Constructors Constructor 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddMapViewsListener(@NotNull MapControl<G,A,R> mapControl, @NotNull MapViewsListener<G,A,R> listener)Adds aMapViewsListenerto be notified of events.voidcloseMapView(@NotNull MapView<G,A,R> mapView)Invoked when the user wants to close a map view.voidcloseView(@NotNull MapView<G,A,R> mapView)Closes a view of aMapControl.@Nullable MapView<G,A,R>getMapViewFrame(@NotNull MapControl<G,A,R> mapControl)Returns the last used view of aMapControl.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.voidnewMapWithView(@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.voidopenMapFileWithView(@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.voidremoveMapViewsListener(@NotNull MapControl<G,A,R> mapControl, @NotNull MapViewsListener<G,A,R> listener)Removes aMapViewsListenerto be notified of events.voidsetFileControl(@NotNull FileControl<G,A,R> fileControl)Deprecated.voidsetFocus(@NotNull MapView<G,A,R> mapView)Sets aMapViewas the main view.
-
-
-
Constructor Detail
-
MapViewsManager
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)Creates a new instance.- Parameters:
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
-
-
Method Detail
-
setFileControl
@Deprecated public void setFileControl(@NotNull @NotNull FileControl<G,A,R> fileControl)Deprecated.
-
addMapViewsListener
public void addMapViewsListener(@NotNull @NotNull MapControl<G,A,R> mapControl, @NotNull @NotNull MapViewsListener<G,A,R> listener)Adds aMapViewsListenerto be notified of events.- Parameters:
mapControl- the map control to attach tolistener- the listener
-
removeMapViewsListener
public void removeMapViewsListener(@NotNull @NotNull MapControl<G,A,R> mapControl, @NotNull @NotNull MapViewsListener<G,A,R> listener)Removes aMapViewsListenerto be notified of events.- Parameters:
mapControl- the map control to attach tolistener- the listener
-
getMapViewFrame
@Nullable public @Nullable MapView<G,A,R> getMapViewFrame(@NotNull @NotNull MapControl<G,A,R> mapControl)
Returns the last used view of aMapControl.- Parameters:
mapControl- the map control- Returns:
- the last used view
-
newMapView
@NotNull public @NotNull MapView<G,A,R> newMapView(@NotNull @NotNull MapControl<G,A,R> mapControl, @Nullable @Nullable java.awt.Point viewPosition)
Creates a new map view.- Parameters:
mapControl- the map controlviewPosition- the view position to show initially; may benullto show the top left corner- Returns:
- the map view
-
closeView
public void closeView(@NotNull @NotNull MapView<G,A,R> mapView)Closes a view of aMapControl.- Parameters:
mapView- the view to be closed
-
setFocus
public void setFocus(@NotNull @NotNull MapView<G,A,R> mapView)Sets aMapViewas the main view.- Parameters:
mapView- the map view
-
getMapViewIterator
public java.util.Iterator<MapView<G,A,R>> getMapViewIterator(@NotNull @NotNull MapControl<G,A,R> mapControl)
Returns anIteratorreturning allMapViewsof aMapControl. The map views are returns top to bottom.- Parameters:
mapControl- the map control- Returns:
- the iterator
-
newMapWithView
public void newMapWithView(@Nullable @Nullable java.util.List<G> objects, @NotNull A mapArchObject, @Nullable @Nullable java.awt.Point viewPosition, @Nullable @Nullable MapFile mapFile)Creates a new map control and an initial map view.- Parameters:
objects- the game objects to insert; may benullmapArchObject- the map arch object for the new mapviewPosition- the view position to show initially; may benullto show the top left cornermapFile- the map file, ornullif the map was not yet saved
-
closeMapView
public void closeMapView(@NotNull @NotNull MapView<G,A,R> mapView)Invoked when the user wants to close a map view. If there is only 1 view left the map will be closed.- Parameters:
mapView- the map view to close
-
openMapFileWithView
@NotNull public @NotNull MapView<G,A,R> openMapFileWithView(@NotNull @NotNull MapFile mapFile, @Nullable @Nullable java.awt.Point viewPosition) throws java.io.IOException
Loads a map file and creates a map view. Returns the last used view if the map is already loaded.- Parameters:
mapFile- the map file to loadviewPosition- the view position to show initially; may benullto show the top left corner- Returns:
- the map view
- Throws:
java.io.IOException- if an I/O error occurs
-
openMapFileWithView
public void openMapFileWithView(@NotNull @NotNull java.io.File file, @Nullable @Nullable java.awt.Point viewPosition, @Nullable @Nullable java.awt.Point centerSquare) throws java.io.IOExceptionLoads a map file and creates a map view.- Parameters:
file- the map file to loadviewPosition- the view position to show initially; may benullto show the top left cornercenterSquare- the map square that should be in the center of the view; ignored ifviewPositionis set- Throws:
java.io.IOException- if an I/O error occurs
-
-