20 package net.sf.gridarta.gui.panel.connectionview;
22 import java.awt.BorderLayout;
23 import java.awt.event.MouseListener;
24 import java.util.ArrayList;
25 import java.util.Comparator;
27 import java.util.TreeMap;
28 import java.util.Vector;
29 import javax.swing.JList;
30 import javax.swing.JPanel;
31 import javax.swing.JScrollPane;
32 import javax.swing.event.ListSelectionListener;
43 import org.jetbrains.annotations.NotNull;
44 import org.jetbrains.annotations.Nullable;
131 connections =
new TreeMap<>(keyComparator);
132 setLayout(
new BorderLayout());
133 connectionList.setCellRenderer(cellRenderer);
134 add(
new JScrollPane(connectionList));
135 delayedMapModelListenerManager.addDelayedMapModelListener(delayedMapModelListener);
136 mapViewManager.addMapViewManagerListener(mapViewManagerListener);
153 connectionList.addListSelectionListener(listener);
161 connectionList.addMouseListener(listener);
169 if (mapView != null) {
172 connectionList.setListData(
new Vector<>(connections.values()));
180 for (
final Iterable<G> mapSquare : mapModel) {
181 for (
final G gameObject : mapSquare) {
194 if (!connections.containsKey(key)) {
197 connections.get(key).addGameObject(gameObject);
206 return new ArrayList<>(connectionList.getSelectedValuesList());
final DelayedMapModelListener< G, A, R > delayedMapModelListener
The map model listener to detect map changes.
final Map< K, Connection< K > > connections
The connections.
void scanMapForConnections(@NotNull final Iterable< MapSquare< G, A, R >> mapModel)
Scans the given map for the contained connections.
Iterable< Connection< K > > getSelectedConnections()
Return a list of all selected connections.
A MapModel reflects the data of a map.
Graphical User Interface of Gridarta.
final MapViewManagerListener< G, A, R > mapViewManagerListener
The map view listener to detect changed active maps.
abstract void scanGameObjectForConnections(@NotNull G gameObject)
Scan the given game object for connections.
Abstract base class for a panel that holds information about connections of the selected key on the s...
Stores GameObjects related to key values.
MapControl< G, A, R > getMapControl()
Return the controller of this view.
MapModel< G, A, R > getMapModel()
Returns the map model.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
View(@NotNull final Comparator< K > keyComparator, @NotNull final CellRenderer< K > cellRenderer, @NotNull final MapViewManager< G, A, R > mapViewManager, @NotNull final DelayedMapModelListenerManager< G, A, R > delayedMapModelListenerManager)
Create a panel.
A DefaultListCellRenderer for rendering Connection objects in a list.
MapView< G, A, R > mapView
Map view corresponding to connectionList.
GameObjects are the objects based on Archetypes found on maps.
Interface for listeners interested in events related to MapViewManager instances. ...
static final long serialVersionUID
The serial version UID.
final JList< Connection< K > > connectionList
The List with the connections.
void addConnection(@NotNull final K key, @NotNull final GameObject< G, A, R > gameObject)
Base classes for rendering maps.
MapView< G, A, R > getMapView()
Return the current map view.
void addListSelectionListener(@NotNull final ListSelectionListener listener)
Register a ListSelectionListener for the connection list.
void scanMapForConnections()
Scans the current map (mapView) for the contained connections.
void addListMouseListener(@NotNull final MouseListener listener)
Register a MouseListener for the connection list.
A map view consists of a map grid and a map cursor, and is attached to a map control.
Interface for listeners interested in delayed map model change events.
Provides support for delayed notification of MapModel changes.
Interface for MapArchObjects.