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-14 22:29:43
|
Revision: 7760 http://gridarta.svn.sourceforge.net/gridarta/?rev=7760&view=rev Author: akirschbaum Date: 2010-05-14 22:29:37 +0000 (Fri, 14 May 2010) Log Message: ----------- Do not report spurious changes in Paths & Resources tab in settings dialog. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/prefs/ResPrefs.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-05-14 21:58:57 UTC (rev 7759) +++ trunk/atrinik/ChangeLog 2010-05-14 22:29:37 UTC (rev 7760) @@ -1,3 +1,8 @@ +2010-05-15 Andreas Kirschbaum + + * Do not report spurious changes in Paths & Resources tab in + settings dialog. + 2010-05-14 Andreas Kirschbaum * Implement #2385930 (Alert when adding items in to a shop): add Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-05-14 21:58:57 UTC (rev 7759) +++ trunk/daimonin/ChangeLog 2010-05-14 22:29:37 UTC (rev 7760) @@ -1,3 +1,8 @@ +2010-05-15 Andreas Kirschbaum + + * Do not report spurious changes in Paths & Resources tab in + settings dialog. + 2010-05-14 Andreas Kirschbaum * Implement #2385930 (Alert when adding items in to a shop): add Modified: trunk/src/app/net/sf/gridarta/gui/prefs/ResPrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/ResPrefs.java 2010-05-14 21:58:57 UTC (rev 7759) +++ trunk/src/app/net/sf/gridarta/gui/prefs/ResPrefs.java 2010-05-14 22:29:37 UTC (rev 7760) @@ -287,7 +287,7 @@ */ @NotNull private static String convertImageSet(@Nullable final String imageSet) { - return imageSet == null || imageSet.equals("none") ? "disabled" : imageSet; + return imageSet == null || imageSet.isEmpty() || imageSet.equals("none") ? "disabled" : imageSet; } } // class ResPrefs This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-14 21:59:05
|
Revision: 7759 http://gridarta.svn.sourceforge.net/gridarta/?rev=7759&view=rev Author: akirschbaum Date: 2010-05-14 21:58:57 +0000 (Fri, 14 May 2010) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2010-05-14 20:36:22 UTC (rev 7758) +++ trunk/src/app/net/sf/gridarta/messages.properties 2010-05-14 21:58:57 UTC (rev 7759) @@ -1113,7 +1113,7 @@ Validator.PaidItemShopSquare.default=true Validator.PaidItemShopSquare.title=Shop square contains paid item -Validator.PaidItemShopSquare.msg=<html><h3>{0}</h3><p>On this square there is a shop square while contains a paid item. Usually items on shop squares should be unpaid by default. +Validator.PaidItemShopSquare.msg=<html><h3>{0}</h3><p>On this square there is a shop square which contains a paid item. Usually items on shop squares should be unpaid by default. Validator.ShopSquare.default=true Validator.ShopSquare.title=Shop square allows magic and/or prayers Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-14 20:36:22 UTC (rev 7758) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-14 21:58:57 UTC (rev 7759) @@ -303,7 +303,7 @@ deletePickmapFolderNotEmpty.message=Die Pickmap-Gruppe ''{0}'' besitzt Untergruppen.\nBitte l\xF6schen Sie diese zuerst. openAttrDialogNoTypes.title=Datei fehlt -openAttrDialogNoTypes.message=Die Konfigurationsdatei \"types.xml\" fehlt. Der Dialog zum \xC4ndern von Object-Attributen funktioniert nicht ohne diese Datei. +openAttrDialogNoTypes.message=Die Konfigurationsdatei \"types.xml\" fehlt. Der Dialog zum \xC4ndern von Objekt-Attributen funktioniert nicht ohne diese Datei. openAttrDialogNoDefaultArch.title=Attribute \xE4ndern openAttrDialogNoDefaultArch.message=Attribute von Objekten ohne Archetype k\xF6nnen nicht ge\xE4ndert werden. @@ -910,7 +910,7 @@ Validator.BlockedMobOrSpawnPoint.msg=<html><h3>{0}</h3><p>Auf diesem Feld ist ein Mob,<br>aber dieses Feld ist auch durch ein anderes Objekt, das nicht passiert werden kann, blockiert.</p><p>Sie k\xF6nnen:</p><ul><li>Das Mob entfernen</li><li>Das <code>no_pass</code>-Flag des blockierenden Objekts auf <code>0</code> setzen</li><li>Das blockierende Objekt entfernen</li></ul> Validator.BlockedSpawnPoint.title=Blockierter Spawn Point -Validator.BlockedSpawnPoint.msg=<html><h3>{0}</h3><p>Dieser Spawn Point is blockiert, da alle Zielfelder das Attribut "no_pass" gesetzt haben.<br>Daher kann dieser Spawn Point niemals Objekte erzeugen.</p><p>Sie k\xF6nnen:</p><ul><li>Den Spawn Point l\xF6schen</li><li>Das Attribut <code>no_pass</code> von angrenzenden Objekten auf <code>0</code> setzen</li><li>Ein blockierendes Objekt l\xF6schen</li></ul> +Validator.BlockedSpawnPoint.msg=<html><h3>{0}</h3><p>Dieser Spawn Point ist blockiert, da alle Zielfelder das Attribut "no_pass" gesetzt haben.<br>Daher kann dieser Spawn Point niemals Objekte erzeugen.</p><p>Sie k\xF6nnen:</p><ul><li>Den Spawn Point l\xF6schen</li><li>Das Attribut <code>no_pass</code> von angrenzenden Objekten auf <code>0</code> setzen</li><li>Ein blockierendes Objekt l\xF6schen</li></ul> Validator.BlockedSquare.title=Unzug\xE4ngliches Feld Validator.BlockedSquare.msg=<html><h3>{0}</h3><p>Dieses Feld ist unzug\xE4nglich. Das Feld und alle umliegenden Felder sind <code>no_pass 1</code> und <code>blocksview 1</code>.</p><p>Normalerweise sind solche Felder nicht sinnvoll und ihr Inhalt sollte gel\xF6scht werden.</p> @@ -957,7 +957,7 @@ Validator.PaidItemShopSquare.msg=<html><h3>{0}</h3><p>Dieses Feld ist eine Gesch\xE4ftsfl\xE4che und enth\xE4lt einen bereits bezahlten Gegenstand. In der Regel sollten diese Gegenst\xE4nde unbezahlt sein. Validator.ShopSquare.title=Gesch\xE4ftsfl\xE4che erlaubt Magie -Validator.ShopSquare.msg=<html><h3>{0}</h3><p>Dieses Feld is eine Gesch\xE4ftsfl\xE4che und erlaubt Magic.</p> +Validator.ShopSquare.msg=<html><h3>{0}</h3><p>Dieses Feld ist eine Gesch\xE4ftsfl\xE4che und erlaubt Magic.</p> Validator.Slaying.title=Ung\xFCltige Zeichen f\xFCr "slaying" Validator.Slaying.msg=<html><h3>{0}</h3><p>Dieses Feld enth\xE4lt ein Objekt mit einem Attribut "slaying", das ung\xFCltige Zeichen enth\xE4lt.</p><p>Erlaubte Zeichen sind:<br><code>a-z A-Z 0-9 / . _</code></p><p>Sie k\xF6nnen:</p><ul><li>Das Attribut \xE4ndern</li></ul> @@ -1102,11 +1102,11 @@ moveSquareDown.text= moveSquareDown.shortdescription=Objekt nach unten verschieben moveSquareBottom.text= -moveSquareBottom.shortdescription=Object ans Ende verschieben +moveSquareBottom.shortdescription=Objekt ans Ende verschieben moveSquareInv.text= -moveSquareInv.shortdescription=Object in Inventory verschieben +moveSquareInv.shortdescription=Objekt in Inventory verschieben moveSquareEnv.text= -moveSquareEnv.shortdescription=Object in Umgebung verschieben +moveSquareEnv.shortdescription=Objekt in Umgebung verschieben ############### This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-14 20:36:28
|
Revision: 7758 http://gridarta.svn.sourceforge.net/gridarta/?rev=7758&view=rev Author: akirschbaum Date: 2010-05-14 20:36:22 +0000 (Fri, 14 May 2010) Log Message: ----------- Fix German translations. Modified Paths: -------------- trunk/crossfire/resource/conf/GameObjectMatchers.xml Modified: trunk/crossfire/resource/conf/GameObjectMatchers.xml =================================================================== --- trunk/crossfire/resource/conf/GameObjectMatchers.xml 2010-05-14 18:59:03 UTC (rev 7757) +++ trunk/crossfire/resource/conf/GameObjectMatchers.xml 2010-05-14 20:36:22 UTC (rev 7758) @@ -217,7 +217,7 @@ matching this matcher are connection sources. --> <GameObjectMatcher id="system_connection_source" system="true"> <title xml:lang="en">Connected objects being a source</title> - <title xml:lang="en">Verbundene Objekte (Quellen)</title> + <title xml:lang="de">Verbundene Objekte (Quellen)</title> <TypeNrs numbers="17 18 27 29 30 31 32 51 64 92 93 155" /> </GameObjectMatcher> @@ -225,7 +225,7 @@ matching this matcher are connection sinks. --> <GameObjectMatcher id="system_connection_sink" system="true"> <title xml:lang="en">Connected objects being a sink</title> - <title xml:lang="en">Verbundene Objekte (Senken)</title> + <title xml:lang="de">Verbundene Objekte (Senken)</title> <Or> <TypeNrs numbers="26 41 42 52 62 65 83 91 94 98 112" /> </Or> @@ -237,7 +237,7 @@ into <Or>. --> <GameObjectMatcher id="system_connection_sink2" system="true"> <title xml:lang="en">Connected objects being a sink</title> - <title xml:lang="en">Verbundene Objekte (Senken)</title> + <title xml:lang="de">Verbundene Objekte (Senken)</title> <Env/> <And> <TypeNrs numbers="116" /> @@ -249,7 +249,7 @@ objects matching this matcher are paid items. --> <GameObjectMatcher id="system_paid_item" system="true"> <title xml:lang="en">Paid items</title> - <title xml:lang="en">Bezahlte Gegenstände</title> + <title xml:lang="de">Bezahlte Gegenstände</title> <And> <Attrib name="no_pick" value="" /> <Attrib name="unpaid" value="" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-14 18:59:10
|
Revision: 7757 http://gridarta.svn.sourceforge.net/gridarta/?rev=7757&view=rev Author: akirschbaum Date: 2010-05-14 18:59:03 +0000 (Fri, 14 May 2010) Log Message: ----------- Remove outdated todo comment. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java Modified: trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java 2010-05-14 18:58:31 UTC (rev 7756) +++ trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java 2010-05-14 18:59:03 UTC (rev 7757) @@ -35,7 +35,6 @@ /** * Validator that checks whether all tile paths are valid. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @xxx contains some casting hacks that need to be removed. */ public class TilePathsChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractValidator implements MapValidator<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-14 18:58:37
|
Revision: 7756 http://gridarta.svn.sourceforge.net/gridarta/?rev=7756&view=rev Author: akirschbaum Date: 2010-05-14 18:58:31 +0000 (Fri, 14 May 2010) Log Message: ----------- Fix possible NullPointerException. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java Modified: trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java 2010-05-14 18:55:10 UTC (rev 7755) +++ trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java 2010-05-14 18:58:31 UTC (rev 7756) @@ -30,6 +30,7 @@ import net.sf.gridarta.validation.AbstractValidator; import net.sf.gridarta.validation.MapValidator; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Validator that checks whether all tile paths are valid. @@ -64,18 +65,20 @@ */ @Override public void validate(@NotNull final MapModel<G, A, R> mapModel, @NotNull final ErrorCollector<G, A, R> errorCollector) { + final File mapFile = mapModel.getMapFile(); + final String mapDir = mapFile == null ? null : mapFile.getParent(); for (int direction = 0; direction < tilePaths; direction++) { final String path = mapModel.getMapArchObject().getTilePath(direction); if (path.length() > 0) { - final File newFile; + @Nullable final File newFile; if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { // we have an absolute path: newFile = new File(globalSettings.getMapsDirectory().getAbsolutePath(), path.substring(1)); } else { // we have a relative path: - newFile = new File(mapModel.getMapFile().getParent(), path); + newFile = mapDir == null ? null : new File(mapDir, path); } - if (!newFile.exists() || newFile.isDirectory()) { + if (newFile != null && (!newFile.exists() || newFile.isDirectory())) { errorCollector.collect(new TilePathsError<G, A, R>(mapModel, path)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-14 18:55:16
|
Revision: 7755 http://gridarta.svn.sourceforge.net/gridarta/?rev=7755&view=rev Author: akirschbaum Date: 2010-05-14 18:55:10 +0000 (Fri, 14 May 2010) Log Message: ----------- Rename variable name. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java Modified: trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java 2010-05-14 18:47:14 UTC (rev 7754) +++ trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java 2010-05-14 18:55:10 UTC (rev 7755) @@ -67,15 +67,15 @@ for (int direction = 0; direction < tilePaths; direction++) { final String path = mapModel.getMapArchObject().getTilePath(direction); if (path.length() > 0) { - final File newfile; + final File newFile; if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { // we have an absolute path: - newfile = new File(globalSettings.getMapsDirectory().getAbsolutePath(), path.substring(1)); + newFile = new File(globalSettings.getMapsDirectory().getAbsolutePath(), path.substring(1)); } else { // we have a relative path: - newfile = new File(mapModel.getMapFile().getParent(), path); + newFile = new File(mapModel.getMapFile().getParent(), path); } - if (!newfile.exists() || newfile.isDirectory()) { + if (!newFile.exists() || newFile.isDirectory()) { errorCollector.collect(new TilePathsError<G, A, R>(mapModel, path)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-14 18:47:21
|
Revision: 7754 http://gridarta.svn.sourceforge.net/gridarta/?rev=7754&view=rev Author: akirschbaum Date: 2010-05-14 18:47:14 +0000 (Fri, 14 May 2010) Log Message: ----------- Implement #2385930 (Alert when adding items in to a shop). Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/crossfire/resource/conf/GameObjectMatchers.xml trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java trunk/src/doc/ref/GameObjectMatcher.xhtml Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/map/validation/errors/PaidItemShopSquareError.java trunk/src/app/net/sf/gridarta/validation/checks/PaidItemShopSquareChecker.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-05-14 17:56:25 UTC (rev 7753) +++ trunk/atrinik/ChangeLog 2010-05-14 18:47:14 UTC (rev 7754) @@ -1,3 +1,9 @@ +2010-05-14 Andreas Kirschbaum + + * Implement #2385930 (Alert when adding items in to a shop): add + new map validator "Shop square contains paid item" that checks for + shop sqaures that contain at least one paid item. + 2010-05-13 Andreas Kirschbaum * Fix missing "Analyze" menu entries. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-05-14 17:56:25 UTC (rev 7753) +++ trunk/crossfire/ChangeLog 2010-05-14 18:47:14 UTC (rev 7754) @@ -1,3 +1,9 @@ +2010-05-14 Andreas Kirschbaum + + * Implement #2385930 (Alert when adding items in to a shop): add + new map validator "Shop square contains paid item" that checks for + shop sqaures that contain at least one paid item. + 2010-05-13 Andreas Kirschbaum * Fix error message about missing cfpython_menu.def file. Modified: trunk/crossfire/resource/conf/GameObjectMatchers.xml =================================================================== --- trunk/crossfire/resource/conf/GameObjectMatchers.xml 2010-05-14 17:56:25 UTC (rev 7753) +++ trunk/crossfire/resource/conf/GameObjectMatchers.xml 2010-05-14 18:47:14 UTC (rev 7754) @@ -245,4 +245,17 @@ </And> </GameObjectMatcher> + <!-- Objects checked by the "Shop square contains paid item" map validator: + objects matching this matcher are paid items. --> + <GameObjectMatcher id="system_paid_item" system="true"> + <title xml:lang="en">Paid items</title> + <title xml:lang="en">Bezahlte Gegenstände</title> + <And> + <Attrib name="no_pick" value="" /> + <Attrib name="unpaid" value="" /> + <Attrib name="monster" value="" /> + <Attrib name="generator" value="" /> + </And> + </GameObjectMatcher> + </GameObjectMatchers> Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-05-14 17:56:25 UTC (rev 7753) +++ trunk/daimonin/ChangeLog 2010-05-14 18:47:14 UTC (rev 7754) @@ -1,3 +1,9 @@ +2010-05-14 Andreas Kirschbaum + + * Implement #2385930 (Alert when adding items in to a shop): add + new map validator "Shop square contains paid item" that checks for + shop sqaures that contain at least one paid item. + 2010-05-13 Andreas Kirschbaum * Fix missing "Analyze" menu entries. Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-05-14 17:56:25 UTC (rev 7753) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-05-14 18:47:14 UTC (rev 7754) @@ -100,6 +100,7 @@ import net.sf.gridarta.validation.DelegatingMapValidator; import net.sf.gridarta.validation.checks.AttributeRangeChecker; import net.sf.gridarta.validation.checks.ConnectionChecker; +import net.sf.gridarta.validation.checks.PaidItemShopSquareChecker; import net.sf.gridarta.validation.checks.ShopSquareChecker; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -205,6 +206,11 @@ if (noSpellsMatcher != null) { validators.addValidator(new ShopSquareChecker<G, A, R>(shopSquareMatcher, noSpellsMatcher)); } + + final GameObjectMatcher paidItemMatcher = gameObjectMatchers.getMatcher("system_paid_item"); + if (paidItemMatcher != null) { + validators.addValidator(new PaidItemShopSquareChecker<G, A, R>(shopSquareMatcher, paidItemMatcher)); + } } Map<String, TreasureTreeNode> specialTreasureLists; try { Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2010-05-14 17:56:25 UTC (rev 7753) +++ trunk/src/app/net/sf/gridarta/messages.properties 2010-05-14 18:47:14 UTC (rev 7754) @@ -946,6 +946,7 @@ prefs.Validator.Exit=Whether this map validator check is is enabled. prefs.Validator.MapDifficulty=Whether this map validator check is is enabled. prefs.Validator.MobOutsideSpawnPoint=Whether this map validator check is is enabled. +prefs.Validator.PaidItemShopSquare=Whether this map validator check is is enabled. prefs.Validator.ShopSquare=Whether this map validator check is is enabled. prefs.Validator.Slaying=Whether this map validator check is is enabled. prefs.Validator.SquareWithoutFloor=Whether this map validator check is is enabled. @@ -1110,6 +1111,10 @@ Validator.MobOutsideSpawnPoint.title=Mob outside spawn point Validator.MobOutsideSpawnPoint.msg=<html><h3>{0}</h3><p>On this square there is a mob outside a spawn point.<br>Mobs outside spawn points are okay, but you should perhaps still put the mob inside a spawn point.</p><p>You could:</p><ul><li>Ignore this</li><li>Create a spawn point for this mob</li></ul> +Validator.PaidItemShopSquare.default=true +Validator.PaidItemShopSquare.title=Shop square contains paid item +Validator.PaidItemShopSquare.msg=<html><h3>{0}</h3><p>On this square there is a shop square while contains a paid item. Usually items on shop squares should be unpaid by default. + Validator.ShopSquare.default=true Validator.ShopSquare.title=Shop square allows magic and/or prayers Validator.ShopSquare.msg=<html><h3>{0}</h3><p>On this square there is a shop square which allows magic and/or prayers.</p> Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-14 17:56:25 UTC (rev 7753) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-14 18:47:14 UTC (rev 7754) @@ -953,6 +953,9 @@ Validator.MobOutsideSpawnPoint.title=Mob au\xDFerhalb Spawn Point Validator.MobOutsideSpawnPoint.msg=<html><h3>{0}</h3><p>Dieses Feld beinhaltete einen Mob au\xDFerhalb eines Spawn Points.<br>Dies ist erlaubt, aber Sie sollten den Mobs trotzdem in einen Spawn Point einf\xFCgen.</p><p>Sie k\xF6nnen:</p><ul><li>Dieses Problem ignorieren</li><li>Einen Spawn Point f\xFCr diesen Mob erzeugen</li></ul> +Validator.PaidItemShopSquare.title=Gesch\xE4ftsfl\xE4che mit bezahltem Gegenstand +Validator.PaidItemShopSquare.msg=<html><h3>{0}</h3><p>Dieses Feld ist eine Gesch\xE4ftsfl\xE4che und enth\xE4lt einen bereits bezahlten Gegenstand. In der Regel sollten diese Gegenst\xE4nde unbezahlt sein. + Validator.ShopSquare.title=Gesch\xE4ftsfl\xE4che erlaubt Magie Validator.ShopSquare.msg=<html><h3>{0}</h3><p>Dieses Feld is eine Gesch\xE4ftsfl\xE4che und erlaubt Magic.</p> Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-05-14 17:56:25 UTC (rev 7753) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-05-14 18:47:14 UTC (rev 7754) @@ -946,6 +946,9 @@ #Validator.MobOutsideSpawnPoint.title= #Validator.MobOutsideSpawnPoint.msg= +#Validator.PaidItemShopSquare.title= +#Validator.PaidItemShopSquare.msg= + #Validator.ShopSquare.title= #Validator.ShopSquare.msg= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-05-14 17:56:25 UTC (rev 7753) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-05-14 18:47:14 UTC (rev 7754) @@ -950,6 +950,9 @@ #Validator.MapDifficulty.title= #Validator.MapDifficulty.msg= +#Validator.PaidItemShopSquare.title= +#Validator.PaidItemShopSquare.msg= + #Validator.ShopSquare.title= #Validator.ShopSquare.msg= Added: trunk/src/app/net/sf/gridarta/model/map/validation/errors/PaidItemShopSquareError.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/validation/errors/PaidItemShopSquareError.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/map/validation/errors/PaidItemShopSquareError.java 2010-05-14 18:47:14 UTC (rev 7754) @@ -0,0 +1,47 @@ +/* + * 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.validation.errors; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapmodel.MapSquare; +import org.jetbrains.annotations.NotNull; + +/** + * A map square that is a shop tile and contains paid items. + * @author Andreas Kirschbaum + */ +public class PaidItemShopSquareError<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends SquareValidationError<G, A, R> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance. + * @param mapSquare the square on which the error occurred + */ + public PaidItemShopSquareError(@NotNull final MapSquare<G, A, R> mapSquare) { + super(mapSquare); + } + +} // class PaidItemShopSquareError Property changes on: trunk/src/app/net/sf/gridarta/model/map/validation/errors/PaidItemShopSquareError.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java 2010-05-14 17:56:25 UTC (rev 7753) +++ trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java 2010-05-14 18:47:14 UTC (rev 7754) @@ -24,8 +24,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.validation.ErrorCollector; -import net.sf.gridarta.model.map.validation.errors.ShopSquareError; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.utils.Size2D; import net.sf.gridarta.validation.AbstractValidator; @@ -41,53 +39,13 @@ public abstract class AbstractShopSquareChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractValidator implements MapValidator<G, A, R> { /** - * The {@link GameObjectMatcher} for finding shop squares. - */ - @NotNull - private final GameObjectMatcher shopMatcher; - - /** - * The {@link GameObjectMatcher} for finding no-spell squares. - */ - @NotNull - private final GameObjectMatcher noSpellsMatcher; - - /** - * Creates a new instance. - * @param shopMatcher the game object matcher for finding shop squares - * @param noSpellsMatcher the game object matcher for finding no-spell - * squares - */ - protected AbstractShopSquareChecker(@NotNull final GameObjectMatcher shopMatcher, @NotNull final GameObjectMatcher noSpellsMatcher) { - this.shopMatcher = shopMatcher; - this.noSpellsMatcher = noSpellsMatcher; - } - - /** - * {@inheritDoc} - */ - @Override - public void validate(@NotNull final MapModel<G, A, R> mapModel, @NotNull final ErrorCollector<G, A, R> errorCollector) { - final boolean[][] shopSquares = findMatchingSquares(mapModel, shopMatcher); - final boolean[][] noSpellsSquares = findMatchingSquares(mapModel, noSpellsMatcher); - final Point point = new Point(); - for (point.x = 0; point.x < shopSquares.length && point.x < noSpellsSquares.length; point.x++) { - for (point.y = 0; point.y < shopSquares[point.x].length && point.y < noSpellsSquares[point.x].length; point.y++) { - if (shopSquares[point.x][point.y] && !noSpellsSquares[point.x][point.y]) { - errorCollector.collect(new ShopSquareError<G, A, R>(mapModel.getMapSquare(point))); - } - } - } - } - - /** * Returns a <code>boolean</code> array of the map size that marks squares * that contain game objects matching a given {@link GameObjectMatcher}. * @param mapModel the map to check * @param matcher the matcher to use * @return the array */ - private boolean[][] findMatchingSquares(@NotNull final MapModel<G, A, R> mapModel, @NotNull final GameObjectMatcher matcher) { + protected boolean[][] findMatchingSquares(@NotNull final MapModel<G, A, R> mapModel, @NotNull final GameObjectMatcher matcher) { final Size2D mapSize = mapModel.getMapSize(); final int mapWidth = mapSize.getWidth(); final int mapHeight = mapSize.getHeight(); Added: trunk/src/app/net/sf/gridarta/validation/checks/PaidItemShopSquareChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/PaidItemShopSquareChecker.java (rev 0) +++ trunk/src/app/net/sf/gridarta/validation/checks/PaidItemShopSquareChecker.java 2010-05-14 18:47:14 UTC (rev 7754) @@ -0,0 +1,78 @@ +/* + * 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.validation.checks; + +import java.awt.Point; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapmodel.MapModel; +import net.sf.gridarta.model.map.validation.ErrorCollector; +import net.sf.gridarta.model.map.validation.errors.PaidItemShopSquareError; +import net.sf.gridarta.model.match.GameObjectMatcher; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link net.sf.gridarta.validation.MapValidator} to detect shop squares + * that contain paid items. + * @author Andreas Kirschbaum + */ +public class PaidItemShopSquareChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractShopSquareChecker<G, A, R> { + + /** + * The {@link GameObjectMatcher} for finding shop squares. + */ + @NotNull + private final GameObjectMatcher shopMatcher; + + /** + * The {@link GameObjectMatcher} for finding paid items. + */ + @NotNull + private final GameObjectMatcher paidItemMatcher; + + /** + * Creates a new instance. + * @param shopMatcher the game object matcher for finding shop squares + * @param paidItemMatcher the game object matcher for finding paid items + */ + public PaidItemShopSquareChecker(@NotNull final GameObjectMatcher shopMatcher, @NotNull final GameObjectMatcher paidItemMatcher) { + this.shopMatcher = shopMatcher; + this.paidItemMatcher = paidItemMatcher; + } + + /** + * {@inheritDoc} + */ + @Override + public void validate(@NotNull final MapModel<G, A, R> mapModel, @NotNull final ErrorCollector<G, A, R> errorCollector) { + final boolean[][] shopSquares = findMatchingSquares(mapModel, shopMatcher); + final boolean[][] noSpellsSquares = findMatchingSquares(mapModel, paidItemMatcher); + final Point point = new Point(); + for (point.x = 0; point.x < shopSquares.length && point.x < noSpellsSquares.length; point.x++) { + for (point.y = 0; point.y < shopSquares[point.x].length && point.y < noSpellsSquares[point.x].length; point.y++) { + if (shopSquares[point.x][point.y] && noSpellsSquares[point.x][point.y]) { + errorCollector.collect(new PaidItemShopSquareError<G, A, R>(mapModel.getMapSquare(point))); + } + } + } + } + +} // class PaidItemShopSquareChecker Property changes on: trunk/src/app/net/sf/gridarta/validation/checks/PaidItemShopSquareChecker.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java 2010-05-14 17:56:25 UTC (rev 7753) +++ trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java 2010-05-14 18:47:14 UTC (rev 7754) @@ -19,9 +19,13 @@ package net.sf.gridarta.validation.checks; +import java.awt.Point; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapmodel.MapModel; +import net.sf.gridarta.model.map.validation.ErrorCollector; +import net.sf.gridarta.model.map.validation.errors.ShopSquareError; import net.sf.gridarta.model.match.GameObjectMatcher; import org.jetbrains.annotations.NotNull; @@ -34,12 +38,42 @@ public class ShopSquareChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractShopSquareChecker<G, A, R> { /** + * The {@link GameObjectMatcher} for finding shop squares. + */ + @NotNull + private final GameObjectMatcher shopMatcher; + + /** + * The {@link GameObjectMatcher} for finding no-spell squares. + */ + @NotNull + private final GameObjectMatcher noSpellsMatcher; + + /** * Creates a new instance. * @param shopMatcher the game object matcher for finding shop squares * @param noSpellsMatcher the game object matcher for finding no-spell squares */ public ShopSquareChecker(@NotNull final GameObjectMatcher shopMatcher, @NotNull final GameObjectMatcher noSpellsMatcher) { - super(shopMatcher, noSpellsMatcher); + this.shopMatcher = shopMatcher; + this.noSpellsMatcher = noSpellsMatcher; } + /** + * {@inheritDoc} + */ + @Override + public void validate(@NotNull final MapModel<G, A, R> mapModel, @NotNull final ErrorCollector<G, A, R> errorCollector) { + final boolean[][] shopSquares = findMatchingSquares(mapModel, shopMatcher); + final boolean[][] noSpellsSquares = findMatchingSquares(mapModel, noSpellsMatcher); + final Point point = new Point(); + for (point.x = 0; point.x < shopSquares.length && point.x < noSpellsSquares.length; point.x++) { + for (point.y = 0; point.y < shopSquares[point.x].length && point.y < noSpellsSquares[point.x].length; point.y++) { + if (shopSquares[point.x][point.y] && !noSpellsSquares[point.x][point.y]) { + errorCollector.collect(new ShopSquareError<G, A, R>(mapModel.getMapSquare(point))); + } + } + } + } + } // class ShopSquareChecker Modified: trunk/src/doc/ref/GameObjectMatcher.xhtml =================================================================== --- trunk/src/doc/ref/GameObjectMatcher.xhtml 2010-05-14 17:56:25 UTC (rev 7753) +++ trunk/src/doc/ref/GameObjectMatcher.xhtml 2010-05-14 18:47:14 UTC (rev 7754) @@ -53,6 +53,12 @@ 'system_no_spells' (or fallback 'no_spells'). Not checked if either matcher is not defined. </li> + <li>Checks for shop tiles that contain paid items. Shop + tiles are selected by matcher 'system_shop_tile' (or + fallback 'shop_tile'); paid items are selected by + matcher 'system_paid_item'. Not checked if either + matcher is not defined. + </li> <li>Checks for connected objects without sources or sinks. Sources are selected by matcher 'system_connection_source'; sinks are selected by This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-14 17:56:31
|
Revision: 7753 http://gridarta.svn.sourceforge.net/gridarta/?rev=7753&view=rev Author: akirschbaum Date: 2010-05-14 17:56:25 +0000 (Fri, 14 May 2010) Log Message: ----------- Simplify code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java Modified: trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java 2010-05-14 17:16:11 UTC (rev 7752) +++ trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java 2010-05-14 17:56:25 UTC (rev 7753) @@ -71,13 +71,10 @@ final boolean[][] shopSquares = findMatchingSquares(mapModel, shopMatcher); final boolean[][] noSpellsSquares = findMatchingSquares(mapModel, noSpellsMatcher); final Point point = new Point(); - final Point tmp = new Point(); - for (point.x = 1; point.x < shopSquares.length - 1 && point.x < noSpellsSquares.length - 1; point.x++) { - for (point.y = 1; point.y < shopSquares[point.x].length - 1 && point.y < noSpellsSquares[point.x].length - 1; point.y++) { + for (point.x = 0; point.x < shopSquares.length && point.x < noSpellsSquares.length; point.x++) { + for (point.y = 0; point.y < shopSquares[point.x].length && point.y < noSpellsSquares[point.x].length; point.y++) { if (shopSquares[point.x][point.y] && !noSpellsSquares[point.x][point.y]) { - tmp.x = point.x - 1; - tmp.y = point.y - 1; - errorCollector.collect(new ShopSquareError<G, A, R>(mapModel.getMapSquare(tmp))); + errorCollector.collect(new ShopSquareError<G, A, R>(mapModel.getMapSquare(point))); } } } @@ -94,11 +91,11 @@ final Size2D mapSize = mapModel.getMapSize(); final int mapWidth = mapSize.getWidth(); final int mapHeight = mapSize.getHeight(); - final boolean[][] matchingSquares = new boolean[mapWidth + 2][mapHeight + 2]; + final boolean[][] matchingSquares = new boolean[mapWidth][mapHeight]; final Point point = new Point(); for (point.x = 0; point.x < mapWidth; point.x++) { for (point.y = 0; point.y < mapHeight; point.y++) { - matchingSquares[point.x + 1][point.y + 1] = isMatching(mapModel.getMapSquare(point), matcher); + matchingSquares[point.x][point.y] = isMatching(mapModel.getMapSquare(point), matcher); } } return matchingSquares; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-14 17:16:18
|
Revision: 7752 http://gridarta.svn.sourceforge.net/gridarta/?rev=7752&view=rev Author: akirschbaum Date: 2010-05-14 17:16:11 +0000 (Fri, 14 May 2010) Log Message: ----------- Extract AbstractShopSquareChecker from ShopSquareChecker. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/validation/AbstractValidator.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java Modified: trunk/src/app/net/sf/gridarta/validation/AbstractValidator.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/AbstractValidator.java 2010-05-14 17:01:25 UTC (rev 7751) +++ trunk/src/app/net/sf/gridarta/validation/AbstractValidator.java 2010-05-14 17:16:11 UTC (rev 7752) @@ -35,6 +35,12 @@ public abstract class AbstractValidator implements Validator { /** + * The prefix for preference keys. + */ + @NotNull + private static final String VALIDATOR_PREFIX = "Validator."; + + /** * Action Builder. */ @NotNull @@ -73,7 +79,7 @@ if (!name.endsWith("Checker")) { throw new IllegalArgumentException("Class name must end with \"Checker\""); } - key = "Validator." + name.substring(0, name.indexOf("Checker")); + key = VALIDATOR_PREFIX + name.substring(0, name.indexOf("Checker")); final String defaultEnabledString = ACTION_BUILDER.getString(key + ".default"); defaultEnabled = Boolean.parseBoolean(defaultEnabledString); enabled = prefs.getBoolean(key, defaultEnabled); Copied: trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java (from rev 7739, trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java) =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java (rev 0) +++ trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java 2010-05-14 17:16:11 UTC (rev 7752) @@ -0,0 +1,123 @@ +/* + * 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.validation.checks; + +import java.awt.Point; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapmodel.MapModel; +import net.sf.gridarta.model.map.validation.ErrorCollector; +import net.sf.gridarta.model.map.validation.errors.ShopSquareError; +import net.sf.gridarta.model.match.GameObjectMatcher; +import net.sf.gridarta.utils.Size2D; +import net.sf.gridarta.validation.AbstractValidator; +import net.sf.gridarta.validation.MapValidator; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link MapValidator} to detect shop squares which allow magic or prayers, + * or which have adjacent squares that allow magic or prayers. + * @author Andreas Kirschbaum + * @fixme this implementation does not take care of multi square objects. + */ +public abstract class AbstractShopSquareChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractValidator implements MapValidator<G, A, R> { + + /** + * The {@link GameObjectMatcher} for finding shop squares. + */ + @NotNull + private final GameObjectMatcher shopMatcher; + + /** + * The {@link GameObjectMatcher} for finding no-spell squares. + */ + @NotNull + private final GameObjectMatcher noSpellsMatcher; + + /** + * Creates a new instance. + * @param shopMatcher the game object matcher for finding shop squares + * @param noSpellsMatcher the game object matcher for finding no-spell + * squares + */ + protected AbstractShopSquareChecker(@NotNull final GameObjectMatcher shopMatcher, @NotNull final GameObjectMatcher noSpellsMatcher) { + this.shopMatcher = shopMatcher; + this.noSpellsMatcher = noSpellsMatcher; + } + + /** + * {@inheritDoc} + */ + @Override + public void validate(@NotNull final MapModel<G, A, R> mapModel, @NotNull final ErrorCollector<G, A, R> errorCollector) { + final boolean[][] shopSquares = findMatchingSquares(mapModel, shopMatcher); + final boolean[][] noSpellsSquares = findMatchingSquares(mapModel, noSpellsMatcher); + final Point point = new Point(); + final Point tmp = new Point(); + for (point.x = 1; point.x < shopSquares.length - 1 && point.x < noSpellsSquares.length - 1; point.x++) { + for (point.y = 1; point.y < shopSquares[point.x].length - 1 && point.y < noSpellsSquares[point.x].length - 1; point.y++) { + if (shopSquares[point.x][point.y] && !noSpellsSquares[point.x][point.y]) { + tmp.x = point.x - 1; + tmp.y = point.y - 1; + errorCollector.collect(new ShopSquareError<G, A, R>(mapModel.getMapSquare(tmp))); + } + } + } + } + + /** + * Returns a <code>boolean</code> array of the map size that marks squares + * that contain game objects matching a given {@link GameObjectMatcher}. + * @param mapModel the map to check + * @param matcher the matcher to use + * @return the array + */ + private boolean[][] findMatchingSquares(@NotNull final MapModel<G, A, R> mapModel, @NotNull final GameObjectMatcher matcher) { + final Size2D mapSize = mapModel.getMapSize(); + final int mapWidth = mapSize.getWidth(); + final int mapHeight = mapSize.getHeight(); + final boolean[][] matchingSquares = new boolean[mapWidth + 2][mapHeight + 2]; + final Point point = new Point(); + for (point.x = 0; point.x < mapWidth; point.x++) { + for (point.y = 0; point.y < mapHeight; point.y++) { + matchingSquares[point.x + 1][point.y + 1] = isMatching(mapModel.getMapSquare(point), matcher); + } + } + return matchingSquares; + } + + /** + * Returns whether a map square contains a game object matching a given + * {@link GameObjectMatcher}. + * @param mapSquare the map square to check + * @param matcher the matcher to use + * @return whether a matching game object was found + */ + private boolean isMatching(@NotNull final Iterable<G> mapSquare, @NotNull final GameObjectMatcher matcher) { + for (final GameObject<G, A, R> gameObject : mapSquare) { + if (matcher.isMatching(gameObject)) { + return true; + } + } + return false; + } + +} // class AbstractShopSquareChecker Property changes on: trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Deleted: trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java 2010-05-14 17:01:25 UTC (rev 7751) +++ trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java 2010-05-14 17:16:11 UTC (rev 7752) @@ -1,123 +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.validation.checks; - -import java.awt.Point; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.validation.ErrorCollector; -import net.sf.gridarta.model.map.validation.errors.ShopSquareError; -import net.sf.gridarta.model.match.GameObjectMatcher; -import net.sf.gridarta.utils.Size2D; -import net.sf.gridarta.validation.AbstractValidator; -import net.sf.gridarta.validation.MapValidator; -import org.jetbrains.annotations.NotNull; - -/** - * A {@link MapValidator} to detect shop squares which allow magic or prayers, - * or which have adjacent squares that allow magic or prayers. - * @author Andreas Kirschbaum - * @fixme this implementation does not take care of multi square objects. - */ -public class ShopSquareChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractValidator implements MapValidator<G, A, R> { - - /** - * The {@link GameObjectMatcher} for finding shop squares. - */ - @NotNull - private final GameObjectMatcher shopMatcher; - - /** - * The {@link GameObjectMatcher} for finding no-spell squares. - */ - @NotNull - private final GameObjectMatcher noSpellsMatcher; - - /** - * Creates a new instance. - * @param shopMatcher the game object matcher for finding shop squares - * @param noSpellsMatcher the game object matcher for finding no-spell - * squares - */ - public ShopSquareChecker(@NotNull final GameObjectMatcher shopMatcher, @NotNull final GameObjectMatcher noSpellsMatcher) { - this.shopMatcher = shopMatcher; - this.noSpellsMatcher = noSpellsMatcher; - } - - /** - * {@inheritDoc} - */ - @Override - public void validate(@NotNull final MapModel<G, A, R> mapModel, @NotNull final ErrorCollector<G, A, R> errorCollector) { - final boolean[][] shopSquares = findMatchingSquares(mapModel, shopMatcher); - final boolean[][] noSpellsSquares = findMatchingSquares(mapModel, noSpellsMatcher); - final Point point = new Point(); - final Point tmp = new Point(); - for (point.x = 1; point.x < shopSquares.length - 1 && point.x < noSpellsSquares.length - 1; point.x++) { - for (point.y = 1; point.y < shopSquares[point.x].length - 1 && point.y < noSpellsSquares[point.x].length - 1; point.y++) { - if (shopSquares[point.x][point.y] && !noSpellsSquares[point.x][point.y]) { - tmp.x = point.x - 1; - tmp.y = point.y - 1; - errorCollector.collect(new ShopSquareError<G, A, R>(mapModel.getMapSquare(tmp))); - } - } - } - } - - /** - * Returns a <code>boolean</code> array of the map size that marks squares - * that contain game objects matching a given {@link GameObjectMatcher}. - * @param mapModel the map to check - * @param matcher the matcher to use - * @return the array - */ - private boolean[][] findMatchingSquares(@NotNull final MapModel<G, A, R> mapModel, @NotNull final GameObjectMatcher matcher) { - final Size2D mapSize = mapModel.getMapSize(); - final int mapWidth = mapSize.getWidth(); - final int mapHeight = mapSize.getHeight(); - final boolean[][] matchingSquares = new boolean[mapWidth + 2][mapHeight + 2]; - final Point point = new Point(); - for (point.x = 0; point.x < mapWidth; point.x++) { - for (point.y = 0; point.y < mapHeight; point.y++) { - matchingSquares[point.x + 1][point.y + 1] = isMatching(mapModel.getMapSquare(point), matcher); - } - } - return matchingSquares; - } - - /** - * Returns whether a map square contains a game object matching a given - * {@link GameObjectMatcher}. - * @param mapSquare the map square to check - * @param matcher the matcher to use - * @return whether a matching game object was found - */ - private boolean isMatching(@NotNull final Iterable<G> mapSquare, @NotNull final GameObjectMatcher matcher) { - for (final GameObject<G, A, R> gameObject : mapSquare) { - if (matcher.isMatching(gameObject)) { - return true; - } - } - return false; - } - -} // class ShopSquareChecker Added: trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java (rev 0) +++ trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java 2010-05-14 17:16:11 UTC (rev 7752) @@ -0,0 +1,45 @@ +/* + * 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.validation.checks; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.match.GameObjectMatcher; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link net.sf.gridarta.validation.MapValidator} to detect shop squares + * which allow magic or prayers, or which have adjacent squares that allow + * magic or prayers. + * @author Andreas Kirschbaum + */ +public class ShopSquareChecker<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractShopSquareChecker<G, A, R> { + + /** + * Creates a new instance. + * @param shopMatcher the game object matcher for finding shop squares + * @param noSpellsMatcher the game object matcher for finding no-spell squares + */ + public ShopSquareChecker(@NotNull final GameObjectMatcher shopMatcher, @NotNull final GameObjectMatcher noSpellsMatcher) { + super(shopMatcher, noSpellsMatcher); + } + +} // class ShopSquareChecker Property changes on: trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.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-14 17:01:31
|
Revision: 7751 http://gridarta.svn.sourceforge.net/gridarta/?rev=7751&view=rev Author: akirschbaum Date: 2010-05-14 17:01:25 +0000 (Fri, 14 May 2010) Log Message: ----------- Fully initialize TilePanel instances in constructor. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-14 16:51:16 UTC (rev 7750) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-14 17:01:25 UTC (rev 7751) @@ -563,10 +563,7 @@ relativeReference = new File(globalSettings.getMapsDirectory(), "dummy"); } final JLabel cLabel = new JLabel(archetypeAttribute.getAttributeName() + ": "); - final TilePanel tilePanel = new TilePanel(mapFileFilter); - tilePanel.setAbsoluteReference(globalSettings.getMapsDirectory()); - tilePanel.setOriginal(gameObject.getAttributeString(archetypeAttribute.getArchetypeAttributeName())); - tilePanel.setRelativeReference(relativeReference); + final TilePanel tilePanel = new TilePanel(mapFileFilter, gameObject.getAttributeString(archetypeAttribute.getArchetypeAttributeName()), relativeReference, globalSettings.getMapsDirectory()); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeMapPath<G, A, R>>(new DialogAttribMapPath<G, A, R>(archetypeAttribute, tilePanel), cLabel, tilePanel, null, null, false); } @@ -574,10 +571,8 @@ @Override public void visit(@NotNull final ArchetypeAttributeScriptFile<G, A, R> archetypeAttribute) { final JLabel cLabel = new JLabel(archetypeAttribute.getAttributeName() + ": "); - final TilePanel tilePanel = new TilePanel(scriptFileFilter); - tilePanel.setAbsoluteReference(globalSettings.getMapsDirectory()); - tilePanel.setOriginal(gameObject.getAttributeString(archetypeAttribute.getArchetypeAttributeName())); - tilePanel.setRelativeReference(new File(globalSettings.getMapsDirectory(), "dummy")); + final File mapsDirectory = globalSettings.getMapsDirectory(); + final TilePanel tilePanel = new TilePanel(scriptFileFilter, gameObject.getAttributeString(archetypeAttribute.getArchetypeAttributeName()), new File(mapsDirectory, "dummy"), mapsDirectory); guiInfo = new GuiInfo<G, A, R, ArchetypeAttributeScriptFile<G, A, R>>(new DialogAttribScriptFile<G, A, R>(archetypeAttribute, tilePanel), cLabel, tilePanel, null, null, false); } 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-14 16:51:16 UTC (rev 7750) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-14 17:01:25 UTC (rev 7751) @@ -190,10 +190,7 @@ for (int index = 0; index < tilePanels.length; index++) { final File mapDir = globalSettings.getMapsDirectory(); final File mapFile = mapModel.getMapFile(); - final TilePanel tilePanel = new TilePanel(mapFileFilter); - tilePanel.setAbsoluteReference(mapDir); - tilePanel.setOriginal(mapArchObject.getTilePath(index)); - tilePanel.setRelativeReference(mapFile); + final TilePanel tilePanel = new TilePanel(mapFileFilter, mapArchObject.getTilePath(index), mapFile, mapDir); tilePanels[index] = new MapTilePanel(index, nextFocus, tilePanel, tileLinks[index].getName()); } return tilePanels; Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2010-05-14 16:51:16 UTC (rev 7750) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2010-05-14 17:01:25 UTC (rev 7751) @@ -99,10 +99,32 @@ /** * Create a TilePanel. * @param fileFilter the file filter to use + * @param original the original value, used as initial value and for + * restoring it + * @param relativeReference file to reference for relative paths (context + * file or directory, not parent directory) + * @param absoluteReference file to reference for absolute paths (context + * file or directory, not parent directory) */ - public TilePanel(@NotNull final FileFilter fileFilter) { + public TilePanel(@NotNull final FileFilter fileFilter, @NotNull final String original, @Nullable final File relativeReference, @NotNull final File absoluteReference) { super(new GridBagLayout()); this.fileFilter = fileFilter; + this.original = original; + //noinspection ProhibitedExceptionCaught + try { + this.relativeReference = relativeReference.getCanonicalFile(); + } catch (final IOException ignored) { + this.relativeReference = relativeReference.getAbsoluteFile(); + } catch (final NullPointerException ignored) { + // occurs on unsaved maps where this method is invoked with null argument + this.relativeReference = null; + } + try { + this.absoluteReference = absoluteReference.getCanonicalFile(); + } catch (final IOException ignored) { + this.absoluteReference = absoluteReference.getAbsoluteFile(); + } + final GridBagConstraints gbc = new GridBagConstraints(); textField = new JTextField(); textField.setColumns(16); @@ -118,49 +140,12 @@ raSwitch = new RASwitch(); add(raSwitch, gbc); add(iconButton(ACTION_BUILDER.createAction(false, "mapTileChoose", this)), gbc); - } - /** - * Set the original value, which is used as initial value and for restoring - * it. This method also invokes {@link #setText(String,boolean)}. - * @param original original value, used as initial value and for restoring - * it. - */ - public void setOriginal(@NotNull final String original) { - this.original = original; - mapTileRevert(); + textField.setText(original); + raSwitch.updateRAState(); } /** - * Set the context reference for relative paths. - * @param relativeReference file to reference for relative paths (context - * file or directory, not parent directory) - */ - public void setRelativeReference(@Nullable final File relativeReference) { - //noinspection ProhibitedExceptionCaught - try { - this.relativeReference = relativeReference.getCanonicalFile(); - } catch (final IOException ignored) { - this.relativeReference = relativeReference.getAbsoluteFile(); - } catch (final NullPointerException ignored) { - // occurs on unsaved maps where this method is invoked with null argument - } - } - - /** - * Set the context reference for absolute paths. - * @param absoluteReference file to reference for absolute paths (context - * file or directory, not parent directory) - */ - public void setAbsoluteReference(@NotNull final File absoluteReference) { - try { - this.absoluteReference = absoluteReference.getCanonicalFile(); - } catch (final IOException ignored) { - this.absoluteReference = absoluteReference.getAbsoluteFile(); - } - } - - /** * Create a new JButton for reverting a path entry. * @param action the action for the button * @return JButton for key This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-14 16:51:22
|
Revision: 7750 http://gridarta.svn.sourceforge.net/gridarta/?rev=7750&view=rev Author: akirschbaum Date: 2010-05-14 16:51:16 +0000 (Fri, 14 May 2010) Log Message: ----------- Move code. 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-14 16:45:12 UTC (rev 7749) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-14 16:51:16 UTC (rev 7750) @@ -143,16 +143,8 @@ tileLinks = new TileLink[] { newTileLink("mapNorth", tileLink[0], CommonConstants.SOUTH), newTileLink("mapEast", tileLink[1], CommonConstants.WEST), newTileLink("mapSouth", tileLink[2], CommonConstants.NORTH), newTileLink("mapWest", tileLink[3], CommonConstants.EAST), newTileLink("mapNorthEast", tileLink[4], CommonConstants.SOUTH_WEST), newTileLink("mapSouthEast", tileLink[5], CommonConstants.NORTH_WEST), newTileLink("mapSouthWest", tileLink[6], CommonConstants.NORTH_EAST), newTileLink("mapNorthWest", tileLink[7], CommonConstants.SOUTH_EAST), }; attachTiledMaps = new AttachTiledMaps<G, A, R>(mapManager, tileLinks, mapPathNormalizer); 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(); - final File mapFile = mapModel.getMapFile(); - for (int i = 0; i < tilePaths.length; i++) { - final TilePanel tilePanel = tilePaths[i].getTilePanel(); - tilePanel.setAbsoluteReference(mapDir); - tilePanel.setOriginal(mapArchObject.getTilePath(i)); - tilePanel.setRelativeReference(mapFile); - } + tilePaths = buildComponents(directionMapping); } /** @@ -196,7 +188,13 @@ private MapTilePanel[] createTilePanels(final int directions) { final MapTilePanel[] tilePanels = new MapTilePanel[directions]; for (int index = 0; index < tilePanels.length; index++) { - tilePanels[index] = new MapTilePanel(index, nextFocus, new TilePanel(mapFileFilter), tileLinks[index].getName()); + final File mapDir = globalSettings.getMapsDirectory(); + final File mapFile = mapModel.getMapFile(); + final TilePanel tilePanel = new TilePanel(mapFileFilter); + tilePanel.setAbsoluteReference(mapDir); + tilePanel.setOriginal(mapArchObject.getTilePath(index)); + tilePanel.setRelativeReference(mapFile); + tilePanels[index] = new MapTilePanel(index, nextFocus, tilePanel, tileLinks[index].getName()); } return tilePanels; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-14 16:45:19
|
Revision: 7749 http://gridarta.svn.sourceforge.net/gridarta/?rev=7749&view=rev Author: akirschbaum Date: 2010-05-14 16:45:12 +0000 (Fri, 14 May 2010) Log Message: ----------- Move TilePanel creation out of MapTilePanel's constructor. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.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-14 16:41:20 UTC (rev 7748) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-14 16:45:12 UTC (rev 7749) @@ -196,7 +196,7 @@ private MapTilePanel[] createTilePanels(final int directions) { final MapTilePanel[] tilePanels = new MapTilePanel[directions]; for (int index = 0; index < tilePanels.length; index++) { - tilePanels[index] = new MapTilePanel(index, nextFocus, mapFileFilter, tileLinks[index].getName()); + tilePanels[index] = new MapTilePanel(index, nextFocus, new TilePanel(mapFileFilter), tileLinks[index].getName()); } return tilePanels; } Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2010-05-14 16:41:20 UTC (rev 7748) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2010-05-14 16:45:12 UTC (rev 7749) @@ -22,7 +22,6 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import javax.swing.border.TitledBorder; -import javax.swing.filechooser.FileFilter; import org.jetbrains.annotations.NotNull; /** @@ -42,11 +41,10 @@ * @param direction Index, used to determine the direction and corresponding * locale keys * @param nextFocus Indices of next focus. - * @param fileFilter The file filter to use. + * @param tilePanel the tile panel to show */ - MapTilePanel(final int direction, @NotNull final int[] nextFocus, @NotNull final FileFilter fileFilter, @NotNull final String name) { - tilePanel = new TilePanel(fileFilter); - + MapTilePanel(final int direction, @NotNull final int[] nextFocus, @NotNull final TilePanel tilePanel, @NotNull final String name) { + this.tilePanel = tilePanel; final TitledBorder border = new TitledBorder(name); border.setTitleJustification(TitledBorder.CENTER); tilePanel.setBorder(border); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-14 16:41:26
|
Revision: 7748 http://gridarta.svn.sourceforge.net/gridarta/?rev=7748&view=rev Author: akirschbaum Date: 2010-05-14 16:41:20 +0000 (Fri, 14 May 2010) Log Message: ----------- Remove MapTilePanel.getDirection(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.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-14 00:08:47 UTC (rev 7747) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-14 16:41:20 UTC (rev 7748) @@ -181,22 +181,22 @@ gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.BOTH; - final MapTilePanel[] tilePanels = createTilePanels(directionMapping); - add(buildTilePanels(tilePanels), gbc); + final MapTilePanel[] tilePanels = createTilePanels(directionMapping.length); + add(buildTilePanels(tilePanels, directionMapping), gbc); add(buildSubPanel(), gbc); return tilePanels; } /** * Builds all {@link MapTilePanel MapTilePanels} for all directions. - * @param directionMapping the directions + * @param directions the number of directions * @return the tile panels */ @NotNull - private MapTilePanel[] createTilePanels(@NotNull final DirectionLayout.Direction[] directionMapping) { - final MapTilePanel[] tilePanels = new MapTilePanel[directionMapping.length]; + private MapTilePanel[] createTilePanels(final int directions) { + final MapTilePanel[] tilePanels = new MapTilePanel[directions]; for (int index = 0; index < tilePanels.length; index++) { - tilePanels[index] = new MapTilePanel(index, nextFocus, mapFileFilter, tileLinks[index].getName(), directionMapping[index]); + tilePanels[index] = new MapTilePanel(index, nextFocus, mapFileFilter, tileLinks[index].getName()); } return tilePanels; } @@ -204,14 +204,15 @@ /** * Builds the tile panel. * @param tilePanels the tile panels + * @param directionMapping the directions * @return the newly built tile panel */ @NotNull - private static Component buildTilePanels(@NotNull final MapTilePanel[] tilePanels) { + private static Component buildTilePanels(@NotNull final MapTilePanel[] tilePanels, @NotNull final DirectionLayout.Direction[] directionMapping) { final JComponent panel = new JPanel(new DirectionLayout()); panel.setBorder(new CompoundBorder(BorderFactory.createTitledBorder(ACTION_BUILDER.getString("mapTiles")), GUIConstants.DIALOG_BORDER)); - for (final MapTilePanel tilePanel : tilePanels) { - panel.add(tilePanel.getTilePanel(), tilePanel.getDirection()); + for (int index = 0; index < tilePanels.length; index++) { + panel.add(tilePanels[index].getTilePanel(), directionMapping[index]); } return panel; } Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2010-05-14 00:08:47 UTC (rev 7747) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2010-05-14 16:41:20 UTC (rev 7748) @@ -23,7 +23,6 @@ import java.awt.event.ActionListener; import javax.swing.border.TitledBorder; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.gui.utils.DirectionLayout; import org.jetbrains.annotations.NotNull; /** @@ -36,9 +35,6 @@ public class MapTilePanel { @NotNull - private final DirectionLayout.Direction direction2; - - @NotNull private final TilePanel tilePanel; /** @@ -48,8 +44,7 @@ * @param nextFocus Indices of next focus. * @param fileFilter The file filter to use. */ - MapTilePanel(final int direction, @NotNull final int[] nextFocus, @NotNull final FileFilter fileFilter, @NotNull final String name, @NotNull final DirectionLayout.Direction direction2) { - this.direction2 = direction2; + MapTilePanel(final int direction, @NotNull final int[] nextFocus, @NotNull final FileFilter fileFilter, @NotNull final String name) { tilePanel = new TilePanel(fileFilter); final TitledBorder border = new TitledBorder(name); @@ -73,11 +68,6 @@ } @NotNull - public DirectionLayout.Direction getDirection() { - return direction2; - } - - @NotNull public TilePanel getTilePanel() { return tilePanel; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-14 00:08:53
|
Revision: 7747 http://gridarta.svn.sourceforge.net/gridarta/?rev=7747&view=rev Author: akirschbaum Date: 2010-05-14 00:08:47 +0000 (Fri, 14 May 2010) Log Message: ----------- Do not export ActionListener interface from MapTilePanel. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2010-05-14 00:02:43 UTC (rev 7746) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2010-05-14 00:08:47 UTC (rev 7747) @@ -33,25 +33,9 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public class MapTilePanel implements ActionListener { +public class MapTilePanel { - /** - * Serial Version UID. - */ - private static final long serialVersionUID = 1L; - - /** - * Indices of next focus. - */ @NotNull - private final int[] nextFocus; - - /** - * The direction. - */ - private final int direction; - - @NotNull private final DirectionLayout.Direction direction2; @NotNull @@ -65,8 +49,6 @@ * @param fileFilter The file filter to use. */ MapTilePanel(final int direction, @NotNull final int[] nextFocus, @NotNull final FileFilter fileFilter, @NotNull final String name, @NotNull final DirectionLayout.Direction direction2) { - this.nextFocus = nextFocus; - this.direction = direction; this.direction2 = direction2; tilePanel = new TilePanel(fileFilter); @@ -74,17 +56,20 @@ border.setTitleJustification(TitledBorder.CENTER); tilePanel.setBorder(border); - tilePanel.textField.addActionListener(this); - } + final ActionListener actionListener = new ActionListener() { - /** - * {@inheritDoc} Bound to the textField to update the relative/absolute - * state. - */ - @Override - public void actionPerformed(@NotNull final ActionEvent e) { - tilePanel.raSwitch.updateRAState(); - ((AbstractMapTilePane<?, ?, ?>) tilePanel.getParent().getParent()).tilePaths[nextFocus[direction]].tilePanel.textField.requestFocusInWindow(); + /** + * {@inheritDoc} Bound to the textField to update the relative/absolute + * state. + */ + @Override + public void actionPerformed(@NotNull final ActionEvent e) { + tilePanel.raSwitch.updateRAState(); + ((AbstractMapTilePane<?, ?, ?>) tilePanel.getParent().getParent()).tilePaths[nextFocus[direction]].tilePanel.textField.requestFocusInWindow(); + } + + }; + tilePanel.textField.addActionListener(actionListener); } @NotNull This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-14 00:02:50
|
Revision: 7746 http://gridarta.svn.sourceforge.net/gridarta/?rev=7746&view=rev Author: akirschbaum Date: 2010-05-14 00:02:43 +0000 (Fri, 14 May 2010) Log Message: ----------- Replace inheritance with delegation. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-13 22:21:12 UTC (rev 7745) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-05-14 00:02:43 UTC (rev 7746) @@ -79,7 +79,6 @@ import net.sf.gridarta.gui.map.maptilepane.TilePanel; import net.sf.gridarta.gui.treasurelist.CFTreasureListTree; 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; @@ -564,7 +563,7 @@ relativeReference = new File(globalSettings.getMapsDirectory(), "dummy"); } final JLabel cLabel = new JLabel(archetypeAttribute.getAttributeName() + ": "); - final TilePanel tilePanel = new TilePanel(mapFileFilter, DirectionLayout.Direction.N); + final TilePanel tilePanel = new TilePanel(mapFileFilter); tilePanel.setAbsoluteReference(globalSettings.getMapsDirectory()); tilePanel.setOriginal(gameObject.getAttributeString(archetypeAttribute.getArchetypeAttributeName())); tilePanel.setRelativeReference(relativeReference); @@ -575,7 +574,7 @@ @Override public void visit(@NotNull final ArchetypeAttributeScriptFile<G, A, R> archetypeAttribute) { final JLabel cLabel = new JLabel(archetypeAttribute.getAttributeName() + ": "); - final TilePanel tilePanel = new TilePanel(scriptFileFilter, DirectionLayout.Direction.N); + final TilePanel tilePanel = new TilePanel(scriptFileFilter); tilePanel.setAbsoluteReference(globalSettings.getMapsDirectory()); tilePanel.setOriginal(gameObject.getAttributeString(archetypeAttribute.getArchetypeAttributeName())); tilePanel.setRelativeReference(new File(globalSettings.getMapsDirectory(), "dummy")); 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 22:21:12 UTC (rev 7745) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-14 00:02:43 UTC (rev 7746) @@ -112,7 +112,7 @@ * The JTextFields with the tile paths. */ @NotNull - public final TilePanel[] tilePaths; + public final MapTilePanel[] tilePaths; @NotNull private final AttachTiledMaps<G, A, R> attachTiledMaps; @@ -148,9 +148,10 @@ final File mapDir = globalSettings.getMapsDirectory(); final File mapFile = mapModel.getMapFile(); for (int i = 0; i < tilePaths.length; i++) { - tilePaths[i].setAbsoluteReference(mapDir); - tilePaths[i].setOriginal(mapArchObject.getTilePath(i)); - tilePaths[i].setRelativeReference(mapFile); + final TilePanel tilePanel = tilePaths[i].getTilePanel(); + tilePanel.setAbsoluteReference(mapDir); + tilePanel.setOriginal(mapArchObject.getTilePath(i)); + tilePanel.setRelativeReference(mapFile); } } @@ -174,26 +175,26 @@ * @param directionMapping maps direction to direction layout direction * @return the JTextFields with the tile paths */ - private TilePanel[] buildComponents(@NotNull final DirectionLayout.Direction[] directionMapping) { + private MapTilePanel[] buildComponents(@NotNull final DirectionLayout.Direction[] directionMapping) { setLayout(new GridBagLayout()); final GridBagConstraints gbc = new GridBagConstraints(); gbc.gridwidth = GridBagConstraints.REMAINDER; gbc.weightx = 1.0; gbc.fill = GridBagConstraints.BOTH; - final TilePanel[] tilePanels = createTilePanels(directionMapping); + final MapTilePanel[] tilePanels = createTilePanels(directionMapping); add(buildTilePanels(tilePanels), gbc); add(buildSubPanel(), gbc); return tilePanels; } /** - * Builds all {@link TilePanel TilePanels} for all directions. + * Builds all {@link MapTilePanel MapTilePanels} for all directions. * @param directionMapping the directions * @return the tile panels */ @NotNull - private TilePanel[] createTilePanels(@NotNull final DirectionLayout.Direction[] directionMapping) { - final TilePanel[] tilePanels = new TilePanel[directionMapping.length]; + private MapTilePanel[] createTilePanels(@NotNull final DirectionLayout.Direction[] directionMapping) { + final MapTilePanel[] tilePanels = new MapTilePanel[directionMapping.length]; for (int index = 0; index < tilePanels.length; index++) { tilePanels[index] = new MapTilePanel(index, nextFocus, mapFileFilter, tileLinks[index].getName(), directionMapping[index]); } @@ -206,11 +207,11 @@ * @return the newly built tile panel */ @NotNull - private static Component buildTilePanels(@NotNull final TilePanel[] tilePanels) { + private static Component buildTilePanels(@NotNull final MapTilePanel[] tilePanels) { final JComponent panel = new JPanel(new DirectionLayout()); panel.setBorder(new CompoundBorder(BorderFactory.createTitledBorder(ACTION_BUILDER.getString("mapTiles")), GUIConstants.DIALOG_BORDER)); - for (final TilePanel tilePanel : tilePanels) { - panel.add(tilePanel, tilePanel.getDirection()); + for (final MapTilePanel tilePanel : tilePanels) { + panel.add(tilePanel.getTilePanel(), tilePanel.getDirection()); } return panel; } @@ -244,7 +245,7 @@ public void mapTilesAttach() { final String[] tmpTilePaths = new String[tilePaths.length]; for (int i = 0; i < tmpTilePaths.length; i++) { - tmpTilePaths[i] = tilePaths[i].getText(); + tmpTilePaths[i] = tilePaths[i].getTilePanel().getText(); } final File mapsDirectory = globalSettings.getMapsDirectory(); try { @@ -263,7 +264,7 @@ return; } for (int i = 0; i < tmpTilePaths.length; i++) { - tilePaths[i].setText(tmpTilePaths[i], true); + tilePaths[i].getTilePanel().setText(tmpTilePaths[i], true); } } @@ -271,8 +272,8 @@ * Action method for tiles clearing paths. */ public void mapTilesClear() { - for (final TilePanel tilePath : tilePaths) { - tilePath.setText("", true); + for (final MapTilePanel tilePath : tilePaths) { + tilePath.getTilePanel().setText("", true); } } @@ -282,7 +283,7 @@ */ public void modifyMapProperties() { for (int i = 0; i < tilePaths.length; i++) { - mapArchObject.setTilePath(i, tilePaths[i].getText()); + mapArchObject.setTilePath(i, tilePaths[i].getTilePanel().getText()); } } @@ -290,8 +291,8 @@ * Restores the settings from the map. */ public void restoreMapProperties() { - for (final TilePanel tilePath : tilePaths) { - tilePath.mapTileRevert(); + for (final MapTilePanel tilePath : tilePaths) { + tilePath.getTilePanel().mapTileRevert(); } } Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2010-05-13 22:21:12 UTC (rev 7745) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2010-05-14 00:02:43 UTC (rev 7746) @@ -31,8 +31,9 @@ * traversal work within the map tile pane. * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum */ -public class MapTilePanel extends TilePanel implements ActionListener { +public class MapTilePanel implements ActionListener { /** * Serial Version UID. @@ -50,6 +51,12 @@ */ private final int direction; + @NotNull + private final DirectionLayout.Direction direction2; + + @NotNull + private final TilePanel tilePanel; + /** * Create a new instance. * @param direction Index, used to determine the direction and corresponding @@ -58,15 +65,16 @@ * @param fileFilter The file filter to use. */ MapTilePanel(final int direction, @NotNull final int[] nextFocus, @NotNull final FileFilter fileFilter, @NotNull final String name, @NotNull final DirectionLayout.Direction direction2) { - super(fileFilter, direction2); this.nextFocus = nextFocus; this.direction = direction; + this.direction2 = direction2; + tilePanel = new TilePanel(fileFilter); final TitledBorder border = new TitledBorder(name); border.setTitleJustification(TitledBorder.CENTER); - setBorder(border); + tilePanel.setBorder(border); - textField.addActionListener(this); + tilePanel.textField.addActionListener(this); } /** @@ -75,8 +83,18 @@ */ @Override public void actionPerformed(@NotNull final ActionEvent e) { - raSwitch.updateRAState(); - ((AbstractMapTilePane<?, ?, ?>) getParent().getParent()).tilePaths[nextFocus[direction]].textField.requestFocusInWindow(); + tilePanel.raSwitch.updateRAState(); + ((AbstractMapTilePane<?, ?, ?>) tilePanel.getParent().getParent()).tilePaths[nextFocus[direction]].tilePanel.textField.requestFocusInWindow(); } + @NotNull + public DirectionLayout.Direction getDirection() { + return direction2; + } + + @NotNull + public TilePanel getTilePanel() { + return tilePanel; + } + } // class MapTilePanel Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2010-05-13 22:21:12 UTC (rev 7745) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2010-05-14 00:02:43 UTC (rev 7746) @@ -34,7 +34,6 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.gui.utils.DirectionLayout; import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.utils.FileChooserUtils; import net.sf.japi.swing.action.ActionBuilder; @@ -67,9 +66,6 @@ @NotNull private final FileFilter fileFilter; - @NotNull - private final DirectionLayout.Direction direction; - /** * The original value. */ @@ -104,10 +100,9 @@ * Create a TilePanel. * @param fileFilter the file filter to use */ - public TilePanel(@NotNull final FileFilter fileFilter, @NotNull final DirectionLayout.Direction direction) { + public TilePanel(@NotNull final FileFilter fileFilter) { super(new GridBagLayout()); this.fileFilter = fileFilter; - this.direction = direction; final GridBagConstraints gbc = new GridBagConstraints(); textField = new JTextField(); textField.setColumns(16); @@ -251,11 +246,6 @@ return textField.getText(); } - @NotNull - public DirectionLayout.Direction getDirection() { - return direction; - } - /** * A JButton that converts relative to absolute paths and vice versa. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 22:21:18
|
Revision: 7745 http://gridarta.svn.sourceforge.net/gridarta/?rev=7745&view=rev Author: akirschbaum Date: 2010-05-13 22:21:12 +0000 (Thu, 13 May 2010) Log Message: ----------- Add @ActionMethod annotatios. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2010-05-13 22:13:58 UTC (rev 7744) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2010-05-13 22:21:12 UTC (rev 7745) @@ -39,6 +39,7 @@ import net.sf.gridarta.utils.FileChooserUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.action.ActionMethod; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -179,6 +180,7 @@ /** * Action method for reverting to stored path. */ + @ActionMethod public void mapTileRevert() { setText(original, false); } @@ -186,6 +188,7 @@ /** * Action method for deleting the path. */ + @ActionMethod public void mapTileClear() { setText("", true); } @@ -193,6 +196,7 @@ /** * Action method for choosing the path. */ + @ActionMethod public void mapTileChoose() { final JFileChooser chooser = new JFileChooser(relativeReference.getParentFile()); final String oldFilename = getText(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 22:14:05
|
Revision: 7744 http://gridarta.svn.sourceforge.net/gridarta/?rev=7744&view=rev Author: akirschbaum Date: 2010-05-13 22:13:58 +0000 (Thu, 13 May 2010) Log Message: ----------- Remove pointless Javadoc references. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 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-13 22:11:10 UTC (rev 7743) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-05-13 22:13:58 UTC (rev 7744) @@ -184,7 +184,6 @@ * by that transaction. <p/> Beginning a nested transaction is a cheap * operation. * @param name Name of the transaction. - * @see #beginTransaction(String) * @see #endTransaction() * @see #endTransaction(boolean) * @see #endAllTransactions() @@ -200,7 +199,6 @@ * transaction is ended, the changes are committed. <p/> Same as {@link * #endTransaction(boolean) endTransaction(false)}. * @see #beginTransaction(String) - * @see #endTransaction() * @see #endTransaction(boolean) * @see #endAllTransactions() * @see #getTransactionDepth() @@ -226,7 +224,6 @@ * @note If the event is fired, the internal change list is not cleared. * @see #beginTransaction(String) * @see #endTransaction() - * @see #endTransaction(boolean) * @see #endAllTransactions() * @see #getTransactionDepth() * @see #isAnyTransactionActive() @@ -241,7 +238,6 @@ * @see #beginTransaction(String) * @see #endTransaction() * @see #endTransaction(boolean) - * @see #endAllTransactions() * @see #getTransactionDepth() * @see #isAnyTransactionActive() */ @@ -257,7 +253,6 @@ * @see #endTransaction() * @see #endTransaction(boolean) * @see #endAllTransactions() - * @see #getTransactionDepth() * @see #isAnyTransactionActive() */ int getTransactionDepth(); @@ -273,7 +268,6 @@ * @see #endTransaction(boolean) * @see #endAllTransactions() * @see #getTransactionDepth() - * @see #isAnyTransactionActive() */ boolean isAnyTransactionActive(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 22:11:16
|
Revision: 7743 http://gridarta.svn.sourceforge.net/gridarta/?rev=7743&view=rev Author: akirschbaum Date: 2010-05-13 22:11:10 +0000 (Thu, 13 May 2010) Log Message: ----------- Remove pointless Javadoc references. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObject.java Modified: trunk/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObject.java 2010-05-13 21:57:37 UTC (rev 7742) +++ trunk/src/app/net/sf/gridarta/model/map/maparchobject/MapArchObject.java 2010-05-13 22:11:10 UTC (rev 7743) @@ -218,7 +218,6 @@ * come before the view is really required to update. Each invocation of * this function requires its own invocation of {@link #endTransaction()}. * <p/> Beginning a nested transaction is a cheap operation. - * @see #beginTransaction() * @see #endTransaction() * @see #endTransaction(boolean) */ @@ -231,7 +230,6 @@ * transaction is ended, the changes are committed. <p/> Same as {@link * #endTransaction(boolean) endTransaction(false)}. * @see #beginTransaction() - * @see #endTransaction() * @see #endTransaction(boolean) */ void endTransaction(); @@ -254,7 +252,6 @@ * @note If the event is fired, the internal change list is not cleared. * @see #beginTransaction() * @see #endTransaction() - * @see #endTransaction(boolean) */ void endTransaction(boolean fireEvent); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 21:57:44
|
Revision: 7742 http://gridarta.svn.sourceforge.net/gridarta/?rev=7742&view=rev Author: akirschbaum Date: 2010-05-13 21:57:37 +0000 (Thu, 13 May 2010) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 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 trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2010-05-13 21:40:12 UTC (rev 7741) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -22,7 +22,6 @@ import java.awt.Component; import javax.swing.JFrame; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; @@ -31,8 +30,6 @@ import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; import net.sf.gridarta.var.atrinik.model.maparchobject.MapArchObject; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; /** @@ -43,11 +40,6 @@ public class DefaultMapPropertiesDialogFactory implements MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> { /** - * Action Builder. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** * The {@link MapManager} to use. */ @NotNull @@ -67,24 +59,16 @@ private final MapPathNormalizer mapPathNormalizer; /** - * The {@link MapViewsManager}. - */ - @NotNull - private final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager; - - /** * Creates a new instance. * @param mapManager the map manager to use * @param globalSettings the global settings instance * @param mapPathNormalizer the map path normalize for converting map paths * to files - * @param mapViewsManager the map views */ - public DefaultMapPropertiesDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager) { + public DefaultMapPropertiesDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapPathNormalizer mapPathNormalizer) { this.mapManager = mapManager; this.globalSettings = globalSettings; this.mapPathNormalizer = mapPathNormalizer; - this.mapViewsManager = mapViewsManager; } /** @@ -92,7 +76,7 @@ */ @Override public void showDialog(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer, mapViewsManager); + final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer); pane.showDialog(parent); } Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-13 21:40:12 UTC (rev 7741) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -51,7 +51,6 @@ import net.sf.gridarta.gui.help.Help; import net.sf.gridarta.gui.map.maptilepane.AbstractMapTilePane; import net.sf.gridarta.gui.map.maptilepane.IsoMapTilePane; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.utils.GUIConstants; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; @@ -174,9 +173,8 @@ * @param mapFileFilter the Swing file filter to use * @param mapPathNormalizer the map path normalizer for converting map paths * to files - * @param mapViewsManager the map views */ - public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<GameObject, MapArchObject, Archetype> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager) { + public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<GameObject, MapArchObject, Archetype> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { okButton.setDefaultCapable(true); final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); @@ -192,7 +190,7 @@ final Component mainPanel = createMainPanel(map); tabs.add(ACTION_BUILDER.getString("mapMapTabTitle"), mainPanel); - mapTilePane = new IsoMapTilePane<GameObject, MapArchObject, Archetype>(mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer, mapViewsManager); + mapTilePane = new IsoMapTilePane<GameObject, MapArchObject, Archetype>(mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer); final Component tilePanel = createTilePathPanel(mapTilePane); tabs.add(ACTION_BUILDER.getString("mapTilesTabTitle"), tilePanel); 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-13 21:40:12 UTC (rev 7741) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -481,8 +481,8 @@ */ @NotNull @Override - public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager) { - return new DefaultMapPropertiesDialogFactory(mapManager, globalSettings, mapPathNormalizer, mapViewsManager); + public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapPathNormalizer mapPathNormalizer) { + return new DefaultMapPropertiesDialogFactory(mapManager, globalSettings, mapPathNormalizer); } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2010-05-13 21:40:12 UTC (rev 7741) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -22,7 +22,6 @@ import java.awt.Component; import javax.swing.JFrame; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; @@ -31,8 +30,6 @@ import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; /** @@ -43,11 +40,6 @@ public class DefaultMapPropertiesDialogFactory implements MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> { /** - * Action Builder. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** * The {@link MapManager} to use. */ @NotNull @@ -67,24 +59,16 @@ private final MapPathNormalizer mapPathNormalizer; /** - * The {@link MapViewsManager}. - */ - @NotNull - private final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager; - - /** * Creates a new instance. * @param mapManager the map manager to use * @param globalSettings the global settings instance * @param mapPathNormalizer the map path normalizer for converting map paths * to files - * @param mapViewsManager the map views */ - public DefaultMapPropertiesDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager) { + public DefaultMapPropertiesDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapPathNormalizer mapPathNormalizer) { this.mapManager = mapManager; this.globalSettings = globalSettings; this.mapPathNormalizer = mapPathNormalizer; - this.mapViewsManager = mapViewsManager; } /** @@ -92,7 +76,7 @@ */ @Override public void showDialog(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer, mapViewsManager); + final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer); pane.showDialog(parent); } Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-13 21:40:12 UTC (rev 7741) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -44,7 +44,6 @@ import net.sf.gridarta.gui.help.Help; import net.sf.gridarta.gui.map.maptilepane.AbstractMapTilePane; import net.sf.gridarta.gui.map.maptilepane.FlatMapTilePane; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; @@ -194,9 +193,8 @@ * @param mapFileFilter the Swing file filter to use * @param mapPathNormalizer the map path normalizer for converting map paths * to files - * @param mapViewsManager the map views */ - public MapPropertiesDialog(final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<GameObject, MapArchObject, Archetype> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager) { + public MapPropertiesDialog(final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<GameObject, MapArchObject, Archetype> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { okButton.setDefaultCapable(true); final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); @@ -242,7 +240,7 @@ final Component weatherPanel = createWeatherPanel(map); tabs.add(ACTION_BUILDER.getString("mapWeatherTabTitle"), weatherPanel); - mapTilePane = new FlatMapTilePane<GameObject, MapArchObject, Archetype>(mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer, mapViewsManager); + mapTilePane = new FlatMapTilePane<GameObject, MapArchObject, Archetype>(mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer); final Component tilePanel = createTilePathPanel(mapTilePane); tabs.add(ACTION_BUILDER.getString("mapTilesTabTitle"), tilePanel); Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-05-13 21:40:12 UTC (rev 7741) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -366,8 +366,8 @@ */ @NotNull @Override - public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager) { - return new DefaultMapPropertiesDialogFactory(mapManager, globalSettings, mapPathNormalizer, mapViewsManager); + public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapPathNormalizer mapPathNormalizer) { + return new DefaultMapPropertiesDialogFactory(mapManager, globalSettings, mapPathNormalizer); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2010-05-13 21:40:12 UTC (rev 7741) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -22,7 +22,6 @@ import java.awt.Component; import javax.swing.JFrame; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; @@ -31,8 +30,6 @@ import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; import net.sf.gridarta.var.daimonin.model.maparchobject.MapArchObject; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; /** @@ -43,11 +40,6 @@ public class DefaultMapPropertiesDialogFactory implements MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> { /** - * Action Builder. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** * The {@link MapManager} to use. */ @NotNull @@ -67,24 +59,16 @@ private final MapPathNormalizer mapPathNormalizer; /** - * The {@link MapViewsManager}. - */ - @NotNull - private final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager; - - /** * Creates a new instance. * @param mapManager the map manager to use * @param globalSettings the global settings instance * @param mapPathNormalizer the map path normalize for converting map paths * to files - * @param mapViewsManager the map views */ - public DefaultMapPropertiesDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager) { + public DefaultMapPropertiesDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapPathNormalizer mapPathNormalizer) { this.mapManager = mapManager; this.globalSettings = globalSettings; this.mapPathNormalizer = mapPathNormalizer; - this.mapViewsManager = mapViewsManager; } /** @@ -92,7 +76,7 @@ */ @Override public void showDialog(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel, @NotNull final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer, mapViewsManager); + final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer); pane.showDialog(parent); } Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-13 21:40:12 UTC (rev 7741) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -52,7 +52,6 @@ import net.sf.gridarta.gui.help.Help; import net.sf.gridarta.gui.map.maptilepane.AbstractMapTilePane; import net.sf.gridarta.gui.map.maptilepane.IsoMapTilePane; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.utils.GUIConstants; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; @@ -178,9 +177,8 @@ * @param mapFileFilter the Swing file filter to use * @param mapPathNormalizer the map path normalizer for converting map paths * to files - * @param mapViewsManager the map views */ - public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<GameObject, MapArchObject, Archetype> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager) { + public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<GameObject, MapArchObject, Archetype> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { okButton.setDefaultCapable(true); final JButton helpButton = new JButton(ACTION_BUILDER.createAction(false, "mapHelp", this)); final JButton restoreButton = new JButton(ACTION_BUILDER.createAction(false, "mapRestore", this)); @@ -197,7 +195,7 @@ final Component mainPanel = createMainPanel(map); tabs.add(ACTION_BUILDER.getString("mapMapTabTitle"), mainPanel); - mapTilePane = new IsoMapTilePane<GameObject, MapArchObject, Archetype>(mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer, mapViewsManager); + mapTilePane = new IsoMapTilePane<GameObject, MapArchObject, Archetype>(mapManager, globalSettings, mapModel, mapFileFilter, mapPathNormalizer); final Component tilePanel = createTilePathPanel(mapTilePane); tabs.add(ACTION_BUILDER.getString("mapTilesTabTitle"), tilePanel); 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-13 21:40:12 UTC (rev 7741) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -482,8 +482,8 @@ */ @NotNull @Override - public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager) { - return new DefaultMapPropertiesDialogFactory(mapManager, globalSettings, mapPathNormalizer, mapViewsManager); + public MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype> newMapPropertiesDialogFactory(@NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapPathNormalizer mapPathNormalizer) { + return new DefaultMapPropertiesDialogFactory(mapManager, globalSettings, mapPathNormalizer); } /** 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 21:40:12 UTC (rev 7741) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -34,7 +34,6 @@ import net.sf.gridarta.actions.CannotSaveMapFileException; import net.sf.gridarta.actions.InvalidPathNameException; import net.sf.gridarta.actions.MapSizeMismatchException; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.utils.DirectionLayout; import net.sf.gridarta.gui.utils.GUIConstants; import net.sf.gridarta.mapmanager.MapManager; @@ -110,12 +109,6 @@ private final FileFilter mapFileFilter; /** - * The {@link MapViewsManager}. - */ - @NotNull - private final MapViewsManager<G, A, R> mapViewsManager; - - /** * The JTextFields with the tile paths. */ @NotNull @@ -140,14 +133,12 @@ * @param mapFileFilter the file filter for map files * @param mapPathNormalizer the map path normalizer for converting map paths * to files - * @param mapViewsManager the map views */ - protected AbstractMapTilePane(@NotNull final MapManager<G, A, R> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapModel<G, A, R> mapModel, @NotNull final MapLink[][] tileLink, @NotNull final DirectionLayout.Direction[] directionMapping, @NotNull final int[] nextFocus, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<G, A, R> mapViewsManager) { + protected AbstractMapTilePane(@NotNull final MapManager<G, A, R> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapModel<G, A, R> mapModel, @NotNull final MapLink[][] tileLink, @NotNull final DirectionLayout.Direction[] directionMapping, @NotNull final int[] nextFocus, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { this.globalSettings = globalSettings; this.mapModel = mapModel; this.nextFocus = nextFocus; this.mapFileFilter = mapFileFilter; - this.mapViewsManager = mapViewsManager; assert tileLink.length == 8; tileLinks = new TileLink[] { newTileLink("mapNorth", tileLink[0], CommonConstants.SOUTH), newTileLink("mapEast", tileLink[1], CommonConstants.WEST), newTileLink("mapSouth", tileLink[2], CommonConstants.NORTH), newTileLink("mapWest", tileLink[3], CommonConstants.EAST), newTileLink("mapNorthEast", tileLink[4], CommonConstants.SOUTH_WEST), newTileLink("mapSouthEast", tileLink[5], CommonConstants.NORTH_WEST), newTileLink("mapSouthWest", tileLink[6], CommonConstants.NORTH_EAST), newTileLink("mapNorthWest", tileLink[7], CommonConstants.SOUTH_EAST), }; attachTiledMaps = new AttachTiledMaps<G, A, R>(mapManager, tileLinks, mapPathNormalizer); 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 21:40:12 UTC (rev 7741) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/FlatMapTilePane.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -20,7 +20,6 @@ package net.sf.gridarta.gui.map.maptilepane; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.utils.DirectionLayout; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.archetype.Archetype; @@ -67,10 +66,9 @@ * @param mapFileFilter the Swing file filter to use * @param mapPathNormalizer the map path normalizer for converting map paths * to files - * @param mapViewsManager the map views */ - public FlatMapTilePane(final MapManager<G, A, R> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<G, A, R> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<G, A, R> mapViewsManager) { - super(mapManager, globalSettings, mapModel, tileLink, directionMapping, nextFocus, mapFileFilter, mapPathNormalizer, mapViewsManager); + public FlatMapTilePane(final MapManager<G, A, R> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<G, A, R> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { + super(mapManager, globalSettings, mapModel, tileLink, directionMapping, nextFocus, mapFileFilter, mapPathNormalizer); } } // class FlatMapTilePane 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 21:40:12 UTC (rev 7741) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/IsoMapTilePane.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -20,7 +20,6 @@ package net.sf.gridarta.gui.map.maptilepane; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.utils.DirectionLayout; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.archetype.Archetype; @@ -95,10 +94,9 @@ * @param mapFileFilter the Swing file filter to use * @param mapPathNormalizer the map path normalizer for converting map paths * to files - * @param mapViewsManager the map views */ - public IsoMapTilePane(final MapManager<G, A, R> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<G, A, R> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<G, A, R> mapViewsManager) { - super(mapManager, globalSettings, mapModel, tileLink, directionMapping, nextFocus, mapFileFilter, mapPathNormalizer, mapViewsManager); + public IsoMapTilePane(final MapManager<G, A, R> mapManager, @NotNull final GlobalSettings globalSettings, final MapModel<G, A, R> mapModel, final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer) { + super(mapManager, globalSettings, mapModel, tileLink, directionMapping, nextFocus, mapFileFilter, mapPathNormalizer); } } // class IsoMapTilePane Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-05-13 21:40:12 UTC (rev 7741) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -311,11 +311,10 @@ * @param mapManager the map manager to use * @param mapPathNormalizer the map path normalizer for converting map paths * to files - * @param mapViewsManager the map views * @return the new instance */ @NotNull - MapPropertiesDialogFactory<G, A, R> newMapPropertiesDialogFactory(@NotNull GlobalSettings globalSettings, @NotNull MapManager<G, A, R> mapManager, @NotNull MapPathNormalizer mapPathNormalizer, @NotNull MapViewsManager<G, A, R> mapViewsManager); + MapPropertiesDialogFactory<G, A, R> newMapPropertiesDialogFactory(@NotNull GlobalSettings globalSettings, @NotNull MapManager<G, A, R> mapManager, @NotNull MapPathNormalizer mapPathNormalizer); /** * @param parent the parent component for dialogs Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-13 21:40:12 UTC (rev 7741) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-05-13 21:57:37 UTC (rev 7742) @@ -453,7 +453,7 @@ final GameObjectMatcher exitGameObjectMatcher = exitGameObjectMatcherTmp == null ? new TypeNrsGameObjectMatcher() : exitGameObjectMatcherTmp; final ExitMatcher<G, A, R> exitMatcher = new ExitMatcher<G, A, R>(exitGameObjectMatcher); final MapPathNormalizer mapPathNormalizer = new MapPathNormalizer(globalSettings); - final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory = editorFactory.newMapPropertiesDialogFactory(globalSettings, mapManager, mapPathNormalizer, mapViewsManager); + final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory = editorFactory.newMapPropertiesDialogFactory(globalSettings, mapManager, mapPathNormalizer); 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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 21:40:19
|
Revision: 7741 http://gridarta.svn.sourceforge.net/gridarta/?rev=7741&view=rev Author: akirschbaum Date: 2010-05-13 21:40:12 +0000 (Thu, 13 May 2010) Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2010-05-13 21:38:23 UTC (rev 7740) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2010-05-13 21:40:12 UTC (rev 7741) @@ -144,9 +144,9 @@ //noinspection ProhibitedExceptionCaught try { this.relativeReference = relativeReference.getCanonicalFile(); - } catch (final IOException e) { + } catch (final IOException ignored) { this.relativeReference = relativeReference.getAbsoluteFile(); - } catch (final NullPointerException e) { + } catch (final NullPointerException ignored) { // occurs on unsaved maps where this method is invoked with null argument } } @@ -159,7 +159,7 @@ public void setAbsoluteReference(@NotNull final File absoluteReference) { try { this.absoluteReference = absoluteReference.getCanonicalFile(); - } catch (final IOException e) { + } catch (final IOException ignored) { this.absoluteReference = absoluteReference.getAbsoluteFile(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 21:38:29
|
Revision: 7740 http://gridarta.svn.sourceforge.net/gridarta/?rev=7740&view=rev Author: akirschbaum Date: 2010-05-13 21:38:23 +0000 (Thu, 13 May 2010) Log Message: ----------- Add @NotNull/@Nullable annotations. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2010-05-13 19:09:19 UTC (rev 7739) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/MapTilePanel.java 2010-05-13 21:38:23 UTC (rev 7740) @@ -42,6 +42,7 @@ /** * Indices of next focus. */ + @NotNull private final int[] nextFocus; /** @@ -56,7 +57,7 @@ * @param nextFocus Indices of next focus. * @param fileFilter The file filter to use. */ - MapTilePanel(final int direction, final int[] nextFocus, final FileFilter fileFilter, @NotNull final String name, @NotNull final DirectionLayout.Direction direction2) { + MapTilePanel(final int direction, @NotNull final int[] nextFocus, @NotNull final FileFilter fileFilter, @NotNull final String name, @NotNull final DirectionLayout.Direction direction2) { super(fileFilter, direction2); this.nextFocus = nextFocus; this.direction = direction; @@ -73,7 +74,7 @@ * state. */ @Override - public void actionPerformed(final ActionEvent e) { + public void actionPerformed(@NotNull final ActionEvent e) { raSwitch.updateRAState(); ((AbstractMapTilePane<?, ?, ?>) getParent().getParent()).tilePaths[nextFocus[direction]].textField.requestFocusInWindow(); } Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2010-05-13 19:09:19 UTC (rev 7739) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2010-05-13 21:38:23 UTC (rev 7740) @@ -39,6 +39,8 @@ import net.sf.gridarta.utils.FileChooserUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * A TilePanel displays exactly one direction for map tiling. It's basically an @@ -55,45 +57,53 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** * The file filter to use. */ + @NotNull private final FileFilter fileFilter; + @NotNull private final DirectionLayout.Direction direction; /** * The original value. */ + @NotNull private String original; /** * The context reference for relative paths (file). */ + @Nullable private File relativeReference; /** * The context reference for absolute paths (file). */ + @NotNull private File absoluteReference; /** * The JTextField with the text. */ + @NotNull protected final JTextField textField; /** * The RASwitch. */ + @NotNull protected final RASwitch raSwitch; /** * Create a TilePanel. * @param fileFilter the file filter to use */ - public TilePanel(final FileFilter fileFilter, final DirectionLayout.Direction direction) { + public TilePanel(@NotNull final FileFilter fileFilter, @NotNull final DirectionLayout.Direction direction) { super(new GridBagLayout()); this.fileFilter = fileFilter; this.direction = direction; @@ -120,7 +130,7 @@ * @param original original value, used as initial value and for restoring * it. */ - public void setOriginal(final String original) { + public void setOriginal(@NotNull final String original) { this.original = original; mapTileRevert(); } @@ -130,7 +140,8 @@ * @param relativeReference file to reference for relative paths (context * file or directory, not parent directory) */ - public void setRelativeReference(final File relativeReference) { + public void setRelativeReference(@Nullable final File relativeReference) { + //noinspection ProhibitedExceptionCaught try { this.relativeReference = relativeReference.getCanonicalFile(); } catch (final IOException e) { @@ -145,7 +156,7 @@ * @param absoluteReference file to reference for absolute paths (context * file or directory, not parent directory) */ - public void setAbsoluteReference(final File absoluteReference) { + public void setAbsoluteReference(@NotNull final File absoluteReference) { try { this.absoluteReference = absoluteReference.getCanonicalFile(); } catch (final IOException e) { @@ -158,7 +169,8 @@ * @param action the action for the button * @return JButton for key */ - private static Component iconButton(final Action action) { + @NotNull + private static Component iconButton(@NotNull final Action action) { final AbstractButton button = new JButton(action); button.setMargin(new Insets(0, 0, 0, 0)); return button; @@ -217,7 +229,7 @@ * @param keepRA If set, modify <code>text</code> to match the current RA * state. */ - public void setText(final String text, final boolean keepRA) { + public void setText(@NotNull final String text, final boolean keepRA) { textField.setText(text); if (keepRA) { raSwitch.actionPerformed(null); @@ -230,10 +242,12 @@ * Get the text. * @return text */ + @Nullable public String getText() { return textField.getText(); } + @NotNull public DirectionLayout.Direction getDirection() { return direction; } @@ -268,7 +282,7 @@ * {@inheritDoc} */ @Override - public void actionPerformed(final ActionEvent e) { + public void actionPerformed(@Nullable final ActionEvent e) { final String path = TilePanel.this.getText(); if (path == null || relativeReference == null) { return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 19:09:27
|
Revision: 7739 http://gridarta.svn.sourceforge.net/gridarta/?rev=7739&view=rev Author: akirschbaum Date: 2010-05-13 19:09:19 +0000 (Thu, 13 May 2010) Log Message: ----------- Fix error message about missing cfpython_menu.def file. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/build.xml Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-05-13 18:53:07 UTC (rev 7738) +++ trunk/crossfire/ChangeLog 2010-05-13 19:09:19 UTC (rev 7739) @@ -1,5 +1,7 @@ 2010-05-13 Andreas Kirschbaum + * Fix error message about missing cfpython_menu.def file. + * Fix missing "Analyze" menu entries. 2010-05-12 Andreas Kirschbaum Modified: trunk/crossfire/build.xml =================================================================== --- trunk/crossfire/build.xml 2010-05-13 18:53:07 UTC (rev 7738) +++ trunk/crossfire/build.xml 2010-05-13 19:09:19 UTC (rev 7739) @@ -115,7 +115,7 @@ > <!-- pack everything into the jar file --> <fileset dir="${build.dir.production}" excludes="MANIFEST.MF,test/**"/> - <fileset dir="${src.dir}" includes="**/*.properties" /> + <fileset dir="${src.dir}" includes="**/*.properties,cfpython_menu.def" /> <fileset file="build.properties" /> <fileset file="../COPYING" /> <fileset dir="${lib.dir}"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-13 18:53:13
|
Revision: 7738 http://gridarta.svn.sourceforge.net/gridarta/?rev=7738&view=rev Author: akirschbaum Date: 2010-05-13 18:53:07 +0000 (Thu, 13 May 2010) Log Message: ----------- Fix missing "Analyze" menu entries. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-05-13 13:51:09 UTC (rev 7737) +++ trunk/atrinik/ChangeLog 2010-05-13 18:53:07 UTC (rev 7738) @@ -1,3 +1,7 @@ +2010-05-13 Andreas Kirschbaum + + * Fix missing "Analyze" menu entries. + 2010-05-12 Andreas Kirschbaum * Implement #2951536 (Different color for unknown fields): use red Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-05-13 13:51:09 UTC (rev 7737) +++ trunk/crossfire/ChangeLog 2010-05-13 18:53:07 UTC (rev 7738) @@ -1,3 +1,7 @@ +2010-05-13 Andreas Kirschbaum + + * Fix missing "Analyze" menu entries. + 2010-05-12 Andreas Kirschbaum * Implement #2951536 (Different color for unknown fields): use red Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-05-13 13:51:09 UTC (rev 7737) +++ trunk/daimonin/ChangeLog 2010-05-13 18:53:07 UTC (rev 7738) @@ -1,3 +1,7 @@ +2010-05-13 Andreas Kirschbaum + + * Fix missing "Analyze" menu entries. + 2010-05-12 Andreas Kirschbaum * Implement #2951536 (Different color for unknown fields): use red Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-05-13 13:51:09 UTC (rev 7737) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-05-13 18:53:07 UTC (rev 7738) @@ -224,7 +224,6 @@ final GlobalSettings globalSettings = editorFactory.newGlobalSettings(configSourceFactory); final PathManager pathManager = new PathManager(globalSettings); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); - final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); final FaceObjects faceObjects = editorFactory.createFaceObjects(archFaceProvider); editorFactory.initSmoothFaces(faceObjects); @@ -235,8 +234,6 @@ final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(faceObjectProviders, animationObjects, archetypeTypeSet); final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, gameObjectMatchers); final GameObjectParser<G, A, R> gameObjectParser = gameObjectParserFactory.newGameObjectParser(); - final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); - final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, gameObjectParser, faceObjectProviders, systemIcons); final ArchetypeFactory<G, A, R> archetypeFactory = editorFactory.newArchetypeFactory(faceObjectProviders, animationObjects); final ArchetypeSet<G, A, R> archetypeSet = editorFactory.newArchetypeSet(globalSettings, archetypeFactory, gameObjectParser); final MapArchObjectFactory<A> mapArchObjectFactory = editorFactory.newMapArchObjectFactory(globalSettings); @@ -272,6 +269,10 @@ } } + final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); + final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); + final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, gameObjectParser, faceObjectProviders, systemIcons); + final ScriptParameters scriptParameters = new ScriptParameters(); scriptParameters.addScriptParameter("archetypeSet", archetypeSet); scriptParameters.addScriptParameter("globalSettings", globalSettings); 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:51:17
|
Revision: 7737 http://gridarta.svn.sourceforge.net/gridarta/?rev=7737&view=rev Author: akirschbaum Date: 2010-05-13 13:51:09 +0000 (Thu, 13 May 2010) Log Message: ----------- Extract AttachTiledMaps from AbstractMapTilePane. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Added Paths: ----------- trunk/src/app/net/sf/gridarta/actions/ trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java trunk/src/app/net/sf/gridarta/actions/CannotLoadMapFileException.java trunk/src/app/net/sf/gridarta/actions/CannotSaveMapFileException.java trunk/src/app/net/sf/gridarta/actions/InvalidPathNameException.java trunk/src/app/net/sf/gridarta/actions/MapSizeMismatchException.java Added: trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java =================================================================== --- trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java (rev 0) +++ trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java 2010-05-13 13:51:09 UTC (rev 7737) @@ -0,0 +1,365 @@ +/* + * 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.actions; + +import java.io.File; +import java.io.IOException; +import java.util.regex.Matcher; +import net.sf.gridarta.mapmanager.MapManager; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +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.normalizer.IOErrorException; +import net.sf.gridarta.model.map.normalizer.InvalidPathException; +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.utils.Size2D; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Attaches maps to adjacent tiled maps. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ +public class AttachTiledMaps<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * The mainControl to use. + */ + @NotNull + private final MapManager<G, A, R> mapManager; + + /** + * The tile links for the attach map algorithm. + */ + @NotNull + private final TileLink[] tileLinks; + + /** + * The {@link MapPathNormalizer} for converting map paths to {@link File}s. + */ + @NotNull + private final MapPathNormalizer mapPathNormalizer; + + /** + * Creates a new instance. + * @param mapManager the map manager to use + * @param tileLinks the tile links to use + * @param mapPathNormalizer the map path normalizer for converting map + * paths the files + */ + public AttachTiledMaps(@NotNull final MapManager<G, A, R> mapManager, @NotNull final TileLink[] tileLinks, @NotNull final MapPathNormalizer mapPathNormalizer) { + this.mapManager = mapManager; + this.tileLinks = tileLinks; + this.mapPathNormalizer = mapPathNormalizer; + } + + /** + * Updates tile paths of a map. + * @param mapModel the map model to update + * @param tilePaths the new tile paths; empty slots will be filled in + * @param mapsDirectory the maps directory + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + * @throws CannotLoadMapFileException if a map file cannot be loaded + * @throws CannotSaveMapFileException if a map file cannot be saved + * @throws InvalidPathNameException if a map path cannot be converted + * @throws MapSizeMismatchException if adjacent map sizes do not match + */ + public boolean attachTiledMaps(@NotNull final MapModel<G, A, R> mapModel, @NotNull final String[] tilePaths, @NotNull final File mapsDirectory, final boolean performAction) throws CannotLoadMapFileException, CannotSaveMapFileException, InvalidPathNameException, MapSizeMismatchException { + if (mapModel.getMapFile() == null) { + return false; // cannot update unsaved map + } + + if (performAction) { + 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 + if (!loadAdjacentMaps(mapModel, mapControls, tilePaths)) { + return false; + } + + // We have loaded all direct linked maps around our map. + // now, lets check free spaces. + if (!fillAdjacentMaps(mapControls)) { + return false; + } + + validateMapSizes(mapModel, mapControls); + + // finally... set the links! + updateTilePaths(mapModel, mapControls, tilePaths, mapsDirectory); + + // all done! now we write all back + saveAdjacentMaps(mapControls); + } finally { + for (final MapControl<G, A, R> mapControl : mapControls) { + if (mapControl != null) { + mapManager.release(mapControl); + } + } + } + } + + return true; + } + + /** + * Loads adjacent map files by "filling" them by checking the "side" path + * links of the loaded ones. + * @param mapModel the map model + * @param mapControls the return value + * @param tilePaths the new tile paths + * @return whether all maps have been loaded + * @throws CannotLoadMapFileException if a map file cannot be loaded + */ + private boolean loadAdjacentMaps(@NotNull final MapModel<G, A, R> mapModel, @NotNull final MapControl<G, A, R>[] mapControls, @NotNull final String[] tilePaths) throws CannotLoadMapFileException { + for (int i = 0; i < tilePaths.length; i++) { + final String path = tilePaths[i]; + if (path != null && path.length() != 0) { + try { + mapControls[i] = loadMapControl(mapModel, path); + } catch (final IOException ex) { + throw new CannotLoadMapFileException(path, ex); + } + } + } + return true; + } + + /** + * Saves adjacent maps. I/O errors are reported to the user but otherwise + * ignored. + * @param mapControls the adjacent maps to save + * @throws CannotSaveMapFileException if the map cannot be saved + */ + private void saveAdjacentMaps(final MapControl<G, A, R>[] mapControls) throws CannotSaveMapFileException { + for (final MapControl<G, A, R> mapControl : mapControls) { + if (mapControl != null) { + try { + if (mapControl.getMapModel().isModified()) { + mapControl.save(); + } + } catch (final IOException e) { + final File mapFile = mapControl.getMapModel().getMapFile(); + assert mapFile != null; + throw new CannotSaveMapFileException(mapFile, e); + } + } + } + } + + /** + * Fills missing adjacent map slots. + * @param mapControls the loaded maps; will be updated + * @return whether all maps have been processed + * @throws CannotLoadMapFileException if a map file cannot be loaded + */ + private boolean fillAdjacentMaps(@NotNull final MapControl<G, A, R>[] mapControls) throws CannotLoadMapFileException { + 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) { + throw new CannotLoadMapFileException(tilePath, ex); + } + } + } + } + } + } + } + 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. + * @param mapModel the map model + * @param mapControls the attached maps to check + * @throws MapSizeMismatchException if a mismatched map size was detected + */ + private void validateMapSizes(@NotNull final MapModel<G, A, R> mapModel, @NotNull final MapControl<G, A, R>[] mapControls) throws MapSizeMismatchException { + final Size2D mapSize = mapModel.getMapArchObject().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)) { + throw new MapSizeMismatchException(mapControl.getMapModel().getMapFile(), mapSize, otherMapSize); + } + for (int ii = 0; ii < 2; ii++) { + // TODO: check links + } + } + } + } + + /** + * Updates map tile paths to match the loaded maps. + * @param mapModel the map model + * @param mapControls the loaded maps + * @param tilePaths the tile paths to update + * @param mapsDirectory the maps directory + * @throws CannotSaveMapFileException if a map file cannot be saved + * @throws InvalidPathNameException if a map path cannot be converted + */ + private void updateTilePaths(@NotNull final MapModel<G, A, R> mapModel, @NotNull final MapControl<G, A, R>[] mapControls, @NotNull final String[] tilePaths, @NotNull final File mapsDirectory) throws CannotSaveMapFileException, InvalidPathNameException { + 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 + final File mapFile1 = mapModel.getMapFile(); + final String canonicalMapPath1; + try { + canonicalMapPath1 = mapFile1.getCanonicalPath(); + } catch (final IOException ex) { + throw new InvalidPathNameException(mapFile1, ex); + } + final File mapFile2 = mapControl.getMapModel().getMapFile(); + final String canonicalMapPath2; + try { + canonicalMapPath2 = mapFile2.getCanonicalPath(); + } catch (final IOException ex) { + throw new InvalidPathNameException(mapFile2, ex); + } + final String link1 = getTilePath(canonicalMapPath1, canonicalMapPath2, mapsDirectory); + // set the link of our source map to the map around + tilePaths[i] = link1; + // generate again a valid path relative to both map positions + final String link2 = getTilePath(canonicalMapPath2, canonicalMapPath1, mapsDirectory); + 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(); + } + } + } + } + + /** + * Loads an adjacent {@link MapControl}, ignoring any (I/O-)errors. + * @param mapModel the map model for relative map paths + * @param path the map path + * @return the map control or <code>null</code> if the map cannot be loaded + * @throws IOException if an I/O error occurs + */ + @Nullable + private MapControl<G, A, R> loadMapControl(@NotNull final MapModel<G, A, R> mapModel, @NotNull final String path) throws IOException { + final File file; + try { + file = mapPathNormalizer.normalizeMapPath(mapModel, path); + } catch (final InvalidPathException ex) { + return null; + } catch (final IOErrorException ex) { + return null; + } catch (final RelativePathOnUnsavedMapException ex) { + return null; + } catch (final SameMapException ex) { + return null; + } + return mapManager.openMapFile(file, false); + } + + /** + * Returns the map path for a tile of a map and a tile path. + * @param base the map path of the map + * @param link the tile path of the map; may be relative to + * <code>base</code> + * @param mapsDirectory the maps directory + * @return the map path + * @throws CannotSaveMapFileException if an I/O error occurs + */ + @Nullable + private static String getTilePath(@NotNull final String base, @NotNull final String link, @NotNull final File mapsDirectory) throws CannotSaveMapFileException { + final int pos = getLastSlashIndex(base); + final int pos2 = getLastSlashIndex(link); + final CharSequence mapdir; + try { + mapdir = mapsDirectory.getCanonicalPath(); + } catch (final IOException e) { + throw new CannotSaveMapFileException(mapsDirectory, e); + } + final String first = base.substring(mapdir.length(), pos).trim(); + final String second = link.substring(mapdir.length(), pos2).trim(); + + final String sep = Matcher.quoteReplacement(File.separator); + + /* our map is in root - second is higher or same map */ + if (first.length() == 0) { + return link.substring(mapdir.length()).trim().replaceAll(sep, "/"); + } + // same folder... we return the name without '/' + if (first.compareTo(second) == 0) { + return link.substring(pos2 + 1).trim().replaceAll(sep, "/"); + } + // second is subfolder of first + if (second.startsWith(first)) { + return link.substring(pos + 1).trim().replaceAll(sep, "/"); + } + // in any other case we return a absolute path + return link.substring(mapdir.length()).trim().replaceAll(sep, "/"); + } + + /** + * Returns the index of the last '/' or {@link File#separator} within a + * string. + * @param base the string + * @return the index or <code>-1</code> if not found + */ + private static int getLastSlashIndex(@NotNull final String base) { + final int slashIndex1 = base.lastIndexOf('/'); + final int separatorIndex1 = base.lastIndexOf(File.separator); + int pos = slashIndex1; + if (separatorIndex1 > slashIndex1) { + pos = separatorIndex1; + } + return pos; + } + +} // class AttachTiledMaps Property changes on: trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/actions/CannotLoadMapFileException.java =================================================================== --- trunk/src/app/net/sf/gridarta/actions/CannotLoadMapFileException.java (rev 0) +++ trunk/src/app/net/sf/gridarta/actions/CannotLoadMapFileException.java 2010-05-13 13:51:09 UTC (rev 7737) @@ -0,0 +1,61 @@ +/* + * 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.actions; + +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +/** + * Exception thrown if a map file cannot be loaded. + * @author Andreas Kirschbaum + */ +public class CannotLoadMapFileException extends IOException { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The map path that could not be loaded. + */ + @NotNull + private final String mapPath; + + /** + * Creates a new instance. + * @param mapPath the map path that could not be loaded + * @param cause the cause why the map file could not be loaded + */ + public CannotLoadMapFileException(@NotNull final String mapPath, @NotNull final Throwable cause) { + super(mapPath, cause); + this.mapPath = mapPath; + } + + /** + * Returns the map path that could not be loaded. + * @return the map path + */ + @NotNull + public String getMapPath() { + return mapPath; + } + +} // class CannotLoadMapFile Property changes on: trunk/src/app/net/sf/gridarta/actions/CannotLoadMapFileException.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/actions/CannotSaveMapFileException.java =================================================================== --- trunk/src/app/net/sf/gridarta/actions/CannotSaveMapFileException.java (rev 0) +++ trunk/src/app/net/sf/gridarta/actions/CannotSaveMapFileException.java 2010-05-13 13:51:09 UTC (rev 7737) @@ -0,0 +1,62 @@ +/* + * 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.actions; + +import java.io.File; +import java.io.IOException; +import org.jetbrains.annotations.NotNull; + +/** + * Exception thrown if a map file cannot be saved. + * @author Andreas Kirschbaum + */ +public class CannotSaveMapFileException extends IOException { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The map file that could not be saved. + */ + @NotNull + private final File mapFile; + + /** + * Creates a new instance. + * @param mapFile the map file that could not be saved + * @param cause the cause why the map file could not be saved + */ + public CannotSaveMapFileException(@NotNull final File mapFile, @NotNull final Throwable cause) { + super(mapFile.getPath(), cause); + this.mapFile = mapFile; + } + + /** + * Returns the map file that could not be saved. + * @return the map file + */ + @NotNull + public File getMapFile() { + return mapFile; + } + +} // class CannotLoadMapFile Property changes on: trunk/src/app/net/sf/gridarta/actions/CannotSaveMapFileException.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/actions/InvalidPathNameException.java =================================================================== --- trunk/src/app/net/sf/gridarta/actions/InvalidPathNameException.java (rev 0) +++ trunk/src/app/net/sf/gridarta/actions/InvalidPathNameException.java 2010-05-13 13:51:09 UTC (rev 7737) @@ -0,0 +1,45 @@ +/* + * 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.actions; + +import java.io.File; +import org.jetbrains.annotations.NotNull; + +/** + * Exception thrown if a map path cannot be converted. + * @author Andreas Kirschbaum + */ +public class InvalidPathNameException extends Exception { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance. + * @param file the file that could not be converted + * @param cause the cause + */ + public InvalidPathNameException(@NotNull final File file, @NotNull final Throwable cause) { + super(file.getPath(), cause); + } + +} // class InvalidPathNameException Property changes on: trunk/src/app/net/sf/gridarta/actions/InvalidPathNameException.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/actions/MapSizeMismatchException.java =================================================================== --- trunk/src/app/net/sf/gridarta/actions/MapSizeMismatchException.java (rev 0) +++ trunk/src/app/net/sf/gridarta/actions/MapSizeMismatchException.java 2010-05-13 13:51:09 UTC (rev 7737) @@ -0,0 +1,94 @@ +/* + * 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.actions; + +import java.io.File; +import net.sf.gridarta.utils.Size2D; +import org.jetbrains.annotations.NotNull; + +/** + * Exception thrown if the size of a map file is unexpected. + * @author Andreas Kirschbazm + */ +public class MapSizeMismatchException extends Exception { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The map {@link File} of the first map. + */ + @NotNull + private final File mapFile; + + /** + * The size of the first map. + */ + @NotNull + private final Size2D mapSize; + + /** + * The size of the second map. + */ + @NotNull + private final Size2D otherMapSize; + + /** + * Creates a new instance. + * @param mapFile the map file of the first map + * @param mapSize the size of the first map + * @param otherMapSize the size of the second map + */ + public MapSizeMismatchException(@NotNull final File mapFile, @NotNull final Size2D mapSize, @NotNull final Size2D otherMapSize) { + this.mapFile = mapFile; + this.mapSize = mapSize; + this.otherMapSize = otherMapSize; + } + + /** + * Returns the map {@link File} of the first map. + * @return the map control + */ + @NotNull + public File getMapFile() { + return mapFile; + } + + /** + * Returns the size of the first map. + * @return the size + */ + @NotNull + public Size2D getMapSize() { + return mapSize; + } + + /** + * Returns the size of the second map. + * @return the size + */ + @NotNull + public Size2D getOtherMapSize() { + return otherMapSize; + } + +} // class MapSizeMismatchException Property changes on: trunk/src/app/net/sf/gridarta/actions/MapSizeMismatchException.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF 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:19:17 UTC (rev 7736) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 13:51:09 UTC (rev 7737) @@ -23,14 +23,17 @@ import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.io.File; -import java.io.IOException; -import java.util.regex.Matcher; import javax.swing.BorderFactory; import javax.swing.JButton; import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.border.CompoundBorder; import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.actions.AttachTiledMaps; +import net.sf.gridarta.actions.CannotLoadMapFileException; +import net.sf.gridarta.actions.CannotSaveMapFileException; +import net.sf.gridarta.actions.InvalidPathNameException; +import net.sf.gridarta.actions.MapSizeMismatchException; import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.utils.DirectionLayout; import net.sf.gridarta.gui.utils.GUIConstants; @@ -38,22 +41,15 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; 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.normalizer.IOErrorException; -import net.sf.gridarta.model.map.normalizer.InvalidPathException; 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; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * A Panel for managing the tiling of maps. It creates a Panel for a map where @@ -78,12 +74,6 @@ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** - * The mainControl to use. - */ - @NotNull - private final MapManager<G, A, R> mapManager; - - /** * The global settings instance. */ @NotNull @@ -120,12 +110,6 @@ private final FileFilter mapFileFilter; /** - * The {@link MapPathNormalizer} for converting map paths to {@link File}s. - */ - @NotNull - private final MapPathNormalizer mapPathNormalizer; - - /** * The {@link MapViewsManager}. */ @NotNull @@ -137,6 +121,9 @@ @NotNull public final TilePanel[] tilePaths; + @NotNull + private final AttachTiledMaps<G, A, R> attachTiledMaps; + /** * Whether "attach maps" function is available. */ @@ -156,15 +143,14 @@ * @param mapViewsManager the map views */ protected AbstractMapTilePane(@NotNull final MapManager<G, A, R> mapManager, @NotNull final GlobalSettings globalSettings, @NotNull final MapModel<G, A, R> mapModel, @NotNull final MapLink[][] tileLink, @NotNull final DirectionLayout.Direction[] directionMapping, @NotNull final int[] nextFocus, @NotNull final FileFilter mapFileFilter, @NotNull final MapPathNormalizer mapPathNormalizer, @NotNull final MapViewsManager<G, A, R> mapViewsManager) { - this.mapManager = mapManager; this.globalSettings = globalSettings; this.mapModel = mapModel; this.nextFocus = nextFocus; this.mapFileFilter = mapFileFilter; - this.mapPathNormalizer = mapPathNormalizer; this.mapViewsManager = mapViewsManager; assert tileLink.length == 8; tileLinks = new TileLink[] { newTileLink("mapNorth", tileLink[0], CommonConstants.SOUTH), newTileLink("mapEast", tileLink[1], CommonConstants.WEST), newTileLink("mapSouth", tileLink[2], CommonConstants.NORTH), newTileLink("mapWest", tileLink[3], CommonConstants.EAST), newTileLink("mapNorthEast", tileLink[4], CommonConstants.SOUTH_WEST), newTileLink("mapSouthEast", tileLink[5], CommonConstants.NORTH_WEST), newTileLink("mapSouthWest", tileLink[6], CommonConstants.NORTH_EAST), newTileLink("mapNorthWest", tileLink[7], CommonConstants.SOUTH_EAST), }; + attachTiledMaps = new AttachTiledMaps<G, A, R>(mapManager, tileLinks, mapPathNormalizer); 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(); @@ -265,7 +251,29 @@ * Action method for tiles attaching automatically. */ public void mapTilesAttach() { - attachTiledMap(); + final String[] tmpTilePaths = new String[tilePaths.length]; + for (int i = 0; i < tmpTilePaths.length; i++) { + tmpTilePaths[i] = tilePaths[i].getText(); + } + final File mapsDirectory = globalSettings.getMapsDirectory(); + try { + attachTiledMaps.attachTiledMaps(mapModel, tmpTilePaths, mapsDirectory, true); + } catch (final CannotLoadMapFileException ex) { + ACTION_BUILDER.showMessageDialog(this, "mapErrorPath2", ex.getMapPath()); // XXX: ignores ex.getMessage() + return; + } catch (final CannotSaveMapFileException ex) { + ACTION_BUILDER.showMessageDialog(this, "mapErrorFatalWrite", ex.getMessage()); // XXX: ignores ex.getMapFile() + return; + } catch (final InvalidPathNameException ex) { + ACTION_BUILDER.showMessageDialog(this, "mapErrorFatalPath", ex.getMessage()); + return; + } catch (final MapSizeMismatchException ex) { + ACTION_BUILDER.showMessageDialog(this, "mapErrorDifferentSize", mapModel.getMapArchObject().getMapName(), ex.getMapSize().getWidth(), ex.getMapSize().getHeight(), ex.getMapFile(), ex.getOtherMapSize().getWidth(), ex.getOtherMapSize().getHeight()); + return; + } + for (int i = 0; i < tmpTilePaths.length; i++) { + tilePaths[i].setText(tmpTilePaths[i], true); + } } /** @@ -278,274 +286,6 @@ } /** - * Looks for all maps surrounding the current map and tries to perform the - * reverse attachment. - * @fixme If you think this method sucks for it's complexity, you're right. - * This method needs refactoring badly. - * @fixme I think this method might fail in case one of the other maps this - * map is linked to is currently loaded. This needs verification. - */ - private void attachTiledMap() { - if (mapModel.getMapFile() == null) { // map is created but was never saved - ACTION_BUILDER.showMessageDialog(this, "mapErrorUnsaved"); - return; - } - - 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 - if (!loadAdjacentMaps(mapControls)) { - return; - } - - // We have loaded all direct linked maps around our map. - // now, lets check free spaces. - if (!fillAdjacentMaps(mapControls)) { - return; - } - - if (!validateMapSizes(mapControls)) { - return; - } - - // finally... set the links! - if (!updateTilePaths(mapControls)) { - return; - } - - // all done! now we write all back - saveAdjacentMaps(mapControls); - } finally { - for (final MapControl<G, A, R> mapControl : mapControls) { - if (mapControl != null) { - mapManager.release(mapControl); - } - } - } - } - - /** - * 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 - */ - 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; - } - - /** - * 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 - */ - 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. - * @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; - } - - /** - * 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 - * @return the map control or <code>null</code> if the map cannot be loaded - * @throws IOException if an I/O error occurs - */ - @Nullable - private MapControl<G, A, R> loadMapControl(@NotNull final MapModel<G, A, R> mapModel, @NotNull final String path) throws IOException { - final File file; - try { - file = mapPathNormalizer.normalizeMapPath(mapModel, path); - } catch (final InvalidPathException ex) { - return null; - } catch (final IOErrorException ex) { - return null; - } catch (final RelativePathOnUnsavedMapException ex) { - return null; - } catch (final SameMapException ex) { - return null; - } - return mapManager.openMapFile(file, false); - } - - /** - * Returns the map path for a tile of a map and a tile path. - * @param base the map path of the map - * @param link the tile path of the map; may be relative to - * <code>base</code> - * @return the map path - */ - @Nullable - private String getTilePath(@NotNull final String base, @NotNull final String link) { - final int pos = getLastSlashIndex(base); - final int pos2 = getLastSlashIndex(link); - final String first; - final String second; - final CharSequence mapdir; - - try { - mapdir = globalSettings.getMapsDirectory().getCanonicalPath(); - first = base.substring(mapdir.length(), pos).trim(); - second = link.substring(mapdir.length(), pos2).trim(); - } catch (final IOException e) { - ACTION_BUILDER.showMessageDialog(this, "mapErrorFatalWrite", e.getMessage()); - return null; - } - - final String sep = Matcher.quoteReplacement(File.separator); - - /* our map is in root - second is higher or same map */ - if (first.length() == 0) { - return link.substring(mapdir.length()).trim().replaceAll(sep, "/"); - } - // same folder... we return the name without '/' - if (first.compareTo(second) == 0) { - return link.substring(pos2 + 1).trim().replaceAll(sep, "/"); - } - // second is subfolder of first - if (second.startsWith(first)) { - return link.substring(pos + 1).trim().replaceAll(sep, "/"); - } - // in any other case we return a absolute path - return link.substring(mapdir.length()).trim().replaceAll(sep, "/"); - } - - /** - * Returns the index of the last '/' or {@link File#separator} within a - * string. - * @param base the string - * @return the index or <code>-1</code> if not found - */ - private static int getLastSlashIndex(@NotNull final String base) { - final int slashIndex1 = base.lastIndexOf('/'); - final int separatorIndex1 = base.lastIndexOf(File.separator); - int pos = slashIndex1; - if (separatorIndex1 > slashIndex1) { - pos = separatorIndex1; - } - return pos; - } - - /** * Invoke this method if the dialog using this pane is confirmed with OK to * write the information from this pane back to the map. */ Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2010-05-13 13:19:17 UTC (rev 7736) +++ trunk/src/app/net/sf/gridarta/messages.properties 2010-05-13 13:51:09 UTC (rev 7737) @@ -421,16 +421,12 @@ mapTilesAttach.shortdescription=Automatically attach the map in all possible directions mapTilesClear.text=Clear Paths mapTilesClear.shortdescription=Clear all path names -mapErrorUnsaved.title=Missing file path -mapErrorUnsaved.message=Can''t attach unsaved map.\nMap must be saved to the map folder first! mapQueryLoaded.title=Map is loaded mapQueryLoaded.message=The map {0} is opened in the editor.\nShould I autosave & update the map? mapErrorPath2.title=Can''t find map mapErrorPath2.message=Please check your map file path: "{0}". mapErrorInvalid.title=Invalid tile link mapErrorInvalid.message=In {0}: {1}\nthe link to {2} is invalid.\nLink to {3} is {4}\ngenerated link:{5}\nShould we stop attaching? -mapErrorFatalPath.title=Can''t get path -mapErrorFatalPath.message=Can''t get path\nFatal Error:\n{0} mapErrorFatalWrite.title=Can''t write map mapErrorFatalWrite.message=Can''t write map\nFatal Error:\n{0} mapErrorDifferentSize.title=Different size Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-13 13:19:17 UTC (rev 7736) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-13 13:51:09 UTC (rev 7737) @@ -399,16 +399,12 @@ mapTilesAttach.shortdescription=Verbindet die Karte automatisch in allen Richtungen mit ihren benachbarten Karten. mapTilesClear.text=Pfade l\xF6schen mapTilesClear.shortdescription=L\xF6scht die Verbindungspfade zu den benachbarten Karten. -mapErrorUnsaved.title=Fehlender Dateipfad -mapErrorUnsaved.message=Kann ungespeicherte Karte nicht verbinden.\nDie Karte muss zuerst im Kartenverzeichnis gespeichert werden! mapQueryLoaded.title=Karte ist ge\xF6ffnet mapQueryLoaded.message=Die Karte {0} ist im Editor ge\xF6ffnet.\nSoll ich sie automatisch speichern und aktualisieren? mapErrorPath2.title=Karte nicht gefunden mapErrorPath2.message=Bitte \xFCberpr\xFCfe den Dateipfad f\xFCr die Karte: "{0}}". mapErrorInvalid.title=Ung\xFCltiger Kartenpfad mapErrorInvalid.message=In {0}: {1}\nder Pfad zu {2} ist ung\xFCltig.\nDer Pfad nach {3} ist {4}\nErzeugter Pfad:{5}\nVerbinden abbrechen? -mapErrorFatalPath.title=Fehler -mapErrorFatalPath.message=Fehler beim Erzeugen des Pfadnamens:\n{0} mapErrorFatalWrite.title=Fehler beim Speichern mapErrorFatalWrite.message=Die Karte kann nicht gespeichert werden:\n{0} mapErrorDifferentSize.title=Unterschiedliche Gr\xF6\xDFe Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-05-13 13:19:17 UTC (rev 7736) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-05-13 13:51:09 UTC (rev 7737) @@ -394,16 +394,12 @@ #mapTilesAttach.shortdescription= #mapTilesClear.text= #mapTilesClear.shortdescription= -#mapErrorUnsaved.title= -#mapErrorUnsaved.message= #mapQueryLoaded.title= #mapQueryLoaded.message= #mapErrorPath2.title= #mapErrorPath2.message= #mapErrorInvalid.title= #mapErrorInvalid.message= -#mapErrorFatalPath.title= -#mapErrorFatalPath.message= #mapErrorFatalWrite.title= #mapErrorFatalWrite.message= #mapErrorDifferentSize.title= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-05-13 13:19:17 UTC (rev 7736) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-05-13 13:51:09 UTC (rev 7737) @@ -397,16 +397,12 @@ mapTilesAttach.shortdescription=Automatiskt anslut kartan till alla n\xE4rliggande kartor i alla riktningar. mapTilesClear.text=Rensa s\xF6kv\xE4gar mapTilesClear.shortdescription=T\xF6m alla s\xF6kv\xE4gar -mapErrorUnsaved.title=S\xF6kv\xE4g saknas -mapErrorUnsaved.message=Kan inte ansluta till ej sparad karta.\nKartan m\xE5ste sparas i kartkatalogen f\xF6rst. mapQueryLoaded.title=Kartan \xE4r inladdad mapQueryLoaded.message=Kartan {0} \xE4r \xF6ppen i editorn.\nSka jag autospara och uppdatera den? mapErrorPath2.title=Kan inte hitta karta mapErrorPath2.message=Var v\xE4nlig kontrollera s\xF6kv\xE4gen: "{0}". mapErrorInvalid.title=Ogiltig anslutning till n\xE4rliggande karta mapErrorInvalid.message=I {0}: {1}\nanslutningen till {2} \xE4r ogiltig.\nAnslutningen till {3} \xE4r {4}\ngenererad anslutning:{5}\nSka jag avbryta anslutningen? -mapErrorFatalPath.title=Kan inte h\xE4mta s\xF6kv\xE4g -mapErrorFatalPath.message=Kan inte h\xE4mta s\xF6kv\xE4g\n\xD6desdigert fel:\n{0} mapErrorFatalWrite.title=Kan inte skriva karta mapErrorFatalWrite.message=Kan inte skriva karta\n\xD6desdigert fel:\n{0} mapErrorDifferentSize.title=Olika storlek 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:19:23
|
Revision: 7736 http://gridarta.svn.sourceforge.net/gridarta/?rev=7736&view=rev Author: akirschbaum Date: 2010-05-13 13:19:17 +0000 (Thu, 13 May 2010) Log Message: ----------- Merge duplicated code; fix possible NullPointerException. 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 13:13:31 UTC (rev 7735) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-05-13 13:19:17 UTC (rev 7736) @@ -164,7 +164,7 @@ this.mapPathNormalizer = mapPathNormalizer; this.mapViewsManager = mapViewsManager; assert tileLink.length == 8; - 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), }; + tileLinks = new TileLink[] { newTileLink("mapNorth", tileLink[0], CommonConstants.SOUTH), newTileLink("mapEast", tileLink[1], CommonConstants.WEST), newTileLink("mapSouth", tileLink[2], CommonConstants.NORTH), newTileLink("mapWest", tileLink[3], CommonConstants.EAST), newTileLink("mapNorthEast", tileLink[4], CommonConstants.SOUTH_WEST), newTileLink("mapSouthEast", tileLink[5], CommonConstants.NORTH_WEST), newTileLink("mapSouthWest", tileLink[6], CommonConstants.NORTH_EAST), newTileLink("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(); @@ -178,6 +178,21 @@ } /** + * Creates a new {@link TileLink}. + * @param key the resource key + * @param revLink direction for reverse map linking + * @return the new instance + */ + @NotNull + private TileLink newTileLink(@NotNull final String key, @NotNull final MapLink[] mapLinks, final int revLink) { + final String name = ACTION_BUILDER.getString(key); + if (name == null) { + throw new IllegalArgumentException("resource key '" + key + "' does not exist"); + } + return new TileLink(name, mapLinks, revLink); + } + + /** * Builds the components of this panel. * @param directionMapping maps direction to direction layout direction * @return the JTextFields with the tile paths This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |