Gridarta Editor
GameObjectAttributesControl.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2023 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.gui.panel.gameobjectattributes;
21 
22 import java.awt.BorderLayout;
23 import java.awt.Component;
24 import java.awt.Container;
25 import java.awt.GridLayout;
26 import java.util.Collection;
27 import java.util.HashSet;
28 import java.util.IdentityHashMap;
29 import java.util.Map;
30 import java.util.Map.Entry;
31 import java.util.Set;
32 import java.util.concurrent.CopyOnWriteArrayList;
33 import javax.swing.Action;
34 import javax.swing.JButton;
35 import javax.swing.JLabel;
36 import javax.swing.JPanel;
37 import javax.swing.JTabbedPane;
38 import javax.swing.SwingConstants;
61 import net.sf.gridarta.utils.Size2D;
62 import net.sf.japi.swing.action.ActionBuilder;
63 import net.sf.japi.swing.action.ActionBuilderFactory;
64 import net.sf.japi.swing.action.ActionMethod;
65 import org.jetbrains.annotations.NotNull;
66 import org.jetbrains.annotations.Nullable;
67 
73 public class GameObjectAttributesControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JPanel {
74 
78  private static final long serialVersionUID = 1L;
79 
83  @NotNull
84  private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta");
85 
89  @NotNull
91 
95  @NotNull
97 
101  @NotNull
103 
108  @NotNull
110 
114  @NotNull
116 
120  @NotNull
121  private final JTabbedPane panelDesktop = new JTabbedPane(SwingConstants.TOP);
122 
126  @NotNull
128 
133  @NotNull
134  private final Collection<GameObjectAttributesControlListener> listeners = new CopyOnWriteArrayList<>();
135 
139  @Nullable
141 
146 
150  @NotNull
152 
156  @NotNull
157  private final Action aMapArchAddInv = ACTION_BUILDER.createAction(false, "mapArchAddInv", this);
158 
162  @NotNull
163  private final Action aMapArchAddEnv = ACTION_BUILDER.createAction(false, "mapArchAddEnv", this);
164 
168  @NotNull
169  private final Action aMapArchAttribute = ACTION_BUILDER.createAction(false, "mapArchAttrib", this);
170 
174  @NotNull
175  private final Collection<GameObjectAttributesTab<G, A, R>> tabs = new HashSet<>();
176 
180  @NotNull
181  private final Map<GameObjectAttributesTab<G, A, R>, Integer> tabIndex = new IdentityHashMap<>();
182 
186  @NotNull
187  private final Map<Component, GameObjectAttributesTab<G, A, R>> componentTabs = new IdentityHashMap<>();
188 
192  @Nullable
194 
199  private boolean isInMapTransaction;
200 
204  @NotNull
206 
207  @Override
208  public void currentMapChanged(@Nullable final MapControl<G, A, R> mapControl) {
209  if (currentMapControl != null) {
213  }
214  currentMapControl = mapControl;
215  if (currentMapControl != null) {
219  }
220  }
221 
222  @Override
223  public void mapCreated(@NotNull final MapControl<G, A, R> mapControl, final boolean interactive) {
224  // ignore
225  }
226 
227  @Override
228  public void mapClosing(@NotNull final MapControl<G, A, R> mapControl) {
229  // ignore
230  }
231 
232  @Override
233  public void mapClosed(@NotNull final MapControl<G, A, R> mapControl) {
234  // ignore
235  }
236 
237  };
238 
242  @NotNull
244 
245  @Override
246  public void mapSizeChanged(@NotNull final Size2D newSize) {
247  // ignore
248  }
249 
250  @Override
251  public void mapSquaresChanged(@NotNull final Set<MapSquare<G, A, R>> mapSquares) {
252  if (selectedGameObject == null) {
253  return;
254  }
255 
256  final G topGameObject = selectedGameObject.getTopContainer();
257  for (final Iterable<G> mapSquare : mapSquares) {
258  for (final G gameObject : mapSquare) {
259  if (gameObject == topGameObject) {
260  refreshDisplay();
261  }
262  }
263  }
264  }
265 
266  @Override
267  public void mapObjectsChanged(@NotNull final Set<G> gameObjects, @NotNull final Set<G> transientGameObjects) {
268  for (final GameObject<G, A, R> gameObject : gameObjects) {
269  if (selectedGameObject == gameObject.getHead()) {
270  refreshDisplay();
271  }
272  }
273  }
274 
275  @Override
276  public void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) {
277  // ignore
278  }
279 
280  @Override
281  public void mapFileChanged(@Nullable final MapFile oldMapFile) {
282  // ignore
283  }
284 
285  @Override
286  public void modifiedChanged() {
287  // ignore
288  }
289 
290  };
291 
297  @NotNull
299 
300  @Override
301  public void preBeginTransaction() {
303  isInMapTransaction = true;
304  }
305 
306  @Override
307  public void beginTransaction(@NotNull final String name) {
308  // ignore
309  }
310 
311  @Override
312  public void endTransaction(@NotNull final SavedSquares<G, A, R> savedSquares) {
313  // ignore
314  }
315 
316  @Override
317  public void postEndTransaction() {
318  isInMapTransaction = false;
319  }
320 
321  };
322 
326  @NotNull
328 
329  @Override
330  public void selectionChanged(@Nullable final MapSquare<G, A, R> mapSquare, @Nullable final G gameObject) {
332  }
333 
334  };
335 
339  @NotNull
341 
342  @Override
343  public void selectedGameObjectChanged(@Nullable final G selectedGameObject) {
346  refreshDisplay();
347  }
348 
349  @Override
350  public void refreshSelectedGameObject() {
351  // ignore
352  }
353 
354  };
355 
359  @NotNull
361 
362  @Override
363  public void tabSeverityChanged(@NotNull final GameObjectAttributesTab<G, A, R> tab, @NotNull final Severity tabSeverity) {
364  setTabSeverity(tab, tabSeverity);
365  }
366 
367  @Override
368  public void apply() {
370  }
371 
372  };
373 
387  super(new BorderLayout());
388  this.gameObjectAttributesModel = gameObjectAttributesModel;
389  this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory;
390  this.objectChooser = objectChooser;
391  this.selectedSquareModel = selectedSquareModel;
392  this.gameObjectFactory = gameObjectFactory;
393  this.mapViewSettings = mapViewSettings;
394 
395  final Container mapArchPanel = new JPanel();
396  mapArchPanel.setLayout(new BorderLayout());
397  add(mapArchPanel, BorderLayout.CENTER);
398 
399  final Container buttonPanel = createButtonPanel();
400  buttonPanel.setLayout(new GridLayout(0, 1));
401  mapArchPanel.add(buttonPanel, BorderLayout.WEST);
402  mapArchPanel.add(panelDesktop, BorderLayout.CENTER);
403 
405  gameObjectAttributesModel.addGameObjectAttributesModelListener(gameObjectAttributesModelListener); // this listener must be registered before any tab, including TextEditorTab
406 
408  refreshDisplay();
409  currentMapControl = mapManager.getCurrentMap();
410  if (currentMapControl != null) {
414  }
415  mapManager.addMapManagerListener(mapManagerListener);
416  }
417 
423  listeners.add(listener);
424  }
425 
431  listeners.remove(listener);
432  }
433 
438  public void addTab(@NotNull final GameObjectAttributesTab<G, A, R> tab) {
439  tabIndex.put(tab, panelDesktop.getTabCount());
440  addTabInt(tab);
441  panelDesktop.add(tab.getPanel(), ActionBuilderUtils.getString(ACTION_BUILDER, "mapArchTab" + tab.getClass().getSimpleName() + ".text"));
442  setTabSeverity(tab, tab.getTabSeverity());
443  }
444 
449  private void addTabInt(final GameObjectAttributesTab<G, A, R> tab) {
450  tabs.add(tab);
451  componentTabs.put(tab.getPanel(), tab);
453  }
454 
459  public void selectTab(@NotNull final GameObjectAttributesTab<G, A, R> tab) {
460  if (!tabs.contains(tab)) {
461  throw new IllegalArgumentException("undefined tab: " + tab);
462  }
463 
464  panelDesktop.setSelectedComponent(tab.getPanel());
465  }
466 
471  @NotNull
473  final Component component = panelDesktop.getSelectedComponent();
474  final GameObjectAttributesTab<G, A, R> tab = componentTabs.get(component);
475  assert tab != null;
476  return tab;
477  }
478 
484  private void setTabSeverity(@NotNull final GameObjectAttributesTab<G, A, R> tab, @NotNull final Severity tabSeverity) {
485  final Integer index = tabIndex.get(tab);
486  if (index == null) {
487  return;
488  }
489 
490  /* panelDesktop.setForegroundAt() doesn't work with Nimbus, so use a (dirty) workaround. */
491  final JLabel title = new JLabel(panelDesktop.getTitleAt(index));
492  title.setForeground(tabSeverity.getColor());
493  panelDesktop.setTabComponentAt(index, title);
494 
495  Severity mainSeverity = tabSeverity;
496  for (final Entry<GameObjectAttributesTab<G, A, R>, Integer> pair2 : tabIndex.entrySet()) {
497  final Severity tmpSeverity = pair2.getKey().getTabSeverity();
498  if (tmpSeverity.getLevel() > mainSeverity.getLevel()) {
499  mainSeverity = tmpSeverity;
500  }
501  }
502  if (severity == mainSeverity) {
503  return;
504  }
505  severity = mainSeverity;
506  for (final GameObjectAttributesControlListener listener : listeners) {
507  listener.severityChanged(mainSeverity);
508  }
509  }
510 
515  @NotNull
517  return severity;
518  }
519 
523  private void refreshDisplay() {
524  aMapArchAddInv.setEnabled(selectedGameObject != null);
525  aMapArchAddEnv.setEnabled(selectedGameObject != null);
526  aMapArchAttribute.setEnabled(selectedGameObject != null);
528  }
529 
534  @ActionMethod
535  public void mapArchAttrib() {
536  if (selectedGameObject != null) {
538  }
539  }
540 
545  @ActionMethod
546  public void mapArchAddInv() {
548  if (arch == null) { // nothing selected?
549  return;
550  }
551 
552  final GameObject<G, A, R> gameObject = selectedGameObject;
553  if (gameObject == null) {
554  return;
555  }
556 
557  final G invNew = arch.newInstance(gameObjectFactory);
558 
559  final MapModel<G, A, R> mapModel = gameObject.getMapSquare().getMapModel();
560  mapModel.beginTransaction("Add to inventory");
561  try {
562  gameObject.addLast(invNew);
563  if (arch instanceof Archetype) {
565  }
566  } finally {
567  mapModel.endTransaction();
568  }
569  }
570 
575  @ActionMethod
576  public void mapArchAddEnv() {
578  if (baseObject == null) {
579  return;
580  }
581 
582  final G prevGameObject = selectedGameObject;
583  if (prevGameObject == null) {
584  return;
585  }
586 
587  final MapSquare<G, A, R> mapSquare = prevGameObject.getMapSquare();
588  final MapModel<G, A, R> mapModel = mapSquare.getMapModel();
589  mapModel.beginTransaction("Add to environment"); // TODO; I18N/L10N
590  try {
591  final G insertedGameObject = mapModel.insertArchToMap(baseObject, prevGameObject, mapSquare.getMapLocation(), mapViewSettings.isAutojoin());
592  if (insertedGameObject != null) {
593  mapModel.removeGameObject(prevGameObject, mapViewSettings.isAutojoin());
594  insertedGameObject.addLast(prevGameObject);
595  selectedSquareModel.setSelectedGameObject(insertedGameObject);
596  }
597  } finally {
598  mapModel.endTransaction();
599  }
600  }
601 
606  private void autoApplyArchPanelChanges() {
608  return;
609  }
610 
612  try {
614  } finally {
616  }
617  }
618 
623  private void applyArchPanelChanges() {
624  final GameObject<G, A, R> gameObject = selectedGameObject;
625  if (gameObject == null) {
626  return;
627  }
628 
629  final MapSquare<G, A, R> mapSquare = gameObject.getMapSquareOptional();
630  if (mapSquare == null) {
631  // auto-apply of deleted game object
632  return;
633  }
634 
635  // suppress unwanted map transactions if nothing has changed
636  boolean canApply = false;
637  for (final GameObjectAttributesTab<G, A, R> tab : tabs) {
638  if (tab.canApply()) {
639  canApply = true;
640  break;
641  }
642  }
643  if (!canApply) {
644  return;
645  }
646 
647  final MapModel<G, A, R> mapModel = mapSquare.getMapModel();
648  mapModel.beginTransaction("Change object attributes");
649  try {
650  for (final GameObjectAttributesTab<G, A, R> tab : tabs) {
651  if (tab.canApply()) {
652  tab.apply();
653  }
654  }
655  } finally {
656  mapModel.endTransaction();
657  }
658  }
659 
664  @NotNull
665  private Container createButtonPanel() {
666  final Container buttonPanel = new JPanel();
667  buttonPanel.add(new JButton(aMapArchAddInv));
668  buttonPanel.add(new JButton(aMapArchAddEnv));
669  buttonPanel.add(new JButton(aMapArchAttribute));
670  return buttonPanel;
671  }
672 
673 }
net.sf.gridarta.model.mapmodel.MapModel.insertArchToMap
G insertArchToMap(@NotNull BaseObject< G, A, R, ?> templateBaseObject, @Nullable G nextGameObject, @NotNull Point pos, boolean join)
Insert a game object to the map at a specified position.
name
name
Definition: ArchetypeTypeSetParserTest-ignoreDefaultAttribute1-result.txt:2
net.sf.gridarta.model.mapmanager
Definition: AbstractMapManager.java:20
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.applyArchPanelChanges
void applyArchPanelChanges()
When the "apply"-button on the ArchPanel (at the bottom of the window) is pressed,...
Definition: GameObjectAttributesControl.java:623
net.sf.gridarta.model.mapmodel.MapModel
A MapModel reflects the data of a map.
Definition: MapModel.java:75
net.sf.gridarta.gui.panel
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.createButtonPanel
Container createButtonPanel()
Creates the button panel containing the actions.
Definition: GameObjectAttributesControl.java:665
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.GameObjectAttributesControl
GameObjectAttributesControl(@NotNull final GameObjectAttributesModel< G, A, R > gameObjectAttributesModel, @NotNull final GameObjectAttributesDialogFactory< G, A, R > gameObjectAttributesDialogFactory, @NotNull final ObjectChooser< G, A, R > objectChooser, @NotNull final MapManager< G, A, R > mapManager, @NotNull final SelectedSquareModel< G, A, R > selectedSquareModel, @NotNull final GameObjectFactory< G, A, R > gameObjectFactory, @NotNull final MapViewSettings mapViewSettings)
Creates a new instance.
Definition: GameObjectAttributesControl.java:386
net.sf.gridarta.model.gameobject.GameObjectFactory
Abstract factory for creating GameObject instances.
Definition: GameObjectFactory.java:31
net.sf.gridarta.model.mapmanager.MapManager
A MapManager manages all opened maps.
Definition: MapManager.java:37
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.serialVersionUID
static final long serialVersionUID
The serial version UID.
Definition: GameObjectAttributesControl.java:78
net.sf.gridarta.model.mapmodel.MapSquare.getMapLocation
Point getMapLocation()
Returns the coordinate on the map.
Definition: MapSquare.java:124
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl
Common base class for the panel that allows users to edit a GameObject's attributes.
Definition: GameObjectAttributesControl.java:73
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.mapViewSettings
final MapViewSettings mapViewSettings
The MapViewSettings instance.
Definition: GameObjectAttributesControl.java:115
net.sf.gridarta
Base package of all Gridarta classes.
net.sf.gridarta.model.mapmodel.MapSquare
A single Map Square.
Definition: MapSquare.java:45
net.sf.gridarta.model.mapmodel.MapModel.endTransaction
void endTransaction()
End a transaction.
net.sf.gridarta.gui.dialog.gameobjectattributes.GameObjectAttributesDialogFactory.showAttributeDialog
void showAttributeDialog(@NotNull final G gameObject)
Shows the game object attributes dialog for a given GameObject instance.
Definition: GameObjectAttributesDialogFactory.java:217
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.gameObjectAttributesModelListener
final GameObjectAttributesModelListener< G, A, R > gameObjectAttributesModelListener
The listener attached to gameObjectAttributesModel.
Definition: GameObjectAttributesControl.java:340
net.sf.gridarta.model.mapviewsettings
Definition: AbstractMapViewSettings.java:20
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesTab.addGameObjectAttributesTabListener
void addGameObjectAttributesTabListener(@NotNull GameObjectAttributesTabListener< G, A, R > listener)
Adds a listener.
net.sf.gridarta.model.mapmodel.MapTransactionListener
Interface for listeners listening on map transactions of MapModels.
Definition: MapTransactionListener.java:33
net.sf
net.sf.gridarta.model.mapmodel.MapModel.beginTransaction
void beginTransaction(@NotNull String name)
Starts a new transaction.
net.sf.gridarta.model.mapviewsettings.MapViewSettings.isAutojoin
boolean isAutojoin()
Returns whether "autojoin" is enabled.
net.sf.gridarta.model.mapmanager.MapManagerListener
Interface for listeners listening to MapManager changes.
Definition: MapManagerListener.java:42
net.sf.gridarta.model.mapmodel
Definition: AboveFloorInsertionMode.java:20
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.getSeverity
Severity getSeverity()
Returns the overall Severity.
Definition: GameObjectAttributesControl.java:516
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.mapModelListener
final MapModelListener< G, A, R > mapModelListener
The map model listener which is attached to currentMapControl.
Definition: GameObjectAttributesControl.java:243
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesModel.setSelectedGameObject
void setSelectedGameObject(@Nullable final G selectedGameObject)
If a game object is selected, the MapArchPanels (bottom right windows) get updated.
Definition: GameObjectAttributesModel.java:52
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.listeners
final Collection< GameObjectAttributesControlListener > listeners
The registered GameObjectAttributesControlListeners to notify.
Definition: GameObjectAttributesControl.java:134
net.sf.gridarta.model.archetype
Definition: AbstractArchetype.java:20
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesTab< G, A, R >
net.sf.gridarta.model.gameobject.GameObject
Reflects a game object (object on a map).
Definition: GameObject.java:36
net.sf.gridarta.model.mapviewsettings.MapViewSettings
Container for settings that affect the rendering of maps.
Definition: MapViewSettings.java:30
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.addTab
void addTab(@NotNull final GameObjectAttributesTab< G, A, R > tab)
Adds a tab.
Definition: GameObjectAttributesControl.java:438
net.sf.gridarta.model.mapcontrol
Definition: DefaultMapControl.java:20
net.sf.gridarta.model.mapmodel.MapModel.addMapModelListener
void addMapModelListener(@NotNull MapModelListener< G, A, R > listener)
Register a map listener.
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.severity
Severity severity
The overall Severity.
Definition: GameObjectAttributesControl.java:151
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.isInMapTransaction
boolean isInMapTransaction
Records whether a map transaction is active.
Definition: GameObjectAttributesControl.java:199
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.tabs
final Collection< GameObjectAttributesTab< G, A, R > > tabs
All active tabs.
Definition: GameObjectAttributesControl.java:175
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesModel.fireRefreshSelectedGameObject
void fireRefreshSelectedGameObject()
Notifies all listeners that the selected game object has changed.
Definition: GameObjectAttributesModel.java:67
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.componentTabs
final Map< Component, GameObjectAttributesTab< G, A, R > > componentTabs
Maps tab's component to tab.
Definition: GameObjectAttributesControl.java:187
net.sf.gridarta.gui
Graphical User Interface of Gridarta.
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.gameObjectAttributesDialogFactory
final GameObjectAttributesDialogFactory< G, A, R > gameObjectAttributesDialogFactory
The MainControl to use, e.g.
Definition: GameObjectAttributesControl.java:90
net.sf.gridarta.model.mapmodel.SavedSquares
Records a set of changed map squares.
Definition: SavedSquares.java:41
arch
arch
Definition: ArchetypeTypeSetParserTest-ignoreDefinedAttribute1-result.txt:5
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.selectedGameObject
G selectedGameObject
The currently selected game object.
Definition: GameObjectAttributesControl.java:193
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControlListener
Interface for listeners interested in GameObjectAttributesControl related events.
Definition: GameObjectAttributesControlListener.java:31
net.sf.gridarta.gui.utils.Severity
Severity levels for colors of tabs.
Definition: Severity.java:29
net.sf.gridarta.gui.panel.objectchooser
Definition: DefaultObjectChooser.java:20
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.aMapArchAddInv
final Action aMapArchAddInv
Action for "add to inventory".
Definition: GameObjectAttributesControl.java:157
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.mapManagerListener
final MapManagerListener< G, A, R > mapManagerListener
The map manager listener.
Definition: GameObjectAttributesControl.java:205
net.sf.gridarta.model.gameobject
GameObjects are the objects based on Archetypes found on maps.
Definition: AbstractGameObject.java:20
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.mapTransactionListener
final MapTransactionListener< G, A, R > mapTransactionListener
The map transaction listener which is attached to {}.
Definition: GameObjectAttributesControl.java:298
net
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.mapArchAttrib
void mapArchAttrib()
Action method for displaying the attributes of the currently selected object.
Definition: GameObjectAttributesControl.java:535
errors
errors
Definition: ArchetypeTypeSetParserTest-ignoreDefaultAttribute1-result.txt:1
net.sf.gridarta.gui.panel.selectedsquare.SelectedSquareModelListener
Interface for listeners interested in events of SelectedSquareModel instances.
Definition: SelectedSquareModelListener.java:34
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.addTabInt
void addTabInt(final GameObjectAttributesTab< G, A, R > tab)
Adds a tab which is not shown in the tab panel.
Definition: GameObjectAttributesControl.java:449
net.sf.gridarta.model.mapmodel.MapModel.removeMapModelListener
void removeMapModelListener(@NotNull MapModelListener< G, A, R > listener)
Unregister a map listener.
net.sf.gridarta.model.maparchobject.MapArchObject
Interface for MapArchObjects.
Definition: MapArchObject.java:40
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.autoApplyArchPanelChanges
void autoApplyArchPanelChanges()
Same as applyArchPanelChanges() but does protect against recursive calls.
Definition: GameObjectAttributesControl.java:606
net.sf.gridarta.model.mapmodel.MapModel.removeGameObject
void removeGameObject(@NotNull G gameObject, boolean join)
Delete an existing GameObject from the map.
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesModel< G, A, R >
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.mapArchAddEnv
void mapArchAddEnv()
Action method for adding the currently selected object to the inventory of a new object.
Definition: GameObjectAttributesControl.java:576
net.sf.gridarta.gui.panel.selectedsquare.SelectedSquareModel
The model component of the selected square control.
Definition: SelectedSquareModel.java:35
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.aMapArchAttribute
final Action aMapArchAttribute
Action for "edit attributes".
Definition: GameObjectAttributesControl.java:169
net.sf.gridarta.model.mapmodel.MapModel.removeMapTransactionListener
void removeMapTransactionListener(@NotNull MapTransactionListener< G, A, R > listener)
Unregisters a map transaction listener.
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.objectChooser
final ObjectChooser< G, A, R > objectChooser
The object chooser instance.
Definition: GameObjectAttributesControl.java:96
net.sf.gridarta.model.validation.ErrorCollector
An interface for classes that collect errors.
Definition: ErrorCollector.java:33
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.selectedSquareModelListener
final SelectedSquareModelListener< G, A, R > selectedSquareModelListener
The listener to detect changes of the selected game object.
Definition: GameObjectAttributesControl.java:327
net.sf.gridarta.gui.panel.objectchooser.ObjectChooser.getSelection
BaseObject< G, A, R, ?> getSelection()
Returns the active arch in the left-side panel.
net.sf.gridarta.model.validation
This package contains the framework for validating maps.
Definition: AbstractValidator.java:20
net.sf.gridarta.utils.ActionBuilderUtils.getString
static String getString(@NotNull final ActionBuilder actionBuilder, @NotNull final String key, @NotNull final String defaultValue)
Returns the value of a key.
Definition: ActionBuilderUtils.java:71
net.sf.gridarta.model.baseobject.BaseObject
Definition: BaseObject.java:34
net.sf.gridarta.gui.dialog.gameobjectattributes
Definition: ArchetypeTypeListCellRenderer.java:20
net.sf.gridarta.gui.dialog
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.aMapArchAddEnv
final Action aMapArchAddEnv
Action for "add to environment".
Definition: GameObjectAttributesControl.java:163
net.sf.gridarta.gui.panel.selectedsquare.SelectedSquareModel.setSelectedGameObject
void setSelectedGameObject(@Nullable final G gameObject)
Sets the currently selected GameObject.
Definition: SelectedSquareModel.java:156
net.sf.gridarta.model.mapmodel.MapFile
The location of a map file with a map directory.
Definition: MapFile.java:31
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.removeGameObjectAttributesControlListener
void removeGameObjectAttributesControlListener(@NotNull final GameObjectAttributesControlListener listener)
Removes a GameObjectAttributesControlListener to notify.
Definition: GameObjectAttributesControl.java:430
net.sf.gridarta.gui.panel.objectchooser.ObjectChooser
Common base interface for ObjectChoosers.
Definition: ObjectChooser.java:34
net.sf.gridarta.model.mapmodel.MapModel.addMapTransactionListener
void addMapTransactionListener(@NotNull MapTransactionListener< G, A, R > listener)
Registers a map transaction listener.
net.sf.gridarta.model.mapmodel.MapSquare.getMapModel
MapModel< G, A, R > getMapModel()
Returns the MapModel this map square is part of.
Definition: MapSquare.java:99
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.getSelectedTab
GameObjectAttributesTab< G, A, R > getSelectedTab()
Returns the selected tab.
Definition: GameObjectAttributesControl.java:472
net.sf.gridarta.gui.dialog.gameobjectattributes.GameObjectAttributesDialogFactory
A factory that creates dialogs for editing game object attributes.
Definition: GameObjectAttributesDialogFactory.java:54
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesTabListener< G, A, R >
net.sf.gridarta.model.mapmodel.MapModelListener
Interface for listeners listening on MapModel events.
Definition: MapModelListener.java:36
net.sf.gridarta.gui.panel.selectedsquare.SelectedSquareModel.addSelectedSquareListener
void addSelectedSquareListener(@NotNull final SelectedSquareModelListener< G, A, R > listener)
Adds a SelectedSquareModelListener to be notified.
Definition: SelectedSquareModel.java:79
net.sf.gridarta.model.gameobject.GameObject.getMapSquareOptional
MapSquare< G, A, R > getMapSquareOptional()
Returns the MapSquare this game object is part of.
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesModel.addGameObjectAttributesModelListener
void addGameObjectAttributesModelListener(@NotNull final GameObjectAttributesModelListener< G, A, R > listener)
Adds a listener to be notified.
Definition: GameObjectAttributesModel.java:86
net.sf.gridarta.model.gameobject.GameObject.addLast
void addLast(@NotNull G gameObject)
Add the given GameObject at the end of this Container.
net.sf.gridarta.model
net.sf.gridarta.model.archetype.Archetype
Reflects an Archetype.
Definition: Archetype.java:41
net.sf.gridarta.gui.utils.Severity.getLevel
int getLevel()
Returns the severity level.
Definition: Severity.java:80
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.gameObjectAttributesTabListener
final GameObjectAttributesTabListener< G, A, R > gameObjectAttributesTabListener
The listener attached to all tabs.
Definition: GameObjectAttributesControl.java:360
net.sf.gridarta.model.baseobject
Definition: AbstractBaseObject.java:20
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.selectedSquareModel
final SelectedSquareModel< G, A, R > selectedSquareModel
The SelectedSquareModel to update.
Definition: GameObjectAttributesControl.java:102
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.refreshDisplay
void refreshDisplay()
Update the displayed information for the selected game object.
Definition: GameObjectAttributesControl.java:523
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.gameObjectAttributesModel
final GameObjectAttributesModel< G, A, R > gameObjectAttributesModel
The model used by this controller.
Definition: GameObjectAttributesControl.java:127
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.panelDesktop
final JTabbedPane panelDesktop
The main panel.
Definition: GameObjectAttributesControl.java:121
net.sf.gridarta.model.mapcontrol.MapControl
Currently nothing more than a marker interface for unification.
Definition: MapControl.java:35
net.sf.gridarta.model.gameobject.GameObject.getMapSquare
MapSquare< G, A, R > getMapSquare()
Returns the MapSquare this game object is part of.
net.sf.gridarta.utils.ActionBuilderUtils
Utility class for ActionBuilder related functions.
Definition: ActionBuilderUtils.java:31
net.sf.gridarta.model.mapcontrol.MapControl.getMapModel
MapModel< G, A, R > getMapModel()
Returns the map model.
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesModelListener< G, A, R >
net.sf.gridarta.model.maparchobject
Definition: AbstractMapArchObject.java:20
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.ACTION_BUILDER
static final ActionBuilder ACTION_BUILDER
Action Builder.
Definition: GameObjectAttributesControl.java:84
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.addGameObjectAttributesControlListener
void addGameObjectAttributesControlListener(@NotNull final GameObjectAttributesControlListener listener)
Adds a GameObjectAttributesControlListener to notify.
Definition: GameObjectAttributesControl.java:422
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.selectTab
void selectTab(@NotNull final GameObjectAttributesTab< G, A, R > tab)
Selects a tab.
Definition: GameObjectAttributesControl.java:459
net.sf.gridarta.gui.utils
Definition: AnimationComponent.java:20
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesTab.getPanel
JPanel getPanel()
Creates the contents panel.
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.mapArchAddInv
void mapArchAddInv()
Action method for adding an object to the inventory of the currently selected object.
Definition: GameObjectAttributesControl.java:546
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesModel.getSelectedGameObject
G getSelectedGameObject()
Returns the selected game object.
Definition: GameObjectAttributesModel.java:78
net.sf.gridarta.gui.panel.selectedsquare
Displays the contents of the currently selected map square.
Definition: CellRenderer.java:20
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.setTabSeverity
void setTabSeverity(@NotNull final GameObjectAttributesTab< G, A, R > tab, @NotNull final Severity tabSeverity)
Sets the tab color of a tab.
Definition: GameObjectAttributesControl.java:484
net.sf.gridarta.gui.utils.Severity.DEFAULT
DEFAULT
The tab contents are unchanged from defaults.
Definition: Severity.java:34
net.sf.gridarta.utils.Size2D
The class Size2D represents a 2d rectangular area.
Definition: Size2D.java:30
net.sf.gridarta.model.mapmodel.MapSquare.getMapSquare
MapSquare< G, A, R > getMapSquare()
Returns the MapSquare this game object is part of.
Definition: MapSquare.java:150
net.sf.gridarta.utils
Definition: ActionBuilderUtils.java:20
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.currentMapControl
MapControl< G, A, R > currentMapControl
Last known active map.
Definition: GameObjectAttributesControl.java:140
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.tabIndex
final Map< GameObjectAttributesTab< G, A, R >, Integer > tabIndex
Maps tab to tab index.
Definition: GameObjectAttributesControl.java:181
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.isInAutoApplyArchPanelChanges
boolean isInAutoApplyArchPanelChanges
Whether autoApplyArchPanelChanges() is currently running.
Definition: GameObjectAttributesControl.java:145
net.sf.gridarta.model.gameobject.GameObjectFactory.createInventory
void createInventory(@NotNull GameObject< G, A, R > gameObject, @NotNull Iterable< G > archetype)
Copies inventory objects from an archetype into a game object.
net.sf.gridarta.gui.panel.gameobjectattributes.GameObjectAttributesControl.gameObjectFactory
final GameObjectFactory< G, A, R > gameObjectFactory
The GameObjectFactory for creating new GameObjects.
Definition: GameObjectAttributesControl.java:109