 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.map.mapview;
22 import java.awt.Point;
23 import java.util.ArrayList;
24 import java.util.Collection;
25 import java.util.Collections;
26 import java.util.Iterator;
27 import java.util.List;
28 import java.util.concurrent.CopyOnWriteArrayList;
33 import org.jetbrains.annotations.NotNull;
34 import org.jetbrains.annotations.Nullable;
46 private final Collection<MapViewsListener<G, A, R>>
listeners =
new CopyOnWriteArrayList<>();
55 private final List<MapView<G, A, R>>
mapViews =
new ArrayList<>();
105 mapControl.acquire();
108 if (viewPosition !=
null) {
112 mapControl.acquire();
114 listener.mapViewCreated(mapView);
118 mapControl.release();
128 final Point[] result =
new Point[
mapViews.size()];
129 for (
int i = 0; i < result.length; i++) {
130 result[i] =
mapViews.get(i).getScrollPane().getViewport().getViewPosition();
141 listener.mapViewClosing(mapView);
143 mapView.closeNotify();
145 mapView.getMapControl().release();
174 return Collections.unmodifiableList(
mapViews).iterator();
182 mapView.getRenderer().forceRepaint();
192 listener.mapViewRaise(mapView);
int nextMapViewCounter
The map view counter for the next created MapView.
Iterator< MapView< G, A, R > > getMapViewIterator()
Returns an Iterator returning all MapViews.
Base package of all Gridarta classes.
void repaintAllViews()
Repaints all MapViews.
A list of MapViews for one MapControl instance.
MapView< G, A, R > newMapView(@NotNull final MapControl< G, A, R > mapControl, @Nullable final Point viewPosition, @NotNull final MapViewFactory< G, A, R > mapViewFactory)
Creates a new MapView.
Reflects a game object (object on a map).
int getMapViews()
Returns the number of views of a MapControl.
MapView< G, A, R > getMapViewFrame()
Returns the last used view of a MapControl.
void setViewPosition(@NotNull Point viewPosition)
Sets the view position.
void closeView(@NotNull final MapView< G, A, R > mapView)
Closes a view of a MapControl.
GameObjects are the objects based on Archetypes found on maps.
void closeAllViews()
Closes all views of a MapControl.
Interface for MapArchObjects.
void removeMapViewsListener(@NotNull final MapViewsListener< G, A, R > listener)
Removes a MapViewsListener to be notified of events.
void addMapViewsListener(@NotNull final MapViewsListener< G, A, R > listener)
Adds a MapViewsListener to be notified of events.
final Collection< MapViewsListener< G, A, R > > listeners
The registered MapViewsListeners.
void setFocus(@NotNull final MapView< G, A, R > mapView)
Sets a MapView as the main view.
final List< MapView< G, A, R > > mapViews
The list contains all views of the map.
Point[] getViewPositions()
Returns the current view positions of all views of a MapControl.
Currently nothing more than a marker interface for unification.