From: <aki...@us...> - 2008-05-04 17:26:06
|
Revision: 3969 http://gridarta.svn.sourceforge.net/gridarta/?rev=3969&view=rev Author: akirschbaum Date: 2008-05-04 10:25:54 -0700 (Sun, 04 May 2008) Log Message: ----------- Move LevelRenderer.printFullImage() to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/gui/map/SimpleLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/SimpleLevelRenderer.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/map/AbstractLevelRenderer.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2008-05-04 16:57:07 UTC (rev 3968) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java 2008-05-04 17:25:54 UTC (rev 3969) @@ -31,14 +31,10 @@ import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; import java.util.Map; -import javax.imageio.ImageIO; -import javax.swing.JComponent; import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.SystemIcons; -import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.AbstractLevelRenderer; import net.sf.gridarta.gui.map.MapGrid; import net.sf.gridarta.gui.map.MapGridEvent; import net.sf.gridarta.gui.map.MapGridListener; @@ -57,7 +53,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>. * @author Andreas Kirschbaum */ -public abstract class DefaultLevelRenderer extends JComponent implements LevelRenderer { +public abstract class DefaultLevelRenderer extends AbstractLevelRenderer { /** Serial Version UID. */ private static final long serialVersionUID = 1L; @@ -496,9 +492,4 @@ forceRepaint(); } - /** {@inheritDoc} */ - public void printFullImage(final File file) throws IOException { - ImageIO.write(getFullImage(), "png", file); - } - } // class DefaultLevelRenderer Modified: trunk/crossfire/src/cfeditor/gui/map/SimpleLevelRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/SimpleLevelRenderer.java 2008-05-04 16:57:07 UTC (rev 3968) +++ trunk/crossfire/src/cfeditor/gui/map/SimpleLevelRenderer.java 2008-05-04 17:25:54 UTC (rev 3969) @@ -26,15 +26,11 @@ import java.awt.Graphics; import java.awt.Point; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import javax.imageio.ImageIO; import javax.swing.ImageIcon; -import javax.swing.JComponent; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gui.SystemIcons; -import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.AbstractLevelRenderer; import net.sf.gridarta.map.MapModel; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -44,7 +40,7 @@ * * @author Andreas Kirschbaum */ -public final class SimpleLevelRenderer extends JComponent implements LevelRenderer { +public final class SimpleLevelRenderer extends AbstractLevelRenderer { /** The serial version UID. */ private static final long serialVersionUID = 1; @@ -141,9 +137,4 @@ public void setGridVisible(final boolean gridVisible) { } - /** {@inheritDoc} */ - public void printFullImage(final File file) throws IOException { - ImageIO.write(getFullImage(), "png", file); - } - } // class SimpleLevelRenderer Modified: trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2008-05-04 16:57:07 UTC (rev 3968) +++ trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java 2008-05-04 17:25:54 UTC (rev 3969) @@ -36,15 +36,11 @@ import java.awt.Rectangle; import java.awt.event.MouseEvent; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; import java.util.Map; -import javax.imageio.ImageIO; import javax.swing.ImageIcon; -import javax.swing.JComponent; import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.SystemIcons; -import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.AbstractLevelRenderer; import net.sf.gridarta.gui.map.MapGrid; import net.sf.gridarta.gui.map.MapGridEvent; import net.sf.gridarta.gui.map.MapGridListener; @@ -61,7 +57,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a>. * @author Andreas Kirschbaum */ -public abstract class DefaultLevelRenderer extends JComponent implements LevelRenderer { +public abstract class DefaultLevelRenderer extends AbstractLevelRenderer { /** Serial Version UID. */ private static final long serialVersionUID = 1L; @@ -558,9 +554,4 @@ forceRepaint(); } - /** {@inheritDoc} */ - public void printFullImage(final File file) throws IOException { - ImageIO.write(getFullImage(), "png", file); - } - } // class DefaultLevelRenderer Modified: trunk/daimonin/src/daieditor/gui/map/SimpleLevelRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/SimpleLevelRenderer.java 2008-05-04 16:57:07 UTC (rev 3968) +++ trunk/daimonin/src/daieditor/gui/map/SimpleLevelRenderer.java 2008-05-04 17:25:54 UTC (rev 3969) @@ -30,14 +30,10 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import javax.imageio.ImageIO; import javax.swing.ImageIcon; -import javax.swing.JComponent; import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.SystemIcons; -import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.AbstractLevelRenderer; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.MapSquare; import org.jetbrains.annotations.NotNull; @@ -47,7 +43,7 @@ * The SimpleLevelRenderer renders maps without MapGrid or validation errors. * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> */ -public final class SimpleLevelRenderer extends JComponent implements LevelRenderer { +public final class SimpleLevelRenderer extends AbstractLevelRenderer { /** The serial version UID. */ private static final long serialVersionUID = 1; @@ -205,9 +201,4 @@ public void setGridVisible(final boolean gridVisible) { } - /** {@inheritDoc} */ - public void printFullImage(final File file) throws IOException { - ImageIO.write(getFullImage(), "png", file); - } - } // class SimpleLevelRenderer Added: trunk/src/app/net/sf/gridarta/gui/map/AbstractLevelRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/AbstractLevelRenderer.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/AbstractLevelRenderer.java 2008-05-04 17:25:54 UTC (rev 3969) @@ -0,0 +1,37 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.map; + +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; +import javax.swing.JComponent; + +/** + * Abstract base class for classes implementing {@link LevelRenderer}. + */ +public abstract class AbstractLevelRenderer extends JComponent implements LevelRenderer { + + /** {@inheritDoc} */ + public void printFullImage(final File file) throws IOException { + ImageIO.write(getFullImage(), "png", file); + } + +} // class AbstractLevelRenderer Property changes on: trunk/src/app/net/sf/gridarta/gui/map/AbstractLevelRenderer.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-04 17:42:20
|
Revision: 3970 http://gridarta.svn.sourceforge.net/gridarta/?rev=3970&view=rev Author: akirschbaum Date: 2008-05-04 10:32:40 -0700 (Sun, 04 May 2008) Log Message: ----------- Move MapControl.repaint() to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2008-05-04 17:25:54 UTC (rev 3969) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2008-05-04 17:32:40 UTC (rev 3970) @@ -75,13 +75,6 @@ } /** {@inheritDoc} */ - public void repaint() { - for (final MapView<GameObject, MapArchObject, Archetype, ?, ?> mapView : getMapViewFrames()) { - ((CMapViewBasic) mapView.getView()).getRenderer().forceRepaint(); - } - } - - /** {@inheritDoc} */ public MapModel<GameObject, MapArchObject, Archetype> getMapModel() { return mapModel; } Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2008-05-04 17:25:54 UTC (rev 3969) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2008-05-04 17:32:40 UTC (rev 3970) @@ -75,13 +75,6 @@ } /** {@inheritDoc} */ - public void repaint() { - for (final MapView<GameObject, MapArchObject, Archetype, ?, ?> mapView : getMapViewFrames()) { - ((CMapViewBasic) mapView.getView()).getRenderer().forceRepaint(); - } - } - - /** {@inheritDoc} */ public MapModel<GameObject, MapArchObject, Archetype> getMapModel() { return mapModel; } Modified: trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java 2008-05-04 17:25:54 UTC (rev 3969) +++ trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java 2008-05-04 17:32:40 UTC (rev 3970) @@ -570,4 +570,11 @@ } } + /** {@inheritDoc} */ + public void repaint() { + for (final MapView<?, ?, ?, ?, ?> mapView : getMapViewFrames()) { + mapView.getView().getRenderer().forceRepaint(); + } + } + } // class AbstractMapControl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-04 17:52:31
|
Revision: 3971 http://gridarta.svn.sourceforge.net/gridarta/?rev=3971&view=rev Author: akirschbaum Date: 2008-05-04 10:52:34 -0700 (Sun, 04 May 2008) Log Message: ----------- Move MApControl.mapModel to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2008-05-04 17:32:40 UTC (rev 3970) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2008-05-04 17:52:34 UTC (rev 3971) @@ -28,9 +28,6 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.map.AbstractMapControl; -import net.sf.gridarta.map.DefaultMapModel; -import net.sf.gridarta.map.MapModel; -import net.sf.gridarta.map.MapSquare; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -49,11 +46,6 @@ private final CMainControl mainControl; /** - * model (= map data of this level). - */ - private final MapModel<GameObject, MapArchObject, Archetype> mapModel; - - /** * Each view of this map will get a unique number. */ private int viewCounter = 0; @@ -67,26 +59,13 @@ * @param exitTypeGameObjectMatcher the matcher for selecting exit objects */ public MapControl(final CMainControl mainControl, final List<GameObject> objects, final MapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher) { - super(mainControl, isPickmap); + super(mainControl, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher); this.mainControl = mainControl; - // we create model (= data) - mapModel = new DefaultMapModel<GameObject, MapArchObject, Archetype>(mainControl, this, objects, mapArchObject, exitTypeGameObjectMatcher); - init(); } /** {@inheritDoc} */ - public MapModel<GameObject, MapArchObject, Archetype> getMapModel() { - return mapModel; - } - - /** {@inheritDoc} */ @NotNull @Override protected MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapView(@Nullable final Point viewPosition) { return new MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(mainControl, this, ++viewCounter, new CMapViewBasic(mainControl, this, viewPosition), ActionFactory.getFactory("cfeditor")); } - /** {@inheritDoc} */ - public Iterable<MapSquare<GameObject, MapArchObject, Archetype>> getAllSquares() { - return mapModel; - } - } // class MapControl Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2008-05-04 17:32:40 UTC (rev 3970) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2008-05-04 17:52:34 UTC (rev 3971) @@ -28,9 +28,6 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.map.AbstractMapControl; -import net.sf.gridarta.map.DefaultMapModel; -import net.sf.gridarta.map.MapModel; -import net.sf.gridarta.map.MapSquare; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -49,11 +46,6 @@ private final CMainControl mainControl; /** - * model (= map data of this level). - */ - private final MapModel<GameObject, MapArchObject, Archetype> mapModel; - - /** * Each view of this map will get a unique number. */ private int viewCounter = 0; @@ -67,26 +59,13 @@ * @param exitTypeGameObjectMatcher the matcher for selecting exit objects */ public MapControl(final CMainControl mainControl, final List<GameObject> objects, final MapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher) { - super(mainControl, isPickmap); + super(mainControl, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher); this.mainControl = mainControl; - // we create model (= data) - mapModel = new DefaultMapModel<GameObject, MapArchObject, Archetype>(mainControl, this, objects, mapArchObject, exitTypeGameObjectMatcher); - init(); } /** {@inheritDoc} */ - public MapModel<GameObject, MapArchObject, Archetype> getMapModel() { - return mapModel; - } - - /** {@inheritDoc} */ @NotNull @Override protected MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapView(@Nullable final Point viewPosition) { return new MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(mainControl, this, ++viewCounter, new CMapViewBasic(mainControl, this, viewPosition), ActionFactory.getFactory("daieditor")); } - /** {@inheritDoc} */ - public Iterable<MapSquare<GameObject, MapArchObject, Archetype>> getAllSquares() { - return mapModel; - } - } // class MapControl Modified: trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java 2008-05-04 17:32:40 UTC (rev 3970) +++ trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java 2008-05-04 17:52:34 UTC (rev 3971) @@ -33,6 +33,7 @@ import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; @@ -77,6 +78,11 @@ private final boolean isPickmap; /** + * model (= map data of this level). + */ + private final MapModel<G, A, R> mapModel; + + /** * Set if the map has changed since last save. */ private boolean modified = false; @@ -143,22 +149,17 @@ * * @param isPickmap true if this is a pickmap */ - protected AbstractMapControl(@NotNull final MainControl<G, A, R, ?, ?> mainControl, final boolean isPickmap) { + protected AbstractMapControl(@NotNull final MainControl<G, A, R, ?, ?> mainControl, final List<G> objects, final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher) { this.mainControl = mainControl; this.isPickmap = isPickmap; + // we create model (= data) + mapModel = new DefaultMapModel<G, A, R>(mainControl, this, objects, mapArchObject, exitTypeGameObjectMatcher); + mapModel.addMapModelListener(mapModelListener); } - /** - * Finish initialization. This function must be called from the constructor - * of all implementing classes. - */ - protected void init() { - getMapModel().addMapModelListener(mapModelListener); - } - /** {@inheritDoc} */ public void levelCloseNotify() { - getMapModel().removeMapModelListener(mapModelListener); + mapModel.removeMapModelListener(mapModelListener); levelClosing = true; } @@ -243,8 +244,6 @@ * @return the inserted object, or <code>null</code> if nothing was inserted */ private G insertSelArchToMap(@NotNull final Point pos, final boolean allowMany) { - final MapModel<G, A, R> mapModel = getMapModel(); - // this is the arch that would get inserted from pickmap, but it also could // be a default arch (when pickmap has no selection) final MapControl<G, A, R> activePickmap = mainControl.getObjectChooser().getPickmapChooserControl().getCurrentPickmap(); @@ -303,8 +302,6 @@ * @param pos tile-coordinates in pickmap */ private void insertMapArchToPickmap(@NotNull final Point pos) { - final MapModel<G, A, R> mapModel = getMapModel(); - final MapControl<G, A, R> currentMap = mainControl.getMapManager().getCurrentMap(); // insertion is only allowed for valid *empty* squares if (currentMap != null && isPickmap() && mapModel.isPointValid(pos) && mapModel.getMapSquare(pos).isEmpty()) { @@ -402,11 +399,11 @@ public void addEditType(final int editType) { // calculate only if needed if (!hasEditType(editType)) { - final Size2D mapSize = getMapModel().getMapSize(); + final Size2D mapSize = mapModel.getMapSize(); final Point pos = new Point(); for (pos.x = 0; pos.x < mapSize.getWidth(); pos.x++) { for (pos.y = 0; pos.y < mapSize.getHeight(); pos.y++) { - for (final G arch : getMapModel().getMapSquare(pos)) { + for (final G arch : mapModel.getMapSquare(pos)) { arch.updateEditType(editType); } } @@ -481,7 +478,7 @@ final LevelRenderer tmpLevelRenderer = levelRendererReference == null ? null : levelRendererReference.get(); final LevelRenderer levelRenderer; if (tmpLevelRenderer == null) { - levelRenderer = mainControl.getGridartaObjectsFactory().newSimpleLevelRenderer(getMapModel(), mainControl.getArchetypeSet()); + levelRenderer = mainControl.getGridartaObjectsFactory().newSimpleLevelRenderer(mapModel, mainControl.getArchetypeSet()); levelRendererReference = new SoftReference<LevelRenderer>(levelRenderer); } else { levelRenderer = tmpLevelRenderer; @@ -521,9 +518,9 @@ } assert mapFile != null; if (isModified()) { - getMapModel().getMapArchObject().updateModifiedAttribute(); + mapModel.getMapArchObject().updateModifiedAttribute(); } - if (!encodeMapFile(mapFile, getMapModel())) { + if (!encodeMapFile(mapFile, mapModel)) { return; } /* if we open a pickmap in the editor, is handled as normal map. @@ -541,7 +538,7 @@ */ public void saveAs(@NotNull final File file) { mainControl.getMainView().setStatusText("Saving the map to a file..."); - if (!encodeMapFile(file, getMapModel())) { + if (!encodeMapFile(file, mapModel)) { return; } mapFile = file; @@ -552,19 +549,19 @@ /** {@inheritDoc} */ public void addCopyToMap(final G gameObject, final Point pos, final boolean allowDouble, final boolean fillBelow) { if (gameObject.isArchetype()) { - getMapModel().addArchToMap(gameObject.getArchetypeName(), pos, allowDouble, false, fillBelow); + mapModel.addArchToMap(gameObject.getArchetypeName(), pos, allowDouble, false, fillBelow); } else { final G newGameObject = gameObject.createMultiClone(pos.x, pos.y); for (G tmp = newGameObject; tmp != null; tmp = tmp.getMultiNext()) { - if (!getMapModel().isPointValid(new Point(tmp.getMapX(), tmp.getMapY()))) { + if (!mapModel.isPointValid(new Point(tmp.getMapX(), tmp.getMapY()))) { // outside map return; } } - getMapModel().addGameObjectToMap(newGameObject, fillBelow); + mapModel.addGameObjectToMap(newGameObject, fillBelow); for (G tmp = newGameObject.getMultiNext(); tmp != null; tmp = tmp.getMultiNext()) { - getMapModel().addGameObjectToMap(tmp, fillBelow); + mapModel.addGameObjectToMap(tmp, fillBelow); mainControl.getArchetypeParser().postParseGameObject(tmp, activeEditType); } } @@ -577,4 +574,14 @@ } } + /** {@inheritDoc} */ + public MapModel<G, A, R> getMapModel() { + return mapModel; + } + + /** {@inheritDoc} */ + public Iterable<MapSquare<G, A, R>> getAllSquares() { + return mapModel; + } + } // class AbstractMapControl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-04 18:07:19
|
Revision: 3972 http://gridarta.svn.sourceforge.net/gridarta/?rev=3972&view=rev Author: akirschbaum Date: 2008-05-04 11:07:17 -0700 (Sun, 04 May 2008) Log Message: ----------- Unify menu entries. Modified Paths: -------------- trunk/crossfire/src/cfeditor/action.properties trunk/daimonin/src/daieditor/action.properties Modified: trunk/crossfire/src/cfeditor/action.properties =================================================================== --- trunk/crossfire/src/cfeditor/action.properties 2008-05-04 17:52:34 UTC (rev 3971) +++ trunk/crossfire/src/cfeditor/action.properties 2008-05-04 18:07:17 UTC (rev 3972) @@ -27,16 +27,15 @@ ######## # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view plugins window help - file.menu=createNew open recent close - save saveAs saveAll revert createImage - options - exit edit.menu=undo redo - clear cut copy paste - shift - replace fillAbove fillBelow randFillAbove randFillBelow floodfill - selectAll -map.menu=autoJoin - gridVisible enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties +map.menu=autoJoin - enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties archetypes.menu=displayObjectNames findArchetypes #pickmaps.menu: See gridarta resources.menu=collectArches - viewTreasurelists tools.menu=validateMap - gc analyze.menu= -view.menu=resetView - prevWindow nextWindow +view.menu=resetView - gridVisible - prevWindow nextWindow plugins.menu=- editPlugins - savePlugins importPlugin window.menu=closeAll help.menu=onlineHelp tod about update @@ -44,7 +43,7 @@ mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor mapwindowFile.menu=save saveAs createImage - revert - close -mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAbove fillBelow randFillAbove randFillBelow floodfill +mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAbove fillBelow randFillAbove randFillBelow floodfill - selectAll mapwindowMap.menu=gridVisible enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties mapwindowCursor.menu=moveCursor - selectTile startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes Modified: trunk/daimonin/src/daieditor/action.properties =================================================================== --- trunk/daimonin/src/daieditor/action.properties 2008-05-04 17:52:34 UTC (rev 3971) +++ trunk/daimonin/src/daieditor/action.properties 2008-05-04 18:07:17 UTC (rev 3972) @@ -47,7 +47,7 @@ mapwindowFile.menu=save saveAs createImage - revert - close mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAbove fillBelow randFillAbove randFillBelow floodfill - selectAll -mapwindowMap.menu=enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties +mapwindowMap.menu=gridVisible enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties mapwindowCursor.menu=moveCursor - selectTile startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes # Zoom This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-07 22:41:04
|
Revision: 3975 http://gridarta.svn.sourceforge.net/gridarta/?rev=3975&view=rev Author: akirschbaum Date: 2008-05-07 15:40:44 -0700 (Wed, 07 May 2008) Log Message: ----------- Move CMainView into gui package. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gui/prefs/GUIPrefs.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gui/prefs/GUIPrefs.java Added Paths: ----------- trunk/crossfire/src/cfeditor/gui/CMainView.java trunk/daimonin/src/daieditor/gui/CMainView.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/CMainView.java trunk/daimonin/src/daieditor/CMainView.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-05-07 22:23:13 UTC (rev 3974) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-05-07 22:40:44 UTC (rev 3975) @@ -28,6 +28,7 @@ import cfeditor.gameobject.face.FaceObjects; import cfeditor.gameobject.scripts.ScriptArchEditor; import cfeditor.gameobject.scripts.ScriptArchUtils; +import cfeditor.gui.CMainView; import cfeditor.gui.GameObjectAttributesDialog; import cfeditor.gui.ObjectChooser; import cfeditor.gui.prefs.GUIPrefs; Deleted: trunk/crossfire/src/cfeditor/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainView.java 2008-05-07 22:23:13 UTC (rev 3974) +++ trunk/crossfire/src/cfeditor/CMainView.java 2008-05-07 22:40:44 UTC (rev 3975) @@ -1,502 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package cfeditor; - -import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.GameObject; -import cfeditor.gui.GameObjectAttributesPanel; -import cfeditor.gui.ObjectChooser; -import cfeditor.map.MapArchObject; -import cfeditor.map.MapControl; -import java.awt.BorderLayout; -import java.awt.Rectangle; -import java.awt.Toolkit; -import java.beans.PropertyVetoException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.prefs.PreferenceChangeEvent; -import java.util.prefs.PreferenceChangeListener; -import java.util.prefs.Preferences; -import javax.swing.Action; -import javax.swing.ImageIcon; -import javax.swing.JMenu; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSplitPane; -import javax.swing.JToolBar; -import net.sf.gridarta.CFArchTypeList; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapManager; -import net.sf.gridarta.MenuHelper; -import net.sf.gridarta.gameobject.match.GameObjectMatcher; -import net.sf.gridarta.gameobject.match.GameObjectMatchers; -import net.sf.gridarta.gui.ArchetypesActions; -import net.sf.gridarta.gui.GSplitPane; -import net.sf.gridarta.gui.GUIConstants; -import net.sf.gridarta.gui.GUIUtils; -import net.sf.gridarta.gui.MainView; -import net.sf.gridarta.gui.connectionview.LockedItemsControl; -import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.map.ViewActions; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; -import net.sf.japi.swing.ActionFactory; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * The main view of the level editor. Contains the "desktop" for internal level - * windows, tile palette, menu, status- and toolbar. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public final class CMainView extends MainView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { - - /** Action Factory to create Actions. */ - private final ActionFactory actionFactory; - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** The Logger for printing log messages. */ - private static final Logger log = Logger.getLogger(CMainView.class); - - /** Preferences. */ - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - - /** The key used to store the main window state in the preferences. */ - private static final String WINDOW_STATE = "WindowState"; - - /** Default value for {@link #MAP_TILE_LIST_BOTTOM_KEY}. */ - public static final boolean MAP_TILE_LIST_BOTTOM_DEFAULT = false; - - /** The controller of this view. */ - private final CMainControl mainControl; - - /** The panel that contains the object chooser. */ - private ObjectChooser objectChooser; - - /** All open level views. */ - private final List<MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>> mapViews = Collections.synchronizedList(new ArrayList<MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>>()); - - /** Last known map view for generating change events. */ - private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> currentMapView = null; - - /** Attributes panel (bottom). */ - private GameObjectAttributesPanel gameObjectAttributesPanel; - - private final Action aViewTreasurelists; - - /** The action for "close all map windows". */ - private final Action aCloseAll; - - /** Action for "prev window". */ - private final Action aPrevWindow; - - /** Action for "next window". */ - private final Action aNextWindow; - - private final ViewActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> viewActions; - - /** The actions of the "Archetypes" menu. */ - private ArchetypesActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> archetypesActions; - - /** The toolbar. */ - private JToolBar mainToolbar = null; - - /** The listener to track preference changes. */ - private final PreferenceChangeListener preferenceChangeListener = new PreferenceChangeListener() - { - /** {@inheritDoc} */ - public void preferenceChange(final PreferenceChangeEvent evt) { - if (mainToolbar != null && evt.getKey().equals(SHOW_MAIN_TOOLBAR_KEY)) { - mainToolbar.setVisible(prefs.getBoolean(SHOW_MAIN_TOOLBAR_KEY, SHOW_MAIN_TOOLBAR_DEFAULT)); - } - } - - }; - - /** - * Constructs the main view and registers the given main controller. - * @param mainControl MainControl to attach to. - * @param objectChooser the object chooser - * @param mapManager the map manager - * @param actionFactory the action factory to use - * @param aCloseAll the action "close all map windows" - */ - CMainView(@NotNull final CMainControl mainControl, @NotNull final ObjectChooser objectChooser, @NotNull final MapManager<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll) { - super(mainControl, mapManager, actionFactory.format("mainWindow.title", CMainControl.getBuildNumberAsString())); - this.mainControl = mainControl; - this.objectChooser = objectChooser; - this.actionFactory = actionFactory; - aViewTreasurelists = actionFactory.createAction(true, "viewTreasurelists", mainControl); - this.aCloseAll = aCloseAll; - aPrevWindow = actionFactory.createAction(true, "prevWindow", this); - aNextWindow = actionFactory.createAction(true, "nextWindow", this); - - viewActions = new ViewActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(mainControl, mapManager); - - final ImageIcon icon = GUIUtils.getIcon(GUIConstants.APP_ICON); - if (icon != null) { - setIconImage(icon.getImage()); - } - - updateFocus(false); - } - - /** - * Initializes (builds) this view. - * @param lockedItemsControl the locked items control - * @param selectedSquareView the selected square view - * @param archTypeList the instance for looking up archetype types - * @param monsterMatcher the <code>GameObjectMatcher</code> for matching - * monster objects - * @param gameObjectMatchers the game object matchers - */ - void init(@NotNull final LockedItemsControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> lockedItemsControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> selectedSquareView, final CFArchTypeList archTypeList, final boolean mapTileListBottom, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final GameObjectMatchers gameObjectMatchers) { - // calculate some default values in case there is no settings file - final Rectangle screen = getGraphicsConfiguration().getBounds(); - final int defwidth = (int) (0.9 * screen.getWidth()); - final int defheight = (int) (0.9 * screen.getHeight()); - - mainToolbar = createMainToolbar(); - - final JPanel toolbarPanel = new JPanel(new BorderLayout()); - toolbarPanel.add(mainToolbar, BorderLayout.NORTH); - toolbarPanel.add(createCenterPanel(defwidth, defheight, lockedItemsControl, selectedSquareView, mapTileListBottom, monsterMatcher), BorderLayout.CENTER); - add(toolbarPanel, BorderLayout.CENTER); - - archetypesActions = new ArchetypesActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(this, objectChooser.getArchetypeChooserControl(), mainControl.getArchetypeSet(), objectChooser, archTypeList); - setJMenuBar(actionFactory.createMenuBar(true, "main")); - objectChooser.setPickmapFoldersMenu((JMenu) actionFactory.find(getJMenuBar(), "pickmapFolders")); - viewActions.init(gameObjectMatchers); - viewActions.setMenu((JMenu) actionFactory.find(getJMenuBar(), "view")); - - // set bounds (location and size) of the main frame - setBounds( - prefs.getInt(WINDOW_X, (int) (screen.getX() + (screen.getWidth() - defwidth) / 2.0)), - prefs.getInt(WINDOW_Y, (int) (screen.getY() + (screen.getHeight() - defheight) / 2.0)), - prefs.getInt(WINDOW_WIDTH, defwidth), - prefs.getInt(WINDOW_HEIGHT, defheight)); - setExtendedState(prefs.getInt(WINDOW_STATE, getExtendedState())); - - refreshMenus(); - } - - /** - * Creates the toolbar. - * @return the toolbar - */ - private JToolBar createMainToolbar() { - final JToolBar toolbar = actionFactory.createToolBar("main"); - prefs.addPreferenceChangeListener(preferenceChangeListener); - toolbar.setVisible(prefs.getBoolean(SHOW_MAIN_TOOLBAR_KEY, SHOW_MAIN_TOOLBAR_DEFAULT)); - return toolbar; - } - - /** - * Create the center panel. - * @param defwidth default width - * @param defheight default height - * @param lockedItemsControl the locked items control - * @param selectedSquareView the selected square view - * @param monsterMatcher the <code>GameObjectMatcher</code> for matching - * monster objects - * @return center panel - */ - private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final LockedItemsControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> lockedItemsControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectMatcher monsterMatcher) { - final JPanel centerPanel = new JPanel(new BorderLayout()); - - final int divLocationRight = prefs.getInt(DIVIDER_LOCATION_KEY3, (int) (defwidth * 0.62)); - final int divLocationDown = prefs.getInt(DIVIDER_LOCATION_KEY2, (int) (defheight * 0.76)); - final int divLocation = prefs.getInt(DIVIDER_LOCATION_KEY, (int) (defwidth * 0.17)); - - gameObjectAttributesPanel = new GameObjectAttributesPanel(mainControl, mapManager, this, lockedItemsControl, monsterMatcher); - - if (mapTileListBottom) { - splitRightPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, gameObjectAttributesPanel, selectedSquareView); - splitDownPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, mapDesktop, splitRightPane); - } else { - splitRightPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, mapDesktop, selectedSquareView); - splitDownPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, splitRightPane, gameObjectAttributesPanel); - } - splitRightPane.setDividerLocation(divLocationRight); - splitRightPane.setContinuousLayout(true); - splitRightPane.setResizeWeight(1); - splitDownPane.setDividerLocation(divLocationDown); - splitDownPane.setContinuousLayout(true); - splitDownPane.setResizeWeight(1); - splitPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, objectChooser, splitDownPane); - splitPane.setDividerLocation(divLocation); - splitPane.setContinuousLayout(true); - - centerPanel.add(splitPane, BorderLayout.CENTER); - return centerPanel; - } - - /** Notifies that the application is about to exit. */ - void appExitNotify() { - // Store the location and size - final Rectangle bounds = getBounds(); - prefs.putInt(WINDOW_X, bounds.x); - prefs.putInt(WINDOW_Y, bounds.y); - prefs.putInt(WINDOW_WIDTH, bounds.width); - prefs.putInt(WINDOW_HEIGHT, bounds.height); - prefs.putInt(DIVIDER_LOCATION_KEY, splitPane.getDividerLocation()); - prefs.putInt(DIVIDER_LOCATION_KEY2, splitDownPane.getDividerLocation()); - prefs.putInt(DIVIDER_LOCATION_KEY3, splitRightPane.getDividerLocation()); - prefs.putInt(WINDOW_STATE, getExtendedState()); - - objectChooser.appExitNotify(); - gameObjectAttributesPanel.appExitNotify(); - } - - /** {@inheritDoc} */ - public void addLevelView(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { - assert !mapViews.contains(mapView); - mapViews.add(0, mapView); - mapView.addInternalFrameListener(internalFrameListener); - mapDesktop.add(mapView); - mapManager.fireMapViewCreatedEvent(mapView); - setCurrentLevelView(mapView); - mapView.setVisible(true); - mapView.setBounds(0, 0, mapDesktop.getWidth(), mapDesktop.getHeight()); - try { - mapView.setMaximum(true); - } catch (final PropertyVetoException e) { - System.err.println(e); - } - refreshMenus(); - } - - /** {@inheritDoc} */ - public void removeLevelView(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { - assert mapViews.contains(mapView); - if (!mapViews.contains(mapView)) { - return; - } - - mapView.removeInternalFrameListener(internalFrameListener); - mapViews.remove(mapView); - generateCurrentMapViewChangedEvent(); - mapManager.fireMapViewClosingEvent(mapView); - mapDesktop.remove(mapView); - // This is important: Removing a JInternalFrame from a JDesktopPane doesn't deselect it. - // Thus it will still be referenced. To prevent a closed map from being referenced by Swing, - // we check whether it's selected and if so deselect it. - if (mapDesktop.getSelectedFrame() == mapView) { - mapDesktop.setSelectedFrame(null); - } - mapView.dispose(); - mapDesktop.repaint(); - - updateFocus(true); - refreshMenus(); - } - - /** - * {@inheritDoc} - * This implementation displays the exception in a modal message dialog. - */ - public void handleThrowable(final Throwable t) { - Toolkit.getDefaultToolkit().beep(); - JOptionPane.showMessageDialog(this, t.getMessage(), "Error", JOptionPane.WARNING_MESSAGE); - } - - /** - * Updates the focus to the first non-iconified level window. - * @param fCareAboutIconification True if the focus update should ignore - * all windows iconified by the user. - */ - private void updateFocus(final boolean fCareAboutIconification) { - // Show the next level (if such exists) - for (final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView : mapViews) { - if (mapView.isIcon()) { - if (!fCareAboutIconification) { - try { - mapView.setIcon(false); - } catch (final PropertyVetoException e) { - log.warn(actionFactory.format("logUnexpectedException", e)); - } - activateAndRaiseMapView(mapView); - return; - } - } else { - activateAndRaiseMapView(mapView); - return; - } - } - - // No non-iconified level windows found - mapManager.setCurrentLevel(null); - } - - /** Gives focus to the next window. */ - public void prevWindow() { - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = getFrameForPrevWindow(); - if (mapView == null) { - return; - } - - // XXX I might work I might not work, use AWT/Swing focus traversal - mapViews.remove(mapView); - mapViews.add(mapView); - generateCurrentMapViewChangedEvent(); - updateFocus(false); - } - - /** Gives focus to the previous window. */ - public void nextWindow() { - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = getFrameForNextWindow(); - if (mapView == null) { - return; - } - - // XXX I might work I might not work, use AWT/Swing focus traversal - mapViews.remove(mapView); - mapViews.add(0, mapView); - generateCurrentMapViewChangedEvent(); - updateFocus(false); - } - - /** {@inheritDoc} */ - public void setCurrentLevelView(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { - assert mapViews.contains(mapView); - mapViews.remove(mapView); - mapViews.add(0, mapView); - generateCurrentMapViewChangedEvent(); - - // Deiconify if necessary - if (mapView.isIcon()) { - try { - mapView.setIcon(false); - } catch (final PropertyVetoException e) { - log.warn(actionFactory.format("logUnexpectedException", e)); - } - activateMapView(mapView); - return; - } - updateFocus(true); - mapView.requestFocus(); - mapView.restoreSubcomponentFocus(); - } - - /** {@inheritDoc} */ - protected void levelViewFocusLostNotify(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { - assert mapViews.contains(mapView); - if (mapViews.size() <= 1) { - return; - } - - mapViews.remove(mapView); - mapViews.add(mapView); - generateCurrentMapViewChangedEvent(); - updateFocus(true); - } - - /** {@inheritDoc} */ - protected void levelViewFocusGainedNotify(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { - assert mapViews.contains(mapView); - mapViews.remove(mapView); - mapViews.add(0, mapView); - generateCurrentMapViewChangedEvent(); - final MapControl level = mapView.getMapControl(); - level.setFocus(mapView); - mapManager.setCurrentLevel(level); - //statusBar.setLevelInfo(level); - } - - /** - * Rebuild the window menu. - */ - private void rebuildWindowMenu() { - final JMenu menuWindow = (JMenu) actionFactory.find(getJMenuBar(), "window"); - MenuHelper.removeAll(menuWindow); - menuWindow.add(aCloseAll); - if (!mapViews.isEmpty()) { - menuWindow.addSeparator(); - } - int index = 0; - for (final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> frame : mapViews) { - frame.addWindowAction(menuWindow, index++); - } - } - - /** {@inheritDoc} */ - @NotNull public GameObjectAttributesPanel getGameObjectAttributesPanel() { - return gameObjectAttributesPanel; - } - - /** - * Returns the current top map view we are working with. - * @return the current top map view we are working with, or - * <code>null</code> if no map is open - */ - @Nullable public MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getCurrentMapView() { - return !mapViews.isEmpty() ? mapViews.get(0) : null; - } - - /** - * Check if the current map view has changed; if it has changed fire an - * event. - */ - private void generateCurrentMapViewChangedEvent() { - rebuildWindowMenu(); - - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newCurrentMapView = getCurrentMapView(); - if (currentMapView == newCurrentMapView) { - return; - } - - currentMapView = newCurrentMapView; - mapManager.fireCurrentMapViewChangedEvent(currentMapView); - } - - /** - * Determine whether "prev window" should be enabled. - * - * @return the map view to activate, or <code>null</code> if "prev window" - * should be disabled - */ - @Nullable private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getFrameForPrevWindow() { - return mapViews.size() > 1 ? mapViews.get(0) : null; - } - - /** - * Determine whether "next window" should be enabled. - * - * @return the map view to activate, or <code>null</code> if "next window" - * should be disabled - */ - @Nullable private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getFrameForNextWindow() { - return mapViews.size() > 1 ? mapViews.get(mapViews.size() - 1) : null; - } - - /** - * Enabled/disable the menu entries according to the current state. - */ - private void refreshMenus() { - aPrevWindow.setEnabled(getFrameForPrevWindow() != null); - aNextWindow.setEnabled(getFrameForNextWindow() != null); - } - -} // class CMainView Copied: trunk/crossfire/src/cfeditor/gui/CMainView.java (from rev 3963, trunk/crossfire/src/cfeditor/CMainView.java) =================================================================== --- trunk/crossfire/src/cfeditor/gui/CMainView.java (rev 0) +++ trunk/crossfire/src/cfeditor/gui/CMainView.java 2008-05-07 22:40:44 UTC (rev 3975) @@ -0,0 +1,502 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package cfeditor.gui; + +import cfeditor.CMainControl; +import cfeditor.CMapViewBasic; +import cfeditor.gameobject.Archetype; +import cfeditor.gameobject.GameObject; +import cfeditor.map.MapArchObject; +import cfeditor.map.MapControl; +import java.awt.BorderLayout; +import java.awt.Rectangle; +import java.awt.Toolkit; +import java.beans.PropertyVetoException; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.prefs.PreferenceChangeEvent; +import java.util.prefs.PreferenceChangeListener; +import java.util.prefs.Preferences; +import javax.swing.Action; +import javax.swing.ImageIcon; +import javax.swing.JMenu; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.JToolBar; +import net.sf.gridarta.CFArchTypeList; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; +import net.sf.gridarta.MenuHelper; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; +import net.sf.gridarta.gameobject.match.GameObjectMatchers; +import net.sf.gridarta.gui.ArchetypesActions; +import net.sf.gridarta.gui.GSplitPane; +import net.sf.gridarta.gui.GUIConstants; +import net.sf.gridarta.gui.GUIUtils; +import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.gui.connectionview.LockedItemsControl; +import net.sf.gridarta.gui.map.MapView; +import net.sf.gridarta.gui.map.ViewActions; +import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; +import net.sf.japi.swing.ActionFactory; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * The main view of the level editor. Contains the "desktop" for internal level + * windows, tile palette, menu, status- and toolbar. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public final class CMainView extends MainView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { + + /** Action Factory to create Actions. */ + private final ActionFactory actionFactory; + + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + + /** The Logger for printing log messages. */ + private static final Logger log = Logger.getLogger(CMainView.class); + + /** Preferences. */ + private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + + /** The key used to store the main window state in the preferences. */ + private static final String WINDOW_STATE = "WindowState"; + + /** Default value for {@link #MAP_TILE_LIST_BOTTOM_KEY}. */ + public static final boolean MAP_TILE_LIST_BOTTOM_DEFAULT = false; + + /** The controller of this view. */ + private final CMainControl mainControl; + + /** The panel that contains the object chooser. */ + private ObjectChooser objectChooser; + + /** All open level views. */ + private final List<MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>> mapViews = Collections.synchronizedList(new ArrayList<MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>>()); + + /** Last known map view for generating change events. */ + private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> currentMapView = null; + + /** Attributes panel (bottom). */ + private GameObjectAttributesPanel gameObjectAttributesPanel; + + private final Action aViewTreasurelists; + + /** The action for "close all map windows". */ + private final Action aCloseAll; + + /** Action for "prev window". */ + private final Action aPrevWindow; + + /** Action for "next window". */ + private final Action aNextWindow; + + private final ViewActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> viewActions; + + /** The actions of the "Archetypes" menu. */ + private ArchetypesActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> archetypesActions; + + /** The toolbar. */ + private JToolBar mainToolbar = null; + + /** The listener to track preference changes. */ + private final PreferenceChangeListener preferenceChangeListener = new PreferenceChangeListener() + { + /** {@inheritDoc} */ + public void preferenceChange(final PreferenceChangeEvent evt) { + if (mainToolbar != null && evt.getKey().equals(SHOW_MAIN_TOOLBAR_KEY)) { + mainToolbar.setVisible(prefs.getBoolean(SHOW_MAIN_TOOLBAR_KEY, SHOW_MAIN_TOOLBAR_DEFAULT)); + } + } + + }; + + /** + * Constructs the main view and registers the given main controller. + * @param mainControl MainControl to attach to. + * @param objectChooser the object chooser + * @param mapManager the map manager + * @param actionFactory the action factory to use + * @param aCloseAll the action "close all map windows" + */ + public CMainView(@NotNull final CMainControl mainControl, @NotNull final ObjectChooser objectChooser, @NotNull final MapManager<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll) { + super(mainControl, mapManager, actionFactory.format("mainWindow.title", CMainControl.getBuildNumberAsString())); + this.mainControl = mainControl; + this.objectChooser = objectChooser; + this.actionFactory = actionFactory; + aViewTreasurelists = actionFactory.createAction(true, "viewTreasurelists", mainControl); + this.aCloseAll = aCloseAll; + aPrevWindow = actionFactory.createAction(true, "prevWindow", this); + aNextWindow = actionFactory.createAction(true, "nextWindow", this); + + viewActions = new ViewActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(mainControl, mapManager); + + final ImageIcon icon = GUIUtils.getIcon(GUIConstants.APP_ICON); + if (icon != null) { + setIconImage(icon.getImage()); + } + + updateFocus(false); + } + + /** + * Initializes (builds) this view. + * @param lockedItemsControl the locked items control + * @param selectedSquareView the selected square view + * @param archTypeList the instance for looking up archetype types + * @param monsterMatcher the <code>GameObjectMatcher</code> for matching + * monster objects + * @param gameObjectMatchers the game object matchers + */ + public void init(@NotNull final LockedItemsControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> lockedItemsControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> selectedSquareView, final CFArchTypeList archTypeList, final boolean mapTileListBottom, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final GameObjectMatchers gameObjectMatchers) { + // calculate some default values in case there is no settings file + final Rectangle screen = getGraphicsConfiguration().getBounds(); + final int defwidth = (int) (0.9 * screen.getWidth()); + final int defheight = (int) (0.9 * screen.getHeight()); + + mainToolbar = createMainToolbar(); + + final JPanel toolbarPanel = new JPanel(new BorderLayout()); + toolbarPanel.add(mainToolbar, BorderLayout.NORTH); + toolbarPanel.add(createCenterPanel(defwidth, defheight, lockedItemsControl, selectedSquareView, mapTileListBottom, monsterMatcher), BorderLayout.CENTER); + add(toolbarPanel, BorderLayout.CENTER); + + archetypesActions = new ArchetypesActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(this, objectChooser.getArchetypeChooserControl(), mainControl.getArchetypeSet(), objectChooser, archTypeList); + setJMenuBar(actionFactory.createMenuBar(true, "main")); + objectChooser.setPickmapFoldersMenu((JMenu) actionFactory.find(getJMenuBar(), "pickmapFolders")); + viewActions.init(gameObjectMatchers); + viewActions.setMenu((JMenu) actionFactory.find(getJMenuBar(), "view")); + + // set bounds (location and size) of the main frame + setBounds( + prefs.getInt(WINDOW_X, (int) (screen.getX() + (screen.getWidth() - defwidth) / 2.0)), + prefs.getInt(WINDOW_Y, (int) (screen.getY() + (screen.getHeight() - defheight) / 2.0)), + prefs.getInt(WINDOW_WIDTH, defwidth), + prefs.getInt(WINDOW_HEIGHT, defheight)); + setExtendedState(prefs.getInt(WINDOW_STATE, getExtendedState())); + + refreshMenus(); + } + + /** + * Creates the toolbar. + * @return the toolbar + */ + private JToolBar createMainToolbar() { + final JToolBar toolbar = actionFactory.createToolBar("main"); + prefs.addPreferenceChangeListener(preferenceChangeListener); + toolbar.setVisible(prefs.getBoolean(SHOW_MAIN_TOOLBAR_KEY, SHOW_MAIN_TOOLBAR_DEFAULT)); + return toolbar; + } + + /** + * Create the center panel. + * @param defwidth default width + * @param defheight default height + * @param lockedItemsControl the locked items control + * @param selectedSquareView the selected square view + * @param monsterMatcher the <code>GameObjectMatcher</code> for matching + * monster objects + * @return center panel + */ + private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final LockedItemsControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> lockedItemsControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectMatcher monsterMatcher) { + final JPanel centerPanel = new JPanel(new BorderLayout()); + + final int divLocationRight = prefs.getInt(DIVIDER_LOCATION_KEY3, (int) (defwidth * 0.62)); + final int divLocationDown = prefs.getInt(DIVIDER_LOCATION_KEY2, (int) (defheight * 0.76)); + final int divLocation = prefs.getInt(DIVIDER_LOCATION_KEY, (int) (defwidth * 0.17)); + + gameObjectAttributesPanel = new GameObjectAttributesPanel(mainControl, mapManager, this, lockedItemsControl, monsterMatcher); + + if (mapTileListBottom) { + splitRightPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, gameObjectAttributesPanel, selectedSquareView); + splitDownPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, mapDesktop, splitRightPane); + } else { + splitRightPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, mapDesktop, selectedSquareView); + splitDownPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, splitRightPane, gameObjectAttributesPanel); + } + splitRightPane.setDividerLocation(divLocationRight); + splitRightPane.setContinuousLayout(true); + splitRightPane.setResizeWeight(1); + splitDownPane.setDividerLocation(divLocationDown); + splitDownPane.setContinuousLayout(true); + splitDownPane.setResizeWeight(1); + splitPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, objectChooser, splitDownPane); + splitPane.setDividerLocation(divLocation); + splitPane.setContinuousLayout(true); + + centerPanel.add(splitPane, BorderLayout.CENTER); + return centerPanel; + } + + /** Notifies that the application is about to exit. */ + public void appExitNotify() { + // Store the location and size + final Rectangle bounds = getBounds(); + prefs.putInt(WINDOW_X, bounds.x); + prefs.putInt(WINDOW_Y, bounds.y); + prefs.putInt(WINDOW_WIDTH, bounds.width); + prefs.putInt(WINDOW_HEIGHT, bounds.height); + prefs.putInt(DIVIDER_LOCATION_KEY, splitPane.getDividerLocation()); + prefs.putInt(DIVIDER_LOCATION_KEY2, splitDownPane.getDividerLocation()); + prefs.putInt(DIVIDER_LOCATION_KEY3, splitRightPane.getDividerLocation()); + prefs.putInt(WINDOW_STATE, getExtendedState()); + + objectChooser.appExitNotify(); + gameObjectAttributesPanel.appExitNotify(); + } + + /** {@inheritDoc} */ + public void addLevelView(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { + assert !mapViews.contains(mapView); + mapViews.add(0, mapView); + mapView.addInternalFrameListener(internalFrameListener); + mapDesktop.add(mapView); + mapManager.fireMapViewCreatedEvent(mapView); + setCurrentLevelView(mapView); + mapView.setVisible(true); + mapView.setBounds(0, 0, mapDesktop.getWidth(), mapDesktop.getHeight()); + try { + mapView.setMaximum(true); + } catch (final PropertyVetoException e) { + System.err.println(e); + } + refreshMenus(); + } + + /** {@inheritDoc} */ + public void removeLevelView(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { + assert mapViews.contains(mapView); + if (!mapViews.contains(mapView)) { + return; + } + + mapView.removeInternalFrameListener(internalFrameListener); + mapViews.remove(mapView); + generateCurrentMapViewChangedEvent(); + mapManager.fireMapViewClosingEvent(mapView); + mapDesktop.remove(mapView); + // This is important: Removing a JInternalFrame from a JDesktopPane doesn't deselect it. + // Thus it will still be referenced. To prevent a closed map from being referenced by Swing, + // we check whether it's selected and if so deselect it. + if (mapDesktop.getSelectedFrame() == mapView) { + mapDesktop.setSelectedFrame(null); + } + mapView.dispose(); + mapDesktop.repaint(); + + updateFocus(true); + refreshMenus(); + } + + /** + * {@inheritDoc} + * This implementation displays the exception in a modal message dialog. + */ + public void handleThrowable(final Throwable t) { + Toolkit.getDefaultToolkit().beep(); + JOptionPane.showMessageDialog(this, t.getMessage(), "Error", JOptionPane.WARNING_MESSAGE); + } + + /** + * Updates the focus to the first non-iconified level window. + * @param fCareAboutIconification True if the focus update should ignore + * all windows iconified by the user. + */ + private void updateFocus(final boolean fCareAboutIconification) { + // Show the next level (if such exists) + for (final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView : mapViews) { + if (mapView.isIcon()) { + if (!fCareAboutIconification) { + try { + mapView.setIcon(false); + } catch (final PropertyVetoException e) { + log.warn(actionFactory.format("logUnexpectedException", e)); + } + activateAndRaiseMapView(mapView); + return; + } + } else { + activateAndRaiseMapView(mapView); + return; + } + } + + // No non-iconified level windows found + mapManager.setCurrentLevel(null); + } + + /** Gives focus to the next window. */ + public void prevWindow() { + final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = getFrameForPrevWindow(); + if (mapView == null) { + return; + } + + // XXX I might work I might not work, use AWT/Swing focus traversal + mapViews.remove(mapView); + mapViews.add(mapView); + generateCurrentMapViewChangedEvent(); + updateFocus(false); + } + + /** Gives focus to the previous window. */ + public void nextWindow() { + final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = getFrameForNextWindow(); + if (mapView == null) { + return; + } + + // XXX I might work I might not work, use AWT/Swing focus traversal + mapViews.remove(mapView); + mapViews.add(0, mapView); + generateCurrentMapViewChangedEvent(); + updateFocus(false); + } + + /** {@inheritDoc} */ + public void setCurrentLevelView(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { + assert mapViews.contains(mapView); + mapViews.remove(mapView); + mapViews.add(0, mapView); + generateCurrentMapViewChangedEvent(); + + // Deiconify if necessary + if (mapView.isIcon()) { + try { + mapView.setIcon(false); + } catch (final PropertyVetoException e) { + log.warn(actionFactory.format("logUnexpectedException", e)); + } + activateMapView(mapView); + return; + } + updateFocus(true); + mapView.requestFocus(); + mapView.restoreSubcomponentFocus(); + } + + /** {@inheritDoc} */ + protected void levelViewFocusLostNotify(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { + assert mapViews.contains(mapView); + if (mapViews.size() <= 1) { + return; + } + + mapViews.remove(mapView); + mapViews.add(mapView); + generateCurrentMapViewChangedEvent(); + updateFocus(true); + } + + /** {@inheritDoc} */ + protected void levelViewFocusGainedNotify(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { + assert mapViews.contains(mapView); + mapViews.remove(mapView); + mapViews.add(0, mapView); + generateCurrentMapViewChangedEvent(); + final MapControl level = mapView.getMapControl(); + level.setFocus(mapView); + mapManager.setCurrentLevel(level); + //statusBar.setLevelInfo(level); + } + + /** + * Rebuild the window menu. + */ + private void rebuildWindowMenu() { + final JMenu menuWindow = (JMenu) actionFactory.find(getJMenuBar(), "window"); + MenuHelper.removeAll(menuWindow); + menuWindow.add(aCloseAll); + if (!mapViews.isEmpty()) { + menuWindow.addSeparator(); + } + int index = 0; + for (final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> frame : mapViews) { + frame.addWindowAction(menuWindow, index++); + } + } + + /** {@inheritDoc} */ + @NotNull public GameObjectAttributesPanel getGameObjectAttributesPanel() { + return gameObjectAttributesPanel; + } + + /** + * Returns the current top map view we are working with. + * @return the current top map view we are working with, or + * <code>null</code> if no map is open + */ + @Nullable public MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getCurrentMapView() { + return !mapViews.isEmpty() ? mapViews.get(0) : null; + } + + /** + * Check if the current map view has changed; if it has changed fire an + * event. + */ + private void generateCurrentMapViewChangedEvent() { + rebuildWindowMenu(); + + final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newCurrentMapView = getCurrentMapView(); + if (currentMapView == newCurrentMapView) { + return; + } + + currentMapView = newCurrentMapView; + mapManager.fireCurrentMapViewChangedEvent(currentMapView); + } + + /** + * Determine whether "prev window" should be enabled. + * + * @return the map view to activate, or <code>null</code> if "prev window" + * should be disabled + */ + @Nullable private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getFrameForPrevWindow() { + return mapViews.size() > 1 ? mapViews.get(0) : null; + } + + /** + * Determine whether "next window" should be enabled. + * + * @return the map view to activate, or <code>null</code> if "next window" + * should be disabled + */ + @Nullable private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getFrameForNextWindow() { + return mapViews.size() > 1 ? mapViews.get(mapViews.size() - 1) : null; + } + + /** + * Enabled/disable the menu entries according to the current state. + */ + private void refreshMenus() { + aPrevWindow.setEnabled(getFrameForPrevWindow() != null); + aNextWindow.setEnabled(getFrameForNextWindow() != null); + } + +} // class CMainView Property changes on: trunk/crossfire/src/cfeditor/gui/CMainView.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/crossfire/src/cfeditor/gui/prefs/GUIPrefs.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/GUIPrefs.java 2008-05-07 22:23:13 UTC (rev 3974) +++ trunk/crossfire/src/cfeditor/gui/prefs/GUIPrefs.java 2008-05-07 22:40:44 UTC (rev 3975) @@ -19,7 +19,7 @@ package cfeditor.gui.prefs; -import cfeditor.CMainView; +import cfeditor.gui.CMainView; import java.awt.Component; import java.util.Arrays; import java.util.Locale; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-05-07 22:23:13 UTC (rev 3974) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-05-07 22:40:44 UTC (rev 3975) @@ -26,6 +26,7 @@ import daieditor.gameobject.anim.AnimationObjects; import daieditor.gameobject.face.FaceObjects; import daieditor.gameobject.scripts.ScriptArchEditor; +import daieditor.gui.CMainView; import daieditor.gui.GameObjectAttributesDialog; import daieditor.gui.ObjectChooser; import daieditor.gui.map.DefaultLevelRenderer; Deleted: trunk/daimonin/src/daieditor/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/CMainView.java 2008-05-07 22:23:13 UTC (rev 3974) +++ trunk/daimonin/src/daieditor/CMainView.java 2008-05-07 22:40:44 UTC (rev 3975) @@ -1,502 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package daieditor; - -import daieditor.gameobject.Archetype; -import daieditor.gameobject.GameObject; -import daieditor.gui.GameObjectAttributesPanel; -import daieditor.gui.ObjectChooser; -import daieditor.map.MapArchObject; -import daieditor.map.MapControl; -import java.awt.BorderLayout; -import java.awt.Rectangle; -import java.awt.Toolkit; -import java.beans.PropertyVetoException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.prefs.PreferenceChangeEvent; -import java.util.prefs.PreferenceChangeListener; -import java.util.prefs.Preferences; -import javax.swing.Action; -import javax.swing.ImageIcon; -import javax.swing.JMenu; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JSplitPane; -import javax.swing.JToolBar; -import net.sf.gridarta.CFArchTypeList; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapManager; -import net.sf.gridarta.MenuHelper; -import net.sf.gridarta.gameobject.match.GameObjectMatcher; -import net.sf.gridarta.gameobject.match.GameObjectMatchers; -import net.sf.gridarta.gui.ArchetypesActions; -import net.sf.gridarta.gui.GSplitPane; -import net.sf.gridarta.gui.GUIConstants; -import net.sf.gridarta.gui.GUIUtils; -import net.sf.gridarta.gui.MainView; -import net.sf.gridarta.gui.connectionview.LockedItemsControl; -import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.map.ViewActions; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; -import net.sf.japi.swing.ActionFactory; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * The main view of the level editor. Contains the "desktop" for internal level - * windows, tile palette, menu, status- and toolbar. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public final class CMainView extends MainView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { - - /** Action Factory to create Actions. */ - private final ActionFactory actionFactory; - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** The Logger for printing log messages. */ - private static final Logger log = Logger.getLogger(CMainView.class); - - /** Preferences. */ - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - - /** The key used to store the main window state in the preferences. */ - private static final String WINDOW_STATE = "WindowState"; - - /** Default value for {@link #MAP_TILE_LIST_BOTTOM_KEY}. */ - public static final boolean MAP_TILE_LIST_BOTTOM_DEFAULT = false; - - /** The controller of this view. */ - private final CMainControl mainControl; - - /** The panel that contains the object chooser. */ - private ObjectChooser objectChooser; - - /** All open level views. */ - private final List<MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>> mapViews = Collections.synchronizedList(new ArrayList<MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>>()); - - /** Last known map view for generating change events. */ - private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> currentMapView = null; - - /** Attributes panel (bottom). */ - private GameObjectAttributesPanel gameObjectAttributesPanel; - - private final Action aViewTreasurelists; - - /** The action for "close all map windows". */ - private final Action aCloseAll; - - /** Action for "prev window". */ - private final Action aPrevWindow; - - /** Action for "next window". */ - private final Action aNextWindow; - - private final ViewActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> viewActions; - - /** The actions of the "Archetypes" menu. */ - private ArchetypesActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> archetypesActions; - - /** The toolbar. */ - private JToolBar mainToolbar = null; - - /** The listener to track preference changes. */ - private final PreferenceChangeListener preferenceChangeListener = new PreferenceChangeListener() - { - /** {@inheritDoc} */ - public void preferenceChange(final PreferenceChangeEvent evt) { - if (mainToolbar != null && evt.getKey().equals(SHOW_MAIN_TOOLBAR_KEY)) { - mainToolbar.setVisible(prefs.getBoolean(SHOW_MAIN_TOOLBAR_KEY, SHOW_MAIN_TOOLBAR_DEFAULT)); - } - } - - }; - - /** - * Constructs the main view and registers the given main controller. - * @param mainControl MainControl to attach to. - * @param objectChooser the object chooser - * @param mapManager the map manager - * @param actionFactory the action factory to use - * @param aCloseAll the action "close all map windows" - */ - CMainView(@NotNull final CMainControl mainControl, @NotNull final ObjectChooser objectChooser, @NotNull final MapManager<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll) { - super(mainControl, mapManager, actionFactory.format("mainWindow.title", CMainControl.getBuildNumberAsString())); - this.mainControl = mainControl; - this.objectChooser = objectChooser; - this.actionFactory = actionFactory; - aViewTreasurelists = actionFactory.createAction(true, "viewTreasurelists", mainControl); - this.aCloseAll = aCloseAll; - aPrevWindow = actionFactory.createAction(true, "prevWindow", this); - aNextWindow = actionFactory.createAction(true, "nextWindow", this); - - viewActions = new ViewActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(mainControl, mapManager); - - final ImageIcon icon = GUIUtils.getIcon(GUIConstants.APP_ICON); - if (icon != null) { - setIconImage(icon.getImage()); - } - - updateFocus(false); - } - - /** - * Initializes (builds) this view. - * @param lockedItemsControl the locked items control - * @param selectedSquareView the selected square view - * @param archTypeList the instance for looking up archetype types - * @param monsterMatcher the <code>GameObjectMatcher</code> for matching - * monster objects - * @param gameObjectMatchers the game object matchers - */ - void init(@NotNull final LockedItemsControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> lockedItemsControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> selectedSquareView, final CFArchTypeList archTypeList, final boolean mapTileListBottom, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final GameObjectMatchers gameObjectMatchers) { - // calculate some default values in case there is no settings file - final Rectangle screen = getGraphicsConfiguration().getBounds(); - final int defwidth = (int) (0.9 * screen.getWidth()); - final int defheight = (int) (0.9 * screen.getHeight()); - - mainToolbar = createMainToolbar(); - - final JPanel toolbarPanel = new JPanel(new BorderLayout()); - toolbarPanel.add(mainToolbar, BorderLayout.NORTH); - toolbarPanel.add(createCenterPanel(defwidth, defheight, lockedItemsControl, selectedSquareView, mapTileListBottom, monsterMatcher), BorderLayout.CENTER); - add(toolbarPanel, BorderLayout.CENTER); - - archetypesActions = new ArchetypesActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(this, objectChooser.getArchetypeChooserControl(), mainControl.getArchetypeSet(), objectChooser, archTypeList); - setJMenuBar(actionFactory.createMenuBar(true, "main")); - objectChooser.setPickmapFoldersMenu((JMenu) actionFactory.find(getJMenuBar(), "pickmapFolders")); - viewActions.init(gameObjectMatchers); - viewActions.setMenu((JMenu) actionFactory.find(getJMenuBar(), "view")); - - // set bounds (location and size) of the main frame - setBounds( - prefs.getInt(WINDOW_X, (int) (screen.getX() + (screen.getWidth() - defwidth) / 2.0)), - prefs.getInt(WINDOW_Y, (int) (screen.getY() + (screen.getHeight() - defheight) / 2.0)), - prefs.getInt(WINDOW_WIDTH, defwidth), - prefs.getInt(WINDOW_HEIGHT, defheight)); - setExtendedState(prefs.getInt(WINDOW_STATE, getExtendedState())); - - refreshMenus(); - } - - /** - * Creates the toolbar. - * @return the toolbar - */ - private JToolBar createMainToolbar() { - final JToolBar toolbar = actionFactory.createToolBar("main"); - prefs.addPreferenceChangeListener(preferenceChangeListener); - toolbar.setVisible(prefs.getBoolean(SHOW_MAIN_TOOLBAR_KEY, SHOW_MAIN_TOOLBAR_DEFAULT)); - return toolbar; - } - - /** - * Create the center panel. - * @param defwidth default width - * @param defheight default height - * @param lockedItemsControl the locked items control - * @param selectedSquareView the selected square view - * @param monsterMatcher the <code>GameObjectMatcher</code> for matching - * monster objects - * @return center panel - */ - private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final LockedItemsControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> lockedItemsControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectMatcher monsterMatcher) { - final JPanel centerPanel = new JPanel(new BorderLayout()); - - final int divLocationRight = prefs.getInt(DIVIDER_LOCATION_KEY3, (int) (defwidth * 0.62)); - final int divLocationDown = prefs.getInt(DIVIDER_LOCATION_KEY2, (int) (defheight * 0.76)); - final int divLocation = prefs.getInt(DIVIDER_LOCATION_KEY, (int) (defwidth * 0.17)); - - gameObjectAttributesPanel = new GameObjectAttributesPanel(mainControl, mapManager, this, lockedItemsControl, monsterMatcher); - - if (mapTileListBottom) { - splitRightPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, gameObjectAttributesPanel, selectedSquareView); - splitDownPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, mapDesktop, splitRightPane); - } else { - splitRightPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, mapDesktop, selectedSquareView); - splitDownPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, splitRightPane, gameObjectAttributesPanel); - } - splitRightPane.setDividerLocation(divLocationRight); - splitRightPane.setContinuousLayout(true); - splitRightPane.setResizeWeight(1); - splitDownPane.setDividerLocation(divLocationDown); - splitDownPane.setContinuousLayout(true); - splitDownPane.setResizeWeight(1); - splitPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, objectChooser, splitDownPane); - splitPane.setDividerLocation(divLocation); - splitPane.setContinuousLayout(true); - - centerPanel.add(splitPane, BorderLayout.CENTER); - return centerPanel; - } - - /** Notifies that the application is about to exit. */ - void appExitNotify() { - // Store the location and size - final Rectangle bounds = getBounds(); - prefs.putInt(WINDOW_X, bounds.x); - prefs.putInt(WINDOW_Y, bounds.y); - prefs.putInt(WINDOW_WIDTH, bounds.width); - prefs.putInt(WINDOW_HEIGHT, bounds.height); - prefs.putInt(DIVIDER_LOCATION_KEY, splitPane.getDividerLocation()); - prefs.putInt(DIVIDER_LOCATION_KEY2, splitDownPane.getDividerLocation()); - prefs.putInt(DIVIDER_LOCATION_KEY3, splitRightPane.getDividerLocation()); - prefs.putInt(WINDOW_STATE, getExtendedState()); - - objectChooser.appExitNotify(); - gameObjectAttributesPanel.appExitNotify(); - } - - /** {@inheritDoc} */ - public void addLevelView(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { - assert !mapViews.contains(mapView); - mapViews.add(0, mapView); - mapView.addInternalFrame... [truncated message content] |
From: <aki...@us...> - 2008-05-07 22:57:28
|
Revision: 3976 http://gridarta.svn.sourceforge.net/gridarta/?rev=3976&view=rev Author: akirschbaum Date: 2008-05-07 15:49:52 -0700 (Wed, 07 May 2008) Log Message: ----------- Move CMapViewBasic into gui.map package. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/MapActions.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/crossfire/src/cfeditor/gui/CMainView.java trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java trunk/crossfire/src/cfeditor/gui/ObjectChooser.java trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninEditor.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/MapActions.java trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java trunk/daimonin/src/daieditor/gui/CMainView.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java trunk/daimonin/src/daieditor/gui/ObjectChooser.java trunk/daimonin/src/daieditor/gui/map/MapUserListener.java trunk/daimonin/src/daieditor/map/MapControl.java Added Paths: ----------- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/CMapViewBasic.java trunk/daimonin/src/daieditor/CMapViewBasic.java Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -21,6 +21,7 @@ import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; +import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; import java.awt.Component; Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -31,6 +31,7 @@ import cfeditor.gui.CMainView; import cfeditor.gui.GameObjectAttributesDialog; import cfeditor.gui.ObjectChooser; +import cfeditor.gui.map.CMapViewBasic; import cfeditor.gui.prefs.GUIPrefs; import cfeditor.gui.prefs.ResPrefs; import cfeditor.map.MapArchObject; Deleted: trunk/crossfire/src/cfeditor/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/CMapViewBasic.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/crossfire/src/cfeditor/CMapViewBasic.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -1,208 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package cfeditor; - -import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.GameObject; -import cfeditor.gui.map.DefaultLevelRenderer; -import cfeditor.gui.map.MapRenderer; -import cfeditor.gui.map.MapUserListener; -import cfeditor.gui.map.PickmapRenderer; -import cfeditor.map.MapArchObject; -import cfeditor.map.MapControl; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.HashMap; -import java.util.Map; -import javax.swing.JViewport; -import net.sf.gridarta.gui.map.LevelRenderer; -import net.sf.gridarta.gui.map.MapCursor; -import net.sf.gridarta.gui.map.MapCursorEvent; -import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.map.MapModel; -import net.sf.gridarta.map.MapModelEvent; -import net.sf.gridarta.map.MapSquare; -import net.sf.gridarta.map.validation.ErrorCollector; -import net.sf.gridarta.map.validation.ValidationError; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * <code>CMapViewBasic</code> is the true mapview object. However, it is not - * bound to a certain type of frame (in order to allow maps be displayed in - * different types of frames). An instance of this class must only exist in - * "wrapper classes" like MapView which create a frame, showing the - * mapview. - * <p/> - * Note for developers: To avoid confusion regarding terminology, please use - * the following consistent terminology: - * <dl> - * <dt>map coordinates</dt> - * <dd>coordinates within the map, ranging from <code>0</code> to - * <code><var>mapWidth</var></code> resp. - * <code><var>mapHeight</var></code></dd> - * <dt>mouse coordinates</dt> - * <dd>coordinates of the mouse as delivered by the AWT/Swing events</dd> - * </dl> - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> - */ -public final class CMapViewBasic extends MapViewBasic<GameObject, MapArchObject, Archetype> { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** The controller of this view. */ - private final MapControl mapControl; - - /** The MapModel. */ - private final MapModel<GameObject, MapArchObject, Archetype> mapModel; - - /** The CMainControl. */ - private final CMainControl mainControl; - - /** The tile palette renderer. */ - private final DefaultLevelRenderer renderer; - - /** The MapSquares that are known to contain errors. */ - private final Map<MapSquare<GameObject, MapArchObject, Archetype>, ValidationError<GameObject, MapArchObject, Archetype>> erroneousMapSquares = new HashMap<MapSquare<GameObject, MapArchObject, Archetype>, ValidationError<GameObject, MapArchObject, Archetype>>(); - - /** The ArchObjects that are known to contain errors. */ - private final Map<GameObject, ValidationError<GameObject, MapArchObject, Archetype>> erroneousArchObjects = new HashMap<GameObject, ValidationError<GameObject, MapArchObject, Archetype>>(); - - @NotNull private final MapUserListener mapUserListener; - - /** - * Constructs a level view. - * @param mainControl the main controller - * @param mapControl the controller of this view - * @param initial the initial view position to show; null=show top left - * corner - */ - public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl mapControl, @Nullable final Point initial) { - super(mapControl); - this.mapControl = mapControl; - mapModel = mapControl.getMapModel(); - mapCursor.addMapCursorListener(this); - if (!mapControl.isPickmap()) { - mapCursor.addMapCursorListener(mainControl.getSelectedSquareControl().getSelectedSquareView()); - } - this.mainControl = mainControl; - - renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, mapGrid) : new MapRenderer(mainControl, mapControl, mapGrid); - setViewportView(renderer); - getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - - mapModel.addMapModelListener(this); - - // set the pixel increment scrolling for clicking once on a scrollbar arrow - getVerticalScrollBar().setUnitIncrement(32); - getHorizontalScrollBar().setUnitIncrement(32); - - if (initial != null) { - getViewport().setViewPosition(initial); - } - - mapUserListener = new MapUserListener(mainControl, mapControl, this, mainControl.getObjectChooser(), mainControl.getSelectedSquareControl().getSelectedSquareView(), mainControl.getObjectChooser().getPickmapChooserControl()); - renderer.addMouseListener(mapUserListener); - renderer.addMouseMotionListener(mapUserListener); - renderer.setErroneousMapSquares(erroneousMapSquares); - renderer.setErroneousArchObjects(erroneousArchObjects); - renderer.setFocusable(true); - setFocusable(true); - } - - /** {@inheritDoc} */ - public void closeNotify() { - renderer.closeNotify(); - mapCursor.removeMapCursorListener(this); - if (!mapControl.isPickmap()) { - mapCursor.removeMapCursorListener(mainControl.getSelectedSquareControl().getSelectedSquareView()); - } - setViewportView(null); - mapModel.removeMapModelListener(this); - renderer.removeMouseListener(mapUserListener); - renderer.removeMouseMotionListener(mapUserListener); - } - - /** {@inheritDoc} */ - public void mapSizeChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { - mapGrid.resize(e.getMapModel().getMapSize()); - } - - /** {@inheritDoc} */ - public void mapSquaresChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { - // ignore - } - - /** {@inheritDoc} */ - public void mapObjectsChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { - // ignore - } - - /** {@inheritDoc} */ - public void mapMetaChanged(@NotNull final MapArchObject mapArchObject) { - // ignore - } - - /** {@inheritDoc} */ - public LevelRenderer getRenderer() { - return renderer; - } - - /** {@inheritDoc} */ - public void errorsChanged(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { - final ErrorCollector<GameObject, MapArchObject, Archetype> errors = mapModel.getErrors(); - erroneousMapSquares.clear(); - erroneousArchObjects.clear(); - mapGrid.clearErrors(); - for (final ValidationError<GameObject, MapArchObject, Archetype> validationError : errors.getErrors()) { - final MapSquare<GameObject, MapArchObject, Archetype> mapSquare = validationError.getMapSquare(); - final GameObject archObject = validationError.getGameObject(); - if (mapSquare != null) { - erroneousMapSquares.put(mapSquare, validationError); - mapGrid.setError(mapSquare.getMapX(), mapSquare.getMapY()); - } - if (archObject != null) { - erroneousArchObjects.put(archObject, validationError); - final GameObject topContainer = archObject.getTopContainer(); - mapGrid.setError(topContainer.getMapX(), topContainer.getMapY()); - } - } - renderer.repaint(); - } - - /** {@inheritDoc} */ - public void mapCursorChangedPos(@NotNull final MapCursorEvent e) { - final MapCursor mapCursor = e.getSource(); - if (mapCursor.isActive()) { - final Rectangle rec = renderer.getTileBounds(mapCursor.getLocation()); - renderer.scrollRectToVisible(rec); - } - } - - /** {@inheritDoc} */ - public void mapCursorChangedMode(@NotNull final MapCursorEvent e) { - // Ignore mode change events - } - -} // class CMapViewBasic Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -22,6 +22,7 @@ import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; import cfeditor.gameobject.UndefinedArchetype; +import cfeditor.gui.map.CMapViewBasic; import cfeditor.gui.map.SimpleLevelRenderer; import cfeditor.io.GameObjectParser; import cfeditor.io.MapArchObjectParser; Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -21,6 +21,7 @@ import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; +import cfeditor.gui.map.CMapViewBasic; import cfeditor.gui.map.MapPropertiesDialog; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -19,7 +19,7 @@ package cfeditor.gameobject; -import cfeditor.CMapViewBasic; +import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; import java.io.BufferedReader; Modified: trunk/crossfire/src/cfeditor/gui/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/CMainView.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/crossfire/src/cfeditor/gui/CMainView.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -20,9 +20,9 @@ package cfeditor.gui; import cfeditor.CMainControl; -import cfeditor.CMapViewBasic; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; +import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; import java.awt.BorderLayout; Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -19,9 +19,9 @@ package cfeditor.gui; -import cfeditor.CMapViewBasic; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; +import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; import java.util.List; Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -19,9 +19,9 @@ package cfeditor.gui; -import cfeditor.CMapViewBasic; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; +import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; import net.sf.gridarta.MainControl; Modified: trunk/crossfire/src/cfeditor/gui/ObjectChooser.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/ObjectChooser.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/crossfire/src/cfeditor/gui/ObjectChooser.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -20,9 +20,9 @@ package cfeditor.gui; import cfeditor.CMainControl; -import cfeditor.CMapViewBasic; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; +import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; import java.awt.BorderLayout; Copied: trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java (from rev 3968, trunk/crossfire/src/cfeditor/CMapViewBasic.java) =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java (rev 0) +++ trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -0,0 +1,205 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package cfeditor.gui.map; + +import cfeditor.CMainControl; +import cfeditor.gameobject.Archetype; +import cfeditor.gameobject.GameObject; +import cfeditor.map.MapArchObject; +import cfeditor.map.MapControl; +import java.awt.Point; +import java.awt.Rectangle; +import java.util.HashMap; +import java.util.Map; +import javax.swing.JViewport; +import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapCursorEvent; +import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.map.MapModel; +import net.sf.gridarta.map.MapModelEvent; +import net.sf.gridarta.map.MapSquare; +import net.sf.gridarta.map.validation.ErrorCollector; +import net.sf.gridarta.map.validation.ValidationError; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * <code>CMapViewBasic</code> is the true mapview object. However, it is not + * bound to a certain type of frame (in order to allow maps be displayed in + * different types of frames). An instance of this class must only exist in + * "wrapper classes" like MapView which create a frame, showing the + * mapview. + * <p/> + * Note for developers: To avoid confusion regarding terminology, please use + * the following consistent terminology: + * <dl> + * <dt>map coordinates</dt> + * <dd>coordinates within the map, ranging from <code>0</code> to + * <code><var>mapWidth</var></code> resp. + * <code><var>mapHeight</var></code></dd> + * <dt>mouse coordinates</dt> + * <dd>coordinates of the mouse as delivered by the AWT/Swing events</dd> + * </dl> + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> + */ +public final class CMapViewBasic extends MapViewBasic<GameObject, MapArchObject, Archetype> { + + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + + /** The controller of this view. */ + private final MapControl mapControl; + + /** The MapModel. */ + private final MapModel<GameObject, MapArchObject, Archetype> mapModel; + + /** The CMainControl. */ + private final CMainControl mainControl; + + /** The tile palette renderer. */ + private final DefaultLevelRenderer renderer; + + /** The MapSquares that are known to contain errors. */ + private final Map<MapSquare<GameObject, MapArchObject, Archetype>, ValidationError<GameObject, MapArchObject, Archetype>> erroneousMapSquares = new HashMap<MapSquare<GameObject, MapArchObject, Archetype>, ValidationError<GameObject, MapArchObject, Archetype>>(); + + /** The ArchObjects that are known to contain errors. */ + private final Map<GameObject, ValidationError<GameObject, MapArchObject, Archetype>> erroneousArchObjects = new HashMap<GameObject, ValidationError<GameObject, MapArchObject, Archetype>>(); + + @NotNull private final MapUserListener mapUserListener; + + /** + * Constructs a level view. + * @param mainControl the main controller + * @param mapControl the controller of this view + * @param initial the initial view position to show; null=show top left + * corner + */ + public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl mapControl, @Nullable final Point initial) { + super(mapControl); + this.mapControl = mapControl; + mapModel = mapControl.getMapModel(); + mapCursor.addMapCursorListener(this); + if (!mapControl.isPickmap()) { + mapCursor.addMapCursorListener(mainControl.getSelectedSquareControl().getSelectedSquareView()); + } + this.mainControl = mainControl; + + renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, mapGrid) : new MapRenderer(mainControl, mapControl, mapGrid); + setViewportView(renderer); + getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); + + mapModel.addMapModelListener(this); + + // set the pixel increment scrolling for clicking once on a scrollbar arrow + getVerticalScrollBar().setUnitIncrement(32); + getHorizontalScrollBar().setUnitIncrement(32); + + if (initial != null) { + getViewport().setViewPosition(initial); + } + + mapUserListener = new MapUserListener(mainControl, mapControl, this, mainControl.getObjectChooser(), mainControl.getSelectedSquareControl().getSelectedSquareView(), mainControl.getObjectChooser().getPickmapChooserControl()); + renderer.addMouseListener(mapUserListener); + renderer.addMouseMotionListener(mapUserListener); + renderer.setErroneousMapSquares(erroneousMapSquares); + renderer.setErroneousArchObjects(erroneousArchObjects); + renderer.setFocusable(true); + setFocusable(true); + } + + /** {@inheritDoc} */ + public void closeNotify() { + renderer.closeNotify(); + mapCursor.removeMapCursorListener(this); + if (!mapControl.isPickmap()) { + mapCursor.removeMapCursorListener(mainControl.getSelectedSquareControl().getSelectedSquareView()); + } + setViewportView(null); + mapModel.removeMapModelListener(this); + renderer.removeMouseListener(mapUserListener); + renderer.removeMouseMotionListener(mapUserListener); + } + + /** {@inheritDoc} */ + public void mapSizeChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { + mapGrid.resize(e.getMapModel().getMapSize()); + } + + /** {@inheritDoc} */ + public void mapSquaresChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { + // ignore + } + + /** {@inheritDoc} */ + public void mapObjectsChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { + // ignore + } + + /** {@inheritDoc} */ + public void mapMetaChanged(@NotNull final MapArchObject mapArchObject) { + // ignore + } + + /** {@inheritDoc} */ + public LevelRenderer getRenderer() { + return renderer; + } + + /** {@inheritDoc} */ + public void errorsChanged(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { + final ErrorCollector<GameObject, MapArchObject, Archetype> errors = mapModel.getErrors(); + erroneousMapSquares.clear(); + erroneousArchObjects.clear(); + mapGrid.clearErrors(); + for (final ValidationError<GameObject, MapArchObject, Archetype> validationError : errors.getErrors()) { + final MapSquare<GameObject, MapArchObject, Archetype> mapSquare = validationError.getMapSquare(); + final GameObject archObject = validationError.getGameObject(); + if (mapSquare != null) { + erroneousMapSquares.put(mapSquare, validationError); + mapGrid.setError(mapSquare.getMapX(), mapSquare.getMapY()); + } + if (archObject != null) { + erroneousArchObjects.put(archObject, validationError); + final GameObject topContainer = archObject.getTopContainer(); + mapGrid.setError(topContainer.getMapX(), topContainer.getMapY()); + } + } + renderer.repaint(); + } + + /** {@inheritDoc} */ + public void mapCursorChangedPos(@NotNull final MapCursorEvent e) { + final MapCursor mapCursor = e.getSource(); + if (mapCursor.isActive()) { + final Rectangle rec = renderer.getTileBounds(mapCursor.getLocation()); + renderer.scrollRectToVisible(rec); + } + } + + /** {@inheritDoc} */ + public void mapCursorChangedMode(@NotNull final MapCursorEvent e) { + // Ignore mode change events + } + +} // class CMapViewBasic Property changes on: trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -20,7 +20,6 @@ package cfeditor.gui.map; import cfeditor.CMainControl; -import cfeditor.CMapViewBasic; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -20,9 +20,9 @@ package cfeditor.map; import cfeditor.CMainControl; -import cfeditor.CMapViewBasic; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; +import cfeditor.gui.map.CMapViewBasic; import java.awt.Point; import java.util.List; import net.sf.gridarta.gameobject.match.GameObjectMatcher; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -29,6 +29,7 @@ import daieditor.gui.CMainView; import daieditor.gui.GameObjectAttributesDialog; import daieditor.gui.ObjectChooser; +import daieditor.gui.map.CMapViewBasic; import daieditor.gui.map.DefaultLevelRenderer; import daieditor.gui.prefs.AppPrefs; import daieditor.gui.prefs.DevPrefs; Deleted: trunk/daimonin/src/daieditor/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/CMapViewBasic.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/daimonin/src/daieditor/CMapViewBasic.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -1,239 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package daieditor; - -import daieditor.gameobject.Archetype; -import daieditor.gameobject.GameObject; -import daieditor.gui.map.DefaultLevelRenderer; -import daieditor.gui.map.MapRenderer; -import daieditor.gui.map.MapUserListener; -import daieditor.gui.map.PickmapRenderer; -import daieditor.map.MapArchObject; -import daieditor.map.MapControl; -import java.awt.Dimension; -import java.awt.Point; -import java.awt.Rectangle; -import java.util.HashMap; -import java.util.Map; -import javax.swing.JViewport; -import net.sf.gridarta.Size2D; -import net.sf.gridarta.gui.map.LevelRenderer; -import net.sf.gridarta.gui.map.MapCursor; -import net.sf.gridarta.gui.map.MapCursorEvent; -import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.map.MapModel; -import net.sf.gridarta.map.MapModelEvent; -import net.sf.gridarta.map.MapSquare; -import net.sf.gridarta.map.validation.ErrorCollector; -import net.sf.gridarta.map.validation.ValidationError; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * <code>CMapViewBasic</code> is the true mapview object. However, it is not - * bound to a certain type of frame (in order to allow maps be displayed in - * different types of frames). An instance of this class must only exist in - * "wrapper classes" like MapView which create a frame, showing the - * mapview. - * <p/> - * Note for developers: To avoid confusion regarding terminology, please use - * the following consistent terminology: - * <dl> - * <dt>map coordinates</dt> - * <dd>coordinates within the map, ranging from <code>0</code> to - * <code><var>mapWidth</var></code> resp. - * <code><var>mapHeight</var></code></dd> - * <dt>mouse coordinates</dt> - * <dd>coordinates of the mouse as delivered by the AWT/Swing events</dd> - * </dl> - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> - */ -public final class CMapViewBasic extends MapViewBasic<GameObject, MapArchObject, Archetype> { - - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - - /** The controller of this view. */ - private final MapControl mapControl; - - /** The MapModel. */ - private final MapModel<GameObject, MapArchObject, Archetype> mapModel; - - /** The CMainControl. */ - private final CMainControl mainControl; - - /** The tile palette renderer. */ - private final DefaultLevelRenderer renderer; - - /** The MapSquares that are known to contain errors. */ - private final Map<MapSquare<GameObject, MapArchObject, Archetype>, ValidationError<GameObject, MapArchObject, Archetype>> erroneousMapSquares = new HashMap<MapSquare<GameObject, MapArchObject, Archetype>, ValidationError<GameObject, MapArchObject, Archetype>>(); - - /** The ArchObjects that are known to contain errors. */ - private final Map<GameObject, ValidationError<GameObject, MapArchObject, Archetype>> erroneousArchObjects = new HashMap<GameObject, ValidationError<GameObject, MapArchObject, Archetype>>(); - - @NotNull private final MapUserListener mapUserListener; - - /** - * Constructs a level view. - * @param mainControl the main controller - * @param mapControl the controller of this view - * @param initial the initial view position to show; null=show top left - * corner - */ - public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl mapControl, @Nullable final Point initial) { - super(mapControl); - this.mapControl = mapControl; - mapModel = mapControl.getMapModel(); - mapCursor.addMapCursorListener(this); - if (!mapControl.isPickmap()) { - mapCursor.addMapCursorListener(mainControl.getSelectedSquareControl().getSelectedSquareView()); - } - this.mainControl = mainControl; - - renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, mapGrid) : new MapRenderer(mainControl, mapControl, mapGrid); - setViewportView(renderer); - getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - - mapModel.addMapModelListener(this); - refreshDataFromModel(); - - // set the pixel increment scrolling for clicking once on a scrollbar arrow - getVerticalScrollBar().setUnitIncrement(IGUIConstants.TILE_ISO_YLEN); - getHorizontalScrollBar().setUnitIncrement(IGUIConstants.TILE_ISO_XLEN); - - if (initial != null) { - getViewport().setViewPosition(initial); - } - - mapUserListener = new MapUserListener(mainControl, mapControl, this); - renderer.addMouseListener(mapUserListener); - renderer.addMouseMotionListener(mapUserListener); - renderer.setErroneousMapSquares(erroneousMapSquares); - renderer.setErroneousArchObjects(erroneousArchObjects); - renderer.setFocusable(true); - setFocusable(true); - } - - /** {@inheritDoc} */ - public void closeNotify() { - renderer.closeNotify(); - mapCursor.removeMapCursorListener(this); - if (!mapControl.isPickmap()) { - mapCursor.removeMapCursorListener(mainControl.getSelectedSquareControl().getSelectedSquareView()); - } - setViewportView(null); - mapModel.removeMapModelListener(this); - renderer.removeMouseListener(mapUserListener); - renderer.removeMouseMotionListener(mapUserListener); - } - - /** Refreshes the data in the view from the model. */ - private void refreshDataFromModel() { - final Size2D mapSize = mapModel.getMapSize(); - - // define how much drawing space we need for the map - final Point offset = renderer.getBorderOffset(); - final int sum = mapSize.getWidth() + mapSize.getHeight(); - final Dimension forcedSize; - if (mapControl.isPickmap()) { - forcedSize = new Dimension( - 2 * offset.x + (Math.min(mapSize.getHeight(), 4) + Math.min(mapSize.getWidth(), 7)) * IGUIConstants.TILE_ISO_XLEN2, - 2 * offset.y + sum * IGUIConstants.TILE_ISO_YLEN2 - ); - } else { - forcedSize = new Dimension( - 2 * offset.x + sum * IGUIConstants.TILE_ISO_XLEN2, - 2 * offset.y + sum * IGUIConstants.TILE_ISO_YLEN2 - ); - - } - renderer.setPreferredSize(forcedSize); - renderer.setMinimumSize(forcedSize); - repaint(); - } - - /** {@inheritDoc} */ - public void mapSizeChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { - mapGrid.resize(e.getMapModel().getMapSize()); - refreshDataFromModel(); - } - - /** {@inheritDoc} */ - public void mapSquaresChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { - repaint(); - // TODO: only repaint a specific region - } - - /** {@inheritDoc} */ - public void mapObjectsChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { - repaint(); - // TODO: only repaint a specific region - } - - /** {@inheritDoc} */ - public void mapMetaChanged(@NotNull final MapArchObject mapArchObject) { - // ignore - } - - /** {@inheritDoc} */ - public LevelRenderer getRenderer() { - return renderer; - } - - /** {@inheritDoc} */ - public void errorsChanged(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { - final ErrorCollector<GameObject, MapArchObject, Archetype> errors = mapModel.getErrors(); - erroneousMapSquares.clear(); - erroneousArchObjects.clear(); - mapGrid.clearErrors(); - for (final ValidationError<GameObject, MapArchObject, Archetype> validationError : errors.getErrors()) { - final MapSquare<GameObject, MapArchObject, Archetype> mapSquare = validationError.getMapSquare(); - final GameObject archObject = validationError.getGameObject(); - if (mapSquare != null) { - erroneousMapSquares.put(mapSquare, validationError); - mapGrid.setError(mapSquare.getMapX(), mapSquare.getMapY()); - } - if (archObject != null) { - erroneousArchObjects.put(archObject, validationError); - final GameObject topContainer = archObject.getTopContainer(); - mapGrid.setError(topContainer.getMapX(), topContainer.getMapY()); - } - } - renderer.repaint(); - } - - /** {@inheritDoc} */ - public void mapCursorChangedPos(@NotNull final MapCursorEvent e) { - final MapCursor mapCursor = e.getSource(); - if (mapCursor.isActive()) { - final Rectangle rec = renderer.getTileBounds(mapCursor.getLocation()); - renderer.scrollRectToVisible(rec); - } - } - - /** {@inheritDoc} */ - public void mapCursorChangedMode(@NotNull final MapCursorEvent e) { - // Ignore mode change events - } - -} // class CMapViewBasic Modified: trunk/daimonin/src/daieditor/DaimoninEditor.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninEditor.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/daimonin/src/daieditor/DaimoninEditor.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -21,6 +21,7 @@ import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; +import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; import daieditor.map.MapControl; import java.awt.Component; Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -22,6 +22,7 @@ import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; import daieditor.gameobject.UndefinedArchetype; +import daieditor.gui.map.CMapViewBasic; import daieditor.gui.map.SimpleLevelRenderer; import daieditor.io.GameObjectParser; import daieditor.io.MapArchObjectParser; Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -21,6 +21,7 @@ import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; +import daieditor.gui.map.CMapViewBasic; import daieditor.gui.map.MapPropertiesDialog; import daieditor.map.MapArchObject; import daieditor.map.MapControl; Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -19,8 +19,8 @@ package daieditor.gameobject; -import daieditor.CMapViewBasic; import daieditor.MultiPositionData; +import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; import daieditor.map.MapControl; import java.io.BufferedReader; Modified: trunk/daimonin/src/daieditor/gui/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/gui/CMainView.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/daimonin/src/daieditor/gui/CMainView.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -20,9 +20,9 @@ package daieditor.gui; import daieditor.CMainControl; -import daieditor.CMapViewBasic; import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; +import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; import daieditor.map.MapControl; import java.awt.BorderLayout; Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -19,9 +19,9 @@ package daieditor.gui; -import daieditor.CMapViewBasic; import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; +import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; import daieditor.map.MapControl; import java.util.List; Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -19,9 +19,9 @@ package daieditor.gui; -import daieditor.CMapViewBasic; import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; +import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; import daieditor.map.MapControl; import net.sf.gridarta.MainControl; Modified: trunk/daimonin/src/daieditor/gui/ObjectChooser.java =================================================================== --- trunk/daimonin/src/daieditor/gui/ObjectChooser.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/daimonin/src/daieditor/gui/ObjectChooser.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -20,9 +20,9 @@ package daieditor.gui; import daieditor.CMainControl; -import daieditor.CMapViewBasic; import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; +import daieditor.gui.map.CMapViewBasic; import daieditor.gui.map.tools.ToolPalette; import daieditor.map.MapArchObject; import daieditor.map.MapControl; Copied: trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java (from rev 3968, trunk/daimonin/src/daieditor/CMapViewBasic.java) =================================================================== --- trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -0,0 +1,237 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package daieditor.gui.map; + +import daieditor.CMainControl; +import daieditor.IGUIConstants; +import daieditor.gameobject.Archetype; +import daieditor.gameobject.GameObject; +import daieditor.map.MapArchObject; +import daieditor.map.MapControl; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.util.HashMap; +import java.util.Map; +import javax.swing.JViewport; +import net.sf.gridarta.Size2D; +import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.MapCursor; +import net.sf.gridarta.gui.map.MapCursorEvent; +import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.map.MapModel; +import net.sf.gridarta.map.MapModelEvent; +import net.sf.gridarta.map.MapSquare; +import net.sf.gridarta.map.validation.ErrorCollector; +import net.sf.gridarta.map.validation.ValidationError; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * <code>CMapViewBasic</code> is the true mapview object. However, it is not + * bound to a certain type of frame (in order to allow maps be displayed in + * different types of frames). An instance of this class must only exist in + * "wrapper classes" like MapView which create a frame, showing the + * mapview. + * <p/> + * Note for developers: To avoid confusion regarding terminology, please use + * the following consistent terminology: + * <dl> + * <dt>map coordinates</dt> + * <dd>coordinates within the map, ranging from <code>0</code> to + * <code><var>mapWidth</var></code> resp. + * <code><var>mapHeight</var></code></dd> + * <dt>mouse coordinates</dt> + * <dd>coordinates of the mouse as delivered by the AWT/Swing events</dd> + * </dl> + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> + */ +public final class CMapViewBasic extends MapViewBasic<GameObject, MapArchObject, Archetype> { + + /** Serial Version UID. */ + private static final long serialVersionUID = 1L; + + /** The controller of this view. */ + private final MapControl mapControl; + + /** The MapModel. */ + private final MapModel<GameObject, MapArchObject, Archetype> mapModel; + + /** The CMainControl. */ + private final CMainControl mainControl; + + /** The tile palette renderer. */ + private final DefaultLevelRenderer renderer; + + /** The MapSquares that are known to contain errors. */ + private final Map<MapSquare<GameObject, MapArchObject, Archetype>, ValidationError<GameObject, MapArchObject, Archetype>> erroneousMapSquares = new HashMap<MapSquare<GameObject, MapArchObject, Archetype>, ValidationError<GameObject, MapArchObject, Archetype>>(); + + /** The ArchObjects that are known to contain errors. */ + private final Map<GameObject, ValidationError<GameObject, MapArchObject, Archetype>> erroneousArchObjects = new HashMap<GameObject, ValidationError<GameObject, MapArchObject, Archetype>>(); + + @NotNull private final MapUserListener mapUserListener; + + /** + * Constructs a level view. + * @param mainControl the main controller + * @param mapControl the controller of this view + * @param initial the initial view position to show; null=show top left + * corner + */ + public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl mapControl, @Nullable final Point initial) { + super(mapControl); + this.mapControl = mapControl; + mapModel = mapControl.getMapModel(); + mapCursor.addMapCursorListener(this); + if (!mapControl.isPickmap()) { + mapCursor.addMapCursorListener(mainControl.getSelectedSquareControl().getSelectedSquareView()); + } + this.mainControl = mainControl; + + renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, mapGrid) : new MapRenderer(mainControl, mapControl, mapGrid); + setViewportView(renderer); + getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); + + mapModel.addMapModelListener(this); + refreshDataFromModel(); + + // set the pixel increment scrolling for clicking once on a scrollbar arrow + getVerticalScrollBar().setUnitIncrement(IGUIConstants.TILE_ISO_YLEN); + getHorizontalScrollBar().setUnitIncrement(IGUIConstants.TILE_ISO_XLEN); + + if (initial != null) { + getViewport().setViewPosition(initial); + } + + mapUserListener = new MapUserListener(mainControl, mapControl, this); + renderer.addMouseListener(mapUserListener); + renderer.addMouseMotionListener(mapUserListener); + renderer.setErroneousMapSquares(erroneousMapSquares); + renderer.setErroneousArchObjects(erroneousArchObjects); + renderer.setFocusable(true); + setFocusable(true); + } + + /** {@inheritDoc} */ + public void closeNotify() { + renderer.closeNotify(); + mapCursor.removeMapCursorListener(this); + if (!mapControl.isPickmap()) { + mapCursor.removeMapCursorListener(mainControl.getSelectedSquareControl().getSelectedSquareView()); + } + setViewportView(null); + mapModel.removeMapModelListener(this); + renderer.removeMouseListener(mapUserListener); + renderer.removeMouseMotionListener(mapUserListener); + } + + /** Refreshes the data in the view from the model. */ + private void refreshDataFromModel() { + final Size2D mapSize = mapModel.getMapSize(); + + // define how much drawing space we need for the map + final Point offset = renderer.getBorderOffset(); + final int sum = mapSize.getWidth() + mapSize.getHeight(); + final Dimension forcedSize; + if (mapControl.isPickmap()) { + forcedSize = new Dimension( + 2 * offset.x + (Math.min(mapSize.getHeight(), 4) + Math.min(mapSize.getWidth(), 7)) * IGUIConstants.TILE_ISO_XLEN2, + 2 * offset.y + sum * IGUIConstants.TILE_ISO_YLEN2 + ); + } else { + forcedSize = new Dimension( + 2 * offset.x + sum * IGUIConstants.TILE_ISO_XLEN2, + 2 * offset.y + sum * IGUIConstants.TILE_ISO_YLEN2 + ); + + } + renderer.setPreferredSize(forcedSize); + renderer.setMinimumSize(forcedSize); + repaint(); + } + + /** {@inheritDoc} */ + public void mapSizeChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { + mapGrid.resize(e.getMapModel().getMapSize()); + refreshDataFromModel(); + } + + /** {@inheritDoc} */ + public void mapSquaresChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { + repaint(); + // TODO: only repaint a specific region + } + + /** {@inheritDoc} */ + public void mapObjectsChanged(final MapModelEvent<GameObject, MapArchObject, Archetype> e) { + repaint(); + // TODO: only repaint a specific region + } + + /** {@inheritDoc} */ + public void mapMetaChanged(@NotNull final MapArchObject mapArchObject) { + // ignore + } + + /** {@inheritDoc} */ + public LevelRenderer getRenderer() { + return renderer; + } + + /** {@inheritDoc} */ + public void errorsChanged(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { + final ErrorCollector<GameObject, MapArchObject, Archetype> errors = mapModel.getErrors(); + erroneousMapSquares.clear(); + erroneousArchObjects.clear(); + mapGrid.clearErrors(); + for (final ValidationError<GameObject, MapArchObject, Archetype> validationError : errors.getErrors()) { + final MapSquare<GameObject, MapArchObject, Archetype> mapSquare = validationError.getMapSquare(); + final GameObject archObject = validationError.getGameObject(); + if (mapSquare != null) { + erroneousMapSquares.put(mapSquare, validationError); + mapGrid.setError(mapSquare.getMapX(), mapSquare.getMapY()); + } + if (archObject != null) { + erroneousArchObjects.put(archObject, validationError); + final GameObject topContainer = archObject.getTopContainer(); + mapGrid.setError(topContainer.getMapX(), topContainer.getMapY()); + } + } + renderer.repaint(); + } + + /** {@inheritDoc} */ + public void mapCursorChangedPos(@NotNull final MapCursorEvent e) { + final MapCursor mapCursor = e.getSource(); + if (mapCursor.isActive()) { + final Rectangle rec = renderer.getTileBounds(mapCursor.getLocation()); + renderer.scrollRectToVisible(rec); + } + } + + /** {@inheritDoc} */ + public void mapCursorChangedMode(@NotNull final MapCursorEvent e) { + // Ignore mode change events + } + +} // class CMapViewBasic Property changes on: trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/gui/map/MapUserListener.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/daimonin/src/daieditor/gui/map/MapUserListener.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -20,7 +20,6 @@ package daieditor.gui.map; import daieditor.CMainControl; -import daieditor.CMapViewBasic; import daieditor.gui.map.event.MouseOpEvent; import daieditor.gui.map.event.MouseOpListener; import daieditor.gui.map.tools.ToolPalette; Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2008-05-07 22:40:44 UTC (rev 3975) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2008-05-07 22:49:52 UTC (rev 3976) @@ -20,9 +20,9 @@ package daieditor.map; import daieditor.CMainControl; -import daieditor.CMapViewBasic; import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; +import daieditor.gui.map.CMapViewBasic; import java.awt.Point; import java.util.List; import net.sf.gridarta.gameobject.match.GameObjectMatcher; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-07 23:05:36
|
Revision: 3977 http://gridarta.svn.sourceforge.net/gridarta/?rev=3977&view=rev Author: akirschbaum Date: 2008-05-07 16:05:04 -0700 (Wed, 07 May 2008) Log Message: ----------- Move Helper to gui package. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/CMainView.java trunk/crossfire/src/cfeditor/gui/script/ScriptView.java trunk/daimonin/src/daieditor/gui/CMainView.java trunk/src/app/net/sf/gridarta/gui/RecentManager.java trunk/src/app/net/sf/gridarta/gui/map/MapView.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListActions.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/MenuHelper.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/MenuHelper.java Modified: trunk/crossfire/src/cfeditor/gui/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/CMainView.java 2008-05-07 22:49:52 UTC (rev 3976) +++ trunk/crossfire/src/cfeditor/gui/CMainView.java 2008-05-07 23:05:04 UTC (rev 3977) @@ -45,7 +45,6 @@ import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; -import net.sf.gridarta.MenuHelper; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gui.ArchetypesActions; @@ -53,6 +52,7 @@ import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.gui.GUIUtils; import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.gui.MenuHelper; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.ViewActions; Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-05-07 22:49:52 UTC (rev 3976) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-05-07 23:05:04 UTC (rev 3977) @@ -39,7 +39,7 @@ import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; -import net.sf.gridarta.MenuHelper; +import net.sf.gridarta.gui.MenuHelper; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ReflectionAction; import org.apache.log4j.Logger; Modified: trunk/daimonin/src/daieditor/gui/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/gui/CMainView.java 2008-05-07 22:49:52 UTC (rev 3976) +++ trunk/daimonin/src/daieditor/gui/CMainView.java 2008-05-07 23:05:04 UTC (rev 3977) @@ -45,7 +45,6 @@ import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; -import net.sf.gridarta.MenuHelper; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gui.ArchetypesActions; @@ -53,6 +52,7 @@ import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.gui.GUIUtils; import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.gui.MenuHelper; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.ViewActions; Deleted: trunk/src/app/net/sf/gridarta/MenuHelper.java =================================================================== --- trunk/src/app/net/sf/gridarta/MenuHelper.java 2008-05-07 22:49:52 UTC (rev 3976) +++ trunk/src/app/net/sf/gridarta/MenuHelper.java 2008-05-07 23:05:04 UTC (rev 3977) @@ -1,87 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta; - -import java.awt.Component; -import javax.swing.AbstractButton; -import javax.swing.JMenu; -import javax.swing.JSeparator; -import javax.swing.MenuElement; - -/** - * Utility class implementing menu related functions. - * @author Andreas Kirschbaum - */ -@SuppressWarnings({"ClassNamingConvention"}) -public class MenuHelper { - - /** - * Private constructor to prevent instantiation. - */ - private MenuHelper() { - } - - /** - * Remove all actions attached to menu entries in a given menu element and - * its children. - * - * @param menuElement the menu element to process - */ - public static void disposeMenuElement(final MenuElement menuElement) { - if (menuElement instanceof AbstractButton) { - ((AbstractButton) menuElement).setAction(null); - } - - for (final MenuElement child : menuElement.getSubElements()) { - disposeMenuElement(child); - } - } - - /** - * Remove all menu entries. - * - * @param menu the menu to remove the entries from - */ - public static void removeAll(final JMenu menu) { - for (final MenuElement child : menu.getSubElements()) { - disposeMenuElement(child); - } - menu.removeAll(); - } - - /** - * Remove all menu entries up to (but not including) the first separator. - * - * @param menu the menu to remove the entries from - */ - public static void removeAllToSeparator(final JMenu menu) { - for (;;) { - final Component menuItem = menu.getMenuComponent(0); - if (menuItem == null || menuItem instanceof JSeparator) { - break; - } - menu.remove(0); - if (menuItem instanceof MenuElement) { - disposeMenuElement((MenuElement) menuItem); - } - } - } - -} // class MenuHelper Copied: trunk/src/app/net/sf/gridarta/gui/MenuHelper.java (from rev 3963, trunk/src/app/net/sf/gridarta/MenuHelper.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MenuHelper.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/MenuHelper.java 2008-05-07 23:05:04 UTC (rev 3977) @@ -0,0 +1,87 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui; + +import java.awt.Component; +import javax.swing.AbstractButton; +import javax.swing.JMenu; +import javax.swing.JSeparator; +import javax.swing.MenuElement; + +/** + * Utility class implementing menu related functions. + * @author Andreas Kirschbaum + */ +@SuppressWarnings({"ClassNamingConvention"}) +public class MenuHelper { + + /** + * Private constructor to prevent instantiation. + */ + private MenuHelper() { + } + + /** + * Remove all actions attached to menu entries in a given menu element and + * its children. + * + * @param menuElement the menu element to process + */ + public static void disposeMenuElement(final MenuElement menuElement) { + if (menuElement instanceof AbstractButton) { + ((AbstractButton) menuElement).setAction(null); + } + + for (final MenuElement child : menuElement.getSubElements()) { + disposeMenuElement(child); + } + } + + /** + * Remove all menu entries. + * + * @param menu the menu to remove the entries from + */ + public static void removeAll(final JMenu menu) { + for (final MenuElement child : menu.getSubElements()) { + disposeMenuElement(child); + } + menu.removeAll(); + } + + /** + * Remove all menu entries up to (but not including) the first separator. + * + * @param menu the menu to remove the entries from + */ + public static void removeAllToSeparator(final JMenu menu) { + for (;;) { + final Component menuItem = menu.getMenuComponent(0); + if (menuItem == null || menuItem instanceof JSeparator) { + break; + } + menu.remove(0); + if (menuItem instanceof MenuElement) { + disposeMenuElement((MenuElement) menuItem); + } + } + } + +} // class MenuHelper Property changes on: trunk/src/app/net/sf/gridarta/gui/MenuHelper.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/RecentManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2008-05-07 22:49:52 UTC (rev 3976) +++ trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2008-05-07 23:05:04 UTC (rev 3977) @@ -31,7 +31,6 @@ import javax.swing.JMenu; import javax.swing.KeyStroke; import net.sf.gridarta.MainControl; -import net.sf.gridarta.MenuHelper; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: trunk/src/app/net/sf/gridarta/gui/map/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-05-07 22:49:52 UTC (rev 3976) +++ trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-05-07 23:05:04 UTC (rev 3977) @@ -28,9 +28,9 @@ import javax.swing.JInternalFrame; import javax.swing.JMenu; import net.sf.gridarta.MainControl; -import net.sf.gridarta.MenuHelper; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.MenuHelper; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListActions.java 2008-05-07 22:49:52 UTC (rev 3976) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListActions.java 2008-05-07 23:05:04 UTC (rev 3977) @@ -22,9 +22,9 @@ import javax.swing.Action; import javax.swing.JCheckBoxMenuItem; import javax.swing.JMenu; -import net.sf.gridarta.MenuHelper; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.MenuHelper; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.map.MapArchObject; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-08 19:02:00
|
Revision: 3978 http://gridarta.svn.sourceforge.net/gridarta/?rev=3978&view=rev Author: akirschbaum Date: 2008-05-08 12:01:43 -0700 (Thu, 08 May 2008) Log Message: ----------- Extract GlobalSettings from MainControl. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/MapActions.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/MapActions.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/RecentManager.java trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/io/PathManager.java Added Paths: ----------- trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java trunk/daimonin/src/daieditor/GlobalSettingsImpl.java trunk/src/app/net/sf/gridarta/GlobalSettings.java trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -80,6 +80,7 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.undo.UndoControl; import net.sf.gridarta.io.IOUtils; +import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.AutoValidator; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.validation.DefaultErrorCollector; @@ -138,12 +139,6 @@ /** Singleton instance reference. */ private static CMainControl instance; - private static final String DOCU_VERSION_KEY = "docuVersion"; - - public static final String USE_IMAGESET = "useImageSet"; - - public static final String LOAD_ARCH_COLL = "loadArchFromCollection"; - /** Preferences key for using System.exit(). */ public static final String PREFS_SYSTEM_EXIT = "systemExit"; @@ -191,27 +186,8 @@ /** The current script controller. */ private final ScriptController scriptControl; - // resource directories - private File mapDir; + private final GlobalSettingsImpl globalSettings = new GlobalSettingsImpl(); - private String strMapDir; - - private String strArchDir; - - private String strScriptDir; - - /** Directory for saving map images. */ - private String strImageDir; - - /** Name of used Image Set (null = none). */ - private String imageSet; - - /** Do we load arches from the collected archives. */ - private boolean loadFromArchive = true; - - /** Time for an automated docu popup. */ - private boolean autoPopupDocu = false; - /** The list of archtype-data (loaded from "types.xml"). */ private CFArchTypeList typeList = null; @@ -258,8 +234,9 @@ mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>("cfeditor", this, getMapManager()); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "gc", "onlineHelp", "tod", "about"); mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(getMapManager()); - readGlobalSettings(); - objectChooser = new ObjectChooser(newMapDialogFactory, this, new File(mapDir, IGUIConstants.PICKMAP_DIR)); + globalSettings.readGlobalSettings(); + PathManager.setGlobalSettings(globalSettings); + objectChooser = new ObjectChooser(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR)); mainView = new CMainView(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction()); new About("cfeditor", mainView); undoControl = new UndoControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(getMapManager()); @@ -270,7 +247,7 @@ createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview()); // initialize the script-editor pad - ScriptEditControl.init(strMapDir, this); + ScriptEditControl.init(globalSettings.getMapDefaultFolder(), this); // load the list with archtype-data from "types.xml" final XmlHelper xmlHelper; @@ -321,11 +298,11 @@ faceObjects = new FaceObjects(this); archetypeSet.loadArchetypes(archetypeParser); - if (autoPopupDocu) { + if (globalSettings.isAutoPopupDocu()) { // do an automated help popup because the docu version has increased // (people won't notice the docu otherwise - nobody expects a docu in opensource) onlineHelp(); - autoPopupDocu = false; + globalSettings.setAutoPopupDocu(false); } net.sf.gridarta.gameobject.GameObject.setTypeList(typeList); // set reference in GameObject @@ -351,7 +328,7 @@ if (menuAnalyze != null) { filterControl.createMenuEntries(menuAnalyze); } - scriptControl.loadScripts(new File(getMapDir(), IGUIConstants.SCRIPTS_DIR)); + scriptControl.loadScripts(new File(globalSettings.getMapDir(), IGUIConstants.SCRIPTS_DIR)); mainView.setStatusText("Sorting..."); objectChooser.getArchetypeChooserControl().finishBuildProcess(); @@ -509,47 +486,6 @@ mainView.openHelpWindow(); } - /** Set all global settings from the preferences. */ - public void readGlobalSettings() { - imageSet = prefs.get(USE_IMAGESET, "base"); - if (imageSet.equalsIgnoreCase("none")) { - imageSet = null; - } - initDirs(); - - loadFromArchive = prefs.getBoolean(LOAD_ARCH_COLL, true); - - // docu version - if (IGUIConstants.DOCU_VERSION > prefs.getInt(DOCU_VERSION_KEY, 0)) { - // remember to open docu - autoPopupDocu = true; - // update docu version right now, because we want the help popup only one time - prefs.putInt(DOCU_VERSION_KEY, IGUIConstants.DOCU_VERSION); - } - } - - /** (Re-)initializes the directories. */ - public void initDirs() { - strMapDir = prefs.get(ResourceFileManager.MAP_DIR_KEY, ResourceFileManager.DEFAULT_MAP_DIR); - strArchDir = prefs.get(ResourceFileManager.ARCH_DIR_KEY, ResourceFileManager.DEFAULT_ARCH_DIR); - strScriptDir = prefs.get(ResourceFileManager.SCRIPT_DIR_KEY, ResourceFileManager.DEFAULT_SCRIPT_DIR); - - // set map dir - if (strMapDir.length() > 0) { - mapDir = new File(strMapDir); - } else { - // if map dir not set, default to current dir - if (!currentDir.exists()) { - log.error("in readGlobalSettings(): current dir doesn't exist!"); - } - mapDir = new File(currentDir.getAbsolutePath()); - } - // if mapdir has no absolute path, set it now - if (currentDir.exists() && mapDir.getParent() == null && !mapDir.isAbsolute() && !hasChangedDir) { - mapDir = new File(currentDir.getAbsolutePath(), mapDir.getPath()); - } - } - /** Swing FileFilter for map files. */ private static final FileFilter mapFileFilter = new HideFileFilterProxy(MapFileFilter.getInstance()); @@ -561,17 +497,11 @@ /** Swing FileFilter for Python scripts. */ public static final FileFilter pythonFileFilter = new HideFileFilterProxy(new EndingFileFilter(true, ACTION_FACTORY.getString("fileDialog.filter.python"), ".py")); - /** {@inheritDoc} */ - public String getMapDefaultFolder() { - return strMapDir; + public GlobalSettingsImpl getGlobalSettings() { + return globalSettings; } /** {@inheritDoc} */ - public String getArchDefaultFolder() { - return strArchDir; - } - - /** {@inheritDoc} */ public FileFilter getScriptFileFilter() { return pythonFileFilter; } @@ -581,15 +511,6 @@ return ".py"; } - /** {@inheritDoc} */ - public String getScriptDefaultFolder() { - return strScriptDir; - } - - public boolean isArchLoadedFromCollection() { - return loadFromArchive; - } - /** * Returns the main view. * @return the main view @@ -629,8 +550,8 @@ fileChooser.setMultiSelectionEnabled(true); fileChooser.addChoosableFileFilter(pythonFileFilter); fileChooser.addChoosableFileFilter(mapFileFilter); - if (mapDir.exists()) { - fileChooser.setCurrentDirectory(mapDir); + if (globalSettings.getMapDir().exists()) { + fileChooser.setCurrentDirectory(globalSettings.getMapDir()); } attachToMapPreviewAccessory(fileChooser); } @@ -646,10 +567,10 @@ } // default folder is the map-folder at first time, then the active folder - if (!hasChangedDir && mapDir.exists()) { - fileChooser.setCurrentDirectory(mapDir); - } else if (currentDir.exists()) { - fileChooser.setCurrentDirectory(currentDir); + if (!globalSettings.hasChangedDir() && globalSettings.getMapDir().exists()) { + fileChooser.setCurrentDirectory(globalSettings.getMapDir()); + } else if (globalSettings.getCurrentDir().exists()) { + fileChooser.setCurrentDirectory(globalSettings.getCurrentDir()); } if (mapFilter) { @@ -665,7 +586,7 @@ return; } - hasChangedDir = true; // user has chosen an active dir + globalSettings.setChangedDir(true); // user has chosen an active dir openFiles(fileChooser.getCurrentDirectory(), fileChooser.getSelectedFiles()); } } @@ -682,7 +603,7 @@ if (isScriptFile) { ScriptEditControl.getInstance().openScriptFile(file.getAbsolutePath()); } else { - currentDir = dir; + globalSettings.setCurrentDir(dir); getMapManager().openMapFileWithView(file, null); } } else if (!file.exists()) { @@ -741,10 +662,10 @@ fileChooser.setMultiSelectionEnabled(false); // default folder is the map-folder at first time, then the active folder - if (!hasChangedDir && mapDir.exists()) { - fileChooser.setCurrentDirectory(mapDir); - } else if (currentDir.exists()) { - fileChooser.setCurrentDirectory(currentDir); + if (!globalSettings.hasChangedDir() && globalSettings.getMapDir().exists()) { + fileChooser.setCurrentDirectory(globalSettings.getMapDir()); + } else if (globalSettings.getCurrentDir().exists()) { + fileChooser.setCurrentDirectory(globalSettings.getCurrentDir()); } // if file already exists, select it @@ -752,17 +673,17 @@ if (mapFile != null && mapFile.exists()) { fileChooser.setSelectedFile(mapFile); } else { - fileChooser.setSelectedFile(new File(mapDir, mapControl.getMapFileName())); + fileChooser.setSelectedFile(new File(globalSettings.getMapDir(), mapControl.getMapFileName())); } final int returnVal = fileChooser.showSaveDialog(mainView); if (returnVal == JFileChooser.APPROVE_OPTION) { - hasChangedDir = true; // user has chosen an active dir + globalSettings.setChangedDir(true); // user has chosen an active dir final File file = fileChooser.getSelectedFile(); if (!file.exists() || ACTION_FACTORY.showConfirmDialog(mainView, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_CANCEL_OPTION, "overwriteOtherFile", file.getName()) == JOptionPane.OK_OPTION) { mapControl.saveAs(file); - currentDir = fileChooser.getCurrentDirectory(); + globalSettings.setCurrentDir(fileChooser.getCurrentDirectory()); } return true; } else { @@ -772,12 +693,12 @@ /** {@inheritDoc} */ public void createImage(@NotNull final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { - if (strImageDir == null) { - strImageDir = mapDir.getAbsolutePath(); + if (globalSettings.getImageDir() == null) { + globalSettings.setImageDir(globalSettings.getMapDir().getAbsolutePath()); } - final String startFilename = strImageDir + "/" + mapView.getMapControl().getMapFileName() + ".png"; - final JFileChooser fileChooser = new JFileChooser(strImageDir); + final String startFilename = globalSettings.getImageDir() + "/" + mapView.getMapControl().getMapFileName() + ".png"; + final JFileChooser fileChooser = new JFileChooser(globalSettings.getImageDir()); fileChooser.setDialogTitle("Save Image As"); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setMultiSelectionEnabled(false); @@ -793,7 +714,7 @@ if (!filename.endsWith(".png")) { imageFile = new File(filename + ".png"); } - strImageDir = imageFile.getParentFile().getAbsolutePath(); + globalSettings.setImageDir(imageFile.getParentFile().getAbsolutePath()); if (!imageFile.exists() || ACTION_FACTORY.showConfirmDialog(mainView, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, "overwriteOtherFile", imageFile) == JOptionPane.YES_OPTION) { try { mapView.getView().getRenderer().printFullImage(imageFile); @@ -924,11 +845,6 @@ mainView.handleThrowable(t); } - /** {@inheritDoc} */ - @NotNull public File getMapDir() { - return mapDir; - } - public CFilterControl getFilterControl() { return filterControl; } @@ -970,7 +886,7 @@ } public String getImageSet() { - return imageSet; + return globalSettings.getImageSet(); } public MapCursorControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getMapCursorControl() { Added: trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java =================================================================== --- trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java (rev 0) +++ trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -0,0 +1,100 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package cfeditor; + +import java.io.File; +import java.util.prefs.Preferences; +import net.sf.gridarta.MainControl; +import org.apache.log4j.Logger; + +/** + * Maintains path names to resources. + * @author Andreas Kirschbaum + */ +public class GlobalSettingsImpl extends net.sf.gridarta.GlobalSettingsImpl { + + private static final String DOCU_VERSION_KEY = "docuVersion"; + + /** The Logger for printing log messages. */ + private static final Logger log = Logger.getLogger(CMainControl.class); + + /** Preferences. */ + private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + + /** Name of used Image Set (null = none). */ + private String imageSet; + + /** Time for an automated docu popup. */ + private boolean autoPopupDocu = false; + + public String getImageSet() { + return imageSet; + } + + public boolean isAutoPopupDocu() { + return autoPopupDocu; + } + + public void setAutoPopupDocu(final boolean autoPopupDocu) { + this.autoPopupDocu = autoPopupDocu; + } + + /** Set all global settings from the preferences. */ + public void readGlobalSettings() { + imageSet = prefs.get(USE_IMAGESET, "base"); + if (imageSet.equalsIgnoreCase("none")) { + imageSet = null; + } + initDirs(); + + setLoadFromArchive(prefs.getBoolean(LOAD_ARCH_COLL, true)); + + // docu version + if (IGUIConstants.DOCU_VERSION > prefs.getInt(DOCU_VERSION_KEY, 0)) { + // remember to open docu + autoPopupDocu = true; + // update docu version right now, because we want the help popup only one time + prefs.putInt(DOCU_VERSION_KEY, IGUIConstants.DOCU_VERSION); + } + } + + /** (Re-)initializes the directories. */ + public void initDirs() { + setMapDefaultFolder(prefs.get(ResourceFileManager.MAP_DIR_KEY, ResourceFileManager.DEFAULT_MAP_DIR)); + setArchDefaultFolder(prefs.get(ResourceFileManager.ARCH_DIR_KEY, ResourceFileManager.DEFAULT_ARCH_DIR)); + setScriptDefaultFolder(prefs.get(ResourceFileManager.SCRIPT_DIR_KEY, ResourceFileManager.DEFAULT_SCRIPT_DIR)); + + // set map dir + if (getMapDefaultFolder().length() > 0) { + setMapDir(new File(getMapDefaultFolder())); + } else { + // if map dir not set, default to current dir + if (!getCurrentDir().exists()) { + log.error("in readGlobalSettings(): current dir doesn't exist!"); + } + setMapDir(new File(getCurrentDir().getAbsolutePath())); + } + // if mapdir has no absolute path, set it now + if (getCurrentDir().exists() && getMapDir().getParent() == null && !getMapDir().isAbsolute() && !hasChangedDir) { + setMapDir(new File(getCurrentDir().getAbsolutePath(), getMapDir().getPath())); + } + } + +} // class GlobalSettingsImpl Property changes on: trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -276,10 +276,10 @@ ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterExitRandomDestination"); return; } - newfile = new File(mainControl.getMapDir().getAbsolutePath(), destinationMap); + newfile = new File(mainControl.getGlobalSettings().getMapDir().getAbsolutePath(), destinationMap); } else if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { // we have an absolute path: - newfile = new File(mainControl.getMapDir().getAbsolutePath(), path.substring(1)); + newfile = new File(mainControl.getGlobalSettings().getMapDir().getAbsolutePath(), path.substring(1)); } else { // we have a relative path: if (currentMap.getMapFile() == null) { @@ -361,7 +361,7 @@ @NotNull final File newfile; // new mapfile to open if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { // we have an absolute path: - newfile = new File(mainControl.getMapDir().getAbsolutePath(), path.substring(1)); + newfile = new File(mainControl.getGlobalSettings().getMapDir().getAbsolutePath(), path.substring(1)); } else { // we have a relative path: if (currentMap.getMapFile() == null) { Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -125,11 +125,11 @@ final List<GameObject> invObjects = new ArrayList<GameObject>(); final String fname; // here we go... - if (mainControl.isArchLoadedFromCollection()) { + if (mainControl.getGlobalSettings().isArchLoadedFromCollection()) { loadArchFromCollected(archetypeParser, invObjects); // load arches & images from collection fname = IGUIConstants.ARCH_FILE; } else { - fname = mainControl.getArchDefaultFolder(); + fname = mainControl.getGlobalSettings().getArchDefaultFolder(); loadArchetypesFromFiles(archetypeParser, new File(fname), 0, "default", "default", invObjects); // collect arches & images from individual files } reportErrors(mainControl.getMainView()); Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -224,7 +224,7 @@ pname1 = faceObject.getPath().substring(tmp).replace('\\', '/').replace('.', '%'); } else { // hope nobody renames his arch-dir and ends up in here - pname1 = "arch" + faceObject.getPath().substring(mainControl.getArchDefaultFolder().length()).replace('\\', '/'); + pname1 = "arch" + faceObject.getPath().substring(mainControl.getGlobalSettings().getArchDefaultFolder().length()).replace('\\', '/'); } return "./" + pname1.substring(0, pname1.lastIndexOf("/") + 1); } Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -118,7 +118,7 @@ */ public static String localizeEventPath(final File f) { final File localMapDir = AbstractMainControl.getInstance().getLocalMapDir(); - final File mapDir = new File(AbstractMainControl.getInstance().getMapDefaultFolder()); // global map directory + final File mapDir = new File(AbstractMainControl.getInstance().getGlobalSettings().getMapDefaultFolder()); // global map directory if (!mapDir.exists()) { log.warn("Map directory '" + mapDir.getAbsolutePath() + "' does not exist!"); @@ -306,7 +306,7 @@ String absScriptPath; if (scriptPath.startsWith("/")) { // script path is absolute - final File mapDir = new File(AbstractMainControl.getInstance().getMapDefaultFolder()); // global map directory + final File mapDir = new File(AbstractMainControl.getInstance().getGlobalSettings().getMapDefaultFolder()); // global map directory if (!mapDir.exists()) { // if map dir doesn't exist, this is not going to work frame.setVisible(false); Modified: trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -34,6 +34,7 @@ import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.border.TitledBorder; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.MainControl; import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.io.PathManager; @@ -106,21 +107,21 @@ prefs.put(ResourceFileManager.ARCH_DIR_KEY, PathManager.path(archField.getText())); prefs.put(ResourceFileManager.MAP_DIR_KEY, PathManager.path(mapField.getText())); prefs.put(ResourceFileManager.SCRIPT_DIR_KEY, PathManager.path(scriptField.getText())); - prefs.putBoolean(CMainControl.LOAD_ARCH_COLL, loadArches.isSelected()); + prefs.putBoolean(GlobalSettings.LOAD_ARCH_COLL, loadArches.isSelected()); final String imageSet = (String) imageSetBox.getSelectedItem(); - prefs.put(CMainControl.USE_IMAGESET, imageSet == null || imageSet.equals("disabled") ? "none" : imageSet); + prefs.put(GlobalSettings.USE_IMAGESET, imageSet == null || imageSet.equals("disabled") ? "none" : imageSet); - mainControl.readGlobalSettings(); + mainControl.getGlobalSettings().readGlobalSettings(); ACTION_FACTORY.showOnetimeMessageDialog(this, JOptionPane.WARNING_MESSAGE, "optionsRestart"); } /** {@inheritDoc} */ public void revert() { - archField.setText(mainControl.getArchDefaultFolder()); - mapField.setText(mainControl.getMapDefaultFolder()); - scriptField.setText(mainControl.getScriptDefaultFolder()); - loadArches.setSelected(mainControl.isArchLoadedFromCollection()); + archField.setText(mainControl.getGlobalSettings().getArchDefaultFolder()); + mapField.setText(mainControl.getGlobalSettings().getMapDefaultFolder()); + scriptField.setText(mainControl.getGlobalSettings().getScriptDefaultFolder()); + loadArches.setSelected(mainControl.getGlobalSettings().isArchLoadedFromCollection()); imageSetBox.setSelectedIndex(linearSearch(imageSets, getCurrentImageSet())); } @@ -138,11 +139,12 @@ final String selectedimageSet = (String) imageSetBox.getSelectedItem(); final String imageSet = selectedimageSet == null ? "disabled" : selectedimageSet; return !( - archField.getText().equals(mainControl.getArchDefaultFolder()) - && mapField.getText().equals(mainControl.getMapDefaultFolder()) - && scriptField.getText().equals(mainControl.getScriptDefaultFolder()) - && loadArches.isSelected() == prefs.getBoolean(CMainControl.LOAD_ARCH_COLL, mainControl.isArchLoadedFromCollection()) - && imageSet.equals(getCurrentImageSet())); + archField.getText().equals(mainControl.getGlobalSettings().getArchDefaultFolder()) + && mapField.getText().equals(mainControl.getGlobalSettings().getMapDefaultFolder()) + && scriptField.getText().equals(mainControl.getGlobalSettings().getScriptDefaultFolder()) + && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, mainControl.getGlobalSettings().isArchLoadedFromCollection()) + && imageSet.equals(getCurrentImageSet()) + ); } /** @@ -168,9 +170,9 @@ private Component createResourcePanel() { final Box resourcePanel = Box.createVerticalBox(); resourcePanel.setBorder(createTitledBorder("optionsResPaths")); - archField = createFileField(resourcePanel, "optionsResArch", mainControl.getArchDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); - mapField = createFileField(resourcePanel, "optionsResMaps", mainControl.getMapDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); - scriptField = createFileField(resourcePanel, "optionsResScripts", mainControl.getScriptDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + archField = createFileField(resourcePanel, "optionsResArch", mainControl.getGlobalSettings().getArchDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + mapField = createFileField(resourcePanel, "optionsResMaps", mainControl.getGlobalSettings().getMapDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + scriptField = createFileField(resourcePanel, "optionsResScripts", mainControl.getGlobalSettings().getScriptDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); return resourcePanel; } @@ -183,9 +185,9 @@ globalPanel.setBorder(createTitledBorder("optionsGlobal")); loadArches = new JCheckBox(ACTION_FACTORY.createToggle(false, "optionsLoadArchColl", this)); - loadArches.setSelected(mainControl.isArchLoadedFromCollection()); + loadArches.setSelected(mainControl.getGlobalSettings().isArchLoadedFromCollection()); globalPanel.add(loadArches); - if (mainControl.isArchLoadedFromCollection()) { + if (mainControl.getGlobalSettings().isArchLoadedFromCollection()) { archField.setEnabled(false); } @@ -245,7 +247,7 @@ } private static String getCurrentImageSet() { - final String imageSet = prefs.get(CMainControl.USE_IMAGESET, "none"); + final String imageSet = prefs.get(GlobalSettings.USE_IMAGESET, "none"); return imageSet.equals("none") ? "disabled" : imageSet; } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -87,6 +87,7 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.undo.UndoControl; import net.sf.gridarta.io.IOUtils; +import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.AutoValidator; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.MapSquare; @@ -156,10 +157,6 @@ /** Singleton instance reference. */ private static CMainControl instance; - private static final String DOCU_VERSION_KEY = "docuVersion"; - - public static final String LOAD_ARCH_COLL = "loadArchFromCollection"; - /** Preferences key for using System.exit(). */ public static final String PREFS_SYSTEM_EXIT = "systemExit"; @@ -225,29 +222,11 @@ */ private final ArchetypeSet archetypeSet; - // resource directories - private File mapDir; - - private String strMapDir; - - private String strArchDir; - - private String strScriptDir; - - private String strMediaDir; - - /** Directory for saving map images. */ - private String strImageDir; - - /** Do we load arches from the collected archives. */ - private boolean loadFromArchive = true; - - /** Time for an automated docu popup. */ - private boolean autoPopupDocu = false; - /** Whether to display double arches like stacked walls in stacked version. */ private boolean drawDouble; + private final GlobalSettingsImpl globalSettings = new GlobalSettingsImpl(); + /** The list of archtype-data (loaded from "types.xml"). */ private CFArchTypeList typeList = null; @@ -310,8 +289,9 @@ ACTION_FACTORY.createToggles(true, this, "drawDouble"); aCollectSpells = ACTION_FACTORY.createAction(true, "collectSpells", this); mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(getMapManager()); - readGlobalSettings(); - objectChooser = new ObjectChooser(newMapDialogFactory, this, new File(strArchDir, IGUIConstants.PICKMAP_DIR)); + globalSettings.readGlobalSettings(); + PathManager.setGlobalSettings(globalSettings); + objectChooser = new ObjectChooser(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR)); mainView = new CMainView(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction()); new About("daieditor", mainView); undoControl = new UndoControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(getMapManager()); @@ -325,7 +305,7 @@ MultiPositionData.init(getConfigurationDirectory()); // initialize the script-editor pad - ScriptEditControl.init(strMapDir, this); + ScriptEditControl.init(globalSettings.getMapDefaultFolder(), this); // load the list with archtype-data from "types.xml" final XmlHelper xmlHelper; @@ -374,11 +354,11 @@ faceObjects = new FaceObjects(this); archetypeSet.loadArchetypes(archetypeParser); - if (autoPopupDocu) { + if (globalSettings.isAutoPopupDocu()) { // do an automated help popup because the docu version has increased // (people won't notice the docu otherwise - nobody expects a docu in opensource) onlineHelp(); - autoPopupDocu = false; + globalSettings.setAutoPopupDocu(false); } net.sf.gridarta.gameobject.GameObject.setTypeList(typeList); // set reference in GameObject @@ -451,7 +431,7 @@ } treasureListTree = new CFTreasureListTree<GameObject, MapArchObject, Archetype>(mainView, archetypeSet, specialTreasureLists, new TreasureLocation(getCollectedDirectory(), IGUIConstants.TREASURES_FILE), - new TreasureLocation(getMapDefaultFolder(), null) + new TreasureLocation(globalSettings.getMapDefaultFolder(), null) ); recentManager.initRecent(); validators = createMapValidators(); @@ -506,13 +486,13 @@ new DoubleTypeChecker<GameObject, MapArchObject, Archetype>(), new DoubleLayerChecker<GameObject, MapArchObject, Archetype>(), new EmptySpawnPointChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT), - new ExitChecker(mapDir), + new ExitChecker(globalSettings.getMapDir()), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(), new MobOutsideSpawnPointChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_MOB), new SquareWithoutFloorChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_FLOOR, Archetype.TYPE_SHOP_FLOOR), new SlayingChecker<GameObject, MapArchObject, Archetype>(), new SysObjectNotOnLayerZeroChecker<GameObject, MapArchObject, Archetype>(), - new TilePathsChecker(mapDir), + new TilePathsChecker(globalSettings.getMapDir()), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(), new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER) ); @@ -670,33 +650,6 @@ mainView.openHelpWindow(); } - /** Set all global settings from the preferences. */ - private void readGlobalSettings() { - initDirs(); - - loadFromArchive = prefs.getBoolean(LOAD_ARCH_COLL, true); - - // docu version - if (IGUIConstants.DOCU_VERSION > prefs.getInt(DOCU_VERSION_KEY, 0)) { - // remember to open docu - autoPopupDocu = true; - // update docu version right now, because we want the help popup only one time - prefs.putInt(DOCU_VERSION_KEY, IGUIConstants.DOCU_VERSION); - } - } - - /** (Re-)initializes the directories. */ - public void initDirs() { - strMapDir = prefs.get(ResourceFileManager.MAP_DIR_KEY, ResourceFileManager.DEFAULT_MAP_DIR); - strArchDir = prefs.get(ResourceFileManager.ARCH_DIR_KEY, ResourceFileManager.DEFAULT_ARCH_DIR); - strScriptDir = prefs.get(ResourceFileManager.SCRIPT_DIR_KEY, ResourceFileManager.DEFAULT_SCRIPT_DIR); - strMediaDir = prefs.get(ResourceFileManager.MEDIA_DIR_KEY, ResourceFileManager.DEFAULT_MEDIA_DIR); - mapDir = new File(strMapDir); - if (currentDir.exists() && mapDir.getParent() == null && !mapDir.isAbsolute() && !hasChangedDir) { - mapDir = new File(currentDir.getAbsolutePath(), mapDir.getPath()); - } - } - /** Swing FileFilter for map files. */ private static final FileFilter mapFileFilter = new HideFileFilterProxy(MapFileFilter.getInstance()); @@ -718,16 +671,11 @@ public static final FileFilter unignoredFilter = new HideFileFilterProxy(new EndingFileFilter(true, ACTION_FACTORY.getString("fileDialog.filter.unignored"), "")); /** {@inheritDoc} */ - public String getMapDefaultFolder() { - return strMapDir; + public GlobalSettingsImpl getGlobalSettings() { + return globalSettings; } /** {@inheritDoc} */ - public String getArchDefaultFolder() { - return strArchDir; - } - - /** {@inheritDoc} */ public FileFilter getScriptFileFilter() { return luaFileFilter; } @@ -737,19 +685,6 @@ return ".lua"; } - /** {@inheritDoc} */ - public String getScriptDefaultFolder() { - return strScriptDir; - } - - public String getMediaDefaultFolder() { - return strMediaDir; - } - - public boolean isArchLoadedFromCollection() { - return loadFromArchive; - } - /** * Returns the main view. * @return the main view @@ -789,8 +724,8 @@ fileChooser.setMultiSelectionEnabled(true); fileChooser.addChoosableFileFilter(luaFileFilter); fileChooser.addChoosableFileFilter(mapFileFilter); - if (mapDir.exists()) { - fileChooser.setCurrentDirectory(mapDir); + if (globalSettings.getMapDir().exists()) { + fileChooser.setCurrentDirectory(globalSettings.getMapDir()); } attachToMapPreviewAccessory(fileChooser); } @@ -817,7 +752,7 @@ return; } - hasChangedDir = true; // user has chosen an active dir + globalSettings.setChangedDir(true); // user has chosen an active dir openFiles(fileChooser.getCurrentDirectory(), fileChooser.getSelectedFiles()); } } @@ -834,7 +769,7 @@ if (isScriptFile) { ScriptEditControl.getInstance().openScriptFile(file.getAbsolutePath()); } else { - currentDir = dir; + globalSettings.setCurrentDir(dir); getMapManager().openMapFileWithView(file, null); } } else if (!file.exists()) { @@ -896,10 +831,10 @@ fileChooser.setFileFilter(mapFileFilter); // default folder is the map-folder at first time, then the active folder - if (!hasChangedDir && mapDir.exists()) { - fileChooser.setCurrentDirectory(mapDir); - } else if (currentDir.exists()) { - fileChooser.setCurrentDirectory(currentDir); + if (!globalSettings.hasChangedDir() && globalSettings.getMapDir().exists()) { + fileChooser.setCurrentDirectory(globalSettings.getMapDir()); + } else if (globalSettings.getCurrentDir().exists()) { + fileChooser.setCurrentDirectory(globalSettings.getCurrentDir()); } // if file already exists, select it @@ -907,17 +842,17 @@ if (mapFile != null && mapFile.exists()) { fileChooser.setSelectedFile(mapFile); } else { - fileChooser.setSelectedFile(new File(mapDir, mapControl.getMapFileName())); + fileChooser.setSelectedFile(new File(globalSettings.getMapDir(), mapControl.getMapFileName())); } final int returnVal = fileChooser.showSaveDialog(mainView); if (returnVal == JFileChooser.APPROVE_OPTION) { - hasChangedDir = true; // user has chosen an active dir + globalSettings.setChangedDir(true); // user has chosen an active dir final File file = fileChooser.getSelectedFile(); if (!file.exists() || ACTION_FACTORY.showConfirmDialog(mainView, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_CANCEL_OPTION, "overwriteOtherFile", file.getName()) == JOptionPane.OK_OPTION) { mapControl.saveAs(file); - currentDir = fileChooser.getCurrentDirectory(); + globalSettings.setCurrentDir(fileChooser.getCurrentDirectory()); } return true; } else { @@ -927,13 +862,13 @@ /** {@inheritDoc} */ public void createImage(@NotNull final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { - if (strImageDir == null) { - strImageDir = mapDir.getAbsolutePath(); + if (globalSettings.getImageDir() == null) { + globalSettings.setImageDir(globalSettings.getMapDir().getAbsolutePath()); } - File file = new File(strImageDir, mapView.getMapControl().getMapFileName() + ".png"); + File file = new File(globalSettings.getImageDir(), mapView.getMapControl().getMapFileName() + ".png"); try { - final JFileChooser fileChooser = new JFileChooser(strImageDir); + final JFileChooser fileChooser = new JFileChooser(globalSettings.getImageDir()); fileChooser.setDialogTitle("Save Image As"); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setMultiSelectionEnabled(false); @@ -948,7 +883,7 @@ if (!file.getName().endsWith(".png")) { file = new File(file.getParentFile(), file.getName() + ".png"); } - strImageDir = file.getParentFile().getAbsolutePath(); + globalSettings.setImageDir(file.getParentFile().getAbsolutePath()); if (!file.exists() || ACTION_FACTORY.showConfirmDialog(mainView, JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, "overwriteOtherFile", file) == JOptionPane.YES_OPTION) { mapView.getView().getRenderer().printFullImage(file); } @@ -1095,11 +1030,6 @@ } /** {@inheritDoc} */ - @NotNull public File getMapDir() { - return mapDir; - } - - /** {@inheritDoc} */ public CFArchTypeList getTypeList() { return typeList; } @@ -1145,12 +1075,12 @@ /** {@inheritDoc} */ @NotNull public String getConfigurationDirectory() { - return getArchDefaultFolder() + "/dev/editor/conf"; + return globalSettings.getArchDefaultFolder() + "/dev/editor/conf"; } /** {@inheritDoc} */ @NotNull public String getCollectedDirectory() { - return getArchDefaultFolder(); + return globalSettings.getArchDefaultFolder(); } /** {@inheritDoc} */ Added: trunk/daimonin/src/daieditor/GlobalSettingsImpl.java =================================================================== --- trunk/daimonin/src/daieditor/GlobalSettingsImpl.java (rev 0) +++ trunk/daimonin/src/daieditor/GlobalSettingsImpl.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -0,0 +1,85 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package daieditor; + +import java.io.File; +import java.util.prefs.Preferences; +import net.sf.gridarta.MainControl; +import org.apache.log4j.Logger; + +/** + * Maintains path names to resources. + * @author Andreas Kirschbaum + */ +public class GlobalSettingsImpl extends net.sf.gridarta.GlobalSettingsImpl { + + private static final String DOCU_VERSION_KEY = "docuVersion"; + + /** The Logger for printing log messages. */ + private static final Logger log = Logger.getLogger(CMainControl.class); + + /** Preferences. */ + private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + + private String mediaDir; + + /** Time for an automated docu popup. */ + private boolean autoPopupDocu = false; + + public String getMediaDefaultFolder() { + return mediaDir; + } + + public boolean isAutoPopupDocu() { + return autoPopupDocu; + } + + public void setAutoPopupDocu(final boolean autoPopupDocu) { + this.autoPopupDocu = autoPopupDocu; + } + + /** Set all global settings from the preferences. */ + public void readGlobalSettings() { + initDirs(); + + setLoadFromArchive(prefs.getBoolean(LOAD_ARCH_COLL, true)); + + // docu version + if (IGUIConstants.DOCU_VERSION > prefs.getInt(DOCU_VERSION_KEY, 0)) { + // remember to open docu + autoPopupDocu = true; + // update docu version right now, because we want the help popup only one time + prefs.putInt(DOCU_VERSION_KEY, IGUIConstants.DOCU_VERSION); + } + } + + /** (Re-)initializes the directories. */ + public void initDirs() { + setMapDefaultFolder(prefs.get(ResourceFileManager.MAP_DIR_KEY, ResourceFileManager.DEFAULT_MAP_DIR)); + setArchDefaultFolder(prefs.get(ResourceFileManager.ARCH_DIR_KEY, ResourceFileManager.DEFAULT_ARCH_DIR)); + setScriptDefaultFolder(prefs.get(ResourceFileManager.SCRIPT_DIR_KEY, ResourceFileManager.DEFAULT_SCRIPT_DIR)); + mediaDir = prefs.get(ResourceFileManager.MEDIA_DIR_KEY, ResourceFileManager.DEFAULT_MEDIA_DIR); + setMapDir(new File(getMapDefaultFolder())); + if (getCurrentDir().exists() && getMapDir().getParent() == null && !getMapDir().isAbsolute() && !hasChangedDir()) { + setMapDir(new File(getCurrentDir().getAbsolutePath(), getMapDir().getPath())); + } + } + +} // class GlobalSettingsImpl Property changes on: trunk/daimonin/src/daieditor/GlobalSettingsImpl.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -321,7 +321,7 @@ @NotNull final File newfile; // new mapfile to open if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { // we have an absolute path: - newfile = new File(mainControl.getMapDir().getAbsolutePath(), path.substring(1)); + newfile = new File(mainControl.getGlobalSettings().getMapDir().getAbsolutePath(), path.substring(1)); } else { // we have a relative path: if (currentMap.getMapFile() == null) { Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -156,22 +156,22 @@ final List<GameObject> invObjects = new ArrayList<GameObject>(); final String fname; // here we go... - if (mainControl.isArchLoadedFromCollection()) { + if (mainControl.getGlobalSettings().isArchLoadedFromCollection()) { loadArchFromCollected(archetypeParser, invObjects); // load arches & images from collection fname = IGUIConstants.ARCH_FILE; } else { FaceObjects.setNormal(new ArchFaceProvider()); setLoadedFromArchive(false); // don't load from the collected files animFiles = new ArrayList<File>(); - addPNGFace(new File(mainControl.getArchDefaultFolder(), "dev/editor/bug.101.png").getAbsolutePath(), "bug.101.png"); - fname = mainControl.getArchDefaultFolder(); + addPNGFace(new File(mainControl.getGlobalSettings().getArchDefaultFolder(), "dev/editor/bug.101.png").getAbsolutePath(), "bug.101.png"); + fname = mainControl.getGlobalSettings().getArchDefaultFolder(); loadArchetypesFromFiles(archetypeParser, new File(fname), 0, "default", "default", false, invObjects); // load arches & images from individual files loadAnimsFromFiles(); } reportErrors(mainControl.getMainView()); loadArchesFromArtifacts(archetypeParser, mainControl.getCollectedDirectory() + "/" + IGUIConstants.ARTIFACTS_FILE, "Artifacts", "artifacts", invObjects); - loadArchesFromArtifacts(archetypeParser, mainControl.getMapDefaultFolder(), "Artifacts", "maps", invObjects); + loadArchesFromArtifacts(archetypeParser, mainControl.getGlobalSettings().getMapDefaultFolder(), "Artifacts", "maps", invObjects); mainControl.getGridartaObjectsFactory().newGameObjectParser().collectTempList(mainControl, invObjects, fname, true); connectFaces(); // attach faces to arches Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -118,7 +118,7 @@ */ public static String localizeEventPath(final File f) { final File localMapDir = AbstractMainControl.getInstance().getLocalMapDir(); - final File mapDir = new File(AbstractMainControl.getInstance().getMapDefaultFolder()); // global map directory + final File mapDir = new File(AbstractMainControl.getInstance().getGlobalSettings().getMapDefaultFolder()); // global map directory if (!mapDir.exists()) { log.warn("Map directory '" + mapDir.getAbsolutePath() + "' does not exist!"); @@ -306,7 +306,7 @@ String absScriptPath; if (scriptPath.startsWith("/")) { // script path is absolute - final File mapDir = new File(AbstractMainControl.getInstance().getMapDefaultFolder()); // global map directory + final File mapDir = new File(AbstractMainControl.getInstance().getGlobalSettings().getMapDefaultFolder()); // global map directory if (!mapDir.exists()) { // if map dir doesn't exist, this is not going to work frame.setVisible(false); Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -278,7 +278,7 @@ mapSound.setText(map.getBackgroundMusic()); final JPanel mapSoundPanel = new JPanel(new BorderLayout()); mapSoundPanel.add(mapSound); - mapSoundPanel.add(new JFileChooserButton(new File(mainControl.getMediaDefaultFolder()), mapSound, JFileChooser.FILES_ONLY), BorderLayout.EAST); + mapSoundPanel.add(new JFileChooserButton(new File(mainControl.getGlobalSettings().getMediaDefaultFolder()), mapSound, JFileChooser.FILES_ONLY), BorderLayout.EAST); mapPanel.add(mapSoundPanel, gbc); mapPanel.add(new JLabel(ACTION_FACTORY.getString("mapWidth")), labelGbc); Modified: trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -31,6 +31,7 @@ import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.border.TitledBorder; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.MainControl; import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.io.PathManager; @@ -101,18 +102,18 @@ prefs.put(ResourceFileManager.MAP_DIR_KEY, PathManager.path(mapField.getText())); prefs.put(ResourceFileManager.SCRIPT_DIR_KEY, PathManager.path(scriptField.getText())); prefs.put(ResourceFileManager.MEDIA_DIR_KEY, PathManager.path(mediaField.getText())); - prefs.putBoolean(CMainControl.LOAD_ARCH_COLL, loadArches.isSelected()); - mainControl.initDirs(); + prefs.putBoolean(GlobalSettings.LOAD_ARCH_COLL, loadArches.isSelected()); + mainControl.getGlobalSettings().initDirs(); ACTION_FACTORY.showOnetimeMessageDialog(this, JOptionPane.WARNING_MESSAGE, "optionsRestart"); } /** {@inheritDoc} */ public void revert() { - archField.setText(mainControl.getArchDefaultFolder()); - mapField.setText(mainControl.getMapDefaultFolder()); - scriptField.setText(mainControl.getScriptDefaultFolder()); - mediaField.setText(mainControl.getMediaDefaultFolder()); - loadArches.setSelected(mainControl.isArchLoadedFromCollection()); + archField.setText(mainControl.getGlobalSettings().getArchDefaultFolder()); + mapField.setText(mainControl.getGlobalSettings().getMapDefaultFolder()); + scriptField.setText(mainControl.getGlobalSettings().getScriptDefaultFolder()); + mediaField.setText(mainControl.getGlobalSettings().getMediaDefaultFolder()); + loadArches.setSelected(mainControl.getGlobalSettings().isArchLoadedFromCollection()); } /** {@inheritDoc} */ @@ -126,11 +127,11 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - archField.getText().equals(mainControl.getArchDefaultFolder()) - && mapField.getText().equals(mainControl.getMapDefaultFolder()) - && scriptField.getText().equals(mainControl.getScriptDefaultFolder()) - && mediaField.getText().equals(mainControl.getMediaDefaultFolder()) - && loadArches.isSelected() == prefs.getBoolean(CMainControl.LOAD_ARCH_COLL, mainControl.isArchLoadedFromCollection()) + archField.getText().equals(mainControl.getGlobalSettings().getArchDefaultFolder()) + && mapField.getText().equals(mainControl.getGlobalSettings().getMapDefaultFolder()) + && scriptField.getText().equals(mainControl.getGlobalSettings().getScriptDefaultFolder()) + && mediaField.getText().equals(mainControl.getGlobalSettings().getMediaDefaultFolder()) + && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, mainControl.getGlobalSettings().isArchLoadedFromCollection()) ); } @@ -157,10 +158,10 @@ private Component createResourcePanel() { final Box resourcePanel = Box.createVerticalBox(); resourcePanel.setBorder(createTitledBorder("optionsResPaths")); - archField = createFileField(resourcePanel, "optionsResArch", mainControl.getArchDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); - mapField = createFileField(resourcePanel, "optionsResMaps", mainControl.getMapDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); - scriptField = createFileField(resourcePanel, "optionsResScripts", mainControl.getScriptDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); - mediaField = createFileField(resourcePanel, "optionsResMedia", mainControl.getMediaDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + archField = createFileField(resourcePanel, "optionsResArch", mainControl.getGlobalSettings().getArchDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + mapField = createFileField(resourcePanel, "optionsResMaps", mainControl.getGlobalSettings().getMapDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + scriptField = createFileField(resourcePanel, "optionsResScripts", mainControl.getGlobalSettings().getScriptDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + mediaField = createFileField(resourcePanel, "optionsResMedia", mainControl.getGlobalSettings().getMediaDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); return resourcePanel; } @@ -173,9 +174,9 @@ globalPanel.setBorder(createTitledBorder("optionsGlobal")); loadArches = new JCheckBox(ACTION_FACTORY.createToggle(false, "optionsLoadArchColl", this)); - loadArches.setSelected(mainControl.isArchLoadedFromCollection()); + loadArches.setSelected(mainControl.getGlobalSettings().isArchLoadedFromCollection()); globalPanel.add(loadArches); - if (mainControl.isArchLoadedFromCollection()) { + if (mainControl.getGlobalSettings().isArchLoadedFromCollection()) { archField.setEnabled(false); } return globalPanel; Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-05-07 23:05:04 UTC (rev 3977) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-05-08 19:01:43 UTC (rev 3978) @@ -29,7 +29,6 @@ import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.updater.UpdaterManager; @@ -74,15 +73,6 @@ /** MapPreviewAccessory. */ private MapPreviewAccessory mapPreviewAccessory; - /** The current main directory. */ - protected File currentDir; - - /** - * Indicates whether the user has ever changed the active directory since - * the program started. - */ - protected boolean hasChangedDir = false; - /** The autojoin lists. */ private final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(); @@ -101,8 +91,6 @@ mapManager = new DefaultMapManager<G, A, R, C, V>(this, key); this.gridartaObjectsFactory = gridartaObjectsFactory; setInstance(this); - PathManager.setMainControl(this); - currentDir = new File(System.getProperty("user.dir")); } /** @@ -223,13 +211,13 @@ public File getLocalMapDir() { final MapControl<G, A, R> mapControl = getMapManager().getCurrentMap(); if (mapControl == null) { - return getMapDir(); + return getGlobalSettings().getMapDir(); } final File mapFile = mapControl.getMapFile(); if (mapFile == null) { ACTION_FACTORY.showMessageDialog(getMainView(), "createNewEventNoMapPath"); - return getMapDir(); + return getGlobalSettings().getMapDir(); } return mapFile.getParentFile(); Added: trunk/src/app/net/... [truncated message content] |
From: <aki...@us...> - 2008-05-16 18:40:27
|
Revision: 3979 http://gridarta.svn.sourceforge.net/gridarta/?rev=3979&view=rev Author: akirschbaum Date: 2008-05-16 11:40:33 -0700 (Fri, 16 May 2008) Log Message: ----------- Add GridartaObjectsFactory.newMapView(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-05-08 19:01:43 UTC (rev 3978) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-05-16 18:40:33 UTC (rev 3979) @@ -28,6 +28,7 @@ import cfeditor.io.MapArchObjectParser; import cfeditor.map.MapArchObject; import cfeditor.map.MapControl; +import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; import java.util.List; @@ -38,9 +39,11 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; import net.sf.gridarta.map.MapModel; +import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -51,6 +54,9 @@ */ public class CrossfireObjectsFactory implements GridartaObjectsFactory<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { + /** The action factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); @@ -103,4 +109,9 @@ return new SimpleLevelRenderer(mapModel, archetypeSet); } + /** {@inheritDoc} */ + @NotNull public MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapView(@NotNull final MapControl mapControl, @Nullable final Point viewPosition, final int viewCounter) { + return new MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition), ACTION_FACTORY); + } + } // class CrossfireObjectsFactory Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2008-05-08 19:01:43 UTC (rev 3978) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2008-05-16 18:40:33 UTC (rev 3979) @@ -28,7 +28,6 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.map.AbstractMapControl; -import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -65,7 +64,7 @@ /** {@inheritDoc} */ @NotNull @Override protected MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapView(@Nullable final Point viewPosition) { - return new MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(mainControl, this, ++viewCounter, new CMapViewBasic(mainControl, this, viewPosition), ActionFactory.getFactory("cfeditor")); + return mainControl.getGridartaObjectsFactory().newMapView(this, viewPosition, ++viewCounter); } } // class MapControl Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-05-08 19:01:43 UTC (rev 3978) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-05-16 18:40:33 UTC (rev 3979) @@ -28,6 +28,7 @@ import daieditor.io.MapArchObjectParser; import daieditor.map.MapArchObject; import daieditor.map.MapControl; +import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; import java.util.List; @@ -38,9 +39,11 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; import net.sf.gridarta.map.MapModel; +import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -51,6 +54,9 @@ */ public class DaimoninObjectsFactory implements GridartaObjectsFactory<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { + /** The action factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); @@ -103,4 +109,9 @@ return new SimpleLevelRenderer(mapModel); } + /** {@inheritDoc} */ + @NotNull public MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapView(@NotNull final MapControl mapControl, @Nullable final Point viewPosition, final int viewCounter) { + return new MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition), ACTION_FACTORY); + } + } // class DaimoninObjectsFactory Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2008-05-08 19:01:43 UTC (rev 3978) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2008-05-16 18:40:33 UTC (rev 3979) @@ -28,7 +28,6 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.map.AbstractMapControl; -import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -65,7 +64,7 @@ /** {@inheritDoc} */ @NotNull @Override protected MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapView(@Nullable final Point viewPosition) { - return new MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(mainControl, this, ++viewCounter, new CMapViewBasic(mainControl, this, viewPosition), ActionFactory.getFactory("daieditor")); + return mainControl.getGridartaObjectsFactory().newMapView(this, viewPosition, ++viewCounter); } } // class MapControl Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-05-08 19:01:43 UTC (rev 3978) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-05-16 18:40:33 UTC (rev 3979) @@ -19,6 +19,7 @@ package net.sf.gridarta; +import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; import java.util.List; @@ -26,6 +27,7 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.io.MapArchObjectParser; @@ -122,4 +124,14 @@ */ @NotNull LevelRenderer newSimpleLevelRenderer(@NotNull MapModel<G, A, R> mapModel, @NotNull ArchetypeSet<G, A, R> archetypeSet); + /** + * Creates a new map view instance for a map control. + * @param mapControl the map control + * @param viewPosition the initiali view position; may be + * <code>null</code> for default + * @param viewCounter the view counter + * @return the new map view + */ + @NotNull MapView<G, A, R, C, V> newMapView(@NotNull C mapControl, @Nullable Point viewPosition, int viewCounter); + } // interface GridartaObjectsFactory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-16 19:40:04
|
Revision: 3980 http://gridarta.svn.sourceforge.net/gridarta/?rev=3980&view=rev Author: akirschbaum Date: 2008-05-16 12:39:58 -0700 (Fri, 16 May 2008) Log Message: ----------- Add even more type parameters. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/ObjectChooser.java trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/gui/ObjectChooser.java trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/CopyBuffer.java trunk/src/app/net/sf/gridarta/CurrentMapListener.java trunk/src/app/net/sf/gridarta/DefaultMapManager.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/MapImageCache.java trunk/src/app/net/sf/gridarta/MapManager.java trunk/src/app/net/sf/gridarta/MapManagerListener.java trunk/src/app/net/sf/gridarta/floodfill/Floodfill.java trunk/src/app/net/sf/gridarta/gui/AbstractObjectChooser.java trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java trunk/src/app/net/sf/gridarta/gui/ErrorListView.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/MapManagerActions.java trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionControl.java trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionView.java trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsControl.java trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsView.java trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterControl.java trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterView.java trunk/src/app/net/sf/gridarta/gui/connectionview/View.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/GoLocationDialogManager.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java trunk/src/app/net/sf/gridarta/gui/map/MapView.java trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapFolderDialog.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/CurrentPickmapActions.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListAction.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListActions.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListener.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Model.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/ModelListener.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserView.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapSelectionListener.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapTileSelection.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapTileSelectionCache.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/gui/undo/UndoControl.java trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java trunk/src/app/net/sf/gridarta/map/AutoValidator.java trunk/src/app/net/sf/gridarta/map/AutoValidatorProcessor.java trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java trunk/src/app/net/sf/gridarta/map/MapControl.java trunk/src/app/net/sf/gridarta/map/MapModel.java Modified: trunk/crossfire/src/cfeditor/gui/ObjectChooser.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/ObjectChooser.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/crossfire/src/cfeditor/gui/ObjectChooser.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -53,7 +53,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public final class ObjectChooser extends AbstractObjectChooser<GameObject, MapArchObject, Archetype> implements net.sf.gridarta.gui.ObjectChooser<GameObject, MapArchObject, Archetype> { +public final class ObjectChooser extends AbstractObjectChooser<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> implements net.sf.gridarta.gui.ObjectChooser<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { private static final String ARCHPANEL_LOCATION_KEY = "MainWindowArchPanel.dividerLocation"; Modified: trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -52,7 +52,7 @@ private final CMainControl mainControl; - private final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser; + private final ObjectChooser<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> objectChooser; private final SelectedSquareView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> selectedSquareView; @@ -62,7 +62,7 @@ @NotNull private final CMapViewBasic mapView; - public MapUserListener(final CMainControl mainControl, final MapControl mapControl, final CMapViewBasic mapView, final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, final SelectedSquareView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> selectedSquareView, final PickmapChooserControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> pickmapChooserControl) { + public MapUserListener(final CMainControl mainControl, final MapControl mapControl, final CMapViewBasic mapView, final ObjectChooser<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> objectChooser, final SelectedSquareView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> selectedSquareView, final PickmapChooserControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> pickmapChooserControl) { this.mainControl = mainControl; this.mapControl = mapControl; this.mapView = mapView; Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -37,7 +37,7 @@ * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public final class MapControl extends AbstractMapControl<GameObject, MapArchObject, Archetype> { +public final class MapControl extends AbstractMapControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { /** * The main controller of this subcontroller. Modified: trunk/daimonin/src/daieditor/gui/ObjectChooser.java =================================================================== --- trunk/daimonin/src/daieditor/gui/ObjectChooser.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/daimonin/src/daieditor/gui/ObjectChooser.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -50,7 +50,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public final class ObjectChooser extends AbstractObjectChooser<GameObject, MapArchObject, Archetype> implements net.sf.gridarta.gui.ObjectChooser<GameObject, MapArchObject, Archetype> { +public final class ObjectChooser extends AbstractObjectChooser<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> implements net.sf.gridarta.gui.ObjectChooser<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); Modified: trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -38,13 +38,13 @@ /** * The object chooser to update. */ - @NotNull private final ObjectChooser<GameObject, ?, ?> objectChooser; + @NotNull private final ObjectChooser<GameObject, ?, ?, ?, ?> objectChooser; /** * Create a BasicAbstractTool. * @param objectChooser the object chooser to update */ - public SelectionTool(@NotNull final ObjectChooser<GameObject, ?, ?> objectChooser) { + public SelectionTool(@NotNull final ObjectChooser<GameObject, ?, ?, ?, ?> objectChooser) { super("selection"); this.objectChooser = objectChooser; } Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -37,7 +37,7 @@ * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public final class MapControl extends AbstractMapControl<GameObject, MapArchObject, Archetype> { +public final class MapControl extends AbstractMapControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { /** * The main controller of this subcontroller. Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -41,7 +41,7 @@ * MainControl is a central class that's used for access on global data structures / collections and global functions. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public abstract class AbstractMainControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> implements MainControl<G, A, R, C, V> { +public abstract class AbstractMainControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> implements MainControl<G, A, R, C, V> { /** Preferences key for username. */ public static final String PREFS_USERNAME = "username"; @@ -209,7 +209,7 @@ /** {@inheritDoc} */ public File getLocalMapDir() { - final MapControl<G, A, R> mapControl = getMapManager().getCurrentMap(); + final MapControl<G, A, R, C, V> mapControl = getMapManager().getCurrentMap(); if (mapControl == null) { return getGlobalSettings().getMapDir(); } Modified: trunk/src/app/net/sf/gridarta/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -45,7 +45,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public final class CopyBuffer<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public final class CopyBuffer<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** Mode for operations. */ protected enum Mode { Modified: trunk/src/app/net/sf/gridarta/CurrentMapListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/CurrentMapListener.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/CurrentMapListener.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -35,7 +35,7 @@ * Encapsulates common code for listening for current map changes. * @author Andreas Kirschbaum */ -public abstract class CurrentMapListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public abstract class CurrentMapListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** * The main control. Modified: trunk/src/app/net/sf/gridarta/DefaultMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -45,7 +45,7 @@ * Manages all opened maps. * @author Andreas Kirschbaum */ -public class DefaultMapManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> implements MapManager<G, A, R, C, V> { +public class DefaultMapManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> implements MapManager<G, A, R, C, V> { /** Action Factory. */ private final ActionFactory actionFactory; Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -43,7 +43,7 @@ * * @author Andreas Kirschbaum */ -public interface GridartaObjectsFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public interface GridartaObjectsFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** * Create a new {@link MapArchObject} instance. Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -50,7 +50,7 @@ * It should become obsolete after a while. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface MainControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public interface MainControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** Preferences key for language. */ String PREFS_LANGUAGE = "language"; @@ -295,7 +295,7 @@ * Return the insertion object chooser. * @return the insertion object chooser */ - ObjectChooser<G, A, R> getObjectChooser(); + ObjectChooser<G, A, R, C, V> getObjectChooser(); /** * Return the Selected Square Control. Modified: trunk/src/app/net/sf/gridarta/MapImageCache.java =================================================================== --- trunk/src/app/net/sf/gridarta/MapImageCache.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/MapImageCache.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -44,7 +44,7 @@ * @author Andreas Kirschbaum * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class MapImageCache<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public class MapImageCache<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(MapImageCache.class); @@ -282,7 +282,7 @@ * * @return the image */ - @NotNull public ImageIcon updateCaches(@Nullable final File mapFile, @NotNull final MapControl<G, A, R> mapControl, final Type type) { + @NotNull public ImageIcon updateCaches(@Nullable final File mapFile, @NotNull final MapControl<G, A, R, C, V> mapControl, final Type type) { final BufferedImage fullImage; final ImageIcon[] images = new ImageIcon[2]; try { Modified: trunk/src/app/net/sf/gridarta/MapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/MapManager.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/MapManager.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -36,7 +36,7 @@ * A MapManager manages all opened maps. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface MapManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public interface MapManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** * Calculate a new type for all opened maps. Modified: trunk/src/app/net/sf/gridarta/MapManagerListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/MapManagerListener.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/MapManagerListener.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -44,7 +44,7 @@ * </ul> * @author Andreas Kirschbaum */ -public interface MapManagerListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends EventListener { +public interface MapManagerListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends EventListener { /** * This event handler is called when the current map has changed. Modified: trunk/src/app/net/sf/gridarta/floodfill/Floodfill.java =================================================================== --- trunk/src/app/net/sf/gridarta/floodfill/Floodfill.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/floodfill/Floodfill.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -48,7 +48,7 @@ * </ul> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class Floodfill<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>> { +public class Floodfill<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, ?>> { /** Constants for lookArea. */ private static final byte NOT_LOOKED_AT = (byte) 0; Modified: trunk/src/app/net/sf/gridarta/gui/AbstractObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/AbstractObjectChooser.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/AbstractObjectChooser.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -24,7 +24,9 @@ import javax.swing.JPanel; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.MapControl; import org.jetbrains.annotations.Nullable; /** @@ -32,7 +34,7 @@ * * @author Andreas Kirschbaum */ -public abstract class AbstractObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JPanel implements ObjectChooser<G, A, R> { +public abstract class AbstractObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends JPanel implements ObjectChooser<G, A, R, C, V> { /** * <code>true</code> if the PickmapChooser is active, <code>false</code> if Modified: trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -39,7 +39,7 @@ * * @author Andreas Kirschbaum */ -public class ArchetypesActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public class ArchetypesActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); @@ -84,7 +84,7 @@ * * @param archTypeList the instance for looking up archetype types */ - public ArchetypesActions(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R, C, V> archetypeChooserControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ObjectChooser<G, A, R> objectChooser, final CFArchTypeList archTypeList) { + public ArchetypesActions(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R, C, V> archetypeChooserControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ObjectChooser<G, A, R, C, V> objectChooser, final CFArchTypeList archTypeList) { findArchetypesDialog = new FindArchetypesDialog(parent, archetypeSet, objectChooser, archTypeList); aDisplayObjectNames = (ToggleAction) ACTION_FACTORY.createToggle(true, "displayObjectNames", archetypeChooserControl); ACTION_FACTORY.createAction(true, "findArchetypes", findArchetypesDialog); Modified: trunk/src/app/net/sf/gridarta/gui/ErrorListView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ErrorListView.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/ErrorListView.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -55,7 +55,7 @@ * An ErrorPanel displays errors to the user. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public final class ErrorListView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends JPanel { +public final class ErrorListView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends JPanel { /** The serial version UID. */ private static final long serialVersionUID = 1; Modified: trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -73,7 +73,7 @@ * Common base class for the panel that allows users to edit a GameObject's attributes. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public abstract class GameObjectAttributesPanel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends JPanel { +public abstract class GameObjectAttributesPanel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends JPanel { // constants for the 'task' parameter in editScriptWanted() public static final int SCRIPT_OPEN = 0; Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -56,7 +56,7 @@ * Encapsulates actions and related functions. * @author Andreas Kirschbaum */ -public final class MainActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public final class MainActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** The MainControl. */ private final MainControl<G, A, R, C, V> mainControl; Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -46,7 +46,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @todo shouldn't extend JFrame */ -public abstract class MainView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends JFrame { +public abstract class MainView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends JFrame { /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(MainView.class); Modified: trunk/src/app/net/sf/gridarta/gui/MapManagerActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MapManagerActions.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/MapManagerActions.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -33,7 +33,7 @@ * Manages actions related to the {@link MapManager} instance. * @author Andreas Kirschbaum */ -public class MapManagerActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public class MapManagerActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); Modified: trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -37,7 +37,7 @@ * The ObjectChoiceDisplay shows quick information about the chose object from the Object Chooser. * @author <a href="mailto:mic...@no...">Michael Toennies</a> */ -public final class ObjectChoiceDisplay<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends JPanel { +public final class ObjectChoiceDisplay<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends JPanel { /** Serial Version UID. */ private static final long serialVersionUID = 1L; Modified: trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -34,7 +34,7 @@ * Common base interface for ObjectChoosers. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public interface ObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public interface ObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** * Return if the Pickmap Chooser is active. @@ -95,7 +95,7 @@ * * @return the pickmap chooser control */ - @NotNull <C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> PickmapChooserControl<G, A, R, C, V> getPickmapChooserControl(); + @NotNull PickmapChooserControl<G, A, R, C, V> getPickmapChooserControl(); /** * Select an archetype in the archetype chooser. If necessary, activates @@ -110,6 +110,6 @@ * * @return the archetype chooser control */ - @NotNull <C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> ArchetypeChooserControl<G, A, R, C, V> getArchetypeChooserControl(); + @NotNull ArchetypeChooserControl<G, A, R, C, V> getArchetypeChooserControl(); } // interface ObjectChooser Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -54,7 +54,7 @@ * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian.Hujer</a> */ -public final class ReplaceDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends JOptionPane { +public final class ReplaceDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends JOptionPane { /** Serial Version UID. */ private static final long serialVersionUID = 1L; @@ -125,7 +125,7 @@ return instance != null && instance.isBuilt; } - public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> ReplaceDialog<G, A, R, C, V> getInstance(@NotNull final MainControl<G, A, R, C, V> mainControl) { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> ReplaceDialog<G, A, R, C, V> getInstance(@NotNull final MainControl<G, A, R, C, V> mainControl) { if (instance == null) { instance = new ReplaceDialog<G, A, R, C, V>(mainControl); } Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -49,7 +49,7 @@ * * @author Andreas Kirschbaum */ -public class ArchetypeChooserControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public class ArchetypeChooserControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -53,7 +53,7 @@ * Common base class for the panel for Archetypes. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class ArchetypePanel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends JPanel { +public class ArchetypePanel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends JPanel { /** Serial Version UID. */ private static final long serialVersionUID = 1L; Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionControl.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionControl.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -32,7 +32,7 @@ * * @author Andreas Kirschbaum */ -public class ConnectionControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends Control<Integer, G, A, R, C, V> { +public class ConnectionControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends Control<Integer, G, A, R, C, V> { /** * Create a new instance. Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionView.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionView.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -34,7 +34,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public final class ConnectionView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends View<Integer, G, A, R, C, V> { +public final class ConnectionView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends View<Integer, G, A, R, C, V> { /** The serial version UID. */ private static final long serialVersionUID = 1; Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -39,7 +39,7 @@ * * @author Andreas Kirschbaum */ -public abstract class Control<K, G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public abstract class Control<K, G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** The view for this controller. */ @NotNull private final View<K, G, A, R, C, V> view; Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsControl.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsControl.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -32,7 +32,7 @@ * * @author Andreas Kirschbaum */ -public class LockedItemsControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends Control<String, G, A, R, C, V> { +public class LockedItemsControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends Control<String, G, A, R, C, V> { /** * Create a new instance. Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsView.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsView.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -36,7 +36,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public final class LockedItemsView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends View<String, G, A, R, C, V> { +public final class LockedItemsView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends View<String, G, A, R, C, V> { /** The serial version UID. */ private static final long serialVersionUID = 1; Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterControl.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterControl.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -33,7 +33,7 @@ * * @author Andreas Kirschbaum */ -public class MonsterControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends Control<String, G, A, R, C, V> { +public class MonsterControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends Control<String, G, A, R, C, V> { /** * Create a new instance. Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterView.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterView.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -35,7 +35,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public final class MonsterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends View<String, G, A, R, C, V> { +public final class MonsterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends View<String, G, A, R, C, V> { /** The serial version UID. */ private static final long serialVersionUID = 1; Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/View.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/View.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/View.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -57,7 +57,7 @@ * @todo attach * @serial exclude */ -public abstract class View<K, G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends JPanel { +public abstract class View<K, G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends JPanel { /** The connections. */ private final Map<K, Connection<K>> connections = new TreeMap<K, Connection<K>>(); Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -60,7 +60,7 @@ * * @author Andreas Kirschbaum */ -public final class FindArchetypesDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public final class FindArchetypesDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** * Do not perform an auto-search until the input name reaches this length. @@ -81,7 +81,7 @@ /** * The insertion object chooser to use when selecing search results. */ - private final ObjectChooser<G, A, R> objectChooser; + private final ObjectChooser<G, A, R, C, V> objectChooser; /** * The name input field. @@ -154,7 +154,7 @@ * * @param archTypeList the instance for looking up archetype types */ - public FindArchetypesDialog(final Component parent, final ArchetypeSet<G, A, R> archetypeSet, final ObjectChooser<G, A, R> objectChooser, final CFArchTypeList archTypeList) { + public FindArchetypesDialog(final Component parent, final ArchetypeSet<G, A, R> archetypeSet, final ObjectChooser<G, A, R, C, V> objectChooser, final CFArchTypeList archTypeList) { this.archetypeSet = archetypeSet; this.objectChooser = objectChooser; Modified: trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -67,7 +67,7 @@ private final MainControl<?, A, ?, ?, ?> mainControl; /** The mapControl of the map in context. */ - private MapControl<?, A, ?> mapControl; + private MapControl<?, A, ?, ?, ?> mapControl; /** The MapArchObject to show. */ private A map; @@ -126,7 +126,7 @@ * @param mainControl MainControl to use for displaying dialogs, getting paths etc.. * @param mapControl MapControl of the map that's tiles are to be viewed / controlled */ - protected AbstractMapTilePane(final MainControl<?, A, ?, ?, ?> mainControl, final MapControl<?, A, ?> mapControl, final int[][][] tileLink, final DirectionLayout.Direction[] directionMapping, final int[] nextFocus) { + protected AbstractMapTilePane(final MainControl<?, A, ?, ?, ?> mainControl, final MapControl<?, A, ?, ?, ?> mapControl, final int[][][] tileLink, final DirectionLayout.Direction[] directionMapping, final int[] nextFocus) { this(mainControl, tileLink, directionMapping, nextFocus); setMapControl(mapControl); } @@ -135,7 +135,7 @@ * Sets the mapControl for this MapTilePane. * @param mapControl MapControl of the map that's tiles are to be viewed / controlled */ - public void setMapControl(final MapControl<?, A, ?> mapControl) { + public void setMapControl(final MapControl<?, A, ?, ?, ?> mapControl) { this.mapControl = mapControl; map = mapControl.getMapModel().getMapArchObject(); final File mapDir = mainControl.getGlobalSettings().getMapDir(); @@ -279,7 +279,7 @@ /* run through all loaded maps and see we have a map with this path * if unsaved, ask for stop or autosave */ - final MapControl<?, A, ?> level = mainControl.getMapManager().getMapIfOpened(mapPath); + final MapControl<?, A, ?, ?, ?> level = mainControl.getMapManager().getMapIfOpened(mapPath); if (level != null) { // opened map in the editor ! if (!ACTION_FACTORY.showQuestionDialog(this, "mapQueryLoaded")) { return; @@ -316,7 +316,7 @@ /* run through all loaded maps and see we have a map with this path * if unsaved, ask for stop or autosave */ - final MapControl<?, A, ?> level = mainControl.getMapManager().getMapIfOpened(mapPath); + final MapControl<?, A, ?, ?, ?> level = mainControl.getMapManager().getMapIfOpened(mapPath); if (level != null) { // opened map in the editor ! if (!ACTION_FACTORY.showQuestionDialog(this, "mapQueryLoaded", level.getMapFileName())) { return; @@ -564,7 +564,7 @@ private final StringBuilder maptail; - private MapControl<?, ?, ?> map; // map loaded in editor + private MapControl<?, ?, ?, ?, ?> map; // map loaded in editor TileMapHeader(final MapArchObject<?> mapArchObject) { this.mapArchObject = mapArchObject; Modified: trunk/src/app/net/sf/gridarta/gui/map/GoLocationDialogManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/GoLocationDialogManager.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/map/GoLocationDialogManager.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -36,7 +36,7 @@ * * @author Andreas Kirschbaum */ -public final class GoLocationDialogManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public final class GoLocationDialogManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** Dialog for each map view. */ private final Map<MapView<G, A, R, C, V>, GoLocationDialog> dialogs = new HashMap<MapView<G, A, R, C, V>, GoLocationDialog>(); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -36,7 +36,7 @@ * Encapsulates actions used by {@link MapCursorControl}. * @author Andreas Kirschbaum */ -public class MapCursorActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public class MapCursorActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** Action Factory to create Actions. */ private final ActionFactory actionFactory; Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -38,7 +38,7 @@ * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> * @author Andreas Kirschbaum */ -public class MapCursorControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public class MapCursorControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** The MainControl. */ private final MainControl<G, A, R, C, V> mainControl; Modified: trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -37,7 +37,7 @@ * * @author Andreas Kirschbaum */ -public class MapFileActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public class MapFileActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** Action Factory to create Actions. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -49,7 +49,7 @@ * * @author Andreas Kirschbaum */ -public class MapView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends JInternalFrame { +public class MapView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends JInternalFrame { /** The serial version UID. */ private static final long serialVersionUID = 1; Modified: trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -58,7 +58,7 @@ * Creates a MapViewBasic. * @param mapControl MapControl to use. */ - protected MapViewBasic(@NotNull final MapControl<G, A, R> mapControl) { + protected MapViewBasic(@NotNull final MapControl<G, A, R, ?, ?> mapControl) { super(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); mapModel = mapControl.getMapModel(); mapGrid = new MapGrid(mapModel.getMapSize()); Modified: trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -44,7 +44,7 @@ * Manages edit type actions in "view" menu. * @author Andreas Kirschbaum */ -public class ViewActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public class ViewActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** Action Factory to create Actions. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); Modified: trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -32,7 +32,7 @@ /** Action class for selecting this window. * @author Andreas Kirschbaum */ -public final class WindowAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends AbstractAction { +public final class WindowAction<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends AbstractAction { /** The serial version UID. */ private static final long serialVersionUID = 1; Modified: trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -38,7 +38,7 @@ * supporting map size input fields. * @author Andreas Kirschbaum */ -public abstract class AbstractMapsizeNewMapDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends AbstractNewMapDialog<G, A, R, C, V> { +public abstract class AbstractMapsizeNewMapDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends AbstractNewMapDialog<G, A, R, C, V> { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); Modified: trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -52,7 +52,7 @@ * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public abstract class AbstractNewMapDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends JOptionPane { +public abstract class AbstractNewMapDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends JOptionPane { /** Serial Version UID. */ private static final long serialVersionUID = 1L; Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -39,7 +39,7 @@ * Dialog to create a new map file. * @author Andreas Kirschbaum */ -public final class NewMapDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends AbstractMapsizeNewMapDialog<G, A, R, C, V> { +public final class NewMapDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> extends AbstractMapsizeNewMapDialog<G, A, R, C, V> { /** The key used to store the last used level width in preferences. */ private static final String DEFAULT_LEVEL_WIDTH_KEY = "NewLevelDialog.mapWidth"; Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -35,7 +35,7 @@ * * @author Andreas Kirschbaum */ -public final class NewMapDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> { +public final class NewMapDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R, C, V>, V extends MapViewBasic<G, A, R>> { /** * The main control instance. Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java 2008-05-16 18:40:33 UTC (rev 3979) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java 2008-05-16 19:39:58 UTC (rev 3980) @@ -37,7 +37,7 @@ * Dialog to create a new pickmap file. * @author Andreas Kirschbaum */ -public final class NewPickmapDialog<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, C extends MapControl<G, A, R>, V extends MapViewBasic<G, A, R>> extends AbstractMapsizeNewMapDialog<G, A, R, C,... [truncated message content] |
From: <aki...@us...> - 2008-05-16 19:45:15
|
Revision: 3981 http://gridarta.svn.sourceforge.net/gridarta/?rev=3981&view=rev Author: akirschbaum Date: 2008-05-16 12:44:57 -0700 (Fri, 16 May 2008) Log Message: ----------- Remove superfluous casts. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-05-16 19:39:58 UTC (rev 3980) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-05-16 19:44:57 UTC (rev 3981) @@ -536,7 +536,7 @@ * because we have a better interface in the gameObject panel. * But we need to add when needed the gameObject text - we do it here. */ - if (gameObject.getDirection() != ((GameObject) archetype).getDirection()) { + if (gameObject.getDirection() != archetype.getDirection()) { newArchText.append("direction ").append(gameObject.getDirection()).append("\n"); } // before we modify the archtext, we look for errors and save them. Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-05-16 19:39:58 UTC (rev 3980) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-05-16 19:44:57 UTC (rev 3981) @@ -1023,7 +1023,7 @@ JOptionPane.showMessageDialog(mainView, "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); return; } - final CMapViewBasic view = (CMapViewBasic) currentMap.getMapViewFrame().getView(); + final CMapViewBasic view = currentMap.getMapViewFrame().getView(); ((DefaultLevelRenderer) view.getRenderer()).setPaintOnlyMap(true); new CPreview(view.getRenderer().getFullImage()); ((DefaultLevelRenderer) view.getRenderer()).setPaintOnlyMap(false); Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-05-16 19:39:58 UTC (rev 3980) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java 2008-05-16 19:44:57 UTC (rev 3981) @@ -469,7 +469,7 @@ * because we have a better interface in the gameObject panel. * But we need to add when needed the gameObject text - we do it here. */ - if (gameObject.getDirection() != ((GameObject) archetype).getDirection()) { + if (gameObject.getDirection() != archetype.getDirection()) { newArchText.append("direction ").append(gameObject.getDirection()).append("\n"); } // before we modify the archtext, we look for errors and save them. Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-05-16 19:39:58 UTC (rev 3980) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-05-16 19:44:57 UTC (rev 3981) @@ -491,7 +491,7 @@ if (arch != null) { title.append("with arch ").append(arch.getArchetypeName()); } else { - pickmap = (C) mainControl.getObjectChooser().getPickmapChooserControl().getCurrentPickmap(); + pickmap = mainControl.getObjectChooser().getPickmapChooserControl().getCurrentPickmap(); if (pickmap != null) { title.append("with pickmap ").append(pickmap.getMapModel().getMapArchObject().getMapName()); } else { // ok ,we have a problem here: arch == null, pickmap == null... @@ -517,7 +517,7 @@ if (rand < 1 || rand > 100) { JOptionPane.showMessageDialog(mainControl.getMainView(), "The fill density must be between 1-100.", "Illegal Value.", JOptionPane.ERROR_MESSAGE); } else { - mainControl.getCopyBuffer().fill(mapView, fillBelow, pickmap == null ? null : (MapView<G, A, R, C, V>) pickmap.getMapViewFrame(), rand); + mainControl.getCopyBuffer().fill(mapView, fillBelow, pickmap == null ? null : pickmap.getMapViewFrame(), rand); break; } } Modified: trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java 2008-05-16 19:39:58 UTC (rev 3980) +++ trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java 2008-05-16 19:44:57 UTC (rev 3981) @@ -435,7 +435,7 @@ * @return the last used view */ @Nullable public MapView<G, A, R, C, V> getMapViewFrame() { - return !mapViews.isEmpty() ? (MapView<G, A, R, C, V>) mapViews.get(0) : null; + return !mapViews.isEmpty() ? mapViews.get(0) : null; } /** {@inheritDoc} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-16 19:57:25
|
Revision: 3984 http://gridarta.svn.sourceforge.net/gridarta/?rev=3984&view=rev Author: akirschbaum Date: 2008-05-16 12:57:26 -0700 (Fri, 16 May 2008) Log Message: ----------- Add final modifiers. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/CMainView.java trunk/daimonin/src/daieditor/gui/CMainView.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Model.java Modified: trunk/crossfire/src/cfeditor/gui/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/CMainView.java 2008-05-16 19:52:08 UTC (rev 3983) +++ trunk/crossfire/src/cfeditor/gui/CMainView.java 2008-05-16 19:57:26 UTC (rev 3984) @@ -93,7 +93,7 @@ private final CMainControl mainControl; /** The panel that contains the object chooser. */ - private ObjectChooser objectChooser; + private final ObjectChooser objectChooser; /** All open level views. */ private final List<MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>> mapViews = Collections.synchronizedList(new ArrayList<MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>>()); Modified: trunk/daimonin/src/daieditor/gui/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/gui/CMainView.java 2008-05-16 19:52:08 UTC (rev 3983) +++ trunk/daimonin/src/daieditor/gui/CMainView.java 2008-05-16 19:57:26 UTC (rev 3984) @@ -93,7 +93,7 @@ private final CMainControl mainControl; /** The panel that contains the object chooser. */ - private ObjectChooser objectChooser; + private final ObjectChooser objectChooser; /** All open level views. */ private final List<MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>> mapViews = Collections.synchronizedList(new ArrayList<MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>>()); Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Model.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Model.java 2008-05-16 19:52:08 UTC (rev 3983) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Model.java 2008-05-16 19:57:26 UTC (rev 3984) @@ -58,7 +58,7 @@ /** * The folders. Maps folder name to folder instance. */ - private TreeMap<String, Folder<G, A, R, C, V>> folders = new TreeMap<String, Folder<G, A, R, C, V>>(); + private final TreeMap<String, Folder<G, A, R, C, V>> folders = new TreeMap<String, Folder<G, A, R, C, V>>(); /** * Creates a new instance. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-16 20:43:50
|
Revision: 3985 http://gridarta.svn.sourceforge.net/gridarta/?rev=3985&view=rev Author: akirschbaum Date: 2008-05-16 13:31:02 -0700 (Fri, 16 May 2008) Log Message: ----------- Remove MapControl.newMapView(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/map/MapControl.java trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java Modified: trunk/crossfire/src/cfeditor/map/MapControl.java =================================================================== --- trunk/crossfire/src/cfeditor/map/MapControl.java 2008-05-16 19:57:26 UTC (rev 3984) +++ trunk/crossfire/src/cfeditor/map/MapControl.java 2008-05-16 20:31:02 UTC (rev 3985) @@ -23,12 +23,9 @@ import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; -import java.awt.Point; import java.util.List; import net.sf.gridarta.gameobject.match.GameObjectMatcher; -import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.map.AbstractMapControl; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -40,16 +37,6 @@ public final class MapControl extends AbstractMapControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { /** - * The main controller of this subcontroller. - */ - private final CMainControl mainControl; - - /** - * Each view of this map will get a unique number. - */ - private int viewCounter = 0; - - /** * Constructs a new Map. * @param mainControl the CMainControl * @param mapArchObject the <code>MapArchObject</code> of the map @@ -59,12 +46,6 @@ */ public MapControl(final CMainControl mainControl, final List<GameObject> objects, final MapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher) { super(mainControl, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher); - this.mainControl = mainControl; } - /** {@inheritDoc} */ - @NotNull @Override protected MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapView(@Nullable final Point viewPosition) { - return mainControl.getGridartaObjectsFactory().newMapView(this, viewPosition, ++viewCounter); - } - } // class MapControl Modified: trunk/daimonin/src/daieditor/map/MapControl.java =================================================================== --- trunk/daimonin/src/daieditor/map/MapControl.java 2008-05-16 19:57:26 UTC (rev 3984) +++ trunk/daimonin/src/daieditor/map/MapControl.java 2008-05-16 20:31:02 UTC (rev 3985) @@ -23,12 +23,9 @@ import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; import daieditor.gui.map.CMapViewBasic; -import java.awt.Point; import java.util.List; import net.sf.gridarta.gameobject.match.GameObjectMatcher; -import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.map.AbstractMapControl; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -40,16 +37,6 @@ public final class MapControl extends AbstractMapControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { /** - * The main controller of this subcontroller. - */ - private final CMainControl mainControl; - - /** - * Each view of this map will get a unique number. - */ - private int viewCounter = 0; - - /** * Constructs a new Map. * @param mainControl the CMainControl * @param mapArchObject the <code>MapArchObject</code> of the map @@ -59,12 +46,6 @@ */ public MapControl(final CMainControl mainControl, final List<GameObject> objects, final MapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher) { super(mainControl, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher); - this.mainControl = mainControl; } - /** {@inheritDoc} */ - @NotNull @Override protected MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapView(@Nullable final Point viewPosition) { - return mainControl.getGridartaObjectsFactory().newMapView(this, viewPosition, ++viewCounter); - } - } // class MapControl Modified: trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java 2008-05-16 19:57:26 UTC (rev 3984) +++ trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java 2008-05-16 20:31:02 UTC (rev 3985) @@ -73,6 +73,11 @@ @NotNull private final MainControl<G, A, R, C, V> mainControl; /** + * Each view of this map will get a unique number. + */ + private int viewCounter = 0; + + /** * Flag that indicates whether this is a pickmap or not. */ private final boolean isPickmap; @@ -445,13 +450,11 @@ /** {@inheritDoc} */ @NotNull public MapView<G, A, R, C, V> createView(@Nullable final Point viewPosition) { - final MapView<G, A, R, C, V> mapView = newMapView(viewPosition); + final MapView<G, A, R, C, V> mapView = mainControl.getGridartaObjectsFactory().newMapView((C) this, viewPosition, ++viewCounter); mapViews.add(mapView); return mapView; } - @NotNull protected abstract MapView<G, A, R, C, V> newMapView(@Nullable final Point viewPosition); - /** {@inheritDoc} */ public void closeView(@NotNull final MapView<G, A, R, C, V> mapView) { mapView.closeNotify(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-16 22:44:31
|
Revision: 3986 http://gridarta.svn.sourceforge.net/gridarta/?rev=3986&view=rev Author: akirschbaum Date: 2008-05-16 15:44:34 -0700 (Fri, 16 May 2008) Log Message: ----------- Move MapControl to common code base; remove type parameter C. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CFilterControl.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/MapActions.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/crossfire/src/cfeditor/gui/CMainView.java trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java trunk/crossfire/src/cfeditor/gui/ObjectChooser.java trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java trunk/crossfire/src/cfeditor/gui/map/DefaultLevelRenderer.java trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java trunk/crossfire/src/cfeditor/gui/map/PickmapRenderer.java trunk/crossfire/src/cfeditor/gui/script/parameter/MapParameterView.java trunk/crossfire/src/cfeditor/script/parameter/MapParameter.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninEditor.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/MapActions.java trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gui/CMainView.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java trunk/daimonin/src/daieditor/gui/ObjectChooser.java trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java trunk/daimonin/src/daieditor/gui/map/DefaultLevelRenderer.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/gui/map/MapRenderer.java trunk/daimonin/src/daieditor/gui/map/MapTilePane.java trunk/daimonin/src/daieditor/gui/map/MapUserListener.java trunk/daimonin/src/daieditor/gui/map/PickmapRenderer.java trunk/daimonin/src/daieditor/gui/map/event/MouseOpEvent.java trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java trunk/daimonin/src/daieditor/gui/map/tools/SelectionTool.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/CopyBuffer.java trunk/src/app/net/sf/gridarta/CurrentMapListener.java trunk/src/app/net/sf/gridarta/DefaultMapManager.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/MapImageCache.java trunk/src/app/net/sf/gridarta/MapManager.java trunk/src/app/net/sf/gridarta/MapManagerListener.java trunk/src/app/net/sf/gridarta/floodfill/Floodfill.java trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gui/AbstractGameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/AbstractObjectChooser.java trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java trunk/src/app/net/sf/gridarta/gui/ErrorListView.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/MapManagerActions.java trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionControl.java trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionView.java trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsControl.java trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsView.java trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterControl.java trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterView.java trunk/src/app/net/sf/gridarta/gui/connectionview/View.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/GoLocationDialog.java trunk/src/app/net/sf/gridarta/gui/map/GoLocationDialogManager.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorActions.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java trunk/src/app/net/sf/gridarta/gui/map/MapView.java trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapFolderDialog.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/CurrentPickmapActions.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListAction.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListActions.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListener.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Model.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/ModelListener.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserView.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapSelectionListener.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapTileSelection.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapTileSelectionCache.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/gui/undo/UndoControl.java trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java trunk/src/app/net/sf/gridarta/io/DefaultMapWriter.java trunk/src/app/net/sf/gridarta/io/GameObjectParser.java trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java trunk/src/app/net/sf/gridarta/map/AutoValidator.java trunk/src/app/net/sf/gridarta/map/AutoValidatorProcessor.java trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java trunk/src/app/net/sf/gridarta/map/MapControl.java trunk/src/app/net/sf/gridarta/map/MapControlListener.java trunk/src/app/net/sf/gridarta/map/MapModel.java trunk/src/app/net/sf/gridarta/treasurelist/CFTreasureListTree.java trunk/src/doc/dev/typeParameters.xhtml Removed Paths: ------------- trunk/crossfire/src/cfeditor/map/MapControl.java trunk/daimonin/src/daieditor/map/MapControl.java Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-05-16 20:31:02 UTC (rev 3985) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-05-16 22:44:34 UTC (rev 3986) @@ -23,7 +23,6 @@ import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; -import cfeditor.map.MapControl; import java.awt.Component; import java.io.BufferedReader; import java.io.File; @@ -172,7 +171,7 @@ } if (in.canRead()) { - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = mainControl.getMapManager().openMapFileWithView(in, null); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = mainControl.getMapManager().openMapFileWithView(in, null); if (mapView != null) { mainControl.createImageWanted(mapView, out); mainControl.getMapManager().closeView(mapView); Modified: trunk/crossfire/src/cfeditor/CFilterControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CFilterControl.java 2008-05-16 20:31:02 UTC (rev 3985) +++ trunk/crossfire/src/cfeditor/CFilterControl.java 2008-05-16 22:44:34 UTC (rev 3986) @@ -26,10 +26,13 @@ import cfeditor.filter.NamedFilterEvent; import cfeditor.filter.NamedFilterList; import cfeditor.filter.NamedFilterListener; -import cfeditor.map.MapControl; +import cfeditor.gameobject.Archetype; +import cfeditor.gui.map.CMapViewBasic; +import cfeditor.map.MapArchObject; import javax.swing.JMenu; import javax.swing.JMenuItem; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.MapControl; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -67,7 +70,7 @@ /** The main control. */ @NotNull private final CMainControl mainControl; - @Nullable private final MapControl mapControl; + @Nullable private final MapControl<cfeditor.gameobject.GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl; /** * Create a new FilterControl. @@ -75,7 +78,7 @@ * @param mapControl MapControl to create FilterControl for. * @param mainControl The main control. */ - public CFilterControl(@Nullable final MapControl mapControl, @NotNull final CMainControl mainControl, final NamedFilterList filterList) { + public CFilterControl(@Nullable final MapControl<cfeditor.gameobject.GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @NotNull final CMainControl mainControl, final NamedFilterList filterList) { this.filterList = filterList; this.mainControl = mainControl; filterOutConfig = (NamedFilterConfig) filterList.createConfig(); @@ -140,7 +143,7 @@ if (mapControl != null) { mapControl.repaint(); } else { - for (final MapControl mapControl : mainControl.getMapManager().getOpenedMaps()) { + for (final MapControl<cfeditor.gameobject.GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl : mainControl.getMapManager().getOpenedMaps()) { mapControl.repaint(); } } Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-05-16 20:31:02 UTC (rev 3985) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-05-16 22:44:34 UTC (rev 3986) @@ -35,7 +35,6 @@ import cfeditor.gui.prefs.GUIPrefs; import cfeditor.gui.prefs.ResPrefs; import cfeditor.map.MapArchObject; -import cfeditor.map.MapControl; import cfeditor.script.ScriptController; import java.awt.Point; import java.io.File; @@ -82,6 +81,7 @@ import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.AutoValidator; +import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.validation.DefaultErrorCollector; import net.sf.gridarta.map.validation.DelegatingMapValidator; @@ -125,7 +125,7 @@ * @author Andreas Kirschbaum * @fixme I'm 2200 lines long, therefore I suck. */ -public final class CMainControl extends AbstractMainControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> implements ThrowableHandler<Throwable> { +public final class CMainControl extends AbstractMainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> implements ThrowableHandler<Throwable> { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); @@ -146,7 +146,7 @@ public static final boolean PREFS_SYSTEM_EXIT_DEFAULT = true; /** The map manager actions. */ - private final MapManagerActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapManagerActions; + private final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions; private final MapActions mapActions; @@ -157,7 +157,7 @@ private final CMainView mainView; /** The undo control. */ - @NotNull private final UndoControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> undoControl; + @NotNull private final UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic> undoControl; private final ArchetypeParser archetypeParser; @@ -174,7 +174,7 @@ private final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells = new Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>>(); /** List of objects on map (right side). */ - private SelectedSquareControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> selectedSquareControl; + private SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl; /** * The ArchetypeSet, which is a registry of all Archetypes. @@ -200,10 +200,10 @@ /** Preferences default for auto validation. */ private static final boolean PREFS_VALIDATOR_AUTO_DEFAULT = true; - private final MapCursorControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapCursorControl; + private final MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapCursorControl; /** Actions used by this instance. */ - private final MainActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mainActions = new MainActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(this, ACTION_FACTORY); + private final MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, ACTION_FACTORY); /** JFileChooser for opening a file. */ private JFileChooser fileChooser; @@ -212,13 +212,13 @@ private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; /** The auto-validator. */ - private final AutoValidator<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> autoValidator; + private final AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic> autoValidator; /** The filter control. */ private final CFilterControl filterControl; /** The factory for creating new maps or pickmaps. */ - private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); + private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); /** * Constructs the main controller and its model and view. @@ -231,15 +231,15 @@ animationObjects = new AnimationObjects(); archetypeSet = new ArchetypeSet(this, animationObjects); scriptControl = new ScriptController(this); - mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>("cfeditor", this, getMapManager()); + mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, getMapManager()); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "gc", "onlineHelp", "tod", "about"); - mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(getMapManager()); + mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); globalSettings.readGlobalSettings(); PathManager.setGlobalSettings(globalSettings); objectChooser = new ObjectChooser(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR)); mainView = new CMainView(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction()); new About("cfeditor", mainView); - undoControl = new UndoControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(getMapManager()); + undoControl = new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("cfeditor", this, mainView, "CrossfireEditor.jar"); updaterManager.startup(); @@ -284,14 +284,14 @@ ScriptArchEditor.initEventTypeBoxes(".py", "Python"); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, CMainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(ACTION_FACTORY, this, mainView, mapTileListBottom, null); + selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, mainView, mapTileListBottom, null); // Initialize the main view final GameObjectMatcher monsterMatcher = GameObjectMatchers.getMatcher("monster"); if (monsterMatcher == null) { log.fatal("GameObjectMatcher 'monster' does not exist"); throw new MissingResourceException("GameObjectMatcher 'monster' does not exist", null, null); } - mainView.init(new LockedItemsControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(getMapManager(), Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER), selectedSquareControl.getSelectedSquareView(), typeList, mapTileListBottom, monsterMatcher, gameObjectMatchers); + mainView.init(new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER), selectedSquareControl.getSelectedSquareView(), typeList, mapTileListBottom, monsterMatcher, gameObjectMatchers); mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); archetypeParser = new ArchetypeParser(this, objectChooser.getArchetypeChooserControl(), animationObjects); @@ -364,7 +364,7 @@ ); recentManager.initRecent(); validators = createMapValidators(); - autoValidator = new AutoValidator<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); + autoValidator = new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); } /** @@ -655,7 +655,7 @@ } /** {@inheritDoc} */ - public boolean saveLevelAsWanted(@NotNull final MapControl mapControl) { + public boolean saveLevelAsWanted(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Save Level File As"); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); @@ -692,7 +692,7 @@ } /** {@inheritDoc} */ - public void createImage(@NotNull final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { + public void createImage(@NotNull final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView) { if (globalSettings.getImageDir() == null) { globalSettings.setImageDir(globalSettings.getMapDir().getAbsolutePath()); } @@ -732,7 +732,7 @@ * @param mapView the map view of the map to save * @param file the png image file to create */ - public void createImageWanted(@NotNull final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView, final File file) { + public void createImageWanted(@NotNull final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView, final File file) { final File tmpFile = new File(file.getPath() + ".tmp"); try { mapView.getView().getRenderer().printFullImage(tmpFile); @@ -825,7 +825,7 @@ final Point[] viewPositions = mapControl.getViewPositions(); getMapManager().closeLevel(mapControl, true); - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapView = getMapManager().openMapFileWithView(mfile, viewPositions[0]); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView = getMapManager().openMapFileWithView(mfile, viewPositions[0]); if (newMapView != null) { final MapControl newMapControl = newMapView.getMapControl(); for (int i = 1; i < viewPositions.length; i++) { @@ -873,7 +873,7 @@ * @return the current top map view we are working with, or * <code>null</code> if no map is open */ - @Nullable public MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getCurrentMapView() { + @Nullable public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getCurrentMapView() { return mainView == null ? null : mainView.getCurrentMapView(); } @@ -889,7 +889,7 @@ return globalSettings.getImageSet(); } - public MapCursorControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getMapCursorControl() { + public MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic> getMapCursorControl() { return mapCursorControl; } @@ -931,12 +931,12 @@ } /** {@inheritDoc} */ - @NotNull public SelectedSquareControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getSelectedSquareControl() { + @NotNull public SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> getSelectedSquareControl() { return selectedSquareControl; } /** {@inheritDoc} */ - @NotNull public MainActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getMainActions() { + @NotNull public MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic> getMainActions() { return mainActions; } Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-05-16 20:31:02 UTC (rev 3985) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-05-16 22:44:34 UTC (rev 3986) @@ -27,7 +27,6 @@ import cfeditor.io.GameObjectParser; import cfeditor.io.MapArchObjectParser; import cfeditor.map.MapArchObject; -import cfeditor.map.MapControl; import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; @@ -42,6 +41,8 @@ import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; +import net.sf.gridarta.map.AbstractMapControl; +import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -52,7 +53,7 @@ * * @author Andreas Kirschbaum */ -public class CrossfireObjectsFactory implements GridartaObjectsFactory<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { +public class CrossfireObjectsFactory implements GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { /** The action factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); @@ -95,13 +96,13 @@ } /** {@inheritDoc} */ - @NotNull public MapControl newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new MapControl(CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchers.getMatcher("exit")); + @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { + return new AbstractMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchers.getMatcher("exit")); } /** {@inheritDoc} */ - @NotNull public MapControl newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new MapControl(CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchers.getMatcher("exit")); + @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { + return new AbstractMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchers.getMatcher("exit")); } /** {@inheritDoc} */ @@ -110,8 +111,8 @@ } /** {@inheritDoc} */ - @NotNull public MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapView(@NotNull final MapControl mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition), ACTION_FACTORY); + @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl mapControl, @Nullable final Point viewPosition, final int viewCounter) { + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition), ACTION_FACTORY); } } // class CrossfireObjectsFactory Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-05-16 20:31:02 UTC (rev 3985) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-05-16 22:44:34 UTC (rev 3986) @@ -24,7 +24,6 @@ import cfeditor.gui.map.CMapViewBasic; import cfeditor.gui.map.MapPropertiesDialog; import cfeditor.map.MapArchObject; -import cfeditor.map.MapControl; import java.awt.Dimension; import java.awt.Point; import java.awt.Rectangle; @@ -39,6 +38,7 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.map.MapCursorEvent; import net.sf.gridarta.gui.map.MapView; +import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ToggleAction; import org.apache.log4j.Logger; @@ -105,7 +105,7 @@ private final CMainControl mainControl; /** The map manager. */ - private final MapManager<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapManager; + private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; /** The matcher for selecting exit objects. */ private final GameObjectMatcher exitMatcher; @@ -113,7 +113,7 @@ /** * The current map listener used to detect current map/map view changes. */ - private final CurrentMapListener<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> currentMapListener; + private final CurrentMapListener<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMapListener; /** * Create a new instance. @@ -124,7 +124,7 @@ * * @param GameObjectMatchers the game object matchers */ - public MapActions(final CMainControl mainControl, final MapManager<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher) { + public MapActions(final CMainControl mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher) { this.mainControl = mainControl; this.mapManager = mapManager; this.exitMatcher = exitMatcher; @@ -135,7 +135,7 @@ aDirections[i] = ACTION_FACTORY.createAction(true, directionsMap[i], this); } - currentMapListener = new CurrentMapListener<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(mainControl, mapManager, null, false, false, true) { + currentMapListener = new CurrentMapListener<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapManager, null, false, false, true) { /** {@inheritDoc} */ @Override protected void mapHasChanged() { @@ -170,7 +170,7 @@ * if the grid is invisible */ public boolean isGridVisible() { - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = getGridVisibleEnabled(); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getGridVisibleEnabled(); return mapView != null && mapView.getView().getRenderer().isGridVisible(); } @@ -182,7 +182,7 @@ * @see #isGridVisible() */ public void setGridVisible(final boolean gridVisible) { - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = getGridVisibleEnabled(); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getGridVisibleEnabled(); if (mapView != null) { mapView.getView().getRenderer().setGridVisible(gridVisible); } @@ -207,7 +207,7 @@ /** Action method for "create view". */ public void mapCreateView() { - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = getCreateViewEnabled(); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getCreateViewEnabled(); if (mapView != null) { mapManager.mapCreateView(mapView.getMapControl(), mapView.getView().getViewPosition()); } @@ -215,7 +215,7 @@ /** Action method for "map properties". */ public void mapProperties() { - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = getMapPropertiesEnabled(); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); if (mapView != null) { MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, mapView.getMapControl()); } @@ -254,8 +254,8 @@ exitPos.y = exit.getAttributeInt("sp"); final String path = exit.getAttributeString("slaying"); - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> currentMapView = currentMapListener.getCurrentMapView(); - final MapControl currentMap = currentMapView.getMapControl(); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMapView = currentMapListener.getCurrentMapView(); + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = currentMapView.getMapControl(); if (path.length() == 0 || (currentMap.getMapFile() != null && path.equals(currentMap.getMapFile().getName()))) { // path points to the same map @@ -295,7 +295,7 @@ return; } - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapView = mapManager.openMapFileWithView(newfile, null); // open the new map + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView = mapManager.openMapFileWithView(newfile, null); // open the new map if (exitPos.x == 0 && exitPos.y == 0) { // use the entry point defined by the map header @@ -355,8 +355,8 @@ * @param path path to map that should be loaded * @param direction the direction to go */ - private void enterMap(@NotNull final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> currentMapView, @NotNull final String path, final int direction) { - final MapControl currentMap = currentMapView.getMapControl(); + private void enterMap(@NotNull final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMapView, @NotNull final String path, final int direction) { + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = currentMapView.getMapControl(); @NotNull final File newfile; // new mapfile to open if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { @@ -388,7 +388,7 @@ ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "enterTileIOException", newfile.getAbsolutePath()); return; } - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newMapView = mapManager.openMapFileWithView(canonicalNewFile, null); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView = mapManager.openMapFileWithView(canonicalNewFile, null); if (newMapView == null) { return; } @@ -404,7 +404,7 @@ * @return the current map view, or <code>null</code> if "grid visible" is * disabled */ - private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getGridVisibleEnabled() { + private MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getGridVisibleEnabled() { return currentMapListener.getCurrentMapView(); } @@ -413,7 +413,7 @@ * * @return the current map, or <code>null</code> if "tile show" is disabled */ - @Nullable private MapControl getTileShowEnabled() { + @Nullable private MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> getTileShowEnabled() { return null;//currentMapListener.getCurrentMap(); } @@ -423,7 +423,7 @@ * @return the current map, or <code>null</code> if "create view" is * disabled */ - private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getCreateViewEnabled() { + private MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getCreateViewEnabled() { return currentMapListener.getCurrentMapView(); } @@ -433,7 +433,7 @@ * @return the current map view, or <code>null</code> if "map properties" * is disabled */ - private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getMapPropertiesEnabled() { + private MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getMapPropertiesEnabled() { return currentMapListener.getCurrentMapView(); } @@ -444,7 +444,7 @@ * disabled */ @Nullable private GameObject getEnterExitEnabled() { - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = currentMapListener.getCurrentMapView(); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = currentMapListener.getCurrentMapView(); if (mapView == null) { return null; } @@ -471,7 +471,7 @@ * disabled */ @Nullable private Destination getEnterMapEnabled(final int direction) { - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = currentMapListener.getCurrentMapView(); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = currentMapListener.getCurrentMapView(); if (mapView == null) { return null; } @@ -578,7 +578,7 @@ /** * The source map to leave. */ - private final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView; + private final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView; /** * The destination map path to enter. @@ -592,7 +592,7 @@ * * @param path the destination map path to enter */ - Destination(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView, final String path) { + Destination(final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView, final String path) { this.mapView = mapView; this.path = path; } @@ -602,7 +602,7 @@ * * @return the source map to leave */ - public MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getMapView() { + public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getMapView() { return mapView; } Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-05-16 20:31:02 UTC (rev 3985) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-05-16 22:44:34 UTC (rev 3986) @@ -21,7 +21,6 @@ import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; -import cfeditor.map.MapControl; import java.io.BufferedReader; import java.io.File; import java.io.IOException; @@ -55,14 +54,14 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); - private final MainControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mainControl; + private final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl; private final AnimationObjects animationObjects; /** * The archetype chooser to add parsed archetypes to. */ - private final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> archetypeChooserControl; + private final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl; /** * The pattern to match end of line characters separating lines in the arch @@ -76,7 +75,7 @@ * @param archetypeChooserControl an archetype chooser to add parsed * archetypes to */ - public ArchetypeParser(final MainControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mainControl, final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> archetypeChooserControl, final AnimationObjects animationObjects) { + public ArchetypeParser(final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, final AnimationObjects animationObjects) { this.mainControl = mainControl; this.archetypeChooserControl = archetypeChooserControl; this.animationObjects = animationObjects; Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-05-16 20:31:02 UTC (rev 3985) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-05-16 22:44:34 UTC (rev 3986) @@ -197,7 +197,7 @@ } /** {@inheritDoc} */ - @Override public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?, ?> mapanel) { + @Override public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel) { scriptArchData.modifyEventScript(eventType, task, eventList); if (scriptArchData.isEmpty()) { @@ -206,7 +206,7 @@ } /** {@inheritDoc} */ - @Override public void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?, ?> mapanel) { + @Override public void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel) { ScriptArchEditor.addEventScript(eventList, this, scriptArchData); if (!scriptArchData.isEmpty()) { Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-05-16 20:31:02 UTC (rev 3985) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-05-16 22:44:34 UTC (rev 3986) @@ -50,13 +50,13 @@ private static final int IMAGE_BUFFER_SIZE = 50 * 1024; /** The main control. */ - @NotNull private final MainControl<?, ?, ?, ?, ?> mainControl; + @NotNull private final MainControl<?, ?, ?, ?> mainControl; /** * Creates a new instance. * @param mainControl the main control */ - public FaceObjects(@NotNull final MainControl<?, ?, ?, ?, ?> mainControl) { + public FaceObjects(@NotNull final MainControl<?, ?, ?, ?> mainControl) { this.mainControl = mainControl; } Modified: trunk/crossfire/src/cfeditor/gui/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/CMainView.java 2008-05-16 20:31:02 UTC (rev 3985) +++ trunk/crossfire/src/cfeditor/gui/CMainView.java 2008-05-16 22:44:34 UTC (rev 3986) @@ -24,7 +24,6 @@ import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; -import cfeditor.map.MapControl; import java.awt.BorderLayout; import java.awt.Rectangle; import java.awt.Toolkit; @@ -57,6 +56,7 @@ import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.ViewActions; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; +import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -69,7 +69,7 @@ * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public final class CMainView extends MainView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> { +public final class CMainView extends MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> { /** Action Factory to create Actions. */ private final ActionFactory actionFactory; @@ -96,10 +96,10 @@ private final ObjectChooser objectChooser; /** All open level views. */ - private final List<MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>> mapViews = Collections.synchronizedList(new ArrayList<MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>>()); + private final List<MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>> mapViews = Collections.synchronizedList(new ArrayList<MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>>()); /** Last known map view for generating change events. */ - private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> currentMapView = null; + private MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMapView = null; /** Attributes panel (bottom). */ private GameObjectAttributesPanel gameObjectAttributesPanel; @@ -115,10 +115,10 @@ /** Action for "next window". */ private final Action aNextWindow; - private final ViewActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> viewActions; + private final ViewActions<GameObject, MapArchObject, Archetype, CMapViewBasic> viewActions; /** The actions of the "Archetypes" menu. */ - private ArchetypesActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> archetypesActions; + private ArchetypesActions<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypesActions; /** The toolbar. */ private JToolBar mainToolbar = null; @@ -143,7 +143,7 @@ * @param actionFactory the action factory to use * @param aCloseAll the action "close all map windows" */ - public CMainView(@NotNull final CMainControl mainControl, @NotNull final ObjectChooser objectChooser, @NotNull final MapManager<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll) { + public CMainView(@NotNull final CMainControl mainControl, @NotNull final ObjectChooser objectChooser, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final ActionFactory actionFactory, @NotNull final Action aCloseAll) { super(mainControl, mapManager, actionFactory.format("mainWindow.title", CMainControl.getBuildNumberAsString())); this.mainControl = mainControl; this.objectChooser = objectChooser; @@ -153,7 +153,7 @@ aPrevWindow = actionFactory.createAction(true, "prevWindow", this); aNextWindow = actionFactory.createAction(true, "nextWindow", this); - viewActions = new ViewActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(mainControl, mapManager); + viewActions = new ViewActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapManager); final ImageIcon icon = GUIUtils.getIcon(GUIConstants.APP_ICON); if (icon != null) { @@ -172,7 +172,7 @@ * monster objects * @param gameObjectMatchers the game object matchers */ - public void init(@NotNull final LockedItemsControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> lockedItemsControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> selectedSquareView, final CFArchTypeList archTypeList, final boolean mapTileListBottom, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final GameObjectMatchers gameObjectMatchers) { + public void init(@NotNull final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, final CFArchTypeList archTypeList, final boolean mapTileListBottom, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final GameObjectMatchers gameObjectMatchers) { // calculate some default values in case there is no settings file final Rectangle screen = getGraphicsConfiguration().getBounds(); final int defwidth = (int) (0.9 * screen.getWidth()); @@ -185,7 +185,7 @@ toolbarPanel.add(createCenterPanel(defwidth, defheight, lockedItemsControl, selectedSquareView, mapTileListBottom, monsterMatcher), BorderLayout.CENTER); add(toolbarPanel, BorderLayout.CENTER); - archetypesActions = new ArchetypesActions<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic>(this, objectChooser.getArchetypeChooserControl(), mainControl.getArchetypeSet(), objectChooser, archTypeList); + archetypesActions = new ArchetypesActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser.getArchetypeChooserControl(), mainControl.getArchetypeSet(), objectChooser, archTypeList); setJMenuBar(actionFactory.createMenuBar(true, "main")); objectChooser.setPickmapFoldersMenu((JMenu) actionFactory.find(getJMenuBar(), "pickmapFolders")); viewActions.init(gameObjectMatchers); @@ -223,7 +223,7 @@ * monster objects * @return center panel */ - private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final LockedItemsControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> lockedItemsControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectMatcher monsterMatcher) { + private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectMatcher monsterMatcher) { final JPanel centerPanel = new JPanel(new BorderLayout()); final int divLocationRight = prefs.getInt(DIVIDER_LOCATION_KEY3, (int) (defwidth * 0.62)); @@ -271,7 +271,7 @@ } /** {@inheritDoc} */ - public void addLevelView(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { + public void addLevelView(final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView) { assert !mapViews.contains(mapView); mapViews.add(0, mapView); mapView.addInternalFrameListener(internalFrameListener); @@ -289,7 +289,7 @@ } /** {@inheritDoc} */ - public void removeLevelView(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { + public void removeLevelView(final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView) { assert mapViews.contains(mapView); if (!mapViews.contains(mapView)) { return; @@ -329,7 +329,7 @@ */ private void updateFocus(final boolean fCareAboutIconification) { // Show the next level (if such exists) - for (final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView : mapViews) { + for (final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView : mapViews) { if (mapView.isIcon()) { if (!fCareAboutIconification) { try { @@ -352,7 +352,7 @@ /** Gives focus to the next window. */ public void prevWindow() { - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = getFrameForPrevWindow(); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getFrameForPrevWindow(); if (mapView == null) { return; } @@ -366,7 +366,7 @@ /** Gives focus to the previous window. */ public void nextWindow() { - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView = getFrameForNextWindow(); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getFrameForNextWindow(); if (mapView == null) { return; } @@ -379,7 +379,7 @@ } /** {@inheritDoc} */ - public void setCurrentLevelView(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { + public void setCurrentLevelView(final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView) { assert mapViews.contains(mapView); mapViews.remove(mapView); mapViews.add(0, mapView); @@ -401,7 +401,7 @@ } /** {@inheritDoc} */ - protected void levelViewFocusLostNotify(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { + protected void levelViewFocusLostNotify(final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView) { assert mapViews.contains(mapView); if (mapViews.size() <= 1) { return; @@ -414,12 +414,12 @@ } /** {@inheritDoc} */ - protected void levelViewFocusGainedNotify(final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapView) { + protected void levelViewFocusGainedNotify(final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView) { assert mapViews.contains(mapView); mapViews.remove(mapView); mapViews.add(0, mapView); generateCurrentMapViewChangedEvent(); - final MapControl level = mapView.getMapControl(); + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level = mapView.getMapControl(); level.setFocus(mapView); mapManager.setCurrentLevel(level); //statusBar.setLevelInfo(level); @@ -436,7 +436,7 @@ menuWindow.addSeparator(); } int index = 0; - for (final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> frame : mapViews) { + for (final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> frame : mapViews) { frame.addWindowAction(menuWindow, index++); } } @@ -451,7 +451,7 @@ * @return the current top map view we are working with, or * <code>null</code> if no map is open */ - @Nullable public MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getCurrentMapView() { + @Nullable public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getCurrentMapView() { return !mapViews.isEmpty() ? mapViews.get(0) : null; } @@ -462,7 +462,7 @@ private void generateCurrentMapViewChangedEvent() { rebuildWindowMenu(); - final MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> newCurrentMapView = getCurrentMapView(); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newCurrentMapView = getCurrentMapView(); if (currentMapView == newCurrentMapView) { return; } @@ -477,7 +477,7 @@ * @return the map view to activate, or <code>null</code> if "prev window" * should be disabled */ - @Nullable private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getFrameForPrevWindow() { + @Nullable private MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getFrameForPrevWindow() { return mapViews.size() > 1 ? mapViews.get(0) : null; } @@ -487,7 +487,7 @@ * @return the map view to activate, or <code>null</code> if "next window" * should be disabled */ - @Nullable private MapView<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> getFrameForNextWindow() { + @Nullable private MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> getFrameForNextWindow() { return mapViews.size() > 1 ? mapViews.get(mapViews.size() - 1) : null; } Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-05-16 20:31:02 UTC (rev 3985) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesDialog.java 2008-05-16 22:44:34 UTC (rev 3986) @@ -23,7 +23,6 @@ import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; -import cfeditor.map.MapControl; import java.util.List; import java.util.Vector; import javax.swing.ImageIcon; @@ -65,7 +64,7 @@ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); /** The map manager. */ - private final MapManager<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapManager; + private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; /** * Wrapper method for the constructor. @@ -75,7 +74,7 @@ * @param mainControl main control * @param mapManager the map manager */ - public static void showAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree) { + public static void showAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree) { synchronized (dialogs) { if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); @@ -99,7 +98,7 @@ * @param mapManager the map manager * @param treasureListTree the treasure list tree */ - private GameObjectAttributesDialog(final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, MapControl, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree) { + private GameObjectAttributesDialog(final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree) { super(archTypeList, gameObject, mainControl, treasureListTree); this.mapManager = mapManager; } Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java 2008-05-16 20:31:02 UTC (rev 3985) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java 2008-05-16 22:44:34 UTC (rev 3986) @@ -23,7 +23,6 @@ import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; -import cfeditor.map.MapControl; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.match.GameObjectMatcher; @@ -38,13 +37,13 @@ * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public final class GameObjectAttributesPan... [truncated message content] |
From: <aki...@us...> - 2008-05-16 22:55:34
|
Revision: 3988 http://gridarta.svn.sourceforge.net/gridarta/?rev=3988&view=rev Author: akirschbaum Date: 2008-05-16 15:55:33 -0700 (Fri, 16 May 2008) Log Message: ----------- Rename AbstractMapControl into DefaultMapControl since it is not abstract anymore. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-05-16 22:53:22 UTC (rev 3987) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-05-16 22:55:33 UTC (rev 3988) @@ -41,7 +41,7 @@ import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; -import net.sf.gridarta.map.AbstractMapControl; +import net.sf.gridarta.map.DefaultMapControl; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; import net.sf.japi.swing.ActionFactory; @@ -97,12 +97,12 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new AbstractMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchers.getMatcher("exit")); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchers.getMatcher("exit")); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new AbstractMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchers.getMatcher("exit")); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchers.getMatcher("exit")); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-05-16 22:53:22 UTC (rev 3987) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-05-16 22:55:33 UTC (rev 3988) @@ -41,7 +41,7 @@ import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; -import net.sf.gridarta.map.AbstractMapControl; +import net.sf.gridarta.map.DefaultMapControl; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; import net.sf.japi.swing.ActionFactory; @@ -97,12 +97,12 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new AbstractMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchers.getMatcher("exit")); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchers.getMatcher("exit")); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new AbstractMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchers.getMatcher("exit")); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchers.getMatcher("exit")); } /** {@inheritDoc} */ Deleted: trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java 2008-05-16 22:53:22 UTC (rev 3987) +++ trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java 2008-05-16 22:55:33 UTC (rev 3988) @@ -1,581 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.map; - -import java.awt.Point; -import java.io.File; -import java.io.IOException; -import java.lang.ref.SoftReference; -import java.util.ArrayList; -import java.util.LinkedList; -import java.util.List; -import javax.swing.event.EventListenerList; -import net.sf.gridarta.CommonConstants; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapImageCache; -import net.sf.gridarta.Size2D; -import net.sf.gridarta.gameobject.Archetype; -import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gameobject.match.GameObjectMatcher; -import net.sf.gridarta.gui.map.LevelRenderer; -import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.io.DefaultMapWriter; -import net.sf.gridarta.io.MapWriter; -import net.sf.japi.swing.ActionFactory; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * The class <code>AbstractMapControl</code> implements common code between - * crossfire and daimonin <code>MapControl</code>. - * - * @author Andreas Kirschbaum - */ -public class AbstractMapControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R>> implements MapControl<G, A, R, V> { - - /** - * Action Factory. - */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - - /** - * List of all views of this map. Maps opened in the editor have one or - * more views; if the last view is closed, the map is closed, too. Maps - * opened by scripts or used internally may have zero or more views. - * Pickmaps always have exactly one view. - */ - private final List<MapView<G, A, R, V>> mapViews = new LinkedList<MapView<G, A, R, V>>(); - - /** The registered event listeners. */ - private final EventListenerList listenerList = new EventListenerList(); - - /** - * The main control. - */ - @NotNull private final MainControl<G, A, R, V> mainControl; - - /** - * Each view of this map will get a unique number. - */ - private int viewCounter = 0; - - /** - * Flag that indicates whether this is a pickmap or not. - */ - private final boolean isPickmap; - - /** - * model (= map data of this level). - */ - private final MapModel<G, A, R> mapModel; - - /** - * Set if the map has changed since last save. - */ - private boolean modified = false; - - @Nullable protected File mapFile; - - /** The filename of this map. */ - // TODO: Rename because the filename is a URI now. - @NotNull private String mapFileName = "<new map>"; - - /** - * Contains the edit types that have already been (requested and) - * calculated (edit types get calculated only when needed to save time). - */ - private int activeEditType = 0; - - /** - * Flag that indicates whether the level is closing or not. - */ - private boolean levelClosing = false; - - /** - * Reference to LevelRenderer, which is only used to get images. - */ - private SoftReference<LevelRenderer> levelRendererReference; - - /** - * The {@link MapModelListener} used to detect changes in the underlying - * map model and set the {@link #modified} flag accordingly. - */ - private final MapModelListener<G, A, R> mapModelListener = new MapModelListener<G, A, R>() { - - /** {@inheritDoc} */ - public void mapSizeChanged(final MapModelEvent<G, A, R> e) { - setModified(); - } - - /** {@inheritDoc} */ - public void mapSquaresChanged(final MapModelEvent<G, A, R> e) { - setModified(); - } - - /** {@inheritDoc} */ - public void mapObjectsChanged(final MapModelEvent<G, A, R> e) { - setModified(); - } - - /** {@inheritDoc} */ - public void mapMetaChanged(@NotNull final A mapArchObject) { - setModified(); - } - - /** {@inheritDoc} */ - public void errorsChanged(@NotNull final MapModel<G, A, R> mapModel) { - // ignore - } - - }; - - /** - * Create a new instance. - * - * @param mainControl The main control. - * - * @param isPickmap true if this is a pickmap - */ - public AbstractMapControl(@NotNull final MainControl<G, A, R, V> mainControl, final List<G> objects, final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher) { - this.mainControl = mainControl; - this.isPickmap = isPickmap; - // we create model (= data) - mapModel = new DefaultMapModel<G, A, R>(mainControl, this, objects, mapArchObject, exitTypeGameObjectMatcher); - mapModel.addMapModelListener(mapModelListener); - } - - /** {@inheritDoc} */ - public void levelCloseNotify() { - mapModel.removeMapModelListener(mapModelListener); - levelClosing = true; - } - - /** {@inheritDoc} */ - public boolean isClosing() { - return levelClosing; - } - - /** {@inheritDoc} */ - public boolean isModified() { - return modified; - } - - /** {@inheritDoc} */ - public void resetModified() { - if (!modified) { - return; - } - - modified = false; - fireModifiedChanged(); - } - - /** - * Set the level changed flag to true. - */ - public void setModified() { - if (modified) { - return; - } - - modified = true; - fireModifiedChanged(); - } - - /** {@inheritDoc} */ - public void addMapControlListener(@NotNull final MapControlListener<G, A, R, V> listener) { - listenerList.add(MapControlListener.class, listener); - } - - /** {@inheritDoc} */ - public void removeMapControlListener(@NotNull final MapControlListener<G, A, R, V> listener) { - listenerList.remove(MapControlListener.class, listener); - } - - /** Fire a map size changed event. */ - private void fireModifiedChanged() { - for (final MapControlListener<G, A, R, V> listener : listenerList.getListeners(MapControlListener.class)) { - listener.modifiedChanged(this); - } - } - - /** Fire a map file name changed event. */ - protected void fireMapFileNameChanged() { - for (final MapControlListener<G, A, R, V> listener : listenerList.getListeners(MapControlListener.class)) { - listener.mapFileNameChanged(this); - } - } - - /** Fire a icon changed event. */ - public void fireIconChanged() { - for (final MapControlListener<G, A, R, V> listener : listenerList.getListeners(MapControlListener.class)) { - listener.iconChanged(this); - } - } - - /** {@inheritDoc} */ - @Nullable public G insertSelectedObject(@NotNull final Point pos, final boolean allowMany) { - if (isPickmap()) { - insertMapArchToPickmap(pos); - return null; - } else { - return insertSelArchToMap(pos, allowMany); - } - } - - /** - * Take the currently selected arch (from archlist or pickmap) and insert - * it to the defined spot on the currently active map. - * @param pos coordinates on map - * @param allowMany when true, it is possible to insert same arches many times - * @return the inserted object, or <code>null</code> if nothing was inserted - */ - private G insertSelArchToMap(@NotNull final Point pos, final boolean allowMany) { - // this is the arch that would get inserted from pickmap, but it also could - // be a default arch (when pickmap has no selection) - final MapControl<G, A, R, V> activePickmap = mainControl.getObjectChooser().getPickmapChooserControl().getCurrentPickmap(); - G newarch = activePickmap == null ? null : activePickmap.getMapViewFrame().getSelectedGameObject(); - - final G newObject; - if (!mainControl.getObjectChooser().isPickmapActive() || isPickmap() || (newarch != null && newarch.isArchetype())) { - // insert default arch from archlist: - mapModel.beginTransaction("Insert"); // TODO: I18N/L10N - newObject = mapModel.addArchToMap(mainControl.getObjectChooser().getArchetypeChooserControl().getSelectedArch(), pos, allowMany, true, false); - mapModel.endTransaction(); - } else { - // insert custom arch from the pickmap: - if (newarch != null) { - boolean insertAllowed = true; // are we allowed to insert this? - if (!allowMany) { - // check if there is already an arch of that kind - for (final G t : mapModel.getMapSquare(pos)) { - if (t.hasSameArchetype(newarch) || t.getArchTypNr() == newarch.getArchTypNr()) { - insertAllowed = false; // there's a match - don't insert a second one - } - } - } - - if (insertAllowed) { - if (!newarch.isMulti()) { - // insert single tile from pickmap - newObject = newarch.createClone(pos.x, pos.y); - mapModel.addGameObjectToMap(newObject, false); - } else { - // insert multi tile from pickmap: - newarch = newarch.getHead(); - // first insert default arch from archlist - newObject = mapModel.addArchToMap(newarch.getArchetypeName(), pos, allowMany, false, false); - if (newObject != null) { - newObject.setObjectText(newarch.getObjectText()); - newObject.setObjName(newarch.getObjName()); - newObject.resetMsgText(); - newObject.addMsgText(newarch.getMsgText()); - } - } - } else { - newObject = null; - } - } else { - newObject = null; - } - } - - return newObject; - } - - /** - * This method is only called for pickmaps. Take the currently highlighted - * arch on the map (if any) and insert it on this pickmap. - * @param pos tile-coordinates in pickmap - */ - private void insertMapArchToPickmap(@NotNull final Point pos) { - final MapControl<G, A, R, V> currentMap = mainControl.getMapManager().getCurrentMap(); - // insertion is only allowed for valid *empty* squares - if (currentMap != null && isPickmap() && mapModel.isPointValid(pos) && mapModel.getMapSquare(pos).isEmpty()) { - // get the currently selected map arch - G newarch = mainControl.getSelectedSquareControl().getSelectedSquareView().getSelectedGameObject(); - if (newarch != null) { - newarch = newarch.getHead(); - - // check if all spaces are free that the multi will occupy - boolean allSpacesFree = true; - final Point d = new Point(); - for (R part = newarch.getArchetype(); part != null; part = (R) part.getMultiNext()) { - d.x = pos.x + part.getMultiX(); - d.y = pos.y + part.getMultiY(); - if (!mapModel.isPointValid(d) || !mapModel.getMapSquare(d).isEmpty()) { - allSpacesFree = false; - break; - } - } - if (allSpacesFree) { - addCopyToMap(newarch, pos, true, false); - } - } - } - } - - /** {@inheritDoc} */ - public boolean isPlainSaveEnabled() { - return mapFile != null && !getMapFileName().equals(CommonConstants.DEF_MAPFNAME); - } - - /** {@inheritDoc} */ - // TODO: Rename because the filename is a URI now. - @NotNull public String getMapFileName() { - return mapFileName; - } - - /** {@inheritDoc} */ - public void setMapFileName(@NotNull final String mapFileName) { - if (this.mapFileName.equals(mapFileName)) { - return; - } - - this.mapFileName = mapFileName; - - fireMapFileNameChanged(); - } - - /** {@inheritDoc} */ - public void setMapFile(@Nullable final File file) { - mapFile = file; - } - - /** {@inheritDoc} */ - @Nullable public File getMapFile() { - return mapFile; - } - - /** {@inheritDoc} */ - @NotNull public List<G> getAllGameObjects() { - final List<G> gameObjects = new ArrayList<G>(); - for (final MapSquare<G, A, R> mapSquare : getAllSquares()) { - for (final G gameObject : mapSquare) { - gameObjects.add(gameObject.getHead()); - } - } - return gameObjects; - } - - /** - * Return the edit types that have already been (requested and) calculated - * (edit types get calculated only when needed to save time). - * - * @return the edit types that have already been calculated - */ - public int getActiveEditType() { - return activeEditType; - } - - /** {@inheritDoc} */ - public void setActiveEditType(final int activeEditType) { - this.activeEditType = activeEditType; - } - - /** - * Checks if the given edit type is active or not. - * @param editType edit type - * @return true if this edit type is active - */ - public boolean hasEditType(final int editType) { - return (activeEditType & editType) != 0; - } - - /** {@inheritDoc} */ - public void addEditType(final int editType) { - // calculate only if needed - if (!hasEditType(editType)) { - final Size2D mapSize = mapModel.getMapSize(); - final Point pos = new Point(); - for (pos.x = 0; pos.x < mapSize.getWidth(); pos.x++) { - for (pos.y = 0; pos.y < mapSize.getHeight(); pos.y++) { - for (final G arch : mapModel.getMapSquare(pos)) { - arch.updateEditType(editType); - } - } - } - // from now on we have this type, so we don't have to calculate it again - activeEditType |= editType; - } - } - - /** {@inheritDoc} */ - @NotNull public Point[] getViewPositions() { - final Point[] result = new Point[mapViews.size()]; - for (int i = 0; i < result.length; i++) { - result[i] = mapViews.get(i).getView().getViewPosition(); - } - return result; - } - - /** {@inheritDoc} */ - public int nViews() { - return mapViews.size(); - } - - /** - * Get the last used view of this level. - * @return the last used view - */ - @Nullable public MapView<G, A, R, V> getMapViewFrame() { - return !mapViews.isEmpty() ? mapViews.get(0) : null; - } - - /** {@inheritDoc} */ - public List<MapView<G, A, R, V>> getMapViewFrames() { - return mapViews; - } - - /** {@inheritDoc} */ - @NotNull public MapView<G, A, R, V> createView(@Nullable final Point viewPosition) { - final MapView<G, A, R, V> mapView = mainControl.getGridartaObjectsFactory().newMapView(this, viewPosition, ++viewCounter); - mapViews.add(mapView); - return mapView; - } - - /** {@inheritDoc} */ - public void closeView(@NotNull final MapView<G, A, R, V> mapView) { - mapView.closeNotify(); - mapViews.remove(mapView); - } - - /** {@inheritDoc} */ - public void setFocus(final MapView<G, A, R, V> mapView) { - assert mapViews.contains(mapView); - mapViews.remove(mapView); - mapViews.add(0, mapView); - } - - /** {@inheritDoc} */ - public boolean isPickmap() { - return isPickmap; - } - - /** {@inheritDoc} */ - public LevelRenderer getRenderer() { - final LevelRenderer tmpLevelRenderer = levelRendererReference == null ? null : levelRendererReference.get(); - final LevelRenderer levelRenderer; - if (tmpLevelRenderer == null) { - levelRenderer = mainControl.getGridartaObjectsFactory().newSimpleLevelRenderer(mapModel, mainControl.getArchetypeSet()); - levelRendererReference = new SoftReference<LevelRenderer>(levelRenderer); - } else { - levelRenderer = tmpLevelRenderer; - } - return levelRenderer; - } - - /** - * Save a map. - * @param file File to save to - * @param mapModel MapModel to save - * @return Whether saving was successful. - */ - protected boolean encodeMapFile(@NotNull final File file, final MapModel<G, A, R> mapModel) { - try { - final MapWriter<G, A, R> mapFileEncoder = new DefaultMapWriter<G, A, R>(mainControl, file); - try { - mapFileEncoder.encodeMapFile(mapModel); - } finally { - mapFileEncoder.close(); - } - - mainControl.getMapImageCache().updateCaches(file, this, MapImageCache.Type.ICON); - } catch (final IOException e) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "encodeMapFile", file, e.getMessage()); - return false; - } - return true; - } - - /** {@inheritDoc} */ - public void save() { - if (isPickmap()) { - mainControl.getMainView().setStatusText("Saving pickmap '" + getMapFileName() + "'..."); - } else { - mainControl.getMainView().setStatusText("Saving map '" + getMapFileName() + "'..."); - } - assert mapFile != null; - if (isModified()) { - mapModel.getMapArchObject().updateModifiedAttribute(); - } - if (!encodeMapFile(mapFile, mapModel)) { - return; - } - /* if we open a pickmap in the editor, is handled as normal map. - * to find out its original a pickmap we check the file name. - */ - if (!isPickmap()) { - mainControl.getObjectChooser().getPickmapChooserControl().reloadPickmap(mapFile); - } - resetModified(); - } - - /** {@inheritDoc} */ - public void saveAs(@NotNull final File file) { - mainControl.getMainView().setStatusText("Saving the map to a file..."); - if (!encodeMapFile(file, mapModel)) { - return; - } - mapFile = file; - setMapFileName(file.getName()); - resetModified(); - } - - /** {@inheritDoc} */ - public void addCopyToMap(final G gameObject, final Point pos, final boolean allowDouble, final boolean fillBelow) { - if (gameObject.isArchetype()) { - mapModel.addArchToMap(gameObject.getArchetypeName(), pos, allowDouble, false, fillBelow); - } else { - final G newGameObject = gameObject.createMultiClone(pos.x, pos.y); - for (G tmp = newGameObject; tmp != null; tmp = tmp.getMultiNext()) { - if (!mapModel.isPointValid(new Point(tmp.getMapX(), tmp.getMapY()))) { - // outside map - return; - } - } - - mapModel.addGameObjectToMap(newGameObject, fillBelow); - for (G tmp = newGameObject.getMultiNext(); tmp != null; tmp = tmp.getMultiNext()) { - mapModel.addGameObjectToMap(tmp, fillBelow); - mainControl.getArchetypeParser().postParseGameObject(tmp, activeEditType); - } - } - } - - /** {@inheritDoc} */ - public void repaint() { - for (final MapView<G, A, R, V> mapView : getMapViewFrames()) { - mapView.getView().getRenderer().forceRepaint(); - } - } - - /** {@inheritDoc} */ - public MapModel<G, A, R> getMapModel() { - return mapModel; - } - - /** {@inheritDoc} */ - public Iterable<MapSquare<G, A, R>> getAllSquares() { - return mapModel; - } - -} // class AbstractMapControl Copied: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java (from rev 3986, trunk/src/app/net/sf/gridarta/map/AbstractMapControl.java) =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java (rev 0) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-05-16 22:55:33 UTC (rev 3988) @@ -0,0 +1,581 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.map; + +import java.awt.Point; +import java.io.File; +import java.io.IOException; +import java.lang.ref.SoftReference; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import javax.swing.event.EventListenerList; +import net.sf.gridarta.CommonConstants; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapImageCache; +import net.sf.gridarta.Size2D; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; +import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.MapView; +import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.io.DefaultMapWriter; +import net.sf.gridarta.io.MapWriter; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * The class <code>AbstractMapControl</code> implements common code between + * crossfire and daimonin <code>MapControl</code>. + * + * @author Andreas Kirschbaum + */ +public class DefaultMapControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R>> implements MapControl<G, A, R, V> { + + /** + * Action Factory. + */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); + + /** + * List of all views of this map. Maps opened in the editor have one or + * more views; if the last view is closed, the map is closed, too. Maps + * opened by scripts or used internally may have zero or more views. + * Pickmaps always have exactly one view. + */ + private final List<MapView<G, A, R, V>> mapViews = new LinkedList<MapView<G, A, R, V>>(); + + /** The registered event listeners. */ + private final EventListenerList listenerList = new EventListenerList(); + + /** + * The main control. + */ + @NotNull private final MainControl<G, A, R, V> mainControl; + + /** + * Each view of this map will get a unique number. + */ + private int viewCounter = 0; + + /** + * Flag that indicates whether this is a pickmap or not. + */ + private final boolean isPickmap; + + /** + * model (= map data of this level). + */ + private final MapModel<G, A, R> mapModel; + + /** + * Set if the map has changed since last save. + */ + private boolean modified = false; + + @Nullable protected File mapFile; + + /** The filename of this map. */ + // TODO: Rename because the filename is a URI now. + @NotNull private String mapFileName = "<new map>"; + + /** + * Contains the edit types that have already been (requested and) + * calculated (edit types get calculated only when needed to save time). + */ + private int activeEditType = 0; + + /** + * Flag that indicates whether the level is closing or not. + */ + private boolean levelClosing = false; + + /** + * Reference to LevelRenderer, which is only used to get images. + */ + private SoftReference<LevelRenderer> levelRendererReference; + + /** + * The {@link MapModelListener} used to detect changes in the underlying + * map model and set the {@link #modified} flag accordingly. + */ + private final MapModelListener<G, A, R> mapModelListener = new MapModelListener<G, A, R>() { + + /** {@inheritDoc} */ + public void mapSizeChanged(final MapModelEvent<G, A, R> e) { + setModified(); + } + + /** {@inheritDoc} */ + public void mapSquaresChanged(final MapModelEvent<G, A, R> e) { + setModified(); + } + + /** {@inheritDoc} */ + public void mapObjectsChanged(final MapModelEvent<G, A, R> e) { + setModified(); + } + + /** {@inheritDoc} */ + public void mapMetaChanged(@NotNull final A mapArchObject) { + setModified(); + } + + /** {@inheritDoc} */ + public void errorsChanged(@NotNull final MapModel<G, A, R> mapModel) { + // ignore + } + + }; + + /** + * Create a new instance. + * + * @param mainControl The main control. + * + * @param isPickmap true if this is a pickmap + */ + public DefaultMapControl(@NotNull final MainControl<G, A, R, V> mainControl, final List<G> objects, final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher) { + this.mainControl = mainControl; + this.isPickmap = isPickmap; + // we create model (= data) + mapModel = new DefaultMapModel<G, A, R>(mainControl, this, objects, mapArchObject, exitTypeGameObjectMatcher); + mapModel.addMapModelListener(mapModelListener); + } + + /** {@inheritDoc} */ + public void levelCloseNotify() { + mapModel.removeMapModelListener(mapModelListener); + levelClosing = true; + } + + /** {@inheritDoc} */ + public boolean isClosing() { + return levelClosing; + } + + /** {@inheritDoc} */ + public boolean isModified() { + return modified; + } + + /** {@inheritDoc} */ + public void resetModified() { + if (!modified) { + return; + } + + modified = false; + fireModifiedChanged(); + } + + /** + * Set the level changed flag to true. + */ + public void setModified() { + if (modified) { + return; + } + + modified = true; + fireModifiedChanged(); + } + + /** {@inheritDoc} */ + public void addMapControlListener(@NotNull final MapControlListener<G, A, R, V> listener) { + listenerList.add(MapControlListener.class, listener); + } + + /** {@inheritDoc} */ + public void removeMapControlListener(@NotNull final MapControlListener<G, A, R, V> listener) { + listenerList.remove(MapControlListener.class, listener); + } + + /** Fire a map size changed event. */ + private void fireModifiedChanged() { + for (final MapControlListener<G, A, R, V> listener : listenerList.getListeners(MapControlListener.class)) { + listener.modifiedChanged(this); + } + } + + /** Fire a map file name changed event. */ + protected void fireMapFileNameChanged() { + for (final MapControlListener<G, A, R, V> listener : listenerList.getListeners(MapControlListener.class)) { + listener.mapFileNameChanged(this); + } + } + + /** Fire a icon changed event. */ + public void fireIconChanged() { + for (final MapControlListener<G, A, R, V> listener : listenerList.getListeners(MapControlListener.class)) { + listener.iconChanged(this); + } + } + + /** {@inheritDoc} */ + @Nullable public G insertSelectedObject(@NotNull final Point pos, final boolean allowMany) { + if (isPickmap()) { + insertMapArchToPickmap(pos); + return null; + } else { + return insertSelArchToMap(pos, allowMany); + } + } + + /** + * Take the currently selected arch (from archlist or pickmap) and insert + * it to the defined spot on the currently active map. + * @param pos coordinates on map + * @param allowMany when true, it is possible to insert same arches many times + * @return the inserted object, or <code>null</code> if nothing was inserted + */ + private G insertSelArchToMap(@NotNull final Point pos, final boolean allowMany) { + // this is the arch that would get inserted from pickmap, but it also could + // be a default arch (when pickmap has no selection) + final MapControl<G, A, R, V> activePickmap = mainControl.getObjectChooser().getPickmapChooserControl().getCurrentPickmap(); + G newarch = activePickmap == null ? null : activePickmap.getMapViewFrame().getSelectedGameObject(); + + final G newObject; + if (!mainControl.getObjectChooser().isPickmapActive() || isPickmap() || (newarch != null && newarch.isArchetype())) { + // insert default arch from archlist: + mapModel.beginTransaction("Insert"); // TODO: I18N/L10N + newObject = mapModel.addArchToMap(mainControl.getObjectChooser().getArchetypeChooserControl().getSelectedArch(), pos, allowMany, true, false); + mapModel.endTransaction(); + } else { + // insert custom arch from the pickmap: + if (newarch != null) { + boolean insertAllowed = true; // are we allowed to insert this? + if (!allowMany) { + // check if there is already an arch of that kind + for (final G t : mapModel.getMapSquare(pos)) { + if (t.hasSameArchetype(newarch) || t.getArchTypNr() == newarch.getArchTypNr()) { + insertAllowed = false; // there's a match - don't insert a second one + } + } + } + + if (insertAllowed) { + if (!newarch.isMulti()) { + // insert single tile from pickmap + newObject = newarch.createClone(pos.x, pos.y); + mapModel.addGameObjectToMap(newObject, false); + } else { + // insert multi tile from pickmap: + newarch = newarch.getHead(); + // first insert default arch from archlist + newObject = mapModel.addArchToMap(newarch.getArchetypeName(), pos, allowMany, false, false); + if (newObject != null) { + newObject.setObjectText(newarch.getObjectText()); + newObject.setObjName(newarch.getObjName()); + newObject.resetMsgText(); + newObject.addMsgText(newarch.getMsgText()); + } + } + } else { + newObject = null; + } + } else { + newObject = null; + } + } + + return newObject; + } + + /** + * This method is only called for pickmaps. Take the currently highlighted + * arch on the map (if any) and insert it on this pickmap. + * @param pos tile-coordinates in pickmap + */ + private void insertMapArchToPickmap(@NotNull final Point pos) { + final MapControl<G, A, R, V> currentMap = mainControl.getMapManager().getCurrentMap(); + // insertion is only allowed for valid *empty* squares + if (currentMap != null && isPickmap() && mapModel.isPointValid(pos) && mapModel.getMapSquare(pos).isEmpty()) { + // get the currently selected map arch + G newarch = mainControl.getSelectedSquareControl().getSelectedSquareView().getSelectedGameObject(); + if (newarch != null) { + newarch = newarch.getHead(); + + // check if all spaces are free that the multi will occupy + boolean allSpacesFree = true; + final Point d = new Point(); + for (R part = newarch.getArchetype(); part != null; part = (R) part.getMultiNext()) { + d.x = pos.x + part.getMultiX(); + d.y = pos.y + part.getMultiY(); + if (!mapModel.isPointValid(d) || !mapModel.getMapSquare(d).isEmpty()) { + allSpacesFree = false; + break; + } + } + if (allSpacesFree) { + addCopyToMap(newarch, pos, true, false); + } + } + } + } + + /** {@inheritDoc} */ + public boolean isPlainSaveEnabled() { + return mapFile != null && !getMapFileName().equals(CommonConstants.DEF_MAPFNAME); + } + + /** {@inheritDoc} */ + // TODO: Rename because the filename is a URI now. + @NotNull public String getMapFileName() { + return mapFileName; + } + + /** {@inheritDoc} */ + public void setMapFileName(@NotNull final String mapFileName) { + if (this.mapFileName.equals(mapFileName)) { + return; + } + + this.mapFileName = mapFileName; + + fireMapFileNameChanged(); + } + + /** {@inheritDoc} */ + public void setMapFile(@Nullable final File file) { + mapFile = file; + } + + /** {@inheritDoc} */ + @Nullable public File getMapFile() { + return mapFile; + } + + /** {@inheritDoc} */ + @NotNull public List<G> getAllGameObjects() { + final List<G> gameObjects = new ArrayList<G>(); + for (final MapSquare<G, A, R> mapSquare : getAllSquares()) { + for (final G gameObject : mapSquare) { + gameObjects.add(gameObject.getHead()); + } + } + return gameObjects; + } + + /** + * Return the edit types that have already been (requested and) calculated + * (edit types get calculated only when needed to save time). + * + * @return the edit types that have already been calculated + */ + public int getActiveEditType() { + return activeEditType; + } + + /** {@inheritDoc} */ + public void setActiveEditType(final int activeEditType) { + this.activeEditType = activeEditType; + } + + /** + * Checks if the given edit type is active or not. + * @param editType edit type + * @return true if this edit type is active + */ + public boolean hasEditType(final int editType) { + return (activeEditType & editType) != 0; + } + + /** {@inheritDoc} */ + public void addEditType(final int editType) { + // calculate only if needed + if (!hasEditType(editType)) { + final Size2D mapSize = mapModel.getMapSize(); + final Point pos = new Point(); + for (pos.x = 0; pos.x < mapSize.getWidth(); pos.x++) { + for (pos.y = 0; pos.y < mapSize.getHeight(); pos.y++) { + for (final G arch : mapModel.getMapSquare(pos)) { + arch.updateEditType(editType); + } + } + } + // from now on we have this type, so we don't have to calculate it again + activeEditType |= editType; + } + } + + /** {@inheritDoc} */ + @NotNull public Point[] getViewPositions() { + final Point[] result = new Point[mapViews.size()]; + for (int i = 0; i < result.length; i++) { + result[i] = mapViews.get(i).getView().getViewPosition(); + } + return result; + } + + /** {@inheritDoc} */ + public int nViews() { + return mapViews.size(); + } + + /** + * Get the last used view of this level. + * @return the last used view + */ + @Nullable public MapView<G, A, R, V> getMapViewFrame() { + return !mapViews.isEmpty() ? mapViews.get(0) : null; + } + + /** {@inheritDoc} */ + public List<MapView<G, A, R, V>> getMapViewFrames() { + return mapViews; + } + + /** {@inheritDoc} */ + @NotNull public MapView<G, A, R, V> createView(@Nullable final Point viewPosition) { + final MapView<G, A, R, V> mapView = mainControl.getGridartaObjectsFactory().newMapView(this, viewPosition, ++viewCounter); + mapViews.add(mapView); + return mapView; + } + + /** {@inheritDoc} */ + public void closeView(@NotNull final MapView<G, A, R, V> mapView) { + mapView.closeNotify(); + mapViews.remove(mapView); + } + + /** {@inheritDoc} */ + public void setFocus(final MapView<G, A, R, V> mapView) { + assert mapViews.contains(mapView); + mapViews.remove(mapView); + mapViews.add(0, mapView); + } + + /** {@inheritDoc} */ + public boolean isPickmap() { + return isPickmap; + } + + /** {@inheritDoc} */ + public LevelRenderer getRenderer() { + final LevelRenderer tmpLevelRenderer = levelRendererReference == null ? null : levelRendererReference.get(); + final LevelRenderer levelRenderer; + if (tmpLevelRenderer == null) { + levelRenderer = mainControl.getGridartaObjectsFactory().newSimpleLevelRenderer(mapModel, mainControl.getArchetypeSet()); + levelRendererReference = new SoftReference<LevelRenderer>(levelRenderer); + } else { + levelRenderer = tmpLevelRenderer; + } + return levelRenderer; + } + + /** + * Save a map. + * @param file File to save to + * @param mapModel MapModel to save + * @return Whether saving was successful. + */ + protected boolean encodeMapFile(@NotNull final File file, final MapModel<G, A, R> mapModel) { + try { + final MapWriter<G, A, R> mapFileEncoder = new DefaultMapWriter<G, A, R>(mainControl, file); + try { + mapFileEncoder.encodeMapFile(mapModel); + } finally { + mapFileEncoder.close(); + } + + mainControl.getMapImageCache().updateCaches(file, this, MapImageCache.Type.ICON); + } catch (final IOException e) { + ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "encodeMapFile", file, e.getMessage()); + return false; + } + return true; + } + + /** {@inheritDoc} */ + public void save() { + if (isPickmap()) { + mainControl.getMainView().setStatusText("Saving pickmap '" + getMapFileName() + "'..."); + } else { + mainControl.getMainView().setStatusText("Saving map '" + getMapFileName() + "'..."); + } + assert mapFile != null; + if (isModified()) { + mapModel.getMapArchObject().updateModifiedAttribute(); + } + if (!encodeMapFile(mapFile, mapModel)) { + return; + } + /* if we open a pickmap in the editor, is handled as normal map. + * to find out its original a pickmap we check the file name. + */ + if (!isPickmap()) { + mainControl.getObjectChooser().getPickmapChooserControl().reloadPickmap(mapFile); + } + resetModified(); + } + + /** {@inheritDoc} */ + public void saveAs(@NotNull final File file) { + mainControl.getMainView().setStatusText("Saving the map to a file..."); + if (!encodeMapFile(file, mapModel)) { + return; + } + mapFile = file; + setMapFileName(file.getName()); + resetModified(); + } + + /** {@inheritDoc} */ + public void addCopyToMap(final G gameObject, final Point pos, final boolean allowDouble, final boolean fillBelow) { + if (gameObject.isArchetype()) { + mapModel.addArchToMap(gameObject.getArchetypeName(), pos, allowDouble, false, fillBelow); + } else { + final G newGameObject = gameObject.createMultiClone(pos.x, pos.y); + for (G tmp = newGameObject; tmp != null; tmp = tmp.getMultiNext()) { + if (!mapModel.isPointValid(new Point(tmp.getMapX(), tmp.getMapY()))) { + // outside map + return; + } + } + + mapModel.addGameObjectToMap(newGameObject, fillBelow); + for (G tmp = newGameObject.getMultiNext(); tmp != null; tmp = tmp.getMultiNext()) { + mapModel.addGameObjectToMap(tmp, fillBelow); + mainControl.getArchetypeParser().postParseGameObject(tmp, activeEditType); + } + } + } + + /** {@inheritDoc} */ + public void repaint() { + for (final MapView<G, A, R, V> mapView : getMapViewFrames()) { + mapView.getView().getRenderer().forceRepaint(); + } + } + + /** {@inheritDoc} */ + public MapModel<G, A, R> getMapModel() { + return mapModel; + } + + /** {@inheritDoc} */ + public Iterable<MapSquare<G, A, R>> getAllSquares() { + return mapModel; + } + +} // class DefaultMapControl Property changes on: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-17 00:20:34
|
Revision: 4003 http://gridarta.svn.sourceforge.net/gridarta/?rev=4003&view=rev Author: akirschbaum Date: 2008-05-16 17:20:39 -0700 (Fri, 16 May 2008) Log Message: ----------- Remove redundant parameter. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java trunk/src/app/net/sf/gridarta/map/MapModel.java Modified: trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java 2008-05-17 00:03:30 UTC (rev 4002) +++ trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java 2008-05-17 00:20:39 UTC (rev 4003) @@ -114,7 +114,7 @@ } if (tmpArch != null) { mapControl.getMapModel().beginTransaction("Delete Object"); - mapControl.getMapModel().deleteMapArch(tmpArch, temp, true); + mapControl.getMapModel().deleteMapArch(tmpArch, true); mapControl.getMapModel().endTransaction(); } } @@ -210,7 +210,7 @@ } if (tmpArch != null) { mapControl.getMapModel().beginTransaction("Delete Object"); - mapControl.getMapModel().deleteMapArch(tmpArch, mapLoc, true); + mapControl.getMapModel().deleteMapArch(tmpArch, true); mapControl.getMapModel().endTransaction(); } } Modified: trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java 2008-05-17 00:03:30 UTC (rev 4002) +++ trunk/daimonin/src/daieditor/gui/map/tools/DeletionTool.java 2008-05-17 00:20:39 UTC (rev 4003) @@ -102,7 +102,7 @@ } if (delArch != null) { mapSquare.getModel().beginTransaction("Delete Object"); - mapSquare.getModel().deleteMapArch(delArch, mapLoc, true); + mapSquare.getModel().deleteMapArch(delArch, true); mapSquare.getModel().endTransaction(); } } Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-05-17 00:03:30 UTC (rev 4002) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-05-17 00:20:39 UTC (rev 4003) @@ -188,7 +188,7 @@ mapControl.getMapModel().beginTransaction("Delete"); // TODO; I18N/L10N final G entry = view.getListGameObject(index); if (entry != null) { - mapControl.getMapModel().deleteMapArch(entry, new Point(mapSquare.getMapX(), mapSquare.getMapY()), true); + mapControl.getMapModel().deleteMapArch(entry, true); } mapControl.getMapModel().endTransaction(); Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-05-17 00:03:30 UTC (rev 4002) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-05-17 00:20:39 UTC (rev 4003) @@ -544,9 +544,9 @@ } /** {@inheritDoc} */ - public void deleteMapArch(@NotNull final G gameObject, @NotNull final Point pos, final boolean join) { - assert gameObject.getMapSquare() == getMapSquare(pos); - + public void deleteMapArch(@NotNull final G gameObject, final boolean join) { + final MapSquare<?, ?, ?> mapSquare = gameObject.getMapSquare(); + assert mapSquare != null; if (gameObject.isInContainer()) { gameObject.remove(); } else { @@ -558,7 +558,7 @@ final AutojoinList<G, A, R> autojoinList = mainControl.getAutojoinLists().getAutojoinList(archetype); if (autojoinList != null) { // remove connections to the deleted arch - autojoinList.joinDelete(this, pos); + autojoinList.joinDelete(this, new Point(mapSquare.getMapX(), mapSquare.getMapY())); } } } Modified: trunk/src/app/net/sf/gridarta/map/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapModel.java 2008-05-17 00:03:30 UTC (rev 4002) +++ trunk/src/app/net/sf/gridarta/map/MapModel.java 2008-05-17 00:20:39 UTC (rev 4003) @@ -366,14 +366,11 @@ @Nullable G getExit(@Nullable Point hspot); /** - * Delete an existing arch from the map. (If the specified arch doesn't - * exist, nothing happens.) (This includes deletion of multiparts and - * inventory.) + * Delete an existing arch from the map. * @param gameObject the game object to remove - * @param pos location of the arch to be removed * @param join if set, auto-joining is supported */ - void deleteMapArch(@NotNull G gameObject, @NotNull Point pos, boolean join); + void deleteMapArch(@NotNull G gameObject, boolean join); /** * Returns the MapControl that controls this MapModel. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-17 00:27:17
|
Revision: 4004 http://gridarta.svn.sourceforge.net/gridarta/?rev=4004&view=rev Author: akirschbaum Date: 2008-05-16 17:27:25 -0700 (Fri, 16 May 2008) Log Message: ----------- Remove access to mainControl from DefaultMapControl. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-05-17 00:20:39 UTC (rev 4003) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-05-17 00:27:25 UTC (rev 4004) @@ -97,12 +97,12 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchers.getMatcher("exit")); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchers.getMatcher("exit")); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchers.getMatcher("exit")); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchers.getMatcher("exit")); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-05-17 00:20:39 UTC (rev 4003) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-05-17 00:27:25 UTC (rev 4004) @@ -97,12 +97,12 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchers.getMatcher("exit")); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchers.getMatcher("exit")); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchers.getMatcher("exit")); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchers.getMatcher("exit")); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-05-17 00:20:39 UTC (rev 4003) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-05-17 00:27:25 UTC (rev 4004) @@ -31,6 +31,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.Size2D; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.match.GameObjectMatcher; @@ -68,6 +69,11 @@ private final EventListenerList listenerList = new EventListenerList(); /** + * The {@link GridartaObjectsFactory} instance. + */ + @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + + /** * The main control. */ @NotNull private final MainControl<G, A, R, V> mainControl; @@ -151,13 +157,15 @@ /** * Creates a new instance. + * @param gridartaObjectsFactory the gridarta objects factory instance * @param mainControl the main control * @param objects the game objects to insert; my be <code>null</code> * @param mapArchObject the map arch object for this map * @param isPickmap true if this is a pickmap * @param exitTypeGameObjectMatcher the matcher to select exit objects */ - public DefaultMapControl(@NotNull final MainControl<G, A, R, V> mainControl, final List<G> objects, final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher) { + public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MainControl<G, A, R, V> mainControl, final List<G> objects, final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher) { + this.gridartaObjectsFactory = gridartaObjectsFactory; this.mainControl = mainControl; this.isPickmap = isPickmap; // we create model (= data) @@ -392,7 +400,7 @@ /** {@inheritDoc} */ @NotNull public MapView<G, A, R, V> createView(@Nullable final Point viewPosition) { - final MapView<G, A, R, V> mapView = mainControl.getGridartaObjectsFactory().newMapView(this, viewPosition, ++viewCounter); + final MapView<G, A, R, V> mapView = gridartaObjectsFactory.newMapView(this, viewPosition, ++viewCounter); mapViews.add(mapView); return mapView; } @@ -420,7 +428,7 @@ final LevelRenderer tmpLevelRenderer = levelRendererReference == null ? null : levelRendererReference.get(); final LevelRenderer levelRenderer; if (tmpLevelRenderer == null) { - levelRenderer = mainControl.getGridartaObjectsFactory().newSimpleLevelRenderer(mapModel, mainControl.getArchetypeSet()); + levelRenderer = gridartaObjectsFactory.newSimpleLevelRenderer(mapModel, mainControl.getArchetypeSet()); levelRendererReference = new SoftReference<LevelRenderer>(levelRenderer); } else { levelRenderer = tmpLevelRenderer; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-17 00:42:35
|
Revision: 4005 http://gridarta.svn.sourceforge.net/gridarta/?rev=4005&view=rev Author: akirschbaum Date: 2008-05-16 17:42:43 -0700 (Fri, 16 May 2008) Log Message: ----------- Move MapControl.insertSelectedObject() to ObjectChooser. Modified Paths: -------------- trunk/crossfire/crossfire.iml trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java trunk/gridarta.iml trunk/gridarta.ipr trunk/src/app/net/sf/gridarta/gui/AbstractObjectChooser.java trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java trunk/src/app/net/sf/gridarta/map/MapControl.java Modified: trunk/crossfire/crossfire.iml =================================================================== --- trunk/crossfire/crossfire.iml 2008-05-17 00:27:25 UTC (rev 4004) +++ trunk/crossfire/crossfire.iml 2008-05-17 00:42:43 UTC (rev 4005) @@ -21,10 +21,23 @@ <SOURCES /> </library> </orderEntry> + <orderEntry type="library" name="log4j-1.2.13" level="project" /> + <orderEntry type="library" name="junit-4.2" level="project" /> + <orderEntry type="library" name="annotations" level="project" /> + <orderEntry type="library" name="japi-lib-lang-0.1" level="project" /> + <orderEntry type="library" name="japi-lib-xml-0.1" level="project" /> + <orderEntry type="library" name="japi-lib-swing-action-0.1" level="project" /> + <orderEntry type="library" name="japi-lib-util-0.1" level="project" /> + <orderEntry type="library" name="japi-lib-swing-misc-0.1" level="project" /> + <orderEntry type="library" name="japi-lib-swing-prefs-0.1" level="project" /> + <orderEntry type="library" name="japi-lib-swing-extlib-0.1" level="project" /> + <orderEntry type="library" name="japi-lib-swing-about-0.1" level="project" /> + <orderEntry type="module" module-name="textedit" /> + <orderEntry type="library" name="japi-lib-swing-tod-0.1" level="project" /> <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/bsh-classgen.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/bsh-commands-2.0b4.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -33,7 +46,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/bsh-commands.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/bsh-classgen-2.0b4.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -42,7 +55,7 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/bsh-util.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/bsh-core-2.0b4.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> @@ -51,25 +64,12 @@ <orderEntry type="module-library"> <library> <CLASSES> - <root url="jar://$MODULE_DIR$/lib/bsh-core.jar!/" /> + <root url="jar://$MODULE_DIR$/lib/bsh-util-2.0b4.jar!/" /> </CLASSES> <JAVADOC /> <SOURCES /> </library> </orderEntry> - <orderEntry type="library" name="log4j-1.2.13" level="project" /> - <orderEntry type="library" name="junit-4.2" level="project" /> - <orderEntry type="library" name="annotations" level="project" /> - <orderEntry type="library" name="japi-lib-lang-0.1" level="project" /> - <orderEntry type="library" name="japi-lib-xml-0.1" level="project" /> - <orderEntry type="library" name="japi-lib-swing-action-0.1" level="project" /> - <orderEntry type="library" name="japi-lib-util-0.1" level="project" /> - <orderEntry type="library" name="japi-lib-swing-misc-0.1" level="project" /> - <orderEntry type="library" name="japi-lib-swing-prefs-0.1" level="project" /> - <orderEntry type="library" name="japi-lib-swing-extlib-0.1" level="project" /> - <orderEntry type="library" name="japi-lib-swing-about-0.1" level="project" /> - <orderEntry type="module" module-name="textedit" /> - <orderEntry type="library" name="japi-lib-swing-tod-0.1" level="project" /> <orderEntryProperties /> </component> <component name="copyright"> Modified: trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java 2008-05-17 00:27:25 UTC (rev 4004) +++ trunk/crossfire/src/cfeditor/gui/map/MapUserListener.java 2008-05-17 00:42:43 UTC (rev 4005) @@ -97,7 +97,7 @@ } else if (isInsert(e)) { if (mapCursor.setLocation(temp) && temp != null) { mapControl.getMapModel().beginTransaction("Insert Object"); - final GameObject insertedObject = mapControl.insertSelectedObject(temp, false); + final GameObject insertedObject = mainControl.getObjectChooser().insertSelectedObject(mapControl, temp, false); mapControl.getMapModel().endTransaction(); selectedSquareView.setSelectedGameObject(insertedObject); } @@ -172,7 +172,7 @@ private void insertObject(final Point mapLoc) { if (mapLoc.x != -1 && mapLoc.y != -1) { mapControl.getMapModel().beginTransaction("Insert Object"); - final GameObject insertedObject = mapControl.insertSelectedObject(mapLoc, true); + final GameObject insertedObject = mainControl.getObjectChooser().insertSelectedObject(mapControl, mapLoc, true); mapControl.getMapModel().endTransaction(); selectedSquareView.setSelectedGameObject(insertedObject); } Modified: trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java 2008-05-17 00:27:25 UTC (rev 4004) +++ trunk/daimonin/src/daieditor/gui/map/tools/InsertionTool.java 2008-05-17 00:42:43 UTC (rev 4005) @@ -71,7 +71,7 @@ final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = e.getMapControl(); if (p != null) { mapControl.getMapModel().beginTransaction("Insert Object"); - final GameObject insertedObject = mapControl.insertSelectedObject(p, true); + final GameObject insertedObject = mainControl.getObjectChooser().insertSelectedObject(mapControl, p, true); if (!mapControl.isPickmap()) { mapCursor.setLocation(p); } @@ -87,7 +87,7 @@ final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = e.getMapControl(); if (!mapControl.isPickmap() && mapCursor.setLocationSafe(p)) { mapControl.getMapModel().beginTransaction("Insert Object"); - final GameObject insertedObject = mapControl.insertSelectedObject(p, false); + final GameObject insertedObject = mainControl.getObjectChooser().insertSelectedObject(mapControl, p, false); mapControl.getMapModel().endTransaction(); mainControl.getSelectedSquareControl().getSelectedSquareView().setSelectedGameObject(insertedObject); } Modified: trunk/gridarta.iml =================================================================== --- trunk/gridarta.iml 2008-05-17 00:27:25 UTC (rev 4004) +++ trunk/gridarta.iml 2008-05-17 00:42:43 UTC (rev 4005) @@ -24,6 +24,7 @@ <orderEntry type="library" name="japi-lib-swing-prefs-0.1" level="project" /> <orderEntry type="library" name="japi-lib-swing-extlib-0.1" level="project" /> <orderEntry type="library" name="japi-lib-swing-about-0.1" level="project" /> + <orderEntry type="module" module-name="textedit" /> <orderEntryProperties /> </component> <component name="copyright"> Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2008-05-17 00:27:25 UTC (rev 4004) +++ trunk/gridarta.ipr 2008-05-17 00:42:43 UTC (rev 4005) @@ -33,7 +33,7 @@ <package name="" withSubpackages="true" /> </value> </option> - <option name="RIGHT_MARGIN" value="160" /> + <option name="RIGHT_MARGIN" value="80" /> <option name="IF_BRACE_FORCE" value="3" /> <option name="DOWHILE_BRACE_FORCE" value="3" /> <option name="WHILE_BRACE_FORCE" value="3" /> @@ -327,7 +327,6 @@ <inspection_tool class="TrivialIfJS" level="WARNING" enabled="false" /> <inspection_tool class="SimplifiableConditionalExpression" level="WARNING" enabled="false" /> <inspection_tool class="IncompatibleMask" level="WARNING" enabled="false" /> - <inspection_tool class="UNUSED_IMPORT" level="WARNING" enabled="false" /> <inspection_tool class="DuplicateCaseLabelJS" level="WARNING" enabled="false" /> <inspection_tool class="PointlessBitwiseExpressionJS" level="WARNING" enabled="false"> <option name="m_ignoreExpressionsContainingConstants" value="false" /> @@ -392,8 +391,7 @@ </inspection_tool> <inspection_tool class="Deprecation" level="WARNING" enabled="false" /> <inspection_tool class="StrutsInspection" level="ERROR" enabled="false" /> - <inspection_tool class="MissingDeprecatedAnnotation" level="WARNING" enabled="true" /> - <inspection_tool class="JavaDoc" level="WARNING" enabled="true"> + <inspection_tool class="JavaDoc" level="WARNING" enabled="false"> <option name="TOP_LEVEL_CLASS_OPTIONS"> <value> <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="public" /> @@ -422,6 +420,13 @@ <option name="IGNORE_JAVADOC_PERIOD" value="false" /> <option name="myAdditionalJavadocTags" value="todo,note,todo,xxx,note,todo,fixme,fixme,warning,invariant,retval,pre" /> </inspection_tool> + <inspection_tool class="JavadocReference" level="ERROR" enabled="false" /> + <inspection_tool class="OnDemandImport" level="WARNING" enabled="true" /> + <inspection_tool class="SamePackageImport" level="WARNING" enabled="true" /> + <inspection_tool class="JavaLangImport" level="WARNING" enabled="true" /> + <inspection_tool class="RedundantImport" level="WARNING" enabled="true" /> + <inspection_tool class="UnusedImport" level="WARNING" enabled="true" /> + <inspection_tool class="UNUSED_IMPORT" level="WARNING" enabled="false" /> </profile> <profile version="1.0" is_locked="true"> <option name="myName" value="No errors allowed here" /> @@ -1667,7 +1672,6 @@ </inspection_tool> <inspection_tool class="ConstantOnRHSOfComparisonJS" level="WARNING" enabled="false" /> <inspection_tool class="ConstantDeclaredInInterface" level="WARNING" enabled="false" /> - <inspection_tool class="SuspiciousIndentAfterControlStatement" level="WARNING" enabled="false" /> </profile> <profile version="1.0" is_locked="false"> <option name="myName" value="Project Default" /> @@ -1707,6 +1711,718 @@ <inspection_tool class="MultipleDeclaration" level="WARNING" enabled="true" /> <inspection_tool class="FloatingPointEquality" level="WARNING" enabled="true" /> </profile> + <profile version="1.0" is_locked="false"> + <option name="myName" value="ank" /> + <option name="myLocal" value="false" /> + <inspection_tool class="FieldCanBeLocal" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryModuleDependencyInspection" level="WARNING" enabled="false" /> + <inspection_tool class="WebProperties" level="ERROR" enabled="false" /> + <inspection_tool class="CssOverwrittenProperties" level="WARNING" enabled="false" /> + <inspection_tool class="CheckJsfComponentUnderViewTag" level="INFO" enabled="false" /> + <inspection_tool class="TrivialIfJS" level="WARNING" enabled="false" /> + <inspection_tool class="EjbWarningInspection" level="WARNING" enabled="false" /> + <inspection_tool class="AntMissingPropertiesFileInspection" level="ERROR" enabled="false" /> + <inspection_tool class="NonSerializableServiceParameters" level="ERROR" enabled="false" /> + <inspection_tool class="MissingMnemonic" level="WARNING" enabled="false" /> + <inspection_tool class="OneButtonGroup" level="WARNING" enabled="false" /> + <inspection_tool class="BadExpressionStatementJS" level="WARNING" enabled="false" /> + <inspection_tool class="UnusedLabel" level="WARNING" enabled="false" /> + <inspection_tool class="ComponentRegistrationProblems" level="ERROR" enabled="false"> + <option name="CHECK_PLUGIN_XML" value="true" /> + <option name="CHECK_JAVA_CODE" value="true" /> + <option name="CHECK_ACTIONS" value="true" /> + </inspection_tool> + <inspection_tool class="SimplifiableIfStatement" level="WARNING" enabled="false" /> + <inspection_tool class="ReturnFromFinallyBlock" level="WARNING" enabled="false" /> + <inspection_tool class="ConstantConditions" level="WARNING" enabled="false"> + <option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" /> + <option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" /> + </inspection_tool> + <inspection_tool class="StrutsValidatorInspection" level="ERROR" enabled="false" /> + <inspection_tool class="FunctionWithInconsistentReturnsJS" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryLocalVariableJS" level="WARNING" enabled="false"> + <option name="m_ignoreImmediatelyReturnedVariables" value="false" /> + <option name="m_ignoreAnnotatedVariables" value="false" /> + </inspection_tool> + <inspection_tool class="UnhandledExceptionInJSP" level="WARNING" enabled="false" /> + <inspection_tool class="StrutsInspection" level="ERROR" enabled="false" /> + <inspection_tool class="EjbDomInspection" level="ERROR" enabled="false" /> + <inspection_tool class="InfiniteLoopStatement" level="WARNING" enabled="false" /> + <inspection_tool class="FacesModelInspection" level="ERROR" enabled="false" /> + <inspection_tool class="UnnecessaryLabelOnContinueStatement" level="WARNING" enabled="false" /> + <inspection_tool class="FinallyBlockCannotCompleteNormally" level="WARNING" enabled="false" /> + <inspection_tool class="ShiftOutOfRangeJS" level="WARNING" enabled="false" /> + <inspection_tool class="RequiredAttributes" level="WARNING" enabled="false"> + <option name="myAdditionalRequiredHtmlAttributes" value="" /> + </inspection_tool> + <inspection_tool class="UnusedMessageFormatParameter" level="WARNING" enabled="false" /> + <inspection_tool class="DuplicateMnemonic" level="WARNING" enabled="false" /> + <inspection_tool class="TrivialIf" level="WARNING" enabled="false" /> + <inspection_tool class="ThrowFromFinallyBlockJS" level="WARNING" enabled="false" /> + <inspection_tool class="AntDuplicateImportedTargetsInspection" level="WARNING" enabled="false" /> + <inspection_tool class="CanBeFinal" level="WARNING" enabled="false"> + <option name="REPORT_CLASSES" value="false" /> + <option name="REPORT_METHODS" value="false" /> + <option name="REPORT_FIELDS" value="true" /> + </inspection_tool> + <inspection_tool class="DefaultFileTemplate" level="WARNING" enabled="false"> + <option name="CHECK_FILE_HEADER" value="true" /> + <option name="CHECK_TRY_CATCH_SECTION" value="true" /> + <option name="CHECK_METHOD_BODY" value="true" /> + </inspection_tool> + <inspection_tool class="UnnecessaryLabelOnBreakStatementJS" level="WARNING" enabled="false" /> + <inspection_tool class="NoLabelFor" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryReturn" level="WARNING" enabled="false" /> + <inspection_tool class="DuplicateCaseLabelJS" level="WARNING" enabled="false" /> + <inspection_tool class="InfiniteLoopJS" level="WARNING" enabled="false" /> + <inspection_tool class="GwtServiceNotRegistered" level="ERROR" enabled="false" /> + <inspection_tool class="BooleanMethodIsAlwaysInverted" level="WARNING" enabled="false" /> + <inspection_tool class="NonJREEmulationClassesInClientCode" level="ERROR" enabled="false" /> + <inspection_tool class="JSUnresolvedFunction" level="INFO" enabled="false" /> + <inspection_tool class="ELValidationInJSP" level="WARNING" enabled="false" /> + <inspection_tool class="FinalStaticMethod" level="WARNING" enabled="false" /> + <inspection_tool class="SameParameterValue" level="WARNING" enabled="false" /> + <inspection_tool class="AntDuplicateTargetsInspection" level="ERROR" enabled="false" /> + <inspection_tool class="ReservedWordUsedAsNameJS" level="WARNING" enabled="false" /> + <inspection_tool class="ComponentNotRegistered" level="WARNING" enabled="false"> + <option name="CHECK_ACTIONS" value="true" /> + <option name="IGNORE_NON_PUBLIC" value="true" /> + </inspection_tool> + <inspection_tool class="ReflectionForUnavailableAnnotation" level="WARNING" enabled="false" /> + <inspection_tool class="ExceptionCaughtLocallyJS" level="WARNING" enabled="false" /> + <inspection_tool class="PointlessBooleanExpressionJS" level="WARNING" enabled="false" /> + <inspection_tool class="WeakerAccess" level="WARNING" enabled="false"> + <option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="true" /> + <option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="true" /> + <option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" /> + </inspection_tool> + <inspection_tool class="Glassfish" level="ERROR" enabled="false" /> + <inspection_tool class="UnusedReturnValue" level="WARNING" enabled="false" /> + <inspection_tool class="GwtToHtmlReferences" level="ERROR" enabled="false" /> + <inspection_tool class="GWTRemoteServiceAsyncCheck" level="ERROR" enabled="false" /> + <inspection_tool class="InfiniteRecursionJS" level="WARNING" enabled="false" /> + <inspection_tool class="SimplifiableConditionalExpression" level="WARNING" enabled="false" /> + <inspection_tool class="Dependency" level="ERROR" enabled="false" /> + <inspection_tool class="SillyAssignmentJS" level="WARNING" enabled="false" /> + <inspection_tool class="GwtInconsistentI18nInterface" level="ERROR" enabled="false" /> + <inspection_tool class="FinalPrivateMethod" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryLabelOnContinueStatementJS" level="WARNING" enabled="false" /> + <inspection_tool class="CssUnitlessNumber" level="WARNING" enabled="false" /> + <inspection_tool class="EjbQlInspection" level="ERROR" enabled="false" /> + <inspection_tool class="UnusedParameters" level="WARNING" enabled="false" /> + <inspection_tool class="PointlessArithmeticExpressionJS" level="WARNING" enabled="false" /> + <inspection_tool class="ConstantIfStatement" level="WARNING" enabled="false" /> + <inspection_tool class="JSUnresolvedVariable" level="INFO" enabled="false" /> + <inspection_tool class="CheckValidXmlInScriptTagBody" level="ERROR" enabled="false" /> + <inspection_tool class="PointlessBitwiseExpressionJS" level="WARNING" enabled="false"> + <option name="m_ignoreExpressionsContainingConstants" value="false" /> + </inspection_tool> + <inspection_tool class="StrutsTilesInspection" level="ERROR" enabled="false" /> + <inspection_tool class="PointlessArithmeticExpression" level="WARNING" enabled="false"> + <option name="m_ignoreExpressionsContainingConstants" value="false" /> + </inspection_tool> + <inspection_tool class="UnnecessaryLocalVariable" level="WARNING" enabled="false"> + <option name="m_ignoreImmediatelyReturnedVariables" value="false" /> + <option name="m_ignoreAnnotatedVariables" value="false" /> + </inspection_tool> + <inspection_tool class="FinalizeCallsSuperFinalize" level="WARNING" enabled="false"> + <option name="m_ignoreForObjectSubclasses" value="false" /> + </inspection_tool> + <inspection_tool class="SynchronizeOnNonFinalField" level="WARNING" enabled="false" /> + <inspection_tool class="OctalLiteral" level="WARNING" enabled="false" /> + <inspection_tool class="Geronimo" level="ERROR" enabled="false" /> + <inspection_tool class="PointlessBooleanExpression" level="WARNING" enabled="false"> + <option name="m_ignoreExpressionsContainingConstants" value="false" /> + </inspection_tool> + <inspection_tool class="BoundFieldAssignment" level="WARNING" enabled="false" /> + <inspection_tool class="GWTStyleCheck" level="ERROR" enabled="false" /> + <inspection_tool class="ExtendsAnnotation" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryLabelOnBreakStatement" level="WARNING" enabled="false" /> + <inspection_tool class="StringEquality" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryReturnJS" level="WARNING" enabled="false" /> + <inspection_tool class="SelfIncludingJspFiles" level="ERROR" enabled="false" /> + <inspection_tool class="DuplicatePropertyOnObjectJS" level="WARNING" enabled="false" /> + <inspection_tool class="SameReturnValue" level="WARNING" enabled="false" /> + <inspection_tool class="UnreachableCodeJS" level="WARNING" enabled="false" /> + <inspection_tool class="ConstantConditionalExpression" level="WARNING" enabled="false" /> + <inspection_tool class="LoopStatementThatDoesntLoopJS" level="WARNING" enabled="false" /> + <inspection_tool class="ThrowFromFinallyBlock" level="WARNING" enabled="false" /> + <inspection_tool class="NoExplicitFinalizeCalls" level="WARNING" enabled="false" /> + <inspection_tool class="UnusedDeclaration" level="WARNING" enabled="false"> + <option name="ADD_MAINS_TO_ENTRIES" value="true" /> + <option name="ADD_APPLET_TO_ENTRIES" value="true" /> + <option name="ADD_SERVLET_TO_ENTRIES" value="true" /> + <option name="ADD_NONJAVA_TO_ENTRIES" value="true" /> + <option name="ADDITIONAL_ANNOTATIONS"> + <value> + <list size="0" /> + </value> + </option> + <option name="ADD_EJB_TO_ENTRIES" value="true" /> + <option name="ADD_JUNIT_TO_ENTRIES" value="true" /> + <option name="ADD_TESTNG_TO_ENTRIES" value="true" /> + </inspection_tool> + <inspection_tool class="DuplicateThrows" level="WARNING" enabled="false" /> + <inspection_tool class="ContinueOrBreakFromFinallyBlockJS" level="WARNING" enabled="false" /> + <inspection_tool class="EjbErrorInspection" level="ERROR" enabled="false" /> + <inspection_tool class="JBoss" level="ERROR" enabled="false" /> + <inspection_tool class="IncompatibleMaskJS" level="WARNING" enabled="false" /> + <inspection_tool class="CssNoGenericFontName" level="WARNING" enabled="false" /> + <inspection_tool class="LoopStatementsThatDontLoop" level="WARNING" enabled="false" /> + <inspection_tool class="TrivialConditionalJS" level="WARNING" enabled="false" /> + <inspection_tool class="JSUndeclaredVariable" level="INFO" enabled="false" /> + <inspection_tool class="RedundantThrows" level="WARNING" enabled="false" /> + <inspection_tool class="ConstantConditionalExpressionJS" level="WARNING" enabled="false" /> + <inspection_tool class="FallthroughInSwitchStatementJS" level="WARNING" enabled="false" /> + <inspection_tool class="UNUSED_SYMBOL" level="WARNING" enabled="false"> + <option name="LOCAL_VARIABLE" value="true" /> + <option name="FIELD" value="true" /> + <option name="METHOD" value="true" /> + <option name="CLASS" value="true" /> + <option name="PARAMETER" value="true" /> + <option name="REPORT_PARAMETER_FOR_PUBLIC_METHODS" value="true" /> + <option name="INJECTION_ANNOS"> + <value> + <list size="0" /> + </value> + </option> + </inspection_tool> + <inspection_tool class="ReturnFromFinallyBlockJS" level="WARNING" enabled="false" /> + <inspection_tool class="StrutsValidatorFormInspection" level="ERROR" enabled="false" /> + <inspection_tool class="CheckImageSize" level="WARNING" enabled="false" /> + <inspection_tool class="ConstantIfStatementJS" level="WARNING" enabled="false" /> + <inspection_tool class="UnresolvedPropertyKey" level="ERROR" enabled="false" /> + <inspection_tool class="EmptyStatementBodyJS" level="WARNING" enabled="false"> + <option name="m_reportEmptyBlocks" value="false" /> + </inspection_tool> + <inspection_tool class="ThisExpressionReferencesGlobalObjectJS" level="WARNING" enabled="false" /> + <inspection_tool class="Weblogic" level="ERROR" enabled="false" /> + <inspection_tool class="UnnecessaryLabelJS" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryContinueJS" level="WARNING" enabled="false" /> + <inspection_tool class="EmptyMethod" level="WARNING" enabled="false" /> + <inspection_tool class="UNUSED_IMPORT" level="WARNING" enabled="false" /> + <inspection_tool class="ReferencesToClassesFromDefaultPackagesInJSPFile" level="ERROR" enabled="false" /> + <inspection_tool class="CheckEmptyScriptTag" level="WARNING" enabled="false" /> + <inspection_tool class="NoScrollPane" level="WARNING" enabled="false" /> + <inspection_tool class="NoButtonGroup" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryConditionalExpression" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryContinue" level="WARNING" enabled="false" /> + <inspection_tool class="ReplaceAssignmentWithOperatorAssignment" level="WARNING" enabled="true"> + <option name="ignoreLazyOperators" value="true" /> + <option name="ignoreObscureOperators" value="false" /> + </inspection_tool> + <inspection_tool class="AssignmentToForLoopParameter" level="WARNING" enabled="true"> + <option name="m_checkForeachParameters" value="false" /> + </inspection_tool> + <inspection_tool class="AssignmentToCatchBlockParameter" level="WARNING" enabled="true" /> + <inspection_tool class="AssignmentToCollectionFieldFromParameter" level="WARNING" enabled="true"> + <option name="ignorePrivateMethods" value="true" /> + </inspection_tool> + <inspection_tool class="AssignmentToDateFieldFromParameter" level="WARNING" enabled="true"> + <option name="ignorePrivateMethods" value="true" /> + </inspection_tool> + <inspection_tool class="AssignmentToMethodParameter" level="WARNING" enabled="true"> + <option name="ignoreTransformationOfOriginalParameter" value="false" /> + </inspection_tool> + <inspection_tool class="AssignmentUsedAsCondition" level="WARNING" enabled="true" /> + <inspection_tool class="NestedAssignment" level="WARNING" enabled="true" /> + <inspection_tool class="UtilityClassWithoutPrivateConstructor" level="WARNING" enabled="true"> + <option name="ignoreClassesWithOnlyMain" value="false" /> + </inspection_tool> + <inspection_tool class="CloneCallsConstructors" level="WARNING" enabled="true" /> + <inspection_tool class="CloneInNonCloneableClass" level="WARNING" enabled="true" /> + <inspection_tool class="CloneableImplementsClone" level="WARNING" enabled="true"> + <option name="m_ignoreCloneableDueToInheritance" value="false" /> + </inspection_tool> + <inspection_tool class="ThrowablePrintStackTrace" level="WARNING" enabled="true" /> + <inspection_tool class="ThreadDumpStack" level="WARNING" enabled="true" /> + <inspection_tool class="ObsoleteCollection" level="WARNING" enabled="true"> + <option name="ignoreLibraryArguments" value="false" /> + </inspection_tool> + <inspection_tool class="SystemOutErr" level="WARNING" enabled="true" /> + <inspection_tool class="CStyleArrayDeclaration" level="WARNING" enabled="true" /> + <inspection_tool class="CallToStringConcatCanBeReplacedByOperator" level="WARNING" enabled="true" /> + <inspection_tool class="ChainedEquality" level="WARNING" enabled="true" /> + <inspection_tool class="ConfusingOctalEscape" level="WARNING" enabled="true" /> + <inspection_tool class="ConstantOnLHSOfComparison" level="WARNING" enabled="true" /> + <inspection_tool class="ControlFlowStatementWithoutBraces" level="WARNING" enabled="true" /> + <inspection_tool class="ListIndexOfReplaceableByContains" level="WARNING" enabled="true" /> + <inspection_tool class="LocalCanBeFinal" level="WARNING" enabled="true"> + <option name="REPORT_VARIABLES" value="true" /> + <option name="REPORT_PARAMETERS" value="true" /> + </inspection_tool> + <inspection_tool class="MissortedModifiers" level="WARNING" enabled="true"> + <option name="m_requireAnnotationsFirst" value="true" /> + </inspection_tool> + <inspection_tool class="MultipleDeclaration" level="WARNING" enabled="true" /> + <inspection_tool class="UnnecessarilyQualifiedStaticUsage" level="WARNING" enabled="true"> + <option name="m_ignoreStaticFieldAccesses" value="false" /> + <option name="m_ignoreStaticMethodCalls" value="false" /> + <option name="m_ignoreStaticAccessFromStaticContext" value="false" /> + </inspection_tool> + <inspection_tool class="UnnecessaryThis" level="WARNING" enabled="true" /> + <inspection_tool class="UnnecessarySuperConstructor" level="WARNING" enabled="true" /> + <inspection_tool class="UnnecessaryEnumModifier" level="WARNING" enabled="true" /> + <inspection_tool class="UnnecessaryFullyQualifiedName" level="WARNING" enabled="true"> + <option name="m_ignoreJavadoc" value="false" /> + </inspection_tool> + <inspection_tool class="UnnecessaryInterfaceModifier" level="WARNING" enabled="true" /> + <inspection_tool class="UnnecessaryParentheses" level="WARNING" enabled="true" /> + <inspection_tool class="UnnecessaryQualifierForThis" level="WARNING" enabled="true" /> + <inspection_tool class="MultipleTypedDeclaration" level="WARNING" enabled="true" /> + <inspection_tool class="ReuseOfLocalVariable" level="WARNING" enabled="true" /> + <inspection_tool class="PackageVisibleField" level="WARNING" enabled="true" /> + <inspection_tool class="PackageVisibleInnerClass" level="WARNING" enabled="true" /> + <inspection_tool class="ProtectedField" level="WARNING" enabled="true" /> + <inspection_tool class="ProtectedInnerClass" level="WARNING" enabled="true" /> + <inspection_tool class="PublicField" level="WARNING" enabled="true"> + <option name="ignoreEnums" value="false" /> + </inspection_tool> + <inspection_tool class="PublicInnerClass" level="WARNING" enabled="true"> + <option name="ignoreEnums" value="false" /> + </inspection_tool> + <inspection_tool class="ReturnOfCollectionField" level="WARNING" enabled="true"> + <option name="ignorePrivateMethods" value="true" /> + </inspection_tool> + <inspection_tool class="ReturnOfDateField" level="WARNING" enabled="true" /> + <inspection_tool class="CatchGenericClass" level="WARNING" enabled="true" /> + <inspection_tool class="CaughtExceptionImmediatelyRethrown" level="WARNING" enabled="true" /> + <inspection_tool class="InstanceofCatchParameter" level="WARNING" enabled="true" /> + <inspection_tool class="ErrorRethrown" level="WARNING" enabled="true" /> + <inspection_tool class="ThreadDeathRethrown" level="WARNING" enabled="true" /> + <inspection_tool class="NonFinalFieldOfException" level="WARNING" enabled="true" /> + <inspection_tool class="BadExceptionCaught" level="WARNING" enabled="true"> + <option name="exceptionsString" value="java.lang.NullPointerException,java.lang.IllegalMonitorStateException,java.lang.ArrayIndexOutOfBoundsException" /> + </inspection_tool> + <inspection_tool class="BadExceptionDeclared" level="WARNING" enabled="true"> + <option name="exceptionsString" value="java.lang.Throwable,java.lang.Exception,java.lang.Error,java.lang.RuntimeException,java.lang.NullPointerException,java.lang.ClassCastException,java.lang.ArrayIndexOutOfBoundsException" /> + <option name="ignoreTestCases" value="false" /> + </inspection_tool> + <inspection_tool class="BadExceptionThrown" level="WARNING" enabled="true"> + <option name="exceptionsString" value="java.lang.Throwable,java.lang.Exception,java.lang.Error,java.lang.RuntimeException,java.lang.NullPointerException,java.lang.ClassCastException,java.lang.ArrayIndexOutOfBoundsException" /> + </inspection_tool> + <inspection_tool class="EqualsAndHashcode" level="WARNING" enabled="true" /> + <inspection_tool class="OnDemandImport" level="WARNING" enabled="true" /> + <inspection_tool class="SamePackageImport" level="WARNING" enabled="true" /> + <inspection_tool class="JavaLangImport" level="WARNING" enabled="true" /> + <inspection_tool class="RedundantImport" level="WARNING" enabled="true" /> + <inspection_tool class="UnusedImport" level="WARNING" enabled="true" /> + <inspection_tool class="AbstractClassExtendsConcreteClass" level="WARNING" enabled="true" /> + <inspection_tool class="AbstractClassNeverImplemented" level="WARNING" enabled="true" /> + <inspection_tool class="AbstractMethodOverridesConcreteMethod" level="WARNING" enabled="true" /> + <inspection_tool class="AbstractMethodWithMissingImplementations" level="WARNING" enabled="true" /> + <inspection_tool class="ExtendsUtilityClass" level="WARNING" enabled="true" /> + <inspection_tool class="NonProtectedConstructorInAbstractClass" level="WARNING" enabled="true"> + <option name="m_ignoreNonPublicClasses" value="false" /> + </inspection_tool> + <inspection_tool class="InterfaceNeverImplemented" level="WARNING" enabled="true"> + <option name="ignoreInterfacesThatOnlyDeclareConstants" value="false" /> + </inspection_tool> + <inspection_tool class="RedundantMethodOverride" level="WARNING" enabled="true" /> + <inspection_tool class="RefusedBequest" level="WARNING" enabled="true"> + <option name="ignoreEmptySuperMethods" value="false" /> + </inspection_tool> + <inspection_tool class="StaticInheritance" level="WARNING" enabled="true" /> + <inspection_tool class="TypeParameterExtendsFinalClass" level="WARNING" enabled="true" /> + <inspection_tool class="AbstractMethodCallInConstructor" level="WARNING" enabled="true" /> + <inspection_tool class="OverridableMethodCallDuringObjectConstruction" level="WARNING" enabled="true" /> + <inspection_tool class="OverriddenMethodCallDuringObjectConstruction" level="WARNING" enabled="true" /> + <inspection_tool class="NonThreadSafeLazyInitialization" level="WARNING" enabled="true" /> + <inspection_tool class="IndexOfReplaceableByContains" level="WARNING" enabled="true" /> + <inspection_tool class="RawUseOfParameterizedType" level="WARNING" enabled="true"> + <option name="ignoreObjectConstruction" value="true" /> + <option name="ignoreTypeCasts" value="false" /> + </inspection_tool> + <inspection_tool class="ToArrayCallWithZeroLengthArrayArgument" level="WARNING" enabled="true" /> + <inspection_tool class="CallToSimpleGetterInClass" level="WARNING" enabled="true"> + <option name="ignoreGetterCallsOnOtherObjects" value="false" /> + </inspection_tool> + <inspection_tool class="CallToSimpleSetterInClass" level="WARNING" enabled="true"> + <option name="ignoreSetterCallsOnOtherObjects" value="false" /> + </inspection_tool> + <inspection_tool class="TrivialStringConcatenation" level="WARNING" enabled="true" /> + <inspection_tool class="StringBufferReplaceableByString" level="WARNING" enabled="true" /> + <inspection_tool class="EqualsHashCodeCalledOnUrl" level="WARNING" enabled="true" /> + <inspection_tool class="FieldMayBeStatic" level="WARNING" enabled="true" /> + <inspection_tool class="InnerClassMayBeStatic" level="WARNING" enabled="true" /> + <inspection_tool class="ManualArrayToCollectionCopy" level="WARNING" enabled="true" /> + <inspection_tool class="CollectionContainsUrl" level="WARNING" enabled="true" /> + <inspection_tool class="MapReplaceableByEnumMap" level="WARNING" enabled="true" /> + <inspection_tool class="MethodMayBeStatic" level="WARNING" enabled="true"> + <option name="m_onlyPrivateOrFinal" value="false" /> + <option name="m_ignoreEmptyMethods" value="true" /> + </inspection_tool> + <inspection_tool class="StringReplaceableByStringBuffer" level="WARNING" enabled="true" /> + <inspection_tool class="SubstringZero" level="WARNING" enabled="true" /> + <inspection_tool class="SetReplaceableByEnumSet" level="WARNING" enabled="true" /> + <inspection_tool class="LengthOneStringInIndexOf" level="WARNING" enabled="true" /> + <inspection_tool class="SizeReplaceableByIsEmpty" level="WARNING" enabled="true"> + <option name="ignoreNegations" value="false" /> + </inspection_tool> + <inspection_tool class="StringConcatenationInLoops" level="WARNING" enabled="true"> + <option name="m_ignoreUnlessAssigned" value="false" /> + </inspection_tool> + <inspection_tool class="StringEqualsEmptyString" level="WARNING" enabled="true" /> + <inspection_tool class="StringBufferReplaceableByStringBuilder" level="WARNING" enabled="true" /> + <inspection_tool class="StringBufferToStringInConcatenation" level="WARNING" enabled="true" /> + <inspection_tool class="ObjectToString" level="WARNING" enabled="true" /> + <inspection_tool class="ReplaceAllDot" level="WARNING" enabled="true" /> + <inspection_tool class="CastToIncompatibleInterface" level="WARNING" enabled="true" /> + <inspection_tool class="CollectionAddedToSelf" level="WARNING" enabled="true" /> + <inspection_tool class="ComparableImplementedButEqualsNotOverridden" level="WARNING" enabled="true" /> + <inspection_tool class="ComparatorMethodParameterNotUsed" level="WARNING" enabled="true" /> + <inspection_tool class="MisspelledCompareTo" level="WARNING" enabled="true" /> + <inspection_tool class="CovariantCompareTo" level="WARNING" enabled="true" /> + <inspection_tool class="CovariantEquals" level="WARNING" enabled="true" /> + <inspection_tool class="EmptyInitializer" level="WARNING" enabled="true" /> + <inspection_tool class="MisspelledEquals" level="WARNING" enabled="true" /> + <inspection_tool class="MisspelledHashcode" level="WARNING" enabled="true" /> + <inspection_tool class="ImplicitArrayToString" level="WARNING" enabled="true" /> + <inspection_tool class="InstanceofIncompatibleInterface" level="WARNING" enabled="true" /> + <inspection_tool class="InstantiationOfUtilityClass" level="WARNING" enabled="true" /> + <inspection_tool class="IteratorHasNextCallsIteratorNext" level="WARNING" enabled="true" /> + <inspection_tool class="IteratorNextDoesNotThrowNoSuchElementException" level="WARNING" enabled="true" /> + <inspection_tool class="NonShortCircuitBoolean" level="WARNING" enabled="true" /> + <inspection_tool class="NumberEquality" level="WARNING" enabled="true" /> + <inspection_tool class="StaticFieldReferenceOnSubclass" level="WARNING" enabled="true" /> + <inspection_tool class="StaticCallOnSubclass" level="WARNING" enabled="true" /> + <inspection_tool class="NewStringBufferWithCharArgument" level="WARNING" enabled="true" /> + <inspection_tool class="SubtractionInCompareTo" level="WARNING" enabled="true" /> + <inspection_tool class="SuspiciousIndentAfterControlStatement" level="WARNING" enabled="true" /> + <inspection_tool class="TextLabelInSwitchStatement" level="WARNING" enabled="true" /> + <inspection_tool class="ThrowableInstanceNeverThrown" level="WARNING" enabled="true" /> + <inspection_tool class="MisspelledToString" level="WARNING" enabled="true" /> + <inspection_tool class="ArchaicSystemPropertyAccess" level="WARNING" enabled="true" /> + <inspection_tool class="IOResource" level="WARNING" enabled="true" /> + <inspection_tool class="FieldHidesSuperclassField" level="WARNING" enabled="true"> + <option name="m_ignoreInvisibleFields" value="true" /> + </inspection_tool> + <inspection_tool class="InnerClassVariableHidesOuterClassVariable" level="WARNING" enabled="true"> + <option name="m_ignoreInvisibleFields" value="true" /> + </inspection_tool> + <inspection_tool class="LocalVariableHidingMemberVariable" level="WARNING" enabled="true"> + <option name="m_ignoreInvisibleFields" value="true" /> + <option name="m_ignoreStaticMethods" value="true" /> + </inspection_tool> + <inspection_tool class="MethodOverloadsParentMethod" level="WARNING" enabled="true" /> + <inspection_tool class="MethodOverridesPackageLocalMethod" level="WARNING" enabled="true" /> + <inspection_tool class="MethodOverridesPrivateMethod" level="WARNING" enabled="true" /> + <inspection_tool class="MethodOverridesStaticMethod" level="WARNING" enabled="true" /> + <inspection_tool class="TypeParameterHidesVisibleType" level="WARNING" enabled="true" /> + </profile> + <profile version="1.0" is_locked="false"> + <option name="myName" value="import" /> + <option name="myLocal" value="false" /> + <inspection_tool class="CheckEmptyScriptTag" level="WARNING" enabled="false" /> + <inspection_tool class="FunctionWithInconsistentReturnsJS" level="WARNING" enabled="false" /> + <inspection_tool class="InfiniteLoopStatement" level="WARNING" enabled="false" /> + <inspection_tool class="UnusedMessageFormatParameter" level="WARNING" enabled="false" /> + <inspection_tool class="ConstantIfStatementJS" level="WARNING" enabled="false" /> + <inspection_tool class="FacesModelInspection" level="ERROR" enabled="false" /> + <inspection_tool class="UnhandledExceptionInJSP" level="WARNING" enabled="false" /> + <inspection_tool class="SillyAssignmentJS" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryLabelOnBreakStatement" level="WARNING" enabled="false" /> + <inspection_tool class="ShiftOutOfRangeJS" level="WARNING" enabled="false" /> + <inspection_tool class="JSUnresolvedVariable" level="INFO" enabled="false" /> + <inspection_tool class="DuplicateThrows" level="WARNING" enabled="false" /> + <inspection_tool class="ELValidationInJSP" level="WARNING" enabled="false" /> + <inspection_tool class="ConstantConditionalExpressionJS" level="WARNING" enabled="false" /> + <inspection_tool class="PointlessBooleanExpression" level="WARNING" enabled="false"> + <option name="m_ignoreExpressionsContainingConstants" value="false" /> + </inspection_tool> + <inspection_tool class="GwtInconsistentI18nInterface" level="ERROR" enabled="false" /> + <inspection_tool class="StringToString" level="WARNING" enabled="false" /> + <inspection_tool class="BoundFieldAssignment" level="WARNING" enabled="false" /> + <inspection_tool class="NullArgumentToVariableArgMethod" level="WARNING" enabled="false" /> + <inspection_tool class="JSUndeclaredVariable" level="INFO" enabled="false" /> + <inspection_tool class="LoopStatementsThatDontLoop" level="WARNING" enabled="false" /> + <inspection_tool class="RedundantThrows" level="WARNING" enabled="false" /> + <inspection_tool class="StrutsValidatorFormInspection" level="ERROR" enabled="false" /> + <inspection_tool class="UnnecessaryLabelOnBreakStatementJS" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryLocalVariableJS" level="WARNING" enabled="false"> + <option name="m_ignoreImmediatelyReturnedVariables" value="false" /> + <option name="m_ignoreAnnotatedVariables" value="false" /> + </inspection_tool> + <inspection_tool class="EjbDomInspection" level="ERROR" enabled="false" /> + <inspection_tool class="RedundantTypeArguments" level="WARNING" enabled="false" /> + <inspection_tool class="UnresolvedPropertyKey" level="ERROR" enabled="false" /> + <inspection_tool class="EjbWarningInspection" level="WARNING" enabled="false" /> + <inspection_tool class="EjbQlInspection" level="ERROR" enabled="false" /> + <inspection_tool class="Glassfish" level="ERROR" enabled="false" /> + <inspection_tool class="ConstantConditions" level="WARNING" enabled="false"> + <option name="SUGGEST_NULLABLE_ANNOTATIONS" value="false" /> + <option name="DONT_REPORT_TRUE_ASSERT_STATEMENTS" value="false" /> + </inspection_tool> + <inspection_tool class="GwtServiceNotRegistered" level="ERROR" enabled="false" /> + <inspection_tool class="JavaDoc" level="WARNING" enabled="false"> + <option name="TOP_LEVEL_CLASS_OPTIONS"> + <value> + <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" /> + <option name="REQUIRED_TAGS" value="" /> + </value> + </option> + <option name="INNER_CLASS_OPTIONS"> + <value> + <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" /> + <option name="REQUIRED_TAGS" value="" /> + </value> + </option> + <option name="METHOD_OPTIONS"> + <value> + <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" /> + <option name="REQUIRED_TAGS" value="@return@param@throws or @exception" /> + </value> + </option> + <option name="FIELD_OPTIONS"> + <value> + <option name="ACCESS_JAVADOC_REQUIRED_FOR" value="none" /> + <option name="REQUIRED_TAGS" value="" /> + </value> + </option> + <option name="IGNORE_DEPRECATED" value="false" /> + <option name="IGNORE_JAVADOC_PERIOD" value="true" /> + <option name="myAdditionalJavadocTags" value="" /> + </inspection_tool> + <inspection_tool class="EjbErrorInspection" level="ERROR" enabled="false" /> + <inspection_tool class="CanBeFinal" level="WARNING" enabled="false"> + <option name="REPORT_CLASSES" value="false" /> + <option name="REPORT_METHODS" value="false" /> + <option name="REPORT_FIELDS" value="true" /> + </inspection_tool> + <inspection_tool class="NoScrollPane" level="WARNING" enabled="false" /> + <inspection_tool class="JSUnresolvedFunction" level="INFO" enabled="false" /> + <inspection_tool class="InstantiatingObjectToGetClassObject" level="WARNING" enabled="false" /> + <inspection_tool class="ReturnFromFinallyBlockJS" level="WARNING" enabled="false" /> + <inspection_tool class="UnusedAssignment" level="WARNING" enabled="false"> + <option name="REPORT_PREFIX_EXPRESSIONS" value="false" /> + <option name="REPORT_POSTFIX_EXPRESSIONS" value="true" /> + <option name="REPORT_REDUNDANT_INITIALIZER" value="true" /> + </inspection_tool> + <inspection_tool class="WebProperties" level="ERROR" enabled="false" /> + <inspection_tool class="PointlessArithmeticExpressionJS" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryConditionalExpression" level="WARNING" enabled="false" /> + <inspection_tool class="StringConcatenationInsideStringBufferAppend" level="WARNING" enabled="false" /> + <inspection_tool class="UNUSED_SYMBOL" level="WARNING" enabled="false"> + <option name="LOCAL_VARIABLE" value="true" /> + <option name="FIELD" value="true" /> + <option name="METHOD" value="true" /> + <option name="CLASS" value="true" /> + <option name="PARAMETER" value="true" /> + <option name="REPORT_PARAMETER_FOR_PUBLIC_METHODS" value="true" /> + <option name="INJECTION_ANNOS"> + <value> + <list size="0" /> + </value> + </option> + </inspection_tool> + <inspection_tool class="CssOverwrittenProperties" level="WARNING" enabled="false" /> + <inspection_tool class="WeakerAccess" level="WARNING" enabled="false"> + <option name="SUGGEST_PACKAGE_LOCAL_FOR_MEMBERS" value="true" /> + <option name="SUGGEST_PACKAGE_LOCAL_FOR_TOP_CLASSES" value="true" /> + <option name="SUGGEST_PRIVATE_FOR_INNERS" value="false" /> + </inspection_tool> + <inspection_tool class="CheckJsfComponentUnderViewTag" level="INFO" enabled="false" /> + <inspection_tool class="UnnecessarySemicolon" level="WARNING" enabled="false" /> + <inspection_tool class="ShiftOutOfRange" level="WARNING" enabled="false" /> + <inspection_tool class="DefaultFileTemplate" level="WARNING" enabled="false"> + <option name="CHECK_FILE_HEADER" value="true" /> + <option name="CHECK_TRY_CATCH_SECTION" value="true" /> + <option name="CHECK_METHOD_BODY" value="true" /> + </inspection_tool> + <inspection_tool class="PointlessArithmeticExpression" level="WARNING" enabled="false"> + <option name="m_ignoreExpressionsContainingConstants" value="false" /> + </inspection_tool> + <inspection_tool class="UnnecessaryTemporaryOnConversionToString" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryContinue" level="WARNING" enabled="false" /> + <inspection_tool class="SameReturnValue" level="WARNING" enabled="false" /> + <inspection_tool class="UnusedLabel" level="WARNING" enabled="false" /> + <inspection_tool class="NoButtonGroup" level="WARNING" enabled="false" /> + <inspection_tool class="GWTStyleCheck" level="ERROR" enabled="false" /> + <inspection_tool class="NonSerializableServiceParameters" level="ERROR" enabled="false" /> + <inspection_tool class="CloneCallsSuperClone" level="WARNING" enabled="false" /> + <inspection_tool class="ReturnFromFinallyBlock" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryBoxing" level="WARNING" enabled="false" /> + <inspection_tool class="UnreachableCodeJS" level="WARNING" enabled="false" /> + <inspection_tool class="CheckValidXmlInScriptTagBody" level="ERROR" enabled="false" /> + <inspection_tool class="ManualArrayCopy" level="WARNING" enabled="false" /> + <inspection_tool class="Weblogic" level="ERROR" enabled="false" /> + <inspection_tool class="FallthroughInSwitchStatementJS" level="WARNING" enabled="false" /> + <inspection_tool class="IgnoreResultOfCall" level="WARNING" enabled="false"> + <option name="m_reportAllNonLibraryCalls" value="false" /> + <option name="callCheckString" value="java.io.InputStream,read,java.io.InputStream,skip,java.lang.StringBuffer,toString,java.lang.StringBuilder,toString,java.lang.String,.*,java.math.BigInteger,.*,java.math.BigDecimal,.*,java.net.InetAddress,.*" /> + </inspection_tool> + <inspection_tool class="ThrowFromFinallyBlock" level="WARNING" enabled="false" /> + <inspection_tool class="RedundantCast" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryReturn" level="WARNING" enabled="false" /> + <inspection_tool class="FinalStaticMethod" level="WARNING" enabled="false" /> + <inspection_tool class="SuspiciousMethodCalls" level="WARNING" enabled="false"> + <option name="REPORT_CONVERTIBLE_METHOD_CALLS" value="true" /> + </inspection_tool> + <inspection_tool class="UnnecessaryUnboxing" level="WARNING" enabled="false" /> + <inspection_tool class="SameParameterValue" level="WARNING" enabled="false" /> + <inspection_tool class="NoExplicitFinalizeCalls" level="WARNING" enabled="false" /> + <inspection_tool class="FinalPrivateMethod" level="WARNING" enabled="false" /> + <inspection_tool class="ReservedWordUsedAsNameJS" level="WARNING" enabled="false" /> + <inspection_tool class="ExtendsAnnotation" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryReturnJS" level="WARNING" enabled="false" /> + <inspection_tool class="ConstantIfStatement" level="WARNING" enabled="false" /> + <inspection_tool class="ComponentNotRegistered" level="WARNING" enabled="false"> + <option name="CHECK_ACTIONS" value="true" /> + <option name="IGNORE_NON_PUBLIC" value="true" /> + </inspection_tool> + <inspection_tool class="UnnecessaryLabelOnContinueStatement" level="WARNING" enabled="false" /> + <inspection_tool class="NoLabelFor" level="WARNING" enabled="false" /> + <inspection_tool class="SynchronizeOnNonFinalField" level="WARNING" enabled="false" /> + <inspection_tool class="AntDuplicateTargetsInspection" level="ERROR" enabled="false" /> + <inspection_tool class="NullableProblems" level="WARNING" enabled="false"> + <option name="REPORT_NULLABLE_METHOD_OVERRIDES_NOTNULL" value="true" /> + <option name="REPORT_NOT_ANNOTATED_METHOD_OVERRIDES_NOTNULL" value="true" /> + <option name="REPORT_NOTNULL_PARAMETER_OVERRIDES_NULLABLE" value="true" /> + <option name="REPORT_NOT_ANNOTATED_PARAMETER_OVERRIDES_NOTNULL" value="true" /> + <option name="REPORT_NOT_ANNOTATED_GETTER" value="true" /> + <option name="REPORT_NOT_ANNOTATED_SETTER_PARAMETER" value="true" /> + <option name="REPORT_ANNOTATION_NOT_PROPAGATED_TO_OVERRIDERS" value="true" /> + </inspection_tool> + <inspection_tool class="ReferencesToClassesFromDefaultPackagesInJSPFile" level="ERROR" enabled="false" /> + <inspection_tool class="TrivialIf" level="WARNING" enabled="false" /> + <inspection_tool class="AntMissingPropertiesFileInspection" level="ERROR" enabled="false" /> + <inspection_tool class="ObjectEqualsNull" level="WARNING" enabled="false" /> + <inspection_tool class="GwtToHtmlReferences" level="ERROR" enabled="false" /> + <inspection_tool class="EmptyFinallyBlock" level="WARNING" enabled="false" /> + <inspection_tool class="MismatchedCollectionQueryUpdate" level="WARNING" enabled="false" /> + <inspection_tool class="EmptyStatementBody" level="WARNING" enabled="false"> + <option name="m_reportEmptyBlocks" value="false" /> + </inspection_tool> + <inspection_tool class="StringEquality" level="WARNING" enabled="false" /> + <inspection_tool class="RequiredAttributes" level="WARNING" enabled="false"> + <option name="myAdditionalRequiredHtmlAttributes" value="" /> + </inspection_tool> + <inspection_tool class="TrivialConditionalJS" level="WARNING" enabled="false" /> + <inspection_tool class="OneButtonGroup" level="WARNING" enabled="false" /> + <inspection_tool class="StrutsTilesInspection" level="ERROR" enabled="false" /> + <inspection_tool class="ReflectionForUnavailableAnnotation" level="WARNING" enabled="false" /> + <inspection_tool class="IncompatibleMaskJS" level="WARNING" enabled="false" /> + <inspection_tool class="NonJREEmulationClassesInClientCode" level="ERROR" enabled="false" /> + <inspection_tool class="OctalLiteral" level="WARNING" enabled="false" /> + <inspection_tool class="WhileCanBeForeach" level="WARNING" enabled="false" /> + <inspection_tool class="InfiniteRecursion" level="WARNING" enabled="false" /> + <inspection_tool class="Geronimo" level="ERROR" enabled="false" /> + <inspection_tool class="InfiniteLoopJS" level="WARNING" enabled="false" /> + <inspection_tool class="SelfIncludingJspFiles" level="ERROR" enabled="false" /> + <inspection_tool class="CssNoGenericFontName" level="WARNING" enabled="false" /> + <inspection_tool class="ThisExpressionReferencesGlobalObjectJS" level="WARNING" enabled="false" /> + <inspection_tool class="UnnecessaryLabelJS" level="WARNING" enabled="false" /> + <inspection_tool class="EmptyCatchBlock" level="WARNING" enabled="false"> + <option name="m_includeComments" value="true" /> + <option name="m_ignoreTestCases" value="true" /> + <option name="m_ignoreIgnoreParameter" value="true" /> + </inspection_tool> + <inspection_tool class="Dependency" level="ERROR" enabled="false" /> + <inspection_tool class="UnnecessaryLocalVariable" level="WARNING" enabled="false"> + <option name="m_ignoreImmediatelyReturnedVariables" value="false" /> + <option name="m_ignoreAnnotatedVariables" value="false" /> + </inspection_tool> + <inspection_tool class="UnnecessaryTemporaryOnConversionFromString" level="WARNING" enabled="false" /> + <inspection_tool class="WrongPackageStatement" level="WARNING" enabled="false" /> + <inspection_tool class="EmptyStatementBodyJS" level="WARNING" enabled="false"> + <option name="m_reportEmptyBlocks" value="false" /> + </inspection_tool> + <inspection_tool class="ThrowFromFinallyBlockJS" level="WARNING" enabled="false" /> + <inspection_tool class="ForCanBeForeach" level="WARNING" enabled="false"> + <option name="REPORT_INDEXED_LOOP" value="true" /> + </inspection_tool> + <inspection_tool class="TypeParameterExtendsObject" level="WARNING" enabled="false" /> + <inspection_tool class="FieldCanBeLocal" level="WARNING" enabled="false" /> + <inspection_tool class="UNCHECKED_WARNING" level="WARNING" enabled="false" /> + <inspection_tool class="LoopStatementThatDoesntLoopJS" level="WARNING" enabled="false" /> + <inspection_tool class="SuspiciousNameCombination" level="WARNING" enabled="false"> + <group names="x,width,left,right" /> + <group names="y,height,top,bottom" /> + </inspection_tool> + <inspection_tool class="FinalizeCallsSuperFinalize" level="WARNING" enabled="false"> + <option name="m_ignoreForObjectSubclasses" value="false" /> + </inspection_tool> + <inspection_tool class="MalformedRegex" level="WARNING" enabled="false" /> + <inspection_tool class="TrivialIfJS" level="WARNING" enabled="false" /> + <inspection_tool class="SimplifiableConditionalExpression" level="WARNING" enabled="false" /> + <inspection_tool class="IncompatibleMask" level="WARNING" enabled="false" /> + <inspection_tool class="UNUSED_IMPORT" level="WARNING" enabled="false" /> + <inspection_tool class="DuplicateCaseLabelJS" level="WARNING" enabled="false" /> + <inspection_tool class="PointlessBitwiseExpressionJS" level="WARNING" enabled="false"> + <option name="m_ignoreExpressionsContainingConstants" value="false" /> + </inspection_tool> + <inspection_tool class="SimplifiableIfStatement" level="WARNING" enabled="false" /> + <inspection_tool class="BooleanConstructor" level="WARNING" enabled="false" />... [truncated message content] |
From: <aki...@us...> - 2008-05-17 08:45:21
|
Revision: 4006 http://gridarta.svn.sourceforge.net/gridarta/?rev=4006&view=rev Author: akirschbaum Date: 2008-05-17 01:45:28 -0700 (Sat, 17 May 2008) Log Message: ----------- Move ArchetypeParser.postParseArchetype() to Archetype. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeParser.java trunk/src/app/net/sf/gridarta/gameobject/Archetype.java trunk/src/app/net/sf/gridarta/gameobject/ArchetypeParser.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-05-17 00:42:43 UTC (rev 4005) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-05-17 08:45:28 UTC (rev 4006) @@ -220,7 +220,7 @@ archetype.setEditorFolder("intern"); } } - postParseArchetype(archetype); + archetype.postParseArchetype(); archetype.setIsArchetype(); mainControl.getArchetypeSet().addArchetype(archetype); Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-05-17 00:42:43 UTC (rev 4005) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-05-17 08:45:28 UTC (rev 4006) @@ -226,7 +226,7 @@ archetype.setEditorFolder("intern"); } } - postParseArchetype(archetype); + archetype.postParseArchetype(); archetype.setIsArchetype(); mainControl.getArchetypeSet().addArchetype(archetype); Modified: trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeParser.java 2008-05-17 00:42:43 UTC (rev 4005) +++ trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeParser.java 2008-05-17 08:45:28 UTC (rev 4006) @@ -25,7 +25,6 @@ import java.io.IOException; import java.util.List; import java.util.regex.Pattern; -import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; @@ -79,43 +78,6 @@ } /** {@inheritDoc} */ - public void postParseArchetype(final G archetype) { - final String text = archetype.getObjectText(); - archetype.resetObjectText(); - - // if no type was set, zero is taken - if (archetype.getArchTypNr() == GameObject.TYPE_UNSET) { - archetype.setArchTypNr(0); - } - - boolean scriptflag = false; - for (final String line : lineSeparatorPattern.split(text)) { - if (line.length() > 0) { - if (scriptflag) { - archetype.addObjectText(line); - if (line.startsWith("end_script_")) { - scriptflag = false; - } - } else if (line.startsWith("start_script_")) { - archetype.addObjectText(line); - scriptflag = true; - } else if (line.startsWith("editable ")) { - archetype.setEditType(Integer.parseInt(line.substring(9))); - } else if (line.startsWith("name ")) { - archetype.setObjName(line.substring(5)); - } else { - archetype.addObjectText(line); - } - } - } - - // default arches don't get an editType (not worth the time) - // they get one assigned as soon as put on a map though. - // TODO: This should be changed. - archetype.setEditType(GUIConstants.EDIT_TYPE_NONE); - } - - /** {@inheritDoc} */ public void expandMulti(final G gameObject, final List<G> objects) { final Archetype<G, A, R> archetype = gameObject.getArchetype(); Modified: trunk/src/app/net/sf/gridarta/gameobject/Archetype.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/Archetype.java 2008-05-17 00:42:43 UTC (rev 4005) +++ trunk/src/app/net/sf/gridarta/gameobject/Archetype.java 2008-05-17 08:45:28 UTC (rev 4006) @@ -285,4 +285,10 @@ */ void setRealFace(@Nullable String name); + /** + * Does some parsing on archetypes after they've been read. It reads the + * object text, parses it and resets it. + */ + void postParseArchetype(); + } // interface Archetype Modified: trunk/src/app/net/sf/gridarta/gameobject/ArchetypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/ArchetypeParser.java 2008-05-17 00:42:43 UTC (rev 4005) +++ trunk/src/app/net/sf/gridarta/gameobject/ArchetypeParser.java 2008-05-17 08:45:28 UTC (rev 4006) @@ -87,13 +87,6 @@ void parseArchetypeFromStream(BufferedReader in, @NotNull String panelName, @NotNull String folderName, String fname, @NotNull List<G> invObjects) throws IOException; /** - * Does some parsing on archetypes after they've been read. - * It reads the object text, parses it and resets it. - * @param archetype archetype to be parsed - */ - void postParseArchetype(G archetype); - - /** * Here we go... thats the hard one * we copy the needed values from archetype to the gameObject. * we setup the panels to show the right values Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-05-17 00:42:43 UTC (rev 4005) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-05-17 08:45:28 UTC (rev 4006) @@ -44,6 +44,12 @@ /** Special constant that's used if a GameObject has no GameObject type set. */ public static final int TYPE_UNSET = -666; + /** + * The pattern to match end of line characters separating lines in the arch + * text. + */ + private static final Pattern lineSeparatorPattern = Pattern.compile("\n"); + /** Static reference to the typeList (find syntax errors). */ protected static CFArchTypeList typeList; @@ -1430,4 +1436,41 @@ } } + /** {@inheritDoc} */ + public void postParseArchetype() { + final String text = getObjectText(); + resetObjectText(); + + // if no type was set, zero is taken + if (getArchTypNr() == TYPE_UNSET) { + setArchTypNr(0); + } + + boolean scriptflag = false; + for (final String line : lineSeparatorPattern.split(text)) { + if (line.length() > 0) { + if (scriptflag) { + addObjectText(line); + if (line.startsWith("end_script_")) { + scriptflag = false; + } + } else if (line.startsWith("start_script_")) { + addObjectText(line); + scriptflag = true; + } else if (line.startsWith("editable ")) { + setEditType(Integer.parseInt(line.substring(9))); + } else if (line.startsWith("name ")) { + setObjName(line.substring(5)); + } else { + addObjectText(line); + } + } + } + + // default arches don't get an editType (not worth the time) + // they get one assigned as soon as put on a map though. + // TODO: This should be changed. + setEditType(GUIConstants.EDIT_TYPE_NONE); + } + } // interface GameObject This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-17 09:50:03
|
Revision: 4011 http://gridarta.svn.sourceforge.net/gridarta/?rev=4011&view=rev Author: akirschbaum Date: 2008-05-17 02:50:06 -0700 (Sat, 17 May 2008) Log Message: ----------- Do not advertise internal archetypes through the archetype finder. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/CMainView.java trunk/daimonin/ChangeLog trunk/daimonin/src/daieditor/gui/CMainView.java trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java Modified: trunk/crossfire/src/cfeditor/gui/CMainView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/CMainView.java 2008-05-17 09:23:36 UTC (rev 4010) +++ trunk/crossfire/src/cfeditor/gui/CMainView.java 2008-05-17 09:50:06 UTC (rev 4011) @@ -185,7 +185,7 @@ toolbarPanel.add(createCenterPanel(defwidth, defheight, lockedItemsControl, selectedSquareView, mapTileListBottom, monsterMatcher), BorderLayout.CENTER); add(toolbarPanel, BorderLayout.CENTER); - archetypesActions = new ArchetypesActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser.getArchetypeChooserControl(), mainControl.getArchetypeSet(), objectChooser, archTypeList); + archetypesActions = new ArchetypesActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser.getArchetypeChooserControl(), objectChooser, archTypeList); setJMenuBar(actionFactory.createMenuBar(true, "main")); objectChooser.setPickmapFoldersMenu((JMenu) actionFactory.find(getJMenuBar(), "pickmapFolders")); viewActions.init(gameObjectMatchers); Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-05-17 09:23:36 UTC (rev 4010) +++ trunk/daimonin/ChangeLog 2008-05-17 09:50:06 UTC (rev 4011) @@ -1,3 +1,8 @@ +2008-05-17 Andreas Kirschbaum + + * Do not advertise internal archetypes through the archetype + finder. + 2008-05-03 Andreas Kirschbaum * Fix NullPointerExceptions when using command line option -s with Modified: trunk/daimonin/src/daieditor/gui/CMainView.java =================================================================== --- trunk/daimonin/src/daieditor/gui/CMainView.java 2008-05-17 09:23:36 UTC (rev 4010) +++ trunk/daimonin/src/daieditor/gui/CMainView.java 2008-05-17 09:50:06 UTC (rev 4011) @@ -185,7 +185,7 @@ toolbarPanel.add(createCenterPanel(defwidth, defheight, lockedItemsControl, selectedSquareView, mapTileListBottom, monsterMatcher), BorderLayout.CENTER); add(toolbarPanel, BorderLayout.CENTER); - archetypesActions = new ArchetypesActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser.getArchetypeChooserControl(), mainControl.getArchetypeSet(), objectChooser, archTypeList); + archetypesActions = new ArchetypesActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser.getArchetypeChooserControl(), objectChooser, archTypeList); setJMenuBar(actionFactory.createMenuBar(true, "main")); objectChooser.setPickmapFoldersMenu((JMenu) actionFactory.find(getJMenuBar(), "pickmapFolders")); viewActions.init(gameObjectMatchers); Modified: trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java 2008-05-17 09:23:36 UTC (rev 4010) +++ trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java 2008-05-17 09:50:06 UTC (rev 4011) @@ -22,7 +22,6 @@ import java.awt.Component; import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.gameobject.Archetype; -import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserListener; @@ -75,16 +74,13 @@ * * @param archetypeChooserControl The archetype chooser control. * - * @param archetypeSet The archetype set to search in the "find archetypes" - * dialog. - * * @param objectChooser The insertion object chooser to use when selecting * search results in the "find archetypes" dialog. * * @param archTypeList the instance for looking up archetype types */ - public ArchetypesActions(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ObjectChooser<G, A, R, V> objectChooser, final CFArchTypeList archTypeList) { - findArchetypesDialog = new FindArchetypesDialog(parent, archetypeSet, objectChooser, archTypeList); + public ArchetypesActions(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R, V> objectChooser, final CFArchTypeList archTypeList) { + findArchetypesDialog = new FindArchetypesDialog(parent, archetypeChooserControl, objectChooser, archTypeList); aDisplayObjectNames = (ToggleAction) ACTION_FACTORY.createToggle(true, "displayObjectNames", archetypeChooserControl); ACTION_FACTORY.createAction(true, "findArchetypes", findArchetypesDialog); archetypeChooserControl.addArchetypeChooserListener(archetypeChooserListener); Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-05-17 09:23:36 UTC (rev 4010) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-05-17 09:50:06 UTC (rev 4011) @@ -23,6 +23,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.prefs.Preferences; @@ -48,7 +49,7 @@ * * @author Andreas Kirschbaum */ -public class ArchetypeChooserControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R>> { +public class ArchetypeChooserControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R>> implements Iterable<R> { /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); @@ -329,6 +330,14 @@ } /** + * Returns all archetypes in the panel. The archetypes are not sorted.. + * @return an iterator returning all archetypes + */ + public Iterator<R> iterator() { + return Collections.unmodifiableSet(archetypes.keySet()).iterator(); + } + + /** * Return whether a given panel is the currently active panel. * * @param panel The panel to check. Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2008-05-17 09:23:36 UTC (rev 4010) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2008-05-17 09:50:06 UTC (rev 4011) @@ -46,9 +46,9 @@ import javax.swing.text.JTextComponent; import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.gameobject.Archetype; -import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.ObjectChooser; +import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; @@ -75,7 +75,7 @@ /** * The archetype set to search. */ - private final ArchetypeSet<G, A, R> archetypeSet; + private final ArchetypeChooserControl<G, A, R, ?> archetypeChooserControl; /** * The insertion object chooser to use when selecing search results. @@ -146,15 +146,16 @@ * * @param parent The parent component. * - * @param archetypeSet The archetype set to search. + * @param archetypeChooserControl The archetype chooser control to to + * search. * * @param objectChooser The insertion object chooser to use when * selecting search results.# * * @param archTypeList the instance for looking up archetype types */ - public FindArchetypesDialog(final Component parent, final ArchetypeSet<G, A, R> archetypeSet, final ObjectChooser<G, A, R, V> objectChooser, final CFArchTypeList archTypeList) { - this.archetypeSet = archetypeSet; + public FindArchetypesDialog(final Component parent, final ArchetypeChooserControl<G, A, R, ?> archetypeChooserControl, final ObjectChooser<G, A, R, V> objectChooser, final CFArchTypeList archTypeList) { + this.archetypeChooserControl = archetypeChooserControl; this.objectChooser = objectChooser; final JPanel panel = new JPanel(new GridBagLayout()); @@ -268,7 +269,7 @@ final String lowerCaseName = name.toLowerCase(); R exactArchetypeNameMatch = null; R exactDisplayNameMatch = null; - for (final R archetype : archetypeSet.getArchetypes()) { + for (final R archetype : archetypeChooserControl) { if (!archetype.isTail()) { final String archetypeName = archetype.getArchetypeName(); final String objName = archetype.getObjName(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-17 11:40:48
|
Revision: 4017 http://gridarta.svn.sourceforge.net/gridarta/?rev=4017&view=rev Author: akirschbaum Date: 2008-05-17 04:40:54 -0700 (Sat, 17 May 2008) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-05-17 11:32:06 UTC (rev 4016) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-05-17 11:40:54 UTC (rev 4017) @@ -28,9 +28,7 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; import java.io.OutputStreamWriter; -import java.io.PrintWriter; import java.util.Iterator; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.face.AbstractFaceObjects; @@ -116,7 +114,7 @@ final byte[] imgBuffer = new byte[IMAGE_BUFFER_SIZE]; int numBytes; try { - final InputStream fin = new FileInputStream(path1); + final FileInputStream fin = new FileInputStream(path1); try { numBytes = fin.read(imgBuffer, 0, IMAGE_BUFFER_SIZE); } finally { @@ -138,19 +136,17 @@ binFile.writeBytes("IMAGE " + numstring + " " + numBytes + " ./arch/system/bug.111\n"); binFile.write(imgBuffer, 0, numBytes); - // now write all pngs into the file final int numOfFaceObjects = size(); progress.setLabel(ACTION_FACTORY.getString("archCollectImages"), numOfFaceObjects); int i = 0; while (it.hasNext()) { final FaceObject faceObject = it.next(); - final String num2 = Integer.toString(++i); + final String num2 = Integer.toString(i + 1); final String numstring2 = def.substring(0, 5 - num2.length()) + num2; final String path = faceObject.getPath(); try { - // try to open the png image file - final InputStream fin = new FileInputStream(path); + final FileInputStream fin = new FileInputStream(path); try { numBytes = fin.read(imgBuffer, 0, IMAGE_BUFFER_SIZE); } finally { @@ -176,7 +172,7 @@ binFile.writeBytes("IMAGE " + numstring2 + " " + numBytes + " " + pname + faceObject.getName() + "\n"); binFile.write(imgBuffer, 0, numBytes); - if (i % 100 == 0) { + if (i++ % 100 == 0) { progress.setValue(i); } } Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-05-17 11:32:06 UTC (rev 4016) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-05-17 11:40:54 UTC (rev 4017) @@ -30,7 +30,6 @@ import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStream; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.io.PrintStream; @@ -234,7 +233,7 @@ final String actualFilename = faceFile.toString(); byte[] data; // open a bytestream to the resource file - final InputStream in = new FileInputStream(faceFile); + final FileInputStream in = new FileInputStream(faceFile); try { final ByteArrayOutputStream bufOut = new ByteArrayOutputStream((int) faceFile.length()); final byte[] buf = new byte[1 << 12]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-17 11:46:27
|
Revision: 4018 http://gridarta.svn.sourceforge.net/gridarta/?rev=4018&view=rev Author: akirschbaum Date: 2008-05-17 04:46:32 -0700 (Sat, 17 May 2008) Log Message: ----------- Move FaceProvider to common code base. Modified Paths: -------------- trunk/daimonin/src/daieditor/gameobject/face/AbstractFaceProvider.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gameobject/face/FilterFaceProvider.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gameobject/face/FaceProvider.java Removed Paths: ------------- trunk/daimonin/src/daieditor/gameobject/face/FaceProvider.java Modified: trunk/daimonin/src/daieditor/gameobject/face/AbstractFaceProvider.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/AbstractFaceProvider.java 2008-05-17 11:40:54 UTC (rev 4017) +++ trunk/daimonin/src/daieditor/gameobject/face/AbstractFaceProvider.java 2008-05-17 11:46:32 UTC (rev 4018) @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.Map; import javax.swing.ImageIcon; +import net.sf.gridarta.gameobject.face.FaceProvider; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-05-17 11:40:54 UTC (rev 4017) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-05-17 11:46:32 UTC (rev 4018) @@ -38,6 +38,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.face.AbstractFaceObjects; import net.sf.gridarta.gameobject.face.DuplicateFaceException; +import net.sf.gridarta.gameobject.face.FaceProvider; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.misc.Progress; import org.apache.log4j.Logger; Deleted: trunk/daimonin/src/daieditor/gameobject/face/FaceProvider.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceProvider.java 2008-05-17 11:40:54 UTC (rev 4017) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceProvider.java 2008-05-17 11:46:32 UTC (rev 4018) @@ -1,46 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package daieditor.gameobject.face; - -import javax.swing.ImageIcon; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * This interface represents a lazy loader that provides images on demand. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public interface FaceProvider { - - /** - * Get an image from this FaceProvider. - * @param faceName face name to get image for, excluding path and ending - * @return icon for faceName - */ - @Nullable ImageIcon getImageIconForFacename(@NotNull String faceName); - - /** - * Reload faces. - * This method does not really immediately reload all faces, lazy loading is allowed. - * But all old face information definitely is flushed, so in case the files on harddisk have changed, they will be freshly loaded from harddisk. - */ - void reload(); - -} // interface FaceProvider Modified: trunk/daimonin/src/daieditor/gameobject/face/FilterFaceProvider.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FilterFaceProvider.java 2008-05-17 11:40:54 UTC (rev 4017) +++ trunk/daimonin/src/daieditor/gameobject/face/FilterFaceProvider.java 2008-05-17 11:46:32 UTC (rev 4018) @@ -23,6 +23,7 @@ import java.awt.image.FilteredImageSource; import java.awt.image.ImageFilter; import javax.swing.ImageIcon; +import net.sf.gridarta.gameobject.face.FaceProvider; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Copied: trunk/src/app/net/sf/gridarta/gameobject/face/FaceProvider.java (from rev 4014, trunk/daimonin/src/daieditor/gameobject/face/FaceProvider.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/FaceProvider.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gameobject/face/FaceProvider.java 2008-05-17 11:46:32 UTC (rev 4018) @@ -0,0 +1,46 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gameobject.face; + +import javax.swing.ImageIcon; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * This interface represents a lazy loader that provides images on demand. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public interface FaceProvider { + + /** + * Get an image from this FaceProvider. + * @param faceName face name to get image for, excluding path and ending + * @return icon for faceName + */ + @Nullable ImageIcon getImageIconForFacename(@NotNull String faceName); + + /** + * Reload faces. + * This method does not really immediately reload all faces, lazy loading is allowed. + * But all old face information definitely is flushed, so in case the files on harddisk have changed, they will be freshly loaded from harddisk. + */ + void reload(); + +} // interface FaceProvider Property changes on: trunk/src/app/net/sf/gridarta/gameobject/face/FaceProvider.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-17 11:48:31
|
Revision: 4019 http://gridarta.svn.sourceforge.net/gridarta/?rev=4019&view=rev Author: akirschbaum Date: 2008-05-17 04:48:36 -0700 (Sat, 17 May 2008) Log Message: ----------- Move AbstractFaceProvider to common code base. Modified Paths: -------------- trunk/daimonin/src/daieditor/gameobject/face/ArchFaceProvider.java trunk/daimonin/src/daieditor/gameobject/face/DaimoninFaceProvider.java trunk/daimonin/src/daieditor/gameobject/face/FilterFaceProvider.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceProvider.java Removed Paths: ------------- trunk/daimonin/src/daieditor/gameobject/face/AbstractFaceProvider.java Deleted: trunk/daimonin/src/daieditor/gameobject/face/AbstractFaceProvider.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/AbstractFaceProvider.java 2008-05-17 11:46:32 UTC (rev 4018) +++ trunk/daimonin/src/daieditor/gameobject/face/AbstractFaceProvider.java 2008-05-17 11:48:36 UTC (rev 4019) @@ -1,71 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package daieditor.gameobject.face; - -import java.lang.ref.SoftReference; -import java.util.HashMap; -import java.util.Map; -import javax.swing.ImageIcon; -import net.sf.gridarta.gameobject.face.FaceProvider; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Abstract Base class for FaceProviders which implements a memory sensitive cache. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public abstract class AbstractFaceProvider implements FaceProvider { - - /** - * The HashMap to provide the icons from. - * Note: Weak hashing does not differ because the keys are definitely referenced elsewhere. - */ - private final Map<String, SoftReference<ImageIcon>> cache = new HashMap<String, SoftReference<ImageIcon>>(); - - /** {@inheritDoc} */ - @Nullable public final ImageIcon getImageIconForFacename(@NotNull final String faceName) { - ImageIcon icon = null; - final SoftReference<ImageIcon> ref = cache.get(faceName); - if (ref != null) { - icon = ref.get(); - } - if (icon == null) { - icon = createImage(faceName); - if (icon != null) { - cache.put(faceName, new SoftReference<ImageIcon>(icon)); - } - } - return icon; - } - - /** {@inheritDoc} */ - public void reload() { - System.err.println("Clearing image cache."); - cache.clear(); - } - - /** - * Create an image not found in the cache. - * @param faceName face name to get image for, excluding path and ending - * @return icon for faceName - */ - @Nullable protected abstract ImageIcon createImage(@NotNull String faceName); - -} // class AbstractFaceProvider Modified: trunk/daimonin/src/daieditor/gameobject/face/ArchFaceProvider.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/ArchFaceProvider.java 2008-05-17 11:46:32 UTC (rev 4018) +++ trunk/daimonin/src/daieditor/gameobject/face/ArchFaceProvider.java 2008-05-17 11:48:36 UTC (rev 4019) @@ -23,6 +23,7 @@ import java.util.HashMap; import java.util.Map; import javax.swing.ImageIcon; +import net.sf.gridarta.gameobject.face.AbstractFaceProvider; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: trunk/daimonin/src/daieditor/gameobject/face/DaimoninFaceProvider.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/DaimoninFaceProvider.java 2008-05-17 11:46:32 UTC (rev 4018) +++ trunk/daimonin/src/daieditor/gameobject/face/DaimoninFaceProvider.java 2008-05-17 11:48:36 UTC (rev 4019) @@ -25,6 +25,7 @@ import java.util.HashMap; import java.util.Map; import javax.swing.ImageIcon; +import net.sf.gridarta.gameobject.face.AbstractFaceProvider; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: trunk/daimonin/src/daieditor/gameobject/face/FilterFaceProvider.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FilterFaceProvider.java 2008-05-17 11:46:32 UTC (rev 4018) +++ trunk/daimonin/src/daieditor/gameobject/face/FilterFaceProvider.java 2008-05-17 11:48:36 UTC (rev 4019) @@ -23,6 +23,7 @@ import java.awt.image.FilteredImageSource; import java.awt.image.ImageFilter; import javax.swing.ImageIcon; +import net.sf.gridarta.gameobject.face.AbstractFaceProvider; import net.sf.gridarta.gameobject.face.FaceProvider; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Copied: trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceProvider.java (from rev 4018, trunk/daimonin/src/daieditor/gameobject/face/AbstractFaceProvider.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceProvider.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceProvider.java 2008-05-17 11:48:36 UTC (rev 4019) @@ -0,0 +1,70 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gameobject.face; + +import java.lang.ref.SoftReference; +import java.util.HashMap; +import java.util.Map; +import javax.swing.ImageIcon; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Abstract Base class for FaceProviders which implements a memory sensitive cache. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public abstract class AbstractFaceProvider implements FaceProvider { + + /** + * The HashMap to provide the icons from. + * Note: Weak hashing does not differ because the keys are definitely referenced elsewhere. + */ + private final Map<String, SoftReference<ImageIcon>> cache = new HashMap<String, SoftReference<ImageIcon>>(); + + /** {@inheritDoc} */ + @Nullable public final ImageIcon getImageIconForFacename(@NotNull final String faceName) { + ImageIcon icon = null; + final SoftReference<ImageIcon> ref = cache.get(faceName); + if (ref != null) { + icon = ref.get(); + } + if (icon == null) { + icon = createImage(faceName); + if (icon != null) { + cache.put(faceName, new SoftReference<ImageIcon>(icon)); + } + } + return icon; + } + + /** {@inheritDoc} */ + public void reload() { + System.err.println("Clearing image cache."); + cache.clear(); + } + + /** + * Create an image not found in the cache. + * @param faceName face name to get image for, excluding path and ending + * @return icon for faceName + */ + @Nullable protected abstract ImageIcon createImage(@NotNull String faceName); + +} // class AbstractFaceProvider Property changes on: trunk/src/app/net/sf/gridarta/gameobject/face/AbstractFaceProvider.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-17 11:51:08
|
Revision: 4020 http://gridarta.svn.sourceforge.net/gridarta/?rev=4020&view=rev Author: akirschbaum Date: 2008-05-17 04:51:15 -0700 (Sat, 17 May 2008) Log Message: ----------- Move ArchFaceProvider to common code base. Modified Paths: -------------- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gameobject/face/ArchFaceProvider.java Removed Paths: ------------- trunk/daimonin/src/daieditor/gameobject/face/ArchFaceProvider.java Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-05-17 11:48:36 UTC (rev 4019) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-05-17 11:51:15 UTC (rev 4020) @@ -22,7 +22,6 @@ import daieditor.CMainControl; import daieditor.IGUIConstants; import daieditor.gameobject.anim.AnimationObjects; -import daieditor.gameobject.face.ArchFaceProvider; import daieditor.gameobject.face.FaceObjects; import daieditor.map.MapArchObject; import java.io.BufferedReader; @@ -43,6 +42,7 @@ import net.sf.gridarta.gameobject.AbstractArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationParseException; import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; +import net.sf.gridarta.gameobject.face.ArchFaceProvider; import net.sf.gridarta.gameobject.face.DuplicateFaceException; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.io.IOUtils; Deleted: trunk/daimonin/src/daieditor/gameobject/face/ArchFaceProvider.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/ArchFaceProvider.java 2008-05-17 11:48:36 UTC (rev 4019) +++ trunk/daimonin/src/daieditor/gameobject/face/ArchFaceProvider.java 2008-05-17 11:51:15 UTC (rev 4020) @@ -1,75 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package daieditor.gameobject.face; - -import java.io.File; -import java.util.HashMap; -import java.util.Map; -import javax.swing.ImageIcon; -import net.sf.gridarta.gameobject.face.AbstractFaceProvider; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Implementation of FaceProvider which reads images from the daimonin arch directory. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @todo Move scanning for face files to this class, so the faces can be easily reloaded while the application is running. - */ -public final class ArchFaceProvider extends AbstractFaceProvider { - - /** - * The icon filename. - * The value is a String with the full reachable path of the png file. - */ - private final Map<String, String> files = new HashMap<String, String>(); - - /** - * Report position of a face for loading it later. - * @param faceName face name to get image for, excluding path and ending - * @param fileName filename with full reachable path of the png file (maybe relative but must be loadable). - */ - public void addInfo(@NotNull final String faceName, @NotNull final String fileName) { - files.put(faceName, fileName); - } - - /** - * Get the filename for a face. - * @param faceName face name to get filename for - * @return filename for <var>faceName</var> or <code>null</code> if no face - */ - @Nullable public String getFilename(@NotNull final String faceName) { - return files.get(faceName); - } - - /** {@inheritDoc} */ - @Nullable @Override protected ImageIcon createImage(@NotNull final String faceName) { - try { - final File file = new File(files.get(faceName)); - if (!file.exists()) { - return null; - } - //System.err.println("Loading new image for " + faceName); - return new ImageIcon(files.get(faceName)); - } catch (final Exception e) { - return null; - } - } - -} // class ArchFaceProvider Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-05-17 11:48:36 UTC (rev 4019) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-05-17 11:51:15 UTC (rev 4020) @@ -37,6 +37,7 @@ import javax.swing.GrayFilter; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.face.AbstractFaceObjects; +import net.sf.gridarta.gameobject.face.ArchFaceProvider; import net.sf.gridarta.gameobject.face.DuplicateFaceException; import net.sf.gridarta.gameobject.face.FaceProvider; import net.sf.japi.swing.ActionFactory; Copied: trunk/src/app/net/sf/gridarta/gameobject/face/ArchFaceProvider.java (from rev 4019, trunk/daimonin/src/daieditor/gameobject/face/ArchFaceProvider.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/ArchFaceProvider.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gameobject/face/ArchFaceProvider.java 2008-05-17 11:51:15 UTC (rev 4020) @@ -0,0 +1,74 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gameobject.face; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; +import javax.swing.ImageIcon; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Implementation of FaceProvider which reads images from the arch directory. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @todo Move scanning for face files to this class, so the faces can be easily reloaded while the application is running. + */ +public final class ArchFaceProvider extends AbstractFaceProvider { + + /** + * The icon filename. + * The value is a String with the full reachable path of the png file. + */ + private final Map<String, String> files = new HashMap<String, String>(); + + /** + * Report position of a face for loading it later. + * @param faceName face name to get image for, excluding path and ending + * @param fileName filename with full reachable path of the png file (maybe relative but must be loadable). + */ + public void addInfo(@NotNull final String faceName, @NotNull final String fileName) { + files.put(faceName, fileName); + } + + /** + * Get the filename for a face. + * @param faceName face name to get filename for + * @return filename for <var>faceName</var> or <code>null</code> if no face + */ + @Nullable public String getFilename(@NotNull final String faceName) { + return files.get(faceName); + } + + /** {@inheritDoc} */ + @Nullable @Override protected ImageIcon createImage(@NotNull final String faceName) { + try { + final File file = new File(files.get(faceName)); + if (!file.exists()) { + return null; + } + //System.err.println("Loading new image for " + faceName); + return new ImageIcon(files.get(faceName)); + } catch (final Exception e) { + return null; + } + } + +} // class ArchFaceProvider Property changes on: trunk/src/app/net/sf/gridarta/gameobject/face/ArchFaceProvider.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-05-17 11:54:02
|
Revision: 4021 http://gridarta.svn.sourceforge.net/gridarta/?rev=4021&view=rev Author: akirschbaum Date: 2008-05-17 04:54:05 -0700 (Sat, 17 May 2008) Log Message: ----------- Move DaimoninFaceProvider to common code base; rename it to CollectedFaceProvider. Modified Paths: -------------- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java Removed Paths: ------------- trunk/daimonin/src/daieditor/gameobject/face/DaimoninFaceProvider.java Deleted: trunk/daimonin/src/daieditor/gameobject/face/DaimoninFaceProvider.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/DaimoninFaceProvider.java 2008-05-17 11:51:15 UTC (rev 4020) +++ trunk/daimonin/src/daieditor/gameobject/face/DaimoninFaceProvider.java 2008-05-17 11:54:05 UTC (rev 4021) @@ -1,91 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package daieditor.gameobject.face; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.RandomAccessFile; -import java.util.HashMap; -import java.util.Map; -import javax.swing.ImageIcon; -import net.sf.gridarta.gameobject.face.AbstractFaceProvider; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Implementation of FaceProvider which reads images from the daimonin PNG archive. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @todo Construction of this class should succeed even in case the face file is unavailable. - * @todo Move parsing of the face files to this class, so the faces can be easily reloaded while the application is running. - */ -@SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) -public final class DaimoninFaceProvider extends AbstractFaceProvider { - - /** - * The icon position and size are stored here. - * The value is a long with the highint being the position and the lowint being the size. - */ - private final Map<String, Long> positions = new HashMap<String, Long>(); - - /** The file to read from. */ - @NotNull private final RandomAccessFile file; - - /** - * Create a DaimoninFaceProvider. - * @param file file where icons are found - * @throws FileNotFoundException in case the File <var>file</var> wasn't found - */ - public DaimoninFaceProvider(final File file) throws FileNotFoundException { - this.file = new RandomAccessFile(file, "r"); - } - - /** - * Create a DaimoninFaceProvider. - * @param fileName name of file where icons are found - * @throws FileNotFoundException in case the File with name <var>fileName</var> wasn't found - */ - public DaimoninFaceProvider(final String fileName) throws FileNotFoundException { - file = new RandomAccessFile(fileName, "r"); - } - - /** - * Report posistion and size of a face for loading it later. - * @param faceName face name to get image for, excluding path and ending - * @param pos position of image - * @param size Size of image - */ - public void addInfo(@NotNull final String faceName, final int pos, final int size) { - positions.put(faceName, (long) pos << 32 | size); - } - - /** {@inheritDoc} */ - @Nullable @Override protected ImageIcon createImage(@NotNull final String faceName) { - try { - final long posI = positions.get(faceName); - file.seek(posI >> 32); - final byte[] buf = new byte[(int) posI]; - file.readFully(buf); - return new ImageIcon(buf); - } catch (final Exception e) { - return null; - } - } - -} // class DaimoninFaceProvider Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-05-17 11:51:15 UTC (rev 4020) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-05-17 11:54:05 UTC (rev 4021) @@ -38,6 +38,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.face.AbstractFaceObjects; import net.sf.gridarta.gameobject.face.ArchFaceProvider; +import net.sf.gridarta.gameobject.face.CollectedFaceProvider; import net.sf.gridarta.gameobject.face.DuplicateFaceException; import net.sf.gridarta.gameobject.face.FaceProvider; import net.sf.japi.swing.ActionFactory; @@ -231,7 +232,7 @@ * @throws DuplicateFaceException in case a face was not unique */ public void loadFacesCollection(final File faceFile, final File treeFile) throws IOException, FileNotFoundException, DuplicateFaceException { - setNormal(new DaimoninFaceProvider(faceFile)); + setNormal(new CollectedFaceProvider(faceFile)); final String actualFilename = faceFile.toString(); byte[] data; // open a bytestream to the resource file @@ -289,7 +290,7 @@ addFaceObject(faceName, originalFilename, actualFilename, offset, size); } } - ((DaimoninFaceProvider) normal).addInfo(faceName, offset, size); // TODO Remove me + ((CollectedFaceProvider) normal).addInfo(faceName, offset, size); // TODO Remove me offset += size; } } finally { Copied: trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java (from rev 4019, trunk/daimonin/src/daieditor/gameobject/face/DaimoninFaceProvider.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java 2008-05-17 11:54:05 UTC (rev 4021) @@ -0,0 +1,90 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gameobject.face; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.RandomAccessFile; +import java.util.HashMap; +import java.util.Map; +import javax.swing.ImageIcon; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Implementation of FaceProvider which reads images from the collected PNG archive. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @todo Construction of this class should succeed even in case the face file is unavailable. + * @todo Move parsing of the face files to this class, so the faces can be easily reloaded while the application is running. + */ +@SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) +public final class CollectedFaceProvider extends AbstractFaceProvider { + + /** + * The icon position and size are stored here. + * The value is a long with the highint being the position and the lowint being the size. + */ + private final Map<String, Long> positions = new HashMap<String, Long>(); + + /** The file to read from. */ + @NotNull private final RandomAccessFile file; + + /** + * Creates a new instance. + * @param file file where icons are found + * @throws FileNotFoundException in case the File <var>file</var> wasn't found + */ + public CollectedFaceProvider(final File file) throws FileNotFoundException { + this.file = new RandomAccessFile(file, "r"); + } + + /** + * Creates a new instance. + * @param fileName name of file where icons are found + * @throws FileNotFoundException in case the File with name <var>fileName</var> wasn't found + */ + public CollectedFaceProvider(final String fileName) throws FileNotFoundException { + file = new RandomAccessFile(fileName, "r"); + } + + /** + * Report posistion and size of a face for loading it later. + * @param faceName face name to get image for, excluding path and ending + * @param pos position of image + * @param size Size of image + */ + public void addInfo(@NotNull final String faceName, final int pos, final int size) { + positions.put(faceName, (long) pos << 32 | size); + } + + /** {@inheritDoc} */ + @Nullable @Override protected ImageIcon createImage(@NotNull final String faceName) { + try { + final long posI = positions.get(faceName); + file.seek(posI >> 32); + final byte[] buf = new byte[(int) posI]; + file.readFully(buf); + return new ImageIcon(buf); + } catch (final Exception e) { + return null; + } + } + +} // class CollectedFaceProvider Property changes on: trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java ___________________________________________________________________ Name: svn:mime-type + text/plain Name: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |