20 package net.sf.gridarta.gui.mainwindow;
22 import java.awt.event.FocusEvent;
23 import java.awt.event.FocusListener;
44 import org.jetbrains.annotations.NotNull;
45 import org.jetbrains.annotations.Nullable;
90 if (currentMapControl != null) {
95 currentMapControl = mapControl;
96 if (currentMapControl != null) {
104 public void mapCreated(@NotNull
final MapControl<G, A, R> mapControl,
final boolean interactive) {
129 public void preBeginTransaction() {
131 isInMapTransaction =
true;
135 public void beginTransaction(@NotNull
final String name) {
145 public void postEndTransaction() {
146 isInMapTransaction =
false;
158 public void mapSizeChanged(@NotNull
final Size2D newSize) {
164 if (selectedGameObject == null) {
168 final G topGameObject = selectedGameObject.getTopContainer();
169 for (
final Iterable<G> mapSquare : mapSquares) {
170 for (
final G gameObject : mapSquare) {
171 if (gameObject == topGameObject) {
179 public void mapObjectsChanged(@NotNull
final Set<G> gameObjects, @NotNull
final Set<G> transientGameObjects) {
181 if (selectedGameObject == gameObject.getHead()) {
193 public void mapFileChanged(@Nullable
final MapFile oldMapFile) {
198 public void modifiedChanged() {
216 public GameObjectTextEditorTab(@NotNull
final String
ident, @NotNull
final GameObjectTextEditor gameObjectTextEditor, @NotNull
final Location defaultLocation,
final boolean alternativeLocation,
final int index,
final boolean defaultOpen, @NotNull
final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull
final MapManager<G, A, R> mapManager) {
217 super(ident, gameObjectTextEditor, defaultLocation, alternativeLocation, index, defaultOpen);
222 public void selectionChanged(@Nullable
final MapSquare<G, A, R> mapSquare, @Nullable
final G gameObject) {
224 selectedGameObject = gameObject;
229 currentMapControl = mapManager.getCurrentMap();
230 if (currentMapControl != null) {
235 mapManager.addMapManagerListener(mapManagerListener);
236 selectedGameObject = selectedSquareModel.getSelectedGameObject();
238 gameObjectTextEditor.getTextPane().addFocusListener(
new FocusListener() {
241 public void focusGained(
final FocusEvent e) {
246 public void focusLost(
final FocusEvent e) {
258 if (gameObject == null || isInAutoApplyArchPanelChanges || isInMapTransaction) {
263 if (mapSquare == null) {
269 isInAutoApplyArchPanelChanges =
true;
278 isInAutoApplyArchPanelChanges =
false;
void autoApplyArchPanelChanges()
Applies pending changed.
void removeMapTransactionListener(@NotNull MapTransactionListener< G, A, R > listener)
Unregisters a map transaction listener.
A MapModel reflects the data of a map.
A MapManager manages all opened maps.
Graphical User Interface of Gridarta.
MapModel< G, A, R > getMapModel()
Returns the MapModel this map square is part of.
This package contains the framework for validating maps.
void endTransaction()
End a transaction.
A tab in a TabbedPanel component.
void applyChanges(@NotNull final GameObject<?, ?, ?> gameObject)
Updates a GameObject's attributes from the input field.
Interface for listeners listening on MapModel events.
Interface for listeners interested in events of SelectedSquareModel instances.
void addMapModelListener(@NotNull MapModelListener< G, A, R > listener)
Register a map listener.
Severity refreshDisplay(@Nullable final GameObject<?, ?, ?> gameObject)
Refreshes the input field to show the attributes of a GameObject.
boolean isInAutoApplyArchPanelChanges
Whether autoApplyArchPanelChanges() is currently running.
MapModel< G, A, R > getMapModel()
Returns the map model.
Base package of all Gridarta classes.
Interface for listeners listening on map transactions of MapModels.
Reflects a game object (object on a map).
void addMapTransactionListener(@NotNull MapTransactionListener< G, A, R > listener)
Registers a map transaction listener.
final MapTransactionListener< G, A, R > mapTransactionListener
The map transaction listener which is attached to currentMapControl.
final GameObjectTextEditor gameObjectTextEditor
The displayed GameObjectTextEditor instance.
Interface for listeners listening to MapManager changes.
final String ident
The tab's identification string.
GameObjects are the objects based on Archetypes found on maps.
void refreshDisplay()
Refreshes the tab's state from a selectedGameObject.
Displays the contents of the currently selected map square.
boolean alternativeLocation
Whether the tab is shown in the alternative location (.
G selectedGameObject
The currently selected game object.
The Tab displaying the game object text editor.
void removeMapModelListener(@NotNull MapModelListener< G, A, R > listener)
Unregister a map listener.
Currently nothing more than a marker interface for unification.
Records a set of changed map squares.
GameObjectTextEditorTab(@NotNull final String ident, @NotNull final GameObjectTextEditor gameObjectTextEditor, @NotNull final Location defaultLocation, final boolean alternativeLocation, final int index, final boolean defaultOpen, @NotNull final SelectedSquareModel< G, A, R > selectedSquareModel, @NotNull final MapManager< G, A, R > mapManager)
Creates a new instance.
An interface for classes that collect errors.
Implements the "Game Object Text Editor".
final MapModelListener< G, A, R > mapModelListener
The map model listener which is attached to currentMapControl.
void beginTransaction(@NotNull String name)
Starts a new transaction.
The model component of the selected square control.
final MapManagerListener< G, A, R > mapManagerListener
The map manager listener.
boolean isInMapTransaction
Records whether a map transaction is active.
void setSeverity(@NotNull final Severity severity)
Sets the tab's Severity.
final int index
The tab's index for ordering.
The location of a map file with a map directory.
Interface for MapArchObjects.
MapControl< G, A, R > currentMapControl
Last known active map.
The class Size2D represents a 2d rectangular area.
MapSquare< G, A, R > getMapSquare()
Get the MapSquare of this GameObjectContainer.