From: <aki...@us...> - 2010-06-27 20:17:41
|
Revision: 8525 http://gridarta.svn.sourceforge.net/gridarta/?rev=8525&view=rev Author: akirschbaum Date: 2010-06-27 20:17:34 +0000 (Sun, 27 Jun 2010) Log Message: ----------- Improve --script command-line option to report some plugin script errors to the operating system. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/commands/ScriptCommand.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/atrinik/ChangeLog 2010-06-27 20:17:34 UTC (rev 8525) @@ -1,5 +1,8 @@ 2010-06-27 Andreas Kirschbaum + * Improve --script command-line option to report some plugin + script errors to the operating system. + * Include details in error messages of "Tile path invalid" map validator. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/crossfire/ChangeLog 2010-06-27 20:17:34 UTC (rev 8525) @@ -1,5 +1,8 @@ 2010-06-27 Andreas Kirschbaum + * Improve --script command-line option to report some plugin + script errors to the operating system. + * Include details in error messages of "Tile path invalid" map validator. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/daimonin/ChangeLog 2010-06-27 20:17:34 UTC (rev 8525) @@ -1,5 +1,8 @@ 2010-06-27 Andreas Kirschbaum + * Improve --script command-line option to report some plugin + script errors to the operating system. + * Include details in error messages of "Tile path invalid" map validator. Deleted: trunk/src/app/net/sf/gridarta/commands/ScriptCommand.java =================================================================== --- trunk/src/app/net/sf/gridarta/commands/ScriptCommand.java 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/src/app/net/sf/gridarta/commands/ScriptCommand.java 2010-06-27 20:17:34 UTC (rev 8525) @@ -1,76 +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.commands; - -import net.sf.gridarta.script.ScriptExecException; -import net.sf.gridarta.script.ScriptExecutor; -import org.jetbrains.annotations.NotNull; - -/** - * Executes a plugin script. - * @author Andreas Kirschbaum - */ -public class ScriptCommand implements Command { - - /** - * The script to execute. - */ - @NotNull - private final String script; - - /** - * The script parameters. - */ - @NotNull - private final Iterable<String> params; - - /** - * The {@link ScriptExecutor} to execute. - */ - @NotNull - private final ScriptExecutor<?, ?, ?> scriptExecutor; - - /** - * Creates a new instance. - * @param script the script to execute - * @param params the script parameters - * @param scriptExecutor the script executor to use - */ - public ScriptCommand(@NotNull final String script, @NotNull final Iterable<String> params, @NotNull final ScriptExecutor<?, ?, ?> scriptExecutor) { - this.script = script; - this.params = params; - this.scriptExecutor = scriptExecutor; - } - - /** - * {@inheritDoc} - */ - @Override - public int execute() { - try { - scriptExecutor.executeScript(script, params); - } catch (final ScriptExecException ex) { - System.err.println(ex.getMessage()); - return 1; - } - return 0; - } - -} // class ScriptCommand Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-06-27 20:17:34 UTC (rev 8525) @@ -35,8 +35,6 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.commands.BatchPngCommand; import net.sf.gridarta.commands.CollectArchesCommand; -import net.sf.gridarta.commands.Command; -import net.sf.gridarta.commands.ScriptCommand; import net.sf.gridarta.commands.SinglePngCommand; import net.sf.gridarta.gui.errorview.ConsoleErrorView; import net.sf.gridarta.gui.errorview.DefaultErrorView; @@ -90,6 +88,7 @@ import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; import net.sf.gridarta.preferences.FilePreferencesFactory; +import net.sf.gridarta.script.ScriptExecException; import net.sf.gridarta.script.ScriptExecutor; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptParameters; @@ -343,12 +342,18 @@ * @param scriptExecutor the script executor to use * @return return code suitable for passing to {@link System#exit(int)} */ - private int runScript(@NotNull final String script, final ErrorView errorView, final List<String> args, @NotNull final ScriptExecutor<G, A, R> scriptExecutor) { + private int runScript(@NotNull final String script, final ErrorView errorView, final Iterable<String> args, @NotNull final ScriptExecutor<G, A, R> scriptExecutor) { checkForErrors(errorView); waitDialog(errorView); - final Command command = new ScriptCommand(script, args, scriptExecutor); - return command.execute(); + try { + scriptExecutor.executeScript(script, args); + } catch (final ScriptExecException ex) { + System.err.println(ex.getMessage()); + return 1; + } + + return 0; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-27 20:27:33
|
Revision: 8527 http://gridarta.svn.sourceforge.net/gridarta/?rev=8527&view=rev Author: akirschbaum Date: 2010-06-27 20:27:26 +0000 (Sun, 27 Jun 2010) Log Message: ----------- Improve --script command-line option to report plugin script errors to the operating system. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/script/BshThread.java trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-06-27 20:25:56 UTC (rev 8526) +++ trunk/atrinik/ChangeLog 2010-06-27 20:27:26 UTC (rev 8527) @@ -1,7 +1,7 @@ 2010-06-27 Andreas Kirschbaum - * Improve --script command-line option to report some plugin - script errors to the operating system. + * Improve --script command-line option to report plugin script + errors to the operating system. * Include details in error messages of "Tile path invalid" map validator. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-06-27 20:25:56 UTC (rev 8526) +++ trunk/crossfire/ChangeLog 2010-06-27 20:27:26 UTC (rev 8527) @@ -1,7 +1,7 @@ 2010-06-27 Andreas Kirschbaum - * Improve --script command-line option to report some plugin - script errors to the operating system. + * Improve --script command-line option to report plugin script + errors to the operating system. * Include details in error messages of "Tile path invalid" map validator. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-06-27 20:25:56 UTC (rev 8526) +++ trunk/daimonin/ChangeLog 2010-06-27 20:27:26 UTC (rev 8527) @@ -1,7 +1,7 @@ 2010-06-27 Andreas Kirschbaum - * Improve --script command-line option to report some plugin - script errors to the operating system. + * Improve --script command-line option to report plugin script + errors to the operating system. * Include details in error messages of "Tile path invalid" map validator. Modified: trunk/src/app/net/sf/gridarta/script/BshThread.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/BshThread.java 2010-06-27 20:25:56 UTC (rev 8526) +++ trunk/src/app/net/sf/gridarta/script/BshThread.java 2010-06-27 20:27:26 UTC (rev 8527) @@ -43,6 +43,11 @@ private final Interpreter interpreter; /** + * Whether the script has been executed successfully. + */ + private boolean success = false; + + /** * Create a BshThread with name. * @param name Name to assign to the BshThread. * @param script ScriptModel for this BshThread. @@ -62,9 +67,18 @@ try { interpreter.set("scriptThread", this); interpreter.eval(script.getCode()); + success = true; } catch (final EvalError e) { e.printStackTrace(interpreter.getErr()); } } + /** + * Returns whether the script has been executed successfully. + * @return whether the script has been executed successfully + */ + public boolean isSuccess() { + return success; + } + } // class BshThread Modified: trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java 2010-06-27 20:25:56 UTC (rev 8526) +++ trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java 2010-06-27 20:27:26 UTC (rev 8527) @@ -145,13 +145,18 @@ } }; - final Thread scriptThread = doRunScript(clonedScript, console); + final BshThread<G, A, R> scriptThread = doRunScript(clonedScript, console); try { scriptThread.join(); - } catch (final InterruptedException ignored) { + } catch (final InterruptedException ex) { scriptThread.interrupt(); Thread.currentThread().interrupt(); + throw new ScriptExecException("interrupted", ex); } + + if (!scriptThread.isSuccess()) { + throw new ScriptExecException("script failed"); + } } /** @@ -163,7 +168,7 @@ * @throws ScriptExecException if an error occurs */ @NotNull - public Thread doRunScript(@NotNull final Script<G, A, R> script, @NotNull final ConsoleInterface console) throws ScriptExecException { + public BshThread<G, A, R> doRunScript(@NotNull final Script<G, A, R> script, @NotNull final ConsoleInterface console) throws ScriptExecException { final Interpreter runner = new Interpreter(); runner.setConsole(console); try { @@ -187,7 +192,7 @@ } catch (final EvalError ex) { throw new ScriptExecException("evaluation error: " + ex.getMessage(), ex); } - final Thread scriptThread = new BshThread<G, A, R>(script.getName(), script, runner); + final BshThread<G, A, R> scriptThread = new BshThread<G, A, R>(script.getName(), script, runner); scriptThread.start(); return scriptThread; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-27 20:59:00
|
Revision: 8528 http://gridarta.svn.sourceforge.net/gridarta/?rev=8528&view=rev Author: akirschbaum Date: 2010-06-27 20:58:53 +0000 (Sun, 27 Jun 2010) Log Message: ----------- Add regression tests for map validators. Modified Paths: -------------- trunk/build.xml Added Paths: ----------- trunk/test-mapvalidator/ trunk/test-mapvalidator/arch/ trunk/test-mapvalidator/arch/altar.base.111.png trunk/test-mapvalidator/arch/altar.face trunk/test-mapvalidator/arch/altar1.arc trunk/test-mapvalidator/arch/altar2.face trunk/test-mapvalidator/arch/door1.arc trunk/test-mapvalidator/arch/door2.arc trunk/test-mapvalidator/arch/exit1.arc trunk/test-mapvalidator/arch/gate1.arc trunk/test-mapvalidator/arch/mob1.arc trunk/test-mapvalidator/arch/rod1.arc trunk/test-mapvalidator/arch/shop1.arc trunk/test-mapvalidator/arch/shop2.arc trunk/test-mapvalidator/maps/ trunk/test-mapvalidator/maps/AttributeRange trunk/test-mapvalidator/maps/AttributeRange.expected trunk/test-mapvalidator/maps/ConnectedInsideContainer trunk/test-mapvalidator/maps/ConnectedInsideContainer.expected trunk/test-mapvalidator/maps/ConnectedPickable trunk/test-mapvalidator/maps/ConnectedPickable.expected trunk/test-mapvalidator/maps/Connection trunk/test-mapvalidator/maps/Connection.expected trunk/test-mapvalidator/maps/CustomType trunk/test-mapvalidator/maps/CustomType.expected trunk/test-mapvalidator/maps/Exit trunk/test-mapvalidator/maps/Exit.expected trunk/test-mapvalidator/maps/MapDifficulty trunk/test-mapvalidator/maps/MapDifficulty.expected trunk/test-mapvalidator/maps/NonAbsoluteExitPath trunk/test-mapvalidator/maps/NonAbsoluteExitPath.expected trunk/test-mapvalidator/maps/PaidItemShopSquare trunk/test-mapvalidator/maps/PaidItemShopSquare.expected trunk/test-mapvalidator/maps/ShopSquare trunk/test-mapvalidator/maps/ShopSquare.expected trunk/test-mapvalidator/maps/TilePaths trunk/test-mapvalidator/maps/TilePaths.expected trunk/test-mapvalidator/maps/UndefinedArchetype trunk/test-mapvalidator/maps/UndefinedArchetype.expected trunk/test-mapvalidator/maps/UndefinedFace trunk/test-mapvalidator/maps/UndefinedFace.expected trunk/test-mapvalidator/maps/UnsetSlaying trunk/test-mapvalidator/maps/UnsetSlaying.expected trunk/test-mapvalidator/maps/editor/ trunk/test-mapvalidator/maps/editor/pickmaps/ trunk/test-mapvalidator/maps/editor/scripts/ trunk/test-mapvalidator/maps/editor/scripts/MapValidator trunk/test-mapvalidator/regtest.conf Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2010-06-27 20:27:26 UTC (rev 8527) +++ trunk/build.xml 2010-06-27 20:58:53 UTC (rev 8528) @@ -833,7 +833,9 @@ </javadoc> </target> - <target name="test" description="Executes the junit tests." depends="test-atrinik,test-crossfire,test-daimonin,test-gridarta,test-model,test-preferences,test-textedit,test-utils"> + <target name="test" description="Executes all tests." depends="test-junit,test-mapvalidator"/> + + <target name="test-junit" description="Executes the junit tests." depends="test-atrinik,test-crossfire,test-daimonin,test-gridarta,test-model,test-preferences,test-textedit,test-utils"> <junitreport todir="docs/test"> <fileset dir="docs/test"> <include name="TEST-*.xml"/> @@ -1029,4 +1031,11 @@ </junit> </target> + <target name="test-mapvalidator" description="Executes the map validator tests." depends="jar-crossfire"> + <java jar="CrossfireEditor.jar" failonerror="true" fork="true"> + <arg value="--config=test-mapvalidator/regtest.conf"/> + <arg value="--script=MapValidator"/> + </java> + </target> + </project> Added: trunk/test-mapvalidator/arch/altar.base.111.png =================================================================== (Binary files differ) Property changes on: trunk/test-mapvalidator/arch/altar.base.111.png ___________________________________________________________________ Added: svn:mime-type + image/png Added: trunk/test-mapvalidator/arch/altar.face =================================================================== --- trunk/test-mapvalidator/arch/altar.face (rev 0) +++ trunk/test-mapvalidator/arch/altar.face 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,5 @@ +animation altar +altar.111 +mina +face altar.111 +end Property changes on: trunk/test-mapvalidator/arch/altar.face ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/arch/altar1.arc =================================================================== --- trunk/test-mapvalidator/arch/altar1.arc (rev 0) +++ trunk/test-mapvalidator/arch/altar1.arc 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,5 @@ +Object altar1 +type 18 +no_pick 1 +food 1 +end Property changes on: trunk/test-mapvalidator/arch/altar1.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/arch/altar2.face =================================================================== --- trunk/test-mapvalidator/arch/altar2.face (rev 0) +++ trunk/test-mapvalidator/arch/altar2.face 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,5 @@ +animation altar2 +altar.112 +mina +face altar.112 +end Property changes on: trunk/test-mapvalidator/arch/altar2.face ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/arch/door1.arc =================================================================== --- trunk/test-mapvalidator/arch/door1.arc (rev 0) +++ trunk/test-mapvalidator/arch/door1.arc 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,4 @@ +Object door1 +type 20 +slaying unset_value +end Property changes on: trunk/test-mapvalidator/arch/door1.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/arch/door2.arc =================================================================== --- trunk/test-mapvalidator/arch/door2.arc (rev 0) +++ trunk/test-mapvalidator/arch/door2.arc 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,4 @@ +Object door2 +type 20 +slaying player +end Property changes on: trunk/test-mapvalidator/arch/door2.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/arch/exit1.arc =================================================================== --- trunk/test-mapvalidator/arch/exit1.arc (rev 0) +++ trunk/test-mapvalidator/arch/exit1.arc 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,4 @@ +Object exit1 +type 66 +no_pick 1 +end Property changes on: trunk/test-mapvalidator/arch/exit1.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/arch/gate1.arc =================================================================== --- trunk/test-mapvalidator/arch/gate1.arc (rev 0) +++ trunk/test-mapvalidator/arch/gate1.arc 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,4 @@ +Object gate1 +type 91 +no_pick 1 +end Property changes on: trunk/test-mapvalidator/arch/gate1.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/arch/mob1.arc =================================================================== --- trunk/test-mapvalidator/arch/mob1.arc (rev 0) +++ trunk/test-mapvalidator/arch/mob1.arc 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,5 @@ +Object mob1 +alive 1 +monster 1 +level 1 +end Property changes on: trunk/test-mapvalidator/arch/mob1.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/arch/rod1.arc =================================================================== --- trunk/test-mapvalidator/arch/rod1.arc (rev 0) +++ trunk/test-mapvalidator/arch/rod1.arc 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,4 @@ +Object rod1 +type 3 +level 1 +end Property changes on: trunk/test-mapvalidator/arch/rod1.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/arch/shop1.arc =================================================================== --- trunk/test-mapvalidator/arch/shop1.arc (rev 0) +++ trunk/test-mapvalidator/arch/shop1.arc 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,4 @@ +Object shop1 +type 68 +no_pick 1 +end Property changes on: trunk/test-mapvalidator/arch/shop1.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/arch/shop2.arc =================================================================== --- trunk/test-mapvalidator/arch/shop2.arc (rev 0) +++ trunk/test-mapvalidator/arch/shop2.arc 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,6 @@ +Object shop2 +type 68 +damned 1 +no_magic 1 +no_pick 1 +end Property changes on: trunk/test-mapvalidator/arch/shop2.arc ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/AttributeRange =================================================================== --- trunk/test-mapvalidator/maps/AttributeRange (rev 0) +++ trunk/test-mapvalidator/maps/AttributeRange 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,55 @@ +arch map +name test for AttributeRange map validator +difficulty 1 +width 6 +height 2 +msg +Created: 2010-06-24 Andreas Kirschbaum +endmsg +end +arch rod1 +level 0 +end +arch mob1 +y 1 +level 0 +end +arch rod1 +x 1 +end +arch mob1 +x 1 +y 1 +level 1 +end +arch rod1 +x 2 +level 115 +end +arch mob1 +x 2 +y 1 +level 200 +end +arch rod1 +x 3 +level 116 +end +arch mob1 +x 3 +y 1 +level 201 +end +arch mob1 +x 5 +arch rod1 +level 0 +end +end +arch mob1 +x 5 +y 1 +arch mob1 +level 0 +end +end Property changes on: trunk/test-mapvalidator/maps/AttributeRange ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/AttributeRange.expected =================================================================== --- trunk/test-mapvalidator/maps/AttributeRange.expected (rev 0) +++ trunk/test-mapvalidator/maps/AttributeRange.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,6 @@ +[0|0] Suspicious attribute value [rod1] [rod1] [casting level, 0] +[3|0] Suspicious attribute value [rod1] [rod1] [casting level, 116] +[5|0] Suspicious attribute value [rod1] [rod1] [casting level, 0] +[0|1] Suspicious attribute value [mob1] [mob1] [level, 0] +[3|1] Suspicious attribute value [mob1] [mob1] [level, 201] +[5|1] Suspicious attribute value [mob1] [mob1] [level, 0] Property changes on: trunk/test-mapvalidator/maps/AttributeRange.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/ConnectedInsideContainer =================================================================== --- trunk/test-mapvalidator/maps/ConnectedInsideContainer (rev 0) +++ trunk/test-mapvalidator/maps/ConnectedInsideContainer 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,49 @@ +arch map +name test for ConnectedInsideContainer map validator +difficulty 1 +width 2 +height 4 +msg +Created: 2010-06-24 Andreas Kirschbaum +endmsg +end +arch altar1 +connected 1 +end +arch mob1 +y 1 +arch altar1 +connected 1 +end +end +arch altar1 +y 2 +connected 1 +no_pick 0 +end +arch altar1 +y 3 +connected 2 +end +arch gate1 +x 1 +connected 1 +end +arch mob1 +x 1 +y 1 +arch gate1 +connected 1 +end +end +arch gate1 +x 1 +y 2 +connected 1 +no_pick 0 +end +arch gate1 +x 1 +y 3 +connected 3 +end Property changes on: trunk/test-mapvalidator/maps/ConnectedInsideContainer ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/ConnectedInsideContainer.expected =================================================================== --- trunk/test-mapvalidator/maps/ConnectedInsideContainer.expected (rev 0) +++ trunk/test-mapvalidator/maps/ConnectedInsideContainer.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,6 @@ +[0|1] Connected object inside container [altar1] [altar1] +[1|1] Connected object inside container [gate1] [gate1] +[0|2] Pickable connected object [altar1] [altar1] +[1|2] Pickable connected object [gate1] [gate1] +[0|3] Connection without sinks [altar1] [altar1] [2] +[1|3] Connection without sources [gate1] [gate1] [3] Property changes on: trunk/test-mapvalidator/maps/ConnectedInsideContainer.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/ConnectedPickable =================================================================== --- trunk/test-mapvalidator/maps/ConnectedPickable (rev 0) +++ trunk/test-mapvalidator/maps/ConnectedPickable 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,32 @@ +arch map +name test for ConnectedPickable map validator +difficulty 1 +width 3 +height 2 +msg +Created: 2010-06-27 Andreas Kirschbaum +endmsg +end +arch altar1 +connected 1 +move_on walk +end +arch altar1 +x 1 +connected 1 +move_on walk +no_pick 0 +end +arch mob1 +x 1 +y 1 +arch altar1 +connected 1 +move_on walk +no_pick 0 +end +end +arch gate1 +x 2 +connected 1 +end Property changes on: trunk/test-mapvalidator/maps/ConnectedPickable ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/ConnectedPickable.expected =================================================================== --- trunk/test-mapvalidator/maps/ConnectedPickable.expected (rev 0) +++ trunk/test-mapvalidator/maps/ConnectedPickable.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,3 @@ +[1|0] Pickable connected object [altar1] [altar1] +[1|1] Connected object inside container [altar1] [altar1] +[1|1] Pickable connected object [altar1] [altar1] Property changes on: trunk/test-mapvalidator/maps/ConnectedPickable.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/Connection =================================================================== --- trunk/test-mapvalidator/maps/Connection (rev 0) +++ trunk/test-mapvalidator/maps/Connection 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,71 @@ +arch map +name test for Connection map validator +difficulty 1 +width 5 +height 8 +msg +Created: 2010-06-27 Andreas Kirschbaum +endmsg +end +arch altar1 +y 1 +connected 2 +end +arch altar1 +y 3 +connected 4 +end +arch rod1 +y 7 +connected 10 +no_pick 1 +end +arch altar1 +x 1 +connected 1 +end +arch altar1 +x 1 +y 1 +connected 2 +end +arch altar1 +x 1 +y 2 +connected 3 +end +arch altar1 +x 1 +y 3 +connected 4 +end +arch gate1 +x 3 +y 2 +connected 3 +end +arch gate1 +x 3 +y 3 +connected 4 +end +arch gate1 +x 3 +y 5 +connected 6 +end +arch gate1 +x 3 +y 6 +connected 7 +end +arch gate1 +x 4 +y 3 +connected 4 +end +arch gate1 +x 4 +y 5 +connected 6 +end Property changes on: trunk/test-mapvalidator/maps/Connection ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/Connection.expected =================================================================== --- trunk/test-mapvalidator/maps/Connection.expected (rev 0) +++ trunk/test-mapvalidator/maps/Connection.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,5 @@ +[1|0] Connection without sinks [altar1] [altar1] [1] +[0|1 1|1] Connection without sinks [altar1 altar1] [altar1] [altar1] [2] +[3|5 4|5] Connection without sources [gate1 gate1] [gate1] [gate1] [6] +[3|6] Connection without sources [gate1] [gate1] [7] +[0|7] Unexpected connection [rod1] [rod1] Property changes on: trunk/test-mapvalidator/maps/Connection.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/CustomType =================================================================== --- trunk/test-mapvalidator/maps/CustomType (rev 0) +++ trunk/test-mapvalidator/maps/CustomType 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,21 @@ +arch map +name test for CustomType map validator +difficulty 1 +width 3 +height 1 +msg +Created: 2010-06-27 Andreas Kirschbaum +endmsg +end +arch rod1 +end +arch rod1 +x 1 +type 1 +end +arch mob1 +x 2 +arch rod1 +type 1 +end +end Property changes on: trunk/test-mapvalidator/maps/CustomType ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/CustomType.expected =================================================================== --- trunk/test-mapvalidator/maps/CustomType.expected (rev 0) +++ trunk/test-mapvalidator/maps/CustomType.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,2 @@ +[1|0] Object with custom type [rod1] [rod1] [3, 1] +[2|0] Object with custom type [rod1] [rod1] [3, 1] Property changes on: trunk/test-mapvalidator/maps/CustomType.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/Exit =================================================================== --- trunk/test-mapvalidator/maps/Exit (rev 0) +++ trunk/test-mapvalidator/maps/Exit 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,33 @@ +arch map +name test for Exit map validator +difficulty 1 +width 2 +height 6 +msg +Created: 2010-06-27 Andreas Kirschbaum +endmsg +end +arch exit1 +end +arch exit1 +slaying /! +y 1 +end +arch exit1 +slaying /Exit +y 3 +end +arch exit1 +slaying Exit +y 5 +end +arch exit1 +slaying /nonexisting +x 1 +y 2 +end +arch exit1 +slaying nonexisting +x 1 +y 4 +end Property changes on: trunk/test-mapvalidator/maps/Exit ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/Exit.expected =================================================================== --- trunk/test-mapvalidator/maps/Exit.expected (rev 0) +++ trunk/test-mapvalidator/maps/Exit.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,2 @@ +[1|2] Exit path invalid [exit1] [exit1] +[1|4] Exit path invalid [exit1] [exit1] Property changes on: trunk/test-mapvalidator/maps/Exit.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/MapDifficulty =================================================================== --- trunk/test-mapvalidator/maps/MapDifficulty (rev 0) +++ trunk/test-mapvalidator/maps/MapDifficulty 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,8 @@ +arch map +name test for MapDifficulty map validator +width 1 +height 1 +msg +Created: 2010-06-27 Andreas Kirschbaum +endmsg +end Property changes on: trunk/test-mapvalidator/maps/MapDifficulty ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/MapDifficulty.expected =================================================================== --- trunk/test-mapvalidator/maps/MapDifficulty.expected (rev 0) +++ trunk/test-mapvalidator/maps/MapDifficulty.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1 @@ +Map difficulty invalid Property changes on: trunk/test-mapvalidator/maps/MapDifficulty.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/NonAbsoluteExitPath =================================================================== --- trunk/test-mapvalidator/maps/NonAbsoluteExitPath (rev 0) +++ trunk/test-mapvalidator/maps/NonAbsoluteExitPath 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,17 @@ +arch map +name test for NonAbsoluteExitPath map validator +difficulty 1 +width 2 +height 1 +msg +Created: 2010-06-27 Andreas Kirschbaum +endmsg +unique 1 +end +arch exit1 +slaying NonAbsoluteExitPath +end +arch exit1 +slaying /NonAbsoluteExitPath +x 1 +end Property changes on: trunk/test-mapvalidator/maps/NonAbsoluteExitPath ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/NonAbsoluteExitPath.expected =================================================================== --- trunk/test-mapvalidator/maps/NonAbsoluteExitPath.expected (rev 0) +++ trunk/test-mapvalidator/maps/NonAbsoluteExitPath.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1 @@ +[0|0] Exit path is not absolute [exit1] [exit1] [NonAbsoluteExitPath] Property changes on: trunk/test-mapvalidator/maps/NonAbsoluteExitPath.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/PaidItemShopSquare =================================================================== --- trunk/test-mapvalidator/maps/PaidItemShopSquare (rev 0) +++ trunk/test-mapvalidator/maps/PaidItemShopSquare 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,26 @@ +arch map +name test for ShopSquare map validator +difficulty 1 +width 1 +height 3 +msg +Created: 2010-06-27 Andreas Kirschbaum +endmsg +end +arch shop2 +end +arch rod1 +end +arch shop2 +y 1 +end +arch rod1 +y 1 +unpaid 1 +end +arch shop2 +y 2 +end +arch mob1 +y 2 +end Property changes on: trunk/test-mapvalidator/maps/PaidItemShopSquare ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/PaidItemShopSquare.expected =================================================================== --- trunk/test-mapvalidator/maps/PaidItemShopSquare.expected (rev 0) +++ trunk/test-mapvalidator/maps/PaidItemShopSquare.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1 @@ +[0|0] Shop square contains paid item Property changes on: trunk/test-mapvalidator/maps/PaidItemShopSquare.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/ShopSquare =================================================================== --- trunk/test-mapvalidator/maps/ShopSquare (rev 0) +++ trunk/test-mapvalidator/maps/ShopSquare 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,43 @@ +arch map +name test for ShopSquare map validator +difficulty 1 +width 4 +height 2 +msg +Created: 2010-06-27 Andreas Kirschbaum +endmsg +end +arch shop1 +end +arch shop2 +y 1 +no_magic 0 +damned 0 +end +arch shop1 +x 1 +no_magic 1 +end +arch shop2 +x 1 +y 1 +damned 0 +end +arch shop1 +x 2 +damned 1 +end +arch shop2 +x 2 +y 1 +no_magic 0 +end +arch shop1 +x 3 +no_magic 1 +damned 1 +end +arch shop2 +x 3 +y 1 +end Property changes on: trunk/test-mapvalidator/maps/ShopSquare ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/ShopSquare.expected =================================================================== --- trunk/test-mapvalidator/maps/ShopSquare.expected (rev 0) +++ trunk/test-mapvalidator/maps/ShopSquare.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,6 @@ +[0|0] Shop square allows magic and/or prayers +[1|0] Shop square allows magic and/or prayers +[2|0] Shop square allows magic and/or prayers +[0|1] Shop square allows magic and/or prayers +[1|1] Shop square allows magic and/or prayers +[2|1] Shop square allows magic and/or prayers Property changes on: trunk/test-mapvalidator/maps/ShopSquare.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/TilePaths =================================================================== --- trunk/test-mapvalidator/maps/TilePaths (rev 0) +++ trunk/test-mapvalidator/maps/TilePaths 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,13 @@ +arch map +name test for TilePaths map validator +difficulty 1 +width 1 +height 1 +msg +Created: 2010-06-27 Andreas Kirschbaum +endmsg +tile_path_1 nonexistant +tile_path_2 TilePaths +tile_path_3 /TilePaths +tile_path_4 /nonexistant +end Property changes on: trunk/test-mapvalidator/maps/TilePaths ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/TilePaths.expected =================================================================== --- trunk/test-mapvalidator/maps/TilePaths.expected (rev 0) +++ trunk/test-mapvalidator/maps/TilePaths.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,2 @@ +Tile path invalid [NORTH, nonexistant] +Tile path invalid [WEST, /nonexistant] Property changes on: trunk/test-mapvalidator/maps/TilePaths.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/UndefinedArchetype =================================================================== --- trunk/test-mapvalidator/maps/UndefinedArchetype (rev 0) +++ trunk/test-mapvalidator/maps/UndefinedArchetype 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,11 @@ +arch map +name test for UndefinedArchetype map validator +difficulty 1 +width 1 +height 1 +msg +Created: 2010-06-27 Andreas Kirschbaum +endmsg +end +arch undefined +end Property changes on: trunk/test-mapvalidator/maps/UndefinedArchetype ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/UndefinedArchetype.expected =================================================================== --- trunk/test-mapvalidator/maps/UndefinedArchetype.expected (rev 0) +++ trunk/test-mapvalidator/maps/UndefinedArchetype.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1 @@ +[0|0] Undefined archetype [undefined] [undefined] Property changes on: trunk/test-mapvalidator/maps/UndefinedArchetype.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/UndefinedFace =================================================================== --- trunk/test-mapvalidator/maps/UndefinedFace (rev 0) +++ trunk/test-mapvalidator/maps/UndefinedFace 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,40 @@ +arch map +name test for UndefinedFace map validator +difficulty 1 +width 2 +height 4 +msg +Created: 2010-06-27 Andreas Kirschbaum +endmsg +end +arch exit1 +face altar.111 +end +arch exit1 +face altar.112 +y 1 +end +arch exit1 +animation altar +x 1 +is_animated 1 +end +arch exit1 +animation altar2 +x 1 +y 1 +is_animated 1 +end +arch exit1 +animation altar3 +x 1 +y 2 +is_animated 1 +end +arch exit1 +face altar.111 +animation altar3 +x 1 +y 3 +is_animated 1 +end Property changes on: trunk/test-mapvalidator/maps/UndefinedFace ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/UndefinedFace.expected =================================================================== --- trunk/test-mapvalidator/maps/UndefinedFace.expected (rev 0) +++ trunk/test-mapvalidator/maps/UndefinedFace.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,4 @@ +[0|1] Undefined face [exit1] [exit1] [altar.112] +[1|1] Undefined animation [exit1] [exit1] [altar2] +[1|2] Undefined animation [exit1] [exit1] [altar3] +[1|3] Undefined animation [exit1] [exit1] [altar3] Property changes on: trunk/test-mapvalidator/maps/UndefinedFace.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/UnsetSlaying =================================================================== --- trunk/test-mapvalidator/maps/UnsetSlaying (rev 0) +++ trunk/test-mapvalidator/maps/UnsetSlaying 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,37 @@ +arch map +name test for UnsetSlaying map validator +difficulty 1 +width 2 +height 4 +msg +Created: 2010-06-27 Andreas Kirschbaum +endmsg +end +arch door1 +end +arch door1 +slaying unset_value1 +y 1 +end +arch door1 +slaying player +y 2 +end +arch mob1 +y 3 +arch door1 +end +end +arch door2 +x 1 +end +arch door2 +slaying player1 +x 1 +y 1 +end +arch door2 +slaying unset_value +x 1 +y 2 +end Property changes on: trunk/test-mapvalidator/maps/UnsetSlaying ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/UnsetSlaying.expected =================================================================== --- trunk/test-mapvalidator/maps/UnsetSlaying.expected (rev 0) +++ trunk/test-mapvalidator/maps/UnsetSlaying.expected 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,2 @@ +[0|0] Invalid key string [door1] [door1] +[0|3] Invalid key string [door1] [door1] Property changes on: trunk/test-mapvalidator/maps/UnsetSlaying.expected ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/test-mapvalidator/maps/editor/scripts/MapValidator =================================================================== --- trunk/test-mapvalidator/maps/editor/scripts/MapValidator (rev 0) +++ trunk/test-mapvalidator/maps/editor/scripts/MapValidator 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,134 @@ +<?xml version="1.0" encoding="UTF-8"?> +<script> + <name>MapValidator</name> + <code><![CDATA[import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileWriter; +import java.io.InputStream; +import java.util.Iterator; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.RecursiveFileIterator; +import net.sf.gridarta.model.map.validation.ErrorCollector; +import net.sf.gridarta.model.map.validation.errors.ValidationError; + +String checkMap(File mapFile, String mapPath) { + try { + map = mapManager.openMapFile(mapFile, false); + } catch (IOException ex) { + print("Cannot load map '"+mapFile+"': "+ex.getMessage()); + return null; + } + if (map == null) { + print(mapPath + ":"); + print("- cannot load map file"); + return null; + } + + ErrorCollector errorCollector; + try { + try { + validators.validateAll(map.getMapModel()); + } finally { + errorCollector = map.getMapModel().getErrors(); + } + } finally { + mapManager.release(map); + } + + StringBuffer sb = new StringBuffer(); + Iterator it = errorCollector.iterator(); + while (it.hasNext()) { + ValidationError validationError = it.next(); + + sb.append(validationError); + + Iterator it2 = validationError.getGameObjects().iterator(); + while (it2.hasNext()) { + GameObject gameObject = it2.next(); + sb.append(" [").append(gameObject.getBestName()).append(']'); + } + + String parameter0 = validationError.getParameter(0); + if (parameter0 != null) { + sb.append(" [").append(parameter0); + String parameter1 = validationError.getParameter(1); + if (parameter1 != null) { + sb.append(", ").append(parameter1); + } + sb.append(']'); + } + sb.append("\n"); + } + + return sb.toString(); +} + +if (baseDirectory == null || baseDirectory.length() <= 0) { + baseDirectory = "/"; +} +print("Checking maps below " + baseDirectory + "..."); +if (baseDirectory.endsWith("/")) { + baseDirectory = baseDirectory.substring(0, baseDirectory.length() - 1); +} + +String mapDefaultFolder = globalSettings.getMapsDirectory().getPath(); +String rootDirectory = mapDefaultFolder + baseDirectory; +boolean ok = true; +Iterator it = new RecursiveFileIterator(new File(rootDirectory)); +while (it.hasNext()) { + File file = it.next(); + String name = file.getName(); + String path = file.getPath(); + if (file.isFile() + && path.startsWith(rootDirectory) + && !name.endsWith(".expected")) { + File expectedFile = new File(file.getPath() + ".expected"); + if (expectedFile.exists()) { + String result = checkMap(file, file.getPath().substring(mapDefaultFolder.length())); + + final ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); + final InputStream inputStream = new FileInputStream(expectedFile); + try { + final byte[] buf = new byte[1024]; + for (;;) { + final int len = inputStream.read(buf); + if (len == -1) { + break; + } + byteArrayOutputStream.write(buf, 0, len); + } + } finally { + inputStream.close(); + } + final String expected = byteArrayOutputStream.toString("UTF-8"); + if (result.equals(expected)) { + print(file + ": OK"); + } else { + print(file + ": unexpected result:"); + print(result); + print("expected result:"); + print(expected); + ok = false; + } + } + } +} +if (!ok) { + throw new AssertionError(); +} +]]></code> + <mode> + <autoboot>false</autoboot> + <bash>true</bash> + <filter>false</filter> + </mode> + <parameter> + <name>baseDirectory</name> + <description>Base Directory</description> + <type>java.lang.String</type> + <value>/</value> + </parameter> +</script> + Property changes on: trunk/test-mapvalidator/maps/editor/scripts/MapValidator ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + CRLF Added: trunk/test-mapvalidator/regtest.conf =================================================================== --- trunk/test-mapvalidator/regtest.conf (rev 0) +++ trunk/test-mapvalidator/regtest.conf 2010-06-27 20:58:53 UTC (rev 8528) @@ -0,0 +1,71 @@ + +# Whether the map validator is enabled. +MapValidator.All=true + +UpdaterAutoCheck=false + +# Whether this map validator check is is enabled. +Validator.AttributeRange=true + +# Whether this map validator check is is enabled. +Validator.ConnectedInsideContainer=true + +# Whether this map validator check is is enabled. +Validator.ConnectedPickable=true + +# Whether this map validator check is is enabled. +Validator.Connection=true + +# Whether this map validator check is enabled. +Validator.CustomType=true + +# Whether this map validator check is is enabled. +Validator.Exit=true + +# Whether this map validator check is is enabled. +Validator.MapDifficulty=true + +# Whether this map validator check is is enabled. +Validator.NonAbsoluteExitPath=true + +# Whether this map validator check is is enabled. +Validator.PaidItemShopSquare=true + +# Whether this map validator check is is enabled. +Validator.ShopSquare=true + +# Whether this map validator check is is enabled. +Validator.TilePaths=true + +# Whether this map validator check is is enabled. +Validator.UndefinedArchetype=true + +# Whether this map validator check is is enabled. +Validator.UndefinedFace=true + +# Whether this map validator check is is enabled. +Validator.UnsetSlaying=true + +# Archetype directory. +archDirectory=test-mapvalidator/arch + +configSource=ARCH_DIRECTORY + +# Last displayed version of the help documentation. +docuVersion=2 + +filterRealMaps=true + +# Language for the user interface. +language=en + +# Maps directory. +mapDirectory=test-mapvalidator/maps + +mediaDirectory= + +# Script directory. +scriptDirectory=test-mapvalidator/scripts + +# The image set to use. +useImageSet=base Property changes on: trunk/test-mapvalidator/regtest.conf ___________________________________________________________________ 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-06-28 06:24:05
|
Revision: 8533 http://gridarta.svn.sourceforge.net/gridarta/?rev=8533&view=rev Author: akirschbaum Date: 2010-06-28 06:23:59 +0000 (Mon, 28 Jun 2010) Log Message: ----------- Remove redundant module dependencies. Modified Paths: -------------- trunk/atrinik.iml trunk/crossfire.iml Modified: trunk/atrinik.iml =================================================================== --- trunk/atrinik.iml 2010-06-28 06:22:28 UTC (rev 8532) +++ trunk/atrinik.iml 2010-06-28 06:23:59 UTC (rev 8533) @@ -12,7 +12,6 @@ <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="module" module-name="gridarta" /> <orderEntry type="module" module-name="utils" /> - <orderEntry type="module" module-name="preferences" /> <orderEntry type="module-library"> <library> <CLASSES> Modified: trunk/crossfire.iml =================================================================== --- trunk/crossfire.iml 2010-06-28 06:22:28 UTC (rev 8532) +++ trunk/crossfire.iml 2010-06-28 06:23:59 UTC (rev 8533) @@ -13,7 +13,6 @@ <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="module" module-name="gridarta" /> <orderEntry type="module" module-name="utils" /> - <orderEntry type="module" module-name="preferences" /> <orderEntry type="module-library"> <library> <CLASSES> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-28 06:33:51
|
Revision: 8535 http://gridarta.svn.sourceforge.net/gridarta/?rev=8535&view=rev Author: akirschbaum Date: 2010-06-28 06:33:45 +0000 (Mon, 28 Jun 2010) Log Message: ----------- Explicitly initialize fields. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java trunk/src/app/net/sf/gridarta/gui/misc/SplashScreen.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/ScrollLayout.java Modified: trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java 2010-06-28 06:26:10 UTC (rev 8534) +++ trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java 2010-06-28 06:33:45 UTC (rev 8535) @@ -62,30 +62,30 @@ /** * The location of the point on the map model. */ - private Point mapLocation; + private Point mapLocation = null; /** * The pressed mouse button. * @see java.awt.event.MouseEvent#getButton() */ - private int button; + private int button = 0; /** * The type of event. * @see java.awt.AWTEvent#getID() */ - private int id; + private int id = 0; /** * The modifiers during this event. * @see java.awt.event.MouseEvent#getModifiers() */ - private int modifiers; + private int modifiers = 0; /** * The number of consecutive mouse clicks (only valid for click events). */ - private int clickCount; + private int clickCount = 0; /** * Create an empty MouseOpEvent. Modified: trunk/src/app/net/sf/gridarta/gui/misc/SplashScreen.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/SplashScreen.java 2010-06-28 06:26:10 UTC (rev 8534) +++ trunk/src/app/net/sf/gridarta/gui/misc/SplashScreen.java 2010-06-28 06:33:45 UTC (rev 8535) @@ -42,7 +42,7 @@ * SplashScreen window. */ @Nullable - private Frame splashScreen; + private Frame splashScreen = null; /** * Show the splash screen. Modified: trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2010-06-28 06:26:10 UTC (rev 8534) +++ trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2010-06-28 06:33:45 UTC (rev 8535) @@ -203,7 +203,7 @@ @NotNull private JTextComponent replaceDensityInput; - private int lastSelectedIndex; + private int lastSelectedIndex = REPLACE_WITH_OBJECT_CHOOSER; /** * The {@link ObjectChooserListener} for tracking the selection. Modified: trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/ScrollLayout.java =================================================================== --- trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/ScrollLayout.java 2010-06-28 06:26:10 UTC (rev 8534) +++ trunk/textedit/src/app/net/sf/gridarta/textedit/textarea/ScrollLayout.java 2010-06-28 06:33:45 UTC (rev 8535) @@ -44,13 +44,13 @@ private static final String LEFT_OF_SCROLL_BAR = "los"; @Nullable - private Component center; + private Component center = null; @Nullable - private Component right; + private Component right = null; @Nullable - private Component bottom; + private Component bottom = null; @NotNull private final Collection<Component> leftOfScrollBar = new ArrayList<Component>(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-28 07:52:31
|
Revision: 8552 http://gridarta.svn.sourceforge.net/gridarta/?rev=8552&view=rev Author: akirschbaum Date: 2010-06-28 07:52:25 +0000 (Mon, 28 Jun 2010) Log Message: ----------- Remove dependency NamedObject -> FaceObjectProviders. Modified Paths: -------------- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObject.java trunk/model/src/app/net/sf/gridarta/model/data/NamedObject.java trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java trunk/model/src/app/net/sf/gridarta/model/face/FaceObjectProviders.java trunk/src/app/net/sf/gridarta/gui/data/NamedNodeTreeCellRenderer.java trunk/src/app/net/sf/gridarta/gui/utils/AnimTreeChooseAction.java Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java 2010-06-28 07:26:29 UTC (rev 8551) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java 2010-06-28 07:52:25 UTC (rev 8552) @@ -180,7 +180,7 @@ * This part is located using the 2 weights calculated: * (32*weight,0) and (32*weightC,32) */ - final ImageIcon img = smoothFace.getDisplayIcon(faceObjectProviders); + final ImageIcon img = faceObjectProviders.getDisplayIcon(smoothFace); if (weight > 0) { src.x = IGUIConstants.SQUARE_WIDTH * weight; src.y = 0; Modified: trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObject.java 2010-06-28 07:26:29 UTC (rev 8551) +++ trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObject.java 2010-06-28 07:52:25 UTC (rev 8552) @@ -22,13 +22,10 @@ import java.util.ArrayList; import java.util.List; import java.util.regex.Pattern; -import javax.swing.ImageIcon; import net.sf.gridarta.model.data.AbstractNamedObject; -import net.sf.gridarta.model.face.FaceObjectProviders; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Abstract base implementation of {@link AnimationObject}. @@ -190,16 +187,16 @@ /** * {@inheritDoc} */ - @Nullable + @NotNull @Override - public ImageIcon getDisplayIcon(@NotNull final FaceObjectProviders faceObjectProviders) { + public String getDisplayIconName() { for (int facing = 1; facing < facings; facing++) { final String frame = getFirstFrame(facing); if (!frame.startsWith("dummy.")) { - return faceObjectProviders.getImageIconForFacename(frame); + return frame; } } - return faceObjectProviders.getImageIconForFacename(getFirstFrame(0)); + return getFirstFrame(0); } /** Modified: trunk/model/src/app/net/sf/gridarta/model/data/NamedObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/data/NamedObject.java 2010-06-28 07:26:29 UTC (rev 8551) +++ trunk/model/src/app/net/sf/gridarta/model/data/NamedObject.java 2010-06-28 07:52:25 UTC (rev 8552) @@ -20,10 +20,7 @@ package net.sf.gridarta.model.data; import java.io.Serializable; -import javax.swing.ImageIcon; -import net.sf.gridarta.model.face.FaceObjectProviders; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * A <code>AbstractNamedObject</code> has a name and tree position source and @@ -66,13 +63,11 @@ void setPath(@NotNull String path); /** - * Get the display icon for this AbstractNamedObject. - * @param faceObjectProviders the face object providers for looking up - * faces - * @return display icon of this AbstractNamedObject + * Returns the face name of the display icon for this AbstractNamedObject. + * @return the face name */ - @Nullable - ImageIcon getDisplayIcon(@NotNull FaceObjectProviders faceObjectProviders); + @NotNull + String getDisplayIconName(); /** * {@inheritDoc} Modified: trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java 2010-06-28 07:26:29 UTC (rev 8551) +++ trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObject.java 2010-06-28 07:52:25 UTC (rev 8552) @@ -21,7 +21,6 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.swing.ImageIcon; import net.sf.gridarta.model.data.AbstractNamedObject; import net.sf.gridarta.model.data.NamedObject; import org.jetbrains.annotations.NotNull; @@ -194,10 +193,10 @@ /** * {@inheritDoc} */ - @Nullable + @NotNull @Override - public ImageIcon getDisplayIcon(@NotNull final FaceObjectProviders faceObjectProviders) { - return faceObjectProviders.getImageIconForFacename(faceName); + public String getDisplayIconName() { + return faceName; } /** Modified: trunk/model/src/app/net/sf/gridarta/model/face/FaceObjectProviders.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/FaceObjectProviders.java 2010-06-28 07:26:29 UTC (rev 8551) +++ trunk/model/src/app/net/sf/gridarta/model/face/FaceObjectProviders.java 2010-06-28 07:52:25 UTC (rev 8552) @@ -26,6 +26,7 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.baseobject.BaseObjectVisitor; +import net.sf.gridarta.model.data.NamedObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.utils.AlphaImageFilterInstance; @@ -349,4 +350,14 @@ return normalFaceProvider == null ? null : normalFaceProvider.getImageIconForFacename(faceObjName); } + /** + * Returns the display icon for a {@link NamedObject}. + * @param namedObject the named object + * @return display icon of this AbstractNamedObject + */ + @Nullable + public ImageIcon getDisplayIcon(@NotNull final NamedObject namedObject) { + return getImageIconForFacename(namedObject.getDisplayIconName()); + } + } // class FaceObjectProviders Modified: trunk/src/app/net/sf/gridarta/gui/data/NamedNodeTreeCellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/data/NamedNodeTreeCellRenderer.java 2010-06-28 07:26:29 UTC (rev 8551) +++ trunk/src/app/net/sf/gridarta/gui/data/NamedNodeTreeCellRenderer.java 2010-06-28 07:52:25 UTC (rev 8552) @@ -63,7 +63,7 @@ final NamedTreeNode<?> node = (NamedTreeNode<?>) value; final NamedObject object = node.getNamedObject(); if (object != null) { - setIcon(object.getDisplayIcon(faceObjectProviders)); + setIcon(faceObjectProviders.getDisplayIcon(object)); } setText(node.getName()); return this; Modified: trunk/src/app/net/sf/gridarta/gui/utils/AnimTreeChooseAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/AnimTreeChooseAction.java 2010-06-28 07:26:29 UTC (rev 8551) +++ trunk/src/app/net/sf/gridarta/gui/utils/AnimTreeChooseAction.java 2010-06-28 07:52:25 UTC (rev 8552) @@ -127,7 +127,7 @@ if (animationObject == null) { face = unknownSquareIcon; } else { - final Icon tmp = animationObject.getDisplayIcon(faceObjectProviders); + final Icon tmp = faceObjectProviders.getDisplayIcon(animationObject); face = tmp == null ? unknownSquareIcon : tmp; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-28 08:01:37
|
Revision: 8553 http://gridarta.svn.sourceforge.net/gridarta/?rev=8553&view=rev Author: akirschbaum Date: 2010-06-28 08:01:28 +0000 (Mon, 28 Jun 2010) Log Message: ----------- Rename package names. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java 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/map/renderer/AbstractFlatMapRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.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/map/renderer/DefaultRendererFactory.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/model/src/app/net/sf/gridarta/model/map/mapgrid/MapGrid.java trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/MapGridEvent.java trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/MapGridListener.java trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/SelectionMode.java trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/IOErrorException.java trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/InvalidPathException.java trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/MapPathNormalizer.java trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/RelativePathOnUnsavedMapException.java trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/SameMapException.java trunk/model/src/app/net/sf/gridarta/model/mapcursor/MapCursor.java trunk/model/src/test/net/sf/gridarta/model/map/mapgrid/MapGridTest.java trunk/model/src/test/net/sf/gridarta/model/mapcursor/MapCursorTest.java trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.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/gui/map/mapview/AbstractMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/RendererFactory.java trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java trunk/src/app/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/app/net/sf/gridarta/gui/misc/ShiftProcessor.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java trunk/src/test/net/sf/gridarta/gui/map/renderer/TestRendererFactory.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/ trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/ trunk/model/src/test/net/sf/gridarta/model/map/mapgrid/ Removed Paths: ------------- trunk/model/src/app/net/sf/gridarta/model/map/grid/ trunk/model/src/app/net/sf/gridarta/model/map/normalizer/ trunk/model/src/test/net/sf/gridarta/model/map/grid/ Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -28,7 +28,7 @@ import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.grid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.utils.SystemIcons; 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-06-28 07:52:25 UTC (rev 8552) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -25,7 +25,7 @@ import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; 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-06-28 07:52:25 UTC (rev 8552) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -53,7 +53,7 @@ import net.sf.gridarta.gui.utils.TextComponentUtils; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.Size2D; 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-06-28 07:52:25 UTC (rev 8552) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -78,7 +78,7 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.map.mapcontrol.MapControlFactory; import net.sf.gridarta.model.map.mapmodel.InsertionMode; -import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -32,9 +32,9 @@ import net.sf.gridarta.gui.map.renderer.AbstractMapRenderer; import net.sf.gridarta.gui.map.renderer.GridMapSquarePainter; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.grid.MapGrid; -import net.sf.gridarta.model.map.grid.MapGridEvent; -import net.sf.gridarta.model.map.grid.MapGridListener; +import net.sf.gridarta.model.map.mapgrid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.MapGridEvent; +import net.sf.gridarta.model.map.mapgrid.MapGridListener; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.mapmodel.MapModelListener; import net.sf.gridarta.model.map.mapmodel.MapSquare; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -24,7 +24,7 @@ import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.grid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.utils.SystemIcons; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -37,7 +37,7 @@ import net.sf.gridarta.model.filter.FilterConfigChangeType; import net.sf.gridarta.model.filter.FilterConfigListener; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.grid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.mapmodel.MapSquare; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -27,7 +27,7 @@ import net.sf.gridarta.gui.map.renderer.GridMapSquarePainter; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.grid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.mapmodel.MapSquare; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; 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-06-28 07:52:25 UTC (rev 8552) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -25,7 +25,7 @@ import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; 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-06-28 07:52:25 UTC (rev 8552) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -45,7 +45,7 @@ import net.sf.gridarta.gui.utils.TextComponentUtils; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.Size2D; 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-06-28 07:52:25 UTC (rev 8552) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -73,7 +73,7 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.map.mapcontrol.MapControlFactory; import net.sf.gridarta.model.map.mapmodel.InsertionMode; -import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/map/renderer/DefaultRendererFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/map/renderer/DefaultRendererFactory.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/map/renderer/DefaultRendererFactory.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -28,7 +28,7 @@ import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.grid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.utils.SystemIcons; 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-06-28 07:52:25 UTC (rev 8552) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -25,7 +25,7 @@ import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; 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-06-28 07:52:25 UTC (rev 8552) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -54,7 +54,7 @@ import net.sf.gridarta.gui.utils.TextComponentUtils; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.Size2D; 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-06-28 07:52:25 UTC (rev 8552) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -78,7 +78,7 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.map.mapcontrol.MapControlFactory; import net.sf.gridarta.model.map.mapmodel.InsertionMode; -import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; Modified: trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/MapGrid.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/grid/MapGrid.java 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/MapGrid.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.model.map.grid; +package net.sf.gridarta.model.map.mapgrid; import java.awt.Point; import java.awt.Rectangle; Modified: trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/MapGridEvent.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/grid/MapGridEvent.java 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/MapGridEvent.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.model.map.grid; +package net.sf.gridarta.model.map.mapgrid; import java.util.EventObject; import org.jetbrains.annotations.NotNull; Modified: trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/MapGridListener.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/grid/MapGridListener.java 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/MapGridListener.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.model.map.grid; +package net.sf.gridarta.model.map.mapgrid; import java.util.EventListener; import org.jetbrains.annotations.NotNull; Modified: trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/SelectionMode.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/grid/SelectionMode.java 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/SelectionMode.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.model.map.grid; +package net.sf.gridarta.model.map.mapgrid; /** * Modes that describe how squares get selected. Modified: trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/IOErrorException.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/normalizer/IOErrorException.java 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/IOErrorException.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.model.map.normalizer; +package net.sf.gridarta.model.map.mappathnormalizer; import java.io.File; import java.io.IOException; Modified: trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/InvalidPathException.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/normalizer/InvalidPathException.java 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/InvalidPathException.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.model.map.normalizer; +package net.sf.gridarta.model.map.mappathnormalizer; import java.io.File; import org.jetbrains.annotations.NotNull; Modified: trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/MapPathNormalizer.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/normalizer/MapPathNormalizer.java 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/MapPathNormalizer.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.model.map.normalizer; +package net.sf.gridarta.model.map.mappathnormalizer; import java.io.File; import java.io.IOException; Modified: trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/RelativePathOnUnsavedMapException.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/normalizer/RelativePathOnUnsavedMapException.java 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/RelativePathOnUnsavedMapException.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.model.map.normalizer; +package net.sf.gridarta.model.map.mappathnormalizer; import org.jetbrains.annotations.NotNull; Modified: trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/SameMapException.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/map/normalizer/SameMapException.java 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/SameMapException.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.model.map.normalizer; +package net.sf.gridarta.model.map.mappathnormalizer; /** * Exception thrown if the destination path points to the source map. Modified: trunk/model/src/app/net/sf/gridarta/model/mapcursor/MapCursor.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapcursor/MapCursor.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/model/src/app/net/sf/gridarta/model/mapcursor/MapCursor.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -23,10 +23,10 @@ import java.awt.Point; import java.awt.Rectangle; import net.sf.gridarta.model.direction.Direction; -import net.sf.gridarta.model.map.grid.MapGrid; -import net.sf.gridarta.model.map.grid.MapGridEvent; -import net.sf.gridarta.model.map.grid.MapGridListener; -import net.sf.gridarta.model.map.grid.SelectionMode; +import net.sf.gridarta.model.map.mapgrid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.MapGridEvent; +import net.sf.gridarta.model.map.mapgrid.MapGridListener; +import net.sf.gridarta.model.map.mapgrid.SelectionMode; import net.sf.gridarta.utils.EventListenerList2; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: trunk/model/src/test/net/sf/gridarta/model/map/mapgrid/MapGridTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/map/grid/MapGridTest.java 2010-06-27 20:03:32 UTC (rev 8524) +++ trunk/model/src/test/net/sf/gridarta/model/map/mapgrid/MapGridTest.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.model.map.grid; +package net.sf.gridarta.model.map.mapgrid; import java.awt.Point; import net.sf.gridarta.utils.Size2D; Modified: trunk/model/src/test/net/sf/gridarta/model/mapcursor/MapCursorTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapcursor/MapCursorTest.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/model/src/test/net/sf/gridarta/model/mapcursor/MapCursorTest.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -23,8 +23,8 @@ import java.awt.Point; import junit.framework.JUnit4TestAdapter; import net.sf.gridarta.model.direction.Direction; -import net.sf.gridarta.model.map.grid.MapGrid; -import net.sf.gridarta.model.map.grid.SelectionMode; +import net.sf.gridarta.model.map.mapgrid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.SelectionMode; import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; import org.junit.Assert; Modified: trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java =================================================================== --- trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -29,11 +29,11 @@ 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.mappathnormalizer.IOErrorException; +import net.sf.gridarta.model.map.mappathnormalizer.InvalidPathException; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.RelativePathOnUnsavedMapException; +import net.sf.gridarta.model.map.mappathnormalizer.SameMapException; import net.sf.gridarta.model.map.tiles.MapLink; import net.sf.gridarta.model.map.tiles.TileLink; import net.sf.gridarta.utils.Size2D; Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -29,9 +29,9 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.grid.MapGrid; -import net.sf.gridarta.model.map.grid.SelectionMode; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapgrid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.SelectionMode; import org.jetbrains.annotations.NotNull; /** Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -49,11 +49,11 @@ 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.mappathnormalizer.IOErrorException; +import net.sf.gridarta.model.map.mappathnormalizer.InvalidPathException; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.RelativePathOnUnsavedMapException; +import net.sf.gridarta.model.map.mappathnormalizer.SameMapException; import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapcursor.MapCursorEvent; import net.sf.gridarta.model.mapcursor.MapCursorListener; Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -42,7 +42,7 @@ 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.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.map.tiles.MapLink; import net.sf.gridarta.model.map.tiles.TileLink; import net.sf.gridarta.model.settings.GlobalSettings; Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/FlatMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/FlatMapTilePane.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/FlatMapTilePane.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -26,7 +26,7 @@ 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.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.map.tiles.MapLink; import net.sf.gridarta.model.settings.GlobalSettings; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/IsoMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/IsoMapTilePane.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/IsoMapTilePane.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -27,7 +27,7 @@ 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.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.map.tiles.MapLink; import net.sf.gridarta.model.settings.GlobalSettings; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/AbstractMapViewBasic.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -25,8 +25,8 @@ import java.util.List; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.grid.MapGrid; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.mapmodel.MapSquare; import net.sf.gridarta.model.mapcursor.MapCursor; Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -34,8 +34,8 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.grid.MapGrid; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.mapmodel.MapModelListener; import net.sf.gridarta.model.map.mapmodel.MapSquare; Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -25,8 +25,8 @@ import net.sf.gridarta.gui.map.renderer.MapRenderer; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.grid.MapGrid; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapSquare; import net.sf.gridarta.model.mapcursor.MapCursor; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -35,10 +35,10 @@ import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.grid.MapGrid; -import net.sf.gridarta.model.map.grid.MapGridEvent; -import net.sf.gridarta.model.map.grid.MapGridListener; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapgrid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.MapGridEvent; +import net.sf.gridarta.model.map.mapgrid.MapGridListener; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.mapmodel.MapModelListener; import net.sf.gridarta.model.map.mapmodel.MapSquare; Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -22,7 +22,7 @@ import java.awt.Graphics; import java.awt.Image; import java.awt.image.ImageObserver; -import net.sf.gridarta.model.map.grid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -33,8 +33,8 @@ import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.grid.MapGrid; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.mapmodel.MapSquare; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -27,8 +27,8 @@ import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.grid.MapGrid; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.mapmodel.MapSquare; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; Modified: trunk/src/app/net/sf/gridarta/gui/map/renderer/RendererFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/renderer/RendererFactory.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/renderer/RendererFactory.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -21,8 +21,8 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.grid.MapGrid; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -34,8 +34,8 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.floodfill.FillUtils; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.grid.SelectionMode; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapgrid.SelectionMode; import net.sf.gridarta.model.map.mapmodel.InsertionMode; import net.sf.gridarta.model.map.mapmodel.InsertionModeSet; import net.sf.gridarta.model.mapcursor.MapCursor; Modified: trunk/src/app/net/sf/gridarta/gui/mapcursor/MapCursorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/mapcursor/MapCursorActions.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -33,8 +33,8 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.direction.Direction; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.grid.SelectionMode; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapgrid.SelectionMode; import net.sf.gridarta.model.mapcursor.MapCursor; import net.sf.gridarta.model.mapcursor.MapCursorEvent; import net.sf.gridarta.model.mapcursor.MapCursorListener; Modified: trunk/src/app/net/sf/gridarta/gui/misc/ShiftProcessor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/ShiftProcessor.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/gui/misc/ShiftProcessor.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -28,9 +28,9 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.direction.Direction; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.grid.MapGrid; -import net.sf.gridarta.model.map.grid.SelectionMode; import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapgrid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.SelectionMode; import net.sf.gridarta.model.map.mapmodel.InsertionModeSet; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -49,12 +49,12 @@ import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.floodfill.FillUtils; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.grid.MapGrid; -import net.sf.gridarta.model.map.grid.MapGridEvent; -import net.sf.gridarta.model.map.grid.MapGridListener; -import net.sf.gridarta.model.map.grid.SelectionMode; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.map.mapcontrol.MapControl; +import net.sf.gridarta.model.map.mapgrid.MapGrid; +import net.sf.gridarta.model.map.mapgrid.MapGridEvent; +import net.sf.gridarta.model.map.mapgrid.MapGridListener; +import net.sf.gridarta.model.map.mapgrid.SelectionMode; import net.sf.gridarta.model.map.mapmodel.InsertionMode; import net.sf.gridarta.model.map.mapmodel.InsertionModeSet; import net.sf.gridarta.model.map.mapmodel.MapModel; Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -59,7 +59,7 @@ import net.sf.gridarta.model.map.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.map.mapcontrol.MapControlFactory; import net.sf.gridarta.model.map.mapmodel.InsertionMode; -import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.resource.AbstractResources; Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -147,7 +147,7 @@ import net.sf.gridarta.model.map.mapmodel.InsertionMode; import net.sf.gridarta.model.map.mapmodel.InsertionModeSet; import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; +import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; Modified: trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -27,9 +27,9 @@ import net.sf.gridarta.model.archetype.DuplicateArchetypeException; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; -import net.sf.gridarta.model.map.grid.SelectionMode; import net.sf.gridarta.model.map.maparchobject.TestMapArchObject; import net.sf.gridarta.model.map.mapcontrol.MapControl; +import net.sf.gridarta.model.map.mapgrid.SelectionMode; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.utils.Size2D; import org.junit.Test; Modified: trunk/src/test/net/sf/gridarta/gui/map/renderer/TestRendererFactory.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/renderer/TestRendererFactory.java 2010-06-28 07:52:25 UTC (rev 8552) +++ trunk/src/test/net/sf/gridarta/gui/map/renderer/TestRendererFactory.java 2010-06-28 08:01:28 UTC (rev 8553) @@ -21,8 +21,8 @@ import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; -import net.sf.gridarta.model.map.grid.MapGrid; import net.sf.gridarta.model.map.maparchobject.TestMapArchObject; +import net.sf.gridarta.model.map.mapgrid.MapGrid; import net.sf.gridarta.model.map.mapmodel.MapModel; import org.jetbrains.annotations.NotNull; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-28 08:18:32
|
Revision: 8554 http://gridarta.svn.sourceforge.net/gridarta/?rev=8554&view=rev Author: akirschbaum Date: 2010-06-28 08:18:16 +0000 (Mon, 28 Jun 2010) Log Message: ----------- Reorganize package names. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java 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/atrinik/src/app/net/sf/gridarta/var/atrinik/model/maparchobject/DefaultMapArchObjectFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/mapcontrol/DefaultMapControlFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/CollectedConfigSource.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/FilesConfigSource.java trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObjectTest.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.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/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/DefaultMapArchObjectFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/maparchobject/MapArchObject.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/mapcontrol/DefaultMapControlFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/CollectedConfigSource.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/FilesConfigSource.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/validation/checks/NonAbsoluteExitPathChecker.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/map/renderer/DefaultRendererFactory.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/daimonin/src/app/net/sf/gridarta/var/daimonin/model/maparchobject/DefaultMapArchObjectFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObject.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/mapcontrol/DefaultMapControlFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/CollectedConfigSource.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/FilesConfigSource.java trunk/daimonin/src/test/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObjectTest.java trunk/model/src/app/net/sf/gridarta/model/anim/AnimationObjects.java trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetype/Archetype.java trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeFactory.java trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeParser.java trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java trunk/model/src/app/net/sf/gridarta/model/archetype/ArchetypeSetListener.java trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolderListener.java trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModelListener.java trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserPanel.java trunk/model/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserPanelListener.java trunk/model/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java trunk/model/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObject.java trunk/model/src/app/net/sf/gridarta/model/baseobject/BaseObjectVisitor.java trunk/model/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java trunk/model/src/app/net/sf/gridarta/model/baseobject/RecursiveGameObjectIterator.java trunk/model/src/app/net/sf/gridarta/model/collectable/Collectable.java trunk/model/src/app/net/sf/gridarta/model/configsource/ConfigSource.java trunk/model/src/app/net/sf/gridarta/model/exitconnector/ExitMatcher.java trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java trunk/model/src/app/net/sf/gridarta/model/face/FaceObjectProviders.java trunk/model/src/app/net/sf/gridarta/model/face/FaceObjects.java trunk/model/src/app/net/sf/gridarta/model/floodfill/FillUtils.java trunk/model/src/app/net/sf/gridarta/model/floodfill/FloodFill.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java trunk/model/src/app/net/sf/gridarta/model/gameobject/AbstractIsoGameObjectFactory.java trunk/model/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObject.java trunk/model/src/app/net/sf/gridarta/model/gameobject/GameObjectFactory.java trunk/model/src/app/net/sf/gridarta/model/gameobject/MultiArchData.java trunk/model/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java trunk/model/src/app/net/sf/gridarta/model/io/AbstractMapArchObjectParser.java trunk/model/src/app/net/sf/gridarta/model/io/DefaultMapReader.java trunk/model/src/app/net/sf/gridarta/model/io/DefaultMapReaderFactory.java trunk/model/src/app/net/sf/gridarta/model/io/DefaultMapWriter.java trunk/model/src/app/net/sf/gridarta/model/io/GameObjectParser.java trunk/model/src/app/net/sf/gridarta/model/io/GameObjectParserFactory.java trunk/model/src/app/net/sf/gridarta/model/io/MapArchObjectParser.java trunk/model/src/app/net/sf/gridarta/model/io/MapArchObjectParserFactory.java trunk/model/src/app/net/sf/gridarta/model/io/MapReader.java trunk/model/src/app/net/sf/gridarta/model/io/MapReaderFactory.java trunk/model/src/app/net/sf/gridarta/model/io/MapWriter.java trunk/model/src/app/net/sf/gridarta/model/maparchobject/AbstractMapArchObject.java trunk/model/src/app/net/sf/gridarta/model/maparchobject/MapArchObject.java trunk/model/src/app/net/sf/gridarta/model/maparchobject/MapArchObjectFactory.java trunk/model/src/app/net/sf/gridarta/model/maparchobject/MapArchObjectListener.java trunk/model/src/app/net/sf/gridarta/model/mapcontrol/DefaultMapControl.java trunk/model/src/app/net/sf/gridarta/model/mapcontrol/MapControl.java trunk/model/src/app/net/sf/gridarta/model/mapcontrol/MapControlFactory.java trunk/model/src/app/net/sf/gridarta/model/mapcontrol/MapControlListener.java trunk/model/src/app/net/sf/gridarta/model/mapcursor/MapCursor.java trunk/model/src/app/net/sf/gridarta/model/mapgrid/MapGrid.java trunk/model/src/app/net/sf/gridarta/model/mapgrid/MapGridEvent.java trunk/model/src/app/net/sf/gridarta/model/mapgrid/MapGridListener.java trunk/model/src/app/net/sf/gridarta/model/mapgrid/SelectionMode.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/AboveFloorInsertionMode.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/AutoInsertionMode.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/BelowFloorInsertionMode.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/BottommostInsertionMode.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/InsertionMode.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/InsertionModeSet.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModel.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModelListener.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquare.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquareGrid.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapSquareIterator.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapTransactionListener.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/SavedSquares.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/TopmostInsertionMode.java trunk/model/src/app/net/sf/gridarta/model/mappathnormalizer/IOErrorException.java trunk/model/src/app/net/sf/gridarta/model/mappathnormalizer/InvalidPathException.java trunk/model/src/app/net/sf/gridarta/model/mappathnormalizer/MapPathNormalizer.java trunk/model/src/app/net/sf/gridarta/model/mappathnormalizer/RelativePathOnUnsavedMapException.java trunk/model/src/app/net/sf/gridarta/model/mappathnormalizer/SameMapException.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractFilesResourcesReader.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResources.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java trunk/model/src/app/net/sf/gridarta/model/resource/CollectedResourcesWriter.java trunk/model/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEvent.java trunk/model/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEventFactory.java trunk/model/src/app/net/sf/gridarta/model/scripts/DefaultScriptArchData.java trunk/model/src/app/net/sf/gridarta/model/scripts/ScriptArchData.java trunk/model/src/app/net/sf/gridarta/model/scripts/ScriptedEvent.java trunk/model/src/app/net/sf/gridarta/model/scripts/ScriptedEventFactory.java trunk/model/src/app/net/sf/gridarta/model/spells/ArchetypeSetSpellLoader.java trunk/model/src/app/net/sf/gridarta/model/spells/GameObjectSpell.java trunk/model/src/app/net/sf/gridarta/model/tiles/MapLink.java trunk/model/src/app/net/sf/gridarta/model/tiles/TileLink.java trunk/model/src/app/net/sf/gridarta/model/undo/UndoModel.java trunk/model/src/app/net/sf/gridarta/model/undo/UndoState.java trunk/model/src/app/net/sf/gridarta/model/validation/DefaultErrorCollector.java trunk/model/src/app/net/sf/gridarta/model/validation/ErrorCollector.java trunk/model/src/app/net/sf/gridarta/model/validation/ValidationErrorComparator.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/AttributeRangeError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/BlockedMobOrSpawnPointError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/BlockedSpawnPointError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/BlockedSquareError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ConnectedInsideContainerError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ConnectedPickableError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ConnectionError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ConnectionWithoutSinksError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ConnectionWithoutSourcesError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/CorrectableError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/CustomTypeError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/DoubleLayerError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/DoubleTypeError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/EmptySpawnPointError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/EnvironmentSensorSlayingError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ExitError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/GameObjectValidationError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/GameObjectsValidationError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/MapDifficultyError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/MapValidationError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/MobOutsideSpawnPointError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/PaidItemShopSquareError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ShopSquareError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/SlayingError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/SquareValidationError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/SquareWithoutFloorError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/SysObjectNotOnLayerZeroError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/TilePathsError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/UndefinedAnimError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/UndefinedArchetypeError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/UndefinedFaceError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/UnsetSlayingError.java trunk/model/src/app/net/sf/gridarta/model/validation/errors/ValidationError.java trunk/model/src/test/net/sf/gridarta/model/archetype/AbstractArchetypeParserTest.java trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetype.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeBuilder.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeFactory.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeParser.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeSet.java trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java trunk/model/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java trunk/model/src/test/net/sf/gridarta/model/gameobject/TestGameObject.java trunk/model/src/test/net/sf/gridarta/model/gameobject/TestGameObjectFactory.java trunk/model/src/test/net/sf/gridarta/model/io/TestGameObjectParser.java trunk/model/src/test/net/sf/gridarta/model/io/TestMapArchObjectParser.java trunk/model/src/test/net/sf/gridarta/model/io/TestMapArchObjectParserFactory.java trunk/model/src/test/net/sf/gridarta/model/io/TestMapReaderFactory.java trunk/model/src/test/net/sf/gridarta/model/maparchobject/TestMapArchObject.java trunk/model/src/test/net/sf/gridarta/model/maparchobject/TestMapArchObjectFactory.java trunk/model/src/test/net/sf/gridarta/model/mapcontrol/TestMapControlFactory.java trunk/model/src/test/net/sf/gridarta/model/mapcursor/MapCursorTest.java trunk/model/src/test/net/sf/gridarta/model/mapgrid/MapGridTest.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java trunk/model/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java trunk/model/src/test/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java trunk/model/src/test/net/sf/gridarta/model/resource/TestFilesResourcesReader.java trunk/src/app/net/sf/gridarta/actions/AttachTiledMaps.java trunk/src/app/net/sf/gridarta/actions/UndoActions.java trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListener.java trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserViewListener.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeIconCellRenderer.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeNameCellRenderer.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/DirectionPane.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/DisplayMode.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/DisplayNameCellRenderer.java trunk/src/app/net/sf/gridarta/gui/archetypetype/ArchetypeTypeChecks.java trunk/src/app/net/sf/gridarta/gui/autovalidator/AutoValidator.java trunk/src/app/net/sf/gridarta/gui/bookmarks/BookmarkActions.java trunk/src/app/net/sf/gridarta/gui/bookmarks/EditBookmarkDialog.java trunk/src/app/net/sf/gridarta/gui/bookmarks/ManageBookmarksDialog.java trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionControl.java trunk/src/app/net/sf/gridarta/gui/connectionview/ConnectionView.java trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsControl.java trunk/src/app/net/sf/gridarta/gui/connectionview/LockedItemsView.java trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterControl.java trunk/src/app/net/sf/gridarta/gui/connectionview/MonsterView.java trunk/src/app/net/sf/gridarta/gui/connectionview/View.java trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyMode.java trunk/src/app/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialogManager.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribute.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeAnimationName.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeBitmask.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeBool.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeBoolSpec.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeFaceName.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeFloat.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeInt.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeInvSpell.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeList.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeLong.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeMapPath.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeScriptFile.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeSpell.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeString.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeText.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeTreasure.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttributeZSpell.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GuiInfo.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/MaskChangeAL.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TypesBoxItemListener.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ViewTreasurelistAL.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/AbstractGameObjectAttributesTab.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ArchTab.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/ErrorListView.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/EventsTab.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/FaceTab.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesModel.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesModelListener.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesTab.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesTabListener.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/MsgTextTab.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/TextEditorTab.java trunk/src/app/net/sf/gridarta/gui/golocationdialog/GoLocationDialog.java trunk/src/app/net/sf/gridarta/gui/golocationdialog/GoLocationDialogManager.java trunk/src/app/net/sf/gridarta/gui/mainwindow/GameObjectTab.java trunk/src/app/net/sf/gridarta/gui/mainwindow/WarningsTab.java trunk/src/app/net/sf/gridarta/gui/map/AbstractPerMapDialogManager.java trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpAdapter.java trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpListener.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/MapActions.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/gui/map/mapview/AbstractMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewFactory.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManagerListener.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViews.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsListener.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractIsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/AbstractSimpleIsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/GridMapSquarePainter.java trunk/src/app/net/sf/gridarta/gui/map/renderer/ImageCreator.java trunk/src/app/net/sf/gridarta/gui/map/renderer/ImageCreator2.java trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/IsoPickmapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/RendererFactory.java trunk/src/app/net/sf/gridarta/gui/map/renderer/SimpleIsoMapRenderer.java trunk/src/app/net/sf/gridarta/gui/map/renderer/ToolTipAppender.java trunk/src/app/net/sf/gridarta/gui/map/tools/AbstractTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/BasicAbstractTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/Tool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/app/net/sf/gridarta/gui/map/tools/VoidTool.java trunk/src/app/net/sf/gridarta/gui/map/viewaction/ViewActions.java trunk/src/app/net/sf/gridarta/gui/mapcursor/MapCursorActions.java trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowMenuManager.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeAction.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java trunk/src/app/net/sf/gridarta/gui/mapimagecache/MapImageCache.java trunk/src/app/net/sf/gridarta/gui/mapimagecache/MapImageCacheListener.java trunk/src/app/net/sf/gridarta/gui/mapmenu/AbstractMapMenuPreferences.java trunk/src/app/net/sf/gridarta/gui/mapmenu/BookmarksMapMenuPreferences.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuEntry.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuManager.java trunk/src/app/net/sf/gridarta/gui/mapmenu/MapMenuPreferences.java trunk/src/app/net/sf/gridarta/gui/mapmenu/RecentMapMenuPreferences.java trunk/src/app/net/sf/gridarta/gui/mappropertiesdialog/MapPropertiesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListener.java trunk/src/app/net/sf/gridarta/gui/mapuserlistener/MapUserListenerManager.java trunk/src/app/net/sf/gridarta/gui/misc/MainViewActions.java trunk/src/app/net/sf/gridarta/gui/misc/RecentManager.java trunk/src/app/net/sf/gridarta/gui/misc/ShiftProcessor.java trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractNewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapFolderDialog.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooserListener.java trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooserTab.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModelListener.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserView.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ArchetypeNameMatchCriteria.java trunk/src/app/net/sf/gridarta/gui/replacedialog/MatchCriteria.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ObjectNameMatchCriteria.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialogManager.java trunk/src/app/net/sf/gridarta/gui/script/ScriptController.java trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java trunk/src/app/net/sf/gridarta/gui/script/ScriptManager.java trunk/src/app/net/sf/gridarta/gui/script/ScriptManagerFactory.java trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBox.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxEditor.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxModel.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/BooleanParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/DoubleParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/IntegerParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterCellRenderer.java trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterComboBoxModel.java trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterDescriptionEditor.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterNameEditor.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterTypeEditor.java trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java trunk/src/app/net/sf/gridarta/gui/scripts/DefaultScriptArchEditor.java trunk/src/app/net/sf/gridarta/gui/scripts/PathButtonListener.java trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchDataUtils.java trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchEditor.java trunk/src/app/net/sf/gridarta/gui/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapSquareSelection.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapSquareSelectionCache.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapSquareSelectionListener.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareActions.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareModel.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareModelListener.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/gui/shrinkmapsizedialog/ShrinkMapSizeDialog.java trunk/src/app/net/sf/gridarta/gui/shrinkmapsizedialog/ShrinkMapSizeDialogManager.java trunk/src/app/net/sf/gridarta/gui/shrinkmapsizedialog/ShrinkMapSizeUtils.java trunk/src/app/net/sf/gridarta/gui/treasurelist/CFTreasureListTree.java trunk/src/app/net/sf/gridarta/gui/treasurelist/TreasureCellRenderer.java trunk/src/app/net/sf/gridarta/gui/undo/UndoControl.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java trunk/src/app/net/sf/gridarta/mapfiles/Loader.java trunk/src/app/net/sf/gridarta/mapfiles/MapFile.java trunk/src/app/net/sf/gridarta/mapfiles/MapFolder.java trunk/src/app/net/sf/gridarta/mapfiles/MapFolderListener.java trunk/src/app/net/sf/gridarta/mapfiles/MapFolderTree.java trunk/src/app/net/sf/gridarta/mapfiles/MapFolderTreeListener.java trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java trunk/src/app/net/sf/gridarta/mapmanager/DefaultMapManager.java trunk/src/app/net/sf/gridarta/mapmanager/DefaultPickmapManager.java trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java trunk/src/app/net/sf/gridarta/mapmanager/MapManagerListener.java trunk/src/app/net/sf/gridarta/script/BshThread.java trunk/src/app/net/sf/gridarta/script/Script.java trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java trunk/src/app/net/sf/gridarta/script/ScriptModel.java trunk/src/app/net/sf/gridarta/script/ScriptModelListener.java trunk/src/app/net/sf/gridarta/script/ScriptModelLoader.java trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java trunk/src/app/net/sf/gridarta/script/parameter/AbstractPluginParameter.java trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java trunk/src/app/net/sf/gridarta/script/parameter/BooleanParameter.java trunk/src/app/net/sf/gridarta/script/parameter/DoubleParameter.java trunk/src/app/net/sf/gridarta/script/parameter/FilterParameter.java trunk/src/app/net/sf/gridarta/script/parameter/IntegerParameter.java trunk/src/app/net/sf/gridarta/script/parameter/MapParameter.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterFactory.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterVisitor.java trunk/src/app/net/sf/gridarta/script/parameter/StringParameter.java trunk/src/app/net/sf/gridarta/validation/DelegatingMapValidator.java trunk/src/app/net/sf/gridarta/validation/ErrorHandler.java trunk/src/app/net/sf/gridarta/validation/GameObjectValidator.java trunk/src/app/net/sf/gridarta/validation/MapValidator.java trunk/src/app/net/sf/gridarta/validation/SquareValidator.java trunk/src/app/net/sf/gridarta/validation/checks/AbstractShopSquareChecker.java trunk/src/app/net/sf/gridarta/validation/checks/AttributeRangeChecker.java trunk/src/app/net/sf/gridarta/validation/checks/BlockedMatrix.java trunk/src/app/net/sf/gridarta/validation/checks/BlockedMobOrSpawnPointChecker.java trunk/src/app/net/sf/gridarta/validation/checks/BlockedSpawnPointChecker.java trunk/src/app/net/sf/gridarta/validation/checks/BlockedSquareChecker.java trunk/src/app/net/sf/gridarta/validation/checks/ConnectedInsideContainerChecker.java trunk/src/app/net/sf/gridarta/validation/checks/ConnectedPickableChecker.java trunk/src/app/net/sf/gridarta/validation/checks/ConnectionChecker.java trunk/src/app/net/sf/gridarta/validation/checks/ConnectionUnknownError.java trunk/src/app/net/sf/gridarta/validation/checks/CustomTypeChecker.java trunk/src/app/net/sf/gridarta/validation/checks/DoubleLayerChecker.java trunk/src/app/net/sf/gridarta/validation/checks/DoubleTypeChecker.java trunk/src/app/net/sf/gridarta/validation/checks/EmptySpawnPointChecker.java trunk/src/app/net/sf/gridarta/validation/checks/Entry.java trunk/src/app/net/sf/gridarta/validation/checks/ExitChecker.java trunk/src/app/net/sf/gridarta/validation/checks/MapDifficultyChecker.java trunk/src/app/net/sf/gridarta/validation/checks/MobOutsideSpawnPointChecker.java trunk/src/app/net/sf/gridarta/validation/checks/NonAbsoluteExitPathError.java trunk/src/app/net/sf/gridarta/validation/checks/PaidItemShopSquareChecker.java trunk/src/app/net/sf/gridarta/validation/checks/RangeEntry.java trunk/src/app/net/sf/gridarta/validation/checks/ShopSquareChecker.java trunk/src/app/net/sf/gridarta/validation/checks/SlayingChecker.java trunk/src/app/net/sf/gridarta/validation/checks/SquareWithoutFloorChecker.java trunk/src/app/net/sf/gridarta/validation/checks/SysObjectNotOnLayerZeroChecker.java trunk/src/app/net/sf/gridarta/validation/checks/TilePathsChecker.java trunk/src/app/net/sf/gridarta/validation/checks/Type.java trunk/src/app/net/sf/gridarta/validation/checks/UndefinedArchetypeChecker.java trunk/src/app/net/sf/gridarta/validation/checks/UndefinedFaceChecker.java trunk/src/app/net/sf/gridarta/validation/checks/UnsetSlayingChecker.java trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapView.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewBasic.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java trunk/src/test/net/sf/gridarta/gui/map/renderer/TestMapRenderer.java trunk/src/test/net/sf/gridarta/gui/map/renderer/TestRendererFactory.java trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java trunk/src/test/net/sf/gridarta/gui/mapmenu/MapMenuManagerTest.java trunk/src/test/net/sf/gridarta/gui/selectedsquare/SelectedSquareActionsTest.java trunk/src/test/net/sf/gridarta/mapmanager/DefaultMapManagerTest.java trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java trunk/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java trunk/test-mapvalidator/maps/editor/scripts/MapValidator trunk/test-mapvalidator/regtest.conf Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/maparchobject/ trunk/model/src/app/net/sf/gridarta/model/mapcontrol/ trunk/model/src/app/net/sf/gridarta/model/mapgrid/ trunk/model/src/app/net/sf/gridarta/model/mapmodel/ trunk/model/src/app/net/sf/gridarta/model/mappathnormalizer/ trunk/model/src/app/net/sf/gridarta/model/tiles/ trunk/model/src/app/net/sf/gridarta/model/validation/ trunk/model/src/test/net/sf/gridarta/model/maparchobject/ trunk/model/src/test/net/sf/gridarta/model/mapcontrol/ trunk/model/src/test/net/sf/gridarta/model/mapgrid/ trunk/model/src/test/net/sf/gridarta/model/mapmodel/ trunk/model/src/test/net/sf/gridarta/model/validation/ Removed Paths: ------------- trunk/model/src/app/net/sf/gridarta/model/map/maparchobject/ trunk/model/src/app/net/sf/gridarta/model/map/mapcontrol/ trunk/model/src/app/net/sf/gridarta/model/map/mapgrid/ trunk/model/src/app/net/sf/gridarta/model/map/mapmodel/ trunk/model/src/app/net/sf/gridarta/model/map/mappathnormalizer/ trunk/model/src/app/net/sf/gridarta/model/map/tiles/ trunk/model/src/app/net/sf/gridarta/model/map/validation/ trunk/model/src/test/net/sf/gridarta/model/map/maparchobject/ trunk/model/src/test/net/sf/gridarta/model/map/mapcontrol/ trunk/model/src/test/net/sf/gridarta/model/map/mapgrid/ trunk/model/src/test/net/sf/gridarta/model/map/mapmodel/ trunk/model/src/test/net/sf/gridarta/model/map/validation/ Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/map/renderer/DefaultRendererFactory.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -28,8 +28,8 @@ import net.sf.gridarta.model.gameobject.IsoMapSquareInfo; import net.sf.gridarta.model.gameobject.MultiPositionData; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.mapgrid.MapGrid; -import net.sf.gridarta.model.map.mapmodel.MapModel; +import net.sf.gridarta.model.mapgrid.MapGrid; +import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; 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-06-28 08:01:28 UTC (rev 8553) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -24,8 +24,8 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.mapmanager.MapManager; -import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; 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-06-28 08:01:28 UTC (rev 8553) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -52,8 +52,8 @@ import net.sf.gridarta.gui.utils.GUIConstants; import net.sf.gridarta.gui.utils.TextComponentUtils; import net.sf.gridarta.mapmanager.MapManager; -import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.Size2D; @@ -403,7 +403,7 @@ * @return the map data panel */ @NotNull - private Component createMapDataPanel(@NotNull final net.sf.gridarta.model.map.maparchobject.MapArchObject<MapArchObject> map) { + private Component createMapDataPanel(@NotNull final net.sf.gridarta.model.maparchobject.MapArchObject<MapArchObject> map) { mapDescription.setText(map.getText()); mapDescription.setCaretPosition(0); final JScrollPane scrollPane = new JScrollPane(mapDescription); 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-06-28 08:01:28 UTC (rev 8553) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -75,10 +75,10 @@ import net.sf.gridarta.model.io.MapWriter; import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.io.SubDirectoryCacheFiles; -import net.sf.gridarta.model.map.maparchobject.MapArchObjectFactory; -import net.sf.gridarta.model.map.mapcontrol.MapControlFactory; -import net.sf.gridarta.model.map.mapmodel.InsertionMode; -import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; +import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; +import net.sf.gridarta.model.mapcontrol.MapControlFactory; +import net.sf.gridarta.model.mapmodel.InsertionMode; +import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/maparchobject/DefaultMapArchObjectFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/maparchobject/DefaultMapArchObjectFactory.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/maparchobject/DefaultMapArchObjectFactory.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -19,7 +19,7 @@ package net.sf.gridarta.var.atrinik.model.maparchobject; -import net.sf.gridarta.model.map.maparchobject.MapArchObjectFactory; +import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.settings.GlobalSettings; import org.jetbrains.annotations.NotNull; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObject.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -19,7 +19,7 @@ package net.sf.gridarta.var.atrinik.model.maparchobject; -import net.sf.gridarta.model.map.maparchobject.AbstractMapArchObject; +import net.sf.gridarta.model.maparchobject.AbstractMapArchObject; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/mapcontrol/DefaultMapControlFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/mapcontrol/DefaultMapControlFactory.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/mapcontrol/DefaultMapControlFactory.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -25,12 +25,12 @@ import net.sf.gridarta.model.autojoin.AutojoinLists; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.MapWriter; -import net.sf.gridarta.model.map.mapcontrol.DefaultMapControl; -import net.sf.gridarta.model.map.mapcontrol.MapControl; -import net.sf.gridarta.model.map.mapcontrol.MapControlFactory; -import net.sf.gridarta.model.map.mapmodel.DefaultMapModel; -import net.sf.gridarta.model.map.mapmodel.InsertionMode; -import net.sf.gridarta.model.map.mapmodel.MapModel; +import net.sf.gridarta.model.mapcontrol.DefaultMapControl; +import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapcontrol.MapControlFactory; +import net.sf.gridarta.model.mapmodel.DefaultMapModel; +import net.sf.gridarta.model.mapmodel.InsertionMode; +import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.settings.GlobalSettings; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/CollectedConfigSource.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/CollectedConfigSource.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/CollectedConfigSource.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -23,7 +23,7 @@ import net.sf.gridarta.model.configsource.AbstractConfigSource; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.settings.GlobalSettings; import org.jetbrains.annotations.NotNull; Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/FilesConfigSource.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/FilesConfigSource.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/FilesConfigSource.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -23,7 +23,7 @@ import net.sf.gridarta.model.configsource.AbstractConfigSource; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.settings.GlobalSettings; import org.jetbrains.annotations.NotNull; Modified: trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObjectTest.java =================================================================== --- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObjectTest.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObjectTest.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -23,7 +23,7 @@ import java.io.IOException; import java.io.StringReader; import net.sf.gridarta.model.io.AbstractMapArchObjectParser; -import net.sf.gridarta.model.map.maparchobject.AbstractMapArchObject; +import net.sf.gridarta.model.maparchobject.AbstractMapArchObject; import net.sf.gridarta.utils.Size2D; import net.sf.gridarta.var.atrinik.model.io.MapArchObjectParser; import org.junit.Assert; @@ -37,7 +37,7 @@ /** * Test for {@link net.sf.gridarta.model.io.AbstractMapArchObjectParser#load(BufferedReader, - * net.sf.gridarta.model.map.maparchobject.MapArchObject)}. + * net.sf.gridarta.model.maparchobject.MapArchObject)}. * @throws IOException (unexpected) */ @Test Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/AbstractFlatMapRenderer.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -32,15 +32,15 @@ import net.sf.gridarta.gui.map.renderer.AbstractMapRenderer; import net.sf.gridarta.gui.map.renderer.GridMapSquarePainter; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.mapgrid.MapGrid; -import net.sf.gridarta.model.map.mapgrid.MapGridEvent; -import net.sf.gridarta.model.map.mapgrid.MapGridListener; -import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.mapmodel.MapModelListener; -import net.sf.gridarta.model.map.mapmodel.MapSquare; -import net.sf.gridarta.model.map.validation.ErrorCollector; +import net.sf.gridarta.model.mapgrid.MapGrid; +import net.sf.gridarta.model.mapgrid.MapGridEvent; +import net.sf.gridarta.model.mapgrid.MapGridListener; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.MapModelListener; +import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.mapviewsettings.MapViewSettingsListener; +import net.sf.gridarta.model.validation.ErrorCollector; import net.sf.gridarta.utils.Size2D; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/DefaultRendererFactory.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -24,8 +24,8 @@ import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.mapgrid.MapGrid; -import net.sf.gridarta.model.map.mapmodel.MapModel; +import net.sf.gridarta.model.mapgrid.MapGrid; +import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -37,9 +37,9 @@ import net.sf.gridarta.model.filter.FilterConfigChangeType; import net.sf.gridarta.model.filter.FilterConfigListener; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.mapgrid.MapGrid; -import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.mapmodel.MapSquare; +import net.sf.gridarta.model.mapgrid.MapGrid; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.crossfire.IGUIConstants; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -27,9 +27,9 @@ import net.sf.gridarta.gui.map.renderer.GridMapSquarePainter; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.map.mapgrid.MapGrid; -import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.mapmodel.MapSquare; +import net.sf.gridarta.model.mapgrid.MapGrid; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.MapSquare; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.utils.CommonConstants; import net.sf.gridarta.var.crossfire.IGUIConstants; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -27,7 +27,7 @@ import javax.swing.ImageIcon; import net.sf.gridarta.gui.map.renderer.AbstractMapRenderer; import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.map.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.utils.Size2D; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.var.crossfire.IGUIConstants; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java 2010-06-28 08:01:28 UTC (rev 8553) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SmoothingRenderer.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -25,7 +25,7 @@ import net.sf.gridarta.model.data.NamedObject; import net.sf.gridarta.model.face.FaceObject; import net.sf.gridarta.model.face.FaceObjectProviders; -import net.sf.gridarta.model.map.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.var.crossfire.IGUIConstants; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; 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-06-28 08:01:28 UTC (rev 8553) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/DefaultMapPropertiesDialogFactory.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -24,8 +24,8 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.mapmanager.MapManager; -import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; 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-06-28 08:01:28 UTC (rev 8553) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/mappropertiesdialog/MapPropertiesDialog.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -44,8 +44,8 @@ import net.sf.gridarta.gui.map.maptilepane.FlatMapTilePane; import net.sf.gridarta.gui.utils.TextComponentUtils; import net.sf.gridarta.mapmanager.MapManager; -import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.mappathnormalizer.MapPathNormalizer; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.utils.ActionBuilderUtils; import net.sf.gridarta.utils.Size2D; @@ -544,7 +544,7 @@ * @return Newly created map text panel. */ @NotNull - private Component createMapTextPanel(@NotNull final net.sf.gridarta.model.map.maparchobject.MapArchObject<MapArchObject> map) { + private Component createMapTextPanel(@NotNull final net.sf.gridarta.model.maparchobject.MapArchObject<MapArchObject> map) { final Container panel = new JPanel(new BorderLayout(1, 1)); mapDescription.setText(map.getText()); 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-06-28 08:01:28 UTC (rev 8553) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-06-28 08:18:16 UTC (rev 8554) @@ -70,10 +70,10 @@ import net.sf.gridarta.mod... [truncated message content] |
From: <aki...@us...> - 2010-06-30 19:03:45
|
Revision: 8561 http://gridarta.svn.sourceforge.net/gridarta/?rev=8561&view=rev Author: akirschbaum Date: 2010-06-30 19:03:37 +0000 (Wed, 30 Jun 2010) Log Message: ----------- Extract MapModelFactory from MapControlFactory. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/mapcontrol/DefaultMapControlFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/mapcontrol/DefaultMapControlFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/mapcontrol/DefaultMapControlFactory.java trunk/model/src/app/net/sf/gridarta/model/mapcontrol/MapControlFactory.java trunk/model/src/test/net/sf/gridarta/model/mapcontrol/TestMapControlFactory.java trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModelFactory.java 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-06-30 06:09:26 UTC (rev 8560) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-06-30 19:03:37 UTC (rev 8561) @@ -78,6 +78,7 @@ import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.mapcontrol.MapControlFactory; import net.sf.gridarta.model.mapmodel.InsertionMode; +import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; @@ -283,8 +284,8 @@ */ @NotNull @Override - public MapControlFactory<GameObject, MapArchObject, Archetype> newMapControlFactory(@NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GlobalSettings globalSettings, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode) { - return new DefaultMapControlFactory(archetypeChooserModel, autojoinLists, mapViewSettings, mapWriter, gameObjectFactory, gameObjectMatchers, globalSettings, topmostInsertionMode); + public MapControlFactory<GameObject, MapArchObject, Archetype> newMapControlFactory(@NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter, @NotNull final GlobalSettings globalSettings, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory) { + return new DefaultMapControlFactory(mapWriter, globalSettings, mapModelFactory); } /** @@ -502,8 +503,8 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", true, mapManager, pickmapManager, archetypeSet, mapControlFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); } /** Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/mapcontrol/DefaultMapControlFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/mapcontrol/DefaultMapControlFactory.java 2010-06-30 06:09:26 UTC (rev 8560) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/mapcontrol/DefaultMapControlFactory.java 2010-06-30 19:03:37 UTC (rev 8561) @@ -21,18 +21,12 @@ import java.io.File; import java.util.List; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.model.autojoin.AutojoinLists; -import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.MapWriter; import net.sf.gridarta.model.mapcontrol.DefaultMapControl; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcontrol.MapControlFactory; -import net.sf.gridarta.model.mapmodel.DefaultMapModel; -import net.sf.gridarta.model.mapmodel.InsertionMode; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; @@ -47,74 +41,34 @@ public class DefaultMapControlFactory implements MapControlFactory<GameObject, MapArchObject, Archetype> { /** - * The {@link ArchetypeChooserModel} instance to use. - */ - @NotNull - private final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel; - - /** - * The {@link AutojoinLists} instance to use. - */ - @NotNull - private final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists; - - /** - * The map view settings instance. - */ - @NotNull - private final MapViewSettings mapViewSettings; - - /** * The {@link MapWriter} for saving {@link MapControl} instances. */ @NotNull private final MapWriter<GameObject, MapArchObject, Archetype> mapWriter; /** - * The {@link GameObjectFactory} for creating {@link GameObject}s. - */ - @NotNull - private final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory; - - /** - * The {@link GameObjectMatchers} to use. - */ - @NotNull - private final GameObjectMatchers gameObjectMatchers; - - /** * The {@link GlobalSettings} to use. */ @NotNull private final GlobalSettings globalSettings; /** - * The "topmost" {@link InsertionMode}. + * The {@link MapModelFactory} for creating {@link MapModel} instances. */ @NotNull - private final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode; + private final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory; /** * Creates a new instance. - * @param archetypeChooserModel the archetype chooser model to use - * @param autojoinLists the autojoin lists to use - * @param mapViewSettings the map view settings instance * @param mapWriter the map writer for saving map control instances - * @param gameObjectFactory the game object factory for creating game - * objects - * @param gameObjectMatchers the game object matchers to use * @param globalSettings the global settings to use - * @param topmostInsertionMode the "topmost" insertion mode + * @param mapModelFactory the map model factory for creating map model + * instances */ - public DefaultMapControlFactory(@NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GlobalSettings globalSettings, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode) { - this.archetypeChooserModel = archetypeChooserModel; - this.autojoinLists = autojoinLists; - this.mapViewSettings = mapViewSettings; + public DefaultMapControlFactory(@NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter, @NotNull final GlobalSettings globalSettings, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory) { this.mapWriter = mapWriter; - this.gameObjectFactory = gameObjectFactory; - this.gameObjectMatchers = gameObjectMatchers; this.globalSettings = globalSettings; - this.topmostInsertionMode = topmostInsertionMode; + this.mapModelFactory = mapModelFactory; } /** @@ -123,7 +77,7 @@ @NotNull @Override public MapControl<GameObject, MapArchObject, Archetype> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final File file) { - final MapModel<GameObject, MapArchObject, Archetype> mapModel = newMapModel(mapArchObject); + final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapModelFactory.newMapModel(mapArchObject); if (objects != null) { mapModel.beginTransaction("init"); try { @@ -145,7 +99,7 @@ @Override public MapControl<GameObject, MapArchObject, Archetype> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final File file) { mapArchObject.setDifficulty(1); - final MapModel<GameObject, MapArchObject, Archetype> mapModel = newMapModel(mapArchObject); + final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapModelFactory.newMapModel(mapArchObject); if (objects != null) { mapModel.beginTransaction("init"); try { @@ -161,13 +115,4 @@ return mapControl; } - /** - * {@inheritDoc} - */ - @NotNull - @Override - public MapModel<GameObject, MapArchObject, Archetype> newMapModel(@NotNull final MapArchObject mapArchObject) { - return new DefaultMapModel<GameObject, MapArchObject, Archetype>(autojoinLists, mapArchObject, archetypeChooserModel, mapViewSettings.getEditType(), gameObjectFactory, gameObjectMatchers, topmostInsertionMode); - } - } // class DefaultMapControlFactory 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-06-30 06:09:26 UTC (rev 8560) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-06-30 19:03:37 UTC (rev 8561) @@ -73,6 +73,7 @@ import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.mapcontrol.MapControlFactory; import net.sf.gridarta.model.mapmodel.InsertionMode; +import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; @@ -239,8 +240,8 @@ */ @NotNull @Override - public MapControlFactory<GameObject, MapArchObject, Archetype> newMapControlFactory(@NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GlobalSettings globalSettings, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode) { - return new DefaultMapControlFactory(archetypeChooserModel, autojoinLists, mapViewSettings, mapWriter, gameObjectFactory, gameObjectMatchers, globalSettings, topmostInsertionMode); + public MapControlFactory<GameObject, MapArchObject, Archetype> newMapControlFactory(@NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter, @NotNull final GlobalSettings globalSettings, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory) { + return new DefaultMapControlFactory(mapWriter, globalSettings, mapModelFactory); } /** @@ -398,8 +399,8 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", false, mapManager, pickmapManager, archetypeSet, mapControlFactory, null, "CrossfireEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, this, errorView, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, 0, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, true, scriptedEventEditor, new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", false, mapManager, pickmapManager, archetypeSet, mapModelFactory, null, "CrossfireEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, this, errorView, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, 0, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, true, scriptedEventEditor, new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/mapcontrol/DefaultMapControlFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/mapcontrol/DefaultMapControlFactory.java 2010-06-30 06:09:26 UTC (rev 8560) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/mapcontrol/DefaultMapControlFactory.java 2010-06-30 19:03:37 UTC (rev 8561) @@ -21,18 +21,12 @@ import java.io.File; import java.util.List; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.model.autojoin.AutojoinLists; -import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.MapWriter; import net.sf.gridarta.model.mapcontrol.DefaultMapControl; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcontrol.MapControlFactory; -import net.sf.gridarta.model.mapmodel.DefaultMapModel; -import net.sf.gridarta.model.mapmodel.InsertionMode; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; @@ -47,74 +41,34 @@ public class DefaultMapControlFactory implements MapControlFactory<GameObject, MapArchObject, Archetype> { /** - * The {@link ArchetypeChooserModel} instance to use. - */ - @NotNull - private final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel; - - /** - * The {@link AutojoinLists} instance to use. - */ - @NotNull - private final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists; - - /** - * The map view settings instance. - */ - @NotNull - private final MapViewSettings mapViewSettings; - - /** * The {@link MapWriter} for saving {@link MapControl} instances. */ @NotNull private final MapWriter<GameObject, MapArchObject, Archetype> mapWriter; /** - * The {@link GameObjectFactory} for creating {@link GameObject}s. - */ - @NotNull - private final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory; - - /** - * The {@link GameObjectMatchers} to use. - */ - @NotNull - private final GameObjectMatchers gameObjectMatchers; - - /** * The {@link GlobalSettings} to use. */ @NotNull private final GlobalSettings globalSettings; /** - * The "topmost" {@link InsertionMode}. + * The {@link MapModelFactory} for creating {@link MapModel} instances. */ @NotNull - private final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode; + private final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory; /** * Creates a new instance. - * @param archetypeChooserModel the archetype chooser model to use - * @param autojoinLists the autojoin lists to use - * @param mapViewSettings the map view settings instance * @param mapWriter the map writer for saving map control instances - * @param gameObjectFactory the game object factory for creating game - * objects - * @param gameObjectMatchers the game object matchers to use * @param globalSettings the global settings to use - * @param topmostInsertionMode the "topmost" insertion mode + * @param mapModelFactory the map model factory for creating map model + * instances */ - public DefaultMapControlFactory(@NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GlobalSettings globalSettings, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode) { - this.archetypeChooserModel = archetypeChooserModel; - this.autojoinLists = autojoinLists; - this.mapViewSettings = mapViewSettings; + public DefaultMapControlFactory(@NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter, @NotNull final GlobalSettings globalSettings, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory) { this.mapWriter = mapWriter; - this.gameObjectFactory = gameObjectFactory; - this.gameObjectMatchers = gameObjectMatchers; this.globalSettings = globalSettings; - this.topmostInsertionMode = topmostInsertionMode; + this.mapModelFactory = mapModelFactory; } /** @@ -123,7 +77,7 @@ @NotNull @Override public MapControl<GameObject, MapArchObject, Archetype> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final File file) { - final MapModel<GameObject, MapArchObject, Archetype> mapModel = newMapModel(mapArchObject); + final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapModelFactory.newMapModel(mapArchObject); if (objects != null) { mapModel.beginTransaction("init"); try { @@ -144,7 +98,7 @@ @NotNull @Override public MapControl<GameObject, MapArchObject, Archetype> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final File file) { - final MapModel<GameObject, MapArchObject, Archetype> mapModel = newMapModel(mapArchObject); + final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapModelFactory.newMapModel(mapArchObject); if (objects != null) { mapModel.beginTransaction("init"); try { @@ -160,13 +114,4 @@ return mapControl; } - /** - * {@inheritDoc} - */ - @NotNull - @Override - public MapModel<GameObject, MapArchObject, Archetype> newMapModel(@NotNull final MapArchObject mapArchObject) { - return new DefaultMapModel<GameObject, MapArchObject, Archetype>(autojoinLists, mapArchObject, archetypeChooserModel, mapViewSettings.getEditType(), gameObjectFactory, gameObjectMatchers, topmostInsertionMode); - } - } // class DefaultMapControlFactory 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-06-30 06:09:26 UTC (rev 8560) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-06-30 19:03:37 UTC (rev 8561) @@ -78,6 +78,7 @@ import net.sf.gridarta.model.maparchobject.MapArchObjectFactory; import net.sf.gridarta.model.mapcontrol.MapControlFactory; import net.sf.gridarta.model.mapmodel.InsertionMode; +import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.mappathnormalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; @@ -284,8 +285,8 @@ */ @NotNull @Override - public MapControlFactory<GameObject, MapArchObject, Archetype> newMapControlFactory(@NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GlobalSettings globalSettings, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode) { - return new DefaultMapControlFactory(archetypeChooserModel, autojoinLists, mapViewSettings, mapWriter, gameObjectFactory, gameObjectMatchers, globalSettings, topmostInsertionMode); + public MapControlFactory<GameObject, MapArchObject, Archetype> newMapControlFactory(@NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter, @NotNull final GlobalSettings globalSettings, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory) { + return new DefaultMapControlFactory(mapWriter, globalSettings, mapModelFactory); } /** @@ -503,8 +504,8 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(GuiFileFilters.luaFileFilter, ".lua", true, mapManager, pickmapManager, archetypeSet, mapControlFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + return mainControl.createGUIMainControl(GuiFileFilters.luaFileFilter, ".lua", true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/mapcontrol/DefaultMapControlFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/mapcontrol/DefaultMapControlFactory.java 2010-06-30 06:09:26 UTC (rev 8560) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/mapcontrol/DefaultMapControlFactory.java 2010-06-30 19:03:37 UTC (rev 8561) @@ -21,18 +21,12 @@ import java.io.File; import java.util.List; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.model.autojoin.AutojoinLists; -import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.io.MapWriter; import net.sf.gridarta.model.mapcontrol.DefaultMapControl; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapcontrol.MapControlFactory; -import net.sf.gridarta.model.mapmodel.DefaultMapModel; -import net.sf.gridarta.model.mapmodel.InsertionMode; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; @@ -47,74 +41,34 @@ public class DefaultMapControlFactory implements MapControlFactory<GameObject, MapArchObject, Archetype> { /** - * The {@link ArchetypeChooserModel} instance to use. - */ - @NotNull - private final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel; - - /** - * The {@link AutojoinLists} instance to use. - */ - @NotNull - private final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists; - - /** - * The map view settings instance. - */ - @NotNull - private final MapViewSettings mapViewSettings; - - /** * The {@link MapWriter} for saving {@link MapControl} instances. */ @NotNull private final MapWriter<GameObject, MapArchObject, Archetype> mapWriter; /** - * The {@link GameObjectFactory} for creating {@link GameObject}s. - */ - @NotNull - private final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory; - - /** - * The {@link GameObjectMatchers} to use. - */ - @NotNull - private final GameObjectMatchers gameObjectMatchers; - - /** * The {@link GlobalSettings} to use. */ @NotNull private final GlobalSettings globalSettings; /** - * The "topmost" {@link InsertionMode}. + * The {@link MapModelFactory} for creating {@link MapModel} instances. */ @NotNull - private final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode; + private final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory; /** * Creates a new instance. - * @param archetypeChooserModel the archetype chooser model to use - * @param autojoinLists the autojoin lists to use - * @param mapViewSettings the map view settings instance * @param mapWriter the map writer for saving map control instances - * @param gameObjectFactory the game object factory for creating game - * objects - * @param gameObjectMatchers the game object matchers to use * @param globalSettings the global settings to use - * @param topmostInsertionMode the "topmost" insertion mode + * @param mapModelFactory the map model factory for creating map model + * instances */ - public DefaultMapControlFactory(@NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GlobalSettings globalSettings, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode) { - this.archetypeChooserModel = archetypeChooserModel; - this.autojoinLists = autojoinLists; - this.mapViewSettings = mapViewSettings; + public DefaultMapControlFactory(@NotNull final MapWriter<GameObject, MapArchObject, Archetype> mapWriter, @NotNull final GlobalSettings globalSettings, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory) { this.mapWriter = mapWriter; - this.gameObjectFactory = gameObjectFactory; - this.gameObjectMatchers = gameObjectMatchers; this.globalSettings = globalSettings; - this.topmostInsertionMode = topmostInsertionMode; + this.mapModelFactory = mapModelFactory; } /** @@ -123,7 +77,7 @@ @NotNull @Override public MapControl<GameObject, MapArchObject, Archetype> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final File file) { - final MapModel<GameObject, MapArchObject, Archetype> mapModel = newMapModel(mapArchObject); + final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapModelFactory.newMapModel(mapArchObject); if (objects != null) { mapModel.beginTransaction("init"); try { @@ -145,7 +99,7 @@ @Override public MapControl<GameObject, MapArchObject, Archetype> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @Nullable final File file) { mapArchObject.setDifficulty(1); - final MapModel<GameObject, MapArchObject, Archetype> mapModel = newMapModel(mapArchObject); + final MapModel<GameObject, MapArchObject, Archetype> mapModel = mapModelFactory.newMapModel(mapArchObject); if (objects != null) { mapModel.beginTransaction("init"); try { @@ -161,13 +115,4 @@ return mapControl; } - /** - * {@inheritDoc} - */ - @NotNull - @Override - public MapModel<GameObject, MapArchObject, Archetype> newMapModel(@NotNull final MapArchObject mapArchObject) { - return new DefaultMapModel<GameObject, MapArchObject, Archetype>(autojoinLists, mapArchObject, archetypeChooserModel, mapViewSettings.getEditType(), gameObjectFactory, gameObjectMatchers, topmostInsertionMode); - } - } // class DefaultMapControlFactory Modified: trunk/model/src/app/net/sf/gridarta/model/mapcontrol/MapControlFactory.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapcontrol/MapControlFactory.java 2010-06-30 06:09:26 UTC (rev 8560) +++ trunk/model/src/app/net/sf/gridarta/model/mapcontrol/MapControlFactory.java 2010-06-30 19:03:37 UTC (rev 8561) @@ -24,7 +24,6 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.model.mapmodel.MapModel; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -54,12 +53,4 @@ @NotNull MapControl<G, A, R> newPickmapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @Nullable File file); - /** - * Creates a new {@link MapModel} instance. - * @param mapArchObject the map arch object to use for the new map model - * @return the new map model instance - */ - @NotNull - MapModel<G, A, R> newMapModel(@NotNull A mapArchObject); - } // interface MapControlFactory Added: trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModelFactory.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModelFactory.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModelFactory.java 2010-06-30 19:03:37 UTC (rev 8561) @@ -0,0 +1,103 @@ +/* + * 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.mapmodel; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.model.autojoin.AutojoinLists; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.gameobject.GameObjectFactory; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; +import net.sf.gridarta.model.match.GameObjectMatchers; +import org.jetbrains.annotations.NotNull; + +/** + * A factory for creating {@link MapModel} instances. + * @author Andreas Kirschbaum + */ +public class MapModelFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * The {@link ArchetypeChooserModel} instance to use. + */ + @NotNull + private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; + + /** + * The {@link AutojoinLists} instance to use. + */ + @NotNull + private final AutojoinLists<G, A, R> autojoinLists; + + /** + * The map view settings instance. + */ + @NotNull + private final MapViewSettings mapViewSettings; + + /** + * The {@link GameObjectFactory} for creating {@link GameObject}s. + */ + @NotNull + private final GameObjectFactory<G, A, R> gameObjectFactory; + + /** + * The {@link GameObjectMatchers} to use. + */ + @NotNull + private final GameObjectMatchers gameObjectMatchers; + + /** + * The "topmost" {@link InsertionMode}. + */ + @NotNull + private final InsertionMode<G, A, R> topmostInsertionMode; + + /** + * Creates a new instance. + * @param archetypeChooserModel the archetype chooser model to use + * @param autojoinLists the autojoin lists to use + * @param mapViewSettings the map view settings instance + * @param gameObjectFactory the game object factory for creating game + * objects + * @param gameObjectMatchers the game object matchers to use + * @param topmostInsertionMode the "topmost" insertion mode + */ + public MapModelFactory(@NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapViewSettings mapViewSettings, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final InsertionMode<G, A, R> topmostInsertionMode) { + this.archetypeChooserModel = archetypeChooserModel; + this.autojoinLists = autojoinLists; + this.mapViewSettings = mapViewSettings; + this.gameObjectFactory = gameObjectFactory; + this.gameObjectMatchers = gameObjectMatchers; + this.topmostInsertionMode = topmostInsertionMode; + } + + /** + * Creates a new {@link MapModel} instance. + * @param mapArchObject the map arch object for the map model + * @return the map model instance + */ + @NotNull + public MapModel<G, A, R> newMapModel(@NotNull final A mapArchObject) { + return new DefaultMapModel<G, A, R>(autojoinLists, mapArchObject, archetypeChooserModel, mapViewSettings.getEditType(), gameObjectFactory, gameObjectMatchers, topmostInsertionMode); + } + +} // class MapModelFactory Property changes on: trunk/model/src/app/net/sf/gridarta/model/mapmodel/MapModelFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/test/net/sf/gridarta/model/mapcontrol/TestMapControlFactory.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapcontrol/TestMapControlFactory.java 2010-06-30 06:09:26 UTC (rev 8560) +++ trunk/model/src/test/net/sf/gridarta/model/mapcontrol/TestMapControlFactory.java 2010-06-30 19:03:37 UTC (rev 8561) @@ -22,16 +22,11 @@ import java.io.File; import java.util.List; import net.sf.gridarta.model.archetype.TestArchetype; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.model.autojoin.AutojoinLists; -import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.io.MapWriter; import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.gridarta.model.mapmodel.DefaultMapModel; -import net.sf.gridarta.model.mapmodel.InsertionMode; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.mapmodel.MapModelFactory; import net.sf.gridarta.model.settings.GlobalSettings; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -49,60 +44,28 @@ private final MapWriter<TestGameObject, TestMapArchObject, TestArchetype> mapWriter; /** - * The {@link AutojoinLists} for new maps. - */ - @NotNull - private final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists; - - /** - * The {@link ArchetypeChooserModel} for new maps. - */ - @NotNull - private final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel; - - /** - * The {@link GameObjectFactory} for for creating game objects. - */ - @NotNull - private final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory; - - /** * The {@link GlobalSettings} to use. */ @NotNull private final GlobalSettings globalSettings; /** - * The {@link GameObjectMatchers} to use. + * The {@link MapModelFactory} for creating {@link MapModel} instances. */ @NotNull - private final GameObjectMatchers gameObjectMatchers; + private final MapModelFactory<TestGameObject, TestMapArchObject, TestArchetype> mapModelFactory; /** - * The "topmost" {@link InsertionMode}. - */ - @NotNull - private final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode; - - /** * Creates a new instance. * @param mapWriter the map writer for saving map control instances - * @param autojoinLists the autojoin lists for new maps - * @param archetypeChooserModel the autojoin lists - * @param gameObjectFactory the game object factory for creating game - * objects * @param globalSettings the global settings to use - * @param gameObjectMatchers the game object matchers to use - * @param topmostInsertionMode the "topmost" insertion mode + * @param mapModelFactory... [truncated message content] |
From: <aki...@us...> - 2010-06-30 19:27:30
|
Revision: 8562 http://gridarta.svn.sourceforge.net/gridarta/?rev=8562&view=rev Author: akirschbaum Date: 2010-06-30 19:27:19 +0000 (Wed, 30 Jun 2010) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/gridarta.ipr trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java trunk/model/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java trunk/model/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEvent.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 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-06-30 19:03:37 UTC (rev 8561) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-06-30 19:27:19 UTC (rev 8562) @@ -139,8 +139,6 @@ import net.sf.gridarta.var.atrinik.model.scripts.DefaultScriptedEventFactory; import net.sf.gridarta.var.atrinik.model.settings.DefaultGlobalSettings; import net.sf.gridarta.var.atrinik.resource.DefaultResources; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.prefs.PreferencesGroup; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -183,11 +181,6 @@ private static final Category log = Logger.getLogger(DefaultEditorFactory.class); /** - * Action Builder. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** * The {@link IsoMapSquareInfo} instance. */ @NotNull @@ -503,8 +496,8 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); } /** 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-06-30 19:03:37 UTC (rev 8561) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-06-30 19:27:19 UTC (rev 8562) @@ -399,8 +399,8 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", false, mapManager, pickmapManager, archetypeSet, mapModelFactory, null, "CrossfireEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, this, errorView, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, 0, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, true, scriptedEventEditor, new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + return mainControl.createGUIMainControl(GuiFileFilters.pythonFileFilter, ".py", false, mapManager, pickmapManager, archetypeSet, mapModelFactory, null, "CrossfireEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, null, this, errorView, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, 0, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, true, scriptedEventEditor, new Direction[] { Direction.NORTH, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); } /** 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-06-30 19:03:37 UTC (rev 8561) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-06-30 19:27:19 UTC (rev 8562) @@ -140,8 +140,6 @@ import net.sf.gridarta.var.daimonin.model.scripts.DefaultScriptedEventFactory; import net.sf.gridarta.var.daimonin.model.settings.DefaultGlobalSettings; import net.sf.gridarta.var.daimonin.resource.DefaultResources; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.prefs.PreferencesGroup; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -184,11 +182,6 @@ private static final Category log = Logger.getLogger(DefaultEditorFactory.class); /** - * Action Builder. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** * The {@link IsoMapSquareInfo} instance. */ @NotNull @@ -504,8 +497,8 @@ */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { - return mainControl.createGUIMainControl(GuiFileFilters.luaFileFilter, ".lua", true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, attributeRangeChecker, pluginParameterFactory); + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapModelFactory<GameObject, MapArchObject, Archetype> mapModelFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects<GameObject, MapArchObject, Archetype> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects<GameObject, MapArchObject, Archetype> animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> gameObjectSpells, @NotNull final PluginParameterFactory<GameObject, MapArchObject, Archetype> pluginParameterFactory) { + return mainControl.createGUIMainControl(GuiFileFilters.luaFileFilter, ".lua", true, mapManager, pickmapManager, archetypeSet, mapModelFactory, guiUtils.getResourceIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFERENCES_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubDirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new Direction[] { Direction.NORTH_EAST, Direction.SOUTH_EAST, Direction.SOUTH_WEST, Direction.NORTH_WEST, Direction.EAST, Direction.SOUTH, Direction.WEST, Direction.NORTH, }, resources, gameObjectSpells, numberSpells, pluginParameterFactory); } /** Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-06-30 19:03:37 UTC (rev 8561) +++ trunk/gridarta.ipr 2010-06-30 19:27:19 UTC (rev 8562) @@ -956,8 +956,8 @@ <inspection_tool class="XsltUnusedDeclaration" level="WARNING" enabled="false" /> </profile> </profiles> - <option name="PROJECT_PROFILE" value="Project Default" /> - <option name="USE_PROJECT_PROFILE" value="true" /> + <option name="PROJECT_PROFILE" /> + <option name="USE_PROJECT_PROFILE" value="false" /> <version value="1.0" /> <list size="5"> <item index="0" class="java.lang.String" itemvalue="SERVER PROBLEM" /> Modified: trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java 2010-06-30 19:03:37 UTC (rev 8561) +++ trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java 2010-06-30 19:27:19 UTC (rev 8562) @@ -21,9 +21,7 @@ import java.io.Serializable; import java.util.ArrayList; -import java.util.IdentityHashMap; import java.util.List; -import java.util.Map; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; @@ -86,7 +84,7 @@ throw new IllegalAutojoinListException("autojoin list with less than " + SIZE + " valid entries"); } - final Map<R, R> tmp = new IdentityHashMap<R, R>(); + //final Map<R, R> tmp = new IdentityHashMap<R, R>(); for (final R archetype : newArchetypes) { if (archetype == null) { throw new IllegalArgumentException(); Modified: trunk/model/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java 2010-06-30 19:03:37 UTC (rev 8561) +++ trunk/model/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java 2010-06-30 19:27:19 UTC (rev 8562) @@ -432,7 +432,7 @@ protected abstract int loadEditType(); /** - * Saves the {@link #editType} }value. + * Saves the {@link #editType} value. * @param editType the edit type value */ protected abstract void saveEditType(final int editType); Modified: trunk/model/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEvent.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEvent.java 2010-06-30 19:03:37 UTC (rev 8561) +++ trunk/model/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEvent.java 2010-06-30 19:27:19 UTC (rev 8562) @@ -32,11 +32,6 @@ */ public abstract class AbstractScriptedEvent<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements ScriptedEvent<G, A, R> { - /** - * The Logger for printing log messages. - */ - private static final Category log = Logger.getLogger(AbstractScriptedEvent.class); - @NotNull protected abstract String typeName(final int eventType); Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-06-30 19:03:37 UTC (rev 8561) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-06-30 19:27:19 UTC (rev 8562) @@ -354,12 +354,11 @@ * @param resources the resources * @param gameObjectSpells the game object spells to use * @param numberSpells the number spells to use - * @param attributeRangeChecker the attribute range checker to use * @param pluginParameterFactory the plugin parameter factory to use * @return the new instance */ - public GUIMainControl<G, A, R> createGUIMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault, @Nullable final String spellFile, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final CacheFiles cacheFiles, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final FaceObjects<G, A, R> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, final int undefinedSpellIndex, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final String scriptsDir, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final AnimationObjects<G, A, R> animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, final boolean allowRandomMapParameters, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final Direction[] directionMap, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { - return new GUIMainControl<G, A, R>(createDirectionPane, mapManager, pickmapManager, archetypeSet, faceObjects, globalSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, compassIcon, gridartaJarFilename, GuiFileFilters.mapFileFilter, scriptFileFilter, scriptExtension, validators, resources, gameObjectMatchers, errorView, attributeRangeChecker, lockedItemsTypeNumbers, scriptsDir, scriptModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchData, scriptArchDataUtils, scriptArchUtils, autoValidatorDefault, spellFile, allowRandomMapParameters, directionMap, editorFactory, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, cacheFiles, gameObjectSpells, numberSpells, undefinedSpellIndex, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, scriptExecutor, scriptParameters); + public GUIMainControl<G, A, R> createGUIMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault, @Nullable final String spellFile, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final CacheFiles cacheFiles, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final FaceObjects<G, A, R> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, final int undefinedSpellIndex, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final String scriptsDir, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final AnimationObjects<G, A, R> animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, final boolean allowRandomMapParameters, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final Direction[] directionMap, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { + return new GUIMainControl<G, A, R>(createDirectionPane, mapManager, pickmapManager, archetypeSet, faceObjects, globalSettings, mapViewSettings, mapModelFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, compassIcon, gridartaJarFilename, GuiFileFilters.mapFileFilter, scriptFileFilter, scriptExtension, validators, resources, gameObjectMatchers, errorView, lockedItemsTypeNumbers, scriptsDir, scriptModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchData, scriptArchDataUtils, scriptArchUtils, autoValidatorDefault, spellFile, allowRandomMapParameters, directionMap, editorFactory, faceObjectProviders, pluginParameterFactory, gameObjectFactory, pathManager, cacheFiles, gameObjectSpells, numberSpells, undefinedSpellIndex, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, scriptExecutor, scriptParameters); } } // class DefaultMainControl Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-06-30 19:03:37 UTC (rev 8561) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-06-30 19:27:19 UTC (rev 8562) @@ -369,12 +369,11 @@ * @param resources the resources * @param numberSpells the number spells to use * @param gameObjectSpells the game object spells to use - * @param attributeRangeChecker the attribute range checker to use * @param pluginParameterFactory the plugin parameter factory to use * @return the new instance */ @NotNull - GUIMainControl<G, A, R> createGUIMainControl(@NotNull DefaultMainControl<G, A, R> mainControl, @NotNull ErrorView errorView, @NotNull GUIUtils guiUtils, @NotNull ConfigSourceFactory configSourceFactory, @NotNull RendererFactory<G, A, R> rendererFactory, @NotNull FilterControl<G, A, R> filterControl, @NotNull ScriptExecutor<G, A, R> scriptExecutor, @NotNull ScriptParameters scriptParameters, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull MapManager<G, A, R> pickmapManager, @NotNull MapModelFactory<G, A, R> mapModelFactory, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull FaceObjects<G, A, R> faceObjects, @NotNull GlobalSettings globalSettings, @NotNull MapViewSettings mapViewSettings, @NotNull FaceObjectProviders faceObjectProviders, @NotNull PathManager pathManager, @NotNull InsertionMode<G, A, R> topmostInsertionMode, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull SystemIcons systemIcons, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull MapArchObjectFactory<A> mapArchObjectFactory, @NotNull DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull ScriptModel<G, A, R> scriptModel, @NotNull AnimationObjects<G, A, R> animationObjects, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory); + GUIMainControl<G, A, R> createGUIMainControl(@NotNull DefaultMainControl<G, A, R> mainControl, @NotNull ErrorView errorView, @NotNull GUIUtils guiUtils, @NotNull ConfigSourceFactory configSourceFactory, @NotNull RendererFactory<G, A, R> rendererFactory, @NotNull FilterControl<G, A, R> filterControl, @NotNull ScriptExecutor<G, A, R> scriptExecutor, @NotNull ScriptParameters scriptParameters, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull MapManager<G, A, R> pickmapManager, @NotNull MapModelFactory<G, A, R> mapModelFactory, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull FaceObjects<G, A, R> faceObjects, @NotNull GlobalSettings globalSettings, @NotNull MapViewSettings mapViewSettings, @NotNull FaceObjectProviders faceObjectProviders, @NotNull PathManager pathManager, @NotNull InsertionMode<G, A, R> topmostInsertionMode, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull SystemIcons systemIcons, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull MapArchObjectFactory<A> mapArchObjectFactory, @NotNull DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull ScriptModel<G, A, R> scriptModel, @NotNull AnimationObjects<G, A, R> animationObjects, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory); /** * Creates a new {@link AbstractResources} instance. Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-06-30 19:03:37 UTC (rev 8561) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-06-30 19:27:19 UTC (rev 8562) @@ -172,7 +172,6 @@ import net.sf.gridarta.utils.ProcessRunner; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.validation.DelegatingMapValidator; -import net.sf.gridarta.validation.checks.AttributeRangeChecker; import net.sf.gridarta.validation.checks.BlockedSquareChecker; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; @@ -389,7 +388,6 @@ * @param resources the resources to collect * @param gameObjectMatchers the game object matchers instance * @param errorView the error view for reporting errors - * @param attributeRangeChecker the attribute range checker instance * @param lockedItemsTypeNumbers the type numbers of game objects being * locked items * @param scriptsDir the plugin scripts directory @@ -424,7 +422,7 @@ * @param scriptExecutor the script executor instance * @param scriptParameters the script parameters instance */ - public GUIMainControl(final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects<G, A, R> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final MapReaderFactory<G, A> mapReaderFactory, final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final ArchetypeTypeSet archetypeTypeSet, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AbstractResources<G, A, R> resources, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorView errorView, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final int[] lockedItemsTypeNumbers, @NotNull final String scriptsDir, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AnimationObjects<G, A, R> animationObjects, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchData<G, A, R> scriptArchData, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, final boolean autoValidatorDefault, @Nullable final String spellFile, final boolean allowRandomMapParameters, @NotNull final Direction[] directionMap, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final PathManager pathManager, @NotNull final CacheFiles cacheFiles, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters) { + public GUIMainControl(final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects<G, A, R> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final MapReaderFactory<G, A> mapReaderFactory, final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final ArchetypeTypeSet archetypeTypeSet, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AbstractResources<G, A, R> resources, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorView errorView, @NotNull final int[] lockedItemsTypeNumbers, @NotNull final String scriptsDir, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AnimationObjects<G, A, R> animationObjects, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchData<G, A, R> scriptArchData, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, @NotNull final ScriptArchUtils scriptArchUtils, final boolean autoValidatorDefault, @Nullable final String spellFile, final boolean allowRandomMapParameters, @NotNull final Direction[] directionMap, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final PathManager pathManager, @NotNull final CacheFiles cacheFiles, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters) { this.archetypeSet = archetypeSet; this.configSourceFactory = configSourceFactory; this.rendererFactory = rendererFactory; Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-06-30 19:03:37 UTC (rev 8561) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-06-30 19:27:19 UTC (rev 8562) @@ -293,7 +293,7 @@ try { switch (mode) { case NORMAL: - returnCode = runNormal(args2, mainControl, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, mapManager, pickmapManager, mapModelFactory, archetypeSet, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, scriptModel, animationObjects, archetypeChooserModel, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory); + returnCode = runNormal(args2, mainControl, editorFactory, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, mapManager, pickmapManager, mapModelFactory, archetypeSet, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, scriptModel, animationObjects, archetypeChooserModel, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory); break; case BATCH_PNG: @@ -413,18 +413,17 @@ * @param resources the resources * @param numberSpells the number spells to use * @param gameObjectSpells the game object spells to use - * @param attributeRangeChecker the attribute range checker to use * @param pluginParameterFactory the plugin parameter factory to use * @return return code suitable for passing to {@link System#exit(int)} */ - private int runNormal(@NotNull final Iterable<String> args, @NotNull final DefaultMainControl<G, A, R> mainControl, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects<G, A, R> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final AnimationObjects<G, A, R> animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { + private int runNormal(@NotNull final Iterable<String> args, @NotNull final DefaultMainControl<G, A, R> mainControl, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final MapModelFactory<G, A, R> mapModelFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects<G, A, R> faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final AnimationObjects<G, A, R> animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final AbstractResources<G, A, R> resources, @NotNull final Spells<NumberSpell> numberSpells, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory) { final GUIMainControl<?, ?, ?>[] guiMainControl = new GUIMainControl<?, ?, ?>[1]; final Runnable runnable = new Runnable() { /** {@inheritDoc} */ @Override public void run() { - guiMainControl[0] = editorFactory.createGUIMainControl(mainControl, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, mapManager, pickmapManager, mapModelFactory, archetypeSet, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, scriptModel, animationObjects, archetypeChooserModel, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory); + guiMainControl[0] = editorFactory.createGUIMainControl(mainControl, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, mapManager, pickmapManager, mapModelFactory, archetypeSet, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, scriptModel, animationObjects, archetypeChooserModel, scriptedEventEditor, resources, numberSpells, gameObjectSpells, pluginParameterFactory); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-01 17:22:34
|
Revision: 8567 http://gridarta.svn.sourceforge.net/gridarta/?rev=8567&view=rev Author: akirschbaum Date: 2010-07-01 17:22:27 +0000 (Thu, 01 Jul 2010) Log Message: ----------- Remove dependency ArchetypeType -> ActionBuilder. Modified Paths: -------------- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java Modified: trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2010-06-30 19:52:40 UTC (rev 8566) +++ trunk/model/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2010-07-01 17:22:27 UTC (rev 8567) @@ -21,8 +21,6 @@ import java.util.Iterator; import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -36,11 +34,6 @@ public class ArchetypeType implements Iterable<ArchetypeAttribute> { /** - * Action Builder. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** * The type name (artificial). */ @NotNull @@ -113,14 +106,6 @@ } /** - * Create the documentation to this GameObject-type. - * @return the full html-text to be (parsed and) displayed - */ - public String createHtmlDocumentation() { - return ACTION_BUILDER.format("arcDoc.htmlText", typeName, description != null ? description.trim() : "", use != null ? use.trim() : ""); - } - - /** * {@inheritDoc} */ @NotNull @@ -165,6 +150,24 @@ } /** + * Returns the description. + * @return the description + */ + @NotNull + public String getDescription() { + return description == null ? "" : description.trim(); + } + + /** + * Returns the usage notes. + * @return the usage notes + */ + @NotNull + public String getUse() { + return use == null ? "" : use.trim(); + } + + /** * Checks whether a {@link BaseObject} matches all type attributes. * @param baseObject the base object to check * @return whether the base object matches Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-06-30 19:52:40 UTC (rev 8566) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2010-07-01 17:22:27 UTC (rev 8567) @@ -1158,7 +1158,8 @@ */ @ActionMethod public void attribHelp() { - new Help(/* XXX */ parent, typesBoxItemListener.archetypeType.createHtmlDocumentation()).setVisible(true); + final String helpText = ACTION_BUILDER.format("arcDoc.htmlText", typesBoxItemListener.archetypeType.getTypeName(), typesBoxItemListener.archetypeType.getDescription(), typesBoxItemListener.archetypeType.getUse()); + new Help(/* XXX */ parent, helpText).setVisible(true); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-01 19:12:12
|
Revision: 8571 http://gridarta.svn.sourceforge.net/gridarta/?rev=8571&view=rev Author: akirschbaum Date: 2010-07-01 19:12:05 +0000 (Thu, 01 Jul 2010) Log Message: ----------- Add TestAnimationObjects and TestFaceObjects; use these instead of DefaultAnimationObjects and DefaultFaceObjects in regression tests. Modified Paths: -------------- trunk/build.xml trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java trunk/model/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java trunk/model/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java trunk/model/src/test/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java Added Paths: ----------- trunk/model/src/test/net/sf/gridarta/model/anim/ trunk/model/src/test/net/sf/gridarta/model/anim/TestAnimationObjects.java trunk/model/src/test/net/sf/gridarta/model/face/ trunk/model/src/test/net/sf/gridarta/model/face/TestFaceObjects.java Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2010-07-01 18:36:35 UTC (rev 8570) +++ trunk/build.xml 2010-07-01 19:12:05 UTC (rev 8571) @@ -382,6 +382,7 @@ <javac srcdir="model/src/test" destdir="dest/model/test" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> <fileset dir="lib" includes="annotations.jar"/> + <fileset dir="lib" includes="japi-lib-swing-misc-trunk-1398.jar"/> <fileset dir="lib" includes="junit-4.2.jar"/> <fileset dir="lib" includes="log4j-1.2.13.jar"/> <pathelement location="dest/model/app"/> Added: trunk/model/src/test/net/sf/gridarta/model/anim/TestAnimationObjects.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/anim/TestAnimationObjects.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/anim/TestAnimationObjects.java 2010-07-01 19:12:05 UTC (rev 8571) @@ -0,0 +1,57 @@ +/* + * 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.anim; + +import java.io.File; +import java.io.IOException; +import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.gameobject.TestGameObject; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.japi.swing.misc.Progress; +import org.jetbrains.annotations.NotNull; + +/** + * An {@link AnimationObjects} for regression tests. + * @author Andreas Kirschbaum + */ +public class TestAnimationObjects extends AbstractAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance. + */ + public TestAnimationObjects() { + super("anim"); + } + + /** + * {@inheritDoc} + */ + @Override + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser) throws IOException { + throw new AssertionError(); + } + +} // class TestAnimationObjects Property changes on: trunk/model/src/test/net/sf/gridarta/model/anim/TestAnimationObjects.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2010-07-01 18:36:35 UTC (rev 8570) +++ trunk/model/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2010-07-01 19:12:05 UTC (rev 8571) @@ -20,13 +20,11 @@ package net.sf.gridarta.model.archetype; import java.io.IOException; -import java.util.regex.Pattern; import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.DefaultAnimationObjects; -import net.sf.gridarta.model.face.ArchFaceProvider; -import net.sf.gridarta.model.face.DefaultFaceObjects; +import net.sf.gridarta.model.anim.TestAnimationObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.gameobject.TestGameObjectFactory; import net.sf.gridarta.model.maparchobject.TestMapArchObject; @@ -126,12 +124,11 @@ @NotNull @Override protected AbstractArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype, ? extends AbstractArchetypeBuilder<TestGameObject, TestMapArchObject, TestArchetype>> newArchetypeParser() { - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new DefaultFaceObjects<TestGameObject, TestMapArchObject, TestArchetype>("png", "facetree", Pattern.compile(".*"), "facetree.output", archFaceProvider); + final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("animtree"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); final TestArchetypeBuilder archetypeBuilder = new TestArchetypeBuilder(gameObjectFactory); final TestArchetypeFactory archetypeFactory = new TestArchetypeFactory(); Modified: trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java 2010-07-01 18:36:35 UTC (rev 8570) +++ trunk/model/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeTest.java 2010-07-01 19:12:05 UTC (rev 8571) @@ -19,15 +19,13 @@ package net.sf.gridarta.model.archetypetype; -import java.util.regex.Pattern; import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.DefaultAnimationObjects; +import net.sf.gridarta.model.anim.TestAnimationObjects; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.face.ArchFaceProvider; -import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.utils.GUIUtils; @@ -48,10 +46,9 @@ public void testAttributes1() { final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new DefaultFaceObjects<TestGameObject, TestMapArchObject, TestArchetype>("png", "facetree", Pattern.compile(".*"), "", archFaceProvider); + final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("animtree"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final ArchetypeAttributes archetypeAttributes = new ArchetypeAttributes(); final ArchetypeAttributesDefinition typeAttributes = new ArchetypeAttributesDefinition(); final BaseObject<?, ?, ?, ?> archetype = new TestArchetype("base", faceObjectProviders, animationObjects); @@ -67,10 +64,9 @@ public void testAttributes2() { final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new DefaultFaceObjects<TestGameObject, TestMapArchObject, TestArchetype>("png", "facetree", Pattern.compile(".*"), "", archFaceProvider); + final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("animtree"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final ArchetypeAttributes archetypeAttributes = new ArchetypeAttributes(); final ArchetypeAttributesDefinition typeAttributes = new ArchetypeAttributesDefinition(); final BaseObject<?, ?, ?, ?> archetype = new TestArchetype("base", faceObjectProviders, animationObjects); @@ -99,10 +95,9 @@ public void testAttributes3() { final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new DefaultFaceObjects<TestGameObject, TestMapArchObject, TestArchetype>("png", "facetree", Pattern.compile(".*"), "", archFaceProvider); + final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("animtree"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final ArchetypeAttributes archetypeAttributes = new ArchetypeAttributes(); final ArchetypeAttributesDefinition typeAttributes = new ArchetypeAttributesDefinition(); final BaseObject<?, ?, ?, ?> archetype = new TestArchetype("base", faceObjectProviders, animationObjects); Modified: trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java 2010-07-01 18:36:35 UTC (rev 8570) +++ trunk/model/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java 2010-07-01 19:12:05 UTC (rev 8571) @@ -26,9 +26,8 @@ import java.io.StringReader; import java.util.ArrayList; import java.util.List; -import java.util.regex.Pattern; import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.DefaultAnimationObjects; +import net.sf.gridarta.model.anim.TestAnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.DuplicateArchetypeException; @@ -40,10 +39,9 @@ import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.errorview.TestErrorView; -import net.sf.gridarta.model.face.ArchFaceProvider; -import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.gameobject.TestGameObjectFactory; import net.sf.gridarta.model.maparchobject.TestMapArchObject; @@ -69,11 +67,10 @@ final TestArchetypeFactory archetypeFactory = new TestArchetypeFactory(); final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new DefaultFaceObjects<TestGameObject, TestMapArchObject, TestArchetype>("png", "facetree", Pattern.compile(".*"), "", archFaceProvider); + final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final TestArchetypeSet archetypeSet = new TestArchetypeSet(archetypeFactory, "archetypes", faceObjectProviders); - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("animtree"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final TestArchetype baseArchetype = new TestArchetype("base", faceObjectProviders, animationObjects); baseArchetype.setObjectText("sp 2\n"); archetypeSet.addArchetype(baseArchetype); Modified: trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java 2010-07-01 18:36:35 UTC (rev 8570) +++ trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java 2010-07-01 19:12:05 UTC (rev 8571) @@ -21,9 +21,8 @@ import java.util.ArrayList; import java.util.List; -import java.util.regex.Pattern; import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.DefaultAnimationObjects; +import net.sf.gridarta.model.anim.TestAnimationObjects; import net.sf.gridarta.model.archetype.ArchetypeFactory; import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.archetype.DuplicateArchetypeException; @@ -31,10 +30,9 @@ import net.sf.gridarta.model.archetype.TestArchetypeFactory; import net.sf.gridarta.model.archetype.TestArchetypeSet; import net.sf.gridarta.model.archetype.UndefinedArchetypeException; -import net.sf.gridarta.model.face.ArchFaceProvider; -import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapviewsettings.TestMapViewSettings; @@ -123,11 +121,10 @@ final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory = new TestArchetypeFactory(); final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new DefaultFaceObjects<TestGameObject, TestMapArchObject, TestArchetype>("png", "facetree", Pattern.compile(""), "", archFaceProvider); + final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); faceObjectProviders = new FaceObjectProviders(1, faceObjects, systemIcons); archetypeSet = new TestArchetypeSet(archetypeFactory, "arch", faceObjectProviders); - animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("animtree"); + animationObjects = new TestAnimationObjects(); final TestMapViewSettings mapViewSettings = new TestMapViewSettings(); autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); } Modified: trunk/model/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java 2010-07-01 18:36:35 UTC (rev 8570) +++ trunk/model/src/test/net/sf/gridarta/model/baseobject/AbstractBaseObjectTest.java 2010-07-01 19:12:05 UTC (rev 8571) @@ -19,14 +19,12 @@ package net.sf.gridarta.model.baseobject; -import java.util.regex.Pattern; import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.DefaultAnimationObjects; +import net.sf.gridarta.model.anim.TestAnimationObjects; import net.sf.gridarta.model.archetype.TestArchetype; -import net.sf.gridarta.model.face.ArchFaceProvider; -import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; @@ -55,7 +53,7 @@ */ @Test public void testSetFaceName1() { - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", null, faceObjectProviders, animationObjects); Assert.assertNull(archetype.getFaceName()); @@ -100,7 +98,7 @@ */ @Test public void testSetFaceName2() { - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", "face arch_face", faceObjectProviders, animationObjects); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders, animationObjects); @@ -118,7 +116,7 @@ */ @Test public void testSetAttributeString() { - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", "key1 value1\n" + "key2 value2\n", faceObjectProviders, animationObjects); @@ -193,7 +191,7 @@ */ @Test public void testDirection1() { - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", null, faceObjectProviders, animationObjects); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders, animationObjects); @@ -211,7 +209,7 @@ */ @Test public void testDirection2() { - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", "direction 2", faceObjectProviders, animationObjects); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders, animationObjects); @@ -227,7 +225,7 @@ */ @Test public void testDirection3() { - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype1 = newArchetype("arch", "direction 1", faceObjectProviders, animationObjects); final TestArchetype archetype2 = newArchetype("arch", "direction 2", faceObjectProviders, animationObjects); @@ -259,7 +257,7 @@ */ @Test public void testType1() { - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", null, faceObjectProviders, animationObjects); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders, animationObjects); @@ -277,7 +275,7 @@ */ @Test public void testType2() { - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", "type 2", faceObjectProviders, animationObjects); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders, animationObjects); @@ -293,7 +291,7 @@ */ @Test public void testType3() { - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype1 = newArchetype("arch", "type 1", faceObjectProviders, animationObjects); final TestArchetype archetype2 = newArchetype("arch", "type 2", faceObjectProviders, animationObjects); @@ -325,7 +323,7 @@ */ @Test public void testName1() { - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", null, faceObjectProviders, animationObjects); final BaseObject<?, ?, ?, ?> gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); @@ -343,7 +341,7 @@ */ @Test public void testName2() { - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", "name 2", faceObjectProviders, animationObjects); final BaseObject<?, ?, ?, ?> gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); @@ -359,7 +357,7 @@ */ @Test public void testName3() { - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype1 = newArchetype("arch", "name 1", faceObjectProviders, animationObjects); final TestArchetype archetype2 = newArchetype("arch", "name 2", faceObjectProviders, animationObjects); @@ -426,8 +424,7 @@ * @return the face object providers instance */ private FaceObjectProviders newFaceObjectProviders() { - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new DefaultFaceObjects<TestGameObject, TestMapArchObject, TestArchetype>("test", "bmaps.paths", Pattern.compile("^.*\t\\.?(.*)"), "\\%1$05d\t./arch%2$s", archFaceProvider); + final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); assert systemIcons != null; final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); return faceObjectProviders; Added: trunk/model/src/test/net/sf/gridarta/model/face/TestFaceObjects.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/face/TestFaceObjects.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/face/TestFaceObjects.java 2010-07-01 19:12:05 UTC (rev 8571) @@ -0,0 +1,67 @@ +/* + * 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.face; + +import java.io.File; +import java.io.IOException; +import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.errorview.ErrorView; +import net.sf.gridarta.model.gameobject.TestGameObject; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.japi.swing.misc.Progress; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link FaceObjects} for regression tests. + * @author Andreas Kirschbaum + */ +public class TestFaceObjects extends AbstractFaceObjects<TestGameObject, TestMapArchObject, TestArchetype> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance. + */ + public TestFaceObjects() { + super("test"); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public FaceProvider loadFacesCollection(@NotNull final ErrorView errorView, @NotNull final File collectedDirectory, @NotNull final String faceFile, @NotNull final String treeFile) { + throw new AssertionError(); + } + + /** + * {@inheritDoc} + */ + @Override + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParser) throws IOException { + throw new AssertionError(); + } + +} // class TestFaceObjects Property changes on: trunk/model/src/test/net/sf/gridarta/model/face/TestFaceObjects.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java 2010-07-01 18:36:35 UTC (rev 8570) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java 2010-07-01 19:12:05 UTC (rev 8571) @@ -26,18 +26,16 @@ import java.util.List; import java.util.Set; import java.util.TreeSet; -import java.util.regex.Pattern; import javax.swing.ImageIcon; import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.DefaultAnimationObjects; +import net.sf.gridarta.model.anim.TestAnimationObjects; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.autojoin.AutojoinLists; import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.face.ArchFaceProvider; -import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.gameobject.TestGameObject; @@ -449,7 +447,7 @@ final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final MapViewSettings mapViewSettings = new TestMapViewSettings(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); - animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + animationObjects = new TestAnimationObjects(); final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode = new TopmostInsertionMode<TestGameObject, TestMapArchObject, TestArchetype>(); @@ -468,8 +466,7 @@ * @return the face object providers instance */ private FaceObjectProviders newFaceObjectProviders() { - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new DefaultFaceObjects<TestGameObject, TestMapArchObject, TestArchetype>("test", "bmaps.paths", Pattern.compile("^.*\t\\.?(.*)"), "\\%1$05d\t./arch%2$s", archFaceProvider); + final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); assert systemIcons != null; final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); return faceObjectProviders; Modified: trunk/model/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java 2010-07-01 18:36:35 UTC (rev 8570) +++ trunk/model/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java 2010-07-01 19:12:05 UTC (rev 8571) @@ -19,15 +19,13 @@ package net.sf.gridarta.model.match; -import java.util.regex.Pattern; import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.DefaultAnimationObjects; +import net.sf.gridarta.model.anim.TestAnimationObjects; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.face.ArchFaceProvider; -import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.gameobject.TestGameObjectFactory; @@ -61,7 +59,7 @@ final GameObjectMatcher invGameObjectMatcher = new TypeNrsGameObjectMatcher(1); final GameObjectMatcher namedGameObjectMatcher = new NamedGameObjectMatcher(0, "namedGameObjectMatcher", "namedGameObjectMatcher", false, null, invGameObjectMatcher); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); Assert.assertTrue(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1))); Assert.assertFalse(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2))); @@ -86,7 +84,7 @@ final GameObjectMatcher envGameObjectMatcher = new TypeNrsGameObjectMatcher(2); final GameObjectMatcher namedGameObjectMatcher = new NamedGameObjectMatcher(0, "namedGameObjectMatcher", "namedGameObjectMatcher", false, envGameObjectMatcher, invGameObjectMatcher); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); Assert.assertFalse(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1))); Assert.assertFalse(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2))); @@ -165,8 +163,7 @@ * @return the face object providers instance */ private FaceObjectProviders newFaceObjectProviders() { - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new DefaultFaceObjects<TestGameObject, TestMapArchObject, TestArchetype>("test", "bmaps.paths", Pattern.compile("^.*\t\\.?(.*)"), "\\%1$05d\t./arch%2$s", archFaceProvider); + final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); assert systemIcons != null; final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); return faceObjectProviders; Modified: trunk/model/src/test/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java 2010-07-01 18:36:35 UTC (rev 8570) +++ trunk/model/src/test/net/sf/gridarta/model/resource/AbstractFilesResourcesReaderTest.java 2010-07-01 19:12:05 UTC (rev 8571) @@ -28,10 +28,9 @@ import java.io.Writer; import java.util.ArrayList; import java.util.List; -import java.util.regex.Pattern; import net.sf.gridarta.model.anim.AnimationObject; import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.DefaultAnimationObjects; +import net.sf.gridarta.model.anim.TestAnimationObjects; import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.ArchetypeFactory; import net.sf.gridarta.model.archetype.ArchetypeSet; @@ -43,9 +42,9 @@ import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.TestErrorView; import net.sf.gridarta.model.face.ArchFaceProvider; -import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.gameobject.TestGameObjectFactory; @@ -110,12 +109,12 @@ private static AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> readAnimations(@NotNull final File archDirectory, @NotNull final File collectedDirectory) { final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory = new TestArchetypeFactory(); final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new DefaultFaceObjects<TestGameObject, TestMapArchObject, TestArchetype>(new File(collectedDirectory, "gridarta.0").getPath(), new File(collectedDirectory, "facetree").getPath(), Pattern.compile(""), "", archFaceProvider); + final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(1, faceObjects, systemIcons); final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet = new TestArchetypeSet(archetypeFactory, new File(collectedDirectory, "archetypes").getPath(), faceObjectProviders); - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>(new File(collectedDirectory, "animtree").getPath()); + final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); final TestArchetypeBuilder archetypeBuilder = new TestArchetypeBuilder(gameObjectFactory); final AbstractArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype, ?> archetypeParser = new TestArchetypeParser(archetypeBuilder, animationObjects, archetypeSet); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-01 19:26:11
|
Revision: 8572 http://gridarta.svn.sourceforge.net/gridarta/?rev=8572&view=rev Author: akirschbaum Date: 2010-07-01 19:26:04 +0000 (Thu, 01 Jul 2010) Log Message: ----------- Move DefaultAnimationObjects and DefaultFaceObjects out of model module. Modified Paths: -------------- trunk/build.xml Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/ trunk/src/app/net/sf/gridarta/model/anim/ trunk/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java trunk/src/app/net/sf/gridarta/model/face/ trunk/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java Removed Paths: ------------- trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2010-07-01 19:12:05 UTC (rev 8571) +++ trunk/build.xml 2010-07-01 19:26:04 UTC (rev 8572) @@ -245,6 +245,7 @@ <fileset dir="lib" includes="japi-lib-swing-action-0.1.0.jar"/> <fileset dir="lib" includes="junit-4.2.jar"/> <pathelement location="dest/atrinik/app"/> + <pathelement location="dest/gridarta/app"/> <pathelement location="dest/model/app"/> <pathelement location="dest/model/test"/> <pathelement location="dest/utils/app"/> @@ -279,6 +280,7 @@ <fileset dir="lib" includes="japi-lib-swing-action-0.1.0.jar"/> <fileset dir="lib" includes="junit-4.2.jar"/> <pathelement location="dest/crossfire/app"/> + <pathelement location="dest/gridarta/app"/> <pathelement location="dest/model/app"/> <pathelement location="dest/model/test"/> <pathelement location="dest/utils/app"/> @@ -312,6 +314,7 @@ <fileset dir="lib" includes="annotations.jar"/> <fileset dir="lib" includes="junit-4.2.jar"/> <pathelement location="dest/daimonin/app"/> + <pathelement location="dest/gridarta/app"/> <pathelement location="dest/model/app"/> <pathelement location="dest/utils/app"/> </classpath> Deleted: trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java 2010-07-01 19:12:05 UTC (rev 8571) +++ trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java 2010-07-01 19:26:04 UTC (rev 8572) @@ -1,128 +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.model.anim; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStreamWriter; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.data.NamedObject; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.utils.ActionBuilderUtils; -import net.sf.gridarta.utils.IOUtils; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; -import net.sf.japi.swing.misc.Progress; -import org.jetbrains.annotations.NotNull; - -/** - * Abstract base implementation of {@link AnimationObjects}. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class DefaultAnimationObjects<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractAnimationObjects<G, A, R> { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1L; - - /** - * Action Builder. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** - * The collected animation tree file. - */ - @NotNull - private final String animTreeFile; - - /** - * Creates a new instance. - * @param animTreeFile the collected animation tree file - */ - public DefaultAnimationObjects(@NotNull final String animTreeFile) { - super(ActionBuilderUtils.getString(ACTION_BUILDER, "nameOfAnimationObject")); - this.animTreeFile = animTreeFile; - } - - /** - * {@inheritDoc} Collects the Animations. The animation data is written to - * "animations". The tree information for the editor is written to - * "animtree". - */ - @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { - collectAnimations(progress, collectedDirectory); - collectAnimTree(progress, collectedDirectory); - } - - /** - * Collects the animation data into the file "animations". - * @param progress Progress to report progress to. - * @param collectedDirectory the destination directory to collect data to - * @throws IOException in case of I/O problems during collection - */ - private void collectAnimations(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectAnimations"), size()); - final BufferedWriter animations = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(collectedDirectory, "animations")), IOUtils.MAP_ENCODING)); - try { - int counter = 0; // counter for progress bar - for (final AnimationObject anim : this) { - animations.append("anim ").append(anim.getAnimName()).append('\n').append(anim.getAnimList()).append("mina\n"); - if (counter++ % 128 == 0) { - progress.setValue(counter); - } - } - } finally { - animations.close(); - } - progress.setValue(size()); - } - - /** - * Collects the animation data into the file "animations". - * @param progress Progress to report progress to. - * @param collectedDirectory the destination directory to collect data to - * @throws IOException in case of I/O problems during collection - */ - private void collectAnimTree(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectAnimTree"), size()); - final BufferedWriter animtree = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(collectedDirectory, animTreeFile)), IOUtils.MAP_ENCODING)); - try { - int counter = 0; // counter for progress bar - for (final NamedObject anim : this) { - animtree.append(anim.getPath()).append('\n'); - if (counter++ % 128 == 0) { - progress.setValue(counter); - } - } - } finally { - animtree.close(); - } - progress.setValue(size()); - } - - -} // class DefaultAnimationObjects Deleted: trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java 2010-07-01 19:12:05 UTC (rev 8571) +++ trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java 2010-07-01 19:26:04 UTC (rev 8572) @@ -1,420 +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.model.face; - -import java.io.BufferedReader; -import java.io.BufferedWriter; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.io.Reader; -import java.net.URL; -import java.nio.channels.FileChannel; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.data.NamedObject; -import net.sf.gridarta.model.errorview.ErrorView; -import net.sf.gridarta.model.errorview.ErrorViewCategory; -import net.sf.gridarta.model.errorview.ErrorViewCollector; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.io.GameObjectParser; -import net.sf.gridarta.model.maparchobject.MapArchObject; -import net.sf.gridarta.utils.ActionBuilderUtils; -import net.sf.gridarta.utils.ArrayUtils; -import net.sf.gridarta.utils.CommonConstants; -import net.sf.gridarta.utils.IOUtils; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; -import net.sf.japi.swing.misc.Progress; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; - -/** - * Abstract base implementation of {@link FaceObjects}. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class DefaultFaceObjects<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractFaceObjects<G, A, R> { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1L; - - /** - * The chunk size in bytes when reading file contents. - */ - private static final int CHUNK_SIZE = 4096; - - /** - * The Logger for printing log messages. - */ - private static final Category log = Logger.getLogger(DefaultFaceObjects.class); - - /** - * Action Builder. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** - * The filename of the collected image file. - * @serial - */ - @NotNull - private final String pngFile; - - /** - * The filename of the face tree file. - * @serial - */ - @NotNull - private final String faceTreeFile; - - /** - * The {@link Pattern} for parsing face tree files. The pattern must return - * the face name in the first capturing group. - * @serial - */ - @NotNull - private final Pattern faceTreeInputPattern; - - /** - * The format string for writing face tree files. - * @serial - */ - @NotNull - private final String faceTreeOutputFormat; - - /** - * The {@link ArchFaceProvider} to use for collection. - */ - @NotNull - private final ArchFaceProvider archFaceProvider; - - /** - * Creates a new instance. - * @param pngFile the filename of the collected image file - * @param faceTreeFile the filename of the face tree file - * @param faceTreeInputPattern the pattern for parsing face tree files - * @param faceTreeOutputFormat the format string for writing face tree - * files - * @param archFaceProvider the arch face provider to use for collection - */ - public DefaultFaceObjects(@NotNull final String pngFile, @NotNull final String faceTreeFile, @NotNull final Pattern faceTreeInputPattern, @NotNull final String faceTreeOutputFormat, @NotNull final ArchFaceProvider archFaceProvider) { - super(ActionBuilderUtils.getString(ACTION_BUILDER, "nameOfFaceObject")); - this.pngFile = pngFile; - this.faceTreeFile = faceTreeFile; - this.faceTreeInputPattern = faceTreeInputPattern; - this.faceTreeOutputFormat = faceTreeOutputFormat; - this.archFaceProvider = archFaceProvider; - } - - /** - * {@inheritDoc} Collects the faces. The graphics information is written to - * "crossfire.0" resp. "daimonin.0". The meta information (offsets etc.) is - * written to "bmaps". The tree information for the editor is written to - * "bmaps.paths" resp. "facetree". <p/> Theoretically it would also be - * possible to recode the images. But the Java image encoder isn't as good - * as that of gimp in many cases (yet much better as the old visualtek's). - */ - @Override - public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { - collectTreeFile(progress, collectedDirectory); - collectBmapsFile(progress, collectedDirectory); - collectImageFile(progress, collectedDirectory); - } - - /** - * Creates the image file. - * @param progress Progress to report progress to. - * @param collectedDirectory the destination directory to collect data to - * @throws IOException in case of I/O problems during collection - */ - private void collectImageFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - final File file = new File(collectedDirectory, pngFile); - final FileOutputStream fos = new FileOutputStream(file); - try { - final FileChannel outChannel = fos.getChannel(); - try { - final PrintStream binFile = new PrintStream(fos); - try { - final int numOfFaceObjects = size(); - progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectImages"), numOfFaceObjects); - int i = 0; - for (final FaceObject faceObject : this) { - final String face = faceObject.getFaceName(); - final String path = archFaceProvider.getFilename(face); - try { - final FileInputStream fin = new FileInputStream(path); - try { - final FileChannel inChannel = fin.getChannel(); - final long imageSize = inChannel.size(); - binFile.format("IMAGE %d %d %s\n", i, imageSize, face); - inChannel.transferTo(0L, imageSize, outChannel); - } finally { - fin.close(); - } - } catch (final FileNotFoundException ignored) { - ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectErrorFileNotFound", path); - return; - } catch (final IOException e) { - ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectErrorIOException", path, e); - return; - } - - if (i++ % 100 == 0) { - progress.setValue(i); - } - } - progress.setValue(size()); // finished - } finally { - binFile.close(); - } - } finally { - outChannel.close(); - } - } finally { - fos.close(); - } - } - - /** - * Creates the tree file. - * @param progress Progress to report progress to. - * @param collectedDirectory the destination directory to collect data to - * @throws IOException in case of I/O problems during collection - */ - private void collectTreeFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - final FileOutputStream fos = new FileOutputStream(new File(collectedDirectory, faceTreeFile)); - try { - final OutputStreamWriter osw = new OutputStreamWriter(fos, "us-ascii"); - try { - final BufferedWriter treeFile = new BufferedWriter(osw); - try { - final int numOfFaceObjects = size(); - progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectTree"), numOfFaceObjects); - int i = 0; - for (final NamedObject faceObject : this) { - final String path = faceObject.getPath(); - treeFile.append(String.format(faceTreeOutputFormat, i, path)).append('\n'); - if (i++ % 100 == 0) { - progress.setValue(i); - } - } - progress.setValue(numOfFaceObjects); - } finally { - treeFile.close(); - } - } finally { - osw.close(); - } - } finally { - fos.close(); - } - } - - /** - * Creates the bmaps file. - * @param progress Progress to report progress to. - * @param collectedDirectory the destination directory to collect data to - * @throws IOException in case of I/O problems during collection - */ - protected void collectBmapsFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { - final FileOutputStream fos = new FileOutputStream(new File(collectedDirectory, CommonConstants.BMAPS_FILE)); - try { - final OutputStreamWriter osw = new OutputStreamWriter(fos); - try { - final BufferedWriter bw = new BufferedWriter(osw); - try { - final PrintWriter textFile = new PrintWriter(bw, false); - try { - final int numOfFaceObjects = size(); - progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectBmaps"), numOfFaceObjects); - int i = 0; - for (final FaceObject faceObject : this) { - final String face = faceObject.getFaceName(); - textFile.format("%05d %s\n", i, face); - if (i++ % 100 == 0) { - progress.setValue(i); - } - } - progress.setValue(numOfFaceObjects); - } finally { - textFile.close(); - } - } finally { - bw.close(); - } - } finally { - osw.close(); - } - } finally { - fos.close(); - } - } - - @NotNull - @Override - public FaceProvider loadFacesCollection(@NotNull final ErrorView errorView, @NotNull final File collectedDirectory, @NotNull final String faceFile, @NotNull final String treeFile) { - final File tmpFaceFile; - try { - tmpFaceFile = IOUtils.getFile(collectedDirectory, faceFile); - } catch (final IOException ex) { - errorView.addWarning(ErrorViewCategory.FACES_FILE_INVALID, new File(collectedDirectory, faceFile) + ": " + ex.getMessage()); - return new EmptyFaceProvider(); - } - final CollectedFaceProvider collectedFaceProvider; - int faces = 0; - final ErrorViewCollector faceFileErrorViewCollector = new ErrorViewCollector(errorView, tmpFaceFile); - try { - collectedFaceProvider = new CollectedFaceProvider(tmpFaceFile); - final byte[] data = getFileContents(tmpFaceFile); - - // Note: treeIn might stay null, this is optional data. - final ErrorViewCollector treeFileErrorViewCollector = new ErrorViewCollector(errorView, new File(collectedDirectory, treeFile)); - BufferedReader treeIn = null; - try { - final URL url = IOUtils.getResource(collectedDirectory, treeFile); - final InputStream inputStream2 = url.openStream(); - final Reader reader = new InputStreamReader(inputStream2, IOUtils.MAP_ENCODING); - //cher: it is safely closed but optional. InspectionGadgets doesn't detect where it's closed. - //noinspection IOResourceOpenedButNotSafelyClosed - treeIn = new BufferedReader(reader); - } catch (final FileNotFoundException ignored) { - treeFileErrorViewCollector.addWarning(ErrorViewCategory.FACES_FILE_INVALID); - } - final byte[] tag = "IMAGE ".getBytes(); // this is the starting string for a new png - final StringBuilder faceB = new StringBuilder(); // face name of png - try { - int offset = 0; - while (offset < data.length) { - // File: Structure* - // Structure: "IMAGE " seqNr ' ' size ' ' facename '\n' PNGBinary - if (!ArrayUtils.contains(data, offset, tag)) { // check for IMAGE - throw new IOException("expecting 'IMAGE' at position " + offset); - } - offset += 6; // skip "IMAGE "; - while (data[offset++] != (byte) 0x20) { - // skip seqNr ' ' - } - int size = 0; - // read size ' ' - while (true) { - final char c = (char) data[offset++]; // XXX: do not cast from byte to char - if (c == ' ') { - break; - } - if (c < '0' || c > '9') { - throw new IOException("syntax error at position " + offset + ": not a digit"); - } - size *= 10; - size += (int) c - (int) '0'; - } - faceB.setLength(0); - // read facename '\n' - while (true) { - final char c = (char) data[offset++]; // XXX: do not cast from byte to char - if (c == '\n') { - break; - } - if (c == '/') { - faceB.setLength(0); - } else { - faceB.append(c); - } - } - final String faceName = faceB.toString().intern(); - - if (offset + size > data.length) { - throw new IOException("truncated at position " + offset); - } - - if (treeIn != null) { - final String originalFilename = treeIn.readLine(); - if (originalFilename == null) { - log.warn(ACTION_BUILDER.format("logFaceObjectWithoutOriginalName", faceName)); - } else { - final Matcher matcher = faceTreeInputPattern.matcher(originalFilename); - if (matcher.matches()) { - try { - addFaceObject(faceName, matcher.group(1), offset, size); - } catch (final DuplicateFaceException ex) { - faceFileErrorViewCollector.addWarning(ErrorViewCategory.FACES_ENTRY_INVALID, "duplicate face: " + ex.getDuplicate().getFaceName()); - } catch (final IllegalFaceException ex) { - faceFileErrorViewCollector.addWarning(ErrorViewCategory.FACES_ENTRY_INVALID, "invalid face: " + ex.getFaceObject().getFaceName()); - } - } else { - treeFileErrorViewCollector.addWarning(ErrorViewCategory.FACES_ENTRY_INVALID, "syntax error: " + originalFilename); - } - } - } - collectedFaceProvider.addInfo(faceName, offset, size); // TODO Remove me - faces++; - offset += size; - } - } finally { - if (treeIn != null) { - treeIn.close(); - } - } - } catch (final IOException ex) { - faceFileErrorViewCollector.addWarning(ErrorViewCategory.FACES_FILE_INVALID, ex.getMessage()); - return new EmptyFaceProvider(); - } - if (log.isInfoEnabled()) { - log.info("Loaded " + faces + " faces from '" + tmpFaceFile + "'."); - } - return collectedFaceProvider; - } - - /** - * Returns the contents of a {@link File} as a <code>byte</code> array. - * @param file the file to read - * @return the file contents - * @throws IOException if the file cannot be read - */ - private static byte[] getFileContents(@NotNull final File file) throws IOException { - final ByteArrayOutputStream bufOut = new ByteArrayOutputStream((int) file.length()); - final InputStream inputStream = new FileInputStream(file); - try { - final byte[] buf = new byte[CHUNK_SIZE]; - while (true) { - final int len = inputStream.read(buf); - if (len == -1) { - break; - } - bufOut.write(buf, 0, len); - } - } finally { - inputStream.close(); - } - return bufOut.toByteArray(); - } - -} // class DefaultFaceObjects Copied: trunk/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java (from rev 8570, trunk/model/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java) =================================================================== --- trunk/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java 2010-07-01 19:26:04 UTC (rev 8572) @@ -0,0 +1,128 @@ +/* + * 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.anim; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.data.NamedObject; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.gridarta.utils.IOUtils; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.misc.Progress; +import org.jetbrains.annotations.NotNull; + +/** + * Abstract base implementation of {@link AnimationObjects}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class DefaultAnimationObjects<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractAnimationObjects<G, A, R> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Action Builder. + */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The collected animation tree file. + */ + @NotNull + private final String animTreeFile; + + /** + * Creates a new instance. + * @param animTreeFile the collected animation tree file + */ + public DefaultAnimationObjects(@NotNull final String animTreeFile) { + super(ActionBuilderUtils.getString(ACTION_BUILDER, "nameOfAnimationObject")); + this.animTreeFile = animTreeFile; + } + + /** + * {@inheritDoc} Collects the Animations. The animation data is written to + * "animations". The tree information for the editor is written to + * "animtree". + */ + @Override + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { + collectAnimations(progress, collectedDirectory); + collectAnimTree(progress, collectedDirectory); + } + + /** + * Collects the animation data into the file "animations". + * @param progress Progress to report progress to. + * @param collectedDirectory the destination directory to collect data to + * @throws IOException in case of I/O problems during collection + */ + private void collectAnimations(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { + progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectAnimations"), size()); + final BufferedWriter animations = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(collectedDirectory, "animations")), IOUtils.MAP_ENCODING)); + try { + int counter = 0; // counter for progress bar + for (final AnimationObject anim : this) { + animations.append("anim ").append(anim.getAnimName()).append('\n').append(anim.getAnimList()).append("mina\n"); + if (counter++ % 128 == 0) { + progress.setValue(counter); + } + } + } finally { + animations.close(); + } + progress.setValue(size()); + } + + /** + * Collects the animation data into the file "animations". + * @param progress Progress to report progress to. + * @param collectedDirectory the destination directory to collect data to + * @throws IOException in case of I/O problems during collection + */ + private void collectAnimTree(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { + progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectAnimTree"), size()); + final BufferedWriter animtree = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(new File(collectedDirectory, animTreeFile)), IOUtils.MAP_ENCODING)); + try { + int counter = 0; // counter for progress bar + for (final NamedObject anim : this) { + animtree.append(anim.getPath()).append('\n'); + if (counter++ % 128 == 0) { + progress.setValue(counter); + } + } + } finally { + animtree.close(); + } + progress.setValue(size()); + } + + +} // class DefaultAnimationObjects Property changes on: trunk/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java (from rev 8568, trunk/model/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java) =================================================================== --- trunk/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.java 2010-07-01 19:26:04 UTC (rev 8572) @@ -0,0 +1,420 @@ +/* + * 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.face; + +import java.io.BufferedReader; +import java.io.BufferedWriter; +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.PrintStream; +import java.io.PrintWriter; +import java.io.Reader; +import java.net.URL; +import java.nio.channels.FileChannel; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.data.NamedObject; +import net.sf.gridarta.model.errorview.ErrorView; +import net.sf.gridarta.model.errorview.ErrorViewCategory; +import net.sf.gridarta.model.errorview.ErrorViewCollector; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.GameObjectParser; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import net.sf.gridarta.utils.ActionBuilderUtils; +import net.sf.gridarta.utils.ArrayUtils; +import net.sf.gridarta.utils.CommonConstants; +import net.sf.gridarta.utils.IOUtils; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import net.sf.japi.swing.misc.Progress; +import org.apache.log4j.Category; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; + +/** + * Abstract base implementation of {@link FaceObjects}. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public class DefaultFaceObjects<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractFaceObjects<G, A, R> { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * The chunk size in bytes when reading file contents. + */ + private static final int CHUNK_SIZE = 4096; + + /** + * The Logger for printing log messages. + */ + private static final Category log = Logger.getLogger(DefaultFaceObjects.class); + + /** + * Action Builder. + */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The filename of the collected image file. + * @serial + */ + @NotNull + private final String pngFile; + + /** + * The filename of the face tree file. + * @serial + */ + @NotNull + private final String faceTreeFile; + + /** + * The {@link Pattern} for parsing face tree files. The pattern must return + * the face name in the first capturing group. + * @serial + */ + @NotNull + private final Pattern faceTreeInputPattern; + + /** + * The format string for writing face tree files. + * @serial + */ + @NotNull + private final String faceTreeOutputFormat; + + /** + * The {@link ArchFaceProvider} to use for collection. + */ + @NotNull + private final ArchFaceProvider archFaceProvider; + + /** + * Creates a new instance. + * @param pngFile the filename of the collected image file + * @param faceTreeFile the filename of the face tree file + * @param faceTreeInputPattern the pattern for parsing face tree files + * @param faceTreeOutputFormat the format string for writing face tree + * files + * @param archFaceProvider the arch face provider to use for collection + */ + public DefaultFaceObjects(@NotNull final String pngFile, @NotNull final String faceTreeFile, @NotNull final Pattern faceTreeInputPattern, @NotNull final String faceTreeOutputFormat, @NotNull final ArchFaceProvider archFaceProvider) { + super(ActionBuilderUtils.getString(ACTION_BUILDER, "nameOfFaceObject")); + this.pngFile = pngFile; + this.faceTreeFile = faceTreeFile; + this.faceTreeInputPattern = faceTreeInputPattern; + this.faceTreeOutputFormat = faceTreeOutputFormat; + this.archFaceProvider = archFaceProvider; + } + + /** + * {@inheritDoc} Collects the faces. The graphics information is written to + * "crossfire.0" resp. "daimonin.0". The meta information (offsets etc.) is + * written to "bmaps". The tree information for the editor is written to + * "bmaps.paths" resp. "facetree". <p/> Theoretically it would also be + * possible to recode the images. But the Java image encoder isn't as good + * as that of gimp in many cases (yet much better as the old visualtek's). + */ + @Override + public void collect(@NotNull final Progress progress, @NotNull final File collectedDirectory, @NotNull final GameObjectParser<G, A, R> gameObjectParser) throws IOException { + collectTreeFile(progress, collectedDirectory); + collectBmapsFile(progress, collectedDirectory); + collectImageFile(progress, collectedDirectory); + } + + /** + * Creates the image file. + * @param progress Progress to report progress to. + * @param collectedDirectory the destination directory to collect data to + * @throws IOException in case of I/O problems during collection + */ + private void collectImageFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { + final File file = new File(collectedDirectory, pngFile); + final FileOutputStream fos = new FileOutputStream(file); + try { + final FileChannel outChannel = fos.getChannel(); + try { + final PrintStream binFile = new PrintStream(fos); + try { + final int numOfFaceObjects = size(); + progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectImages"), numOfFaceObjects); + int i = 0; + for (final FaceObject faceObject : this) { + final String face = faceObject.getFaceName(); + final String path = archFaceProvider.getFilename(face); + try { + final FileInputStream fin = new FileInputStream(path); + try { + final FileChannel inChannel = fin.getChannel(); + final long imageSize = inChannel.size(); + binFile.format("IMAGE %d %d %s\n", i, imageSize, face); + inChannel.transferTo(0L, imageSize, outChannel); + } finally { + fin.close(); + } + } catch (final FileNotFoundException ignored) { + ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectErrorFileNotFound", path); + return; + } catch (final IOException e) { + ACTION_BUILDER.showMessageDialog(progress.getParentComponent(), "archCollectErrorIOException", path, e); + return; + } + + if (i++ % 100 == 0) { + progress.setValue(i); + } + } + progress.setValue(size()); // finished + } finally { + binFile.close(); + } + } finally { + outChannel.close(); + } + } finally { + fos.close(); + } + } + + /** + * Creates the tree file. + * @param progress Progress to report progress to. + * @param collectedDirectory the destination directory to collect data to + * @throws IOException in case of I/O problems during collection + */ + private void collectTreeFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { + final FileOutputStream fos = new FileOutputStream(new File(collectedDirectory, faceTreeFile)); + try { + final OutputStreamWriter osw = new OutputStreamWriter(fos, "us-ascii"); + try { + final BufferedWriter treeFile = new BufferedWriter(osw); + try { + final int numOfFaceObjects = size(); + progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectTree"), numOfFaceObjects); + int i = 0; + for (final NamedObject faceObject : this) { + final String path = faceObject.getPath(); + treeFile.append(String.format(faceTreeOutputFormat, i, path)).append('\n'); + if (i++ % 100 == 0) { + progress.setValue(i); + } + } + progress.setValue(numOfFaceObjects); + } finally { + treeFile.close(); + } + } finally { + osw.close(); + } + } finally { + fos.close(); + } + } + + /** + * Creates the bmaps file. + * @param progress Progress to report progress to. + * @param collectedDirectory the destination directory to collect data to + * @throws IOException in case of I/O problems during collection + */ + protected void collectBmapsFile(@NotNull final Progress progress, @NotNull final File collectedDirectory) throws IOException { + final FileOutputStream fos = new FileOutputStream(new File(collectedDirectory, CommonConstants.BMAPS_FILE)); + try { + final OutputStreamWriter osw = new OutputStreamWriter(fos); + try { + final BufferedWriter bw = new BufferedWriter(osw); + try { + final PrintWriter textFile = new PrintWriter(bw, false); + try { + final int numOfFaceObjects = size(); + progress.setLabel(ActionBuilderUtils.getString(ACTION_BUILDER, "archCollectBmaps"), numOfFaceObjects); + int i = 0; + for (final FaceObject faceObject : this) { + final String face = faceObject.getFaceName(); + textFile.format("%05d %s\n", i, face); + if (i++ % 100 == 0) { + progress.setValue(i); + } + } + progress.setValue(numOfFaceObjects); + } finally { + textFile.close(); + } + } finally { + bw.close(); + } + } finally { + osw.close(); + } + } finally { + fos.close(); + } + } + + @NotNull + @Override + public FaceProvider loadFacesCollection(@NotNull final ErrorView errorView, @NotNull final File collectedDirectory, @NotNull final String faceFile, @NotNull final String treeFile) { + final File tmpFaceFile; + try { + tmpFaceFile = IOUtils.getFile(collectedDirectory, faceFile); + } catch (final IOException ex) { + errorView.addWarning(ErrorViewCategory.FACES_FILE_INVALID, new File(collectedDirectory, faceFile) + ": " + ex.getMessage()); + return new EmptyFaceProvider(); + } + final CollectedFaceProvider collectedFaceProvider; + int faces = 0; + final ErrorViewCollector faceFileErrorViewCollector = new ErrorViewCollector(errorView, tmpFaceFile); + try { + collectedFaceProvider = new CollectedFaceProvider(tmpFaceFile); + final byte[] data = getFileContents(tmpFaceFile); + + // Note: treeIn might stay null, this is optional data. + final ErrorViewCollector treeFileErrorViewCollector = new ErrorViewCollector(errorView, new File(collectedDirectory, treeFile)); + BufferedReader treeIn = null; + try { + final URL url = IOUtils.getResource(collectedDirectory, treeFile); + final InputStream inputStream2 = url.openStream(); + final Reader reader = new InputStreamReader(inputStream2, IOUtils.MAP_ENCODING); + //cher: it is safely closed but optional. InspectionGadgets doesn't detect where it's closed. + //noinspection IOResourceOpenedButNotSafelyClosed + treeIn = new BufferedReader(reader); + } catch (final FileNotFoundException ignored) { + treeFileErrorViewCollector.addWarning(ErrorViewCategory.FACES_FILE_INVALID); + } + final byte[] tag = "IMAGE ".getBytes(); // this is the starting string for a new png + final StringBuilder faceB = new StringBuilder(); // face name of png + try { + int offset = 0; + while (offset < data.length) { + // File: Structure* + // Structure: "IMAGE " seqNr ' ' size ' ' facename '\n' PNGBinary + if (!ArrayUtils.contains(data, offset, tag)) { // check for IMAGE + throw new IOException("expecting 'IMAGE' at position " + offset); + } + offset += 6; // skip "IMAGE "; + while (data[offset++] != (byte) 0x20) { + // skip seqNr ' ' + } + int size = 0; + // read size ' ' + while (true) { + final char c = (char) data[offset++]; // XXX: do not cast from byte to char + if (c == ' ') { + break; + } + if (c < '0' || c > '9') { + throw new IOException("syntax error at position " + offset + ": not a digit"); + } + size *= 10; + size += (int) c - (int) '0'; + } + faceB.setLength(0); + // read facename '\n' + while (true) { + final char c = (char) data[offset++]; // XXX: do not cast from byte to char + if (c == '\n') { + break; + } + if (c == '/') { + faceB.setLength(0); + } else { + faceB.append(c); + } + } + final String faceName = faceB.toString().intern(); + + if (offset + size > data.length) { + throw new IOException("truncated at position " + offset); + } + + if (treeIn != null) { + final String originalFilename = treeIn.readLine(); + if (originalFilename == null) { + log.warn(ACTION_BUILDER.format("logFaceObjectWithoutOriginalName", faceName)); + } else { + final Matcher matcher = faceTreeInputPattern.matcher(originalFilename); + if (matcher.matches()) { + try { + addFaceObject(faceName, matcher.group(1), offset, size); + } catch (final DuplicateFaceException ex) { + faceFileErrorViewCollector.addWarning(ErrorViewCategory.FACES_ENTRY_INVALID, "duplicate face: " + ex.getDuplicate().getFaceName()); + } catch (final IllegalFaceException ex) { + faceFileErrorViewCollector.addWarning(ErrorViewCategory.FACES_ENTRY_INVALID, "invalid face: " + ex.getFaceObject().getFaceName()); + } + } else { + treeFileErrorViewCollector.addWarning(ErrorViewCategory.FACES_ENTRY_INVALID, "syntax error: " + originalFilename); + } + } + } + collectedFaceProvider.addInfo(faceName, offset, size); // TODO Remove me + faces++; + offset += size; + } + } finally { + if (treeIn != null) { + treeIn.close(); + } + } + } catch (final IOException ex) { + faceFileErrorViewCollector.addWarning(ErrorViewCategory.FACES_FILE_INVALID, ex.getMessage()); + return new EmptyFaceProvider(); + } + if (log.isInfoEnabled()) { + log.info("Loaded " + faces + " faces from '" + tmpFaceFile + "'."); + } + return collectedFaceProvider; + } + + /** + * Returns the contents of a {@link File} as a <code>byte</code> array. + * @param file the file to read + * @return the file contents + * @throws IOException if the file cannot be read + */ + private static byte[] getFileContents(@NotNull final File file) throws IOException { + final ByteArrayOutputStream bufOut = new ByteArrayOutputStream((int) file.length()); + final InputStream inputStream = new FileInputStream(file); + try { + final byte[] buf = new byte[CHUNK_SIZE]; + while (true) { + final int len = inputStream.read(buf); + if (len == -1) { + break; + } + bufOut.write(buf, 0, len); + } + } finally { + inputStream.close(); + } + return bufOut.toByteArray(); + } + +} // class DefaultFaceObjects Property changes on: trunk/src/app/net/sf/gridarta/model/face/DefaultFaceObjects.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-07-01 21:47:16
|
Revision: 8574 http://gridarta.svn.sourceforge.net/gridarta/?rev=8574&view=rev Author: akirschbaum Date: 2010-07-01 21:47:09 +0000 (Thu, 01 Jul 2010) Log Message: ----------- Add regression tests for AutojoinLists. Modified Paths: -------------- trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java trunk/src/test/net/sf/gridarta/gui/selectedsquare/SelectedSquareActionsTest.java trunk/src/test/net/sf/gridarta/mapmanager/DefaultMapManagerTest.java trunk/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java Added Paths: ----------- trunk/model/src/test/net/sf/gridarta/model/mapmodel/CannotInsertGameObjectException.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelHelper.java Modified: trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java 2010-07-01 20:32:09 UTC (rev 8573) +++ trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java 2010-07-01 21:47:09 UTC (rev 8574) @@ -30,13 +30,25 @@ import net.sf.gridarta.model.archetype.TestArchetypeFactory; import net.sf.gridarta.model.archetype.TestArchetypeSet; import net.sf.gridarta.model.archetype.UndefinedArchetypeException; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.TestFaceObjects; +import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.gameobject.TestGameObject; +import net.sf.gridarta.model.gameobject.TestGameObjectFactory; import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.gridarta.model.mapmodel.CannotInsertGameObjectException; +import net.sf.gridarta.model.mapmodel.InsertionMode; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.MapModelFactory; +import net.sf.gridarta.model.mapmodel.TestMapModelHelper; +import net.sf.gridarta.model.mapmodel.TopmostInsertionMode; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.mapviewsettings.TestMapViewSettings; +import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.Size2D; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; import org.junit.Assert; @@ -86,6 +98,104 @@ } /** + * Checks that inserting with autojoin works as expected. + * @throws IllegalAutojoinListException if the test fails + * @throws DuplicateArchetypeException if the test fails + * @throws UndefinedArchetypeException if the test fails + * @throws CannotInsertGameObjectException if the test fails + */ + @Test + public void testInsert1() throws CannotInsertGameObjectException, DuplicateArchetypeException, IllegalAutojoinListException, UndefinedArchetypeException { + final Creator creator = new Creator(); + creator.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); + final Creator2 creator2 = new Creator2(creator); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = creator2.newMapModel(3, 2); + final TestMapModelHelper testMapModelHelper = newTestMapModelCreator(creator); + final TestArchetype a0 = creator.archetypeSet.getArchetype("a0"); + final TestArchetype a1 = creator.archetypeSet.getArchetype("a1"); + final TestArchetype a6 = creator.archetypeSet.getArchetype("a6"); + final TestArchetype a8 = creator.archetypeSet.getArchetype("a8"); + testMapModelHelper.insertArchetype(mapModel, 1, 0, a1, false); + testMapModelHelper.insertArchetype(mapModel, 0, 1, a8, false); + + creator.mapViewSettings.setAutojoin(true); + + // insert using autojoin + testMapModelHelper.insertArchetype(mapModel, 1, 1, a0, true); + TestMapModelHelper.checkMapContents(mapModel, "|a5|", "a10|a9|"); + + // insert duplicate archetype is ignored + try { + testMapModelHelper.insertArchetype(mapModel, 1, 1, a0, true); + Assert.fail(); + } catch (final CannotInsertGameObjectException ignored) { + // ignore + } + TestMapModelHelper.checkMapContents(mapModel, "|a5|", "a10|a9|"); + + // insert using autojoin + testMapModelHelper.insertArchetype(mapModel, 2, 1, a6, true); + TestMapModelHelper.checkMapContents(mapModel, "|a5|", "a10|a11|a8"); + + // insert using autojoin but disabled autojoin globally + creator.mapViewSettings.setAutojoin(false); + testMapModelHelper.insertArchetype(mapModel, 2, 0, a6, true); + TestMapModelHelper.checkMapContents(mapModel, "|a5|a6", "a10|a11|a8"); + } + + /** + * Checks that removing with autojoin works as expected. + * @throws IllegalAutojoinListException if the test fails + * @throws DuplicateArchetypeException if the test fails + * @throws UndefinedArchetypeException if the test fails + * @throws CannotInsertGameObjectException if the test fails + */ + @Test + public void testRemove1() throws CannotInsertGameObjectException, DuplicateArchetypeException, IllegalAutojoinListException, UndefinedArchetypeException { + final Creator creator = new Creator(); + creator.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); + final Creator2 creator2 = new Creator2(creator); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = creator2.newMapModel(3, 2); + final TestMapModelHelper testMapModelHelper = newTestMapModelCreator(creator); + final TestArchetype a4 = creator.archetypeSet.getArchetype("a4"); + final TestArchetype a8 = creator.archetypeSet.getArchetype("a8"); + final TestArchetype a10 = creator.archetypeSet.getArchetype("a10"); + final TestArchetype a11 = creator.archetypeSet.getArchetype("a11"); + final TestGameObject g10 = testMapModelHelper.insertArchetype(mapModel, 1, 0, a4, false); + final TestGameObject g01 = testMapModelHelper.insertArchetype(mapModel, 0, 1, a10, false); + testMapModelHelper.insertArchetype(mapModel, 1, 1, a11, false); + final TestGameObject g21 = testMapModelHelper.insertArchetype(mapModel, 2, 1, a8, false); + + // remove using autojoin + creator.mapViewSettings.setAutojoin(true); + mapModel.removeGameObject(g21, true); + TestMapModelHelper.checkMapContents(mapModel, "|a4|", "a10|a9|"); + + // remove using autojoin but globally disabled + creator.mapViewSettings.setAutojoin(false); + mapModel.removeGameObject(g10, true); + TestMapModelHelper.checkMapContents(mapModel, "||", "a10|a9|"); + + // remove using autojoin + creator.mapViewSettings.setAutojoin(true); + mapModel.removeGameObject(g01, true); + TestMapModelHelper.checkMapContents(mapModel, "||", "|a1|"); + } + + /** + * Creates a new {@link TestMapModelHelper} instance. + * @param creator the creator to use + * @return the new test map model creator instance + * @throws DuplicateArchetypeException if an internal error occurs + */ + @NotNull + private static TestMapModelHelper newTestMapModelCreator(@NotNull final Creator creator) throws DuplicateArchetypeException { + final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(creator.faceObjectProviders, creator.animationObjects); + final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode = new TopmostInsertionMode<TestGameObject, TestMapArchObject, TestArchetype>(); + return new TestMapModelHelper(topmostInsertionMode, gameObjectFactory, creator.archetypeSet, creator.faceObjectProviders, creator.animationObjects); + } + + /** * Creator for {@link AutojoinList} instances. */ private static class Creator { @@ -109,6 +219,12 @@ private final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects; /** + * The {@link MapViewSettings} instance. + */ + @NotNull + private final MapViewSettings mapViewSettings; + + /** * The {@link ArchetypeSet} instance. */ @NotNull @@ -125,7 +241,7 @@ faceObjectProviders = new FaceObjectProviders(1, faceObjects, systemIcons); archetypeSet = new TestArchetypeSet(archetypeFactory, "arch", faceObjectProviders); animationObjects = new TestAnimationObjects(); - final TestMapViewSettings mapViewSettings = new TestMapViewSettings(); + mapViewSettings = new TestMapViewSettings(); autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); } @@ -179,4 +295,41 @@ } + /** + * Creator for {@link MapModel} instances. + */ + private static class Creator2 { + + /** + * The {@link MapModelFactory} for creating {@link MapModel} instances. + */ + @NotNull + private final MapModelFactory<TestGameObject, TestMapArchObject, TestArchetype> mapModelFactory; + + /** + * Creates a new instance. + * @param creator the creator to use + */ + private Creator2(@NotNull final Creator creator) { + final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); + final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(creator.faceObjectProviders, creator.animationObjects); + final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); + final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode = new TopmostInsertionMode<TestGameObject, TestMapArchObject, TestArchetype>(); + mapModelFactory = new MapModelFactory<TestGameObject, TestMapArchObject, TestArchetype>(archetypeChooserModel, creator.autojoinLists, creator.mapViewSettings, gameObjectFactory, gameObjectMatchers, topmostInsertionMode); + } + + /** + * Creates a new {@link MapModel} instance. + * @param width the map width in squares + * @param height the map height in squares + * @return the map model instance + */ + @NotNull + public MapModel<TestGameObject, TestMapArchObject, TestArchetype> newMapModel(final int width, final int height) { + final TestMapArchObject mapArchObject = new TestMapArchObject(); + mapArchObject.setMapSize(new Size2D(width, height)); + return mapModelFactory.newMapModel(mapArchObject); + } + } + } // class AutojoinListsTest Added: trunk/model/src/test/net/sf/gridarta/model/mapmodel/CannotInsertGameObjectException.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/CannotInsertGameObjectException.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/CannotInsertGameObjectException.java 2010-07-01 21:47:09 UTC (rev 8574) @@ -0,0 +1,46 @@ +/* + * 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.mapmodel; + +import java.awt.Point; +import net.sf.gridarta.model.baseobject.BaseObject; +import org.jetbrains.annotations.NotNull; + +/** + * Exception thrown if a game object cannot be inserted into a map. + * @author Andreas Kirschbaum + */ +public class CannotInsertGameObjectException extends Exception { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance. + * @param archetype the archetypes that cannot be inserted + * @param point the insertion location + */ + public CannotInsertGameObjectException(@NotNull final BaseObject<?, ?, ?, ?> archetype, @NotNull final Point point) { + super(archetype.getBestName() + " at " + point.x + "/" + point.y); + } + +} // class CannotInsertGameObjectException Property changes on: trunk/model/src/test/net/sf/gridarta/model/mapmodel/CannotInsertGameObjectException.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelHelper.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelHelper.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelHelper.java 2010-07-01 21:47:09 UTC (rev 8574) @@ -0,0 +1,313 @@ +/* + * 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.mapmodel; + +import java.awt.Point; +import java.util.regex.Pattern; +import net.sf.gridarta.model.anim.AnimationObjects; +import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetype.DuplicateArchetypeException; +import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.baseobject.BaseObject; +import net.sf.gridarta.model.baseobject.GameObjectContainer; +import net.sf.gridarta.model.face.FaceObjectProviders; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.gameobject.GameObjectFactory; +import net.sf.gridarta.model.gameobject.TestGameObject; +import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.gridarta.utils.Size2D; +import org.jetbrains.annotations.NotNull; +import org.junit.Assert; + +/** + * Helper class for creating {@link MapModel} instances for regression tests. + * @author Andreas Kirschbaum + */ +public class TestMapModelHelper { + + /** + * The archetype type used for "exit" game objects. + */ + public static final int EXIT_TYPE = 1; + + /** + * The archetype type used for "floor" game objects. + */ + private static final int FLOOR_TYPE = 2; + + /** + * The archetype type used for "mob" game objects. + */ + private static final int MOB_TYPE = 3; + + /** + * An empty array of strings. + */ + @NotNull + private static final String[] EMPTY_STRING_ARRAY = new String[0]; + + /** + * The "topmost" {@link InsertionMode} instance. + */ + @NotNull + private final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode; + + /** + * The {@link GameObjectFactory} instance. + */ + @NotNull + private final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory; + + /** + * The archetype to create floor game objects. + */ + @NotNull + private final TestArchetype floorArchetype; + + /** + * The archetype to create exit game objects. + */ + @NotNull + private final TestArchetype exitArchetype; + + /** + * The archetype to create 2x1 mob game objects. + */ + @NotNull + private final TestArchetype mob21Archetype; + + /** + * Creates a new instance. + * @param topmostInsertionMode the "topmost" insertion mode instance + * @param gameObjectFactory the game object factory to use + * @param archetypeSet the archetype set to use + * @param faceObjectProviders the face object providers to use + * @param animationObjects the animation objects to use + * @throws DuplicateArchetypeException if an internal error occurs + */ + public TestMapModelHelper(@NotNull final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode, @NotNull final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects) throws DuplicateArchetypeException { + this.topmostInsertionMode = topmostInsertionMode; + this.gameObjectFactory = gameObjectFactory; + + floorArchetype = new TestArchetype("floor", faceObjectProviders, animationObjects); + floorArchetype.setAttributeString(BaseObject.TYPE, Integer.toString(FLOOR_TYPE)); + archetypeSet.addArchetype(floorArchetype); + + exitArchetype = new TestArchetype("exit", faceObjectProviders, animationObjects); + exitArchetype.setAttributeString(BaseObject.TYPE, Integer.toString(EXIT_TYPE)); + archetypeSet.addArchetype(exitArchetype); + + mob21Archetype = new TestArchetype("mob21", faceObjectProviders, animationObjects); + mob21Archetype.setAttributeString(BaseObject.TYPE, Integer.toString(MOB_TYPE)); + archetypeSet.addArchetype(mob21Archetype); + final TestArchetype mob21bArchetype = new TestArchetype("mob21b", faceObjectProviders, animationObjects); + mob21bArchetype.setMultiX(1); + mob21Archetype.addTailPart(mob21bArchetype); + archetypeSet.addArchetype(mob21bArchetype); + } + + /** + * Inserts a {@link #floorArchetype} game object into a map model. + * @param mapModel the map model to insert into + * @param point the position to insert at + * @return the inserted game object + * @throws CannotInsertGameObjectException if the archetype cannot be + * inserted + */ + @NotNull + public TestGameObject insertFloor(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final Point point) throws CannotInsertGameObjectException { + return insertArchetype(mapModel, point, floorArchetype, false); + } + + /** + * Inserts an {@link #exitArchetype} game object into a map model. + * @param mapModel the map model to insert into + * @param point the position to insert at + * @return the inserted game object + * @throws CannotInsertGameObjectException if the archetype cannot be + * inserted + */ + @NotNull + public TestGameObject insertExit(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final Point point) throws CannotInsertGameObjectException { + return insertArchetype(mapModel, point, exitArchetype, false); + } + + /** + * Inserts a {@link #mob21Archetype} game object into a map model. + * @param mapModel the map model to insert into + * @param point the position to insert at + * @return the inserted game object + * @throws CannotInsertGameObjectException if the archetype cannot be + * inserted + */ + @NotNull + public TestGameObject insertMob21(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final Point point) throws CannotInsertGameObjectException { + return insertArchetype(mapModel, point, mob21Archetype, false); + } + + /** + * Inserts an archetype game object into a map model. + * @param mapModel the map model to insert into + * @param x the x coordinate to insert at + * @param y the y coordinate to insert at + * @param archetype the archetype to insert + * @param join whether to perform autojoining + * @return the inserted game object + * @throws CannotInsertGameObjectException if the archetype cannot be + * inserted + */ + @NotNull + public TestGameObject insertArchetype(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, final int x, final int y, @NotNull final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, ?> archetype, final boolean join) throws CannotInsertGameObjectException { + return insertArchetype(mapModel, new Point(x, y), archetype, join); + } + + /** + * Inserts an archetype game object into a map model. + * @param mapModel the map model to insert into + * @param point the position to insert at + * @param archetype the archetype to insert + * @param join whether to perform autojoining + * @return the inserted game object + * @throws CannotInsertGameObjectException if the archetype cannot be + * inserted + */ + @NotNull + public TestGameObject insertArchetype(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final Point point, @NotNull final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, ?> archetype, final boolean join) throws CannotInsertGameObjectException { + final TestGameObject gameObject = mapModel.insertBaseObject(archetype, point, true, join, topmostInsertionMode); + if (gameObject == null) { + throw new CannotInsertGameObjectException(archetype, point); + } + return gameObject; + } + + /** + * Inserts an {@link #exitArchetype} game object into a game object. + * @param gameObject the game object + * @return the inserted game object + */ + @NotNull + public TestGameObject insertExit(@NotNull final GameObjectContainer<TestGameObject, TestMapArchObject, TestArchetype> gameObject) { + return insertArchetype(gameObject, exitArchetype); + } + + /** + * Inserts a {@link #mob21Archetype} game object into a game object. + * @param gameObject the game object + * @return the inserted game object + */ + @NotNull + public TestGameObject insertMob21(@NotNull final GameObjectContainer<TestGameObject, TestMapArchObject, TestArchetype> gameObject) { + return insertArchetype(gameObject, mob21Archetype); + } + + /** + * Inserts an archetype into a game object. + * @param gameObject the game object + * @param archetype the archetype to insert + * @return the inserted game object + */ + @NotNull + public TestGameObject insertArchetype(@NotNull final GameObjectContainer<TestGameObject, TestMapArchObject, TestArchetype> gameObject, @NotNull final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, ?> archetype) { + final TestGameObject newGameObject = archetype.newInstance(gameObjectFactory); + gameObject.addLast(newGameObject); + return newGameObject; + } + + /** + * Checks for expected {@link MapModel}'s contents. + * @param mapModel the map model + * @param lines the expected contents + */ + public static void checkMapContents(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final String... lines) { + final Size2D mapSize = mapModel.getMapArchObject().getMapSize(); + Assert.assertEquals(lines.length, mapSize.getHeight()); + final Pattern pattern1 = Pattern.compile("\\|"); + final Pattern pattern2 = Pattern.compile(","); + final Point pos = new Point(); + for (int y = 0; y < lines.length; y++) { + final CharSequence line = lines[y]; + final String[] square = pattern1.split(line, -1); + Assert.assertEquals(square.length, mapSize.getWidth()); + + for (int x = 0; x < square.length; x++) { + final String square2 = square[x]; + final String[] gameObjects = square2.isEmpty() ? EMPTY_STRING_ARRAY : pattern2.split(square2, -1); + pos.x = x; + pos.y = y; + checkContentsString(mapModel.getMapSquare(pos), gameObjects); + } + } + } + + /** + * Checks that a {@link MapSquare} contains the given game objects. + * @param mapSquare the map square + * @param gameObjects the game object + */ + private static void checkContentsString(@NotNull final MapSquare<TestGameObject, TestMapArchObject, TestArchetype> mapSquare, @NotNull final String... gameObjects) { + int i = 0; + for (final BaseObject<?, ?, ?, ?> gameObject : mapSquare) { + final String gameObjectName = gameObject.getBestName(); + if (i >= gameObjects.length) { + Assert.fail("map square " + mapSquare.getMapX() + "/" + mapSquare.getMapY() + " contains excess game object '" + gameObjectName + "'"); + } else if (!gameObjectName.equals(gameObjects[i])) { + Assert.fail("map square " + mapSquare.getMapX() + "/" + mapSquare.getMapY() + " contains wrong game object '" + gameObjectName + "' at index " + i + ", expected '" + gameObjects[i] + "'"); + } + i++; + } + if (i < gameObjects.length) { + Assert.fail("map square " + mapSquare.getMapX() + "/" + mapSquare.getMapY() + " is missing game object '" + gameObjects[i] + "'"); + } + } + + /** + * Checks that a {@link MapSquare} contains the given game objects. + * @param mapSquare the map square + * @param gameObjects the game object + */ + public static void checkContents(@NotNull final Iterable<TestGameObject> mapSquare, @NotNull final TestGameObject... gameObjects) { + int i = 0; + for (final BaseObject<?, ?, ?, ?> gameObject : mapSquare) { + final String gameObjectName = gameObject.getBestName(); + if (i >= gameObjects.length) { + Assert.fail("map square contains excess game object '" + gameObjectName + "'"); + } else if (gameObject != gameObjects[i]) { + Assert.fail("map square contains wrong game object '" + gameObjectName + "' at index " + i + ", expected '" + gameObjects[i].getBestName() + "'"); + } + i++; + } + if (i < gameObjects.length) { + Assert.fail("map square is missing game object '" + gameObjects[i].getBestName() + "'"); + } + + final boolean inContainer = mapSquare instanceof GameObject; + for (final GameObject<?, ?, ?> gameObject : mapSquare) { + Assert.assertEquals(inContainer, gameObject.isInContainer()); + if (inContainer) { + // game objects within inventories must not contain tail parts + Assert.assertFalse(gameObject.isMulti()); + } else { + // game objects on the map must have expanded tail parts + Assert.assertEquals(gameObject.getArchetype().isMulti(), gameObject.isMulti()); + } + } + } + +} // class TestMapModelHelper Property changes on: trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelHelper.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2010-07-01 20:32:09 UTC (rev 8573) +++ trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2010-07-01 21:47:09 UTC (rev 8574) @@ -32,7 +32,9 @@ import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapmodel.CannotInsertGameObjectException; import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.TestMapModelHelper; import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -73,6 +75,12 @@ private TestMapControlCreator testMapControlCreator = null; /** + * The {@link TestMapModelHelper} instance. + */ + @Nullable + private TestMapModelHelper mapModelHelper = null; + + /** * Checks that {@link ExitConnectorActions#doExitCopy(boolean, MapControl, * Point)} does work. */ @@ -104,9 +112,10 @@ /** * Checks that {@link ExitConnectorActions#doExitPaste(boolean, MapControl, * Point)} does work. + * @throws CannotInsertGameObjectException if the test fails */ @Test - public void testExitPaste1() { + public void testExitPaste1() throws CannotInsertGameObjectException { final ExitConnectorModel model = new TestExitConnectorModel(); final ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype> actions = createActions(model); final Size2D mapSize = new Size2D(5, 5); @@ -125,8 +134,8 @@ mapModel.beginTransaction("TEST"); try { - assert testMapControlCreator != null; - testMapControlCreator.insertFloor(mapModel, point1); + assert mapModelHelper != null; + mapModelHelper.insertFloor(mapModel, point1); } finally { mapModel.endTransaction(); } @@ -136,8 +145,8 @@ mapModel.beginTransaction("TEST"); try { - assert testMapControlCreator != null; - testMapControlCreator.insertExit(mapModel, point1); + assert mapModelHelper != null; + mapModelHelper.insertExit(mapModel, point1); } finally { mapModel.endTransaction(); } @@ -184,9 +193,10 @@ /** * Checks that {@link ExitConnectorActions#doExitConnect(boolean, * MapControl, Point)} does work. + * @throws CannotInsertGameObjectException if the test fails */ @Test - public void testExitConnect1() { + public void testExitConnect1() throws CannotInsertGameObjectException { final ExitConnectorModel model = new TestExitConnectorModel(); final ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype> actions = createActions(model); @@ -210,8 +220,8 @@ mapModel1.beginTransaction("TEST"); try { - assert testMapControlCreator != null; - testMapControlCreator.insertFloor(mapModel1, point1); + assert mapModelHelper != null; + mapModelHelper.insertFloor(mapModel1, point1); } finally { mapModel1.endTransaction(); } @@ -221,8 +231,8 @@ mapModel1.beginTransaction("TEST"); try { - assert testMapControlCreator != null; - testMapControlCreator.insertExit(mapModel1, point1); + assert mapModelHelper != null; + mapModelHelper.insertExit(mapModel1, point1); } finally { mapModel1.endTransaction(); } @@ -232,8 +242,8 @@ mapModel2.beginTransaction("TEST"); try { - assert testMapControlCreator != null; - testMapControlCreator.insertExit(mapModel2, point2); + assert mapModelHelper != null; + mapModelHelper.insertExit(mapModel2, point2); } finally { mapModel2.endTransaction(); } @@ -298,9 +308,10 @@ /** * Checks that exit paths are correctly generated. + * @throws CannotInsertGameObjectException if the test fails */ @Test - public void testPath1() { + public void testPath1() throws CannotInsertGameObjectException { // both root ==> relative testPath("/a", "/b", "b"); // both root ==> relative @@ -326,8 +337,9 @@ * exit object * @param mapPathTo the map path to connect to * @param expectedExitPath the expected map in the exit object + * @throws CannotInsertGameObjectException if the test fails */ - private void testPath(@NotNull final String mapPathFrom, @NotNull final String mapPathTo, @NotNull final String expectedExitPath) { + private void testPath(@NotNull final String mapPathFrom, @NotNull final String mapPathTo, @NotNull final String expectedExitPath) throws CannotInsertGameObjectException { final ExitConnectorModel model = new TestExitConnectorModel(); final ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype> actions = createActions(model); @@ -348,8 +360,8 @@ model.setExitLocation(new ExitLocation(mapFileTo, pointTo, MAP_NAME2, testMapControlCreator.getPathManager())); mapModel.beginTransaction("TEST"); try { - assert testMapControlCreator != null; - testMapControlCreator.insertExit(mapModel, pointFrom); + assert mapModelHelper != null; + mapModelHelper.insertExit(mapModel, pointFrom); } finally { mapModel.endTransaction(); } @@ -366,6 +378,7 @@ @Before public void setUp() throws DuplicateArchetypeException { testMapControlCreator = new TestMapControlCreator(); + mapModelHelper = testMapControlCreator.newMapModelCreator(); } /** @@ -393,7 +406,7 @@ int thisIndex = 0; for (final BaseObject<?, ?, ?, ?> gameObject : mapModel.getMapSquare(point)) { if (thisIndex == index) { - if (gameObject.getTypeNo() != TestMapControlCreator.EXIT_TYPE) { + if (gameObject.getTypeNo() != TestMapModelHelper.EXIT_TYPE) { break; } Modified: trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java 2010-07-01 20:32:09 UTC (rev 8573) +++ trunk/src/test/net/sf/gridarta/gui/copybuffer/CopyBufferTest.java 2010-07-01 21:47:09 UTC (rev 8574) @@ -30,7 +30,9 @@ import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; import net.sf.gridarta.model.mapgrid.SelectionMode; +import net.sf.gridarta.model.mapmodel.CannotInsertGameObjectException; import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.TestMapModelHelper; import net.sf.gridarta.utils.Size2D; import org.junit.Test; @@ -53,24 +55,26 @@ /** * Checks that {@link CopyBuffer#cut(MapView, Rectangle)} followed by {@link * CopyBuffer#paste(MapView, Point)} does work. + * @throws CannotInsertGameObjectException if the test fails * @throws DuplicateArchetypeException if the test fails */ @Test - public void testCutPaste1() throws DuplicateArchetypeException { + public void testCutPaste1() throws CannotInsertGameObjectException, DuplicateArchetypeException { final TestMapControlCreator testMapControlCreator = new TestMapControlCreator(); + final TestMapModelHelper mapModelHelper = testMapControlCreator.newMapModelCreator(); final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl = testMapControlCreator.newMapControl(MAP_FILE1, MAP_NAME1, new Size2D(3, 3)); final Point point = new Point(1, 1); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapControl.getMapModel(); mapModel.beginTransaction("TEST"); - final TestGameObject ob1 = testMapControlCreator.insertFloor(mapModel, point); - final TestGameObject ob2 = testMapControlCreator.insertMob21(ob1); + final TestGameObject ob1 = mapModelHelper.insertFloor(mapModel, point); + final TestGameObject ob2 = mapModelHelper.insertMob21(ob1); - TestMapControlCreator.checkMapContents(mapModel, + TestMapModelHelper.checkMapContents(mapModel, "||", "|floor|", "||"); - TestMapControlCreator.checkContents(ob1, ob2); + TestMapModelHelper.checkContents(ob1, ob2); // select + cut final CopyBuffer<TestGameObject, TestMapArchObject, TestArchetype> copyBuffer = testMapControlCreator.newCopyBuffer(); @@ -78,7 +82,7 @@ mapView.getMapViewBasic().getMapGrid().select(new Point(1, 1), new Point(1, 1), SelectionMode.ADD); copyBuffer.cut(mapView, new Rectangle(1, 1, 1, 1)); - TestMapControlCreator.checkMapContents(mapModel, + TestMapModelHelper.checkMapContents(mapModel, "||", "||", "||"); @@ -86,7 +90,7 @@ // paste copyBuffer.paste(mapView, new Point(1, 1)); - TestMapControlCreator.checkMapContents(mapModel, + TestMapModelHelper.checkMapContents(mapModel, "||", "|floor|", "||"); Modified: trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java 2010-07-01 20:32:09 UTC (rev 8573) +++ trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java 2010-07-01 21:47:09 UTC (rev 8574) @@ -20,10 +20,8 @@ package net.sf.gridarta.gui.map.test; import java.awt.Image; -import java.awt.Point; import java.awt.image.BufferedImage; import java.io.File; -import java.util.regex.Pattern; import net.sf.gridarta.gui.copybuffer.CopyBuffer; import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.map.mapview.MapViewBasic; @@ -50,14 +48,10 @@ import net.sf.gridarta.model.archetype.TestArchetypeSet; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.autojoin.AutojoinLists; -import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.baseobject.GameObjectContainer; import net.sf.gridarta.model.exitconnector.ExitMatcher; -import net.sf.gridarta.model.face.ArchFaceProvider; -import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.gameobject.TestGameObjectFactory; @@ -80,9 +74,8 @@ import net.sf.gridarta.model.mapcontrol.TestMapControlFactory; import net.sf.gridarta.model.mapmodel.InsertionMode; import net.sf.gridarta.model.mapmodel.InsertionModeSet; -import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapModelFactory; -import net.sf.gridarta.model.mapmodel.MapSquare; +import net.sf.gridarta.model.mapmodel.TestMapModelHelper; import net.sf.gridarta.model.mapmodel.TopmostInsertionMode; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.mapviewsettings.TestMapViewSettings; @@ -96,7 +89,6 @@ import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import org.junit.Assert; /** * Helper class for creating {@link MapControl} instances for regression tests. @@ -105,33 +97,12 @@ public class TestMapControlCreator { /** - * The archetype type used for "exit" game objects. + * The {@link AnimationObjects} instance. */ - public static final int EXIT_TYPE = 1; - - /** - * The archetype type used for "floor" game objects. - */ - private static final int FLOOR_TYPE = 2; - - /** - * The archetype type used for "mob" game objects. - */ - private static final int MOB_TYPE = 3; - - /** - * An empty array of strings. - */ @NotNull - private static final String[] EMPTY_STRING_ARRAY = new String[0]; + private final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects; /** - * The {@link SystemIcons} instance. - */ - @NotNull - private final SystemIcons systemIcons; - - /** * The {@link MapManager} instance. */ @NotNull @@ -156,36 +127,30 @@ private final PathManager pathManager; /** - * The {@link ExitMatcher} instance. + * The "topmost" {@link InsertionMode} instance. */ @NotNull - private final ExitMatcher<TestGameObject, TestMapArchObject, TestArchetype> exitMatcher; + private final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode; /** - * The {@link ArchetypeSet} instance. + * The {@link ExitMatcher} instance. */ @NotNull - private final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet; + private final ExitMatcher<TestGameObject, TestMapArchObject, TestArchetype> exitMatcher; /** - * The archetype to create floor game objects. + * The {@link FaceObjectProviders} instance. */ @NotNull - private final TestArchetype floorArchetype; + private final FaceObjectProviders faceObjectProviders; /** - * The archetype to create exit game objects. + * The {@link ArchetypeSet} instance. */ @NotNull - private final TestArchetype exitArchetype; + private final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet; /** - * The archetype to create 2x1 mob game objects. - */ - @NotNull - private final TestArchetype mob21Archetype; - - /** * The {@link GlobalSettings} instance. */ @NotNull @@ -216,12 +181,6 @@ private final MapModelFactory<TestGameObject, TestMapArchObject, TestArchetype> mapModelFactory; /** - * The "topmost" {@link InsertionMode} instance. - */ - @NotNull - private final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode; - - /** * The {@link InsertionModeSet} instance. */ @NotNull @@ -229,16 +188,16 @@ /** * Creates a new instance. - * @throws DuplicateArchetypeException if an internal error occurs */ - public TestMapControlCreator() throws DuplicateArchetypeException { + public TestMapControlCreator() { final GUIUtils guiUtils = new GUIUtils(); - systemIcons = new SystemIcons(guiUtils); - final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); - final GameObjectMatcher exitGameObjectMatcher = new TypeNrsGameObjectMatcher(EXIT_TYPE); + final SystemIcons systemIcons = new SystemIcons(guiUtils); + animationObjects = new DefaultAnimationObjects<TestGameObject, TestMapArchObject, TestArchetype>("anim"); + final GameObjectMatcher exitGameObjectMatcher = new TypeNrsGameObjectMatcher(TestMapModelHelper.EXIT_TYPE); exitMatcher = new ExitMatcher<TestGameObject, TestMapArchObject, TestArchetype>(exitGameObjectMatcher); final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory = new TestArchetypeFactory(); - final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); + final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); + faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); archetypeSet = new TestArchetypeSet(archetypeFactory, "archetypes", faceObjectProviders); final MapArchObjectParserFactory<TestMapArchObject> mapArchObjectParserFactory = new TestMapArchObjectParserFactory(); mapViewSettings = new TestMapViewSettings(); @@ -262,22 +221,15 @@ final AbstractMapManager<TestGameObject, TestMapArchObject, TestArchetype> tmpPickmapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype>(mapReaderFactory, mapControlFactory, globalSettings, faceObjectProviders); tmpPickmapManager.setFileControl(fileControl); pickmapManager = tmpPickmapManager; + } - floorArchetype = new TestArchetype("floor", faceObjectProviders, animationObjects); - floorArchetype.setAttributeString(BaseObject.TYPE, Integer.toString(FLOOR_TYPE)); - archetypeSet.addArchetype(floorArchetype); - - exitArchetype = new TestArchetype("exit", faceObjectProviders, animationObjects); - exitArchetype.setAttributeString(BaseObject.TYPE, Integer.toString(EXIT_TYPE)); - archetypeSet.addArchetype(exitArchetype); - - mob21Archetype = new TestArchetype("mob21", faceObjectProviders, animationObjects); - mob21Archetype.setAttributeString(BaseObject.TYPE, Integer.toString(MOB_TYPE)); - archetypeSet.addArchetype(mob21Archetype); - final TestArchetype mob21bArchetype = new TestArchetype("mob21b", faceObjectProviders, animationObjects); - mob21bArchetype.setMultiX(1); - mob21Archetype.addTailPart(mob21bArchetype); - archetypeSet.addArchetype(mob21bArchetype); + /** + * Creates a new {@link TestMapModelHelper} instance. + * @return the new instance + * @throws DuplicateArchetypeException if an internal error occurs + */ + public TestMapModelHelper newMapModelCreator() throws DuplicateArchetypeException { + return new TestMapModelHelper(topmostInsertionMode, gameObjectFactory, archetypeSet, faceObjectProviders, animationObjects); } /** @@ -296,99 +248,6 @@ } /** - * Inserts a {@link #floorArchetype} game object into a map model. - * @param mapModel the map model to insert into - * @param point the position to insert at - * @return the inserted game object - */ - @NotNull - public TestGameObject insertFloor(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final Point point) { - return insertArchetype(mapModel, point, floorArchetype); - } - - /** - * Inserts an {@link #exitArchetype} game object into a map model. - * @param mapModel the map model to insert into - * @param point the position to insert at - * @return the inserted game object - */ - @NotNull - public TestGameObject insertExit(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final Point point) { - return insertArchetype(mapModel, point, exitArchetype); - } - - /** - * Inserts a {@link #mob21Archetype} game object into a map model. - * @param mapModel the map model to insert into - * @param point the position to insert at - * @return the inserted game object - */ - @NotNull - public TestGameObject insertMob21(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final Point point) { - return insertArchetype(mapModel, point, mob21Archetype); - } - - /** - * Inserts an archetype game object into a map model. - * @param mapModel the map model to insert into - * @param point the position to insert at - * @param archetype the archetype to insert - * @return the inserted game object - */ - @NotNull - private TestGameObject insertArchetype(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final Point point, @NotNull final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, ?> archetype) { - final TestGameObject gameObject = mapModel.insertBaseObject(archetype, point, true, false, topmostInsertionMode); - if (gameObject == null) { - throw new AssertionError(); - } - return gameObject; - } - - /** - * Inserts an {@link #exitArchetype} game object into a game object. - * @param gameObject the game object - * @return the inserted game object - */ - @NotNull - public TestGameObject insertExit(@NotNull final GameObjectContainer<TestGameObject, TestMapArchObject, TestArchetype> gameObject) { - return insertArchetype(gameObject, exitArchetype); - } - - /** - * Inserts a {@link #mob21Archetype} game object into a game object. - * @param gameObject the game object - * @return the inserted game object - */ - @NotNull - public TestGameObject insertMob21(@NotNull final GameObjectContainer<TestGameObject, TestMapArchObject, TestArchetype> gameObject) { - return insertArchetype(gameObject, mob21Archetype); - } - - /** - * Inserts an archetype into a game object. - * @param gameObject the game object - * @param archetype the archetype to insert - * @return the inserted game object - */ - @NotNull - public TestGameObject insertArchetype(@NotNull final GameObjectContainer<TestGameObject, TestMapArchObject, TestArchetype> gameObject, @NotNull final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, ?> archetype) { - final TestGameObject newGameObject = archetype.newInstance(gameObjectFactory); - gameObject.addLast(newGameObject); - return newGameObject; - } - - /** - * Creates a new {@link FaceObjectProviders} instance. - * @return the face object providers instance - */ - private FaceObjectProviders newFaceObjectProviders() { - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new DefaultFaceObjects<TestGameObject, TestMapArchObject, TestArchetype>("test", "bmaps.paths", Pattern.compile("^.*\t\\.?(.*)"), "\\%1$05d\t./arch%2$s", archFaceProvider); - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - return faceObjectProviders; - } - - /** * Returns the {@link PathManager}. * @return the path manager */ @@ -443,60 +302,6 @@ } /** - * Checks that a {@link MapSquare} contains the given game objects. - * @param mapSquare the map square - * @param gameObjects the game object - */ - public static void checkContents(@NotNull final Iterable<TestGameObject> mapSquare, @NotNull final TestGameObject... gameObjects) { - int i = 0; - for (final BaseObject<?, ?, ?, ?> gameObject : mapSquare) { - final String gameObjectName = gameObject.getBestName(); - if (i >= gameObjects.length) { - Assert.fail("map square contains excess game object '" + gameObjectName + "'"); - } else if (gameObject != gameObjects[i]) { - Assert.fail("map square contains wrong game object '" + gameObjectName + "' at index " + i + ", expected '" + gameObjects[i].getBestName() + "'"); - } - i++; - } - if (i < gameObjects.length) { - Assert.fail("map square is missing game object '" + gameObjects[i].getBestName() + "'"); - } - - final boolean inContainer = mapSquare instanceof GameObject; - for (final GameObject<?, ?, ?> gameObject : mapSquare) { - Assert.assertEquals(inContainer, gameObject.isInContainer()); - if (inContainer) { - // game objects within inventories must not contain tail parts - Assert.assertFalse(gameObject.isMulti()); - } else { - // game objects on the map must have expanded tail parts - Assert.assertEquals(gameObject.getArchetype().isMulti(), gameObject.isMulti()); - } - } - } - - /** - * Checks that a {@link MapSquare} contains the given game objects. - * @param mapSquare the map square - * @param gameObjects the game object - */ - private static void checkContentsString(@NotNull final MapSquare<TestGameObject, TestMapArchObject, TestArchetype> mapSquare, @NotNull final String... gameObjects) { - int i = 0; - for (final BaseObject<?, ?, ?, ?> gameObject : mapSquare) { - final String gameObjectName = gameObject.getBestName(); - if (i >= gameObjects.length) { - Assert.fail("map square " + mapSquare.getMapX() + "/" + mapSquare.getMapY() + " contains excess game object '" + gameObjectName + "'"); - } else if (!gameObjectName.equals(gameObjects[i])) { - Assert.fail("map square " + mapSquare.getMapX() + "/" + mapSquare.getMapY() + " contains wrong game object '" + gameObjectName + "' at index " + i + ", expected '" + gameObjects[i] + "'"); - } - i++; - } - if (i < gameObjects.length) { - Assert.fail("map square " + mapSquare.getMapX() + "/" + mapSquare.getMapY() + " is missing game object '" + gameObjects[i] + "'"); - } - } - - /** * Creates a new {@link MapView} instance. * @param mapControl the associated map control * @return the map view instance @@ -518,32 +323,6 @@ } /** - * Checks for expected {@link MapModel}'s contents. - * @param mapModel the map model - * @param lines the expected contents - */ - public static void checkMapContents(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final String... lines) { - final Size2D mapSize = mapModel.getMapArchObject().getMapSize(); - Assert.assertEquals(lines.length, mapSize.getHeight()); - final Pattern pattern1 = Pattern.compile("\\|"); - final Pattern pattern2 = Pattern.compile(","); - final Point pos = new Point(); - for (int y = 0; y < lines.length; y++) { - final CharSequence line = lines[y]; - final String[] square = pattern1.split(line, -1); - Assert.assertEquals(square.length, mapSize.getWidth()); - - for (int x = 0; x < square.length; x++) { - final String square2 = square[x]; - final String[] gameObjects = square2.isEmpty() ? EMPTY_STRING_ARRAY : pattern2.split(square2, -1); - pos.x = x; - pos.y = y; - checkContentsString(mapModel.getMapSquare(pos), gameObjects); - } - } - } - - /** * Returns the {@link GameObjectFactory} instance. * @return the game object factory */ Modified: trunk/src/test/net/sf/gridarta/gui/selectedsquare/SelectedSquareActionsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/selectedsquare/SelectedSquareActionsTest.java 2010-07-01 20:32:09 UTC (rev 8573) +++ trunk/src/test/net/sf/gridarta/gui/selectedsquare/SelectedSquareActionsTest.java 2010-07-01 21:47:09 UTC (rev 8574) @@ -28,8 +28,10 @@ import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapcontrol.MapControl; +import net.sf.gridarta.model.mapmodel.CannotInsertGameObjectException; import net.sf.gridarta.model.mapmodel.MapModel; import net.sf.gridarta.model.mapmodel.MapSquare; +import net.sf.gridarta.model.mapmodel.TestMapModelHelper; import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; import org.junit.Assert; @@ -54,11 +56,13 @@ /** * Checks that {@link SelectedSquareActions#doMoveSquareTop(boolean)} does * work for single-square game objects. + * @throws CannotInsertGameObjectException if the test fails * @throws DuplicateArchetypeException if the test fails */ @Test - public void testDoMoveSquareTopSingle() throws DuplicateArchetypeException { + public void testDoMoveSquareTopSingle() throws CannotInsertGameObjectException, DuplicateArchetypeException { final TestMapControlCreator testMapControlCreator = new TestMapControlCreator(); + final TestMapModelHelper mapModelHelper = testMapControlCreator.newMapModelCreator(); final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl = testMapControlCreator.newMapControl(MAP_FILE1, MAP_NAME1, new Size2D(1, 1)); final SelectedSquareModel<TestGameObject, TestMapArchObject, TestArchetype> selectedSquareModel = newSelectedSquareModel(mapControl); final SelectedSquareActions<TestGameObject, TestMapArchObject, TestArchetype> selectedSquareActions = new SelectedSquareActions<TestGameObject, TestMapArchObject, TestArchetype>(selectedSquareModel); @@ -67,10 +71,10 @@ final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapControl.getMapModel(); mapModel.beginTransaction("TEST"); final MapSquare<TestGameObject, TestMapArchObject, TestArchetype> mapSquare = mapModel.getMapSquare(point); - final TestGameObject ob2 = testMapControlCreator.insertFloor(mapModel, point); - final TestGameObject ob1 = testMapControlCreator.insertExit(mapModel, point); + final TestGameObject ob2 = mapModelHelper.insertFloor(mapModel, point); + final TestGameObject ob1 = mapModelHelper.insertExit(mapModel, point); - TestMapControlCreator.checkContents(mapSquare, ob2, ob1); + TestMapModelHelper.checkContents(mapSquare, ob2, ob1); // empty selection => nothing to move Assert.assertFalse(selectedSquareActions.doMoveSquareTop(false)); @@ -82,22 +86,24 @@ // [ob2, ob1] => ob2 can move Assert.assertTrue(selectedSquareActions.doMoveSquareTop(false)); Assert.assertTrue(selectedSquareActions.doMoveSquareTop(true)); - TestMapControlCreator.checkContents(mapSquare, ob1, ob2); + TestMapModelHelper.checkContents(mapSquare, ob1, ob2); // [ob1, ob2] => ob2 cannot move Assert.assertFalse(selectedSquareActions.doMoveSquareTop(false)); Assert.assertFalse(selectedSquareActions.doMoveSquareTop(true)); - TestMapControlCreator.checkContents(mapSquare, ob1, ob2); + TestMapModelHelper.checkContents(mapSquare, ob1, ob2); } /** * Checks that {@link SelectedSquareActions#doMoveSquareTop(boolean)} does * work for multi-square game objects. + * @throws CannotInsertGameObjectException if the test fails * @throws DuplicateArchetypeException if the test fails */ @Test - public void testDoMoveSquareTopMulti() throws DuplicateArchetypeException { + public void testDoMoveSquareTopMulti() throws CannotInsertGameObjectException, DuplicateArchetypeException { final TestMapControlCreator testMapControlCreator = new TestMapControlCreator(); + final TestMapModelHelper mapModelHelper = testMapControlCreator.newMapModelCreator(); final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl = testMapControlCreator.newMapControl(MAP_FILE1, MAP_NAME1, n... [truncated message content] |
From: <aki...@us...> - 2010-07-02 07:38:03
|
Revision: 8576 http://gridarta.svn.sourceforge.net/gridarta/?rev=8576&view=rev Author: akirschbaum Date: 2010-07-02 07:37:56 +0000 (Fri, 02 Jul 2010) Log Message: ----------- Move GameObjectFactoryTest to model module. Modified Paths: -------------- trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java Added Paths: ----------- trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java Removed Paths: ------------- trunk/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java Copied: trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java (from rev 8575, trunk/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java) =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java 2010-07-02 07:37:56 UTC (rev 8576) @@ -0,0 +1,69 @@ +/* + * 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.gameobject; + +import java.awt.Point; +import net.sf.gridarta.model.archetype.DuplicateArchetypeException; +import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.gridarta.model.mapmodel.CannotInsertGameObjectException; +import net.sf.gridarta.model.mapmodel.MapModel; +import net.sf.gridarta.model.mapmodel.TestMapModelCreator; +import net.sf.gridarta.model.mapmodel.TestMapModelHelper; +import org.junit.Assert; +import org.junit.Test; + +/** + * Regression tests for {@link GameObjectFactory}. + * @author Andreas Kirschbaum + */ +public class GameObjectFactoryTest { + + /** + * Checks that {@link + * net.sf.gridarta.model.gameobject.GameObjectFactory#cloneGameObject(GameObject)} + * correctly updates the container. + * @throws DuplicateArchetypeException if the test fails + * @throws CannotInsertGameObjectException if the test fails + */ + @Test + public void testDoMoveSquareTopSingle() throws CannotInsertGameObjectException, DuplicateArchetypeException { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final TestMapModelHelper mapModelHelper = mapModelCreator.newMapModelCreator(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(); + + final Point point = new Point(0, 0); + mapModel.beginTransaction("TEST"); + final TestGameObject ob1 = mapModelHelper.insertFloor(mapModel, point); + final TestGameObject ob2 = mapModelHelper.insertExit(ob1); + + final TestGameObject ob1Clone = mapModelCreator.getGameObjectFactory().cloneGameObject(ob1); + + Assert.assertNotSame(ob1, ob1Clone); + Assert.assertEquals(1, ob1Clone.countInvObjects()); + final TestGameObject ob2Clone = ob1Clone.getFirst(); + Assert.assertNotNull(ob2Clone); + Assert.assertNotSame(ob2, ob2Clone); + + Assert.assertSame(ob1, ob2.getContainer()); + Assert.assertSame(ob1Clone, ob2Clone.getContainer()); + } + +} // class GameObjectFactoryTest Property changes on: trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java 2010-07-02 07:07:32 UTC (rev 8575) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java 2010-07-02 07:37:56 UTC (rev 8576) @@ -20,40 +20,22 @@ package net.sf.gridarta.model.mapmodel; import java.awt.Point; -import java.awt.image.BufferedImage; import java.io.File; import java.util.Collection; import java.util.List; import java.util.Set; import java.util.TreeSet; -import javax.swing.ImageIcon; -import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.TestAnimationObjects; import net.sf.gridarta.model.archetype.TestArchetype; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.model.autojoin.AutojoinLists; import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.face.FaceObjectProviders; -import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.model.face.TestFaceObjects; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.gameobject.TestGameObject; -import net.sf.gridarta.model.gameobject.TestGameObjectFactory; import net.sf.gridarta.model.maparchobject.MapArchObjectListener; import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.model.mapviewsettings.TestMapViewSettings; -import net.sf.gridarta.model.match.GameObjectMatchers; -import net.sf.gridarta.model.match.TypeNrsGameObjectMatcher; import net.sf.gridarta.model.validation.ErrorCollector; -import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.Size2D; -import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.Assert; -import org.junit.Before; import org.junit.Test; /** @@ -65,13 +47,7 @@ public class DefaultMapModelTest { /** - * Predefined icon names. - */ - @NotNull - private static final String[] ICON_NAMES = { SystemIcons.SQUARE_SELECTED_SQUARE, SystemIcons.SQUARE_SELECTED_SQUARE_NORTH, SystemIcons.SQUARE_SELECTED_SQUARE_EAST, SystemIcons.SQUARE_SELECTED_SQUARE_SOUTH, SystemIcons.SQUARE_SELECTED_SQUARE_WEST, SystemIcons.SQUARE_PRE_SELECTED_SQUARE, SystemIcons.SQUARE_CURSOR, SystemIcons.SQUARE_EMPTY, SystemIcons.SQUARE_UNKNOWN, SystemIcons.SQUARE_NO_FACE, SystemIcons.SQUARE_NO_ARCH, SystemIcons.DEFAULT_ICON, SystemIcons.DEFAULT_PREVIEW, SystemIcons.SQUARE_WARNING, }; - - /** - * The map model listener registered to {@link #mapModel} to record map + * The map model listener registered to all map models to record map * changes. */ @NotNull @@ -132,7 +108,7 @@ }; /** - * The {@link MapArchObjectListener} registered to {@link #mapModel} to + * The {@link MapArchObjectListener} registered to all map models to * record map changes. */ @NotNull @@ -163,34 +139,13 @@ private final StringBuilder result = new StringBuilder(); /** - * The map model that gets changed. - */ - @Nullable - private DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = null; - - /** - * The {@link SystemIcons} instance. - */ - @Nullable - private SystemIcons systemIcons = null; - - /** - * The {@link AnimationObjects} instance. - */ - @Nullable - private AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = null; - - /** - * The {@link InsertionModeSet} instance. - */ - @Nullable - private InsertionModeSet<TestGameObject, TestMapArchObject, TestArchetype> insertionModeSet = null; - - /** * Test case for an empty transaction. */ @Test public void testEmpty() { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); + mapModel.beginTransaction("TEST"); mapModel.endTransaction(); Assert.assertEquals("", result.toString()); @@ -202,6 +157,9 @@ */ @Test public void testResizeMap1() { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); + mapModel.beginTransaction("TEST"); mapModel.getMapArchObject().setMapSize(new Size2D(4, 3)); mapModel.endTransaction(); @@ -214,6 +172,9 @@ */ @Test public void testResizeMap2() { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); + mapModel.beginTransaction("TEST"); mapModel.getMapArchObject().setMapSize(new Size2D(4, 3)); mapModel.endTransaction(); @@ -231,14 +192,17 @@ */ @Test public void testResizeMap3() { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); + mapModel.beginTransaction("TEST"); mapModel.getMapArchObject().setMapSize(new Size2D(4, 3)); - addGameObjectToMap(mapModel, "1", 1, 2, insertionModeSet.getAutoInsertionMode()); + mapModelCreator.addGameObjectToMap(mapModel, "1", 1, 2, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); mapModel.endTransaction(); result.setLength(0); mapModel.beginTransaction("TEST"); - addGameObjectToMap(mapModel, "1", 2, 2, insertionModeSet.getAutoInsertionMode()); + mapModelCreator.addGameObjectToMap(mapModel, "1", 2, 2, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); mapModel.getMapArchObject().setMapSize(new Size2D(1, 2)); // cancels square changed event mapModel.endTransaction(); Assert.assertEquals("mapSizeChanged:\n" + "no squares\n" + "no game objects\n", result.toString()); @@ -250,9 +214,12 @@ */ @Test public void testResizeMap4() { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); + mapModel.beginTransaction("TEST"); mapModel.getMapArchObject().setMapSize(new Size2D(4, 3)); - addGameObjectToMap(mapModel, "1", 1, 2, insertionModeSet.getAutoInsertionMode()); + mapModelCreator.addGameObjectToMap(mapModel, "1", 1, 2, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); mapModel.endTransaction(); result.setLength(0); @@ -260,7 +227,7 @@ for (final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, ?> gameObject : mapModel.getMapSquare(new Point(1, 2))) { gameObject.setAttributeString("key", "value"); } - addGameObjectToMap(mapModel, "1", 2, 2, insertionModeSet.getAutoInsertionMode()); + mapModelCreator.addGameObjectToMap(mapModel, "1", 2, 2, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); mapModel.getMapArchObject().setMapSize(new Size2D(1, 2)); // cancels square changed event mapModel.endTransaction(); Assert.assertEquals("mapSizeChanged:\n" + "no squares\n" + "no game objects\n", result.toString()); @@ -272,13 +239,16 @@ */ @Test public void testAddGameObjectToMap1() { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); + mapModel.beginTransaction("TEST"); mapModel.getMapArchObject().setMapSize(new Size2D(4, 3)); mapModel.endTransaction(); result.setLength(0); mapModel.beginTransaction("TEST"); - addGameObjectToMap(mapModel, "1", 1, 2, insertionModeSet.getAutoInsertionMode()); + mapModelCreator.addGameObjectToMap(mapModel, "1", 1, 2, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); mapModel.endTransaction(); Assert.assertEquals("mapSquaresChanged:\n" + "square 1 2\n" + "no game objects\n", result.toString()); } @@ -289,15 +259,18 @@ */ @Test public void testAddGameObjectToMap2() { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); + mapModel.beginTransaction("TEST"); mapModel.getMapArchObject().setMapSize(new Size2D(4, 3)); mapModel.endTransaction(); result.setLength(0); mapModel.beginTransaction("TEST"); - addGameObjectToMap(mapModel, "1", 1, 2, insertionModeSet.getAutoInsertionMode()); - addGameObjectToMap(mapModel, "1", 1, 2, insertionModeSet.getAutoInsertionMode()); - addGameObjectToMap(mapModel, "1", 2, 2, insertionModeSet.getAutoInsertionMode()); + mapModelCreator.addGameObjectToMap(mapModel, "1", 1, 2, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); + mapModelCreator.addGameObjectToMap(mapModel, "1", 1, 2, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); + mapModelCreator.addGameObjectToMap(mapModel, "1", 2, 2, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); mapModel.endTransaction(); Assert.assertEquals("mapSquaresChanged:\n" + "square 1 2\n" + "square 2 2\n" + "no game objects\n", result.toString()); } @@ -307,15 +280,18 @@ */ @Test public void testModifiedGameObject1() { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); + mapModel.beginTransaction("TEST"); mapModel.getMapArchObject().setMapSize(new Size2D(4, 3)); - addGameObjectToMap(mapModel, "1", 1, 2, insertionModeSet.getAutoInsertionMode()); + mapModelCreator.addGameObjectToMap(mapModel, "1", 1, 2, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); mapModel.endTransaction(); result.setLength(0); mapModel.beginTransaction("TEST"); for (final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject : mapModel.getMapSquare(new Point(1, 2))) { - insertGameObject(gameObject, "2"); + mapModelCreator.insertGameObject(gameObject, "2"); } mapModel.endTransaction(); Assert.assertEquals("mapObjectsChanged:\n" + "no squares\n" + "game object 1 2 1\n", result.toString()); @@ -326,9 +302,12 @@ */ @Test public void testModifiedGameObject2() { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); + mapModel.beginTransaction("TEST"); mapModel.getMapArchObject().setMapSize(new Size2D(4, 3)); - addGameObjectToMap(mapModel, "1", 1, 2, insertionModeSet.getAutoInsertionMode()); + mapModelCreator.addGameObjectToMap(mapModel, "1", 1, 2, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); mapModel.endTransaction(); result.setLength(0); @@ -346,17 +325,16 @@ */ @Test public void testGetAllGameObjects1() { - final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); - assert animationObjects != null; - final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, TestArchetype> archetype = new TestArchetype("arch", faceObjectProviders, animationObjects); - assert animationObjects != null; - final TestArchetype archetype2 = new TestArchetype("arch2", faceObjectProviders, animationObjects); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); + final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, TestArchetype> archetype = mapModelCreator.getArchetype("arch"); + final TestArchetype archetype2 = mapModelCreator.getArchetype("arch2"); archetype2.setMultiY(1); archetype.addTailPart(archetype2); mapModel.beginTransaction("TEST"); mapModel.getMapArchObject().setMapSize(new Size2D(1, 2)); - final TestGameObject gameObject = mapModel.insertBaseObject(archetype, new Point(0, 0), true, false, insertionModeSet.getAutoInsertionMode()); + final TestGameObject gameObject = mapModel.insertBaseObject(archetype, new Point(0, 0), true, false, mapModelCreator.getInsertionModeSet().getAutoInsertionMode()); mapModel.endTransaction(); final List<TestGameObject> gameObjects = mapModel.getAllGameObjects(); @@ -365,44 +343,6 @@ } /** - * Inserts a game object into a map. - * @param mapModel the map to add to - * @param name the name of the game object to add - * @param x the x coordinate to add to - * @param y the y coordinate to add to - * @param insertionMode the insertion mode to use - */ - private void addGameObjectToMap(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final String name, final int x, final int y, @NotNull final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> insertionMode) { - final TestGameObject gameObject = newGameObject(name); - mapModel.addGameObjectToMap(gameObject, new Point(x, y), insertionMode); - } - - /** - * Inserts a game object into the inventory of another game object. - * @param gameObject the game object to add to - * @param name the name of the game object to add - */ - private void insertGameObject(@NotNull final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject, @NotNull final String name) { - final TestGameObject inv = newGameObject(name); - gameObject.addLast(inv); - } - - /** - * Creates a new game object. - * @param objectName the object name to set - * @return the game object - */ - private TestGameObject newGameObject(@NotNull final String objectName) { - final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); - assert animationObjects != null; - final TestArchetype archetype = new TestArchetype("arch", faceObjectProviders, animationObjects); - assert animationObjects != null; - final TestGameObject gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); - gameObject.setAttributeString(BaseObject.NAME, objectName); - return gameObject; - } - - /** * Records a change event. * @param name the event name * @param mapSquares the changed map squares @@ -436,45 +376,20 @@ } /** - * Sets up a test. + * Creates a new {@link MapModel} instance. + * @param mapModelCreator the map model creator to use + * @return the new map model instance */ - @Before - public void setUp() { - final ImageIcon imageIcon = new ImageIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB)); - final GUIUtils guiUtils = new GUIUtils(); - systemIcons = new SystemIcons(guiUtils); - for (final String iconName : ICON_NAMES) { - guiUtils.addToCache(iconName, imageIcon); - } - final TestMapArchObject mapArchObject = new TestMapArchObject(); - final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); - final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); - final MapViewSettings mapViewSettings = new TestMapViewSettings(); - final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); - animationObjects = new TestAnimationObjects(); - final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); - final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); - final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode = new TopmostInsertionMode<TestGameObject, TestMapArchObject, TestArchetype>(); - insertionModeSet = new InsertionModeSet<TestGameObject, TestMapArchObject, TestArchetype>(topmostInsertionMode); - insertionModeSet.init(new TypeNrsGameObjectMatcher(), new TypeNrsGameObjectMatcher(), new TypeNrsGameObjectMatcher()); - mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(autojoinLists, mapArchObject, archetypeChooserModel, 0, gameObjectFactory, gameObjectMatchers, topmostInsertionMode); + @NotNull + public MapModel<TestGameObject, TestMapArchObject, TestArchetype> newMapModel(@NotNull final TestMapModelCreator mapModelCreator) { + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(); result.setLength(0); mapModel.addMapModelListener(mapModelListener); mapModel.getMapArchObject().addMapArchObjectListener(mapArchObjectListener); Assert.assertEquals("", result.toString()); - } - /** - * Creates a new {@link FaceObjectProviders} instance. - * @return the face object providers instance - */ - @NotNull - private FaceObjectProviders newFaceObjectProviders() { - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); - assert systemIcons != null; - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); - return faceObjectProviders; + return mapModel; } } // class DefaultMapModelTest Added: trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java (rev 0) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java 2010-07-02 07:37:56 UTC (rev 8576) @@ -0,0 +1,237 @@ +/* + * 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.mapmodel; + +import java.awt.Point; +import java.awt.image.BufferedImage; +import javax.swing.ImageIcon; +import net.sf.gridarta.model.anim.AnimationObjects; +import net.sf.gridarta.model.anim.TestAnimationObjects; +import net.sf.gridarta.model.archetype.ArchetypeFactory; +import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetype.DuplicateArchetypeException; +import net.sf.gridarta.model.archetype.TestArchetype; +import net.sf.gridarta.model.archetype.TestArchetypeFactory; +import net.sf.gridarta.model.archetype.TestArchetypeSet; +import net.sf.gridarta.model.archetype.UndefinedArchetypeException; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.model.autojoin.AutojoinLists; +import net.sf.gridarta.model.baseobject.BaseObject; +import net.sf.gridarta.model.face.FaceObjectProviders; +import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.face.TestFaceObjects; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.gameobject.GameObjectFactory; +import net.sf.gridarta.model.gameobject.TestGameObject; +import net.sf.gridarta.model.gameobject.TestGameObjectFactory; +import net.sf.gridarta.model.maparchobject.TestMapArchObject; +import net.sf.gridarta.model.mapviewsettings.MapViewSettings; +import net.sf.gridarta.model.mapviewsettings.TestMapViewSettings; +import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.match.TypeNrsGameObjectMatcher; +import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.SystemIcons; +import org.jetbrains.annotations.NotNull; +import org.junit.Assert; + +/** + * Helper class for regression tests to create {@link MapModel} instances. + * @author Andreas Kirschbaum + */ +public class TestMapModelCreator { + + /** + * The {@link ArchetypeSet} instance. + */ + @NotNull + private final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet; + + /** + * Predefined icon names. + */ + @NotNull + private static final String[] ICON_NAMES = { SystemIcons.SQUARE_SELECTED_SQUARE, SystemIcons.SQUARE_SELECTED_SQUARE_NORTH, SystemIcons.SQUARE_SELECTED_SQUARE_EAST, SystemIcons.SQUARE_SELECTED_SQUARE_SOUTH, SystemIcons.SQUARE_SELECTED_SQUARE_WEST, SystemIcons.SQUARE_PRE_SELECTED_SQUARE, SystemIcons.SQUARE_CURSOR, SystemIcons.SQUARE_EMPTY, SystemIcons.SQUARE_UNKNOWN, SystemIcons.SQUARE_NO_FACE, SystemIcons.SQUARE_NO_ARCH, SystemIcons.DEFAULT_ICON, SystemIcons.DEFAULT_PREVIEW, SystemIcons.SQUARE_WARNING, }; + + /** + * The {@link FaceObjectProviders} instance. + */ + @NotNull + private final FaceObjectProviders faceObjectProviders; + + /** + * The {@link GameObjectMatchers} instance. + */ + @NotNull + private final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); + + /** + * The {@link ArchetypeChooserModel} instance. + */ + @NotNull + private final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); + + /** + * The {@link AutojoinLists} instance. + */ + @NotNull + private final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists; + + /** + * The {@link GameObjectFactory} instance. + */ + @NotNull + private final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory; + + /** + * The {@link AnimationObjects} instance. + */ + @NotNull + private final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects = new TestAnimationObjects(); + + /** + * The "topmost" {@link InsertionMode} instance. + */ + @NotNull + private final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode; + + /** + * The {@link InsertionModeSet} instance. + */ + @NotNull + private final InsertionModeSet<TestGameObject, TestMapArchObject, TestArchetype> insertionModeSet; + + /** + * Creates a new instance. + */ + public TestMapModelCreator() { + final MapViewSettings mapViewSettings = new TestMapViewSettings(); + autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); + final GUIUtils guiUtils = new GUIUtils(); + final ImageIcon imageIcon = new ImageIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB)); + for (final String iconName : ICON_NAMES) { + guiUtils.addToCache(iconName, imageIcon); + } + final SystemIcons systemIcons = new SystemIcons(guiUtils); + final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); + faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); + final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory = new TestArchetypeFactory(); + archetypeSet = new TestArchetypeSet(archetypeFactory, "archetypes", faceObjectProviders); + gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); + topmostInsertionMode = new TopmostInsertionMode<TestGameObject, TestMapArchObject, TestArchetype>(); + insertionModeSet = new InsertionModeSet<TestGameObject, TestMapArchObject, TestArchetype>(topmostInsertionMode); + insertionModeSet.init(new TypeNrsGameObjectMatcher(), new TypeNrsGameObjectMatcher(), new TypeNrsGameObjectMatcher()); + } + + /** + * Creates a new {@link MapModel} instance. + * @return the new map model instance + */ + @NotNull + public MapModel<TestGameObject, TestMapArchObject, TestArchetype> newMapModel() { + final TestMapArchObject mapArchObject = new TestMapArchObject(); + return new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(autojoinLists, mapArchObject, archetypeChooserModel, 0, gameObjectFactory, gameObjectMatchers, topmostInsertionMode); + } + + /** + * Creates a new game object. + * @param objectName the object name to set + * @return the game object + */ + private TestGameObject newGameObject(@NotNull final String objectName) { + final TestArchetype archetype = getArchetype("arch"); + final TestGameObject gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); + gameObject.setAttributeString(BaseObject.NAME, objectName); + return gameObject; + } + + /** + * Inserts a game object into a map. + * @param mapModel the map to add to + * @param name the name of the game object to add + * @param x the x coordinate to add to + * @param y the y coordinate to add to + * @param insertionMode the insertion mode to use + */ + public void addGameObjectToMap(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final String name, final int x, final int y, @NotNull final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> insertionMode) { + final TestGameObject gameObject = newGameObject(name); + mapModel.addGameObjectToMap(gameObject, new Point(x, y), insertionMode); + } + + /** + * Inserts a game object into the inventory of another game object. + * @param gameObject the game object to add to + * @param name the name of the game object to add + */ + public void insertGameObject(@NotNull final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject, @NotNull final String name) { + final TestGameObject inv = newGameObject(name); + gameObject.addLast(inv); + } + + /** + * Returns the {@link InsertionModeSet} instance. + * @return the insertion mode set instance + */ + @NotNull + public InsertionModeSet<TestGameObject, TestMapArchObject, TestArchetype> getInsertionModeSet() { + return insertionModeSet; + } + + /** + * Returns an archetype. + * @param archetypeName the archetype name + * @return the archetype + */ + @NotNull + public TestArchetype getArchetype(@NotNull final String archetypeName) { + try { + return archetypeSet.getArchetype(archetypeName); + } catch (final UndefinedArchetypeException ignored) { + // ignore + } + + final TestArchetype archetype = new TestArchetype(archetypeName, faceObjectProviders, animationObjects); + try { + archetypeSet.addArchetype(archetype); + } catch (final DuplicateArchetypeException ex) { + Assert.fail(ex.getMessage()); + throw new AssertionError(ex); + } + return archetype; + } + + /** + * Returns the {@link GameObjectFactory} instance. + * @return the game object factory instance + */ + @NotNull + public GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> getGameObjectFactory() { + return gameObjectFactory; + } + + /** + * Creates a new {@link TestMapModelHelper} instance. + * @return the new instance + * @throws DuplicateArchetypeException if an internal error occurs + */ + public TestMapModelHelper newMapModelCreator() throws DuplicateArchetypeException { + return new TestMapModelHelper(topmostInsertionMode, gameObjectFactory, archetypeSet, faceObjectProviders, animationObjects); + } + +} // class TestMapModelCreator Property changes on: trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Deleted: trunk/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java 2010-07-02 07:07:32 UTC (rev 8575) +++ trunk/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java 2010-07-02 07:37:56 UTC (rev 8576) @@ -1,73 +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.model.gameobject; - -import java.awt.Point; -import java.io.File; -import net.sf.gridarta.gui.map.test.TestMapControlCreator; -import net.sf.gridarta.model.archetype.DuplicateArchetypeException; -import net.sf.gridarta.model.archetype.TestArchetype; -import net.sf.gridarta.model.maparchobject.TestMapArchObject; -import net.sf.gridarta.model.mapcontrol.MapControl; -import net.sf.gridarta.model.mapmodel.CannotInsertGameObjectException; -import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mapmodel.TestMapModelHelper; -import net.sf.gridarta.utils.Size2D; -import org.junit.Assert; -import org.junit.Test; - -/** - * Regression tests for {@link GameObjectFactory}. - * @author Andreas Kirschbaum - */ -public class GameObjectFactoryTest { - - /** - * Checks that {@link - * net.sf.gridarta.model.gameobject.GameObjectFactory#cloneGameObject(GameObject)} - * correctly updates the container. - * @throws DuplicateArchetypeException if the test fails - * @throws CannotInsertGameObjectException if the test fails - */ - @Test - public void testDoMoveSquareTopSingle() throws CannotInsertGameObjectException, DuplicateArchetypeException { - final TestMapControlCreator testMapControlCreator = new TestMapControlCreator(); - final TestMapModelHelper mapModelHelper = testMapControlCreator.newMapModelCreator(); - final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl = testMapControlCreator.newMapControl(new File("file"), "name", new Size2D(1, 1)); - - final Point point = new Point(0, 0); - final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapControl.getMapModel(); - mapModel.beginTransaction("TEST"); - final TestGameObject ob1 = mapModelHelper.insertFloor(mapModel, point); - final TestGameObject ob2 = mapModelHelper.insertExit(ob1); - - final TestGameObject ob1Clone = testMapControlCreator.getGameObjectFactory().cloneGameObject(ob1); - - Assert.assertNotSame(ob1, ob1Clone); - Assert.assertEquals(1, ob1Clone.countInvObjects()); - final TestGameObject ob2Clone = ob1Clone.getFirst(); - Assert.assertNotNull(ob2Clone); - Assert.assertNotSame(ob2, ob2Clone); - - Assert.assertSame(ob1, ob2.getContainer()); - Assert.assertSame(ob1Clone, ob2Clone.getContainer()); - } - -} // class GameObjectFactoryTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-02 08:17:59
|
Revision: 8577 http://gridarta.svn.sourceforge.net/gridarta/?rev=8577&view=rev Author: akirschbaum Date: 2010-07-02 08:17:52 +0000 (Fri, 02 Jul 2010) Log Message: ----------- Clean up AutojoinListsTest. Modified Paths: -------------- trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java Modified: trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java 2010-07-02 07:37:56 UTC (rev 8576) +++ trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java 2010-07-02 08:17:52 UTC (rev 8577) @@ -21,35 +21,15 @@ import java.util.ArrayList; import java.util.List; -import net.sf.gridarta.model.anim.AnimationObjects; -import net.sf.gridarta.model.anim.TestAnimationObjects; -import net.sf.gridarta.model.archetype.ArchetypeFactory; -import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.archetype.DuplicateArchetypeException; import net.sf.gridarta.model.archetype.TestArchetype; -import net.sf.gridarta.model.archetype.TestArchetypeFactory; -import net.sf.gridarta.model.archetype.TestArchetypeSet; import net.sf.gridarta.model.archetype.UndefinedArchetypeException; -import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.model.face.FaceObjectProviders; -import net.sf.gridarta.model.face.FaceObjects; -import net.sf.gridarta.model.face.TestFaceObjects; -import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.gameobject.TestGameObject; -import net.sf.gridarta.model.gameobject.TestGameObjectFactory; import net.sf.gridarta.model.maparchobject.TestMapArchObject; import net.sf.gridarta.model.mapmodel.CannotInsertGameObjectException; -import net.sf.gridarta.model.mapmodel.InsertionMode; import net.sf.gridarta.model.mapmodel.MapModel; -import net.sf.gridarta.model.mapmodel.MapModelFactory; +import net.sf.gridarta.model.mapmodel.TestMapModelCreator; import net.sf.gridarta.model.mapmodel.TestMapModelHelper; -import net.sf.gridarta.model.mapmodel.TopmostInsertionMode; -import net.sf.gridarta.model.mapviewsettings.MapViewSettings; -import net.sf.gridarta.model.mapviewsettings.TestMapViewSettings; -import net.sf.gridarta.model.match.GameObjectMatchers; -import net.sf.gridarta.utils.GUIUtils; -import net.sf.gridarta.utils.Size2D; -import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; import org.junit.Assert; import org.junit.Test; @@ -66,12 +46,12 @@ */ @Test public void testWrongCount() throws IllegalAutojoinListException { - final Creator creator = new Creator(); - creator.newAutojoinListsFail("autojoin list with less than 16 valid entries"); - creator.newAutojoinListsFail("autojoin list with less than 16 valid entries", "a0"); - creator.newAutojoinListsFail("autojoin list with less than 16 valid entries", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14"); - creator.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); - creator.newAutojoinListsFail("autojoin list with more than 16 valid entries", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15", "a16"); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(); + autojoinListsHelper.newAutojoinListsFail("autojoin list with less than 16 valid entries"); + autojoinListsHelper.newAutojoinListsFail("autojoin list with less than 16 valid entries", "a0"); + autojoinListsHelper.newAutojoinListsFail("autojoin list with less than 16 valid entries", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14"); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); + autojoinListsHelper.newAutojoinListsFail("autojoin list with more than 16 valid entries", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15", "a16"); } /** @@ -80,10 +60,10 @@ */ @Test public void testDuplicateArchetype1() throws IllegalAutojoinListException { - final Creator creator = new Creator(); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(); //Check disabled for now as Daimonin uses this feature: - //creator.newAutojoinListsFail("autojoin list contains duplicate archetype 'a0'", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a0"); - creator.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a0"); + //autojoinListsHelper.newAutojoinListsFail("autojoin list contains duplicate archetype 'a0'", "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a0"); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a0"); } /** @@ -92,9 +72,9 @@ */ @Test public void testDuplicateArchetype2() throws IllegalAutojoinListException { - final Creator creator = new Creator(); - creator.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); - creator.newAutojoinListsFail("archetype 'a4' contained in more than one autojoin list", "b0", "b1", "b2", "b3", "a4", "b5", "b6", "b7", "b8", "b9", "b10", "b11", "b12", "b13", "b14", "b15"); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); + autojoinListsHelper.newAutojoinListsFail("archetype 'a4' contained in more than one autojoin list", "b0", "b1", "b2", "b3", "a4", "b5", "b6", "b7", "b8", "b9", "b10", "b11", "b12", "b13", "b14", "b15"); } /** @@ -106,19 +86,19 @@ */ @Test public void testInsert1() throws CannotInsertGameObjectException, DuplicateArchetypeException, IllegalAutojoinListException, UndefinedArchetypeException { - final Creator creator = new Creator(); - creator.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); - final Creator2 creator2 = new Creator2(creator); - final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = creator2.newMapModel(3, 2); - final TestMapModelHelper testMapModelHelper = newTestMapModelCreator(creator); - final TestArchetype a0 = creator.archetypeSet.getArchetype("a0"); - final TestArchetype a1 = creator.archetypeSet.getArchetype("a1"); - final TestArchetype a6 = creator.archetypeSet.getArchetype("a6"); - final TestArchetype a8 = creator.archetypeSet.getArchetype("a8"); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(mapModelCreator); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(3, 2); + final TestMapModelHelper testMapModelHelper = mapModelCreator.newTestMapModelHelper(); + final TestArchetype a0 = mapModelCreator.getArchetype("a0"); + final TestArchetype a1 = mapModelCreator.getArchetype("a1"); + final TestArchetype a6 = mapModelCreator.getArchetype("a6"); + final TestArchetype a8 = mapModelCreator.getArchetype("a8"); testMapModelHelper.insertArchetype(mapModel, 1, 0, a1, false); testMapModelHelper.insertArchetype(mapModel, 0, 1, a8, false); - creator.mapViewSettings.setAutojoin(true); + mapModelCreator.getMapViewSettings().setAutojoin(true); // insert using autojoin testMapModelHelper.insertArchetype(mapModel, 1, 1, a0, true); @@ -138,7 +118,7 @@ TestMapModelHelper.checkMapContents(mapModel, "|a5|", "a10|a11|a8"); // insert using autojoin but disabled autojoin globally - creator.mapViewSettings.setAutojoin(false); + mapModelCreator.getMapViewSettings().setAutojoin(false); testMapModelHelper.insertArchetype(mapModel, 2, 0, a6, true); TestMapModelHelper.checkMapContents(mapModel, "|a5|a6", "a10|a11|a8"); } @@ -152,97 +132,67 @@ */ @Test public void testRemove1() throws CannotInsertGameObjectException, DuplicateArchetypeException, IllegalAutojoinListException, UndefinedArchetypeException { - final Creator creator = new Creator(); - creator.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); - final Creator2 creator2 = new Creator2(creator); - final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = creator2.newMapModel(3, 2); - final TestMapModelHelper testMapModelHelper = newTestMapModelCreator(creator); - final TestArchetype a4 = creator.archetypeSet.getArchetype("a4"); - final TestArchetype a8 = creator.archetypeSet.getArchetype("a8"); - final TestArchetype a10 = creator.archetypeSet.getArchetype("a10"); - final TestArchetype a11 = creator.archetypeSet.getArchetype("a11"); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(mapModelCreator); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(3, 2); + final TestMapModelHelper testMapModelHelper = mapModelCreator.newTestMapModelHelper(); + final TestArchetype a4 = mapModelCreator.getArchetype("a4"); + final TestArchetype a8 = mapModelCreator.getArchetype("a8"); + final TestArchetype a10 = mapModelCreator.getArchetype("a10"); + final TestArchetype a11 = mapModelCreator.getArchetype("a11"); final TestGameObject g10 = testMapModelHelper.insertArchetype(mapModel, 1, 0, a4, false); final TestGameObject g01 = testMapModelHelper.insertArchetype(mapModel, 0, 1, a10, false); testMapModelHelper.insertArchetype(mapModel, 1, 1, a11, false); final TestGameObject g21 = testMapModelHelper.insertArchetype(mapModel, 2, 1, a8, false); // remove using autojoin - creator.mapViewSettings.setAutojoin(true); + mapModelCreator.getMapViewSettings().setAutojoin(true); mapModel.removeGameObject(g21, true); TestMapModelHelper.checkMapContents(mapModel, "|a4|", "a10|a9|"); // remove using autojoin but globally disabled - creator.mapViewSettings.setAutojoin(false); + mapModelCreator.getMapViewSettings().setAutojoin(false); mapModel.removeGameObject(g10, true); TestMapModelHelper.checkMapContents(mapModel, "||", "a10|a9|"); // remove using autojoin - creator.mapViewSettings.setAutojoin(true); + mapModelCreator.getMapViewSettings().setAutojoin(true); mapModel.removeGameObject(g01, true); TestMapModelHelper.checkMapContents(mapModel, "||", "|a1|"); } /** - * Creates a new {@link TestMapModelHelper} instance. - * @param creator the creator to use - * @return the new test map model creator instance - * @throws DuplicateArchetypeException if an internal error occurs + * Implements {@link AutojoinList} related functions. */ - @NotNull - private static TestMapModelHelper newTestMapModelCreator(@NotNull final Creator creator) throws DuplicateArchetypeException { - final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(creator.faceObjectProviders, creator.animationObjects); - final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode = new TopmostInsertionMode<TestGameObject, TestMapArchObject, TestArchetype>(); - return new TestMapModelHelper(topmostInsertionMode, gameObjectFactory, creator.archetypeSet, creator.faceObjectProviders, creator.animationObjects); - } + private static class AutojoinListsHelper { - /** - * Creator for {@link AutojoinList} instances. - */ - private static class Creator { - /** - * The {@link AutojoinLists} instance. + * The {@link TestMapModelCreator} instance. */ @NotNull - private final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists; + private final TestMapModelCreator mapModelCreator; /** - * The {@link FaceObjectProviders} instance. + * The {@link AutojoinLists} instance. */ @NotNull - private final FaceObjectProviders faceObjectProviders; + private final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists; /** - * The {@link AnimationObjects} instance. + * Creates a new instance. */ - @NotNull - private final AnimationObjects<TestGameObject, TestMapArchObject, TestArchetype> animationObjects; + private AutojoinListsHelper() { + this(new TestMapModelCreator(false)); + } /** - * The {@link MapViewSettings} instance. - */ - @NotNull - private final MapViewSettings mapViewSettings; - - /** - * The {@link ArchetypeSet} instance. - */ - @NotNull - private final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet; - - /** * Creates a new instance. + * @param mapModelCreator the map model creator instance */ - private Creator() { - final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory = new TestArchetypeFactory(); - final GUIUtils guiUtils = new GUIUtils(); - final SystemIcons systemIcons = new SystemIcons(guiUtils); - final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); - faceObjectProviders = new FaceObjectProviders(1, faceObjects, systemIcons); - archetypeSet = new TestArchetypeSet(archetypeFactory, "arch", faceObjectProviders); - animationObjects = new TestAnimationObjects(); - mapViewSettings = new TestMapViewSettings(); - autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); + private AutojoinListsHelper(@NotNull final TestMapModelCreator mapModelCreator) { + this.mapModelCreator = mapModelCreator; + autojoinLists = mapModelCreator.getAutojoinLists(); } /** @@ -254,7 +204,7 @@ public void newAutojoinLists(@NotNull final String... archetypeNames) throws IllegalAutojoinListException { final List<TestArchetype> archetypes = new ArrayList<TestArchetype>(); for (final String archetypeName : archetypeNames) { - archetypes.add(getArchetype(archetypeName)); + archetypes.add(mapModelCreator.getArchetype(archetypeName)); } autojoinLists.addAutojoinList(new AutojoinList<TestGameObject, TestMapArchObject, TestArchetype>(archetypes)); } @@ -273,63 +223,6 @@ } } - /** - * Returns or creates an archetype by name. - * @param archetypeName the archetype name - * @return the archetype - */ - @NotNull - private TestArchetype getArchetype(@NotNull final String archetypeName) { - try { - return archetypeSet.getArchetype(archetypeName); - } catch (final UndefinedArchetypeException ignored) { - final TestArchetype archetype = new TestArchetype(archetypeName, faceObjectProviders, animationObjects); - try { - archetypeSet.addArchetype(archetype); - } catch (final DuplicateArchetypeException ex) { - Assert.fail(ex.getMessage()); - } - return archetype; - } - } - } - /** - * Creator for {@link MapModel} instances. - */ - private static class Creator2 { - - /** - * The {@link MapModelFactory} for creating {@link MapModel} instances. - */ - @NotNull - private final MapModelFactory<TestGameObject, TestMapArchObject, TestArchetype> mapModelFactory; - - /** - * Creates a new instance. - * @param creator the creator to use - */ - private Creator2(@NotNull final Creator creator) { - final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); - final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(creator.faceObjectProviders, creator.animationObjects); - final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); - final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode = new TopmostInsertionMode<TestGameObject, TestMapArchObject, TestArchetype>(); - mapModelFactory = new MapModelFactory<TestGameObject, TestMapArchObject, TestArchetype>(archetypeChooserModel, creator.autojoinLists, creator.mapViewSettings, gameObjectFactory, gameObjectMatchers, topmostInsertionMode); - } - - /** - * Creates a new {@link MapModel} instance. - * @param width the map width in squares - * @param height the map height in squares - * @return the map model instance - */ - @NotNull - public MapModel<TestGameObject, TestMapArchObject, TestArchetype> newMapModel(final int width, final int height) { - final TestMapArchObject mapArchObject = new TestMapArchObject(); - mapArchObject.setMapSize(new Size2D(width, height)); - return mapModelFactory.newMapModel(mapArchObject); - } - } - } // class AutojoinListsTest Modified: trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java 2010-07-02 07:37:56 UTC (rev 8576) +++ trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java 2010-07-02 08:17:52 UTC (rev 8577) @@ -45,9 +45,9 @@ */ @Test public void testDoMoveSquareTopSingle() throws CannotInsertGameObjectException, DuplicateArchetypeException { - final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final TestMapModelHelper mapModelHelper = mapModelCreator.newMapModelCreator(); - final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(1, 1); final Point point = new Point(0, 0); mapModel.beginTransaction("TEST"); Modified: trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java 2010-07-02 07:37:56 UTC (rev 8576) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/DefaultMapModelTest.java 2010-07-02 08:17:52 UTC (rev 8577) @@ -143,7 +143,7 @@ */ @Test public void testEmpty() { - final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); mapModel.beginTransaction("TEST"); @@ -157,7 +157,7 @@ */ @Test public void testResizeMap1() { - final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); mapModel.beginTransaction("TEST"); @@ -172,7 +172,7 @@ */ @Test public void testResizeMap2() { - final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); mapModel.beginTransaction("TEST"); @@ -192,7 +192,7 @@ */ @Test public void testResizeMap3() { - final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); mapModel.beginTransaction("TEST"); @@ -214,7 +214,7 @@ */ @Test public void testResizeMap4() { - final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); mapModel.beginTransaction("TEST"); @@ -239,7 +239,7 @@ */ @Test public void testAddGameObjectToMap1() { - final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); mapModel.beginTransaction("TEST"); @@ -259,7 +259,7 @@ */ @Test public void testAddGameObjectToMap2() { - final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); mapModel.beginTransaction("TEST"); @@ -280,7 +280,7 @@ */ @Test public void testModifiedGameObject1() { - final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); mapModel.beginTransaction("TEST"); @@ -302,7 +302,7 @@ */ @Test public void testModifiedGameObject2() { - final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); mapModel.beginTransaction("TEST"); @@ -325,7 +325,7 @@ */ @Test public void testGetAllGameObjects1() { - final TestMapModelCreator mapModelCreator = new TestMapModelCreator(); + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = newMapModel(mapModelCreator); final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, TestArchetype> archetype = mapModelCreator.getArchetype("arch"); final TestArchetype archetype2 = mapModelCreator.getArchetype("arch2"); @@ -382,7 +382,7 @@ */ @NotNull public MapModel<TestGameObject, TestMapArchObject, TestArchetype> newMapModel(@NotNull final TestMapModelCreator mapModelCreator) { - final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(1, 1); result.setLength(0); mapModel.addMapModelListener(mapModelListener); Modified: trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java 2010-07-02 07:37:56 UTC (rev 8576) +++ trunk/model/src/test/net/sf/gridarta/model/mapmodel/TestMapModelCreator.java 2010-07-02 08:17:52 UTC (rev 8577) @@ -47,6 +47,7 @@ import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.TypeNrsGameObjectMatcher; import net.sf.gridarta.utils.GUIUtils; +import net.sf.gridarta.utils.Size2D; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; import org.junit.Assert; @@ -70,6 +71,12 @@ private static final String[] ICON_NAMES = { SystemIcons.SQUARE_SELECTED_SQUARE, SystemIcons.SQUARE_SELECTED_SQUARE_NORTH, SystemIcons.SQUARE_SELECTED_SQUARE_EAST, SystemIcons.SQUARE_SELECTED_SQUARE_SOUTH, SystemIcons.SQUARE_SELECTED_SQUARE_WEST, SystemIcons.SQUARE_PRE_SELECTED_SQUARE, SystemIcons.SQUARE_CURSOR, SystemIcons.SQUARE_EMPTY, SystemIcons.SQUARE_UNKNOWN, SystemIcons.SQUARE_NO_FACE, SystemIcons.SQUARE_NO_ARCH, SystemIcons.DEFAULT_ICON, SystemIcons.DEFAULT_PREVIEW, SystemIcons.SQUARE_WARNING, }; /** + * The {@link MapViewSettings} instance. + */ + @NotNull + private final MapViewSettings mapViewSettings = new TestMapViewSettings(); + + /** * The {@link FaceObjectProviders} instance. */ @NotNull @@ -119,14 +126,16 @@ /** * Creates a new instance. + * @param createIcons whether to create icon instances */ - public TestMapModelCreator() { - final MapViewSettings mapViewSettings = new TestMapViewSettings(); + public TestMapModelCreator(final boolean createIcons) { autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); final GUIUtils guiUtils = new GUIUtils(); - final ImageIcon imageIcon = new ImageIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB)); - for (final String iconName : ICON_NAMES) { - guiUtils.addToCache(iconName, imageIcon); + if (createIcons) { + final ImageIcon imageIcon = new ImageIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_RGB)); + for (final String iconName : ICON_NAMES) { + guiUtils.addToCache(iconName, imageIcon); + } } final SystemIcons systemIcons = new SystemIcons(guiUtils); final FaceObjects<TestGameObject, TestMapArchObject, TestArchetype> faceObjects = new TestFaceObjects(); @@ -141,11 +150,14 @@ /** * Creates a new {@link MapModel} instance. + * @param w the width in squares + * @param h the height in squares * @return the new map model instance */ @NotNull - public MapModel<TestGameObject, TestMapArchObject, TestArchetype> newMapModel() { + public MapModel<TestGameObject, TestMapArchObject, TestArchetype> newMapModel(final int w, final int h) { final TestMapArchObject mapArchObject = new TestMapArchObject(); + mapArchObject.setMapSize(new Size2D(w, h)); return new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(autojoinLists, mapArchObject, archetypeChooserModel, 0, gameObjectFactory, gameObjectMatchers, topmostInsertionMode); } @@ -234,4 +246,32 @@ return new TestMapModelHelper(topmostInsertionMode, gameObjectFactory, archetypeSet, faceObjectProviders, animationObjects); } + /** + * Returns the {@link MapViewSettings} instance. + * @return the map view settings instance + */ + @NotNull + public MapViewSettings getMapViewSettings() { + return mapViewSettings; + } + + /** + * Creates a new {@link TestMapModelHelper} instance. + * @return the new test map model creator instance + * @throws DuplicateArchetypeException if an internal error occurs + */ + @NotNull + public TestMapModelHelper newTestMapModelHelper() throws DuplicateArchetypeException { + return new TestMapModelHelper(topmostInsertionMode, gameObjectFactory, archetypeSet, faceObjectProviders, animationObjects); + } + + /** + * Returns the {@link AutojoinLists} instance. + * @return the autojoin lists instance + */ + @NotNull + public AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> getAutojoinLists() { + return autojoinLists; + } + } // class TestMapModelCreator Modified: trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java 2010-07-02 07:37:56 UTC (rev 8576) +++ trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java 2010-07-02 08:17:52 UTC (rev 8577) @@ -323,15 +323,6 @@ } /** - * Returns the {@link GameObjectFactory} instance. - * @return the game object factory - */ - @NotNull - public GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> getGameObjectFactory() { - return gameObjectFactory; - } - - /** * Creates a new {@link MapViewsManager} instance. * @return the map views manager instance */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-03 09:55:30
|
Revision: 8579 http://gridarta.svn.sourceforge.net/gridarta/?rev=8579&view=rev Author: akirschbaum Date: 2010-07-03 09:55:23 +0000 (Sat, 03 Jul 2010) Log Message: ----------- Implement #1726046 (Window handling): autojoining now supports alternative archetypes (such as windowed wall or weak walls). Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java Added Paths: ----------- trunk/model/src/app/net/sf/gridarta/model/autojoin/InsertionResult.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-07-03 09:51:14 UTC (rev 8578) +++ trunk/atrinik/ChangeLog 2010-07-03 09:55:23 UTC (rev 8579) @@ -1,3 +1,8 @@ +2010-07-03 Andreas Kirschbaum + + * Implement #1726046 (Window handling): autojoining now supports + alternative archetypes (such as windowed wall or weak walls). + 2010-06-27 Andreas Kirschbaum * Improve --script command-line option to report plugin script Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-07-03 09:51:14 UTC (rev 8578) +++ trunk/crossfire/ChangeLog 2010-07-03 09:55:23 UTC (rev 8579) @@ -1,3 +1,8 @@ +2010-07-03 Andreas Kirschbaum + + * Implement #1726046 (Window handling): autojoining now supports + alternative archetypes (such as windowed wall or weak walls). + 2010-06-27 Andreas Kirschbaum * Improve --script command-line option to report plugin script Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-07-03 09:51:14 UTC (rev 8578) +++ trunk/daimonin/ChangeLog 2010-07-03 09:55:23 UTC (rev 8579) @@ -1,3 +1,8 @@ +2010-07-03 Andreas Kirschbaum + + * Implement #1726046 (Window handling): autojoining now supports + alternative archetypes (such as windowed wall or weak walls). + 2010-06-27 Andreas Kirschbaum * Improve --script command-line option to report plugin script Modified: trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java 2010-07-03 09:51:14 UTC (rev 8578) +++ trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinList.java 2010-07-03 09:55:23 UTC (rev 8579) @@ -21,7 +21,10 @@ import java.io.Serializable; import java.util.ArrayList; +import java.util.Collections; +import java.util.IdentityHashMap; import java.util.List; +import java.util.Map; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; @@ -62,13 +65,22 @@ public static final int WEST = 8; - // the arches' node numbers, interpreted in following order (0-15): - //index: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 - //means: 0, N, E, NE, S, NS, ES, NES, W, WN, WE, WNE, SW, SWN, ESW, NESW - // (0 = no connection, N = north, E = east, S = south, W = west) - + /** + * Maps index to list of archetypes representing autojoin-able archetypes + * for this direction. The first archetype is the main archetype that can be + * converted into other archetypes. Following archetypes are alternative + * variants that are recognized but never converted. Examples for + * alternative archetypes are walls having windows. + * <p/> + * The indices are interpreted in following order (0-15): + * <ol> + * <li>index: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15</li> + * <li>means: 0, N, E, NE, S, NS, ES, NES, W, WN, WE, WNE, SW, SWN, ESW, NESW</li> + * <li>(0 = no connection, N = north, E = east, S = south, W = west)</li> + * </ol> + */ @NotNull - private final List<R> archetypes; + private final List<List<R>> archetypes; /** * Create an AutojoinList. @@ -76,28 +88,50 @@ * @throws IllegalAutojoinListException if the autojoin list cannot be * created */ - public AutojoinList(@NotNull final List<R> archetypes) throws IllegalAutojoinListException { - final ArrayList<R> newArchetypes = new ArrayList<R>(archetypes); + public AutojoinList(@NotNull final Iterable<List<R>> archetypes) throws IllegalAutojoinListException { + final ArrayList<List<R>> newArchetypes = new ArrayList<List<R>>(); + + for (final List<R> archetypeList : archetypes) { + newArchetypes.add(validate(archetypeList)); + } + if (newArchetypes.size() > SIZE) { throw new IllegalAutojoinListException("autojoin list with more than " + SIZE + " valid entries"); } else if (newArchetypes.size() < SIZE) { throw new IllegalAutojoinListException("autojoin list with less than " + SIZE + " valid entries"); } - //final Map<R, R> tmp = new IdentityHashMap<R, R>(); - for (final R archetype : newArchetypes) { + newArchetypes.trimToSize(); + this.archetypes = newArchetypes; + } + + /** + * Validates a list of archetypes: no entry must be <null>, no duplicate + * entry must exist, at least one entry must exist. + * @param archetypeList the archetype list to validate + * @return a copy of the validated archetype list + * @throws IllegalAutojoinListException if a validation error was detected + */ + @NotNull + private static <R extends Archetype<?, ?, R>> List<R> validate(@NotNull final Iterable<R> archetypeList) throws IllegalAutojoinListException { + final ArrayList<R> result = new ArrayList<R>(); + final Map<R, R> tmp = new IdentityHashMap<R, R>(); + for (final R archetype : archetypeList) { if (archetype == null) { throw new IllegalArgumentException(); } - // Must not check for duplicate archetypes as Daimonin uses this. - //if (tmp.put(archetype, archetype) != null) { - // throw new IllegalAutojoinListException("autojoin list contains duplicate archetype '" + archetype.getArchetypeName() + "'"); - //} + if (tmp.put(archetype, archetype) != null) { + throw new IllegalAutojoinListException("autojoin list contains duplicate archetype '" + archetype.getArchetypeName() + "'"); + } + + result.add(archetype); } - - newArchetypes.trimToSize(); - this.archetypes = newArchetypes; + if (result.isEmpty()) { + throw new IllegalAutojoinListException("autojoin list is empty"); + } + result.trimToSize(); + return result; } /** @@ -105,9 +139,9 @@ * @param archetype node to lookup * @return index of the node in the array. */ - public int getIndex(@NotNull final Archetype<G, A, R> archetype) { + public int getIndex(@NotNull final R archetype) { for (int i = 0; i < SIZE; i++) { - if (archetypes.get(i) == archetype) { + if (archetypes.get(i).contains(archetype)) { return i; } } @@ -117,11 +151,54 @@ } /** + * Returns the index of an {@link Archetype} if it is a main archetype for + * any direction. + * @param archetype the archetype to check + * @return whether the archetype is a main archetype + */ + public boolean isMainIndex(@NotNull final R archetype) { + for (int i = 0; i < SIZE; i++) { + if (archetypes.get(i).get(0) == archetype) { + return true; + } + } + + return false; + } + + /** + * Returns the index of an {@link Archetype} if it is an alternative + * archetype for any direction. + * @param archetype the archetype to check + * @return the direction or <code>-1</code> + */ + public int getAlternativeIndex(@NotNull final R archetype) { + for (int i = 0; i < SIZE; i++) { + final List<R> tmp = archetypes.get(i); + if (tmp.get(0) != archetype && tmp.contains(archetype)) { + return i; + } + } + + return -1; + } + + /** * @noinspection TypeMayBeWeakened */ @NotNull public R getArchetype(final int index) { - return archetypes.get(index); + return archetypes.get(index).get(0); } + /** + * Returns all archetypes for an index. + * @param index the index + * @return the archetypes; the result contains at least one entry + */ + @NotNull + public Iterable<R> getArchetypes(final int index) { + return Collections.unmodifiableCollection(archetypes.get(index)); + } + } // class AutojoinList Modified: trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java 2010-07-03 09:51:14 UTC (rev 8578) +++ trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinLists.java 2010-07-03 09:55:23 UTC (rev 8579) @@ -75,7 +75,9 @@ } for (int i = 0; i < AutojoinList.SIZE; i++) { - autojoinLists.put(autojoinList.getArchetype(i), autojoinList); + for (final R archetype : autojoinList.getArchetypes(i)) { + autojoinLists.put(archetype, autojoinList); + } } } @@ -88,39 +90,66 @@ * @param point Location of the insert point on the map * @param archetype the archetype to connect with * @param mapModel Data model of the map - * @return the archetype to be inserted at point, or <code>null</code> if - * there's already an arch of this list on point + * @return the insertion result */ - @Nullable - public R joinInsert(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final R archetype) { + @NotNull + public InsertionResult<G, A, R> joinInsert(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final R archetype) { if (!mapViewSettings.isAutojoin()) { - return archetype; + return new InsertionResult<G, A, R>(null, archetype); } if (archetype.isMulti()) { - return archetype; + return new InsertionResult<G, A, R>(null, archetype); } final AutojoinList<G, A, R> autojoinList = autojoinLists.get(archetype); if (autojoinList == null) { - return archetype; + return new InsertionResult<G, A, R>(null, archetype); } // if there already is an arch of this list at point -> abort - if (findGameObjectOfAutojoinList(mapModel, point, autojoinList) != null) { - return null; // we don't want same arches over each other + final boolean isMainIndex = autojoinList.isMainIndex(archetype); + final G gameObject = findGameObjectOfAutojoinList(mapModel, point, autojoinList); + if (gameObject != null) { + final R gameObjectArchetype = gameObject.getArchetype(); + final boolean isExistingMainIndex = autojoinList.isMainIndex(gameObjectArchetype); + if (isMainIndex) { + // alt/main -> main + if (isExistingMainIndex) { + // ignore main -> main + return new InsertionResult<G, A, R>(null, null); // we don't want same archetypes over each other + } else { + // alt -> main -> update + } + } else { + // alt/main -> alt + if (isExistingMainIndex) { + // main -> alt -> update + } else { + // alt -> alt -> update if different archetype + if (gameObjectArchetype == archetype) { + return new InsertionResult<G, A, R>(null, null); // we don't want same archetypes over each other + } + } + } } // now do the joining in all four directions: + final int altIndex = isMainIndex ? -1 : autojoinList.getAlternativeIndex(archetype); int newIndex = 0; // return value, see above - newIndex |= joinInsert(mapModel, point, autojoinList, 0, -1, AutojoinList.NORTH, AutojoinList.SOUTH); - newIndex |= joinInsert(mapModel, point, autojoinList, +1, 0, AutojoinList.EAST, AutojoinList.WEST); - newIndex |= joinInsert(mapModel, point, autojoinList, 0, +1, AutojoinList.SOUTH, AutojoinList.NORTH); - newIndex |= joinInsert(mapModel, point, autojoinList, -1, 0, AutojoinList.WEST, AutojoinList.EAST); - return autojoinList.getArchetype(newIndex); + newIndex |= joinInsert(mapModel, point, autojoinList, 0, -1, AutojoinList.NORTH, AutojoinList.SOUTH, altIndex); + newIndex |= joinInsert(mapModel, point, autojoinList, +1, 0, AutojoinList.EAST, AutojoinList.WEST, altIndex); + newIndex |= joinInsert(mapModel, point, autojoinList, 0, +1, AutojoinList.SOUTH, AutojoinList.NORTH, altIndex); + newIndex |= joinInsert(mapModel, point, autojoinList, -1, 0, AutojoinList.WEST, AutojoinList.EAST, altIndex); + final R newArchetype = isMainIndex ? autojoinList.getArchetype(newIndex) : archetype; + if (gameObject != null) { + gameObject.setArchetype(newArchetype); + return new InsertionResult<G, A, R>(gameObject, null); + } + return new InsertionResult<G, A, R>(null, newArchetype); } - private int joinInsert(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final AutojoinList<G, A, R> autojoinList, final int dx, final int dy, final int dir, final int reverseDir) { + private int joinInsert(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final AutojoinList<G, A, R> autojoinList, final int dx, final int dy, final int dir, final int reverseDir, final int altIndex) { final Point tmp = new Point(point.x + dx, point.y + dy); if (!mapModel.getMapArchObject().isPointValid(tmp)) { return 0; @@ -131,7 +160,20 @@ return 0; } - gameObject.setArchetype(autojoinList.getArchetype(autojoinList.getIndex(gameObject.getArchetype()) | reverseDir)); + final R archetype = gameObject.getArchetype(); + final int index = autojoinList.getAlternativeIndex(archetype); + if (index != -1) { + return (index & reverseDir) == 0 ? 0 : dir; + } + + final int archetypeIndex = autojoinList.getIndex(archetype); + final int newIndex; + if ((altIndex & dir) == 0) { + newIndex = archetypeIndex & ~reverseDir; + } else { + newIndex = archetypeIndex | reverseDir; + } + gameObject.setArchetype(autojoinList.getArchetype(newIndex)); return dir; } @@ -144,7 +186,7 @@ * @param archetype the archetype to connect with * @param mapModel Data model of the map */ - public void joinDelete(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final Archetype<G, A, R> archetype) { + public void joinDelete(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final R archetype) { if (!mapViewSettings.isAutojoin()) { return; } @@ -158,19 +200,26 @@ return; } - joinDelete(mapModel, point, autojoinList, 0, -1, AutojoinList.SOUTH); - joinDelete(mapModel, point, autojoinList, +1, 0, AutojoinList.WEST); - joinDelete(mapModel, point, autojoinList, 0, +1, AutojoinList.NORTH); - joinDelete(mapModel, point, autojoinList, -1, 0, AutojoinList.EAST); + final boolean isMainIndex = autojoinList.isMainIndex(archetype); + final int altIndex = isMainIndex ? -1 : autojoinList.getAlternativeIndex(archetype); + + joinDelete(mapModel, point, autojoinList, 0, -1, AutojoinList.NORTH, AutojoinList.SOUTH, altIndex); + joinDelete(mapModel, point, autojoinList, +1, 0, AutojoinList.EAST, AutojoinList.WEST, altIndex); + joinDelete(mapModel, point, autojoinList, 0, +1, AutojoinList.SOUTH, AutojoinList.NORTH, altIndex); + joinDelete(mapModel, point, autojoinList, -1, 0, AutojoinList.WEST, AutojoinList.EAST, altIndex); } - private void joinDelete(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final AutojoinList<G, A, R> autojoinList, final int dx, final int dy, final int dir) { + private void joinDelete(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final AutojoinList<G, A, R> autojoinList, final int dx, final int dy, final int reverseDir, final int dir, final int altIndex) { + if ((altIndex & reverseDir) == 0) { + return; + } + final Point tmp = new Point(point.x + dx, point.y + dy); if (!mapModel.getMapArchObject().isPointValid(tmp)) { return; } - final GameObject<G, A, R> gameObject = findGameObjectOfAutojoinList(mapModel, tmp, autojoinList); + final GameObject<G, A, R> gameObject = findMainGameObjectOfAutojoinList(mapModel, tmp, autojoinList); if (gameObject == null) { return; } @@ -187,9 +236,9 @@ * @return arch which is part of this join-list, null if no such arch exists */ @Nullable - private GameObject<G, A, R> findGameObjectOfAutojoinList(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final AutojoinList<G, A, R> autojoinList) { + private G findGameObjectOfAutojoinList(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final AutojoinList<G, A, R> autojoinList) { // we look through the arches at the given location (top to bottom): - for (final GameObject<G, A, R> gameObject : mapModel.getMapSquare(point).reverse()) { + for (final G gameObject : mapModel.getMapSquare(point).reverse()) { if (autojoinLists.get(gameObject.getArchetype()) == autojoinList) { return gameObject; // we found an arch } @@ -198,4 +247,25 @@ return null; // nothing found } + /** + * Looks for an arch at map-position point which is the main archetypes part + * of an autojoin list. + * @param mapModel the map model to search + * @param point location to search + * @param autojoinList the autojoin list + * @return arch which is part of this join-list, null if no such arch exists + */ + @Nullable + private GameObject<G, A, R> findMainGameObjectOfAutojoinList(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point point, @NotNull final AutojoinList<G, A, R> autojoinList) { + // we look through the arches at the given location (top to bottom): + for (final GameObject<G, A, R> gameObject : mapModel.getMapSquare(point).reverse()) { + final R archetype = gameObject.getArchetype(); + if (autojoinLists.get(archetype) == autojoinList && autojoinList.isMainIndex(archetype)) { + return gameObject; // we found an arch + } + } + + return null; // nothing found + } + } // class AutojoinLists Modified: trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java 2010-07-03 09:51:14 UTC (rev 8578) +++ trunk/model/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java 2010-07-03 09:55:23 UTC (rev 8579) @@ -36,6 +36,7 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.maparchobject.MapArchObject; import net.sf.gridarta.utils.IOUtils; +import net.sf.gridarta.utils.StringUtils; import org.jetbrains.annotations.NotNull; /** @@ -119,7 +120,7 @@ */ private void loadList(@NotNull final URL url, @NotNull final BufferedReader bufferedReader) throws IOException { boolean sectionFlag = false; // true while section (start ... end) read; XXX: replace flag with control flow - final List<R> archetypes = new ArrayList<R>(AutojoinList.SIZE); + final List<List<R>> archetypes = new ArrayList<List<R>>(AutojoinList.SIZE); final StringBuilder undefinedArchetypes = new StringBuilder(); boolean skipList = true; while (true) { @@ -146,18 +147,22 @@ } sectionFlag = false; } else { - try { - final R archetype = archetypeSet.getArchetype(line); - if (archetype.isMulti()) { - errorView.addWarning(ErrorViewCategory.AUTOJOIN_ENTRY_INVALID, url + ": list contains multi-part game object: archetype '" + line + "'"); + final List<R> tmp = new ArrayList<R>(); + for (final String archetypeName : StringUtils.PATTERN_WHITESPACE.split(line)) { + try { + final R archetype = archetypeSet.getArchetype(archetypeName); + if (archetype.isMulti()) { + errorView.addWarning(ErrorViewCategory.AUTOJOIN_ENTRY_INVALID, url + ": list contains multi-part game object: archetype '" + line + "'"); + skipList = true; + } else { + tmp.add(archetype); + } + } catch (final UndefinedArchetypeException ex) { + undefinedArchetypes.append(' ').append(ex.getMessage()); skipList = true; - } else { - archetypes.add(archetype); } - } catch (final UndefinedArchetypeException ex) { - undefinedArchetypes.append(' ').append(ex.getMessage()); - skipList = true; } + archetypes.add(tmp); } } else { // we are outside a section Added: trunk/model/src/app/net/sf/gridarta/model/autojoin/InsertionResult.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/autojoin/InsertionResult.java (rev 0) +++ trunk/model/src/app/net/sf/gridarta/model/autojoin/InsertionResult.java 2010-07-03 09:55:23 UTC (rev 8579) @@ -0,0 +1,90 @@ +/* + * 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.autojoin; + +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.maparchobject.MapArchObject; +import org.jetbrains.annotations.Nullable; + +/** + * The result of an insertion operation involving autojoining. The result can be + * one of: + * <ol> + * <li>a new archetype should be inserted</li> + * <li>an existing game object has been modified</li> + * <li>the operation failed; nothing has been modified or should be + * inserted</li> + * </ol> + * @author Andreas Kirschbaum + */ +public class InsertionResult<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * The {@link GameObject} that has been modified. Set to <code>null</code> + * if no game object has been modified. + */ + @Nullable + private final G gameObject; + + /** + * The {@link Archetype} that should be inserted. Set to <code>null</code> + * if no archetype should be inserted. + */ + @Nullable + private final R archetype; + + /** + * Creates a new instance. + * @param gameObject the game object that has been modified or + * <code>null</code> if no game object has been modified + * @param archetype the archetype that should be inserted or + * <code>null</code> if no archetype should be inserted + */ + public InsertionResult(@Nullable final G gameObject, @Nullable final R archetype) { + if (gameObject != null && archetype != null) { + throw new IllegalArgumentException(); + } + + this.gameObject = gameObject; + this.archetype = archetype; + } + + /** + * Returns the {@link GameObject} that has been modified. + * @return the game object that has been modified or <code>null</code> if no + * game object has been modified + */ + @Nullable + public G getGameObject() { + return gameObject; + } + + /** + * Returns the {@link Archetype} that should be inserted. + * @return the archetype that should be inserted or <code>null</code> if no + * archetype should be inserted + */ + @Nullable + public R getArchetype() { + return archetype; + } + +} // class InsertionResult Property changes on: trunk/model/src/app/net/sf/gridarta/model/autojoin/InsertionResult.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2010-07-03 09:51:14 UTC (rev 8578) +++ trunk/model/src/app/net/sf/gridarta/model/mapmodel/DefaultMapModel.java 2010-07-03 09:55:23 UTC (rev 8579) @@ -31,6 +31,7 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.autojoin.AutojoinLists; +import net.sf.gridarta.model.autojoin.InsertionResult; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.baseobject.GameObjectContainer; import net.sf.gridarta.model.gameobject.GameObject; @@ -764,7 +765,13 @@ final R realArchetype = baseObject.getArchetype(); final R effectiveArchetype; if (join) { - effectiveArchetype = autojoinLists.joinInsert(this, pos, realArchetype); + final InsertionResult<G, A, R> insertionResult = autojoinLists.joinInsert(this, pos, realArchetype); + final G gameObject = insertionResult.getGameObject(); + if (gameObject != null) { + return gameObject; + } + + effectiveArchetype = insertionResult.getArchetype(); if (effectiveArchetype == null) { return null; // only one autojoin type per square allowed } Modified: trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java 2010-07-03 09:51:14 UTC (rev 8578) +++ trunk/model/src/test/net/sf/gridarta/model/autojoin/AutojoinListsTest.java 2010-07-03 09:55:23 UTC (rev 8579) @@ -75,6 +75,8 @@ final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(); autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", "a8", "a9", "a10", "a11", "a12", "a13", "a14", "a15"); autojoinListsHelper.newAutojoinListsFail("archetype 'a4' contained in more than one autojoin list", "b0", "b1", "b2", "b3", "a4", "b5", "b6", "b7", "b8", "b9", "b10", "b11", "b12", "b13", "b14", "b15"); + autojoinListsHelper.newAutojoinListsFail("autojoin list contains duplicate archetype 'c0'", "c0|c1|c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8", "c9", "c10", "c11", "c12", "c13", "c14", "c15"); + autojoinListsHelper.newAutojoinListsFail("autojoin list is empty", "d0", "d1", "d2", "", "d4", "d5", "d6", "d7", "d8", "d9", "d10", "d11", "d12", "d13", "d14", "d15"); } /** @@ -95,6 +97,7 @@ final TestArchetype a1 = mapModelCreator.getArchetype("a1"); final TestArchetype a6 = mapModelCreator.getArchetype("a6"); final TestArchetype a8 = mapModelCreator.getArchetype("a8"); + mapModel.beginTransaction("TEST"); testMapModelHelper.insertArchetype(mapModel, 1, 0, a1, false); testMapModelHelper.insertArchetype(mapModel, 0, 1, a8, false); @@ -141,6 +144,7 @@ final TestArchetype a8 = mapModelCreator.getArchetype("a8"); final TestArchetype a10 = mapModelCreator.getArchetype("a10"); final TestArchetype a11 = mapModelCreator.getArchetype("a11"); + mapModel.beginTransaction("TEST"); final TestGameObject g10 = testMapModelHelper.insertArchetype(mapModel, 1, 0, a4, false); final TestGameObject g01 = testMapModelHelper.insertArchetype(mapModel, 0, 1, a10, false); testMapModelHelper.insertArchetype(mapModel, 1, 1, a11, false); @@ -163,6 +167,293 @@ } /** + * Checks that inserting alternative archetypes with autojoin works as + * expected. + * @throws IllegalAutojoinListException if the test fails + * @throws DuplicateArchetypeException if the test fails + * @throws UndefinedArchetypeException if the test fails + * @throws CannotInsertGameObjectException if the test fails + */ + @Test + public void testInsertAlt1() throws CannotInsertGameObjectException, DuplicateArchetypeException, IllegalAutojoinListException, UndefinedArchetypeException { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(mapModelCreator); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5|b5", "a6", "a7", "a8", "a9", "a10|b10", "a11", "a12", "a13", "a14", "a15"); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(3, 2); + final TestMapModelHelper testMapModelHelper = mapModelCreator.newTestMapModelHelper(); + final TestArchetype a0 = mapModelCreator.getArchetype("a0"); + final TestArchetype a3 = mapModelCreator.getArchetype("a3"); + final TestArchetype a8 = mapModelCreator.getArchetype("a8"); + final TestArchetype b5 = mapModelCreator.getArchetype("b5"); + final TestArchetype b10 = mapModelCreator.getArchetype("b10"); + mapModel.beginTransaction("TEST"); + testMapModelHelper.insertArchetype(mapModel, 0, 0, b5, false); + testMapModelHelper.insertArchetype(mapModel, 2, 0, b10, false); + testMapModelHelper.insertArchetype(mapModel, 0, 1, a3, false); + testMapModelHelper.insertArchetype(mapModel, 1, 1, a8, false); + + mapModelCreator.getMapViewSettings().setAutojoin(true); + + // insert using autojoin + testMapModelHelper.insertArchetype(mapModel, 1, 0, a0, true); + TestMapModelHelper.checkMapContents(mapModel, "b5|a6|b10", "a3|a9|"); + } + + /** + * Checks that inserting alternative archetypes with autojoin works as + * expected. + * @throws IllegalAutojoinListException if the test fails + * @throws DuplicateArchetypeException if the test fails + * @throws UndefinedArchetypeException if the test fails + * @throws CannotInsertGameObjectException if the test fails + */ + @Test + public void testInsertAlt2() throws CannotInsertGameObjectException, DuplicateArchetypeException, IllegalAutojoinListException, UndefinedArchetypeException { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(mapModelCreator); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5|b5", "a6", "a7", "a8", "a9", "a10|b10", "a11", "a12", "a13", "a14", "a15"); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(3, 2); + final TestMapModelHelper testMapModelHelper = mapModelCreator.newTestMapModelHelper(); + final TestArchetype a3 = mapModelCreator.getArchetype("a3"); + final TestArchetype a8 = mapModelCreator.getArchetype("a8"); + final TestArchetype b5 = mapModelCreator.getArchetype("b5"); + final TestArchetype b10 = mapModelCreator.getArchetype("b10"); + mapModel.beginTransaction("TEST"); + testMapModelHelper.insertArchetype(mapModel, 0, 0, b5, false); + testMapModelHelper.insertArchetype(mapModel, 2, 0, b10, false); + testMapModelHelper.insertArchetype(mapModel, 0, 1, a3, false); + testMapModelHelper.insertArchetype(mapModel, 1, 1, a8, false); + + mapModelCreator.getMapViewSettings().setAutojoin(true); + + // insert using autojoin + testMapModelHelper.insertArchetype(mapModel, 1, 0, b10, true); + TestMapModelHelper.checkMapContents(mapModel, "b5|b10|b10", "a3|a8|"); + } + + /** + * Checks that inserting alternative archetypes with autojoin works as + * expected. + * @throws IllegalAutojoinListException if the test fails + * @throws DuplicateArchetypeException if the test fails + * @throws UndefinedArchetypeException if the test fails + * @throws CannotInsertGameObjectException if the test fails + */ + @Test + public void testInsertAlt3() throws CannotInsertGameObjectException, DuplicateArchetypeException, IllegalAutojoinListException, UndefinedArchetypeException { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(mapModelCreator); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5|b5", "a6", "a7", "a8", "a9", "a10|b10", "a11", "a12", "a13", "a14", "a15"); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(3, 2); + final TestMapModelHelper testMapModelHelper = mapModelCreator.newTestMapModelHelper(); + final TestArchetype a3 = mapModelCreator.getArchetype("a3"); + final TestArchetype a8 = mapModelCreator.getArchetype("a8"); + final TestArchetype b5 = mapModelCreator.getArchetype("b5"); + final TestArchetype b10 = mapModelCreator.getArchetype("b10"); + mapModel.beginTransaction("TEST"); + testMapModelHelper.insertArchetype(mapModel, 0, 0, b5, false); + testMapModelHelper.insertArchetype(mapModel, 2, 0, b10, false); + testMapModelHelper.insertArchetype(mapModel, 0, 1, a3, false); + testMapModelHelper.insertArchetype(mapModel, 1, 1, a8, false); + + mapModelCreator.getMapViewSettings().setAutojoin(true); + + // insert using autojoin + testMapModelHelper.insertArchetype(mapModel, 1, 0, b5, true); + TestMapModelHelper.checkMapContents(mapModel, "b5|b5|b10", "a3|a9|"); + } + + /** + * Checks that removing alternative archetypes with autojoin works as + * expected. + * @throws IllegalAutojoinListException if the test fails + * @throws DuplicateArchetypeException if the test fails + * @throws UndefinedArchetypeException if the test fails + * @throws CannotInsertGameObjectException if the test fails + */ + @Test + public void testRemoveAlt1() throws CannotInsertGameObjectException, DuplicateArchetypeException, IllegalAutojoinListException, UndefinedArchetypeException { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(mapModelCreator); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5|b5", "a6", "a7", "a8", "a9", "a10|b10", "a11", "a12", "a13", "a14", "a15"); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(3, 2); + final TestMapModelHelper testMapModelHelper = mapModelCreator.newTestMapModelHelper(); + final TestArchetype a10 = mapModelCreator.getArchetype("a10"); + final TestArchetype b10 = mapModelCreator.getArchetype("b10"); + final TestArchetype a11 = mapModelCreator.getArchetype("a11"); + mapModel.beginTransaction("TEST"); + testMapModelHelper.insertArchetype(mapModel, 0, 0, a10, false); + final TestGameObject g10 = testMapModelHelper.insertArchetype(mapModel, 1, 0, b10, false); + testMapModelHelper.insertArchetype(mapModel, 2, 0, a10, false); + testMapModelHelper.insertArchetype(mapModel, 1, 1, a11, false); + + mapModelCreator.getMapViewSettings().setAutojoin(true); + + // remove using autojoin + mapModel.removeGameObject(g10, true); + TestMapModelHelper.checkMapContents(mapModel, "a8||a2", "|a11|"); + } + + /** + * Checks that removing alternative archetypes with autojoin works as + * expected. + * @throws IllegalAutojoinListException if the test fails + * @throws DuplicateArchetypeException if the test fails + * @throws UndefinedArchetypeException if the test fails + * @throws CannotInsertGameObjectException if the test fails + */ + @Test + public void testRemoveAlt2() throws CannotInsertGameObjectException, DuplicateArchetypeException, IllegalAutojoinListException, UndefinedArchetypeException { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(mapModelCreator); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5|b5", "a6", "a7", "a8", "a9", "a10|b10", "a11", "a12", "a13", "a14", "a15"); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(3, 2); + final TestMapModelHelper testMapModelHelper = mapModelCreator.newTestMapModelHelper(); + final TestArchetype b5 = mapModelCreator.getArchetype("b5"); + final TestArchetype b10 = mapModelCreator.getArchetype("b10"); + final TestArchetype a11 = mapModelCreator.getArchetype("a11"); + final TestArchetype a12 = mapModelCreator.getArchetype("a12"); + mapModel.beginTransaction("TEST"); + testMapModelHelper.insertArchetype(mapModel, 0, 0, b10, false); + final TestGameObject g10 = testMapModelHelper.insertArchetype(mapModel, 1, 0, a12, false); + testMapModelHelper.insertArchetype(mapModel, 2, 0, b5, false); + testMapModelHelper.insertArchetype(mapModel, 1, 1, a11, false); + + mapModelCreator.getMapViewSettings().setAutojoin(true); + + // remove using autojoin + mapModel.removeGameObject(g10, true); + TestMapModelHelper.checkMapContents(mapModel, "b10||b5", "|a10|"); + } + + /** + * Checks that removing alternative archetypes with autojoin works as + * expected. + * @throws IllegalAutojoinListException if the test fails + * @throws DuplicateArchetypeException if the test fails + * @throws UndefinedArchetypeException if the test fails + * @throws CannotInsertGameObjectException if the test fails + */ + @Test + public void testRemoveAlt3() throws CannotInsertGameObjectException, DuplicateArchetypeException, IllegalAutojoinListException, UndefinedArchetypeException { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(mapModelCreator); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5|b5", "a6", "a7", "a8", "a9", "a10|b10", "a11", "a12", "a13", "a14", "a15"); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(3, 2); + final TestMapModelHelper testMapModelHelper = mapModelCreator.newTestMapModelHelper(); + final TestArchetype b10 = mapModelCreator.getArchetype("b10"); + final TestArchetype a11 = mapModelCreator.getArchetype("a11"); + mapModel.beginTransaction("TEST"); + testMapModelHelper.insertArchetype(mapModel, 0, 0, b10, false); + final TestGameObject g10 = testMapModelHelper.insertArchetype(mapModel, 1, 0, b10, false); + testMapModelHelper.insertArchetype(mapModel, 2, 0, b10, false); + testMapModelHelper.insertArchetype(mapModel, 1, 1, a11, false); + + mapModelCreator.getMapViewSettings().setAutojoin(true); + + // remove using autojoin + mapModel.removeGameObject(g10, true); + TestMapModelHelper.checkMapContents(mapModel, "b10||b10", "|a11|"); + } + + /** + * Checks that inserting duplicate archetypes with autojoin works as + * expected. + * @throws IllegalAutojoinListException if the test fails + * @throws DuplicateArchetypeException if the test fails + * @throws UndefinedArchetypeException if the test fails + * @throws CannotInsertGameObjectException if the test fails + */ + @Test + public void testInsertDuplicate1() throws CannotInsertGameObjectException, DuplicateArchetypeException, IllegalAutojoinListException, UndefinedArchetypeException { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(mapModelCreator); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5|b5", "a6", "a7", "a8", "a9", "a10|b10", "a11", "a12", "a13", "a14", "a15"); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(3, 3); + final TestMapModelHelper testMapModelHelper = mapModelCreator.newTestMapModelHelper(); + final TestArchetype a5 = mapModelCreator.getArchetype("a5"); + final TestArchetype b5 = mapModelCreator.getArchetype("b5"); + final TestArchetype a10 = mapModelCreator.getArchetype("a10"); + final TestArchetype b10 = mapModelCreator.getArchetype("b10"); + final TestArchetype a15 = mapModelCreator.getArchetype("a15"); + mapModel.beginTransaction("TEST"); + testMapModelHelper.insertArchetype(mapModel, 1, 0, a10, false); + testMapModelHelper.insertArchetype(mapModel, 0, 1, b10, false); + testMapModelHelper.insertArchetype(mapModel, 1, 1, a15, false); + testMapModelHelper.insertArchetype(mapModel, 2, 1, a5, false); + testMapModelHelper.insertArchetype(mapModel, 1, 2, b5, false); + + mapModelCreator.getMapViewSettings().setAutojoin(true); + + try { + testMapModelHelper.insertArchetype(mapModel, 1, 1, a10, true); + Assert.fail(); + } catch (final CannotInsertGameObjectException ignored) { + // ignore + } + try { + testMapModelHelper.insertArchetype(mapModel, 0, 1, b10, true); + Assert.fail(); + } catch (final CannotInsertGameObjectException ignored) { + // ignore + } + TestMapModelHelper.checkMapContents(mapModel, "|a10|", "b10|a15|a5", "|b5|"); + } + + /** + * Checks that replacing archetypes works as expected. + * @throws IllegalAutojoinListException if the test fails + * @throws DuplicateArchetypeException if the test fails + * @throws UndefinedArchetypeException if the test fails + * @throws CannotInsertGameObjectException if the test fails + */ + @Test + public void testInsertReplace1() throws CannotInsertGameObjectException, DuplicateArchetypeException, IllegalAutojoinListException, UndefinedArchetypeException { + final TestMapModelCreator mapModelCreator = new TestMapModelCreator(false); + final AutojoinListsHelper autojoinListsHelper = new AutojoinListsHelper(mapModelCreator); + autojoinListsHelper.newAutojoinLists("a0", "a1", "a2", "a3", "a4", "a5|b5", "a6", "a7", "a8", "a9", "a10|b10", "a11", "a12", "a13", "a14", "a15"); + final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapModelCreator.newMapModel(3, 3); + final TestMapModelHelper testMapModelHelper = mapModelCreator.newTestMapModelHelper(); + final TestArchetype a0 = mapModelCreator.getArchetype("a0"); + final TestArchetype a5 = mapModelCreator.getArchetype("a5"); + final TestArchetype b5 = mapModelCreator.getArchetype("b5"); + final TestArchetype a10 = mapModelCreator.getArchetype("a10"); + final TestArchetype b10 = mapModelCreator.getArchetype("b10"); + mapModel.beginTransaction("TEST"); + for (int y = 0; y < 3; y++) { + for (int x = 0; x < 3; x++) { + testMapModelHelper.insertArchetype(mapModel, x, y, a10, false); + } + } + + mapModelCreator.getMapViewSettings().setAutojoin(true); + + TestMapModelHelper.checkMapContents(mapModel, "a10|a10|a10", "a10|a10|a10", "a10|a10|a10"); + testMapModelHelper.insertArchetype(mapModel, 1, 1, b5, true); // replace main->alt + TestMapModelHelper.checkMapContents(mapModel, "a10|a14|a10", "a8|b5|a2", "a10|a11|a10"); + testMapModelHelper.insertArchetype(mapModel, 1, 1, b10, true); // replace alt->alt, different archetype + TestMapModelHelper.checkMapContents(mapModel, "a10|a10|a10", "a10|b10|a10", "a10|a10|a10"); + testMapModelHelper.insertArchetype(mapModel, 1, 1, a5, true); // replace alt->main + TestMapModelHelper.checkMapContents(mapModel, "a10|a14|a10", "a10|a15|a10", "a10|a11|a10"); + testMapModelHelper.insertArchetype(mapModel, 1, 1, b10, true); // replace main->alt + TestMapModelHelper.checkMapContents(mapModel, "a10|a10|a10", "a10|b10|a10", "a10|a10|a10"); + try { + testMapModelHelper.insertArchetype(mapModel, 1, 1, b10, true); // replace alt->alt, same archetype + Assert.fail(); + } catch (final CannotInsertGameObjectException ignored) { + // ignore + } + TestMapModelHelper.checkMapContents(mapModel, "a10|a10|a10", "a10|b10|a10", "a10|a10|a10"); + try { + testMapModelHelper.insertArchetype(mapModel, 1, 0, a0, true); // replace main->main + Assert.fail(); + } catch (final CannotInsertGameObjectException ignored) { + // ignore + } + TestMapModelHelper.checkMapContents(mapModel, "a10|a10|a10", "a10|b10|a10", "a10|a10|a10"); + } + + /** * Implements {@link AutojoinList} related functions. */ private static class AutojoinListsHelper { @@ -202,9 +493,15 @@ * cannot be created */ public void newAutojoinLists(@NotNull final String... archetypeNames) throws IllegalAutojoinListException { - final List<TestArchetype> archetypes = new ArrayList<TestArchetype>(); - for (final String archetypeName : archetypeNames) { - archetypes.add(mapModelCreator.getArchetype(archetypeName)); + final List<List<TestArchetype>> archetypes = new ArrayList<List<TestArchetype>>(); + for (final String archetypeNameList : archetypeNames) { + final List<TestArchetype> archetypeList = new ArrayList<TestArchetype>(); + if (!archetypeNameList.isEmpty()) { + for (final String archetypeName : archetypeNameList.split("\\|", -1)) { + archetypeList.add(mapModelCreator.getArchetype(archetypeName)); + } + } + archetypes.add(archetypeList); } autojoinLists.addAutojoinList(new AutojoinList<TestGameObject, TestMapArchObject, TestArchetype>(archetypes)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-12 19:29:06
|
Revision: 8589 http://gridarta.svn.sourceforge.net/gridarta/?rev=8589&view=rev Author: akirschbaum Date: 2010-07-12 19:28:59 +0000 (Mon, 12 Jul 2010) Log Message: ----------- Fix hiding of archetypes in /intern path when loading from arch directory. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java trunk/crossfire/ChangeLog trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java trunk/daimonin/ChangeLog trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeParser.java trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java trunk/model/src/app/net/sf/gridarta/model/resource/AbstractFilesResourcesReader.java trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeParser.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-07-06 07:01:08 UTC (rev 8588) +++ trunk/atrinik/ChangeLog 2010-07-12 19:28:59 UTC (rev 8589) @@ -1,3 +1,8 @@ +2010-07-12 Andreas Kirschbaum + + * Fix hiding of archetypes in /intern path when loading from arch + directory. + 2010-07-03 Andreas Kirschbaum * Implement #1726046 (Window handling): autojoining now supports Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java 2010-07-06 07:01:08 UTC (rev 8588) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java 2010-07-12 19:28:59 UTC (rev 8589) @@ -168,8 +168,8 @@ * {@inheritDoc} */ @Override - protected boolean addToPanel(final boolean isInternPath, @Nullable final String editorFolder, @NotNull final Archetype archetype) { - return !isInternPath && !(editorFolder != null && editorFolder.contains(net.sf.gridarta.model.gameobject.GameObject.EDITOR_FOLDER_INTERN)); + protected boolean addToPanel(final boolean isInternPath, @NotNull final String editorFolder, @NotNull final Archetype archetype) { + return !isInternPath && !(editorFolder + "/").startsWith("/" + net.sf.gridarta.model.gameobject.GameObject.EDITOR_FOLDER_INTERN + "/"); } /** Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-07-06 07:01:08 UTC (rev 8588) +++ trunk/crossfire/ChangeLog 2010-07-12 19:28:59 UTC (rev 8589) @@ -1,3 +1,8 @@ +2010-07-12 Andreas Kirschbaum + + * Fix hiding of archetypes in /intern path when loading from arch + directory. + 2010-07-03 Andreas Kirschbaum * Implement #1726046 (Window handling): autojoining now supports Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java 2010-07-06 07:01:08 UTC (rev 8588) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java 2010-07-12 19:28:59 UTC (rev 8589) @@ -192,8 +192,8 @@ * {@inheritDoc} */ @Override - protected boolean addToPanel(final boolean isInternPath, @Nullable final String editorFolder, @NotNull final Archetype archetype) { - return !isInternPath && !(editorFolder != null && editorFolder.contains(net.sf.gridarta.model.gameobject.GameObject.EDITOR_FOLDER_INTERN)) && !archetype.getArchetypeName().equals(START_ARCH_NAME); + protected boolean addToPanel(final boolean isInternPath, @NotNull final String editorFolder, @NotNull final Archetype archetype) { + return !isInternPath && !(editorFolder + "/").startsWith("/" + net.sf.gridarta.model.gameobject.GameObject.EDITOR_FOLDER_INTERN + "/") && !archetype.getArchetypeName().equals(START_ARCH_NAME); } } // class ArchetypeParser Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-07-06 07:01:08 UTC (rev 8588) +++ trunk/daimonin/ChangeLog 2010-07-12 19:28:59 UTC (rev 8589) @@ -1,3 +1,8 @@ +2010-07-12 Andreas Kirschbaum + + * Fix hiding of archetypes in /intern path when loading from arch + directory. + 2010-07-03 Andreas Kirschbaum * Implement #1726046 (Window handling): autojoining now supports Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeParser.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeParser.java 2010-07-06 07:01:08 UTC (rev 8588) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/archetype/ArchetypeParser.java 2010-07-12 19:28:59 UTC (rev 8589) @@ -151,8 +151,8 @@ * {@inheritDoc} */ @Override - protected boolean addToPanel(final boolean isInternPath, @Nullable final String editorFolder, @NotNull final Archetype archetype) { - return !isInternPath && !(editorFolder != null && editorFolder.contains(net.sf.gridarta.model.gameobject.GameObject.EDITOR_FOLDER_INTERN)); + protected boolean addToPanel(final boolean isInternPath, @NotNull final String editorFolder, @NotNull final Archetype archetype) { + return !isInternPath && !(editorFolder + "/").startsWith("/" + net.sf.gridarta.model.gameobject.GameObject.EDITOR_FOLDER_INTERN + "/"); } /** Modified: trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java 2010-07-06 07:01:08 UTC (rev 8588) +++ trunk/model/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java 2010-07-12 19:28:59 UTC (rev 8589) @@ -86,7 +86,7 @@ @Nullable final String path; if (!archetypeSet.isLoadedFromArchive() && archName == null) { final String tmpPath = archPath + "/"; - isInternPath = tmpPath.contains("/intern/"); + isInternPath = tmpPath.startsWith("/intern/"); path = tmpPath; } else { isInternPath = false; @@ -147,7 +147,7 @@ initParseArchetype(); - @Nullable String editorFolder = null; + @NotNull String editorFolder = archPath.isEmpty() ? "default" : archPath; while (true) { thisLine2 = in.readLine(); if (thisLine2 == null) { @@ -204,9 +204,6 @@ if (!archetypeSet.isLoadedFromArchive() || archName != null) { panel = panelName; folder = folderName; - } else if (editorFolder == null) { - panel = "default"; - folder = "default"; } else { final String[] names = editorFolder.split("/", 3); panel = names[0]; @@ -359,6 +356,6 @@ * @param archetype the archetype to add * @return whether the archetype should be added */ - protected abstract boolean addToPanel(final boolean isInternPath, @Nullable final String editorFolder, @NotNull final R archetype); + protected abstract boolean addToPanel(final boolean isInternPath, @NotNull final String editorFolder, @NotNull final R archetype); } // class AbstractArchetypeParser Modified: trunk/model/src/app/net/sf/gridarta/model/resource/AbstractFilesResourcesReader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/resource/AbstractFilesResourcesReader.java 2010-07-06 07:01:08 UTC (rev 8588) +++ trunk/model/src/app/net/sf/gridarta/model/resource/AbstractFilesResourcesReader.java 2010-07-12 19:28:59 UTC (rev 8589) @@ -179,7 +179,7 @@ try { final BufferedReader in = new BufferedReader(isr); try { - archetypeParser.parseArchetypeFromStream(in, null, null, null, panelName, folderName, "", invObjects, new ErrorViewCollector(errorView, f)); + archetypeParser.parseArchetypeFromStream(in, null, null, null, panelName, folderName, path, invObjects, new ErrorViewCollector(errorView, f)); } finally { in.close(); } Modified: trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeParser.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeParser.java 2010-07-06 07:01:08 UTC (rev 8588) +++ trunk/model/src/test/net/sf/gridarta/model/archetype/TestArchetypeParser.java 2010-07-12 19:28:59 UTC (rev 8589) @@ -86,7 +86,7 @@ * {@inheritDoc} */ @Override - protected boolean addToPanel(final boolean isInternPath, @Nullable final String editorFolder, @NotNull final TestArchetype archetype) { + protected boolean addToPanel(final boolean isInternPath, @NotNull final String editorFolder, @NotNull final TestArchetype archetype) { return true; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-12 19:34:38
|
Revision: 8590 http://gridarta.svn.sourceforge.net/gridarta/?rev=8590&view=rev Author: akirschbaum Date: 2010-07-12 19:34:32 +0000 (Mon, 12 Jul 2010) Log Message: ----------- Remove support for hiding archetypes in /intern path. Now all archetypes are added to the archetype chooser. [Atrinik and Crossfire only] Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java trunk/crossfire/ChangeLog trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-07-12 19:28:59 UTC (rev 8589) +++ trunk/atrinik/ChangeLog 2010-07-12 19:34:32 UTC (rev 8590) @@ -1,7 +1,7 @@ 2010-07-12 Andreas Kirschbaum - * Fix hiding of archetypes in /intern path when loading from arch - directory. + * Remove support for hiding archetypes in /intern path. Now all + archetypes are added to the archetype chooser. 2010-07-03 Andreas Kirschbaum Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java 2010-07-12 19:28:59 UTC (rev 8589) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/archetype/ArchetypeParser.java 2010-07-12 19:34:32 UTC (rev 8590) @@ -169,7 +169,7 @@ */ @Override protected boolean addToPanel(final boolean isInternPath, @NotNull final String editorFolder, @NotNull final Archetype archetype) { - return !isInternPath && !(editorFolder + "/").startsWith("/" + net.sf.gridarta.model.gameobject.GameObject.EDITOR_FOLDER_INTERN + "/"); + return true; } /** Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-07-12 19:28:59 UTC (rev 8589) +++ trunk/crossfire/ChangeLog 2010-07-12 19:34:32 UTC (rev 8590) @@ -1,7 +1,7 @@ 2010-07-12 Andreas Kirschbaum - * Fix hiding of archetypes in /intern path when loading from arch - directory. + * Remove support for hiding archetypes in /intern path. Now all + archetypes are added to the archetype chooser. 2010-07-03 Andreas Kirschbaum Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java 2010-07-12 19:28:59 UTC (rev 8589) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/archetype/ArchetypeParser.java 2010-07-12 19:34:32 UTC (rev 8590) @@ -193,7 +193,7 @@ */ @Override protected boolean addToPanel(final boolean isInternPath, @NotNull final String editorFolder, @NotNull final Archetype archetype) { - return !isInternPath && !(editorFolder + "/").startsWith("/" + net.sf.gridarta.model.gameobject.GameObject.EDITOR_FOLDER_INTERN + "/") && !archetype.getArchetypeName().equals(START_ARCH_NAME); + return !archetype.getArchetypeName().equals(START_ARCH_NAME); } } // class ArchetypeParser This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-15 18:01:21
|
Revision: 8591 http://gridarta.svn.sourceforge.net/gridarta/?rev=8591&view=rev Author: akirschbaum Date: 2010-07-15 18:01:14 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Fix crash when using --config command-line option. [Daimonin only] Modified Paths: -------------- trunk/build.xml trunk/daimonin/ChangeLog Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2010-07-12 19:34:32 UTC (rev 8590) +++ trunk/build.xml 2010-07-15 18:01:14 UTC (rev 8591) @@ -174,6 +174,7 @@ <fileset dir="dest/daimonin/app"/> <fileset dir="dest/gridarta/app"/> <fileset dir="dest/model/app"/> + <fileset dir="dest/preferences/app"/> <fileset dir="dest/textedit/app"/> <fileset dir="dest/utils/app"/> <fileset dir="dest" includes="build.properties"/> Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-07-12 19:34:32 UTC (rev 8590) +++ trunk/daimonin/ChangeLog 2010-07-15 18:01:14 UTC (rev 8591) @@ -1,3 +1,7 @@ +2010-07-15 Andreas Kirschbaum + + * Fix crash when using --config command-line option. + 2010-07-12 Andreas Kirschbaum * Fix hiding of archetypes in /intern path when loading from arch This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-15 18:52:01
|
Revision: 8592 http://gridarta.svn.sourceforge.net/gridarta/?rev=8592&view=rev Author: akirschbaum Date: 2010-07-15 18:51:54 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Update comments. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/map/renderer/package.html trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/package.html trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/map/renderer/package.html trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureListsParser.java trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java trunk/src/app/net/sf/gridarta/gui/map/package.html trunk/src/app/net/sf/gridarta/validation/checks/package.html trunk/src/app/overview.html Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/map/renderer/package.html =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/map/renderer/package.html 2010-07-15 18:01:14 UTC (rev 8591) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/map/renderer/package.html 2010-07-15 18:51:54 UTC (rev 8592) @@ -23,6 +23,6 @@ <p>Renders maps.</p> <p>Note: management of maps is in a different package: {@link - net.sf.gridarta.model.map.mapcontrol}.</p> + net.sf.gridarta.model.mapcontrol}.</p> </body> </html> Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/package.html =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/package.html 2010-07-15 18:01:14 UTC (rev 8591) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/package.html 2010-07-15 18:51:54 UTC (rev 8592) @@ -23,6 +23,6 @@ <p>Renders maps.</p> <p>Note: management of maps is in a different package: {@link - net.sf.gridarta.model.map.mapcontrol}.</p> + net.sf.gridarta.model.mapcontrol}.</p> </body> </html> Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/map/renderer/package.html =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/map/renderer/package.html 2010-07-15 18:01:14 UTC (rev 8591) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/map/renderer/package.html 2010-07-15 18:51:54 UTC (rev 8592) @@ -23,6 +23,6 @@ <p>Renders maps.</p> <p>Note: management of maps is in a different package: {@link - net.sf.gridarta.model.map.mapcontrol}.</p> + net.sf.gridarta.model.mapcontrol}.</p> </body> </html> Modified: trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureListsParser.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureListsParser.java 2010-07-15 18:01:14 UTC (rev 8591) +++ trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureListsParser.java 2010-07-15 18:51:54 UTC (rev 8592) @@ -47,7 +47,7 @@ * @return the hash table */ @NotNull - public static Map<String, TreasureTreeNode> parseTreasureLists(final Document specialTreasureListsDocument) { + public static Map<String, TreasureTreeNode> parseTreasureLists(@NotNull final Document specialTreasureListsDocument) { final Map<String, TreasureTreeNode> specialTreasureLists = new HashMap<String, TreasureTreeNode>(); final Element rootElement = specialTreasureListsDocument.getDocumentElement(); Modified: trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2010-07-15 18:01:14 UTC (rev 8591) +++ trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2010-07-15 18:51:54 UTC (rev 8592) @@ -49,7 +49,8 @@ import org.jetbrains.annotations.Nullable; /** - * Loader for treasure list files. + * Loader for treasure list files. The same format is used for Atrinik, + * Crossfire, and Daimonin. * @author Andreas Kirschbaum */ public class TreasureLoader { @@ -66,11 +67,12 @@ */ @NotNull private static final Comparator<TreasureTreeNode> treasureNodeComparator = new Comparator<TreasureTreeNode>() { - /** {@inheritDoc} */ + @Override public int compare(@NotNull final TreasureTreeNode o1, @NotNull final TreasureTreeNode o2) { return String.CASE_INSENSITIVE_ORDER.compare(o1.getTreasureObj().getName(), o2.getTreasureObj().getName()); } + }; /** @@ -79,7 +81,6 @@ @NotNull private static final FilenameFilter treasureListFilter = new FilenameFilter() { - /** {@inheritDoc} */ @Override public boolean accept(@NotNull final File dir, @NotNull final String name) { final File fullPath = new File(dir, name); @@ -95,9 +96,9 @@ } /** - * Parse the treasure-data from the CF file "treasures.txt" into this JTree - * instance. This method must be called AFTER arch-loading is complete! + * Parses a treasure file into a {@link TreasureTree} instance. * @param errorView the error view to use + * @param specialTreasureLists maps treasure list name to parent node * @param configSource the config source to read from * @param globalSettings the global settings to use * @return the parsed treasure tree @@ -138,6 +139,14 @@ return createTreasureTree(tmpList, needLink, specialTreasureLists); } + /** + * Creates a {@link TreasureTree} instance from a list of {@link + * TreasureTreeNode TreasureTreeNodes}. + * @param tmpList the treasure tree nodes to add to the treasure tree + * @param needLink all treasure tree nodes within <code>tmpList</code> + * @param specialTreasureLists maps treasure list name to parent node + * @return the new treasure tree instance + */ @NotNull private static TreasureTree createTreasureTree(@NotNull final List<TreasureTreeNode> tmpList, @NotNull final Iterable<TreasureTreeNode> needLink, @NotNull final Map<String, TreasureTreeNode> specialTreasureLists) { final DefaultMutableTreeNode root = new DefaultMutableTreeNode("Treasurelists:"); @@ -149,12 +158,19 @@ return treasures; } + /** + * Adds a list of {@link TreasureTreeNode TreasureTreeNodes} to a root + * {@link DefaultMutableTreeNode}. The entries are added with the ordering + * specified by {@link #treasureNodeComparator}. + * @param tmpList the treasure tree nodes to add + * @param specialTreasureLists maps treasure list name to parent node + * @param root the root tree node to add to + */ private static void addTopLevelEntries(@NotNull final List<TreasureTreeNode> tmpList, @NotNull final Map<String, TreasureTreeNode> specialTreasureLists, @NotNull final DefaultMutableTreeNode root) { - // sort alphabetically and link sub-treasurelist entries Collections.sort(tmpList, treasureNodeComparator); - // Loop through all treasureone lists and calculate the real ratio - // of chances (Summed up to be 100%). Also attach lists to tree model. + // Calculate the real ratio of chances (summed up to be 100%). Also + // attach lists to tree model. for (final TreasureTreeNode realNode : tmpList) { realNode.recalculateChances(); @@ -168,6 +184,11 @@ } } + /** + * Links sub-treasure tree nodes to their parent nodes. + * @param needLink the sub-treasure tree nodes to link + * @param treasures the model to link into + */ private static void linkSubLists(@NotNull final Iterable<TreasureTreeNode> needLink, @NotNull final TreasureTree treasures) { final List<TreasureTreeNode> needSecondLink = new ArrayList<TreasureTreeNode>(); linkSubList2(needLink, treasures, false, needSecondLink); @@ -198,6 +219,12 @@ return treasures.get(node.getTreasureObj().getName()); } + /** + * Add the special treasure list parents to the root {@link + * DefaultMutableTreeNode}. + * @param specialTreasureLists maps treasure list name to parent node + * @param root the root default mutable tree node + */ private static void addSpecialEntries(@NotNull final Map<String, TreasureTreeNode> specialTreasureLists, @NotNull final DefaultMutableTreeNode root) { for (final MutableTreeNode folder : specialTreasureLists.values()) { root.add(folder); @@ -208,7 +235,8 @@ * Parses one treasurelist file. * @param errorViewCollector the error view collector to use * @param file the file to read from - * @param tmpList tmp. container for all treasurelists + * @param tmpList a collection to which all parsed treasure tree nodes are + * added * @param needLink all sub-treasurelist nodes that need linking * @see #parseTreasures(ErrorView, Map, ConfigSource, GlobalSettings) */ @@ -262,7 +290,8 @@ * (*.tl). * @param errorViewCollector the error view collector to use * @param dir directory to read from - * @param tmpList tmp. container for all treasurelists + * @param tmpList a collection to which all parsed treasure tree nodes are + * added * @param needLink all sub-treasurelist nodes that need linking * @see #parseTreasures(ErrorView, Map, ConfigSource, GlobalSettings) */ @@ -284,7 +313,7 @@ } /** - * Read and parse the text inside a treasurelist. + * Reads and parses the text inside a treasurelist definition. * @param errorViewCollector the error view collector to use * @param parentNode parent tree node * @param reader Reader to read from. Modified: trunk/src/app/net/sf/gridarta/gui/map/package.html =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/package.html 2010-07-15 18:01:14 UTC (rev 8591) +++ trunk/src/app/net/sf/gridarta/gui/map/package.html 2010-07-15 18:51:54 UTC (rev 8592) @@ -20,7 +20,7 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <body> -Base classes for rendering maps. A {@link net.sf.gridarta.model.map.grid.MapGrid +Base classes for rendering maps. A {@link net.sf.gridarta.model.mapgrid.MapGrid MapGrid} contains a 2D array of flags for highlighting tiles on a map. A {@link net.sf.gridarta.model.mapcursor.MapCursor MapCursor} is used to modify selection and cursor position flags on this MapGrid. Modified: trunk/src/app/net/sf/gridarta/validation/checks/package.html =================================================================== --- trunk/src/app/net/sf/gridarta/validation/checks/package.html 2010-07-15 18:01:14 UTC (rev 8591) +++ trunk/src/app/net/sf/gridarta/validation/checks/package.html 2010-07-15 18:51:54 UTC (rev 8592) @@ -24,6 +24,7 @@ <h3>How to create your own checks</h3> <p>The easiest way to create your own checks is this:</p> + <ol> <li>Extend {@link net.sf.gridarta.validation.AbstractValidator AbstractValidator} by a class named like @@ -31,8 +32,7 @@ implements one of the {@link net.sf.gridarta.validation.Validator Validator} sub-interfaces </li> - <li>Extend {@link - net.sf.gridarta.model.map.validation.errors.ValidationError + <li>Extend {@link net.sf.gridarta.model.validation.errors.ValidationError ValidationError} or one of its subclasses by a class named like <code>net.sf.gridarta.map.validation.checks.MyError</code>. </li> </ol> @@ -50,13 +50,12 @@ <h3>FAQ</h3> <dl> <dt>Do I really have to always extend {@link - net.sf.gridarta.model.map.validation.errors.ValidationError - ValidationError} for my validator's errors? + net.sf.gridarta.model.validation.errors.ValidationError ValidationError} + for my validator's errors? </dt> <dd>Well not really. But the automatic localization of <code>ValidationError</code>s depends on separate error class names. - Also, {@link - net.sf.gridarta.model.map.validation.errors.CorrectableError + Also, {@link net.sf.gridarta.model.validation.errors.CorrectableError CorrectableError} depends on separate error classes. </dd> </dl> Modified: trunk/src/app/overview.html =================================================================== --- trunk/src/app/overview.html 2010-07-15 18:01:14 UTC (rev 8591) +++ trunk/src/app/overview.html 2010-07-15 18:51:54 UTC (rev 8592) @@ -128,7 +128,7 @@ items etc.. <p/> The Map itself is defined by a Map Arch Object. The class storing the - Map is {@link net.sf.gridarta.model.map.mapmodel.MapModel}. + Map is {@link net.sf.gridarta.model.mapmodel.MapModel}. </dd> <dt id="MapSquare">(Map )Square</dt> <dd> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-15 19:20:19
|
Revision: 8594 http://gridarta.svn.sourceforge.net/gridarta/?rev=8594&view=rev Author: akirschbaum Date: 2010-07-15 19:20:13 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Skip special files when loading treasure lists. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-07-15 18:55:58 UTC (rev 8593) +++ trunk/atrinik/ChangeLog 2010-07-15 19:20:13 UTC (rev 8594) @@ -1,3 +1,7 @@ +2010-07-15 Andreas Kirschbaum + + * Skip special files when loading treasure lists. + 2010-07-12 Andreas Kirschbaum * Remove support for hiding archetypes in /intern path. Now all Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-07-15 18:55:58 UTC (rev 8593) +++ trunk/crossfire/ChangeLog 2010-07-15 19:20:13 UTC (rev 8594) @@ -1,3 +1,7 @@ +2010-07-15 Andreas Kirschbaum + + * Skip special files when loading treasure lists. + 2010-07-12 Andreas Kirschbaum * Remove support for hiding archetypes in /intern path. Now all Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-07-15 18:55:58 UTC (rev 8593) +++ trunk/daimonin/ChangeLog 2010-07-15 19:20:13 UTC (rev 8594) @@ -1,5 +1,7 @@ 2010-07-15 Andreas Kirschbaum + * Skip special files when loading treasure lists. + * Fix crash when using --config command-line option. 2010-07-12 Andreas Kirschbaum Modified: trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2010-07-15 18:55:58 UTC (rev 8593) +++ trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2010-07-15 19:20:13 UTC (rev 8594) @@ -134,8 +134,10 @@ final int tmpListSize = tmpList.size(); if (treasureLocation.isDirectory()) { loadTreasureDir(errorViewCollector, treasureLocation, tmpList, needLink); + } else if (treasureLocation.isFile()) { + loadTreasureList(errorViewCollector, treasureLocation, tmpList, needLink); } else { - loadTreasureList(errorViewCollector, treasureLocation, tmpList, needLink); + errorViewCollector.addWarning(ErrorViewCategory.TREASURES_FILE_INVALID, "location is neither file nor directory"); } if (log.isInfoEnabled()) { log.info("Loaded " + (tmpList.size() - tmpListSize) + " treasurelists from '" + treasureLocation + "'."); @@ -311,9 +313,9 @@ Arrays.sort(traverse); for (final String entry : traverse) { final File file = new File(dir, entry); - if (entry.endsWith(".tl")) { + if (file.isFile()) { loadTreasureList(errorViewCollector, file, tmpList, needLink); - } else { + } else if (file.isDirectory()) { loadTreasureDir(errorViewCollector, file, tmpList, needLink); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-15 19:31:37
|
Revision: 8595 http://gridarta.svn.sourceforge.net/gridarta/?rev=8595&view=rev Author: akirschbaum Date: 2010-07-15 19:31:31 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Include correct filename for errors in *.tl treasurelists. [Atrinik and Daimonin only] Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/daimonin/ChangeLog trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-07-15 19:20:13 UTC (rev 8594) +++ trunk/atrinik/ChangeLog 2010-07-15 19:31:31 UTC (rev 8595) @@ -1,5 +1,7 @@ 2010-07-15 Andreas Kirschbaum + * Include correct filename for errors in *.tl treasurelists. + * Skip special files when loading treasure lists. 2010-07-12 Andreas Kirschbaum Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-07-15 19:20:13 UTC (rev 8594) +++ trunk/daimonin/ChangeLog 2010-07-15 19:31:31 UTC (rev 8595) @@ -1,5 +1,7 @@ 2010-07-15 Andreas Kirschbaum + * Include correct filename for errors in *.tl treasurelists. + * Skip special files when loading treasure lists. * Fix crash when using --config command-line option. Modified: trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2010-07-15 19:20:13 UTC (rev 8594) +++ trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2010-07-15 19:31:31 UTC (rev 8595) @@ -130,14 +130,13 @@ break; } - final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, treasureLocation); final int tmpListSize = tmpList.size(); if (treasureLocation.isDirectory()) { - loadTreasureDir(errorViewCollector, treasureLocation, tmpList, needLink); + loadTreasureDir(errorView, treasureLocation, tmpList, needLink); } else if (treasureLocation.isFile()) { - loadTreasureList(errorViewCollector, treasureLocation, tmpList, needLink); + loadTreasureList(errorView, treasureLocation, tmpList, needLink); } else { - errorViewCollector.addWarning(ErrorViewCategory.TREASURES_FILE_INVALID, "location is neither file nor directory"); + new ErrorViewCollector(errorView, treasureLocation).addWarning(ErrorViewCategory.TREASURES_FILE_INVALID, "location is neither file nor directory"); } if (log.isInfoEnabled()) { log.info("Loaded " + (tmpList.size() - tmpListSize) + " treasurelists from '" + treasureLocation + "'."); @@ -242,14 +241,15 @@ /** * Parses one treasurelist file. - * @param errorViewCollector the error view collector to use + * @param errorView the error view to use * @param file the file to read from * @param tmpList a collection to which all parsed treasure tree nodes are * added * @param needLink all sub-treasurelist nodes that need linking * @see #parseTreasures(ErrorView, Map, ConfigSource, GlobalSettings) */ - private static void loadTreasureList(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final File file, final Collection<TreasureTreeNode> tmpList, final List<TreasureTreeNode> needLink) { + private static void loadTreasureList(@NotNull final ErrorView errorView, @NotNull final File file, final Collection<TreasureTreeNode> tmpList, final List<TreasureTreeNode> needLink) { + final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, file); try { final InputStream inputStream = new FileInputStream(file); try { @@ -297,14 +297,14 @@ /** * Recursively traverses a directory and parses all treasurelist files * (*.tl). - * @param errorViewCollector the error view collector to use + * @param errorView the error view to use * @param dir directory to read from * @param tmpList a collection to which all parsed treasure tree nodes are * added * @param needLink all sub-treasurelist nodes that need linking * @see #parseTreasures(ErrorView, Map, ConfigSource, GlobalSettings) */ - private static void loadTreasureDir(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final File dir, @NotNull final List<TreasureTreeNode> tmpList, @NotNull final List<TreasureTreeNode> needLink) { + private static void loadTreasureDir(@NotNull final ErrorView errorView, @NotNull final File dir, @NotNull final List<TreasureTreeNode> tmpList, @NotNull final List<TreasureTreeNode> needLink) { final String[] traverse = dir.list(treasureListFilter); if (traverse == null) { return; @@ -314,9 +314,9 @@ for (final String entry : traverse) { final File file = new File(dir, entry); if (file.isFile()) { - loadTreasureList(errorViewCollector, file, tmpList, needLink); + loadTreasureList(errorView, file, tmpList, needLink); } else if (file.isDirectory()) { - loadTreasureDir(errorViewCollector, file, tmpList, needLink); + loadTreasureDir(errorView, file, tmpList, needLink); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-15 19:35:29
|
Revision: 8596 http://gridarta.svn.sourceforge.net/gridarta/?rev=8596&view=rev Author: akirschbaum Date: 2010-07-15 19:35:23 +0000 (Thu, 15 Jul 2010) Log Message: ----------- Add support for *.trs treasurelist files in arch directory. [Crossfire only] Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/messages.properties trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-07-15 19:31:31 UTC (rev 8595) +++ trunk/crossfire/ChangeLog 2010-07-15 19:35:23 UTC (rev 8596) @@ -1,5 +1,7 @@ 2010-07-15 Andreas Kirschbaum + * Add support for *.trs treasurelist files in arch directory. + * Skip special files when loading treasure lists. 2010-07-12 Andreas Kirschbaum Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/messages.properties =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/messages.properties 2010-07-15 19:31:31 UTC (rev 8595) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/messages.properties 2010-07-15 19:35:23 UTC (rev 8596) @@ -39,7 +39,7 @@ # - ARCH_DIRECTORY individual files in archetype directory (set in settings # dialog) configSource.COLLECTED.treasures.0=${COLLECTED}/treasures -configSource.ARCH_DIRECTORY.treasures.0=${COLLECTED}/treasures +configSource.ARCH_DIRECTORY.treasures.0=${ARCH} # Internal version number of the included online-documentation. Increasing the # number causes an automated popup of the docu when users upgrade their editor Modified: trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java =================================================================== --- trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2010-07-15 19:31:31 UTC (rev 8595) +++ trunk/model/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java 2010-07-15 19:35:23 UTC (rev 8596) @@ -91,7 +91,7 @@ return true; } final String lowerCaseName = name.toLowerCase(); - return lowerCaseName.endsWith(".tl"); + return lowerCaseName.endsWith(".tl") || lowerCaseName.endsWith(".trs"); } }; @@ -295,8 +295,7 @@ } /** - * Recursively traverses a directory and parses all treasurelist files - * (*.tl). + * Recursively traverses a directory and parses all treasurelist files. * @param errorView the error view to use * @param dir directory to read from * @param tmpList a collection to which all parsed treasure tree nodes are This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-07-22 16:23:22
|
Revision: 8600 http://gridarta.svn.sourceforge.net/gridarta/?rev=8600&view=rev Author: akirschbaum Date: 2010-07-22 16:23:15 +0000 (Thu, 22 Jul 2010) Log Message: ----------- Remove redundant text resources. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2010-07-17 21:22:51 UTC (rev 8599) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2010-07-22 16:23:15 UTC (rev 8600) @@ -69,7 +69,3 @@ about.logo=icons/atrinikLogoSmall.png update.url=http://www.atrinik.org/editor/update.properties - -################ -# Other Strings -nameOfFaceObject=face Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2010-07-17 21:22:51 UTC (rev 8599) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2010-07-22 16:23:15 UTC (rev 8600) @@ -69,7 +69,3 @@ about.logo=icons/daimoninLogoSmall.png update.url=http://daimonin.sourceforge.net/editor/update.properties - -################ -# Other Strings -nameOfFaceObject=face This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |