You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2010-05-13 13:13:38
|
Revision: 7735 http://gridarta.svn.sourceforge.net/gridarta/?rev=7735&view=rev Author: akirschbaum Date: 2010-05-13 13:13:31 +0000 (Thu, 13 May 2010) Log Message: ----------- Move MapLink and TileLink to model package. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/FlatMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/IsoMapTilePane.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/map/tiles/ trunk/src/app/net/sf/gridarta/model/map/tiles/MapLink.java trunk/src/app/net/sf/gridarta/model/map/tiles/TileLink.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapLink.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TileLink.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 13:10:59 UTC (rev 7734) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 13:13:31 UTC (rev 7735) @@ -45,6 +45,8 @@ import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; import net.sf.gridarta.model.map.normalizer.RelativePathOnUnsavedMapException; import net.sf.gridarta.model.map.normalizer.SameMapException; +import net.sf.gridarta.model.map.tiles.MapLink; +import net.sf.gridarta.model.map.tiles.TileLink; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.utils.CommonConstants; import net.sf.gridarta.utils.Size2D; Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/FlatMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/FlatMapTilePane.java 2010-05-13 13:10:59 UTC (rev 7734) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/FlatMapTilePane.java 2010-05-13 13:13:31 UTC (rev 7735) @@ -28,6 +28,7 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.tiles.MapLink; import net.sf.gridarta.model.settings.GlobalSettings; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/IsoMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/IsoMapTilePane.java 2010-05-13 13:10:59 UTC (rev 7734) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/IsoMapTilePane.java 2010-05-13 13:13:31 UTC (rev 7735) @@ -28,6 +28,7 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.tiles.MapLink; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.utils.CommonConstants; import org.jetbrains.annotations.NotNull; Deleted: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapLink.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapLink.java 2010-05-13 13:10:59 UTC (rev 7734) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapLink.java 2010-05-13 13:13:31 UTC (rev 7735) @@ -1,44 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 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.maptilepane; - -/** - * @author Andreas Kirschbaum - */ -public class MapLink { - - private final int mapDirection; - - private final int linkDirection; - - public MapLink(final int mapDirection, final int linkDirection) { - this.mapDirection = mapDirection; - this.linkDirection = linkDirection; - } - - public int getMapDirection() { - return mapDirection; - } - - public int getLinkDirection() { - return linkDirection; - } - -} // class MapLink Deleted: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TileLink.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TileLink.java 2010-05-13 13:10:59 UTC (rev 7734) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TileLink.java 2010-05-13 13:13:31 UTC (rev 7735) @@ -1,68 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 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.maptilepane; - -import org.jetbrains.annotations.NotNull; - -/** - * @author Andreas Kirschbaum - */ -public class TileLink { - - @NotNull - private final String name; - - @NotNull - private final MapLink[] mapLinks; - - /** - * Direction for reverse map linking. - */ - private final int revLink; - - /** - * Creates a new instance. - * @param revLink direction for reverse map linking - */ - public TileLink(@NotNull final String name, @NotNull final MapLink[] mapLinks, final int revLink) { - this.name = name; - this.mapLinks = mapLinks; - this.revLink = revLink; - } - - @NotNull - public String getName() { - return name; - } - - @NotNull - public MapLink[] getMapLinks() { - return mapLinks; - } - - /** - * Returns the index for reverse map linking. - * @return the index - */ - public int getRevLink() { - return revLink; - } - -} // class TileLink Copied: trunk/src/app/net/sf/gridarta/model/map/tiles/MapLink.java (from rev 7733, trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapLink.java) =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/tiles/MapLink.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/map/tiles/MapLink.java 2010-05-13 13:13:31 UTC (rev 7735) @@ -0,0 +1,44 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 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.model.map.tiles; + +/** + * @author Andreas Kirschbaum + */ +public class MapLink { + + private final int mapDirection; + + private final int linkDirection; + + public MapLink(final int mapDirection, final int linkDirection) { + this.mapDirection = mapDirection; + this.linkDirection = linkDirection; + } + + public int getMapDirection() { + return mapDirection; + } + + public int getLinkDirection() { + return linkDirection; + } + +} // class MapLink Property changes on: trunk/src/app/net/sf/gridarta/model/map/tiles/MapLink.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/src/app/net/sf/gridarta/model/map/tiles/TileLink.java (from rev 7734, trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TileLink.java) =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/tiles/TileLink.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/map/tiles/TileLink.java 2010-05-13 13:13:31 UTC (rev 7735) @@ -0,0 +1,68 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 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.model.map.tiles; + +import org.jetbrains.annotations.NotNull; + +/** + * @author Andreas Kirschbaum + */ +public class TileLink { + + @NotNull + private final String name; + + @NotNull + private final MapLink[] mapLinks; + + /** + * Direction for reverse map linking. + */ + private final int revLink; + + /** + * Creates a new instance. + * @param revLink direction for reverse map linking + */ + public TileLink(@NotNull final String name, @NotNull final MapLink[] mapLinks, final int revLink) { + this.name = name; + this.mapLinks = mapLinks; + this.revLink = revLink; + } + + @NotNull + public String getName() { + return name; + } + + @NotNull + public MapLink[] getMapLinks() { + return mapLinks; + } + + /** + * Returns the index for reverse map linking. + * @return the index + */ + public int getRevLink() { + return revLink; + } + +} // class TileLink Property changes on: trunk/src/app/net/sf/gridarta/model/map/tiles/TileLink.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: 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...> - 2010-05-13 13:11:05
|
Revision: 7734 http://gridarta.svn.sourceforge.net/gridarta/?rev=7734&view=rev Author: akirschbaum Date: 2010-05-13 13:10:59 +0000 (Thu, 13 May 2010) Log Message: ----------- Remove dependency TileLink -> ActionBuilder. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TileLink.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 11:57:29 UTC (rev 7733) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 13:10:59 UTC (rev 7734) @@ -162,7 +162,7 @@ this.mapPathNormalizer = mapPathNormalizer; this.mapViewsManager = mapViewsManager; assert tileLink.length == 8; - tileLinks = new TileLink[] { new TileLink("mapNorth", tileLink[0], CommonConstants.SOUTH), new TileLink("mapEast", tileLink[1], CommonConstants.WEST), new TileLink("mapSouth", tileLink[2], CommonConstants.NORTH), new TileLink("mapWest", tileLink[3], CommonConstants.EAST), new TileLink("mapNorthEast", tileLink[4], CommonConstants.SOUTH_WEST), new TileLink("mapSouthEast", tileLink[5], CommonConstants.NORTH_WEST), new TileLink("mapSouthWest", tileLink[6], CommonConstants.NORTH_EAST), new TileLink("mapNorthWest", tileLink[7], CommonConstants.SOUTH_EAST), }; + tileLinks = new TileLink[] { new TileLink(ACTION_BUILDER.getString("mapNorth"), tileLink[0], CommonConstants.SOUTH), new TileLink(ACTION_BUILDER.getString("mapEast"), tileLink[1], CommonConstants.WEST), new TileLink(ACTION_BUILDER.getString("mapSouth"), tileLink[2], CommonConstants.NORTH), new TileLink(ACTION_BUILDER.getString("mapWest"), tileLink[3], CommonConstants.EAST), new TileLink(ACTION_BUILDER.getString("mapNorthEast"), tileLink[4], CommonConstants.SOUTH_WEST), new TileLink(ACTION_BUILDER.getString("mapSouthEast"), tileLink[5], CommonConstants.NORTH_WEST), new TileLink(ACTION_BUILDER.getString("mapSouthWest"), tileLink[6], CommonConstants.NORTH_EAST), new TileLink(ACTION_BUILDER.getString("mapNorthWest"), tileLink[7], CommonConstants.SOUTH_EAST), }; canAttachMaps = tileLink[0].length + tileLink[1].length + tileLink[2].length + tileLink[3].length + tileLink[4].length + tileLink[5].length + tileLink[6].length + tileLink[7].length > 0; tilePaths = buildComponents(directionMapping); mapArchObject = mapModel.getMapArchObject(); Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TileLink.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TileLink.java 2010-05-13 11:57:29 UTC (rev 7733) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TileLink.java 2010-05-13 13:10:59 UTC (rev 7734) @@ -19,8 +19,6 @@ package net.sf.gridarta.gui.map.maptilepane; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; /** @@ -28,13 +26,7 @@ */ public class TileLink { - /** - * Action Builder. - */ @NotNull - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - @NotNull private final String name; @NotNull @@ -49,8 +41,8 @@ * Creates a new instance. * @param revLink direction for reverse map linking */ - public TileLink(@NotNull final String nameKey, @NotNull final MapLink[] mapLinks, final int revLink) { - name = ACTION_BUILDER.getString(nameKey); + public TileLink(@NotNull final String name, @NotNull final MapLink[] mapLinks, final int revLink) { + this.name = name; this.mapLinks = mapLinks; this.revLink = revLink; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 11:57:36
|
Revision: 7733 http://gridarta.svn.sourceforge.net/gridarta/?rev=7733&view=rev Author: akirschbaum Date: 2010-05-13 11:57:29 +0000 (Thu, 13 May 2010) Log Message: ----------- Remove unneeded parentheses. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 11:19:11 UTC (rev 7732) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 11:57:29 UTC (rev 7733) @@ -163,7 +163,7 @@ this.mapViewsManager = mapViewsManager; assert tileLink.length == 8; tileLinks = new TileLink[] { new TileLink("mapNorth", tileLink[0], CommonConstants.SOUTH), new TileLink("mapEast", tileLink[1], CommonConstants.WEST), new TileLink("mapSouth", tileLink[2], CommonConstants.NORTH), new TileLink("mapWest", tileLink[3], CommonConstants.EAST), new TileLink("mapNorthEast", tileLink[4], CommonConstants.SOUTH_WEST), new TileLink("mapSouthEast", tileLink[5], CommonConstants.NORTH_WEST), new TileLink("mapSouthWest", tileLink[6], CommonConstants.NORTH_EAST), new TileLink("mapNorthWest", tileLink[7], CommonConstants.SOUTH_EAST), }; - canAttachMaps = (tileLink[0].length + tileLink[1].length + tileLink[2].length + tileLink[3].length + tileLink[4].length + tileLink[5].length + tileLink[6].length + tileLink[7].length) > 0; + canAttachMaps = tileLink[0].length + tileLink[1].length + tileLink[2].length + tileLink[3].length + tileLink[4].length + tileLink[5].length + tileLink[6].length + tileLink[7].length > 0; tilePaths = buildComponents(directionMapping); mapArchObject = mapModel.getMapArchObject(); final File mapDir = globalSettings.getMapsDirectory(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 11:19:18
|
Revision: 7732 http://gridarta.svn.sourceforge.net/gridarta/?rev=7732&view=rev Author: akirschbaum Date: 2010-05-13 11:19:11 +0000 (Thu, 13 May 2010) Log Message: ----------- Extract code into function. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 11:17:26 UTC (rev 7731) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 11:19:11 UTC (rev 7732) @@ -297,17 +297,7 @@ } // all done! now we write all back - for (final MapControl<G, A, R> mapControl : mapControls) { - if (mapControl != null) { - try { - if (mapControl.getMapModel().isModified() && mapViewsManager.getMapViews(mapControl) <= 0) { - mapControl.save(); - } - } catch (final IOException e) { - ACTION_BUILDER.showMessageDialog(this, "mapErrorFatalWrite", e.getMessage()); - } - } - } + saveAdjacentMaps(mapControls); } finally { for (final MapControl<G, A, R> mapControl : mapControls) { if (mapControl != null) { @@ -339,6 +329,25 @@ } /** + * Saves adjacent maps. I/O errors are reported to the user but otherwise + * ignored. + * @param mapControls the adjacent maps to save + */ + private void saveAdjacentMaps(final MapControl<G, A, R>[] mapControls) { + for (final MapControl<G, A, R> mapControl : mapControls) { + if (mapControl != null) { + try { + if (mapControl.getMapModel().isModified() && mapViewsManager.getMapViews(mapControl) <= 0) { + mapControl.save(); + } + } catch (final IOException e) { + ACTION_BUILDER.showMessageDialog(this, "mapErrorFatalWrite", e.getMessage()); + } + } + } + } + + /** * Fills missing adjacent map slots. * @param mapControls the loaded maps; will be updated * @return whether all maps have been processed This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 11:17:35
|
Revision: 7731 http://gridarta.svn.sourceforge.net/gridarta/?rev=7731&view=rev Author: akirschbaum Date: 2010-05-13 11:17:26 +0000 (Thu, 13 May 2010) Log Message: ----------- Extract code into function. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 11:14:24 UTC (rev 7730) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 11:17:26 UTC (rev 7731) @@ -292,34 +292,8 @@ } // finally... set the links! - for (int i = 0; i < tilePaths.length; i++) { - final MapControl<G, A, R> mapControl = mapControls[i]; - if (mapControl != null) { - // generate a valid path relativ to both map positions - try { - final String link1 = getTilePath(mapModel.getMapFile().getCanonicalPath(), mapControl.getMapModel().getMapFile().getCanonicalPath()); - // set the link of our source map to the map around - tilePaths[i].setText(link1, true); - // generate again a valid path relativ to both map positions - final String link2 = getTilePath(mapControl.getMapModel().getMapFile().getCanonicalPath(), mapModel.getMapFile().getCanonicalPath()); - final MapModel<G, A, R> mapModel2 = mapControl.getMapModel(); - mapModel2.beginTransaction("Attach maps"); - try { - final MapArchObject<A> mapArchObject2 = mapModel2.getMapArchObject(); - mapArchObject2.beginTransaction(); - try { - mapArchObject2.setTilePath(tileLinks[i].getRevLink(), link2 == null ? "" : link2); - } finally { - mapArchObject2.endTransaction(); - } - } finally { - mapModel2.endTransaction(); - } - } catch (final IOException e) { - ACTION_BUILDER.showMessageDialog(this, "mapErrorFatalPath", e.getMessage()); - return; - } - } + if (!updateTilePaths(mapControls)) { + return; } // all done! now we write all back @@ -426,6 +400,44 @@ } /** + * Updates map tile paths to match the loaded maps. + * @param mapControls the loaded maps + * @return whether all maps have been processed + */ + private boolean updateTilePaths(@NotNull final MapControl<G, A, R>[] mapControls) { + for (int i = 0; i < tilePaths.length; i++) { + final MapControl<G, A, R> mapControl = mapControls[i]; + if (mapControl != null) { + // generate a valid path relative to both map positions + try { + final String link1 = getTilePath(mapModel.getMapFile().getCanonicalPath(), mapControl.getMapModel().getMapFile().getCanonicalPath()); + // set the link of our source map to the map around + tilePaths[i].setText(link1, true); + // generate again a valid path relative to both map positions + final String link2 = getTilePath(mapControl.getMapModel().getMapFile().getCanonicalPath(), mapModel.getMapFile().getCanonicalPath()); + final MapModel<G, A, R> mapModel2 = mapControl.getMapModel(); + mapModel2.beginTransaction("Attach maps"); + try { + final MapArchObject<A> mapArchObject2 = mapModel2.getMapArchObject(); + mapArchObject2.beginTransaction(); + try { + mapArchObject2.setTilePath(tileLinks[i].getRevLink(), link2 == null ? "" : link2); + } finally { + mapArchObject2.endTransaction(); + } + } finally { + mapModel2.endTransaction(); + } + } catch (final IOException e) { + ACTION_BUILDER.showMessageDialog(this, "mapErrorFatalPath", e.getMessage()); + return false; + } + } + } + return true; + } + + /** * Loads an adjacent {@link MapControl}, ignoring any (I/O-)errors. * @param mapModel the map model for relative map paths * @param path the map path This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 11:14:31
|
Revision: 7730 http://gridarta.svn.sourceforge.net/gridarta/?rev=7730&view=rev Author: akirschbaum Date: 2010-05-13 11:14:24 +0000 (Thu, 13 May 2010) Log Message: ----------- Extract code into function. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 11:10:43 UTC (rev 7729) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 11:14:24 UTC (rev 7730) @@ -282,34 +282,9 @@ } // We have loaded all direct linked maps around our map. - // now, lets check free spaces. We try to "fill" them - // by checking the "side" path links of the loaded ones. - boolean repeatFlag = true; - while (repeatFlag) { - repeatFlag = false; - for (int i = 0; i < mapControls.length; i++) { - final MapControl<G, A, R> mapControl = mapControls[i]; - if (mapControl != null) { - final TileLink tileLink = tileLinks[i]; - final MapLink[] mapLinks = tileLink.getMapLinks(); - for (final MapLink mapLink : mapLinks) { - final int index = mapLink.getMapDirection(); - if (mapControls[index] == null) { - final String tilePath = mapControl.getMapModel().getMapArchObject().getTilePath(mapLink.getLinkDirection()); - if (tilePath.length() > 0) { - try { - mapControls[index] = loadMapControl(mapControl.getMapModel(), tilePath); - repeatFlag = true; - } catch (final IOException ex) { - if (ACTION_BUILDER.showQuestionDialog(this, "mapErrorPath2", tilePath)) { // XXX: ignores ex.getMessage() - return; - } - } - } - } - } - } - } + // now, lets check free spaces. + if (!fillAdjacentMaps(mapControls)) { + return; } if (!validateMapSizes(mapControls)) { @@ -369,7 +344,8 @@ } /** - * Loads adjacent map files. + * Loads adjacent map files by "filling" them by checking the "side" path + * links of the loaded ones. * @param mapControls the return value * @return whether all maps have been loaded */ @@ -389,6 +365,42 @@ } /** + * Fills missing adjacent map slots. + * @param mapControls the loaded maps; will be updated + * @return whether all maps have been processed + */ + private boolean fillAdjacentMaps(@NotNull final MapControl<G, A, R>[] mapControls) { + boolean repeatFlag = true; + while (repeatFlag) { + repeatFlag = false; + for (int i = 0; i < mapControls.length; i++) { + final MapControl<G, A, R> mapControl = mapControls[i]; + if (mapControl != null) { + final TileLink tileLink = tileLinks[i]; + final MapLink[] mapLinks = tileLink.getMapLinks(); + for (final MapLink mapLink : mapLinks) { + final int index = mapLink.getMapDirection(); + if (mapControls[index] == null) { + final String tilePath = mapControl.getMapModel().getMapArchObject().getTilePath(mapLink.getLinkDirection()); + if (tilePath.length() > 0) { + try { + mapControls[index] = loadMapControl(mapControl.getMapModel(), tilePath); + repeatFlag = true; + } catch (final IOException ex) { + if (ACTION_BUILDER.showQuestionDialog(this, "mapErrorPath2", tilePath)) { // XXX: ignores ex.getMessage() + return false; + } + } + } + } + } + } + } + } + return true; + } + + /** * Validates all links to check that attached maps have matching * width/height. Reports an error to the user if a non-matching size is * detected. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 11:10:49
|
Revision: 7729 http://gridarta.svn.sourceforge.net/gridarta/?rev=7729&view=rev Author: akirschbaum Date: 2010-05-13 11:10:43 +0000 (Thu, 13 May 2010) Log Message: ----------- Extract code into function. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 11:07:48 UTC (rev 7728) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 11:10:43 UTC (rev 7729) @@ -277,18 +277,8 @@ final MapControl<G, A, R>[] mapControls = (MapControl<G, A, R>[]) new MapControl<?, ?, ?>[tilePaths.length]; try { // first action: we go around all links and try to load the maps - for (int i = 0; i < tilePaths.length; i++) { - final String path = tilePaths[i].getText(); - if (path == null || path.length() == 0) { - continue; - } - - try { - mapControls[i] = loadMapControl(mapModel, path); - } catch (final IOException ex) { - ACTION_BUILDER.showMessageDialog(this, "mapErrorPath2", path); // XXX: ignores ex.getMessage() - return; - } + if (!loadAdjacentMaps(mapControls)) { + return; } // We have loaded all direct linked maps around our map. @@ -379,6 +369,26 @@ } /** + * Loads adjacent map files. + * @param mapControls the return value + * @return whether all maps have been loaded + */ + private boolean loadAdjacentMaps(@NotNull final MapControl<G, A, R>[] mapControls) { + for (int i = 0; i < tilePaths.length; i++) { + final String path = tilePaths[i].getText(); + if (path != null && path.length() != 0) { + try { + mapControls[i] = loadMapControl(mapModel, path); + } catch (final IOException ex) { + ACTION_BUILDER.showMessageDialog(this, "mapErrorPath2", path); // XXX: ignores ex.getMessage() + return false; + } + } + } + return true; + } + + /** * Validates all links to check that attached maps have matching * width/height. Reports an error to the user if a non-matching size is * detected. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 11:07:55
|
Revision: 7728 http://gridarta.svn.sourceforge.net/gridarta/?rev=7728&view=rev Author: akirschbaum Date: 2010-05-13 11:07:48 +0000 (Thu, 13 May 2010) Log Message: ----------- Extract code into function. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 10:32:36 UTC (rev 7727) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 11:07:48 UTC (rev 7728) @@ -321,25 +321,9 @@ } } } - // now we have all maps around our starting map loaded. - // As next step we check all links so we are sure all is legal. - // is all ok, we set the new links and save our maps. - // We *also* must check loaded maps and set the links there too! - { - final Size2D mapSize = mapArchObject.getMapSize(); - for (final MapControl<G, A, R> mapControl : mapControls) { - if (mapControl != null) { - final MapArchObject<A> otherMap = mapControl.getMapModel().getMapArchObject(); - final Size2D otherMapSize = otherMap.getMapSize(); - if (!mapSize.equals(otherMapSize)) { - ACTION_BUILDER.showMessageDialog(this, "mapErrorDifferentSize", mapModel.getMapArchObject().getMapName(), mapSize.getWidth(), mapSize.getHeight(), mapControl.getMapModel().getMapFile(), otherMapSize.getWidth(), otherMapSize.getHeight()); - return; - } - for (int ii = 0; ii < 2; ii++) { - // TODO: check links - } - } - } + + if (!validateMapSizes(mapControls)) { + return; } // finally... set the links! @@ -395,6 +379,31 @@ } /** + * Validates all links to check that attached maps have matching + * width/height. Reports an error to the user if a non-matching size is + * detected. + * @param mapControls the attached maps to check + * @return whether all map sizes do match + */ + private boolean validateMapSizes(@NotNull final MapControl<G, A, R>[] mapControls) { + final Size2D mapSize = mapArchObject.getMapSize(); + for (final MapControl<G, A, R> mapControl : mapControls) { + if (mapControl != null) { + final MapArchObject<A> otherMap = mapControl.getMapModel().getMapArchObject(); + final Size2D otherMapSize = otherMap.getMapSize(); + if (!mapSize.equals(otherMapSize)) { + ACTION_BUILDER.showMessageDialog(this, "mapErrorDifferentSize", mapModel.getMapArchObject().getMapName(), mapSize.getWidth(), mapSize.getHeight(), mapControl.getMapModel().getMapFile(), otherMapSize.getWidth(), otherMapSize.getHeight()); + return false; + } + for (int ii = 0; ii < 2; ii++) { + // TODO: check links + } + } + } + return true; + } + + /** * Loads an adjacent {@link MapControl}, ignoring any (I/O-)errors. * @param mapModel the map model for relative map paths * @param path the map path This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 10:32:42
|
Revision: 7727 http://gridarta.svn.sourceforge.net/gridarta/?rev=7727&view=rev Author: akirschbaum Date: 2010-05-13 10:32:36 +0000 (Thu, 13 May 2010) Log Message: ----------- Remove redundant interface. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/maparchobject/AbstractMapArchObject.java Modified: trunk/src/app/net/sf/gridarta/model/map/maparchobject/AbstractMapArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/maparchobject/AbstractMapArchObject.java 2010-05-13 10:27:59 UTC (rev 7726) +++ trunk/src/app/net/sf/gridarta/model/map/maparchobject/AbstractMapArchObject.java 2010-05-13 10:32:36 UTC (rev 7727) @@ -37,7 +37,7 @@ * #equals(Object)} work on non-final fields and thus will break any operation * inside Collections! */ -public abstract class AbstractMapArchObject<A extends MapArchObject<A>> implements Cloneable, MapArchObject<A> { +public abstract class AbstractMapArchObject<A extends MapArchObject<A>> implements MapArchObject<A> { /** * The serial version UID. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 10:28:05
|
Revision: 7726 http://gridarta.svn.sourceforge.net/gridarta/?rev=7726&view=rev Author: akirschbaum Date: 2010-05-13 10:27:59 +0000 (Thu, 13 May 2010) Log Message: ----------- Weaken types. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-12 20:53:31 UTC (rev 7725) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-13 10:27:59 UTC (rev 7726) @@ -43,6 +43,7 @@ import net.sf.gridarta.gui.archetypetype.ArchetypeTypeChecks; import net.sf.gridarta.gui.autovalidator.AutoValidator; import net.sf.gridarta.gui.connectionview.ConnectionControl; +import net.sf.gridarta.gui.connectionview.Control; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.connectionview.MonsterControl; import net.sf.gridarta.gui.copybuffer.CopyBuffer; @@ -456,7 +457,7 @@ new DefaultMapActions<G, A, R>(mainViewFrame, mainViewFrame, mapManager, mapViewManager, exitMatcher, FileFilters.mapFileFilter, selectedSquareModel, directionMap, allowRandomMapParameters, mapPropertiesDialogFactory, mapViewSettings, mapPathNormalizer, mapViewsManager, fileControl); ArchetypeTypeChecks.addChecks(archetypeTypeSet, attributeRangeChecker); final DelayedMapModelListenerManager<G, A, R> delayedMapModelListenerManager = new DelayedMapModelListenerManager<G, A, R>(mapManager, exiter); - final LockedItemsControl<G, A, R> lockedItemsControl = new LockedItemsControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, lockedItemsTypeNumbers); + final Control<?, G, A, R> lockedItemsControl = new LockedItemsControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, lockedItemsTypeNumbers); final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel = new GameObjectAttributesModel<G, A, R>(); final SelectedSquareView<G, A, R> selectedSquareView = selectedSquareControl.getSelectedSquareView(); final GameObjectAttributesControl<G, A, R> gameObjectAttributesControl = new GameObjectAttributesControl<G, A, R>(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, mapManager, selectedSquareModel, selectedSquareView, gameObjectFactory, gameObjectMatchers); Modified: trunk/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java 2010-05-12 20:53:31 UTC (rev 7725) +++ trunk/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java 2010-05-13 10:27:59 UTC (rev 7726) @@ -123,7 +123,7 @@ final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", "key1 value1\nkey2 value2\n", faceObjectProviders, animationObjects); - final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); + final BaseObject<?, ?, ?, ?> gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); Assert.assertEquals("value1", gameObject.getAttributeString("key1")); Assert.assertEquals("value1", gameObject.getAttributeString("key1", true)); @@ -250,7 +250,7 @@ * @param gameObject the game object to check * @param direction the expected direction */ - private static void checkDirection(@NotNull final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject, final int direction) { + private static void checkDirection(@NotNull final BaseObject<?, ?, ?, ?> gameObject, final int direction) { Assert.assertEquals(direction, gameObject.getDirection()); Assert.assertEquals(direction, gameObject.getAttributeInt("direction")); } @@ -316,7 +316,7 @@ * @param gameObject the game object to check * @param type the expected direction */ - private static void checkType(@NotNull final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject, final int type) { + private static void checkType(@NotNull final BaseObject<?, ?, ?, ?> gameObject, final int type) { Assert.assertEquals(type, gameObject.getTypeNo()); Assert.assertEquals(type, gameObject.getAttributeInt("type")); } @@ -329,7 +329,7 @@ final AnimationObjects animationObjects = new DefaultAnimationObjects("anim"); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", null, faceObjectProviders, animationObjects); - final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); + final BaseObject<?, ?, ?, ?> gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); checkName(gameObject, "arch", ""); gameObject.setAttributeString("name", "3"); checkName(gameObject, "3", "3"); @@ -347,7 +347,7 @@ final AnimationObjects animationObjects = new DefaultAnimationObjects("anim"); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", "name 2", faceObjectProviders, animationObjects); - final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); + final BaseObject<?, ?, ?, ?> gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); checkName(gameObject, "2", "2"); gameObject.setAttributeString("name", "3"); checkName(gameObject, "3", "3"); @@ -383,7 +383,7 @@ * @param name the expected name (cached value) * @param nameAttribute the expected name ("name" attribute) */ - private static void checkName(@NotNull final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject, @NotNull final String name, @NotNull final String nameAttribute) { + private static void checkName(@NotNull final BaseObject<?, ?, ?, ?> gameObject, @NotNull final String name, @NotNull final String nameAttribute) { Assert.assertEquals(name, gameObject.getObjName()); Assert.assertEquals(nameAttribute, gameObject.getAttributeString("name")); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-12 20:53:38
|
Revision: 7725 http://gridarta.svn.sourceforge.net/gridarta/?rev=7725&view=rev Author: akirschbaum Date: 2010-05-12 20:53:31 +0000 (Wed, 12 May 2010) Log Message: ----------- Make AutojoinList and AutojoinLists serializable. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java Modified: trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java 2010-05-12 20:39:32 UTC (rev 7724) +++ trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java 2010-05-12 20:53:31 UTC (rev 7725) @@ -19,6 +19,7 @@ package net.sf.gridarta.model.autojoin; +import java.io.Serializable; import java.util.ArrayList; import java.util.List; import net.sf.gridarta.model.archetype.Archetype; @@ -33,9 +34,14 @@ * wall-)arches which do autojoining. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> */ -public class AutojoinList<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class AutojoinList<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Serializable { /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** * The Logger for printing log messages. */ private static final Category log = Logger.getLogger(AutojoinList.class); Modified: trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java 2010-05-12 20:39:32 UTC (rev 7724) +++ trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java 2010-05-12 20:53:31 UTC (rev 7725) @@ -20,6 +20,7 @@ package net.sf.gridarta.model.autojoin; import java.awt.Point; +import java.io.Serializable; import java.util.IdentityHashMap; import java.util.Map; import net.sf.gridarta.model.archetype.Archetype; @@ -34,9 +35,14 @@ * Manages a mapping between archetypes to {@link AutojoinList}s. * @author Andreas Kirschbaum */ -public class AutojoinLists<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class AutojoinLists<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Serializable { /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** * Mapping of archetypes to autojoin lists. */ private final Map<Archetype<G, A, R>, AutojoinList<G, A, R>> autojoinLists = new IdentityHashMap<Archetype<G, A, R>, AutojoinList<G, A, R>>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-12 20:39:39
|
Revision: 7724 http://gridarta.svn.sourceforge.net/gridarta/?rev=7724&view=rev Author: akirschbaum Date: 2010-05-12 20:39:32 +0000 (Wed, 12 May 2010) Log Message: ----------- Implement #2951536 (Different color for unknown fields): use red text for incorrect attributes in game object text editor. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/TextEditorTab.java trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-05-12 20:23:27 UTC (rev 7723) +++ trunk/atrinik/ChangeLog 2010-05-12 20:39:32 UTC (rev 7724) @@ -1,3 +1,8 @@ +2010-05-12 Andreas Kirschbaum + + * Implement #2951536 (Different color for unknown fields): use red + text for incorrect attributes in game object text editor. + 2010-05-09 Andreas Kirschbaum * Implement "Add Env" when using the pickmap chooser. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-05-12 20:23:27 UTC (rev 7723) +++ trunk/crossfire/ChangeLog 2010-05-12 20:39:32 UTC (rev 7724) @@ -1,3 +1,8 @@ +2010-05-12 Andreas Kirschbaum + + * Implement #2951536 (Different color for unknown fields): use red + text for incorrect attributes in game object text editor. + 2010-05-09 Andreas Kirschbaum * Implement "Add Env" when using the pickmap chooser. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-05-12 20:23:27 UTC (rev 7723) +++ trunk/daimonin/ChangeLog 2010-05-12 20:39:32 UTC (rev 7724) @@ -1,3 +1,8 @@ +2010-05-12 Andreas Kirschbaum + + * Implement #2951536 (Different color for unknown fields): use red + text for incorrect attributes in game object text editor. + 2010-05-09 Andreas Kirschbaum * Implement "Add Env" when using the pickmap chooser. Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/TextEditorTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/TextEditorTab.java 2010-05-12 20:23:27 UTC (rev 7723) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/TextEditorTab.java 2010-05-12 20:39:32 UTC (rev 7724) @@ -23,6 +23,7 @@ import net.sf.gridarta.gui.gameobjecttexteditor.GameObjectTextEditor; import net.sf.gridarta.gui.utils.Severity; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -38,14 +39,16 @@ * The displayed {@link GameObjectTextEditor} instance. */ @NotNull - private final GameObjectTextEditor gameObjectTextEditor = new GameObjectTextEditor(); + private final GameObjectTextEditor<G, A, R> gameObjectTextEditor; /** * Creates a new instance. * @param gameObjectAttributesModel the model to track + * @param archetypeTypeSet the archetype type set */ - public TextEditorTab(@NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel) { + public TextEditorTab(@NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { super(gameObjectAttributesModel); + gameObjectTextEditor = new GameObjectTextEditor<G, A, R>(archetypeTypeSet); addAutoApply(gameObjectTextEditor.getTextPane()); } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java 2010-05-12 20:23:27 UTC (rev 7723) +++ trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java 2010-05-12 20:39:32 UTC (rev 7724) @@ -22,6 +22,9 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Component; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; import javax.swing.JPanel; import javax.swing.JScrollPane; import javax.swing.JTextPane; @@ -32,8 +35,14 @@ import javax.swing.text.MutableAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; +import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.AttributeListUtils; +import net.sf.gridarta.model.archetypetype.ArchetypeAttribute; +import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.gameobject.GameObjectUtils; +import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -42,7 +51,7 @@ * currently selected game object as a text document. * @author Andreas Kirschbaum */ -public class GameObjectTextEditor extends JPanel { +public class GameObjectTextEditor<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JPanel { /** * The serial version UID. @@ -50,6 +59,12 @@ private static final long serialVersionUID = 1L; /** + * The {@link ArchetypeTypeSet}. + */ + @NotNull + private final ArchetypeTypeSet<G, A, R> archetypeTypeSet; + + /** * The {@link JTextPane} that contains the attributes of the game object. */ private final JTextPane archEdit = new ScrollingTextPane(); @@ -62,9 +77,11 @@ /** * Creates a new instance. + * @param archetypeTypeSet the archetype type set */ - public GameObjectTextEditor() { + public GameObjectTextEditor(@NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { super(new BorderLayout()); + this.archetypeTypeSet = archetypeTypeSet; final JScrollPane scrollPane = new JScrollPane(); add(scrollPane, BorderLayout.CENTER); scrollPane.setViewportView(archEdit); @@ -96,19 +113,34 @@ * GameObject}. * @param gameObject the game object to set the contents from */ - public void refreshDisplay(@Nullable final GameObject<?, ?, ?> gameObject) { + public void refreshDisplay(@Nullable final GameObject<G, A, R> gameObject) { archEdit.setEnabled(gameObject != null); archEdit.setText(""); if (gameObject != null) { final MutableAttributeSet currentAttributes = archEdit.getStyle(StyleContext.DEFAULT_STYLE); try { - // Color.blue: the "special" attributes, differ from the archetype - StyleConstants.setForeground(currentAttributes, Color.blue); - final Document document = archEdit.getDocument(); - document.insertString(document.getLength(), gameObject.getObjectText(), currentAttributes); - // Color.black: the game object attributes that differ from the archetype + final Iterable<ArchetypeAttribute<G, A, R>> typeStruct = archetypeTypeSet.getTypeOfArch(gameObject); + final String errorText = GameObjectUtils.getSyntaxErrors(gameObject, typeStruct); + + if (errorText == null) { + StyleConstants.setForeground(currentAttributes, Color.blue); + document.insertString(document.getLength(), gameObject.getObjectText(), currentAttributes); + } else { + StyleConstants.setForeground(currentAttributes, Color.red); + document.insertString(document.getLength(), errorText, currentAttributes); + + final Collection<String> errors = new HashSet<String>(); + errors.addAll(Arrays.asList(StringUtils.PATTERN_END_OF_LINE.split(errorText))); + StyleConstants.setForeground(currentAttributes, Color.blue); + for (final String line : StringUtils.PATTERN_END_OF_LINE.split(gameObject.getObjectText())) { + if (!errors.contains(line)) { + document.insertString(document.getLength(), line + '\n', currentAttributes); + } + } + } + StyleConstants.setForeground(currentAttributes, Color.black); document.insertString(document.getLength(), AttributeListUtils.diffArchTextKeys(gameObject, gameObject.getArchetype()), currentAttributes); } catch (final BadLocationException e) { Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-12 20:23:27 UTC (rev 7723) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-12 20:39:32 UTC (rev 7724) @@ -469,7 +469,7 @@ final UpdaterManager updaterManager = new UpdaterManager(exiter, mapManager, mainViewFrame, gridartaJarFilename); updaterManager.startup(); - final GameObjectAttributesTab<G, A, R> textEditorTab = new TextEditorTab<G, A, R>(gameObjectAttributesModel); + final GameObjectAttributesTab<G, A, R> textEditorTab = new TextEditorTab<G, A, R>(gameObjectAttributesModel, archetypeTypeSet); final GameObjectTab<G, A, R> gameObjectTab = new GameObjectTab<G, A, R>("gameObject", gameObjectAttributesControl, Location.BOTTOM, 0, true); mainView = new MainView(mainViewFrame, exitAction, mapDesktop, icon, exiter); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-12 20:23:34
|
Revision: 7723 http://gridarta.svn.sourceforge.net/gridarta/?rev=7723&view=rev Author: akirschbaum Date: 2010-05-12 20:23:27 +0000 (Wed, 12 May 2010) Log Message: ----------- Add @NotNull annotations. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/utils/StringUtils.java Modified: trunk/src/app/net/sf/gridarta/utils/StringUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/StringUtils.java 2010-05-11 22:03:16 UTC (rev 7722) +++ trunk/src/app/net/sf/gridarta/utils/StringUtils.java 2010-05-12 20:23:27 UTC (rev 7723) @@ -32,21 +32,25 @@ /** * Pattern to match whitespace. */ + @NotNull public static final Pattern PATTERN_WHITESPACE = Pattern.compile("[\\x00-\\x09\\x0b\\x20]+"); /** * Pattern to match trailing whitespace. */ + @NotNull private static final Pattern PATTERN_TRAILING_WHITESPACE = Pattern.compile("[\\x00-\\x09\\x0b\\x20]+$"); /** * Pattern to match trailing whitespace in a multiline string. */ + @NotNull private static final Pattern PATTERN_MULTILINE_TRAILING_WHITESPACE = Pattern.compile("(?m)[\\x00-\\x09\\x0b\\x20]+$"); /** * The pattern to match end of line characters separating lines. */ + @NotNull public static final Pattern PATTERN_END_OF_LINE = Pattern.compile("\\s*\n"); /** @@ -60,7 +64,7 @@ * @param str the string * @return the trimmed string */ - public static String removeTrailingWhitespace(final CharSequence str) { + public static String removeTrailingWhitespace(@NotNull final CharSequence str) { return PATTERN_TRAILING_WHITESPACE.matcher(str).replaceFirst(""); } @@ -69,7 +73,7 @@ * @param str the string * @return the trimmed string */ - public static String removeTrailingWhitespaceFromLines(final CharSequence str) { + public static String removeTrailingWhitespaceFromLines(@NotNull final CharSequence str) { return PATTERN_MULTILINE_TRAILING_WHITESPACE.matcher(str).replaceAll(""); } @@ -81,7 +85,7 @@ * @param str the input string * @return the string with a trailing newline character */ - public static CharSequence ensureTrailingNewline(final String str) { + public static CharSequence ensureTrailingNewline(@NotNull final String str) { return str.length() <= 0 ? "" : str.endsWith("\n") ? str : str + "\n"; } @@ -91,7 +95,7 @@ * @return whener the string contains any non-whitespace character * @todo perhaps we should include here a real white space test */ - public static boolean isNonwhitespaceText(final CharSequence text) { + public static boolean isNonwhitespaceText(@NotNull final CharSequence text) { return PATTERN_WHITESPACE.matcher(text).replaceAll("").length() > 0; } @@ -107,7 +111,7 @@ * @return The text that differs. */ @Nullable - public static CharSequence diffTextString(final CharSequence base, final String str, final boolean ignoreValues) { + public static CharSequence diffTextString(@NotNull final CharSequence base, @NotNull final String str, final boolean ignoreValues) { for (final String line : PATTERN_END_OF_LINE.split(base, 0)) { if (ignoreValues ? line.startsWith(str) : line.equals(str)) { return line; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-11 22:03:22
|
Revision: 7722 http://gridarta.svn.sourceforge.net/gridarta/?rev=7722&view=rev Author: akirschbaum Date: 2010-05-11 22:03:16 +0000 (Tue, 11 May 2010) Log Message: ----------- Fix incorrect resource paths. Modified Paths: -------------- trunk/crossfire/build.xml trunk/src/app/net/sf/gridarta/utils/SystemIcons.java Modified: trunk/crossfire/build.xml =================================================================== --- trunk/crossfire/build.xml 2010-05-09 13:05:30 UTC (rev 7721) +++ trunk/crossfire/build.xml 2010-05-11 22:03:16 UTC (rev 7722) @@ -131,11 +131,11 @@ </fileset> <fileset dir="${resource.dir}"> <include name="icons/**"/> + <include name="system/**"/> </fileset> <fileset dir="."> <include name="${resource.dir}/HelpFiles/**"/> <include name="${resource.dir}/conf/**"/> - <include name="${resource.dir}/system/**"/> </fileset> <fileset dir="../src/app" excludes="**/*.java,**/package.html,**/overview.html" /> <fileset dir="../resource"> Modified: trunk/src/app/net/sf/gridarta/utils/SystemIcons.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/SystemIcons.java 2010-05-09 13:05:30 UTC (rev 7721) +++ trunk/src/app/net/sf/gridarta/utils/SystemIcons.java 2010-05-11 22:03:16 UTC (rev 7722) @@ -39,7 +39,7 @@ private static final String ICON_DIR = "icons/"; /** The directory that contains the system icons. */ - public static final String SYSTEM_DIR = "resource/system/"; + public static final String SYSTEM_DIR = "system/"; public static final String SQUARE_SEL_SQUARE = SYSTEM_DIR + "seltile.png"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-09 13:05:37
|
Revision: 7721 http://gridarta.svn.sourceforge.net/gridarta/?rev=7721&view=rev Author: akirschbaum Date: 2010-05-09 13:05:30 +0000 (Sun, 09 May 2010) Log Message: ----------- Rewrite GUIUtils.getResourceIcon() to prefer built-in resources over files and to complain about missing resources. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/IGUIConstants.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/IGUIConstants.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/src/app/net/sf/gridarta/utils/GUIUtils.java trunk/src/app/net/sf/gridarta/utils/SystemIcons.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/IGUIConstants.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/IGUIConstants.java 2010-05-09 11:22:48 UTC (rev 7720) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/IGUIConstants.java 2010-05-09 13:05:30 UTC (rev 7721) @@ -21,6 +21,7 @@ import net.sf.gridarta.gui.utils.GUIConstants; import net.sf.gridarta.utils.CommonConstants; +import net.sf.gridarta.utils.SystemIcons; /** * Defines common UI constants used in different dialogs and all used icon @@ -86,7 +87,7 @@ String ARTIFACTS_FILE = "artifacts"; // file with artifact definitions - String TILE_NORTH = "north.png"; + String TILE_NORTH = SystemIcons.SYSTEM_DIR + "north.png"; /** * Name of the files the spell information (names and numbers). Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-05-09 11:22:48 UTC (rev 7720) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-05-09 13:05:30 UTC (rev 7721) @@ -539,7 +539,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(FileFilters.pythonFileFilter, ".py", true, mapManager, pickmapManager, archetypeSet, mapControlFactory, guiUtils.getSysIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubdirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new int[] { CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST, CommonConstants.EAST, CommonConstants.SOUTH, CommonConstants.WEST, CommonConstants.NORTH, }, defaultFilterList, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); + return mainControl.createGUIMainControl(FileFilters.pythonFileFilter, ".py", true, mapManager, pickmapManager, archetypeSet, mapControlFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubdirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new int[] { CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST, CommonConstants.EAST, CommonConstants.SOUTH, CommonConstants.WEST, CommonConstants.NORTH, }, defaultFilterList, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/IGUIConstants.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/IGUIConstants.java 2010-05-09 11:22:48 UTC (rev 7720) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/IGUIConstants.java 2010-05-09 13:05:30 UTC (rev 7721) @@ -21,6 +21,7 @@ import net.sf.gridarta.gui.utils.GUIConstants; import net.sf.gridarta.utils.CommonConstants; +import net.sf.gridarta.utils.SystemIcons; /** * Defines common UI constants used in different dialogs and all used icon @@ -86,7 +87,7 @@ String ARTIFACTS_FILE = "artifacts"; // file with artifact definitions - String TILE_NORTH = "north.png"; + String TILE_NORTH = SystemIcons.SYSTEM_DIR + "north.png"; /** * Name of the files the spell information (names and numbers). Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-05-09 11:22:48 UTC (rev 7720) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-05-09 13:05:30 UTC (rev 7721) @@ -540,7 +540,7 @@ @NotNull @Override public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(FileFilters.luaFileFilter, ".lua", true, mapManager, pickmapManager, archetypeSet, mapControlFactory, guiUtils.getSysIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubdirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new int[] { CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST, CommonConstants.EAST, CommonConstants.SOUTH, CommonConstants.WEST, CommonConstants.NORTH, }, defaultFilterList, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); + return mainControl.createGUIMainControl(FileFilters.luaFileFilter, ".lua", true, mapManager, pickmapManager, archetypeSet, mapControlFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubdirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new int[] { CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST, CommonConstants.EAST, CommonConstants.SOUTH, CommonConstants.WEST, CommonConstants.NORTH, }, defaultFilterList, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); } /** Modified: trunk/src/app/net/sf/gridarta/utils/GUIUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/GUIUtils.java 2010-05-09 11:22:48 UTC (rev 7720) +++ trunk/src/app/net/sf/gridarta/utils/GUIUtils.java 2010-05-09 13:05:30 UTC (rev 7721) @@ -23,11 +23,11 @@ import java.net.URL; import java.util.HashMap; import java.util.Map; +import java.util.MissingResourceException; import javax.swing.ImageIcon; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * <code>CGUtils</code> is a collection of GUI utility methods. Mainly focusing @@ -39,16 +39,6 @@ public class GUIUtils { /** - * The directory that contains the common-use icons. - */ - private static final String ICON_DIR = "resource/icons"; - - /** - * The directory that contains the system icons. - */ - private static final String SYSTEM_DIR = "resource/system"; - - /** * The Logger for printing log messages. */ private static final Category log = Logger.getLogger(GUIUtils.class); @@ -64,81 +54,46 @@ * once and uses hashtable to return the same instance if same icon name is * given. Note: There must not be conflicting icon names from different * directorys. - * @param dirUri uri of the directory the icon is in - * @param strIconName the icon name (propably one of the constants defined - * in IGUIConstants). - * @return The image icon for the given icon name. + * @param iconName the icon name + * @return the image icon for the given icon name + * @throws MissingResourceException if the icon cannot be loaded */ - @Nullable - private ImageIcon getResourceIcon(@NotNull final String dirUri, @NotNull final String strIconName) { - if (dirUri.contains("\\")) { - throw new IllegalArgumentException("dirUri must be a URI but was: " + dirUri); + @NotNull + public ImageIcon getResourceIcon(@NotNull final String iconName) throws MissingResourceException { + // check cache + if (imageCache.containsKey(iconName)) { + if (log.isDebugEnabled()) { + log.debug("getResourceIcon(" + iconName + "): return cached"); + } + return imageCache.get(iconName); } - // first, look if this icon is already available in the Hashtable - if (imageCache.containsKey(strIconName)) { - return imageCache.get(strIconName); - } - // Look for the file, replacing '/' with File.separatorChar when necessary. - final File imageFile = new File(File.separatorChar == '/' ? dirUri : dirUri.replace('/', File.separatorChar), strIconName); - @Nullable final ImageIcon icon; - if (imageFile.exists()) { - // image file exists in expected directory - icon = new ImageIcon(imageFile.getAbsolutePath()); - } else { - // image file is missing, so let's try to load it from jar - final URL fullImageResource = GUIUtils.class.getClassLoader().getResource(dirUri + '/' + strIconName); + @NotNull final ImageIcon icon; - if (fullImageResource != null) { - icon = new ImageIcon(fullImageResource); - } else { - final int slashIndex = dirUri.indexOf('/'); - if (slashIndex == -1) { - icon = null; - } else { - // let's try it again without first directory (okay, this may look - // a bit weird, but usually this is the correct icon path in the jar) - final URL strippedImageResource = GUIUtils.class.getClassLoader().getResource(dirUri.substring(slashIndex + 1) + '/' + strIconName); - if (strippedImageResource != null) { - icon = new ImageIcon(strippedImageResource); - } else { - icon = null; - } + final URL iconURL = GUIUtils.class.getClassLoader().getResource(iconName); + if (iconURL != null) { + if (log.isDebugEnabled()) { + log.debug("getResourceIcon(" + iconName + "): loading from resource: " + iconURL); + } + icon = new ImageIcon(iconURL); + } else { + final File iconFile = new File(iconName); + if (iconFile.exists()) { + if (log.isDebugEnabled()) { + log.debug("getResourceIcon(" + iconName + "): loading from file: " + iconFile); } + icon = new ImageIcon(iconFile.getAbsolutePath()); + } else { + log.warn("Cannot find icon '" + iconName + "'"); + throw new MissingResourceException("missing resource", GUIUtils.class.getName(), iconName); } } - // put this icon into the Hashtable - if (icon != null) { - imageCache.put(strIconName, icon); - } else { - log.warn("Failed to load icon '" + strIconName + "'!"); - } - + imageCache.put(iconName, icon); return icon; } /** - * Returns the specified icon as a normal icon resource. - * @param strIconName Name of the icon to return. - * @return The icon or <code>null</code> if the icon couldn't be loaded. - */ - @Nullable - public ImageIcon getIcon(@NotNull final String strIconName) { - return getResourceIcon(ICON_DIR, strIconName); - } - - /** - * Returns the specified icon as a system icon resource. - * @param strIconName Name of the icon to return. - * @return The icon or <code>null</code> if the icon couldn't be loaded. - */ - @Nullable - public ImageIcon getSysIcon(@NotNull final String strIconName) { - return getResourceIcon(SYSTEM_DIR, strIconName); - } - - /** * Add an image to the cache. * @param name the name * @param imageIcon the image icon Modified: trunk/src/app/net/sf/gridarta/utils/SystemIcons.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/SystemIcons.java 2010-05-09 11:22:48 UTC (rev 7720) +++ trunk/src/app/net/sf/gridarta/utils/SystemIcons.java 2010-05-09 13:05:30 UTC (rev 7721) @@ -35,60 +35,64 @@ */ public class SystemIcons { - public static final String SQUARE_SEL_SQUARE = "seltile.png"; + /** The directory that contains the common-use icons. */ + private static final String ICON_DIR = "icons/"; - public static final String SQUARE_SEL_SQUARE_NORTH = "seltile_n.png"; + /** The directory that contains the system icons. */ + public static final String SYSTEM_DIR = "resource/system/"; - public static final String SQUARE_SEL_SQUARE_EAST = "seltile_e.png"; + public static final String SQUARE_SEL_SQUARE = SYSTEM_DIR + "seltile.png"; - public static final String SQUARE_SEL_SQUARE_SOUTH = "seltile_s.png"; + public static final String SQUARE_SEL_SQUARE_NORTH = SYSTEM_DIR + "seltile_n.png"; - public static final String SQUARE_SEL_SQUARE_WEST = "seltile_w.png"; + public static final String SQUARE_SEL_SQUARE_EAST = SYSTEM_DIR + "seltile_e.png"; - public static final String SQUARE_PRESEL_SQUARE = "preseltile.png"; + public static final String SQUARE_SEL_SQUARE_SOUTH = SYSTEM_DIR + "seltile_s.png"; - public static final String SQUARE_CURSOR = "cursor.png"; + public static final String SQUARE_SEL_SQUARE_WEST = SYSTEM_DIR + "seltile_w.png"; - public static final String SQUARE_EMPTY = "empty.png"; + public static final String SQUARE_PRESEL_SQUARE = SYSTEM_DIR + "preseltile.png"; - public static final String SQUARE_UNKNOWN = "unknown.png"; + public static final String SQUARE_CURSOR = SYSTEM_DIR + "cursor.png"; - public static final String SQUARE_WARNING = "warning.png"; + public static final String SQUARE_EMPTY = SYSTEM_DIR + "empty.png"; - public static final String SQUARE_NOFACE = "noface.png"; + public static final String SQUARE_UNKNOWN = SYSTEM_DIR + "unknown.png"; - public static final String SQUARE_NOARCH = "noarch.png"; + public static final String SQUARE_WARNING = SYSTEM_DIR + "warning.png"; - public static final String TREASURE_LIST = "treasure_list.png"; + public static final String SQUARE_NOFACE = SYSTEM_DIR + "noface.png"; - public static final String TREASUREONE_LIST = "treasureone_list.png"; + public static final String SQUARE_NOARCH = SYSTEM_DIR + "noarch.png"; - public static final String TREASURE_YES = "treasure_yes.png"; + public static final String TREASURE_LIST = SYSTEM_DIR + "treasure_list.png"; - public static final String TREASURE_NO = "treasure_no.png"; + public static final String TREASUREONE_LIST = SYSTEM_DIR + "treasureone_list.png"; - /** - * The default map icon to use if no icon can be created. - */ - public static final String DEFAULT_ICON = "default_icon.png"; + public static final String TREASURE_YES = SYSTEM_DIR + "treasure_yes.png"; + public static final String TREASURE_NO = SYSTEM_DIR + "treasure_no.png"; + + /** The default map icon to use if no icon can be created. */ + public static final String DEFAULT_ICON = SYSTEM_DIR + "default_icon.png"; + /** * The default map preview to use if no icon can be created. */ - public static final String DEFAULT_PREVIEW = "default_preview.png"; + public static final String DEFAULT_PREVIEW = SYSTEM_DIR + "default_preview.png"; - private static final String CLOSE_TAB_SMALLICON = "CloseTabSmallIcon.gif"; + private static final String CLOSE_TAB_SMALLICON = ICON_DIR + "CloseTabSmallIcon.gif"; - public static final String AUTORUN_SMALLICON = "AutorunSmallIcon.gif"; + public static final String AUTORUN_SMALLICON = SYSTEM_DIR + "AutorunSmallIcon.gif"; - public static final String FILTER_SMALLICON = "FilterSmallIcon.gif"; + public static final String FILTER_SMALLICON = SYSTEM_DIR + "FilterSmallIcon.gif"; - public static final String RUN_PLUGIN_SMALLICON = "RunPluginSmallIcon.gif"; + public static final String RUN_PLUGIN_SMALLICON = SYSTEM_DIR + "RunPluginSmallIcon.gif"; /** * Application icon definitions (icon-dir). */ - private static final String APP_ICON = "CFIcon.gif"; + private static final String APP_ICON = ICON_DIR + "CFIcon.gif"; /** * The {@link GUIUtils} for creating icons. @@ -185,7 +189,7 @@ @NotNull public ImageIcon getMapCursorIcon() { if (mapCursorIcon == null) { - mapCursorIcon = guiUtils.getSysIcon(SQUARE_CURSOR); + mapCursorIcon = guiUtils.getResourceIcon(SQUARE_CURSOR); } return mapCursorIcon; } @@ -193,7 +197,7 @@ @NotNull public Icon getEmptySquareIcon() { if (emptySquareIcon == null) { - emptySquareIcon = guiUtils.getSysIcon(SQUARE_EMPTY); + emptySquareIcon = guiUtils.getResourceIcon(SQUARE_EMPTY); } return emptySquareIcon; } @@ -201,7 +205,7 @@ @NotNull public ImageIcon getUnknownSquareIcon() { if (unknownSquareIcon == null) { - unknownSquareIcon = guiUtils.getSysIcon(SQUARE_UNKNOWN); + unknownSquareIcon = guiUtils.getResourceIcon(SQUARE_UNKNOWN); } return unknownSquareIcon; } @@ -210,7 +214,7 @@ public ImageIcon getWarningSquareIcon() { if (warningSquareIcon == null) { final ImageFilter alphaFilter = AlphaImageFilterInstance.ALPHA_FILTER; - final ImageIcon sysIcon = guiUtils.getSysIcon(SQUARE_WARNING); + final ImageIcon sysIcon = guiUtils.getResourceIcon(SQUARE_WARNING); final Image image = sysIcon.getImage(); final ImageProducer source = image.getSource(); final ImageProducer producer = new FilteredImageSource(source, alphaFilter); @@ -223,21 +227,21 @@ @NotNull public ImageIcon getNofaceSquareIcon() { if (nofaceSquareIcon == null) { - nofaceSquareIcon = guiUtils.getSysIcon(SQUARE_NOFACE); + nofaceSquareIcon = guiUtils.getResourceIcon(SQUARE_NOFACE); } return nofaceSquareIcon; } @NotNull public ImageIcon getNoarchSquareIcon() { - noarchSquareIcon = guiUtils.getSysIcon(SQUARE_NOARCH); + noarchSquareIcon = guiUtils.getResourceIcon(SQUARE_NOARCH); return noarchSquareIcon; } @NotNull public ImageIcon getMapSelIcon() { if (mapSelIcon == null) { - mapSelIcon = guiUtils.getSysIcon(SQUARE_SEL_SQUARE); + mapSelIcon = guiUtils.getResourceIcon(SQUARE_SEL_SQUARE); } return mapSelIcon; } @@ -245,7 +249,7 @@ @NotNull public ImageIcon getMapSelIconNorth() { if (mapSelIconNorth == null) { - mapSelIconNorth = guiUtils.getSysIcon(SQUARE_SEL_SQUARE_NORTH); + mapSelIconNorth = guiUtils.getResourceIcon(SQUARE_SEL_SQUARE_NORTH); } return mapSelIconNorth; } @@ -253,7 +257,7 @@ @NotNull public ImageIcon getMapSelIconEast() { if (mapSelIconEast == null) { - mapSelIconEast = guiUtils.getSysIcon(SQUARE_SEL_SQUARE_EAST); + mapSelIconEast = guiUtils.getResourceIcon(SQUARE_SEL_SQUARE_EAST); } return mapSelIconEast; } @@ -261,7 +265,7 @@ @NotNull public ImageIcon getMapSelIconSouth() { if (mapSelIconSouth == null) { - mapSelIconSouth = guiUtils.getSysIcon(SQUARE_SEL_SQUARE_SOUTH); + mapSelIconSouth = guiUtils.getResourceIcon(SQUARE_SEL_SQUARE_SOUTH); } return mapSelIconSouth; } @@ -269,7 +273,7 @@ @NotNull public ImageIcon getMapSelIconWest() { if (mapSelIconWest == null) { - mapSelIconWest = guiUtils.getSysIcon(SQUARE_SEL_SQUARE_WEST); + mapSelIconWest = guiUtils.getResourceIcon(SQUARE_SEL_SQUARE_WEST); } return mapSelIconWest; } @@ -277,7 +281,7 @@ @NotNull public ImageIcon getMapPreSelIcon() { if (mapPreSelIcon == null) { - mapPreSelIcon = guiUtils.getSysIcon(SQUARE_PRESEL_SQUARE); + mapPreSelIcon = guiUtils.getResourceIcon(SQUARE_PRESEL_SQUARE); } return mapPreSelIcon; } @@ -289,11 +293,10 @@ @NotNull public Image getDefaultIcon() { if (defaultIcon == null) { - final ImageIcon icon = guiUtils.getSysIcon(DEFAULT_ICON); - if (icon != null) { - defaultIcon = icon.getImage(); - } + final ImageIcon icon = guiUtils.getResourceIcon(DEFAULT_ICON); + defaultIcon = icon.getImage(); } + assert defaultIcon != null; return defaultIcon; } @@ -304,18 +307,17 @@ @NotNull public Image getDefaultPreview() { if (defaultPreview == null) { - final ImageIcon icon = guiUtils.getSysIcon(DEFAULT_PREVIEW); - if (icon != null) { - defaultPreview = icon.getImage(); - } + final ImageIcon icon = guiUtils.getResourceIcon(DEFAULT_PREVIEW); + defaultPreview = icon.getImage(); } + assert defaultPreview != null; return defaultPreview; } @NotNull public Icon getTreasureListIcon() { if (treasureListIcon == null) { - treasureListIcon = guiUtils.getSysIcon(TREASURE_LIST); + treasureListIcon = guiUtils.getResourceIcon(TREASURE_LIST); } return treasureListIcon; } @@ -323,7 +325,7 @@ @NotNull public Icon getTreasureOneListIcon() { if (treasureOneListIcon == null) { - treasureOneListIcon = guiUtils.getSysIcon(TREASUREONE_LIST); + treasureOneListIcon = guiUtils.getResourceIcon(TREASUREONE_LIST); } return treasureOneListIcon; } @@ -331,7 +333,7 @@ @NotNull public Icon getTreasureYesIcon() { if (treasureYesIcon == null) { - treasureYesIcon = guiUtils.getSysIcon(TREASURE_YES); + treasureYesIcon = guiUtils.getResourceIcon(TREASURE_YES); } return treasureYesIcon; } @@ -339,7 +341,7 @@ @NotNull public Icon getTreasureNoIcon() { if (treasureNoIcon == null) { - treasureNoIcon = guiUtils.getSysIcon(TREASURE_NO); + treasureNoIcon = guiUtils.getResourceIcon(TREASURE_NO); } return treasureNoIcon; } @@ -347,7 +349,7 @@ @NotNull public ImageIcon getCloseTabSmallIcon() { if (closeTabSmallIcon == null) { - closeTabSmallIcon = guiUtils.getSysIcon(CLOSE_TAB_SMALLICON); + closeTabSmallIcon = guiUtils.getResourceIcon(CLOSE_TAB_SMALLICON); } return closeTabSmallIcon; } @@ -355,7 +357,7 @@ @NotNull public Icon getAutoRunSmallIcon() { if (autoRunSmallIcon == null) { - autoRunSmallIcon = guiUtils.getSysIcon(AUTORUN_SMALLICON); + autoRunSmallIcon = guiUtils.getResourceIcon(AUTORUN_SMALLICON); } return autoRunSmallIcon; } @@ -363,7 +365,7 @@ @NotNull public Icon getFilterSmallIcon() { if (filterSmallIcon == null) { - filterSmallIcon = guiUtils.getSysIcon(FILTER_SMALLICON); + filterSmallIcon = guiUtils.getResourceIcon(FILTER_SMALLICON); } return filterSmallIcon; } @@ -371,7 +373,7 @@ @NotNull public Icon getRunPluginSmallIcon() { if (runPluginSmallIcon == null) { - runPluginSmallIcon = guiUtils.getSysIcon(RUN_PLUGIN_SMALLICON); + runPluginSmallIcon = guiUtils.getResourceIcon(RUN_PLUGIN_SMALLICON); } return runPluginSmallIcon; } @@ -383,7 +385,7 @@ @Nullable public ImageIcon getAppIcon() { if (appIcon == null) { - appIcon = guiUtils.getIcon(APP_ICON); + appIcon = guiUtils.getResourceIcon(APP_ICON); } return appIcon; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-09 11:22:55
|
Revision: 7720 http://gridarta.svn.sourceforge.net/gridarta/?rev=7720&view=rev Author: akirschbaum Date: 2010-05-09 11:22:48 +0000 (Sun, 09 May 2010) Log Message: ----------- Remove MapModelListener.mapClosed(). Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ErrorListView.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java trunk/src/app/net/sf/gridarta/gui/misc/RecentManager.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModelListener.java trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -262,14 +262,6 @@ // ignore } - /** - * {@inheritDoc} - */ - @Override - public void mapClosed() { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -368,14 +368,6 @@ * {@inheritDoc} */ @Override - public void mapClosed() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override public void mapMetaChanged() { scheduleMapModel(mapModel); } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -81,6 +81,8 @@ import net.sf.gridarta.gui.utils.AnimComponent; import net.sf.gridarta.gui.utils.DirectionLayout; import net.sf.gridarta.gui.utils.FaceComponent; +import net.sf.gridarta.mapmanager.MapManager; +import net.sf.gridarta.mapmanager.MapManagerListener; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetypetype.AbstractArchetypeAttributeSpell; @@ -114,6 +116,7 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectUtils; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapcontrol.MapControl; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.mapmodel.MapModelListener; import net.sf.gridarta.model.map.mapmodel.MapSquare; @@ -264,7 +267,13 @@ @NotNull private final TextAreaDefaults textAreaDefaults; + /** + * The {@link MapManager} instance. + */ @NotNull + private final MapManager<G, A, R> mapManager; + + @NotNull private final Collection<DialogAttrib<G, A, R, ?>> dialogAttribs = new ArrayList<DialogAttrib<G, A, R, ?>>(); /** @@ -693,16 +702,52 @@ /** {@inheritDoc} */ @Override - public void mapClosed() { - setValue(cancelButton); + public void mapMetaChanged() { + // ignore } - /** {@inheritDoc} */ + }; + + /** + * The {@link MapManagerListener} to detect closed maps. + */ + @NotNull + private final MapManagerListener<G, A, R> mapManagerListener = new MapManagerListener<G, A, R>() { + + /** + * {@inheritDoc} + */ @Override - public void mapMetaChanged() { + public void currentMapChanged(@Nullable final MapControl<G, A, R> mapControl) { // ignore } + /** + * {@inheritDoc} + */ + @Override + public void mapCreated(@NotNull final MapControl<G, A, R> mapControl, final boolean interactive) { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void mapClosing(@NotNull final MapControl<G, A, R> mapControl) { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void mapClosed(@NotNull final MapControl<G, A, R> mapControl) { + if (mapControl.getMapModel() == mapModel) { + setValue(cancelButton); + } + } + }; /** @@ -728,8 +773,9 @@ * @param systemIcons the system icons for creating icons * @param gameObjectMatchers the game object matchers to use * @param textAreaDefaults the text area defaults for text fields + * @param mapManager the map manager instance */ - public GameObjectAttributesDialog(@NotNull final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory, final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final G gameObject, @NotNull final JFrame parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final GlobalSettings globalSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final SystemIcons systemIcons, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final TextAreaDefaults textAreaDefaults) { + public GameObjectAttributesDialog(@NotNull final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory, final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final G gameObject, @NotNull final JFrame parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final GlobalSettings globalSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final SystemIcons systemIcons, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final TextAreaDefaults textAreaDefaults, @NotNull final MapManager<G, A, R> mapManager) { this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.archetypeTypeSet = archetypeTypeSet; this.gameObject = gameObject; @@ -748,6 +794,7 @@ this.systemIcons = systemIcons; this.gameObjectMatchers = gameObjectMatchers; this.textAreaDefaults = textAreaDefaults; + this.mapManager = mapManager; archetype = gameObject.getArchetype(); final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); @@ -757,6 +804,7 @@ mapModel = mapSquare.getMapModel(); mapPos = new Point(mapSquare.getMapX(), mapSquare.getMapY()); mapModel.addMapModelListener(mapModelListener); + mapManager.addMapManagerListener(mapManagerListener); archetypeType = archetypeTypeSet.getArchetypeType(gameObject); type = archetypeTypeSet.getArchetypeTypeIndex(archetypeType); @@ -822,6 +870,7 @@ if (newValue != UNINITIALIZED_VALUE) { gameObjectAttributesDialogFactory.hideAttribDialog(gameObject); mapModel.removeMapModelListener(mapModelListener); + mapManager.removeMapManagerListener(mapManagerListener); } } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -26,6 +26,7 @@ import javax.swing.JFrame; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.treasurelist.CFTreasureListTree; +import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.anim.AnimationObjects; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; @@ -154,6 +155,12 @@ private TextAreaDefaults textAreaDefaults; /** + * The {@link MapManager} instance. + */ + @NotNull + private final MapManager<G, A, R> mapManager; + + /** * Creates a new instance. * @param archetypeTypeSet the list of CF type-data * @param parent the parent frame for dialog boxes @@ -172,8 +179,9 @@ * @param treasureTree the treasure tree to use * @param systemIcons the system icons for creating icons * @param gameObjectMatchers the game object matchers to use + * @param mapManager the map manager instance */ - public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final JFrame parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final GlobalSettings globalSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final SystemIcons systemIcons, @NotNull final GameObjectMatchers gameObjectMatchers) { + public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final JFrame parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final GlobalSettings globalSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final SystemIcons systemIcons, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final MapManager<G, A, R> mapManager) { this.archetypeTypeSet = archetypeTypeSet; this.parent = parent; this.treasureListTree = treasureListTree; @@ -189,6 +197,7 @@ this.treasureTree = treasureTree; this.systemIcons = systemIcons; this.gameObjectMatchers = gameObjectMatchers; + this.mapManager = mapManager; } @Deprecated @@ -219,7 +228,7 @@ if (dialogs.containsKey(head)) { dialogs.get(head).toFront(); } else { - final GameObjectAttributesDialog<G, A, R> pane = new GameObjectAttributesDialog<G, A, R>(this, archetypeTypeSet, head, parent, treasureListTree, faceObjectProviders, animationObjects, globalSettings, mapFileFilter, scriptFileFilter, faceObjects, gameObjectSpells, numberSpells, undefinedSpellIndex, treasureTree, systemIcons, gameObjectMatchers, textAreaDefaults); + final GameObjectAttributesDialog<G, A, R> pane = new GameObjectAttributesDialog<G, A, R>(this, archetypeTypeSet, head, parent, treasureListTree, faceObjectProviders, animationObjects, globalSettings, mapFileFilter, scriptFileFilter, faceObjects, gameObjectSpells, numberSpells, undefinedSpellIndex, treasureTree, systemIcons, gameObjectMatchers, textAreaDefaults, mapManager); final JDialog dialog = pane.createDialog(); dialogs.put(head, dialog); } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ErrorListView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ErrorListView.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ErrorListView.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -223,12 +223,6 @@ // ignore } - /** {@inheritDoc} */ - @Override - public void mapClosed() { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -295,12 +295,6 @@ // ignore } - /** {@inheritDoc} */ - @Override - public void mapClosed() { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -170,12 +170,6 @@ /** {@inheritDoc} */ @Override - public void mapClosed() { - // ignore - } - - /** {@inheritDoc} */ - @Override public void mapMetaChanged() { // ignore } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -135,12 +135,6 @@ updateTitle(); } - /** {@inheritDoc} */ - @Override - public void mapClosed() { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -167,12 +167,6 @@ /** {@inheritDoc} */ @Override - public void mapClosed() { - // ignore - } - - /** {@inheritDoc} */ - @Override public void mapMetaChanged() { // ignore } Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -267,14 +267,6 @@ // ignore } - /** - * {@inheritDoc} - */ - @Override - public void mapClosed() { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -150,12 +150,6 @@ /** {@inheritDoc} */ @Override - public void mapClosed() { - // ignore - } - - /** {@inheritDoc} */ - @Override public void mapMetaChanged() { // ignore } Modified: trunk/src/app/net/sf/gridarta/gui/misc/RecentManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/RecentManager.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/misc/RecentManager.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -321,14 +321,6 @@ * {@inheritDoc} */ @Override - public void mapClosed() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override public void saved(@NotNull final DefaultMapControl<G, A, R> mapControl) { assert mapModel == mapControl.getMapModel(); addRecent(mapModel, null); Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -263,12 +263,6 @@ /** {@inheritDoc} */ @Override - public void mapClosed() { - // ignore - } - - /** {@inheritDoc} */ - @Override public void mapMetaChanged() { // ignore } Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -111,12 +111,6 @@ /** {@inheritDoc} */ @Override - public void mapClosed() { - // ignore - } - - /** {@inheritDoc} */ - @Override public void mapMetaChanged() { // ignore } Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -168,12 +168,6 @@ // ignore } - /** {@inheritDoc} */ - @Override - public void mapClosed() { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -450,12 +450,6 @@ // ignore } - /** {@inheritDoc} */ - @Override - public void mapClosed() { - // ignore - } - }; /** Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -414,7 +414,7 @@ pickmapChooserControl = new PickmapChooserControl<G, A, R>(pickmapChooserModel, newMapDialogFactory, mapArchObjectFactory, mapReaderFactory, mapFolderTree, mapManager, mainViewFrame, pickmapManager, mapViewsManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); final CFTreasureListTree<G, A, R> treasureListTree = new CFTreasureListTree<G, A, R>(treasureTree, mainViewFrame, archetypeSet, faceObjectProviders, systemIcons); - final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(archetypeTypeSet, mainViewFrame, treasureListTree, faceObjectProviders, animationObjects, globalSettings, mapFileFilter, scriptFileFilter, faceObjects, gameObjectSpells, numberSpells, undefinedSpellIndex, treasureTree, systemIcons, gameObjectMatchers); + final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R>(archetypeTypeSet, mainViewFrame, treasureListTree, faceObjectProviders, animationObjects, globalSettings, mapFileFilter, scriptFileFilter, faceObjects, gameObjectSpells, numberSpells, undefinedSpellIndex, treasureTree, systemIcons, gameObjectMatchers, mapManager); final DefaultObjectChooser<G, A, R> objectChooser = new DefaultObjectChooser<G, A, R>(archetypeChooserControl, pickmapChooserControl, archetypeChooserModel, pickmapChooserModel, archetypeTypeSet); newMapDialogFactory.setObjectChooser(objectChooser); final SelectedSquareModel<G, A, R> selectedSquareModel = new SelectedSquareModel<G, A, R>(); Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -242,9 +242,6 @@ @Override public void mapClosed() { mapArchObject.removeMapArchObjectListener(mapArchObjectListener); - for (final MapModelListener<G, A, R> listener : mapModelListeners.getListeners()) { - listener.mapClosed(); - } } /** Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModelListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModelListener.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModelListener.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -84,9 +84,4 @@ */ void modifiedChanged(@NotNull MapModel<G, A, R> mapModel); - /** - * This map has been closed. - */ - void mapClosed(); - } // interface MapModelListener Modified: trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-05-09 09:30:06 UTC (rev 7719) +++ trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-05-09 11:22:48 UTC (rev 7720) @@ -130,14 +130,6 @@ * {@inheritDoc} */ @Override - public void mapClosed() { - // ignore - } - - /** - * {@inheritDoc} - */ - @Override public void mapMetaChanged() { result.append("mapMetaChanged"); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-09 09:30:14
|
Revision: 7719 http://gridarta.svn.sourceforge.net/gridarta/?rev=7719&view=rev Author: akirschbaum Date: 2010-05-09 09:30:06 +0000 (Sun, 09 May 2010) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-05-09 09:23:20 UTC (rev 7718) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-05-09 09:30:06 UTC (rev 7719) @@ -605,27 +605,27 @@ */ @ActionMethod public void mapArchAddEnv() { - final BaseObject<G, A, R, ?> arch = objectChooser.getSelection(); - if (arch == null) { + final BaseObject<G, A, R, ?> baseObject = objectChooser.getSelection(); + if (baseObject == null) { return; } - final G gameObject = selectedGameObject; - if (gameObject == null) { + final G prevGameObject = selectedGameObject; + if (prevGameObject == null) { return; } - final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); + final MapSquare<G, A, R> mapSquare = prevGameObject.getMapSquare(); assert mapSquare != null; final MapModel<G, A, R> mapModel = mapSquare.getMapModel(); mapModel.beginTransaction("Add to environment"); // TODO; I18N/L10N try { - final G insertedGameObject = mapModel.insertArchToMap(arch, gameObject, new Point(mapSquare.getMapX(), mapSquare.getMapY()), true); + final G insertedGameObject = mapModel.insertArchToMap(baseObject, prevGameObject, new Point(mapSquare.getMapX(), mapSquare.getMapY()), true); if (insertedGameObject != null) { - mapModel.removeGameObject(gameObject, true); - gameObject.setMapX(0); - gameObject.setMapY(0); - insertedGameObject.addLast(gameObject); + mapModel.removeGameObject(prevGameObject, true); + prevGameObject.setMapX(0); + prevGameObject.setMapY(0); + insertedGameObject.addLast(prevGameObject); selectedSquareView.setSelectedGameObject(insertedGameObject); } } finally { Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2010-05-09 09:23:20 UTC (rev 7718) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2010-05-09 09:30:06 UTC (rev 7719) @@ -305,23 +305,25 @@ * @param index the list index to insert at */ private void insertGameObjectFromObjectChooser(@NotNull final MapView<G, A, R> mapView, final int index) { - final BaseObject<G, A, R, ?> gameObject = objectChooser.getSelection(); - if (gameObject == null) { + final BaseObject<G, A, R, ?> baseObject = objectChooser.getSelection(); + if (baseObject == null) { return; } - final MapSquare<G, A, R> currentMapSquare = selectedSquareModel.getCurrentMapSquare(); - if (currentMapSquare == null) { + final MapSquare<G, A, R> mapSquare = selectedSquareModel.getCurrentMapSquare(); + if (mapSquare == null) { return; } + final G prevGameObject = index >= selectedSquareView.getModelSize() ? null : selectedSquareView.getListGameObject(index); final MapControl<G, A, R> mapControl = mapView.getMapControl(); final MapModel<G, A, R> mapModel = mapControl.getMapModel(); mapModel.beginTransaction("Insert"); // TODO; I18N/L10N try { - final G prevGameObject = index >= selectedSquareView.getModelSize() ? null : selectedSquareView.getListGameObject(index); - final G insertedGameObject = mapModel.insertArchToMap(gameObject, prevGameObject, new Point(currentMapSquare.getMapX(), currentMapSquare.getMapY()), true); - selectedSquareView.setSelectedGameObject(insertedGameObject); + final G insertedGameObject = mapModel.insertArchToMap(baseObject, prevGameObject, new Point(mapSquare.getMapX(), mapSquare.getMapY()), true); + if (insertedGameObject != null) { + selectedSquareView.setSelectedGameObject(insertedGameObject); + } } finally { mapModel.endTransaction(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-09 09:23:26
|
Revision: 7718 http://gridarta.svn.sourceforge.net/gridarta/?rev=7718&view=rev Author: akirschbaum Date: 2010-05-09 09:23:20 +0000 (Sun, 09 May 2010) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-09 09:20:19 UTC (rev 7717) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-09 09:23:20 UTC (rev 7718) @@ -891,7 +891,6 @@ // insert the new arch into the inventory of a map arch newGameObject = templateGameObject.newInstance(gameObjectFactory); gameObjectMatchers.updateEditType(newGameObject, activeEditType); - nextGameObjectEnv.addLast(newGameObject); } @@ -942,11 +941,11 @@ } for (final G part : parts) { - gameObjectMatchers.updateEditType(part, activeEditType); final int mapx = pos.x + part.getMultiX(); final int mapy = pos.y + part.getMultiY(); part.setMapX(mapx); part.setMapY(mapy); + gameObjectMatchers.updateEditType(part, activeEditType); insertionMode.insert(part, mapGrid[mapx][mapy]); } @@ -970,8 +969,8 @@ return; } - insertionMode.insert(gameObject, mapGrid[mapx][mapy]); gameObjectMatchers.updateEditType(gameObject, activeEditType); + insertionMode.insert(gameObject, mapGrid[mapx][mapy]); } /** @@ -1101,9 +1100,9 @@ addGameObjectToMap(newGameObject, insertionMode); for (G tmp = newGameObject.getMultiNext(); tmp != null; tmp = tmp.getMultiNext()) { - addGameObjectToMap(tmp, insertionMode); gameObjectFactory.postParseGameObject(tmp); gameObjectMatchers.updateEditType(tmp, activeEditType); + addGameObjectToMap(tmp, insertionMode); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-09 09:20:25
|
Revision: 7717 http://gridarta.svn.sourceforge.net/gridarta/?rev=7717&view=rev Author: akirschbaum Date: 2010-05-09 09:20:19 +0000 (Sun, 09 May 2010) Log Message: ----------- Implement "Add Env" when using the pickmap chooser. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-05-09 08:34:10 UTC (rev 7716) +++ trunk/atrinik/ChangeLog 2010-05-09 09:20:19 UTC (rev 7717) @@ -1,5 +1,7 @@ 2010-05-09 Andreas Kirschbaum + * Implement "Add Env" when using the pickmap chooser. + * Insert complete multi-part game objects in "Edd Env" when using the archetype chooser. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-05-09 08:34:10 UTC (rev 7716) +++ trunk/crossfire/ChangeLog 2010-05-09 09:20:19 UTC (rev 7717) @@ -1,5 +1,7 @@ 2010-05-09 Andreas Kirschbaum + * Implement "Add Env" when using the pickmap chooser. + * Insert complete multi-part game objects in "Edd Env" when using the archetype chooser. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-05-09 08:34:10 UTC (rev 7716) +++ trunk/daimonin/ChangeLog 2010-05-09 09:20:19 UTC (rev 7717) @@ -1,6 +1,8 @@ 2010-05-09 Andreas Kirschbaum - * Insert complete multi-part game objects in "Edd Env" when using + * Implement "Add Env" when using the pickmap chooser. + + * Insert complete multi-part game objects in "Add Env" when using the archetype chooser. 2010-05-08 Andreas Kirschbaum Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-09 08:34:10 UTC (rev 7716) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-09 09:20:19 UTC (rev 7717) @@ -870,21 +870,9 @@ if (nextGameObject == null || nextGameObjectEnv == null) { // put arch on the map - if (templateGameObject.isArchetype()) { - newGameObject = insertBaseObject(templateGameObject, pos, true, join, topmostInsertionMode); - if (newGameObject == null) { - return null; - } - } else { - // insert the given 'templateGameObject' (multis not allowed here yet - sorry) - if (templateGameObject.isMulti()) { - return null; // tried to insert multi (probably from pickmap) - } - - newGameObject = templateGameObject.newInstance(gameObjectFactory); - newGameObject.setMapX(pos.x); - newGameObject.setMapY(pos.y); - addGameObjectToMap(newGameObject, topmostInsertionMode); + newGameObject = insertBaseObject(templateGameObject, pos, true, join, topmostInsertionMode); + if (newGameObject == null) { + return null; } int position = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-09 08:34:17
|
Revision: 7716 http://gridarta.svn.sourceforge.net/gridarta/?rev=7716&view=rev Author: akirschbaum Date: 2010-05-09 08:34:10 +0000 (Sun, 09 May 2010) Log Message: ----------- Insert complete multi-part game objects in "Edd Env" when using the archetype chooser. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-05-08 22:58:20 UTC (rev 7715) +++ trunk/atrinik/ChangeLog 2010-05-09 08:34:10 UTC (rev 7716) @@ -1,3 +1,8 @@ +2010-05-09 Andreas Kirschbaum + + * Insert complete multi-part game objects in "Edd Env" when using + the archetype chooser. + 2010-05-08 Andreas Kirschbaum * CTRL-ALT-E now toggles the game object text editor: activate it Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-05-08 22:58:20 UTC (rev 7715) +++ trunk/crossfire/ChangeLog 2010-05-09 08:34:10 UTC (rev 7716) @@ -1,3 +1,8 @@ +2010-05-09 Andreas Kirschbaum + + * Insert complete multi-part game objects in "Edd Env" when using + the archetype chooser. + 2010-05-08 Andreas Kirschbaum * CTRL-ALT-E now toggles the game object text editor: activate it Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-05-08 22:58:20 UTC (rev 7715) +++ trunk/daimonin/ChangeLog 2010-05-09 08:34:10 UTC (rev 7716) @@ -1,3 +1,8 @@ +2010-05-09 Andreas Kirschbaum + + * Insert complete multi-part game objects in "Edd Env" when using + the archetype chooser. + 2010-05-08 Andreas Kirschbaum * CTRL-ALT-E now toggles the game object text editor: activate it Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-05-08 22:58:20 UTC (rev 7715) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-05-09 08:34:10 UTC (rev 7716) @@ -615,14 +615,12 @@ return; } - final BaseObject<G, A, R, ?> envnew = arch.newInstance(gameObjectFactory); - final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); assert mapSquare != null; final MapModel<G, A, R> mapModel = mapSquare.getMapModel(); mapModel.beginTransaction("Add to environment"); // TODO; I18N/L10N try { - final G insertedGameObject = mapModel.insertArchToMap(envnew, gameObject, new Point(mapSquare.getMapX(), mapSquare.getMapY()), true); + final G insertedGameObject = mapModel.insertArchToMap(arch, gameObject, new Point(mapSquare.getMapX(), mapSquare.getMapY()), true); if (insertedGameObject != null) { mapModel.removeGameObject(gameObject, true); gameObject.setMapX(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-08 22:58:27
|
Revision: 7715 http://gridarta.svn.sourceforge.net/gridarta/?rev=7715&view=rev Author: akirschbaum Date: 2010-05-08 22:58:20 +0000 (Sat, 08 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-08 22:22:05 UTC (rev 7714) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-08 22:58:20 UTC (rev 7715) @@ -871,7 +871,7 @@ // put arch on the map if (templateGameObject.isArchetype()) { - newGameObject = insertBaseObject(templateGameObject.getArchetype(), pos, true, join, topmostInsertionMode); + newGameObject = insertBaseObject(templateGameObject, pos, true, join, topmostInsertionMode); if (newGameObject == null) { return null; } @@ -879,12 +879,12 @@ // insert the given 'templateGameObject' (multis not allowed here yet - sorry) if (templateGameObject.isMulti()) { return null; // tried to insert multi (probably from pickmap) - } else { - newGameObject = templateGameObject.newInstance(gameObjectFactory); - newGameObject.setMapX(pos.x); - newGameObject.setMapY(pos.y); - addGameObjectToMap(newGameObject, topmostInsertionMode); } + + newGameObject = templateGameObject.newInstance(gameObjectFactory); + newGameObject.setMapX(pos.x); + newGameObject.setMapY(pos.y); + addGameObjectToMap(newGameObject, topmostInsertionMode); } int position = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-08 22:22:11
|
Revision: 7714 http://gridarta.svn.sourceforge.net/gridarta/?rev=7714&view=rev Author: akirschbaum Date: 2010-05-08 22:22:05 +0000 (Sat, 08 May 2010) Log Message: ----------- Remove MapModel.isMultiArchFittingToMap(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-08 22:18:41 UTC (rev 7713) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-08 22:22:05 UTC (rev 7714) @@ -798,10 +798,20 @@ } /** - * {@inheritDoc} + * Checks whether an GameObject (multi-arch) would still fit on this map. + * @param archetype the archetype to check + * @param pos position of multi-square head + * @param allowDouble whether overlapping multi-square arches should be + * allowed (check is done using the arch name) + * @return whether the multi-arch would still fit on this map + * @retval <code>true</code> if the multi-square arch would still fit on + * this map + * @retval <code>false</code> otherwise + * @todo discuss whether this method really belongs to the interface of + * MapModel as it is only used by MapModel implementations and heavily + * depends on how arches, especially multi-square arches are implemented. */ - @Override - public boolean isMultiArchFittingToMap(@NotNull final Archetype<G, A, R> archetype, @NotNull final Point pos, final boolean allowDouble) { + private boolean isMultiArchFittingToMap(@NotNull final Archetype<G, A, R> archetype, @NotNull final Point pos, final boolean allowDouble) { for (Archetype<G, A, R> part = archetype; part != null; part = part.getMultiNext()) { final Point point = new Point(part.getMultiX(), part.getMultiY()); point.translate(pos.x, pos.y); Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-08 22:18:41 UTC (rev 7713) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-08 22:22:05 UTC (rev 7714) @@ -320,22 +320,6 @@ G insertBaseObject(@NotNull BaseObject<G, A, R, ?> baseObject, @NotNull Point pos, boolean allowMany, boolean join, @NotNull InsertionMode<G, A, R> insertionMode); /** - * Checks whether an GameObject (multi-arch) would still fit on this map. - * @param archetype the archetype to check - * @param pos position of multi-square head - * @param allowDouble whether overlapping multi-square arches should be - * allowed (check is done using the arch name) - * @return whether the multi-arch would still fit on this map - * @retval <code>true</code> if the multi-square arch would still fit on - * this map - * @retval <code>false</code> otherwise - * @todo discuss whether this method really belongs to the interface of - * MapModel as it is only used by MapModel implementations and heavily - * depends on how arches, especially multi-square arches are implemented. - */ - boolean isMultiArchFittingToMap(@NotNull Archetype<G, A, R> archetype, @NotNull Point pos, boolean allowDouble); - - /** * Insert a new arch to the map at a specified position. This function * allows either to choose from the default arches (->archName) or to insert * a copy from an existing arch (->newObject). It also works for This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-08 22:18:47
|
Revision: 7713 http://gridarta.svn.sourceforge.net/gridarta/?rev=7713&view=rev Author: akirschbaum Date: 2010-05-08 22:18:41 +0000 (Sat, 08 May 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-08 22:13:09 UTC (rev 7712) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-08 22:18:41 UTC (rev 7713) @@ -396,35 +396,10 @@ mapSize = newSize; mapArchObject.setMapSize(newSize); - // discard changed squares that are now out of map bounds - final Iterator<MapSquare<G, A, R>> it = changedSquares.iterator(); - while (it.hasNext()) { - final MapSquare<G, A, R> mapSquare = it.next(); - if (mapSquare.getMapX() >= mapSize.getWidth() || mapSquare.getMapY() >= mapSize.getHeight()) { - it.remove(); - } - } + discardInvalidMapSquares(changedSquares); + discardInvalidGameObjects(changedGameObjects); + discardInvalidGameObjects(transientChangedGameObjects); - // discard changed game objects that are now out of map bounds - final Iterator<G> it2 = changedGameObjects.iterator(); - while (it2.hasNext()) { - final GameObject<G, A, R> gameObject = it2.next(); - final BaseObject<G, A, R, ?> topGameObject = gameObject.getTopContainer(); - if (topGameObject.getMapX() >= mapSize.getWidth() || topGameObject.getMapY() >= mapSize.getHeight()) { - it2.remove(); - } - } - - // discard changed game objects that are now out of map bounds - final Iterator<G> it3 = transientChangedGameObjects.iterator(); - while (it3.hasNext()) { - final GameObject<G, A, R> gameObject = it3.next(); - final BaseObject<G, A, R, ?> topGameObject = gameObject.getTopContainer(); - if (topGameObject.getMapX() >= mapSize.getWidth() || topGameObject.getMapY() >= mapSize.getHeight()) { - it3.remove(); - } - } - fireMapSizeChanged(newSize); } } @@ -448,6 +423,35 @@ } /** + * Discards map squares that are out of map bounds. + * @param mapSquares the map squares to check + */ + private void discardInvalidMapSquares(@NotNull final Collection<MapSquare<G, A, R>> mapSquares) { + final Iterator<MapSquare<G, A, R>> it = mapSquares.iterator(); + while (it.hasNext()) { + final MapSquare<G, A, R> mapSquare = it.next(); + if (mapSquare.getMapX() >= mapSize.getWidth() || mapSquare.getMapY() >= mapSize.getHeight()) { + it.remove(); + } + } + } + + /** + * Discards game objects that are out of map bounds. + * @param gameObjects the game objects to check + */ + private void discardInvalidGameObjects(@NotNull final Collection<G> gameObjects) { + final Iterator<G> it2 = gameObjects.iterator(); + while (it2.hasNext()) { + final GameObject<G, A, R> gameObject = it2.next(); + final BaseObject<G, A, R, ?> topGameObject = gameObject.getTopContainer(); + if (topGameObject.getMapX() >= mapSize.getWidth() || topGameObject.getMapY() >= mapSize.getHeight()) { + it2.remove(); + } + } + } + + /** * {@inheritDoc} */ @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-08 22:13:15
|
Revision: 7712 http://gridarta.svn.sourceforge.net/gridarta/?rev=7712&view=rev Author: akirschbaum Date: 2010-05-08 22:13:09 +0000 (Sat, 08 May 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-08 22:03:56 UTC (rev 7711) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-08 22:13:09 UTC (rev 7712) @@ -360,28 +360,14 @@ // reaching into that area) if (mapSize.getWidth() > newSize.getWidth()) { // clear out the right stripe (as far as being cut off) - for (int x = newSize.getWidth(); x < mapSize.getWidth(); x++) { - for (int y = 0; y < mapSize.getHeight(); y++) { - // for every map square: delete all arches on it - for (final GameObject<G, A, R> node : mapGrid[x][y]) { - objectsToDelete.add(node.getHead()); - } - } - } + collectHeads(newSize.getWidth(), 0, mapSize.getWidth(), mapSize.getHeight(), objectsToDelete); } if (mapSize.getHeight() > newSize.getHeight()) { // clear out the bottom stripe (as far as being cut off) // (and yes, there is an area getting sweeped twice - and yes it could // be optimized you smartass - but I don't care!) - for (int y = newSize.getHeight(); y < mapSize.getHeight(); y++) { - for (int x = 0; x < mapSize.getWidth(); x++) { - // for every map square: delete all arches on it - for (final GameObject<G, A, R> node : mapGrid[x][y]) { - objectsToDelete.add(node.getHead()); - } - } - } + collectHeads(0, newSize.getHeight(), mapSize.getWidth(), mapSize.getHeight(), objectsToDelete); } for (final GameObject<G, A, R> node : objectsToDelete) { @@ -444,6 +430,24 @@ } /** + * Adds all head parts for game object within an area to a collection. + * @param minX the x coordinate of the left border of the area + * @param minY the y coordinate of the top border of the area + * @param maxX the x coordinate of the right border of the area + * @param maxY the y coordinate of the bottom border of the area + * @param objectsToDelete the collection where the heads are added to + */ + private void collectHeads(final int minX, final int minY, final int maxX, final int maxY, @NotNull final Collection<GameObject<G, A, R>> objectsToDelete) { + for (int x = minX; x < maxX; x++) { + for (int y = minY; y < maxY; y++) { + for (final GameObject<G, A, R> node : mapGrid[x][y]) { + objectsToDelete.add(node.getHead()); + } + } + } + } + + /** * {@inheritDoc} */ @Override This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-08 22:04:03
|
Revision: 7711 http://gridarta.svn.sourceforge.net/gridarta/?rev=7711&view=rev Author: akirschbaum Date: 2010-05-08 22:03:56 +0000 (Sat, 08 May 2010) Log Message: ----------- Remove direction parameter from MapModel.insertBaseObject(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialogManager.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java Modified: trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java 2010-05-08 18:35:21 UTC (rev 7710) +++ trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java 2010-05-08 22:03:56 UTC (rev 7711) @@ -26,7 +26,6 @@ import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeSet; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.exitconnector.ExitConnectorModel; import net.sf.gridarta.model.exitconnector.ExitLocation; @@ -90,12 +89,6 @@ private final InsertionModeSet<G, A, R> insertionModeSet; /** - * The {@link ArchetypeChooserModel} to use. - */ - @NotNull - private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; - - /** * Creates a new instance. * @param exitConnectorModel the exit connector model to use * @param exitMatcher the exit matcher to use @@ -104,9 +97,8 @@ * @param fileControl the file control to use * @param pathManager the path manager for converting path names * @param insertionModeSet the insertion mode set to use - * @param archetypeChooserModel the archetype chooser model to use */ - public ExitConnectorActions(@NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ExitMatcher<G, A, R> exitMatcher, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R> mapManager, @NotNull final FileControl<G, A, R> fileControl, @NotNull final PathManager pathManager, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel) { + public ExitConnectorActions(@NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ExitMatcher<G, A, R> exitMatcher, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R> mapManager, @NotNull final FileControl<G, A, R> fileControl, @NotNull final PathManager pathManager, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { this.exitConnectorModel = exitConnectorModel; this.exitMatcher = exitMatcher; this.archetypeSet = archetypeSet; @@ -114,7 +106,6 @@ this.fileControl = fileControl; this.pathManager = pathManager; this.insertionModeSet = insertionModeSet; - this.archetypeChooserModel = archetypeChooserModel; } /** @@ -346,7 +337,7 @@ private boolean pasteExit(@NotNull final Point location, @NotNull final MapModel<G, A, R> mapModel, @NotNull final BaseObject<G, A, R, ?> archetype, @NotNull final ExitLocation exitLocation) { mapModel.beginTransaction("paste exit"); try { - final BaseObject<G, A, R, ?> newExit = mapModel.insertBaseObject(archetype, location, true, false, insertionModeSet.getTopmostInsertionMode(), archetypeChooserModel.getDirection()); + final BaseObject<G, A, R, ?> newExit = mapModel.insertBaseObject(archetype, location, true, false, insertionModeSet.getTopmostInsertionMode()); if (newExit == null) { return false; } Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java 2010-05-08 18:35:21 UTC (rev 7710) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java 2010-05-08 22:03:56 UTC (rev 7711) @@ -34,7 +34,6 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.utils.SwingUtils; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -120,28 +119,20 @@ private final InsertionModeSet<G, A, R> insertionModeSet; /** - * The {@link ArchetypeChooserModel} to use. - */ - @NotNull - private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; - - /** * Create a BasicAbstractTool. * @param selectedSquareView the selected square view * @param selectedSquareModel the selected square model * @param objectChooser the ObjectChooser to use * @param pickmapChooserControl the pickmap chooser control to use * @param insertionModeSet the insertion mode set to use - * @param archetypeChooserModel the archetype chooser model to use */ - public InsertionTool(@NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel) { + public InsertionTool(@NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { super("insertion"); this.selectedSquareView = selectedSquareView; this.selectedSquareModel = selectedSquareModel; this.objectChooser = objectChooser; this.pickmapChooserControl = pickmapChooserControl; this.insertionModeSet = insertionModeSet; - this.archetypeChooserModel = archetypeChooserModel; } /** @@ -241,7 +232,7 @@ throw new AssertionError(); } final BaseObject<G, A, R, ?> selectedArchetype = objectChooser.getSelection(); - insertedObject = selectedArchetype == null ? null : mapModel.insertBaseObject(selectedArchetype, p, isPressed || modeIndex == MODE_AUTO, true, insertionMode, archetypeChooserModel.getDirection()); + insertedObject = selectedArchetype == null ? null : mapModel.insertBaseObject(selectedArchetype, p, isPressed || modeIndex == MODE_AUTO, true, insertionMode); } selectedSquareView.setSelectedGameObject(insertedObject); } finally { Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2010-05-08 18:35:21 UTC (rev 7710) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2010-05-08 22:03:56 UTC (rev 7711) @@ -33,7 +33,6 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareModel; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.map.mapmodel.InsertionModeSet; @@ -87,13 +86,12 @@ * @param wallGameObjectMatcher the wall matcher to use * @param monsterGameObjectMatcher the monster matcher to use * @param insertionModeSet the insertion mode set to use - * @param archetypeChooserModel the archetype chooser model */ - public ToolPalette(@NotNull final MapViewSettings mapViewSettings, @NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl, @Nullable final GameObjectMatcher floorGameObjectMatcher, @Nullable final GameObjectMatcher wallGameObjectMatcher, @Nullable final GameObjectMatcher monsterGameObjectMatcher, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel) { + public ToolPalette(@NotNull final MapViewSettings mapViewSettings, @NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl, @Nullable final GameObjectMatcher floorGameObjectMatcher, @Nullable final GameObjectMatcher wallGameObjectMatcher, @Nullable final GameObjectMatcher monsterGameObjectMatcher, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { super(new BorderLayout()); - lmbSelector = new ToolSelector<G, A, R>("selection", mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher, insertionModeSet, archetypeChooserModel); - mmbSelector = new ToolSelector<G, A, R>("deletion", mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher, insertionModeSet, archetypeChooserModel); - rmbSelector = new ToolSelector<G, A, R>("insertion", mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher, insertionModeSet, archetypeChooserModel); + lmbSelector = new ToolSelector<G, A, R>("selection", mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher, insertionModeSet); + mmbSelector = new ToolSelector<G, A, R>("deletion", mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher, insertionModeSet); + rmbSelector = new ToolSelector<G, A, R>("insertion", mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher, insertionModeSet); add(new JLabel(ACTION_BUILDER.getString("mouse")), BorderLayout.NORTH); final Container mouseTabs = new JTabbedPane(); mouseTabs.add(ACTION_BUILDER.getString("left"), lmbSelector); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2010-05-08 18:35:21 UTC (rev 7710) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2010-05-08 22:03:56 UTC (rev 7711) @@ -40,7 +40,6 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareModel; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.map.mapmodel.InsertionModeSet; @@ -121,14 +120,13 @@ * @param wallGameObjectMatcher the wall matcher to use * @param monsterGameObjectMatcher the monster matcher to use * @param insertionModeSet the insertion mode set to use - * @param archetypeChooserModel the archetype chooser model to use */ - public ToolSelector(@NotNull final String defaultTool, @NotNull final MapViewSettings mapViewSettings, @NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl, @Nullable final GameObjectMatcher floorGameObjectMatcher, @Nullable final GameObjectMatcher wallGameObjectMatcher, @Nullable final GameObjectMatcher monsterGameObjectMatcher, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel) { + public ToolSelector(@NotNull final String defaultTool, @NotNull final MapViewSettings mapViewSettings, @NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl, @Nullable final GameObjectMatcher floorGameObjectMatcher, @Nullable final GameObjectMatcher wallGameObjectMatcher, @Nullable final GameObjectMatcher monsterGameObjectMatcher, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { createUI(); addTool(new VoidTool<G, A, R>(), defaultTool); addTool(new SelectionTool<G, A, R>(objectChooser, insertionModeSet), defaultTool); addTool(new DeletionTool<G, A, R>(mapViewSettings, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher), defaultTool); - addTool(new InsertionTool<G, A, R>(selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, insertionModeSet, archetypeChooserModel), defaultTool); + addTool(new InsertionTool<G, A, R>(selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, insertionModeSet), defaultTool); } /** Modified: trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2010-05-08 18:35:21 UTC (rev 7710) +++ trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2010-05-08 22:03:56 UTC (rev 7711) @@ -47,7 +47,6 @@ import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.objectchooser.ObjectChooserListener; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; @@ -117,12 +116,6 @@ private final InsertionModeSet<G, A, R> insertionModeSet; /** - * The {@link ArchetypeChooserModel} to use. - */ - @NotNull - private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; - - /** * The dialog instance. */ private final JDialog dialog; @@ -221,11 +214,9 @@ * @param faceObjectProviders the face object providers for looking up * faces * @param insertionModeSet the insertion mode set to use - * @param archetypeChooserModel the archetype chooser model to use */ - public ReplaceDialog(@NotNull final Component parent, @NotNull final MapModel<G, A, R> copyBufferMapModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel) { + public ReplaceDialog(@NotNull final Component parent, @NotNull final MapModel<G, A, R> copyBufferMapModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { this.insertionModeSet = insertionModeSet; - this.archetypeChooserModel = archetypeChooserModel; dialog = createDialog(parent, ACTION_BUILDER.getString("replaceTitle")); dialog.setModal(false); dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); @@ -486,7 +477,7 @@ // insert replacement object if (randomArch.isMulti()) { // multi's cannot be inserted properly, so we just put them ontop - mapModel.insertBaseObject(randomArch.getArchetype(), new Point(square.getMapX(), square.getMapY()), false, false, insertionModeSet.getTopmostInsertionMode(), archetypeChooserModel.getDirection()); + mapModel.insertBaseObject(randomArch.getArchetype(), new Point(square.getMapX(), square.getMapY()), false, false, insertionModeSet.getTopmostInsertionMode()); // TODO: if from pickmap it could have special attributes -> copy them } else { Modified: trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialogManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialogManager.java 2010-05-08 18:35:21 UTC (rev 7710) +++ trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialogManager.java 2010-05-08 22:03:56 UTC (rev 7711) @@ -25,7 +25,6 @@ import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -70,12 +69,6 @@ private final InsertionModeSet<G, A, R> insertionModeSet; /** - * The {@link ArchetypeChooserModel} to use. - */ - @NotNull - private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; - - /** * The map view manager listener to detect closed map views. */ private final MapViewManagerListener<G, A, R> mapViewManagerListener = new MapViewManagerListener<G, A, R>() { @@ -106,15 +99,13 @@ * @param faceObjectProviders the face object providers for looking up * faces * @param insertionModeSet the insertion mode set to use - * @param archetypeChooserModel the archetype chooser model to use */ - public ReplaceDialogManager(@NotNull final Component parent, @NotNull final MapModel<G, A, R> copyBufferMapModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel) { + public ReplaceDialogManager(@NotNull final Component parent, @NotNull final MapModel<G, A, R> copyBufferMapModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { this.parent = parent; this.copyBufferMapModel = copyBufferMapModel; this.objectChooser = objectChooser; this.faceObjectProviders = faceObjectProviders; this.insertionModeSet = insertionModeSet; - this.archetypeChooserModel = archetypeChooserModel; mapViewManager.addMapViewManagerListener(mapViewManagerListener); } @@ -130,7 +121,7 @@ @NotNull public ReplaceDialog<G, A, R> getInstance() { if (instance == null) { - instance = new ReplaceDialog<G, A, R>(parent, copyBufferMapModel, objectChooser, faceObjectProviders, insertionModeSet, archetypeChooserModel); + instance = new ReplaceDialog<G, A, R>(parent, copyBufferMapModel, objectChooser, faceObjectProviders, insertionModeSet); } return instance; } Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-08 18:35:21 UTC (rev 7710) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-08 22:03:56 UTC (rev 7711) @@ -426,7 +426,7 @@ final MapModel<G, A, R> copyBufferMapModel = mapControlFactory.newMapModel(mapArchObject); final InsertionModeSet<G, A, R> insertionModeSet = new InsertionModeSet<G, A, R>(topmostInsertionMode); final CopyBuffer<G, A, R> copyBuffer = new CopyBuffer<G, A, R>(mapViewSettings, copyBufferMapModel, gameObjectFactory, insertionModeSet); - final ReplaceDialogManager<G, A, R> replaceDialogManager = new ReplaceDialogManager<G, A, R>(mainViewFrame, copyBufferMapModel, objectChooser, mapViewManager, faceObjectProviders, insertionModeSet, archetypeChooserModel); + final ReplaceDialogManager<G, A, R> replaceDialogManager = new ReplaceDialogManager<G, A, R>(mainViewFrame, copyBufferMapModel, objectChooser, mapViewManager, faceObjectProviders, insertionModeSet); new About(mainViewFrame); exiter = new DefaultExiter(mainViewFrame); scriptEditControl = new ScriptEditControl(scriptFileFilter, scriptExtension, mainViewFrame, globalSettings.getMapsDirectory(), prefs, exiter); @@ -463,7 +463,7 @@ final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory = new PluginParameterViewFactory<G, A, R>(archetypeSet, gameObjectAttributesModel, objectChooser, defaultFilterList, mapManager, faceObjectProviders); final File scriptsFile = new File(globalSettings.getMapsDirectory(), scriptsDir); scriptControl = new ScriptController<G, A, R>(filterControl, scriptParameters, mainViewFrame, pluginParameterViewFactory, scriptsFile, scriptModel, pluginParameterFactory, scriptExecutor, systemIcons); - final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet, archetypeChooserModel); + final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet); new FindArchetypesDialogManager<G, A, R>(mainViewFrame, archetypeChooserControl, objectChooser, archetypeTypeSet); new UndoControl<G, A, R>(mapManager, gameObjectFactory, gameObjectMatchers); final UpdaterManager updaterManager = new UpdaterManager(exiter, mapManager, mainViewFrame, gridartaJarFilename); @@ -486,7 +486,7 @@ mainView.addTab(new Tab("tools", toolPalette, Location.LEFT, 2, false)); mainView.addTab(new Tab("objects", objectChooser, Location.LEFT, 3, true)); exitConnectorModel = new ExitConnectorModel(); // XXX: should be part of DefaultMainControl - final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, archetypeSet, mapManager, fileControl, pathManager, insertionModeSet, archetypeChooserModel); // XXX: should be part of DefaultMainControl + final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, archetypeSet, mapManager, fileControl, pathManager, insertionModeSet); // XXX: should be part of DefaultMainControl new ExitConnectorController<G, A, R>(exitConnectorActions, exitConnectorModel, mapViewManager); final JMenu windowMenu = MenuUtils.getMenu(menuBar, "window"); if (windowMenu == null) { Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-08 18:35:21 UTC (rev 7710) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-08 22:03:56 UTC (rev 7711) @@ -853,7 +853,7 @@ // put arch on the map if (templateGameObject.isArchetype()) { - newGameObject = insertBaseObject(templateGameObject.getArchetype(), pos, true, join, topmostInsertionMode, archetypeChooserModel.getDirection()); + newGameObject = insertBaseObject(templateGameObject.getArchetype(), pos, true, join, topmostInsertionMode); if (newGameObject == null) { return null; } @@ -897,7 +897,7 @@ */ @Nullable @Override - public G insertBaseObject(@NotNull final BaseObject<G, A, R, ?> baseObject, @NotNull final Point pos, final boolean allowMany, final boolean join, @NotNull final InsertionMode<G, A, R> insertionMode, @Nullable final Integer direction) { + public G insertBaseObject(@NotNull final BaseObject<G, A, R, ?> baseObject, @NotNull final Point pos, final boolean allowMany, final boolean join, @NotNull final InsertionMode<G, A, R> insertionMode) { if (!isPointValid(pos)) { return null; } @@ -925,6 +925,7 @@ } final G part = baseObjectPart.newInstance(gameObjectFactory); part.setArchetype(archetypePart); + final Object direction = archetypeChooserModel.getDirection(); if (direction != null) { part.setAttributeString("direction", direction.toString()); } @@ -1080,7 +1081,7 @@ @Override public void addCopyToMap(@NotNull final BaseObject<G, A, R, ?> gameObject, @NotNull final Point pos, final boolean allowDouble, @NotNull final InsertionMode<G, A, R> insertionMode) { if (gameObject.isArchetype()) { - insertBaseObject(gameObject.getArchetype(), pos, allowDouble, false, insertionMode, archetypeChooserModel.getDirection()); + insertBaseObject(gameObject.getArchetype(), pos, allowDouble, false, insertionMode); } else { final G newGameObject = gameObject.newInstance(gameObjectFactory); newGameObject.setMapX(pos.x); Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-08 18:35:21 UTC (rev 7710) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-08 22:03:56 UTC (rev 7711) @@ -305,19 +305,19 @@ /** * Inserts a {@link BaseObject} to a map. Archetypes are instantiated, game - * objects are cloned. + * objects are cloned. The direction of the inserted game object is set to + * the direction of the archetype chooser. * @param baseObject the base object * @param pos the insert-location on this map * @param allowMany whether duplicates are allowed * @param join if set, auto-joining is supported; autojoining is only done * if enabled in the main control * @param insertionMode the insertion mode to use - * @param direction the game object's direction; <code>null</code>=default * @return the inserted game object or <code>null</code> if nothing was * inserted */ @Nullable - G insertBaseObject(@NotNull BaseObject<G, A, R, ?> baseObject, @NotNull Point pos, boolean allowMany, boolean join, @NotNull InsertionMode<G, A, R> insertionMode, @Nullable Integer direction); + G insertBaseObject(@NotNull BaseObject<G, A, R, ?> baseObject, @NotNull Point pos, boolean allowMany, boolean join, @NotNull InsertionMode<G, A, R> insertionMode); /** * Checks whether an GameObject (multi-arch) would still fit on this map. Modified: trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2010-05-08 18:35:21 UTC (rev 7710) +++ trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2010-05-08 22:03:56 UTC (rev 7711) @@ -158,11 +158,6 @@ private GlobalSettings globalSettings; /** - * The {@link ArchetypeChooserModel} instance. - */ - private ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel; - - /** * The "topmost" {@link InsertionMode} instance. */ private InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode; @@ -400,7 +395,7 @@ final MapWriter<TestGameObject, TestMapArchObject, TestArchetype> mapWriter = new TestMapWriter(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); - archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); + final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); pathManager = new PathManager(globalSettings); final ScriptArchData<TestGameObject, TestMapArchObject, TestArchetype> scriptArchData = new TestScriptArchData(); final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(scriptArchData, faceObjectProviders, animationObjects); @@ -428,7 +423,7 @@ * @return the new exit connector actions instance */ private ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype> createActions(@NotNull final ExitConnectorModel model) { - return new ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype>(model, exitMatcher, archetypeSet, mapManager, new TestFileControl(), pathManager, insertionModeSet, archetypeChooserModel); + return new ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype>(model, exitMatcher, archetypeSet, mapManager, new TestFileControl(), pathManager, insertionModeSet); } /** @@ -473,7 +468,7 @@ private void insertArchetype(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final Point point, @NotNull final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, ?> archetype) { mapModel.beginTransaction("test"); try { - mapModel.insertBaseObject(archetype, point, true, false, topmostInsertionMode, archetypeChooserModel.getDirection()); + mapModel.insertBaseObject(archetype, point, true, false, topmostInsertionMode); } finally { mapModel.endTransaction(); } Modified: trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-05-08 18:35:21 UTC (rev 7710) +++ trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-05-08 22:03:56 UTC (rev 7711) @@ -161,12 +161,6 @@ private SystemIcons systemIcons = null; /** - * The {@link ArchetypeChooserModel} instance. - */ - @Nullable - private ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel; - - /** * The {@link AnimationObjects} instance. */ @Nullable @@ -372,9 +366,7 @@ mapModel.beginTransaction("TEST"); mapModel.resizeMap(new Size2D(1, 2)); - assert archetypeChooserModel != null; - final Integer direction = archetypeChooserModel.getDirection(); - final TestGameObject gameObject = mapModel.insertBaseObject(archetype, new Point(0, 0), true, false, insertionModeSet.getAutoInsertionMode(), direction); + final TestGameObject gameObject = mapModel.insertBaseObject(archetype, new Point(0, 0), true, false, insertionModeSet.getAutoInsertionMode()); mapModel.endTransaction(); final List<TestGameObject> gameObjects = mapModel.getAllGameObjects(); @@ -482,7 +474,7 @@ guiUtils.addToCache(iconName, imageIcon); } final TestMapArchObject mapArchObject = new TestMapArchObject(); - archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); + final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final MapViewSettings mapViewSettings = new MapViewSettings(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |