 |
Gridarta Editor
|
Go to the documentation of this file.
20 package net.sf.gridarta.gui.map.mapview;
22 import java.awt.BorderLayout;
23 import java.awt.Component;
24 import java.awt.Point;
25 import java.beans.PropertyVetoException;
27 import javax.swing.Action;
28 import javax.swing.JComponent;
29 import javax.swing.JInternalFrame;
30 import javax.swing.JScrollPane;
31 import javax.swing.KeyStroke;
32 import javax.swing.WindowConstants;
53 import net.
sf.japi.swing.action.ActionBuilder;
54 import net.
sf.japi.swing.action.ActionBuilderFactory;
55 import org.apache.log4j.Category;
56 import org.apache.log4j.Logger;
57 import org.jetbrains.annotations.NotNull;
58 import org.jetbrains.annotations.Nullable;
76 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
127 public void mapSizeChanged(@NotNull
final Size2D newSize) {
137 public void mapObjectsChanged(@NotNull
final Set<G> gameObjects, @NotNull
final Set<G> transientGameObjects) {
147 public void mapFileChanged(@Nullable
final MapFile oldMapFile) {
152 public void modifiedChanged() {
166 public void mapMetaChanged() {
171 public void mapSizeChanged(@NotNull
final Size2D mapSize) {
195 public DefaultMapView(@NotNull
final MapControl<G, A, R> mapControl,
final int number, @NotNull
final PathManager pathManager, @NotNull
final MapGrid mapGrid, @NotNull
final MapCursor<G, A, R> mapCursor, @NotNull
final AbstractMapRenderer<G, A, R> renderer,
final int xScrollDistance,
final int yScrollDistance) {
208 internalFrame.getContentPane().setLayout(
new BorderLayout());
210 internalFrame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
239 if (action !=
null) {
241 if (keyStroke1 !=
null) {
242 internalFrame.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(keyStroke1, key);
245 if (keyStroke2 !=
null) {
246 internalFrame.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT).put(keyStroke2, key);
290 final String mapPath = mapFile ==
null ?
"<unsaved>" : mapFile.
getMapPath().
toString();
310 }
catch (
final PropertyVetoException e) {
311 LOG.warn(
"Unexpected exception", e);
final MapGrid mapGrid
The MapGrid of this map view.
abstract void closeNotify()
Must be called when this renderer is not used anymore.
final MapArchObjectListener mapArchObjectListener
The MapArchObjectListener used to detect changes in the map model that should be reflected in the win...
A MapModel reflects the data of a map.
final MapControlListener< G, A, R > mapControlListener
The MapControlListener used to detect changes in the map control that should be reflected in the wind...
A getMapArchObject()
Returns the Map Arch Object with the meta information about the map.
final MapModel< G, A, R > mapModel
The MapModel of this map view.
final PathManager pathManager
The PathManager for converting path names.
MapControl< G, A, R > getMapControl()
final MapModelListener< G, A, R > mapModelListener
The MapModelListener used to detect changes in the map model that should be reflected in the window t...
final JInternalFrame internalFrame
The JInternalFrame instance associated with this map view.
Base package of all Gridarta classes.
Interface for listeners listening on map arch object changes.
This class contains methods for converting relative map paths to absolute map paths and vice versa.
void setViewPosition(@NotNull final Point viewPosition)
Sets the view position.
static String getWindowTitle(@NotNull final MapControl<?, ?, ?> mapControl, final int number, @NotNull final PathManager pathManager)
Returns the title for the map window.
Reflects a game object (object on a map).
void addMapModelListener(@NotNull MapModelListener< G, A, R > listener)
Register a map listener.
boolean isModified()
Return whether the map has been modified from the on-disk state.
void installAccelerator(@NotNull final String key)
Installs accelerator keys for an action.
AbsoluteMapPath getMapPath()
Returns the map path within getMapsDir().
Utility class implementing Action related functions.
Graphical User Interface of Gridarta.
Abstract base class for classes implementing MapRenderer.
static final ActionBuilder ACTION_BUILDER
Action Builder to create Actions.
GameObjects are the objects based on Archetypes found on maps.
final int number
View number.
boolean isPickmap()
Return flag that indicates whether this is a pickmap or not.
static KeyStroke getShortcut(@NotNull final Action action)
Returns the shortcut of an Action.
void removeMapModelListener(@NotNull MapModelListener< G, A, R > listener)
Unregister a map listener.
Interface for MapArchObjects.
void closeNotify()
Must be called when this instance is not used anymore.
An interface for classes that collect errors.
void updateTitle()
Updates the Map-Window Title (according to name and changeFlag).
JInternalFrame getInternalFrame()
final MapCursorTracker< G, A, R > mapCursorTracker
The erroneous MapSquares.
This package contains the framework for validating maps.
MapCursor provides methods to move and drag on map.
JScrollPane getScrollPane()
The location of a map file with a map directory.
Reading and writing of maps, handling of paths.
static KeyStroke getAlternativeShortcut(@NotNull final Action action)
Returns the alternative shortcut of an Action.
Interface for listeners listening on MapModel events.
2D-Grid containing flags for selection, pre-selection, cursor, warnings and errors.
Default MapView implementation.
void addMapControlListener(@NotNull MapControlListener< G, A, R > listener)
Registers a MapControlListener.
static final Category LOG
The Logger for printing log messages.
JScrollPane getScrollPane()
Returns the JScrollPane of the renderer.
final ErroneousMapSquares< G, A, R > erroneousMapSquares
The erroneous MapSquares.
Base classes for rendering maps.
Abstract base class for MapView implementations.
void closeNotify()
Must be called when this instance is not used anymore.
DefaultMapView(@NotNull final MapControl< G, A, R > mapControl, final int number, @NotNull final PathManager pathManager, @NotNull final MapGrid mapGrid, @NotNull final MapCursor< G, A, R > mapCursor, @NotNull final AbstractMapRenderer< G, A, R > renderer, final int xScrollDistance, final int yScrollDistance)
Creates a new instance.
Currently nothing more than a marker interface for unification.
Interface for listeners listening on changes in MapControl instances.
void removeMapControlListener(@NotNull MapControlListener< G, A, R > listener)
Unregisters a MapControlListener.
final AbstractMapRenderer< G, A, R > renderer
The AbstractMapRenderer for rendering the map model.
MapModel< G, A, R > getMapModel()
Returns the map model.
Common interface for renderers of map control instances.
MapFile getMapFile()
Returns the map file.
MapRenderer getRenderer()
void setViewPosition(@NotNull final Point viewPosition)
Sets the view position.
The class Size2D represents a 2d rectangular area.
final MapControl< G, A, R > mapControl
The controller of this view.
final MapCursor< G, A, R > mapCursor
The MapCursor of this map view.