Gridarta Editor
MapDesktop.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.mapdesktop;
21 
22 import java.awt.Component;
23 import java.beans.PropertyVetoException;
24 import java.util.IdentityHashMap;
25 import java.util.Iterator;
26 import java.util.Map;
27 import javax.swing.Action;
28 import javax.swing.Icon;
29 import javax.swing.ImageIcon;
30 import javax.swing.JDesktopPane;
31 import javax.swing.JInternalFrame;
32 import javax.swing.JMenu;
33 import javax.swing.event.InternalFrameEvent;
34 import javax.swing.event.InternalFrameListener;
48 import net.sf.japi.swing.action.ActionBuilder;
49 import net.sf.japi.swing.action.ActionBuilderFactory;
50 import net.sf.japi.swing.action.ActionMethod;
51 import org.apache.log4j.Category;
52 import org.apache.log4j.Logger;
53 import org.jetbrains.annotations.NotNull;
54 import org.jetbrains.annotations.Nullable;
55 
61 public class MapDesktop<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction {
62 
66  @NotNull
67  private static final Category LOG = Logger.getLogger(MapDesktop.class);
68 
72  @NotNull
73  private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta");
74 
78  private static final long serialVersionUID = 1L;
79 
83  @NotNull
85 
89  @NotNull
91 
95  @NotNull
97 
101  @NotNull
103 
107  @NotNull
108  private final JDesktopPane desktopPane = new JDesktopPane();
109 
113  @Nullable
114  private Action aPrevWindow;
115 
119  @Nullable
120  private Action aNextWindow;
121 
125  @NotNull
126  private final Map<MapView<G, A, R>, WindowAction<G, A, R>> windowActions = new IdentityHashMap<>();
127 
133  @NotNull
134  private final Map<MapView<G, A, R>, MapViewFrameListener> mapViewFrameListeners = new IdentityHashMap<>();
135 
139  @NotNull
141 
142  @Override
143  public void currentMapChanged(@Nullable final MapControl<G, A, R> mapControl) {
144  // ignore
145  }
146 
147  @Override
148  public void mapCreated(@NotNull final MapControl<G, A, R> mapControl, final boolean interactive) {
150  }
151 
152  @Override
153  public void mapClosing(@NotNull final MapControl<G, A, R> mapControl) {
154  // ignore
155  }
156 
157  @Override
158  public void mapClosed(@NotNull final MapControl<G, A, R> mapControl) {
160  }
161 
162  };
163 
168  @NotNull
170 
171  @Override
172  public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) {
173  addMapView(mapView);
174  }
175 
176  @Override
177  public void mapViewRaise(@NotNull final MapView<G, A, R> mapView) {
178  setCurrentMapView(mapView);
179  }
180 
181  @Override
182  public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) {
183  removeMapView(mapView);
184  }
185 
186  };
187 
191  @NotNull
193 
194  @Override
195  public void iconChanged(@NotNull final MapControl<G, A, R> mapControl) {
196  final Iterator<MapView<G, A, R>> it = mapViewsManager.getMapViewIterator(mapControl);
197  while (it.hasNext()) {
198  updateFrameIcon(it.next());
199  }
200  }
201 
202  };
203 
212  this.mapViewManager = mapViewManager;
213  this.mapManager = mapManager;
214  this.mapImageCache = mapImageCache;
215  this.mapViewsManager = mapViewsManager;
218  updateFocus(false);
219  }
220 
225  @NotNull
226  public Component getComponent() {
227  return desktopPane;
228  }
229 
234  public void setCurrentMapView(@NotNull final MapView<G, A, R> mapView) {
236  // De-iconify if necessary
237  final JInternalFrame internalFrame = mapView.getInternalFrame();
238  if (internalFrame.isIcon()) {
239  try {
240  internalFrame.setIcon(false);
241  } catch (final PropertyVetoException e) {
242  LOG.warn(ACTION_BUILDER.format("logUnexpectedException", e));
243  }
244  mapView.activate();
245  return;
246  }
247  updateFocus(true);
248  internalFrame.requestFocus();
249  internalFrame.restoreSubcomponentFocus();
250  }
251 
256  private void removeMapView(@NotNull final MapView<G, A, R> mapView) {
257  final JInternalFrame internalFrame = mapView.getInternalFrame();
258  internalFrame.removeInternalFrameListener(mapViewFrameListeners.remove(mapView));
259  mapViewManager.removeMapView(mapView);
260  if (windowActions.remove(mapView) == null) {
261  assert false;
262  }
263  try {
264  internalFrame.setSelected(false);
265  } catch (final PropertyVetoException ignored) {
266  }
267  try {
268  internalFrame.setClosed(true);
269  } catch (final PropertyVetoException ignored) {
270  }
271  desktopPane.remove(internalFrame);
272  internalFrame.dispose();
273  desktopPane.repaint();
274 
275  updateFocus(true);
276  refreshMenus();
277  }
278 
283  private void addMapView(@NotNull final MapView<G, A, R> mapView) {
284  final WindowAction<G, A, R> windowAction = new WindowAction<>(this, mapView, mapManager);
285  windowActions.put(mapView, windowAction);
286  updateFrameIcon(mapView);
287 
288  final JInternalFrame internalFrame = mapView.getInternalFrame();
289  final MapViewFrameListener mapViewFrameListener = new MapViewFrameListener(mapView);
290  if (mapViewFrameListeners.put(mapView, mapViewFrameListener) != null) {
291  assert false;
292  }
293  internalFrame.addInternalFrameListener(mapViewFrameListener);
294  desktopPane.add(internalFrame);
295  mapViewManager.addMapView(mapView);
296  setCurrentMapView(mapView);
297  internalFrame.setVisible(true);
298  internalFrame.setBounds(0, 0, desktopPane.getWidth(), desktopPane.getHeight());
299  try {
300  internalFrame.setMaximum(true);
301  } catch (final PropertyVetoException e) {
302  LOG.error("PropertyVetoException: " + e);
303  }
304  refreshMenus();
305  }
306 
311  private void updateFrameIcon(@NotNull final MapView<G, A, R> mapView) {
312  final Action windowAction = windowActions.get(mapView);
313  assert windowAction != null;
314  final Icon icon = new ImageIcon(mapImageCache.getOrCreateIcon(mapView.getMapControl()));
315  mapView.getInternalFrame().setFrameIcon(icon);
316  windowAction.putValue(Action.SMALL_ICON, icon);
317  }
318 
325  public void addWindowAction(@NotNull final JMenu menu, @NotNull final MapView<G, A, R> mapView, final int index) {
326  final WindowAction<G, A, R> windowAction = windowActions.get(mapView);
327  assert windowAction != null;
328  windowAction.setIndex(index);
329  menu.add(windowAction);
330  }
331 
336  private void activateAndRaiseMapView(@NotNull final MapView<G, A, R> mapView) {
337  mapManager.setCurrentMap(mapView.getMapControl());
338  mapView.activate();
339  final JInternalFrame internalFrame = mapView.getInternalFrame();
340  internalFrame.moveToFront();
341  try {
342  internalFrame.setSelected(true);
343  } catch (final PropertyVetoException ignored) {
344  }
345  }
346 
352  private void mapViewFocusLostNotify(@NotNull final MapView<G, A, R> mapView) {
354  updateFocus(true);
355  }
356 
361  private void mapViewFocusGainedNotify(@NotNull final MapView<G, A, R> mapView) {
363  mapViewsManager.setFocus(mapView);
364  mapManager.setCurrentMap(mapView.getMapControl());
365  }
366 
372  private void updateFocus(final boolean careAboutIconification) {
373  // Show the next map (if such exists)
374  for (final MapView<G, A, R> mapView : mapViewManager) {
375  final JInternalFrame internalFrame = mapView.getInternalFrame();
376  if (internalFrame.isIcon()) {
377  if (!careAboutIconification) {
378  try {
379  internalFrame.setIcon(false);
380  } catch (final PropertyVetoException e) {
381  LOG.warn(ACTION_BUILDER.format("logUnexpectedException", e));
382  }
383  activateAndRaiseMapView(mapView);
384  return;
385  }
386  } else {
387  activateAndRaiseMapView(mapView);
388  return;
389  }
390  }
391 
392  // No non-iconified map windows found
394  }
395 
399  @ActionMethod
400  public void prevWindow() {
401  doPrevWindow(true);
402  }
403 
407  @ActionMethod
408  public void nextWindow() {
409  doNextWindow(true);
410  }
411 
415  private void refreshMenus() {
416  if (aPrevWindow != null) {
417  aPrevWindow.setEnabled(doPrevWindow(false));
418  }
419  if (aNextWindow != null) {
420  aNextWindow.setEnabled(doNextWindow(false));
421  }
422  }
423 
429  private boolean doPrevWindow(final boolean performAction) {
430  if (!mapViewManager.doPrevWindow(performAction)) {
431  return false;
432  }
433 
434  if (performAction) {
435  updateFocus(false);
436  }
437 
438  return true;
439  }
440 
446  private boolean doNextWindow(final boolean performAction) {
447  if (!mapViewManager.doNextWindow(performAction)) {
448  return false;
449  }
450 
451  if (performAction) {
452  updateFocus(false);
453  }
454 
455  return true;
456  }
457 
458  @Override
459  public void setAction(@NotNull final Action action, @NotNull final String name) {
460  if (name.equals("prevWindow")) {
461  aPrevWindow = action;
462  } else if (name.equals("nextWindow")) {
463  aNextWindow = action;
464  } else {
465  throw new IllegalArgumentException("unsupported action name: " + name);
466  }
467  refreshMenus();
468  }
469 
473  private class MapViewFrameListener implements InternalFrameListener {
474 
478  @NotNull
479  private final MapView<G, A, R> mapView;
480 
486  this.mapView = mapView;
487  }
488 
489  @Override
490  public void internalFrameActivated(@NotNull final InternalFrameEvent e) {
491  // ignore
492  }
493 
494  @Override
495  public void internalFrameClosed(@NotNull final InternalFrameEvent e) {
496  // ignore
497  }
498 
499  @Override
500  public void internalFrameClosing(@NotNull final InternalFrameEvent e) {
502  }
503 
504  @Override
505  public void internalFrameDeactivated(@NotNull final InternalFrameEvent e) {
506  // ignore
507  }
508 
509  @Override
510  public void internalFrameDeiconified(@NotNull final InternalFrameEvent e) {
512  }
513 
514  @Override
515  public void internalFrameIconified(@NotNull final InternalFrameEvent e) {
517  }
518 
519  @Override
520  public void internalFrameOpened(@NotNull final InternalFrameEvent e) {
521  // ignore
522  }
523 
524  }
525 
526 }
net.sf.gridarta.gui.mapimagecache
Definition: ImageType.java:20
net.sf.gridarta.gui.mapdesktop.MapDesktop.MapViewFrameListener.internalFrameActivated
void internalFrameActivated(@NotNull final InternalFrameEvent e)
Definition: MapDesktop.java:490
name
name
Definition: ArchetypeTypeSetParserTest-ignoreDefaultAttribute1-result.txt:2
net.sf.gridarta.model.mapmanager
Definition: AbstractMapManager.java:20
net.sf.gridarta.gui.map.mapview.MapViewManager.deactivateMapView
void deactivateMapView(@NotNull final MapView< G, A, R > mapView)
Deactivates a map view.
Definition: MapViewManager.java:105
net.sf.gridarta.gui.mapdesktop.MapDesktop.mapViewsManager
final MapViewsManager< G, A, R > mapViewsManager
The MapViewsManager.
Definition: MapDesktop.java:102
net.sf.gridarta.gui.mapdesktop.MapDesktop.serialVersionUID
static final long serialVersionUID
The serial version UID.
Definition: MapDesktop.java:78
net.sf.gridarta.gui.mapdesktop.MapDesktop.mapManagerListener
final MapManagerListener< G, A, R > mapManagerListener
The MapManagerListener attached to mapManager.
Definition: MapDesktop.java:140
net.sf.gridarta.model.mapmanager.MapManager
A MapManager manages all opened maps.
Definition: MapManager.java:37
net.sf.gridarta.gui.mapdesktop.MapDesktop.desktopPane
final JDesktopPane desktopPane
The JDesktopPane that contains all map views.
Definition: MapDesktop.java:108
net.sf.gridarta
Base package of all Gridarta classes.
net.sf.gridarta.gui.map.mapview.MapViewManager
Maintains all map views.
Definition: MapViewManager.java:38
net.sf
net.sf.gridarta.gui.map.mapview.MapViewsManager.getMapViewIterator
Iterator< MapView< G, A, R > > getMapViewIterator(@NotNull final MapControl< G, A, R > mapControl)
Returns an Iterator returning all MapViews of a MapControl.
Definition: MapViewsManager.java:256
net.sf.gridarta.model.mapmanager.MapManagerListener
Interface for listeners listening to MapManager changes.
Definition: MapManagerListener.java:42
net.sf.gridarta.gui.mapdesktop.MapDesktop.ACTION_BUILDER
static final ActionBuilder ACTION_BUILDER
The action builder.
Definition: MapDesktop.java:73
net.sf.gridarta.gui.map.mapview.MapViewManager.doNextWindow
boolean doNextWindow(final boolean performAction)
Executes the "next window" action.
Definition: MapViewManager.java:203
net.sf.gridarta.gui.map.mapview.MapViewsManager.removeMapViewsListener
void removeMapViewsListener(@NotNull final MapControl< G, A, R > mapControl, @NotNull final MapViewsListener< G, A, R > listener)
Removes a MapViewsListener to be notified of events.
Definition: MapViewsManager.java:198
net.sf.gridarta.gui.mapdesktop.MapDesktop.updateFocus
void updateFocus(final boolean careAboutIconification)
Updates the focus to the first non-iconified map window.
Definition: MapDesktop.java:372
net.sf.gridarta.model.mapmanager.MapManager.addMapManagerListener
void addMapManagerListener(@NotNull MapManagerListener< G, A, R > listener)
Adds a MapManagerListener to be notified.
net.sf.gridarta.gui.mapdesktop.MapDesktop.doNextWindow
boolean doNextWindow(final boolean performAction)
Performs or checks availability of the "next window" action.
Definition: MapDesktop.java:446
net.sf.gridarta.gui.mapdesktop.MapDesktop.mapManager
final MapManager< G, A, R > mapManager
The MapManager to use.
Definition: MapDesktop.java:90
net.sf.gridarta.gui.mapdesktop.MapDesktop.MapViewFrameListener.mapView
final MapView< G, A, R > mapView
The associated MapView.
Definition: MapDesktop.java:479
net.sf.gridarta.model.archetype
Definition: AbstractArchetype.java:20
net.sf.gridarta.model.gameobject.GameObject
Reflects a game object (object on a map).
Definition: GameObject.java:36
net.sf.gridarta.gui.mapdesktop.MapDesktop.MapViewFrameListener
The listener attached to map views.
Definition: MapDesktop.java:473
net.sf.gridarta.gui.mapdesktop.WindowAction.setIndex
final void setIndex(final int index)
Sets the index of this action so this Action knows what Mnemonic and Accelerator to use.
Definition: WindowAction.java:163
net.sf.gridarta.model.mapcontrol
Definition: DefaultMapControl.java:20
net.sf.gridarta.gui.mapdesktop.WindowAction
Action class for selecting this window.
Definition: WindowAction.java:45
net.sf.gridarta.gui.mapdesktop.MapDesktop.MapViewFrameListener.internalFrameIconified
void internalFrameIconified(@NotNull final InternalFrameEvent e)
Definition: MapDesktop.java:515
net.sf.gridarta.gui.mapdesktop.MapDesktop.mapImageCacheListener
final MapImageCacheListener< G, A, R > mapImageCacheListener
The MapImageCacheListener registered to mapImageCache.
Definition: MapDesktop.java:192
net.sf.gridarta.gui.mapdesktop.MapDesktop.setCurrentMapView
void setCurrentMapView(@NotNull final MapView< G, A, R > mapView)
Sets the given level view as the current one.
Definition: MapDesktop.java:234
net.sf.gridarta.gui
Graphical User Interface of Gridarta.
net.sf.gridarta.gui.map.mapview.MapViewManager.addMapView
void addMapView(@NotNull final MapView< G, A, R > mapView)
Adds a map view.
Definition: MapViewManager.java:92
net.sf.gridarta.gui.mapdesktop.MapDesktop.MapViewFrameListener.internalFrameDeiconified
void internalFrameDeiconified(@NotNull final InternalFrameEvent e)
Definition: MapDesktop.java:510
net.sf.gridarta.gui.mapimagecache.MapImageCache
Caches icon and preview images for map files.
Definition: MapImageCache.java:53
net.sf.gridarta.gui.mapdesktop.MapDesktop.doPrevWindow
boolean doPrevWindow(final boolean performAction)
Performs or checks availability of the "prev window" action.
Definition: MapDesktop.java:429
net.sf.gridarta.model.gameobject
GameObjects are the objects based on Archetypes found on maps.
Definition: AbstractGameObject.java:20
net
net.sf.gridarta.gui.mapimagecache.MapImageCache.getOrCreateIcon
Image getOrCreateIcon(@NotNull final File mapFile)
Returns an icon Image for a given map file.
Definition: MapImageCache.java:192
net.sf.gridarta.gui.mapdesktop.MapDesktop.mapViewFocusGainedNotify
void mapViewFocusGainedNotify(@NotNull final MapView< G, A, R > mapView)
Notifies that the given map view is now set as the current one.
Definition: MapDesktop.java:361
net.sf.gridarta.gui.map.mapview.MapViewsManager.closeMapView
void closeMapView(@NotNull final MapView< G, A, R > mapView)
Invoked when the user wants to close a map view.
Definition: MapViewsManager.java:308
net.sf.gridarta.gui.mapdesktop.MapDesktop.mapViewManager
final MapViewManager< G, A, R > mapViewManager
All open map views.
Definition: MapDesktop.java:84
net.sf.gridarta.gui.mapdesktop.MapDesktop.MapViewFrameListener.internalFrameClosing
void internalFrameClosing(@NotNull final InternalFrameEvent e)
Definition: MapDesktop.java:500
net.sf.gridarta.gui.mapdesktop.MapDesktop.LOG
static final Category LOG
The Logger for printing log messages.
Definition: MapDesktop.java:67
net.sf.gridarta.gui.mapdesktop.MapDesktop.updateFrameIcon
void updateFrameIcon(@NotNull final MapView< G, A, R > mapView)
Updates the frame icon to the current icon image.
Definition: MapDesktop.java:311
net.sf.gridarta.model.maparchobject.MapArchObject
Interface for MapArchObjects.
Definition: MapArchObject.java:40
net.sf.gridarta.gui.mapdesktop.MapDesktop.MapDesktop
MapDesktop(@NotNull final MapViewManager< G, A, R > mapViewManager, @NotNull final MapManager< G, A, R > mapManager, @NotNull final MapImageCache< G, A, R > mapImageCache, @NotNull final MapViewsManager< G, A, R > mapViewsManager)
Creates a new instance.
Definition: MapDesktop.java:211
net.sf.gridarta.gui.map.mapview
Definition: AbstractMapView.java:20
net.sf.gridarta.gui.mapimagecache.MapImageCacheListener
Interface for listeners interested in MapImageCache related events.
Definition: MapImageCacheListener.java:33
net.sf.gridarta.gui.map.mapview.MapView
A map view consists of a map grid and a map cursor, and is attached to a map control.
Definition: MapView.java:43
net.sf.gridarta.gui.mapdesktop.MapDesktop.addWindowAction
void addWindowAction(@NotNull final JMenu menu, @NotNull final MapView< G, A, R > mapView, final int index)
Adds an action for selecting this window to a menu.
Definition: MapDesktop.java:325
net.sf.gridarta.gui.mapdesktop.MapDesktop.MapViewFrameListener.internalFrameOpened
void internalFrameOpened(@NotNull final InternalFrameEvent e)
Definition: MapDesktop.java:520
net.sf.gridarta.gui.mapimagecache.MapImageCache.addMapImageCacheListener
void addMapImageCacheListener(@NotNull final MapImageCacheListener< G, A, R > listener)
Adds a MapImageCacheListener to be notified.
Definition: MapImageCache.java:319
net.sf.gridarta.gui.map.mapview.MapViewsListener
Interface for listeners interested in MapViewsManager related events.
Definition: MapViewsListener.java:33
net.sf.gridarta.gui.mapdesktop.MapDesktop.mapViewsListener
final MapViewsListener< G, A, R > mapViewsListener
The MapViewsListener attached to all existing MapControls for maps.
Definition: MapDesktop.java:169
net.sf.gridarta.gui.mapdesktop.MapDesktop.mapViewFrameListeners
final Map< MapView< G, A, R >, MapViewFrameListener > mapViewFrameListeners
The MapViewFrameListeners associated with MapViews.
Definition: MapDesktop.java:134
net.sf.gridarta.gui.mapdesktop.MapDesktop.activateAndRaiseMapView
void activateAndRaiseMapView(@NotNull final MapView< G, A, R > mapView)
Activates and raises the given map view.
Definition: MapDesktop.java:336
net.sf.gridarta.gui.mapdesktop.MapDesktop.windowActions
final Map< MapView< G, A, R >, WindowAction< G, A, R > > windowActions
The actions to select windows.
Definition: MapDesktop.java:126
net.sf.gridarta.gui.map.mapview.MapViewManager.setActiveMapView
void setActiveMapView(@NotNull final MapView< G, A, R > mapView)
Sets the active map view.
Definition: MapViewManager.java:63
net.sf.gridarta.gui.map.mapview.MapViewsManager.addMapViewsListener
void addMapViewsListener(@NotNull final MapControl< G, A, R > mapControl, @NotNull final MapViewsListener< G, A, R > listener)
Adds a MapViewsListener to be notified of events.
Definition: MapViewsManager.java:189
net.sf.gridarta.gui.mapdesktop.MapDesktop.mapImageCache
final MapImageCache< G, A, R > mapImageCache
The MapImageCache to use.
Definition: MapDesktop.java:96
net.sf.gridarta.gui.mapdesktop.MapDesktop.aPrevWindow
Action aPrevWindow
The action for "prev window".
Definition: MapDesktop.java:114
net.sf.gridarta.model
net.sf.gridarta.model.archetype.Archetype
Reflects an Archetype.
Definition: Archetype.java:41
net.sf.gridarta.gui.mapdesktop.MapDesktop
The JDesktopPane containing all map views.
Definition: MapDesktop.java:61
net.sf.gridarta.gui.map
Base classes for rendering maps.
Definition: AbstractPerMapDialogManager.java:20
net.sf.gridarta.gui.mapdesktop.MapDesktop.nextWindow
void nextWindow()
Gives focus to the previous window.
Definition: MapDesktop.java:408
net.sf.gridarta.gui.mapdesktop.MapDesktop.removeMapView
void removeMapView(@NotNull final MapView< G, A, R > mapView)
Removes (closes) the map view.
Definition: MapDesktop.java:256
net.sf.gridarta.gui.map.mapview.MapViewManager.doPrevWindow
boolean doPrevWindow(final boolean performAction)
Executes the "prev window" action.
Definition: MapViewManager.java:183
net.sf.gridarta.gui.mapdesktop.MapDesktop.getComponent
Component getComponent()
Returns the Component that shows all map views.
Definition: MapDesktop.java:226
net.sf.gridarta.model.mapcontrol.MapControl
Currently nothing more than a marker interface for unification.
Definition: MapControl.java:35
net.sf.gridarta.gui.mapdesktop.MapDesktop.aNextWindow
Action aNextWindow
The action for "next window".
Definition: MapDesktop.java:120
net.sf.gridarta.gui.map.mapview.MapViewManager.activateMapView
void activateMapView(@NotNull final MapView< G, A, R > mapView)
Activates a map view.
Definition: MapViewManager.java:120
net.sf.gridarta.model.maparchobject
Definition: AbstractMapArchObject.java:20
net.sf.gridarta.gui.mapdesktop.MapDesktop.MapViewFrameListener.internalFrameClosed
void internalFrameClosed(@NotNull final InternalFrameEvent e)
Definition: MapDesktop.java:495
net.sf.gridarta.gui.mapdesktop.MapDesktop.MapViewFrameListener.internalFrameDeactivated
void internalFrameDeactivated(@NotNull final InternalFrameEvent e)
Definition: MapDesktop.java:505
net.sf.gridarta.utils.EditorAction
A global editor action.
Definition: EditorAction.java:29
net.sf.gridarta.gui.mapdesktop.MapDesktop.mapViewFocusLostNotify
void mapViewFocusLostNotify(@NotNull final MapView< G, A, R > mapView)
Notifies that the map views focus is lost it is inserted as the second in line to the map view vector...
Definition: MapDesktop.java:352
net.sf.gridarta.gui.map.mapview.MapViewsManager.setFocus
void setFocus(@NotNull final MapView< G, A, R > mapView)
Sets a MapView as the main view.
Definition: MapViewsManager.java:246
net.sf.gridarta.model.mapmanager.MapManager.setCurrentMap
void setCurrentMap(@Nullable MapControl< G, A, R > mapControl)
Sets the given map as the current one.
net.sf.gridarta.gui.mapdesktop.MapDesktop.refreshMenus
void refreshMenus()
Enables/disables the actions according to the current state.
Definition: MapDesktop.java:415
net.sf.gridarta.gui.map.mapview.MapViewsManager
Stores all existing MapViews.
Definition: MapViewsManager.java:47
net.sf.gridarta.utils
Definition: ActionBuilderUtils.java:20
net.sf.gridarta.gui.mapdesktop.MapDesktop.setAction
void setAction(@NotNull final Action action, @NotNull final String name)
Sets the Action instance for this editor action.
Definition: MapDesktop.java:459
net.sf.gridarta.gui.mapdesktop.MapDesktop.prevWindow
void prevWindow()
Gives focus to the next window.
Definition: MapDesktop.java:400
net.sf.gridarta.gui.map.mapview.MapViewManager.removeMapView
void removeMapView(@NotNull final MapView< G, A, R > mapView)
Removes a map view.
Definition: MapViewManager.java:75
it
This document describes some hints and requirements for general development on the CrossfireEditor If you plan to make changes to the editor code or setup please read the following and keep it in derived from a basic editor application called Gridder by Pasi Ker�nen so please communicate with best through the cf devel mailing before considering any fundamental changes About code DO NOT USE TABS No matter what Java development platform you are please configure insert indent Tabs are displayed totally different in every editor and there are millions of different editors out there The insertion of tabs in the source code is messing up the syntax formatting in a way that is UNREPAIRABLE Apart from please keep code indentation accurate This is not just good it helps to keep code readable and in that way dramatically decreases the chance for overlooked bugs Everyone is welcomed to correct indentation errors wherever they are spotted Before you start to do this please double check that your editor is really configured to insert spaces Line feeds may be checked in either in windows or in unix linux style All reasonable text and java editors can deal with both linefeed formats Converting line feeds is but in this case please make sure that only linefeed characters are changed and nothing else is affected Due to the platform independent nature of the editor has the potential to run on almost any given operating system the build process differs greatly between systems as well as java environments In the several people have attempted to add build scripts along with structural changes to optimize the setup on one particular system environment which has led to conflict Please do *not *attempt to change the structure or any directories for the mere purpose of improving a build process or performance in a java environment Build scripts may be placed in the root it would be especially fine if it is just one or two files but the latter is not required Please excuse me for placing such restriction I and many users of the editor greatly appreciate build scripts We just had some real troubles over this issue in the past and I don t want to have them repeated the editor has relatively high performance requirements I ve spent a lot of extra work to keep everything as fast and memory efficient as possible when you add new data fields or calculations in the archetype please make sure they are as efficient as possible and worth both the time and space they consume Now don t be afraid too much No development would be possible without adding calculations and data at all Just bear in mind unlike for many other open source performance does make a difference for the CrossfireEditor The for as many systems as possible In case you are unexperienced with java and note that the graphics look different on every and with every font They also have different sizes proportions and behave different A seemingly trivial and effectless change can wreck havoc for the same GUI run on another system please don t be totally afraid of it
Definition: Developer_README.txt:76
net.sf.gridarta.gui.mapdesktop.MapDesktop.addMapView
void addMapView(@NotNull final MapView< G, A, R > mapView)
Adds the map view.
Definition: MapDesktop.java:283
net.sf.gridarta.gui.mapdesktop.MapDesktop.MapViewFrameListener.MapViewFrameListener
MapViewFrameListener(@NotNull final MapView< G, A, R > mapView)
Creates a new instance.
Definition: MapDesktop.java:485