Go to the documentation of this file.
20 package net.sf.gridarta.gui.mapdesktop;
22 import java.awt.Component;
23 import java.beans.PropertyVetoException;
24 import java.util.IdentityHashMap;
25 import java.util.Iterator;
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;
73 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
148 public void mapCreated(@NotNull
final MapControl<G, A, R> mapControl,
final boolean interactive) {
197 while (
it.hasNext()) {
211 public 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) {
237 final JInternalFrame internalFrame = mapView.getInternalFrame();
238 if (internalFrame.isIcon()) {
240 internalFrame.setIcon(
false);
241 }
catch (
final PropertyVetoException e) {
248 internalFrame.requestFocus();
249 internalFrame.restoreSubcomponentFocus();
257 final JInternalFrame internalFrame = mapView.getInternalFrame();
264 internalFrame.setSelected(
false);
265 }
catch (
final PropertyVetoException ignored) {
268 internalFrame.setClosed(
true);
269 }
catch (
final PropertyVetoException ignored) {
272 internalFrame.dispose();
288 final JInternalFrame internalFrame = mapView.getInternalFrame();
289 final MapViewFrameListener mapViewFrameListener =
new MapViewFrameListener(mapView);
293 internalFrame.addInternalFrameListener(mapViewFrameListener);
297 internalFrame.setVisible(
true);
300 internalFrame.setMaximum(
true);
301 }
catch (
final PropertyVetoException e) {
302 LOG.error(
"PropertyVetoException: " + e);
313 assert windowAction !=
null;
315 mapView.getInternalFrame().setFrameIcon(icon);
316 windowAction.putValue(Action.SMALL_ICON, icon);
327 assert windowAction !=
null;
329 menu.add(windowAction);
339 final JInternalFrame internalFrame = mapView.getInternalFrame();
340 internalFrame.moveToFront();
342 internalFrame.setSelected(
true);
343 }
catch (
final PropertyVetoException ignored) {
375 final JInternalFrame internalFrame = mapView.getInternalFrame();
376 if (internalFrame.isIcon()) {
377 if (!careAboutIconification) {
379 internalFrame.setIcon(
false);
380 }
catch (
final PropertyVetoException e) {
459 public void setAction(@NotNull
final Action action, @NotNull
final String
name) {
460 if (
name.equals(
"prevWindow")) {
462 }
else if (
name.equals(
"nextWindow")) {
465 throw new IllegalArgumentException(
"unsupported action name: " +
name);
void internalFrameActivated(@NotNull final InternalFrameEvent e)
void setActiveMapView(@NotNull final MapView< G, A, R > mapView)
MapViewFrameListener(@NotNull final MapView< G, A, R > mapView)
void mapViewFocusLostNotify(@NotNull final MapView< G, A, R > mapView)
final JDesktopPane desktopPane
void addMapImageCacheListener(@NotNull final MapImageCacheListener< G, A, R > listener)
void internalFrameOpened(@NotNull final InternalFrameEvent e)
void addMapManagerListener(@NotNull MapManagerListener< G, A, R > listener)
void internalFrameClosed(@NotNull final InternalFrameEvent e)
void removeMapView(@NotNull final MapView< G, A, R > mapView)
boolean doNextWindow(final boolean performAction)
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
Iterator< MapView< G, A, R > > getMapViewIterator(@NotNull final MapControl< G, A, R > mapControl)
void mapViewFocusGainedNotify(@NotNull final MapView< G, A, R > mapView)
void updateFrameIcon(@NotNull final MapView< G, A, R > mapView)
void closeMapView(@NotNull final MapView< G, A, R > mapView)
void addMapViewsListener(@NotNull final MapControl< G, A, R > mapControl, @NotNull final MapViewsListener< G, A, R > listener)
boolean doPrevWindow(final boolean performAction)
void internalFrameClosing(@NotNull final InternalFrameEvent e)
final void setIndex(final int index)
final MapImageCache< G, A, R > mapImageCache
void removeMapView(@NotNull final MapView< G, A, R > mapView)
void addWindowAction(@NotNull final JMenu menu, @NotNull final MapView< G, A, R > mapView, final int index)
void setCurrentMapView(@NotNull final MapView< G, A, R > mapView)
void internalFrameDeiconified(@NotNull final InternalFrameEvent e)
final Map< MapView< G, A, R >, MapViewFrameListener > mapViewFrameListeners
void internalFrameDeactivated(@NotNull final InternalFrameEvent e)
void setAction(@NotNull final Action action, @NotNull final String name)
void addMapView(@NotNull final MapView< G, A, R > mapView)
final MapManagerListener< G, A, R > mapManagerListener
final MapViewsManager< G, A, R > mapViewsManager
final MapImageCacheListener< G, A, R > mapImageCacheListener
void deactivateMapView(@NotNull final MapView< G, A, R > mapView)
void setCurrentMap(@Nullable MapControl< G, A, R > mapControl)
static final Category LOG
static final ActionBuilder ACTION_BUILDER
final Map< MapView< G, A, R >, WindowAction< G, A, R > > windowActions
void updateFocus(final boolean careAboutIconification)
void activateMapView(@NotNull final MapView< G, A, R > mapView)
final MapViewsListener< G, A, R > mapViewsListener
boolean doPrevWindow(final boolean performAction)
final MapView< G, A, R > mapView
Image getOrCreateIcon(@NotNull final File mapFile)
final MapViewManager< G, A, R > mapViewManager
void addMapView(@NotNull final MapView< G, A, R > mapView)
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)
final MapManager< G, A, R > mapManager
void removeMapViewsListener(@NotNull final MapControl< G, A, R > mapControl, @NotNull final MapViewsListener< G, A, R > listener)
boolean doNextWindow(final boolean performAction)
void internalFrameIconified(@NotNull final InternalFrameEvent e)
void setFocus(@NotNull final MapView< G, A, R > mapView)
void activateAndRaiseMapView(@NotNull final MapView< G, A, R > mapView)
static final long serialVersionUID