You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2010-06-08 22:29:03
|
Revision: 8285 http://gridarta.svn.sourceforge.net/gridarta/?rev=8285&view=rev Author: akirschbaum Date: 2010-06-08 22:28:57 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Do not ignore caught exception. Modified Paths: -------------- trunk/utils/src/app/net/sf/gridarta/utils/ImageUtils.java Modified: trunk/utils/src/app/net/sf/gridarta/utils/ImageUtils.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/ImageUtils.java 2010-06-08 22:28:21 UTC (rev 8284) +++ trunk/utils/src/app/net/sf/gridarta/utils/ImageUtils.java 2010-06-08 22:28:57 UTC (rev 8285) @@ -72,7 +72,7 @@ tracker.waitForID(id); } catch (final InterruptedException ex) { Thread.currentThread().interrupt(); - throw new AssertionError(); // XXX + throw new AssertionError(ex); // XXX } tracker.removeImage(scaledImage, id); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 22:28:27
|
Revision: 8284 http://gridarta.svn.sourceforge.net/gridarta/?rev=8284&view=rev Author: akirschbaum Date: 2010-06-08 22:28:21 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Add final modifier. Modified Paths: -------------- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java Modified: trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:27:50 UTC (rev 8283) +++ trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:28:21 UTC (rev 8284) @@ -95,7 +95,7 @@ * @serial include */ @Nullable - private File dir; + private final File dir; /** * The Process. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 22:27:56
|
Revision: 8283 http://gridarta.svn.sourceforge.net/gridarta/?rev=8283&view=rev Author: akirschbaum Date: 2010-06-08 22:27:50 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Add @NotNull/@Nullable annotations. Modified Paths: -------------- trunk/utils/src/test/net/sf/gridarta/utils/StringUtilsTest.java Modified: trunk/utils/src/test/net/sf/gridarta/utils/StringUtilsTest.java =================================================================== --- trunk/utils/src/test/net/sf/gridarta/utils/StringUtilsTest.java 2010-06-08 22:26:30 UTC (rev 8282) +++ trunk/utils/src/test/net/sf/gridarta/utils/StringUtilsTest.java 2010-06-08 22:27:50 UTC (rev 8283) @@ -70,7 +70,7 @@ * @param input the input string * @param output the expected output string */ - private static void testRemoveTrailingWhitespaceFromLines(final CharSequence input, final String output) { + private static void testRemoveTrailingWhitespaceFromLines(@NotNull final CharSequence input, @NotNull final String output) { Assert.assertEquals(output, StringUtils.removeTrailingWhitespaceFromLines(input)); } @@ -91,7 +91,7 @@ * @param input the input string * @param output the expected output string */ - private static void testEnsureTrailingNewline(final String input, final String output) { + private static void testEnsureTrailingNewline(@NotNull final String input, @NotNull final String output) { Assert.assertEquals(output, StringUtils.ensureTrailingNewline(input)); } @@ -122,7 +122,7 @@ * @param expectedTrue the expected return value if 'ignoreValues' is * <code>true</code> */ - private static void testDiffTextString(final CharSequence base, final String str, final String expectedFalse, final String expectedTrue) { + private static void testDiffTextString(@NotNull final CharSequence base, @NotNull final String str, @Nullable final String expectedFalse, @Nullable final String expectedTrue) { Assert.assertEquals(expectedFalse, StringUtils.diffTextString(base, str, false)); Assert.assertEquals(expectedTrue, StringUtils.diffTextString(base, str, true)); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 22:26:36
|
Revision: 8282 http://gridarta.svn.sourceforge.net/gridarta/?rev=8282&view=rev Author: akirschbaum Date: 2010-06-08 22:26:30 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Cache icon. Modified Paths: -------------- trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java Modified: trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java 2010-06-08 22:24:05 UTC (rev 8281) +++ trunk/utils/src/app/net/sf/gridarta/utils/SystemIcons.java 2010-06-08 22:26:30 UTC (rev 8282) @@ -240,7 +240,9 @@ @NotNull public ImageIcon getNoArchSquareIcon() { - noarchSquareIcon = guiUtils.getResourceIcon(SQUARE_NO_ARCH); + if (noarchSquareIcon == null) { + noarchSquareIcon = guiUtils.getResourceIcon(SQUARE_NO_ARCH); + } return noarchSquareIcon; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 22:24:11
|
Revision: 8281 http://gridarta.svn.sourceforge.net/gridarta/?rev=8281&view=rev Author: akirschbaum Date: 2010-06-08 22:24:05 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/gridarta.ipr Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-06-08 22:23:29 UTC (rev 8280) +++ trunk/gridarta.ipr 2010-06-08 22:24:05 UTC (rev 8281) @@ -1242,6 +1242,7 @@ <w>microsystems</w> <w>missorted</w> <w>mmorpg</w> + <w>monospaced</w> <w>mpart</w> <w>multi</w> <w>nesw</w> @@ -1299,6 +1300,7 @@ <w>sourceforge</w> <w>spawnpoint</w> <w>startup</w> + <w>stdtxt</w> <w>stoneglow</w> <w>strncmp</w> <w>sublicense</w> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 22:23:35
|
Revision: 8280 http://gridarta.svn.sourceforge.net/gridarta/?rev=8280&view=rev Author: akirschbaum Date: 2010-06-08 22:23:29 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java Modified: trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:22:15 UTC (rev 8279) +++ trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:23:29 UTC (rev 8280) @@ -219,32 +219,6 @@ } /** - * Get the command to be executed by this ProcessRunner. - * @return command - */ - @NotNull - public String getCommand() { - return command; - } - - /** - * Set the working directory. - * @param dir working directory - */ - public void setDir(@Nullable final File dir) { - this.dir = dir; - } - - /** - * Get the working directory. - * @return working directory - */ - @Nullable - public File getDir() { - return dir; - } - - /** * Action method for starting. */ @ActionMethod This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 22:22:21
|
Revision: 8279 http://gridarta.svn.sourceforge.net/gridarta/?rev=8279&view=rev Author: akirschbaum Date: 2010-06-08 22:22:15 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Add assert statements. Modified Paths: -------------- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java Modified: trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:21:02 UTC (rev 8278) +++ trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:22:15 UTC (rev 8279) @@ -320,7 +320,7 @@ * BufferedReader to read from. */ @Nullable - private InputStream in; + private InputStream in = null; /** * JTextArea to write to. @@ -353,6 +353,7 @@ try { final byte[] buf = new byte[4096]; while (true) { + assert in != null; final int bytesRead = in.read(buf); if (bytesRead == -1) { break; @@ -363,6 +364,7 @@ // appender.append(title, line, "\n"); //} } finally { + assert in != null; in.close(); } } catch (final IOException e) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 22:21:08
|
Revision: 8278 http://gridarta.svn.sourceforge.net/gridarta/?rev=8278&view=rev Author: akirschbaum Date: 2010-06-08 22:21:02 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java Modified: trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:19:52 UTC (rev 8277) +++ trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:21:02 UTC (rev 8278) @@ -254,15 +254,21 @@ try { try { process.getInputStream().close(); - } catch (final IOException e) { /* ignore */ } + } catch (final IOException ignored) { + // ignore + } try { process.getErrorStream().close(); - } catch (final IOException e) { /* ignore */ } + } catch (final IOException ignored) { + // ignore + } try { process.getOutputStream().close(); - } catch (final IOException e) { /* ignore */ } + } catch (final IOException ignored) { + // ignore + } process.exitValue(); - } catch (final IllegalThreadStateException e) { + } catch (final IllegalThreadStateException ignored) { log.error("Still running!"); // Process is still running, don't start a new one return; @@ -378,8 +384,8 @@ try { assert in != null; in.close(); - } catch (final IOException e) { - /* ignore */ + } catch (final IOException ignored) { + // ignore } if (log.isInfoEnabled()) { log.info("Stopped previous stream."); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 22:19:58
|
Revision: 8277 http://gridarta.svn.sourceforge.net/gridarta/?rev=8277&view=rev Author: akirschbaum Date: 2010-06-08 22:19:52 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Remove ProcessRunner.controlClear. Modified Paths: -------------- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java Modified: trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:18:56 UTC (rev 8276) +++ trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:19:52 UTC (rev 8277) @@ -139,13 +139,6 @@ private final Action controlStop = ACTION_BUILDER.createAction(false, "controlStop", this); /** - * Action for clearing the log. - * @serial include - */ - @NotNull - private final Action controlClear = ACTION_BUILDER.createAction(false, "controlClear", this); - - /** * The lock object for thread synchronization. */ @NotNull @@ -175,7 +168,7 @@ final JToolBar toolBar = new JToolBar(); toolBar.add(controlStart); toolBar.add(controlStop); - toolBar.add(controlClear); + toolBar.add(ACTION_BUILDER.createAction(false, "controlClear", this)); toolBar.add(new JLabel(ACTION_BUILDER.getString("controlCloseOkay"))); controlStop.setEnabled(false); add(toolBar, BorderLayout.SOUTH); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 22:19:02
|
Revision: 8276 http://gridarta.svn.sourceforge.net/gridarta/?rev=8276&view=rev Author: akirschbaum Date: 2010-06-08 22:18:56 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Explicitly initialize fields. Modified Paths: -------------- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java Modified: trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:13:10 UTC (rev 8275) +++ trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:18:56 UTC (rev 8276) @@ -74,7 +74,7 @@ * @serial include */ @Nullable - private Window dialog; + private Window dialog = null; /** * The i18n key. @@ -101,7 +101,7 @@ * The Process. */ @Nullable - private transient Process process; + private transient Process process = null; /** * JTextArea with log. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 22:13:16
|
Revision: 8275 http://gridarta.svn.sourceforge.net/gridarta/?rev=8275&view=rev Author: akirschbaum Date: 2010-06-08 22:13:10 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Remove nested assignment. Modified Paths: -------------- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java Modified: trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:10:31 UTC (rev 8274) +++ trunk/utils/src/app/net/sf/gridarta/utils/ProcessRunner.java 2010-06-08 22:13:10 UTC (rev 8275) @@ -353,7 +353,11 @@ try { try { final byte[] buf = new byte[4096]; - for (int bytesRead; (bytesRead = in.read(buf)) != -1;) { + while (true) { + final int bytesRead = in.read(buf); + if (bytesRead == -1) { + break; + } appender.append(new String(buf, 0, bytesRead)); } //for (String line; (line = in.readLine()) != null;) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 22:10:38
|
Revision: 8274 http://gridarta.svn.sourceforge.net/gridarta/?rev=8274&view=rev Author: akirschbaum Date: 2010-06-08 22:10:31 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Do not ignore caught exception. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/mapfiles/InvalidNameException.java trunk/src/app/net/sf/gridarta/mapfiles/Loader.java Modified: trunk/src/app/net/sf/gridarta/mapfiles/InvalidNameException.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapfiles/InvalidNameException.java 2010-06-08 22:06:10 UTC (rev 8273) +++ trunk/src/app/net/sf/gridarta/mapfiles/InvalidNameException.java 2010-06-08 22:10:31 UTC (rev 8274) @@ -37,7 +37,7 @@ * @param name the invalid name */ public InvalidNameException(@NotNull final String name) { - super("invalid name: " + name); + super(name); } } // InvalidNameException Modified: trunk/src/app/net/sf/gridarta/mapfiles/Loader.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapfiles/Loader.java 2010-06-08 22:06:10 UTC (rev 8273) +++ trunk/src/app/net/sf/gridarta/mapfiles/Loader.java 2010-06-08 22:10:31 UTC (rev 8274) @@ -117,7 +117,7 @@ try { mapFolder = new MapFolder<G, A, R>(parent, folderName, baseDir, mapViewsManager); } catch (final InvalidNameException ex) { - errorViewCollector.addWarning(ErrorViewCategory.PICKMAPS_DIR_INVALID, "ignoring pickmap folder with invalid name: " + folderName); + errorViewCollector.addWarning(ErrorViewCategory.PICKMAPS_DIR_INVALID, "ignoring pickmap folder with invalid name: " + ex.getMessage()); return null; } try { @@ -134,7 +134,7 @@ try { mapFolder.addPickmap(file.getName(), mapReaderFactory, pickmapManager); } catch (final InvalidNameException ex) { - errorViewCollector.addWarning(ErrorViewCategory.PICKMAPS_FILE_INVALID, "ignoring pickmap with invalid name: " + file); + errorViewCollector.addWarning(ErrorViewCategory.PICKMAPS_FILE_INVALID, "ignoring pickmap with invalid name: " + ex.getMessage()); } } else if (file.isDirectory()) { if (!file.getName().startsWith(".")) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 22:06:16
|
Revision: 8273 http://gridarta.svn.sourceforge.net/gridarta/?rev=8273&view=rev Author: akirschbaum Date: 2010-06-08 22:06:10 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Make project compilable. Added Paths: ----------- trunk/src/test/net/sf/gridarta/model/ trunk/src/test/net/sf/gridarta/model/gameobject/ trunk/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java Removed Paths: ------------- trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java Deleted: trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java =================================================================== --- trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java 2010-06-08 21:39:12 UTC (rev 8272) +++ trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java 2010-06-08 22:06:10 UTC (rev 8273) @@ -1,69 +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.map.maparchobject.TestMapArchObject; -import net.sf.gridarta.model.map.mapcontrol.MapControl; -import net.sf.gridarta.model.map.mapmodel.MapModel; -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 - */ - @Test - public void testDoMoveSquareTopSingle() throws DuplicateArchetypeException { - final TestMapControlCreator testMapControlCreator = new TestMapControlCreator(); - 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 = testMapControlCreator.insertFloor(mapModel, point); - final TestGameObject ob2 = testMapControlCreator.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 Copied: trunk/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java (from rev 8272, trunk/model/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java) =================================================================== --- trunk/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java (rev 0) +++ trunk/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.java 2010-06-08 22:06:10 UTC (rev 8273) @@ -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 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.map.maparchobject.TestMapArchObject; +import net.sf.gridarta.model.map.mapcontrol.MapControl; +import net.sf.gridarta.model.map.mapmodel.MapModel; +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 + */ + @Test + public void testDoMoveSquareTopSingle() throws DuplicateArchetypeException { + final TestMapControlCreator testMapControlCreator = new TestMapControlCreator(); + 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 = testMapControlCreator.insertFloor(mapModel, point); + final TestGameObject ob2 = testMapControlCreator.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 Property changes on: trunk/src/test/net/sf/gridarta/model/gameobject/GameObjectFactoryTest.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-06-08 21:39:19
|
Revision: 8272 http://gridarta.svn.sourceforge.net/gridarta/?rev=8272&view=rev Author: akirschbaum Date: 2010-06-08 21:39:12 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Move model sources out of main source directory. Modified Paths: -------------- trunk/atrinik/build.xml trunk/atrinik.iml trunk/build.xml trunk/crossfire/build.xml trunk/crossfire.iml trunk/daimonin/build.xml trunk/daimonin.iml trunk/gridarta.iml trunk/gridarta.ipr Added Paths: ----------- trunk/model/ trunk/model/src/ trunk/model/src/app/ trunk/model/src/app/net/ trunk/model/src/app/net/sf/ trunk/model/src/app/net/sf/gridarta/ trunk/model/src/app/net/sf/gridarta/model/ trunk/model/src/test/ trunk/model/src/test/net/ trunk/model/src/test/net/sf/ trunk/model/src/test/net/sf/gridarta/ trunk/model/src/test/net/sf/gridarta/model/ trunk/model.iml trunk/src/test/model/ trunk/src/test/model/gameobject/ trunk/src/test/model/gameobject/GameObjectFactoryTest.java trunk/utils/src/app/net/sf/gridarta/gui/ trunk/utils/src/app/net/sf/gridarta/gui/utils/ trunk/utils/src/app/net/sf/gridarta/gui/utils/GUIConstants.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/utils/GUIConstants.java trunk/src/app/net/sf/gridarta/model/ trunk/src/test/net/sf/gridarta/model/ Modified: trunk/atrinik/build.xml =================================================================== --- trunk/atrinik/build.xml 2010-06-08 21:07:47 UTC (rev 8271) +++ trunk/atrinik/build.xml 2010-06-08 21:39:12 UTC (rev 8272) @@ -92,7 +92,7 @@ <!-- compiling all Java classes --> <target name="compile" depends="init,clean,ctags" description="compiles source."> - <javac srcdir="${src.dir}:../src/app:../textedit/src/app:../utils/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> + <javac srcdir="${src.dir}:../src/app:../textedit/src/app:../utils/src/app:../model/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> <classpath> <fileset dir="${lib.dir}" includes="*.jar"/> <fileset dir="../lib/" includes="*.jar"/> @@ -118,6 +118,7 @@ <fileset dir="../src/app" excludes="**/*.java,**/package.html,**/overview.html"/> <fileset dir="../textedit/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> <fileset dir="../utils/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> + <fileset dir="../model/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> </copy> <copy todir="${build.dir.production}"> <fileset dir="${src.dir}" includes="**/*.properties"/> Modified: trunk/atrinik.iml =================================================================== --- trunk/atrinik.iml 2010-06-08 21:07:47 UTC (rev 8271) +++ trunk/atrinik.iml 2010-06-08 21:39:12 UTC (rev 8272) @@ -85,6 +85,7 @@ <SOURCES /> </library> </orderEntry> + <orderEntry type="module" module-name="model" /> </component> </module> Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2010-06-08 21:07:47 UTC (rev 8271) +++ trunk/build.xml 2010-06-08 21:39:12 UTC (rev 8272) @@ -89,7 +89,7 @@ <target name="compile" description="Compiles the Gridarta sources."> <mkdir dir="dest/app"/> - <javac srcdir="src/app:textedit/src/app:utils/src/app:atrinik/src/app:crossfire/src/app:daimonin/src/app" destdir="dest/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> + <javac srcdir="src/app:textedit/src/app:utils/src/app:model/src/app:atrinik/src/app:crossfire/src/app:daimonin/src/app" destdir="dest/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> <classpath> <fileset dir="lib" includes="annotations.jar"/> <fileset dir="lib" includes="bsh-classgen-2.0b4.jar"/> @@ -184,6 +184,7 @@ <pathelement path="src/app"/> <pathelement path="textedit/src/app"/> <pathelement path="utils/src/app"/> + <pathelement path="model/src/app"/> <pathelement path="atrinik/src/app"/> <pathelement path="crossfire/src/app"/> <pathelement path="daimonin/src/app"/> @@ -191,6 +192,7 @@ <packageset dir="src/app" defaultexcludes="yes"/> <packageset dir="textedit/src/app" defaultexcludes="yes"/> <packageset dir="utils/src/app" defaultexcludes="yes"/> + <packageset dir="model/src/app" defaultexcludes="yes"/> <packageset dir="atrinik/src/app" defaultexcludes="yes"/> <packageset dir="crossfire/src/app" defaultexcludes="yes"/> <packageset dir="daimonin/src/app" defaultexcludes="yes"/> @@ -374,6 +376,8 @@ <fileset dir="textedit/src/app" includes="**/*.java"/> <fileset dir="utils/src/app" includes="**/*.java"/> <fileset dir="utils/src/test" includes="**/*.java"/> + <fileset dir="model/src/app" includes="**/*.java"/> + <fileset dir="model/src/test" includes="**/*.java"/> <fileset dir="atrinik/src/app" includes="**/*.java"/> <fileset dir="atrinik/src/test" includes="**/*.java"/> <fileset dir="crossfire/src/app" includes="**/*.java"/> @@ -414,6 +418,8 @@ <pathelement path="textedit/src/app"/> <pathelement path="utils/src/app"/> <pathelement path="utils/src/test"/> + <pathelement path="model/src/app"/> + <pathelement path="model/src/test"/> <pathelement path="atrinik/src/app"/> <pathelement path="atrinik/src/test"/> <pathelement path="crossfire/src/app"/> @@ -426,6 +432,8 @@ <packageset dir="textedit/src/app" defaultexcludes="yes"/> <packageset dir="utils/src/app" defaultexcludes="yes"/> <packageset dir="utils/src/test" defaultexcludes="yes"/> + <packageset dir="model/src/app" defaultexcludes="yes"/> + <packageset dir="model/src/test" defaultexcludes="yes"/> <packageset dir="atrinik/src/app" defaultexcludes="yes"/> <packageset dir="atrinik/src/test" defaultexcludes="yes"/> <packageset dir="crossfire/src/app" defaultexcludes="yes"/> @@ -463,7 +471,7 @@ <target name="test" description="executes the junit tests." depends="compile"> <mkdir dir="classes/test"/> <mkdir dir="docs/test"/> - <javac srcdir="src/test:atrinik/src/test:crossfire/src/test:daimonin/src/test" destdir="classes/test" encoding="utf-8" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> + <javac srcdir="src/test:model/src/test:utils/src/test:atrinik/src/test:crossfire/src/test:daimonin/src/test" destdir="classes/test" encoding="utf-8" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="yes"> <classpath> <fileset dir="lib" includes="annotations.jar"/> <fileset dir="lib" includes="bsh-classgen-2.0b4.jar"/> @@ -495,6 +503,8 @@ <fileset dir="textedit/src/app" includes="**/*.properties,**/*.testdata"/> <fileset dir="utils/src/app" includes="**/*.properties,**/*.testdata"/> <fileset dir="utils/src/test" includes="**/*.properties,**/*.testdata"/> + <fileset dir="model/src/app" includes="**/*.properties,**/*.testdata"/> + <fileset dir="model/src/test" includes="**/*.properties,**/*.testdata"/> <fileset dir="atrinik/src/test" includes="**/*.properties,**/*.testdata"/> <fileset dir="atrinik/src/app" includes="**/*.properties,**/*.testdata"/> <fileset dir="crossfire/src/test" includes="**/*.properties,**/*.testdata"/> Modified: trunk/crossfire/build.xml =================================================================== --- trunk/crossfire/build.xml 2010-06-08 21:07:47 UTC (rev 8271) +++ trunk/crossfire/build.xml 2010-06-08 21:39:12 UTC (rev 8272) @@ -90,7 +90,7 @@ <!-- compiling all Java classes --> <target name="compile" depends="init,clean,ctags" description="compiles source."> - <javac srcdir="${src.dir}:../src/app:../textedit/src/app:../utils/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> + <javac srcdir="${src.dir}:../src/app:../textedit/src/app:../utils/src/app:../model/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> <classpath> <fileset dir="${lib.dir}" includes="*.jar"/> <fileset dir="../lib/" includes="*.jar"/> @@ -129,6 +129,7 @@ <fileset dir="../src/app" excludes="**/*.java,**/package.html,**/overview.html"/> <fileset dir="../textedit/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> <fileset dir="../utils/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> + <fileset dir="../model/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> <fileset dir="../resource"> <include name="icons/**"/> <include name="log4j.properties"/> @@ -184,6 +185,9 @@ <packageset dir="../utils/src/app" defaultexcludes="yes"> <include name="**"/> </packageset> + <packageset dir="../model/src/app" defaultexcludes="yes"> + <include name="**"/> + </packageset> <tag name="todo" description="Todo:"/> <tag name="used" description="Manually marked as used." enabled="false"/> <tag name="fixme" description="Fixme:"/> Modified: trunk/crossfire.iml =================================================================== --- trunk/crossfire.iml 2010-06-08 21:07:47 UTC (rev 8271) +++ trunk/crossfire.iml 2010-06-08 21:39:12 UTC (rev 8272) @@ -122,6 +122,7 @@ <SOURCES /> </library> </orderEntry> + <orderEntry type="module" module-name="model" /> </component> </module> Modified: trunk/daimonin/build.xml =================================================================== --- trunk/daimonin/build.xml 2010-06-08 21:07:47 UTC (rev 8271) +++ trunk/daimonin/build.xml 2010-06-08 21:39:12 UTC (rev 8272) @@ -92,7 +92,7 @@ <!-- compiling all Java classes --> <target name="compile" depends="init,clean,ctags" description="compiles source."> - <javac srcdir="${src.dir}:../src/app:../textedit/src/app:../utils/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> + <javac srcdir="${src.dir}:../src/app:../textedit/src/app:../utils/src/app:../model/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> <classpath> <fileset dir="${lib.dir}" includes="*.jar"/> <fileset dir="../lib/" includes="*.jar"/> @@ -118,6 +118,7 @@ <fileset dir="../src/app" excludes="**/*.java,**/package.html,**/overview.html"/> <fileset dir="../textedit/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> <fileset dir="../utils/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> + <fileset dir="../model/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> </copy> <copy todir="${build.dir.production}"> <fileset dir="${src.dir}" includes="**/*.properties"/> Modified: trunk/daimonin.iml =================================================================== --- trunk/daimonin.iml 2010-06-08 21:07:47 UTC (rev 8271) +++ trunk/daimonin.iml 2010-06-08 21:39:12 UTC (rev 8272) @@ -84,6 +84,7 @@ <SOURCES /> </library> </orderEntry> + <orderEntry type="module" module-name="model" /> </component> </module> Modified: trunk/gridarta.iml =================================================================== --- trunk/gridarta.iml 2010-06-08 21:07:47 UTC (rev 8271) +++ trunk/gridarta.iml 2010-06-08 21:39:12 UTC (rev 8272) @@ -185,6 +185,7 @@ <SOURCES /> </library> </orderEntry> + <orderEntry type="module" module-name="model" /> </component> </module> Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-06-08 21:07:47 UTC (rev 8271) +++ trunk/gridarta.ipr 2010-06-08 21:39:12 UTC (rev 8272) @@ -1364,6 +1364,7 @@ <module fileurl="file://$PROJECT_DIR$/crossfire.iml" filepath="$PROJECT_DIR$/crossfire.iml" /> <module fileurl="file://$PROJECT_DIR$/daimonin.iml" filepath="$PROJECT_DIR$/daimonin.iml" /> <module fileurl="file://$PROJECT_DIR$/gridarta.iml" filepath="$PROJECT_DIR$/gridarta.iml" /> + <module fileurl="file://$PROJECT_DIR$/model.iml" filepath="$PROJECT_DIR$/model.iml" /> <module fileurl="file://$PROJECT_DIR$/preferences.iml" filepath="$PROJECT_DIR$/preferences.iml" /> <module fileurl="file://$PROJECT_DIR$/textedit.iml" filepath="$PROJECT_DIR$/textedit.iml" /> <module fileurl="file://$PROJECT_DIR$/utils.iml" filepath="$PROJECT_DIR$/utils.iml" /> Added: trunk/model.iml =================================================================== --- trunk/model.iml (rev 0) +++ trunk/model.iml 2010-06-08 21:39:12 UTC (rev 8272) @@ -0,0 +1,86 @@ +<?xml version="1.0" encoding="UTF-8"?> +<module type="JAVA_MODULE" version="4"> + <component name="NewModuleRootManager" inherit-compiler-output="true"> + <exclude-output /> + <content url="file://$MODULE_DIR$/model"> + <sourceFolder url="file://$MODULE_DIR$/model/src/app" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/model/src/test" isTestSource="true" /> + </content> + <orderEntry type="inheritedJdk" /> + <orderEntry type="sourceFolder" forTests="false" /> + <orderEntry type="module" module-name="utils" /> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/annotations.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-action-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/japi-lib-swing-misc-trunk-1398.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/log4j-1.2.13.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/japi-lib-util-trunk-1379.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/jdom.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/japi-lib-xml-0.1.0.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + <orderEntry type="module-library"> + <library> + <CLASSES> + <root url="jar://$MODULE_DIR$/lib/junit-4.2.jar!/" /> + </CLASSES> + <JAVADOC /> + <SOURCES /> + </library> + </orderEntry> + </component> +</module> + Property changes on: trunk/model.iml ___________________________________________________________________ Added: svn:mime-type + text/xml Added: svn:eol-style + LF Deleted: trunk/src/app/net/sf/gridarta/gui/utils/GUIConstants.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/GUIConstants.java 2010-06-08 21:07:47 UTC (rev 8271) +++ trunk/src/app/net/sf/gridarta/gui/utils/GUIConstants.java 2010-06-08 21:39:12 UTC (rev 8272) @@ -1,41 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.utils; - -import java.awt.Insets; -import javax.swing.border.Border; -import javax.swing.border.EmptyBorder; - -/** - * Defines common UI constants used in different dialogs. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author Andreas Kirschbaum - */ -public interface GUIConstants { - - /** - * The Border object to be used when creating dialogs. - */ - Border DIALOG_BORDER = new EmptyBorder(new Insets(4, 4, 4, 4)); - - int EDIT_TYPE_NONE = 0x10000; // special case - -} // interface GUIConstants Added: trunk/src/test/model/gameobject/GameObjectFactoryTest.java =================================================================== --- trunk/src/test/model/gameobject/GameObjectFactoryTest.java (rev 0) +++ trunk/src/test/model/gameobject/GameObjectFactoryTest.java 2010-06-08 21:39:12 UTC (rev 8272) @@ -0,0 +1,73 @@ +/* + * 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 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.gameobject.GameObject; +import net.sf.gridarta.model.gameobject.GameObjectFactory; +import net.sf.gridarta.model.gameobject.TestGameObject; +import net.sf.gridarta.model.map.maparchobject.TestMapArchObject; +import net.sf.gridarta.model.map.mapcontrol.MapControl; +import net.sf.gridarta.model.map.mapmodel.MapModel; +import net.sf.gridarta.utils.Size2D; +import org.junit.Assert; +import org.junit.Test; + +/** + * Regression tests for {@link GameObjectFactory}. + * @author Andreas Kirschbaum + * XXX: should be in model module + */ +public class GameObjectFactoryTest { + + /** + * Checks that {@link + * net.sf.gridarta.model.gameobject.GameObjectFactory#cloneGameObject(GameObject)} + * correctly updates the container. + * @throws DuplicateArchetypeException if the test fails + */ + @Test + public void testDoMoveSquareTopSingle() throws DuplicateArchetypeException { + final TestMapControlCreator testMapControlCreator = new TestMapControlCreator(); + 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 = testMapControlCreator.insertFloor(mapModel, point); + final TestGameObject ob2 = testMapControlCreator.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 Property changes on: trunk/src/test/model/gameobject/GameObjectFactoryTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Copied: trunk/utils/src/app/net/sf/gridarta/gui/utils/GUIConstants.java (from rev 8271, trunk/src/app/net/sf/gridarta/gui/utils/GUIConstants.java) =================================================================== --- trunk/utils/src/app/net/sf/gridarta/gui/utils/GUIConstants.java (rev 0) +++ trunk/utils/src/app/net/sf/gridarta/gui/utils/GUIConstants.java 2010-06-08 21:39:12 UTC (rev 8272) @@ -0,0 +1,41 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.utils; + +import java.awt.Insets; +import javax.swing.border.Border; +import javax.swing.border.EmptyBorder; + +/** + * Defines common UI constants used in different dialogs. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @author Andreas Kirschbaum + */ +public interface GUIConstants { + + /** + * The Border object to be used when creating dialogs. + */ + Border DIALOG_BORDER = new EmptyBorder(new Insets(4, 4, 4, 4)); + + int EDIT_TYPE_NONE = 0x10000; // special case + +} // interface GUIConstants Property changes on: trunk/utils/src/app/net/sf/gridarta/gui/utils/GUIConstants.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-06-08 21:07:54
|
Revision: 8271 http://gridarta.svn.sourceforge.net/gridarta/?rev=8271&view=rev Author: akirschbaum Date: 2010-06-08 21:07:47 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Move utils sources out of main source directory. Modified Paths: -------------- trunk/atrinik/build.xml trunk/build.xml trunk/crossfire/build.xml trunk/daimonin/build.xml trunk/utils.iml Added Paths: ----------- trunk/utils/ trunk/utils/src/ trunk/utils/src/app/ trunk/utils/src/app/net/ trunk/utils/src/app/net/sf/ trunk/utils/src/app/net/sf/gridarta/ trunk/utils/src/app/net/sf/gridarta/MainControl.java trunk/utils/src/app/net/sf/gridarta/utils/ trunk/utils/src/test/ trunk/utils/src/test/net/ trunk/utils/src/test/net/sf/ trunk/utils/src/test/net/sf/gridarta/ trunk/utils/src/test/net/sf/gridarta/utils/ Removed Paths: ------------- trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/utils/ trunk/src/test/net/sf/gridarta/utils/ Modified: trunk/atrinik/build.xml =================================================================== --- trunk/atrinik/build.xml 2010-06-08 21:00:12 UTC (rev 8270) +++ trunk/atrinik/build.xml 2010-06-08 21:07:47 UTC (rev 8271) @@ -92,7 +92,7 @@ <!-- compiling all Java classes --> <target name="compile" depends="init,clean,ctags" description="compiles source."> - <javac srcdir="${src.dir}:../src/app:../textedit/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> + <javac srcdir="${src.dir}:../src/app:../textedit/src/app:../utils/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> <classpath> <fileset dir="${lib.dir}" includes="*.jar"/> <fileset dir="../lib/" includes="*.jar"/> @@ -117,6 +117,7 @@ <copy todir="${build.dir.production}"> <fileset dir="../src/app" excludes="**/*.java,**/package.html,**/overview.html"/> <fileset dir="../textedit/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> + <fileset dir="../utils/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> </copy> <copy todir="${build.dir.production}"> <fileset dir="${src.dir}" includes="**/*.properties"/> Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2010-06-08 21:00:12 UTC (rev 8270) +++ trunk/build.xml 2010-06-08 21:07:47 UTC (rev 8271) @@ -89,7 +89,7 @@ <target name="compile" description="Compiles the Gridarta sources."> <mkdir dir="dest/app"/> - <javac srcdir="src/app:textedit/src/app:atrinik/src/app:crossfire/src/app:daimonin/src/app" destdir="dest/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> + <javac srcdir="src/app:textedit/src/app:utils/src/app:atrinik/src/app:crossfire/src/app:daimonin/src/app" destdir="dest/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> <classpath> <fileset dir="lib" includes="annotations.jar"/> <fileset dir="lib" includes="bsh-classgen-2.0b4.jar"/> @@ -183,12 +183,14 @@ <pathelement path="${user.javadoc.javasrc}"/> <pathelement path="src/app"/> <pathelement path="textedit/src/app"/> + <pathelement path="utils/src/app"/> <pathelement path="atrinik/src/app"/> <pathelement path="crossfire/src/app"/> <pathelement path="daimonin/src/app"/> </sourcepath> <packageset dir="src/app" defaultexcludes="yes"/> <packageset dir="textedit/src/app" defaultexcludes="yes"/> + <packageset dir="utils/src/app" defaultexcludes="yes"/> <packageset dir="atrinik/src/app" defaultexcludes="yes"/> <packageset dir="crossfire/src/app" defaultexcludes="yes"/> <packageset dir="daimonin/src/app" defaultexcludes="yes"/> @@ -370,6 +372,8 @@ <fileset dir="src/app" includes="**/*.java"/> <fileset dir="src/test" includes="**/*.java"/> <fileset dir="textedit/src/app" includes="**/*.java"/> + <fileset dir="utils/src/app" includes="**/*.java"/> + <fileset dir="utils/src/test" includes="**/*.java"/> <fileset dir="atrinik/src/app" includes="**/*.java"/> <fileset dir="atrinik/src/test" includes="**/*.java"/> <fileset dir="crossfire/src/app" includes="**/*.java"/> @@ -408,6 +412,8 @@ <pathelement path="src/app"/> <pathelement path="src/test"/> <pathelement path="textedit/src/app"/> + <pathelement path="utils/src/app"/> + <pathelement path="utils/src/test"/> <pathelement path="atrinik/src/app"/> <pathelement path="atrinik/src/test"/> <pathelement path="crossfire/src/app"/> @@ -418,6 +424,8 @@ <packageset dir="src/app" defaultexcludes="yes"/> <packageset dir="src/test" defaultexcludes="yes"/> <packageset dir="textedit/src/app" defaultexcludes="yes"/> + <packageset dir="utils/src/app" defaultexcludes="yes"/> + <packageset dir="utils/src/test" defaultexcludes="yes"/> <packageset dir="atrinik/src/app" defaultexcludes="yes"/> <packageset dir="atrinik/src/test" defaultexcludes="yes"/> <packageset dir="crossfire/src/app" defaultexcludes="yes"/> @@ -485,6 +493,8 @@ <fileset dir="src/test" includes="**/*.properties,**/*.testdata"/> <fileset dir="src/app" includes="**/*.properties,**/*.testdata"/> <fileset dir="textedit/src/app" includes="**/*.properties,**/*.testdata"/> + <fileset dir="utils/src/app" includes="**/*.properties,**/*.testdata"/> + <fileset dir="utils/src/test" includes="**/*.properties,**/*.testdata"/> <fileset dir="atrinik/src/test" includes="**/*.properties,**/*.testdata"/> <fileset dir="atrinik/src/app" includes="**/*.properties,**/*.testdata"/> <fileset dir="crossfire/src/test" includes="**/*.properties,**/*.testdata"/> Modified: trunk/crossfire/build.xml =================================================================== --- trunk/crossfire/build.xml 2010-06-08 21:00:12 UTC (rev 8270) +++ trunk/crossfire/build.xml 2010-06-08 21:07:47 UTC (rev 8271) @@ -90,7 +90,7 @@ <!-- compiling all Java classes --> <target name="compile" depends="init,clean,ctags" description="compiles source."> - <javac srcdir="${src.dir}:../src/app:../textedit/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> + <javac srcdir="${src.dir}:../src/app:../textedit/src/app:../utils/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> <classpath> <fileset dir="${lib.dir}" includes="*.jar"/> <fileset dir="../lib/" includes="*.jar"/> @@ -128,6 +128,7 @@ </fileset> <fileset dir="../src/app" excludes="**/*.java,**/package.html,**/overview.html"/> <fileset dir="../textedit/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> + <fileset dir="../utils/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> <fileset dir="../resource"> <include name="icons/**"/> <include name="log4j.properties"/> @@ -180,6 +181,9 @@ <packageset dir="../textedit/src/app" defaultexcludes="yes"> <include name="**"/> </packageset> + <packageset dir="../utils/src/app" defaultexcludes="yes"> + <include name="**"/> + </packageset> <tag name="todo" description="Todo:"/> <tag name="used" description="Manually marked as used." enabled="false"/> <tag name="fixme" description="Fixme:"/> Modified: trunk/daimonin/build.xml =================================================================== --- trunk/daimonin/build.xml 2010-06-08 21:00:12 UTC (rev 8270) +++ trunk/daimonin/build.xml 2010-06-08 21:07:47 UTC (rev 8271) @@ -92,7 +92,7 @@ <!-- compiling all Java classes --> <target name="compile" depends="init,clean,ctags" description="compiles source."> - <javac srcdir="${src.dir}:../src/app:../textedit/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> + <javac srcdir="${src.dir}:../src/app:../textedit/src/app:../utils/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> <classpath> <fileset dir="${lib.dir}" includes="*.jar"/> <fileset dir="../lib/" includes="*.jar"/> @@ -117,6 +117,7 @@ <copy todir="${build.dir.production}"> <fileset dir="../src/app" excludes="**/*.java,**/package.html,**/overview.html"/> <fileset dir="../textedit/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> + <fileset dir="../utils/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> </copy> <copy todir="${build.dir.production}"> <fileset dir="${src.dir}" includes="**/*.properties"/> Deleted: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2010-06-08 21:00:12 UTC (rev 8270) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2010-06-08 21:07:47 UTC (rev 8271) @@ -1,29 +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; - -/** - * Interface used as preferences location. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @noinspection InterfaceNeverImplemented,MarkerInterface - */ -public interface MainControl { - -} // interface MainControl Copied: trunk/utils/src/app/net/sf/gridarta/MainControl.java (from rev 8269, trunk/src/app/net/sf/gridarta/MainControl.java) =================================================================== --- trunk/utils/src/app/net/sf/gridarta/MainControl.java (rev 0) +++ trunk/utils/src/app/net/sf/gridarta/MainControl.java 2010-06-08 21:07:47 UTC (rev 8271) @@ -0,0 +1,29 @@ +/* + * 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; + +/** + * Interface used as preferences location. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @noinspection InterfaceNeverImplemented,MarkerInterface + */ +public interface MainControl { + +} // interface MainControl Property changes on: trunk/utils/src/app/net/sf/gridarta/MainControl.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/utils.iml =================================================================== --- trunk/utils.iml 2010-06-08 21:00:12 UTC (rev 8270) +++ trunk/utils.iml 2010-06-08 21:07:47 UTC (rev 8271) @@ -1,12 +1,10 @@ <?xml version="1.0" encoding="UTF-8"?> <module relativePaths="true" type="JAVA_MODULE" version="4"> <component name="NewModuleRootManager" inherit-compiler-output="true"> - <content url="file://$MODULE_DIR$/src/app/net/sf/gridarta/utils"> - <sourceFolder url="file://$MODULE_DIR$/src/app/net/sf/gridarta/utils" isTestSource="false" packagePrefix="net.sf.gridarta.utils" /> + <content url="file://$MODULE_DIR$/utils"> + <sourceFolder url="file://$MODULE_DIR$/utils/src/app" isTestSource="false" /> + <sourceFolder url="file://$MODULE_DIR$/utils/src/test" isTestSource="false" /> </content> - <content url="file://$MODULE_DIR$/src/test/net/sf/gridarta/utils"> - <sourceFolder url="file://$MODULE_DIR$/src/test/net/sf/gridarta/utils" isTestSource="true" packagePrefix="net.sf.gridarta.utils" /> - </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="module-library"> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 21:00:18
|
Revision: 8270 http://gridarta.svn.sourceforge.net/gridarta/?rev=8270&view=rev Author: akirschbaum Date: 2010-06-08 21:00:12 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Move textedit sources out of main source directory. Modified Paths: -------------- trunk/atrinik/build.xml trunk/build.xml trunk/crossfire/build.xml trunk/daimonin/build.xml trunk/textedit.iml Added Paths: ----------- trunk/textedit/ trunk/textedit/src/ trunk/textedit/src/app/ trunk/textedit/src/app/net/ trunk/textedit/src/app/net/sf/ trunk/textedit/src/app/net/sf/gridarta/ trunk/textedit/src/app/net/sf/gridarta/textedit/ Removed Paths: ------------- trunk/src/app/net/sf/gridarta/textedit/ Modified: trunk/atrinik/build.xml =================================================================== --- trunk/atrinik/build.xml 2010-06-08 20:34:57 UTC (rev 8269) +++ trunk/atrinik/build.xml 2010-06-08 21:00:12 UTC (rev 8270) @@ -92,7 +92,7 @@ <!-- compiling all Java classes --> <target name="compile" depends="init,clean,ctags" description="compiles source."> - <javac srcdir="${src.dir}:../src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> + <javac srcdir="${src.dir}:../src/app:../textedit/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> <classpath> <fileset dir="${lib.dir}" includes="*.jar"/> <fileset dir="../lib/" includes="*.jar"/> @@ -116,6 +116,7 @@ </copy> <copy todir="${build.dir.production}"> <fileset dir="../src/app" excludes="**/*.java,**/package.html,**/overview.html"/> + <fileset dir="../textedit/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> </copy> <copy todir="${build.dir.production}"> <fileset dir="${src.dir}" includes="**/*.properties"/> Modified: trunk/build.xml =================================================================== --- trunk/build.xml 2010-06-08 20:34:57 UTC (rev 8269) +++ trunk/build.xml 2010-06-08 21:00:12 UTC (rev 8270) @@ -89,7 +89,7 @@ <target name="compile" description="Compiles the Gridarta sources."> <mkdir dir="dest/app"/> - <javac srcdir="src/app:atrinik/src/app:crossfire/src/app:daimonin/src/app" destdir="dest/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> + <javac srcdir="src/app:textedit/src/app:atrinik/src/app:crossfire/src/app:daimonin/src/app" destdir="dest/app" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" includeantruntime="false" debug="${debug}"> <classpath> <fileset dir="lib" includes="annotations.jar"/> <fileset dir="lib" includes="bsh-classgen-2.0b4.jar"/> @@ -182,11 +182,13 @@ <sourcepath> <pathelement path="${user.javadoc.javasrc}"/> <pathelement path="src/app"/> + <pathelement path="textedit/src/app"/> <pathelement path="atrinik/src/app"/> <pathelement path="crossfire/src/app"/> <pathelement path="daimonin/src/app"/> </sourcepath> <packageset dir="src/app" defaultexcludes="yes"/> + <packageset dir="textedit/src/app" defaultexcludes="yes"/> <packageset dir="atrinik/src/app" defaultexcludes="yes"/> <packageset dir="crossfire/src/app" defaultexcludes="yes"/> <packageset dir="daimonin/src/app" defaultexcludes="yes"/> @@ -367,6 +369,7 @@ <formatter type="plain"/> <fileset dir="src/app" includes="**/*.java"/> <fileset dir="src/test" includes="**/*.java"/> + <fileset dir="textedit/src/app" includes="**/*.java"/> <fileset dir="atrinik/src/app" includes="**/*.java"/> <fileset dir="atrinik/src/test" includes="**/*.java"/> <fileset dir="crossfire/src/app" includes="**/*.java"/> @@ -404,6 +407,7 @@ <pathelement path="${user.javadoc.javasrc}"/> <pathelement path="src/app"/> <pathelement path="src/test"/> + <pathelement path="textedit/src/app"/> <pathelement path="atrinik/src/app"/> <pathelement path="atrinik/src/test"/> <pathelement path="crossfire/src/app"/> @@ -413,6 +417,7 @@ </sourcepath> <packageset dir="src/app" defaultexcludes="yes"/> <packageset dir="src/test" defaultexcludes="yes"/> + <packageset dir="textedit/src/app" defaultexcludes="yes"/> <packageset dir="atrinik/src/app" defaultexcludes="yes"/> <packageset dir="atrinik/src/test" defaultexcludes="yes"/> <packageset dir="crossfire/src/app" defaultexcludes="yes"/> @@ -479,6 +484,7 @@ <fileset dir="resource" includes="**/*.properties,**/*.dtd"/> <fileset dir="src/test" includes="**/*.properties,**/*.testdata"/> <fileset dir="src/app" includes="**/*.properties,**/*.testdata"/> + <fileset dir="textedit/src/app" includes="**/*.properties,**/*.testdata"/> <fileset dir="atrinik/src/test" includes="**/*.properties,**/*.testdata"/> <fileset dir="atrinik/src/app" includes="**/*.properties,**/*.testdata"/> <fileset dir="crossfire/src/test" includes="**/*.properties,**/*.testdata"/> Modified: trunk/crossfire/build.xml =================================================================== --- trunk/crossfire/build.xml 2010-06-08 20:34:57 UTC (rev 8269) +++ trunk/crossfire/build.xml 2010-06-08 21:00:12 UTC (rev 8270) @@ -90,7 +90,7 @@ <!-- compiling all Java classes --> <target name="compile" depends="init,clean,ctags" description="compiles source."> - <javac srcdir="${src.dir}:../src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> + <javac srcdir="${src.dir}:../src/app:../textedit/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> <classpath> <fileset dir="${lib.dir}" includes="*.jar"/> <fileset dir="../lib/" includes="*.jar"/> @@ -127,6 +127,7 @@ <include name="${resource.dir}/conf/**"/> </fileset> <fileset dir="../src/app" excludes="**/*.java,**/package.html,**/overview.html"/> + <fileset dir="../textedit/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> <fileset dir="../resource"> <include name="icons/**"/> <include name="log4j.properties"/> @@ -176,6 +177,9 @@ <packageset dir="../src/app" defaultexcludes="yes"> <include name="**"/> </packageset> + <packageset dir="../textedit/src/app" defaultexcludes="yes"> + <include name="**"/> + </packageset> <tag name="todo" description="Todo:"/> <tag name="used" description="Manually marked as used." enabled="false"/> <tag name="fixme" description="Fixme:"/> Modified: trunk/daimonin/build.xml =================================================================== --- trunk/daimonin/build.xml 2010-06-08 20:34:57 UTC (rev 8269) +++ trunk/daimonin/build.xml 2010-06-08 21:00:12 UTC (rev 8270) @@ -92,7 +92,7 @@ <!-- compiling all Java classes --> <target name="compile" depends="init,clean,ctags" description="compiles source."> - <javac srcdir="${src.dir}:../src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> + <javac srcdir="${src.dir}:../src/app:../textedit/src/app" destdir="${build.dir.production}" encoding="${build.source.encoding}" source="${build.source.version}" target="${build.target.version}" debug="${debug}" excludes="test/**/*.java" fork="${javac.fork}" includeantruntime="false"> <classpath> <fileset dir="${lib.dir}" includes="*.jar"/> <fileset dir="../lib/" includes="*.jar"/> @@ -116,6 +116,7 @@ </copy> <copy todir="${build.dir.production}"> <fileset dir="../src/app" excludes="**/*.java,**/package.html,**/overview.html"/> + <fileset dir="../textedit/src/app" excludes="**/*.java,**/package.html,**/overview.html"/> </copy> <copy todir="${build.dir.production}"> <fileset dir="${src.dir}" includes="**/*.properties"/> Modified: trunk/textedit.iml =================================================================== --- trunk/textedit.iml 2010-06-08 20:34:57 UTC (rev 8269) +++ trunk/textedit.iml 2010-06-08 21:00:12 UTC (rev 8270) @@ -1,8 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> <module relativePaths="true" type="JAVA_MODULE" version="4"> <component name="NewModuleRootManager" inherit-compiler-output="true"> - <content url="file://$MODULE_DIR$/src/app/net/sf/gridarta/textedit"> - <sourceFolder url="file://$MODULE_DIR$/src/app/net/sf/gridarta/textedit" isTestSource="false" packagePrefix="net.sf.gridarta.textedit" /> + <content url="file://$MODULE_DIR$/textedit"> + <sourceFolder url="file://$MODULE_DIR$/textedit/src/app" isTestSource="false" /> </content> <orderEntry type="inheritedJdk" /> <orderEntry type="sourceFolder" forTests="false" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 20:35:06
|
Revision: 8269 http://gridarta.svn.sourceforge.net/gridarta/?rev=8269&view=rev Author: akirschbaum Date: 2010-06-08 20:34:57 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Move classes into different packages. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.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/DefaultGlobalSettings.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/FilesConfigSource.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/AbstractResourcesReader.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.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/DefaultGlobalSettings.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/FilesConfigSource.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/AbstractResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.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/DefaultGlobalSettings.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/FilesConfigSource.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/AbstractResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java trunk/src/app/net/sf/gridarta/commands/CollectArchesCommand.java trunk/src/app/net/sf/gridarta/commands/Collector.java trunk/src/app/net/sf/gridarta/gui/prefs/ResPreferences.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/model/resource/AbstractResources.java trunk/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java trunk/src/app/net/sf/gridarta/model/resource/CollectedResourcesWriter.java trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureLoader.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/configsource/ trunk/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java trunk/src/app/net/sf/gridarta/model/configsource/ConfigSource.java trunk/src/app/net/sf/gridarta/model/configsource/ConfigSourceFactory.java trunk/src/app/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java trunk/src/app/net/sf/gridarta/model/resource/ trunk/src/app/net/sf/gridarta/model/settings/AbstractGlobalSettings.java trunk/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java trunk/src/app/net/sf/gridarta/model/settings/GlobalSettings.java trunk/src/app/net/sf/gridarta/model/settings/GlobalSettingsListener.java trunk/src/test/net/sf/gridarta/model/settings/TestGlobalSettings.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/model/settings/AbstractConfigSource.java trunk/src/app/net/sf/gridarta/model/settings/AbstractGlobalSettings.java trunk/src/app/net/sf/gridarta/model/settings/ConfigSource.java trunk/src/app/net/sf/gridarta/model/settings/ConfigSourceFactory.java trunk/src/app/net/sf/gridarta/model/settings/DefaultConfigSourceFactory.java trunk/src/app/net/sf/gridarta/model/settings/DefaultGlobalSettings.java trunk/src/app/net/sf/gridarta/model/settings/GlobalSettings.java trunk/src/app/net/sf/gridarta/model/settings/GlobalSettingsListener.java trunk/src/app/net/sf/gridarta/resource/ trunk/src/test/net/sf/gridarta/model/settings/TestGlobalSettings.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-08 16:52:52 UTC (rev 8268) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -59,6 +59,7 @@ import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.autojoin.AutojoinLists; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; @@ -83,16 +84,15 @@ import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.scripts.DefaultScriptArchData; import net.sf.gridarta.model.scripts.ScriptArchData; import net.sf.gridarta.model.scripts.ScriptArchUtils; import net.sf.gridarta.model.scripts.ScriptedEventFactory; -import net.sf.gridarta.model.settings.ConfigSourceFactory; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; -import net.sf.gridarta.resource.AbstractResources; import net.sf.gridarta.script.ScriptExecutor; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptParameters; 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-08 16:52:52 UTC (rev 8268) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/CollectedConfigSource.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -20,12 +20,12 @@ package net.sf.gridarta.var.atrinik.model.settings; import net.sf.gridarta.model.archetype.Archetype; +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.settings.AbstractConfigSource; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.settings.GlobalSettings; -import net.sf.gridarta.resource.AbstractResources; import org.jetbrains.annotations.NotNull; /** Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/DefaultGlobalSettings.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/DefaultGlobalSettings.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/DefaultGlobalSettings.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -20,7 +20,7 @@ package net.sf.gridarta.var.atrinik.model.settings; import java.io.File; -import net.sf.gridarta.model.settings.ConfigSourceFactory; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.var.atrinik.IGUIConstants; 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-08 16:52:52 UTC (rev 8268) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/settings/FilesConfigSource.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -20,12 +20,12 @@ package net.sf.gridarta.var.atrinik.model.settings; import net.sf.gridarta.model.archetype.Archetype; +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.settings.AbstractConfigSource; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.settings.GlobalSettings; -import net.sf.gridarta.resource.AbstractResources; import org.jetbrains.annotations.NotNull; /** Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/AbstractResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/AbstractResourcesReader.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/AbstractResourcesReader.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -34,7 +34,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public abstract class AbstractResourcesReader extends net.sf.gridarta.resource.AbstractResourcesReader<GameObject, MapArchObject, Archetype> { +public abstract class AbstractResourcesReader extends net.sf.gridarta.model.resource.AbstractResourcesReader<GameObject, MapArchObject, Archetype> { /** * Creates a new instance. Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/DefaultResources.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -32,9 +32,9 @@ import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; +import net.sf.gridarta.model.resource.AbstractResources; +import net.sf.gridarta.model.resource.CollectedResourcesWriter; import net.sf.gridarta.model.settings.GlobalSettings; -import net.sf.gridarta.resource.AbstractResources; -import net.sf.gridarta.resource.CollectedResourcesWriter; import net.sf.gridarta.var.atrinik.IGUIConstants; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; 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-08 16:52:52 UTC (rev 8268) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -54,6 +54,7 @@ import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.autojoin.AutojoinLists; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.exitconnector.ExitConnectorModel; @@ -75,16 +76,15 @@ import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.scripts.DefaultScriptArchData; import net.sf.gridarta.model.scripts.ScriptArchData; import net.sf.gridarta.model.scripts.ScriptArchUtils; import net.sf.gridarta.model.scripts.ScriptedEventFactory; -import net.sf.gridarta.model.settings.ConfigSourceFactory; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; -import net.sf.gridarta.resource.AbstractResources; import net.sf.gridarta.script.ScriptExecutor; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptParameters; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/CollectedConfigSource.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/CollectedConfigSource.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/CollectedConfigSource.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -20,12 +20,12 @@ package net.sf.gridarta.var.crossfire.model.settings; import net.sf.gridarta.model.archetype.Archetype; +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.settings.AbstractConfigSource; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.settings.GlobalSettings; -import net.sf.gridarta.resource.AbstractResources; import org.jetbrains.annotations.NotNull; /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/DefaultGlobalSettings.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/DefaultGlobalSettings.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/DefaultGlobalSettings.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -20,7 +20,7 @@ package net.sf.gridarta.var.crossfire.model.settings; import java.io.File; -import net.sf.gridarta.model.settings.ConfigSourceFactory; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.var.crossfire.IGUIConstants; import org.jetbrains.annotations.NotNull; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/FilesConfigSource.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/FilesConfigSource.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/settings/FilesConfigSource.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -20,12 +20,12 @@ package net.sf.gridarta.var.crossfire.model.settings; import net.sf.gridarta.model.archetype.Archetype; +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.settings.AbstractConfigSource; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.settings.GlobalSettings; -import net.sf.gridarta.resource.AbstractResources; import org.jetbrains.annotations.NotNull; /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/AbstractResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/AbstractResourcesReader.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/AbstractResourcesReader.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -35,7 +35,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public abstract class AbstractResourcesReader extends net.sf.gridarta.resource.AbstractResourcesReader<GameObject, MapArchObject, Archetype> { +public abstract class AbstractResourcesReader extends net.sf.gridarta.model.resource.AbstractResourcesReader<GameObject, MapArchObject, Archetype> { /** * The archetype set to update. Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/DefaultResources.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -31,9 +31,9 @@ import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; +import net.sf.gridarta.model.resource.AbstractResources; +import net.sf.gridarta.model.resource.CollectedResourcesWriter; import net.sf.gridarta.model.settings.GlobalSettings; -import net.sf.gridarta.resource.AbstractResources; -import net.sf.gridarta.resource.CollectedResourcesWriter; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; 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-08 16:52:52 UTC (rev 8268) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -59,6 +59,7 @@ import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.autojoin.AutojoinLists; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; @@ -83,16 +84,15 @@ import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.scripts.DefaultScriptArchData; import net.sf.gridarta.model.scripts.ScriptArchData; import net.sf.gridarta.model.scripts.ScriptArchUtils; import net.sf.gridarta.model.scripts.ScriptedEventFactory; -import net.sf.gridarta.model.settings.ConfigSourceFactory; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; -import net.sf.gridarta.resource.AbstractResources; import net.sf.gridarta.script.ScriptExecutor; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptParameters; Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/CollectedConfigSource.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/CollectedConfigSource.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/CollectedConfigSource.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -20,12 +20,12 @@ package net.sf.gridarta.var.daimonin.model.settings; import net.sf.gridarta.model.archetype.Archetype; +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.settings.AbstractConfigSource; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.settings.GlobalSettings; -import net.sf.gridarta.resource.AbstractResources; import org.jetbrains.annotations.NotNull; /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/DefaultGlobalSettings.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/DefaultGlobalSettings.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/DefaultGlobalSettings.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -20,7 +20,7 @@ package net.sf.gridarta.var.daimonin.model.settings; import java.io.File; -import net.sf.gridarta.model.settings.ConfigSourceFactory; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.var.daimonin.IGUIConstants; import org.jetbrains.annotations.NotNull; Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/FilesConfigSource.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/FilesConfigSource.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/settings/FilesConfigSource.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -20,12 +20,12 @@ package net.sf.gridarta.var.daimonin.model.settings; import net.sf.gridarta.model.archetype.Archetype; +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.settings.AbstractConfigSource; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.settings.GlobalSettings; -import net.sf.gridarta.resource.AbstractResources; import org.jetbrains.annotations.NotNull; /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/AbstractResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/AbstractResourcesReader.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/AbstractResourcesReader.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -34,7 +34,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public abstract class AbstractResourcesReader extends net.sf.gridarta.resource.AbstractResourcesReader<GameObject, MapArchObject, Archetype> { +public abstract class AbstractResourcesReader extends net.sf.gridarta.model.resource.AbstractResourcesReader<GameObject, MapArchObject, Archetype> { /** * Creates a new instance. Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/DefaultResources.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -32,9 +32,9 @@ import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.io.GameObjectParser; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; +import net.sf.gridarta.model.resource.AbstractResources; +import net.sf.gridarta.model.resource.CollectedResourcesWriter; import net.sf.gridarta.model.settings.GlobalSettings; -import net.sf.gridarta.resource.AbstractResources; -import net.sf.gridarta.resource.CollectedResourcesWriter; import net.sf.gridarta.var.daimonin.IGUIConstants; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; Modified: trunk/src/app/net/sf/gridarta/commands/CollectArchesCommand.java =================================================================== --- trunk/src/app/net/sf/gridarta/commands/CollectArchesCommand.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/src/app/net/sf/gridarta/commands/CollectArchesCommand.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -19,8 +19,8 @@ package net.sf.gridarta.commands; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.settings.GlobalSettings; -import net.sf.gridarta.resource.AbstractResources; import net.sf.japi.swing.misc.ConsoleProgress; import org.apache.log4j.Category; import org.apache.log4j.Logger; Modified: trunk/src/app/net/sf/gridarta/commands/Collector.java =================================================================== --- trunk/src/app/net/sf/gridarta/commands/Collector.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/src/app/net/sf/gridarta/commands/Collector.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -21,7 +21,7 @@ import java.io.File; import java.io.IOException; -import net.sf.gridarta.resource.AbstractResources; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.misc.Progress; Modified: trunk/src/app/net/sf/gridarta/gui/prefs/ResPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/ResPreferences.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/src/app/net/sf/gridarta/gui/prefs/ResPreferences.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -36,9 +36,9 @@ import javax.swing.border.CompoundBorder; import javax.swing.border.TitledBorder; import net.sf.gridarta.gui.utils.GUIConstants; +import net.sf.gridarta.model.configsource.ConfigSource; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.io.PathManager; -import net.sf.gridarta.model.settings.ConfigSource; -import net.sf.gridarta.model.settings.ConfigSourceFactory; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.utils.StringUtils; import net.sf.japi.swing.action.ActionBuilder; Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -64,8 +64,8 @@ import net.sf.gridarta.model.map.mapmodel.MapSquare; import net.sf.gridarta.model.map.validation.ErrorCollector; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.settings.GlobalSettings; -import net.sf.gridarta.resource.AbstractResources; import net.sf.gridarta.utils.ActionUtils; import net.sf.gridarta.utils.Exiter; import net.sf.gridarta.utils.ExiterListener; Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -53,6 +53,8 @@ import net.sf.gridarta.model.archetypetype.DefaultArchetypeAttributeFactory; import net.sf.gridarta.model.autojoin.AutojoinLists; import net.sf.gridarta.model.autojoin.AutojoinListsParser; +import net.sf.gridarta.model.configsource.ConfigSource; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; @@ -70,11 +72,10 @@ import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.scripts.ScriptArchData; import net.sf.gridarta.model.scripts.ScriptArchUtils; import net.sf.gridarta.model.scripts.ScriptedEventFactory; -import net.sf.gridarta.model.settings.ConfigSource; -import net.sf.gridarta.model.settings.ConfigSourceFactory; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.model.spells.ArchetypeSetSpellLoader; import net.sf.gridarta.model.spells.GameObjectSpell; @@ -85,7 +86,6 @@ import net.sf.gridarta.model.treasurelist.TreasureLoader; import net.sf.gridarta.model.treasurelist.TreasureTree; import net.sf.gridarta.model.treasurelist.TreasureTreeNode; -import net.sf.gridarta.resource.AbstractResources; import net.sf.gridarta.script.ScriptExecutor; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptModelLoader; Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -40,6 +40,7 @@ import net.sf.gridarta.model.archetypetype.ArchetypeTypeList; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.autojoin.AutojoinLists; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.exitconnector.ExitConnectorModel; @@ -61,15 +62,14 @@ import net.sf.gridarta.model.map.normalizer.MapPathNormalizer; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatchers; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.scripts.ScriptArchData; import net.sf.gridarta.model.scripts.ScriptArchUtils; import net.sf.gridarta.model.scripts.ScriptedEventFactory; -import net.sf.gridarta.model.settings.ConfigSourceFactory; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; -import net.sf.gridarta.resource.AbstractResources; import net.sf.gridarta.script.ScriptExecutor; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptParameters; Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -128,6 +128,7 @@ import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.baseobject.GameObjectContainer; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.exitconnector.DefaultExitConnectorModel; @@ -152,15 +153,14 @@ import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.TypeNrsGameObjectMatcher; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.scripts.ScriptArchData; import net.sf.gridarta.model.scripts.ScriptArchUtils; -import net.sf.gridarta.model.settings.ConfigSourceFactory; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; import net.sf.gridarta.model.treasurelist.TreasureTree; -import net.sf.gridarta.resource.AbstractResources; import net.sf.gridarta.script.ScriptExecutor; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptParameters; Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -58,6 +58,8 @@ import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.autojoin.AutojoinLists; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; +import net.sf.gridarta.model.configsource.DefaultConfigSourceFactory; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; @@ -81,13 +83,11 @@ import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.NamedGameObjectMatcher; -import net.sf.gridarta.model.settings.ConfigSourceFactory; -import net.sf.gridarta.model.settings.DefaultConfigSourceFactory; +import net.sf.gridarta.model.resource.AbstractResources; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.model.spells.GameObjectSpell; import net.sf.gridarta.model.spells.NumberSpell; import net.sf.gridarta.model.spells.Spells; -import net.sf.gridarta.resource.AbstractResources; import net.sf.gridarta.script.ScriptExecutor; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptParameters; Modified: trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -34,6 +34,8 @@ import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypetype.ArchetypeTypeSet; import net.sf.gridarta.model.autojoin.AutojoinLists; +import net.sf.gridarta.model.configsource.ConfigSourceFactory; +import net.sf.gridarta.model.configsource.DefaultConfigSourceFactory; import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; @@ -56,8 +58,6 @@ import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.NamedGameObjectMatcher; -import net.sf.gridarta.model.settings.ConfigSourceFactory; -import net.sf.gridarta.model.settings.DefaultConfigSourceFactory; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; Added: trunk/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -0,0 +1,89 @@ +/* + * 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.configsource; + +import java.io.File; +import java.io.IOException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.utils.IOUtils; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Abstract base class for {@link ConfigSource} implementations. + * @author Andreas Kirschbaum + */ +public abstract class AbstractConfigSource implements ConfigSource { + + /** + * The {@link ActionBuilder}. + */ + @NotNull + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public String toString() { + final String result = ACTION_BUILDER.getString("optionsConfigSource_" + getName()); + return result == null ? getName() : result; + } + + /** + * {@inheritDoc} + */ + @Nullable + @Override + public File getFile(@NotNull final GlobalSettings globalSettings, @NotNull final String type, final int index) throws IOException { + final String key = "configSource." + getName() + "." + type + "." + index; + final String spec = ACTION_BUILDER.getString(key); + if (spec == null) { + return null; + } + + final Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z]+)}"); + final Matcher matcher = pattern.matcher(spec); + final StringBuffer sb = new StringBuffer(); + while (matcher.find()) { + final String group = matcher.group(1); + final String replacement; + if (group.equals("COLLECTED")) { + replacement = globalSettings.getCollectedDirectory().getPath(); + } else if (group.equals("ARCH")) { + replacement = globalSettings.getArchDirectory().getPath(); + } else if (group.equals("MAPS")) { + replacement = globalSettings.getMapsDirectory().getPath(); + } else { + throw new IOException("unknown variable '${" + group + "} in '" + key + "=" + spec + "'"); + } + matcher.appendReplacement(sb, Matcher.quoteReplacement(replacement)); + } + matcher.appendTail(sb); + final String result = sb.toString(); + return IOUtils.getFile(null, result); + } + +} // class AbstractConfigSource Property changes on: trunk/src/app/net/sf/gridarta/model/configsource/AbstractConfigSource.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/model/configsource/ConfigSource.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/configsource/ConfigSource.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/configsource/ConfigSource.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -0,0 +1,79 @@ +/* + * 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.configsource; + +import java.io.File; +import java.io.IOException; +import net.sf.gridarta.model.archetype.Archetype; +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.resource.AbstractResources; +import net.sf.gridarta.model.settings.GlobalSettings; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Possible source locations for configuration files. + * @author Andreas Kirschbaum + */ +public interface ConfigSource { + + /** + * Returns the internal name. + * @return the internal name + */ + @NotNull + String getName(); + + /** + * {@inheritDoc} + */ + @NotNull + @Override + String toString(); + + /** + * Reads config files. + * @param globalSettings the global settings to use + * @param resources the resources to update + * @param errorView the error view for reporting errors + */ + <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void read(@NotNull GlobalSettings globalSettings, @NotNull AbstractResources<G, A, R> resources, @NotNull ErrorView errorView); + + /** + * Whether the "archetype directory" input field in the settings dialog + * should be enabled. + * @return whether the input field should be enabled + */ + boolean isArchDirectoryInputFieldEnabled(); + + /** + * Returns a config file. + * @param globalSettings the global settings to use + * @param type the file type + * @param index the file index, starting with <code>0</code> + * @return the file or <code>null</code> if no more files are available + * @throws IOException if an error occurs + */ + @Nullable + File getFile(@NotNull GlobalSettings globalSettings, @NotNull String type, int index) throws IOException; + +} // interface ConfigSource Property changes on: trunk/src/app/net/sf/gridarta/model/configsource/ConfigSource.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/model/configsource/ConfigSourceFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/configsource/ConfigSourceFactory.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/configsource/ConfigSourceFactory.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -0,0 +1,61 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.configsource; + +import org.jetbrains.annotations.NotNull; + +/** + * A factory for creating {@link ConfigSource}s. + * @author Andreas Kirschbaum + */ +public interface ConfigSourceFactory { + + /** + * Returns all defined configuration sources. The returned array may be + * modified. + * @return the defined configuration sources + */ + @NotNull + ConfigSource[] getConfigSources(); + + /** + * Returns a {@link ConfigSource} by name. + * @param name the name + * @return the configuration source of a default configuration source if the + * name does not exist + */ + @NotNull + ConfigSource getConfigSource(@NotNull String name); + + /** + * Returns the {@link ConfigSource} that reads individual files. + * @return the configuration source that reads individual files + */ + @NotNull + ConfigSource getFilesConfigSource(); + + /** + * Returns the default {@link ConfigSource}. + * @return the default configuration source + */ + @NotNull + ConfigSource getDefaultConfigSource(); + +} // interface ConfigSourceFactory Property changes on: trunk/src/app/net/sf/gridarta/model/configsource/ConfigSourceFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -0,0 +1,135 @@ +/* + * 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.configsource; + +import java.util.ArrayList; +import java.util.MissingResourceException; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link ConfigSourceFactory} that is configured through action keys. + * @author Andreas Kirschbaum + */ +public class DefaultConfigSourceFactory implements ConfigSourceFactory { + + /** + * The action key for configuration source class names. The class names are + * separated by spaces. + */ + @NotNull + private static final String CONFIG_SOURCES_KEY = "configSources"; + + /** + * The {@link ActionBuilder}. + */ + @NotNull + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The defined configuration sources. The list is never empty; the first + * entry is the default configuration source. + */ + @NotNull + private final ArrayList<ConfigSource> configSources = new ArrayList<ConfigSource>(); + + /** + * Creates a new instance. + */ + public DefaultConfigSourceFactory() { + final String configSourceClassNames = ACTION_BUILDER.getString(CONFIG_SOURCES_KEY); + if (configSourceClassNames == null) { + throw new MissingResourceException("No configuration sources defined", "net.sf.gridarta", CONFIG_SOURCES_KEY); + } + + for (final String configSourceClassName : configSourceClassNames.split(" ", -1)) { + final Class<?> configSourceClass; + try { + configSourceClass = Class.forName(configSourceClassName); + } catch (final ClassNotFoundException ex) { + throw new MissingResourceException("Class does not exist: " + configSourceClassName + ": " + ex.getMessage(), "net.sf.gridarta", CONFIG_SOURCES_KEY); + } + + final Class<? extends ConfigSource> configSourceClass2; + try { + configSourceClass2 = configSourceClass.asSubclass(ConfigSource.class); + } catch (final ClassCastException ex) { + throw new MissingResourceException("Class does not implement ConfigSource: " + configSourceClassName + ": " + ex.getMessage(), "net.sf.gridarta", CONFIG_SOURCES_KEY); + } + + final ConfigSource configSource; + try { + configSource = configSourceClass2.newInstance(); + } catch (final InstantiationException ex) { + throw new MissingResourceException("Class cannot be instantiated: " + configSourceClassName + ": " + ex.getMessage(), "net.sf.gridarta", CONFIG_SOURCES_KEY); + } catch (final IllegalAccessException ex) { + throw new MissingResourceException("Class cannot be instantiated: " + configSourceClassName + ": " + ex.getMessage(), "net.sf.gridarta", CONFIG_SOURCES_KEY); + } + + configSources.add(configSource); + } + + configSources.trimToSize(); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ConfigSource[] getConfigSources() { + return configSources.toArray(new ConfigSource[configSources.size()]); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ConfigSource getConfigSource(@NotNull final String name) { + for (final ConfigSource configSource : configSources) { + if (configSource.getName().equals(name)) { + return configSource; + } + } + + return configSources.get(0); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ConfigSource getFilesConfigSource() { + return getConfigSource("ARCH_DIRECTORY"); + } + + /** + * {@inheritDoc} + */ + @NotNull + @Override + public ConfigSource getDefaultConfigSource() { + return configSources.get(0); + } + +} // class DefaultConfigSourceFactory Property changes on: trunk/src/app/net/sf/gridarta/model/configsource/DefaultConfigSourceFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/model/resource/AbstractResources.java =================================================================== --- trunk/src/app/net/sf/gridarta/resource/AbstractResources.java 2010-06-06 18:43:50 UTC (rev 8183) +++ trunk/src/app/net/sf/gridarta/model/resource/AbstractResources.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.resource; +package net.sf.gridarta.model.resource; import java.io.File; import java.io.IOException; Modified: trunk/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java =================================================================== --- trunk/src/app/net/sf/gridarta/resource/AbstractResourcesReader.java 2010-06-06 18:43:50 UTC (rev 8183) +++ trunk/src/app/net/sf/gridarta/model/resource/AbstractResourcesReader.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.resource; +package net.sf.gridarta.model.resource; import java.io.BufferedReader; import java.io.File; Modified: trunk/src/app/net/sf/gridarta/model/resource/CollectedResourcesWriter.java =================================================================== --- trunk/src/app/net/sf/gridarta/resource/CollectedResourcesWriter.java 2010-06-06 18:43:50 UTC (rev 8183) +++ trunk/src/app/net/sf/gridarta/model/resource/CollectedResourcesWriter.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -17,7 +17,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -package net.sf.gridarta.resource; +package net.sf.gridarta.model.resource; import java.io.File; import java.io.IOException; Deleted: trunk/src/app/net/sf/gridarta/model/settings/AbstractConfigSource.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/settings/AbstractConfigSource.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/src/app/net/sf/gridarta/model/settings/AbstractConfigSource.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -1,88 +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.settings; - -import java.io.File; -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import net.sf.gridarta.utils.IOUtils; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Abstract base class for {@link ConfigSource} implementations. - * @author Andreas Kirschbaum - */ -public abstract class AbstractConfigSource implements ConfigSource { - - /** - * The {@link ActionBuilder}. - */ - @NotNull - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** - * {@inheritDoc} - */ - @NotNull - @Override - public String toString() { - final String result = ACTION_BUILDER.getString("optionsConfigSource_" + getName()); - return result == null ? getName() : result; - } - - /** - * {@inheritDoc} - */ - @Nullable - @Override - public File getFile(@NotNull final GlobalSettings globalSettings, @NotNull final String type, final int index) throws IOException { - final String key = "configSource." + getName() + "." + type + "." + index; - final String spec = ACTION_BUILDER.getString(key); - if (spec == null) { - return null; - } - - final Pattern pattern = Pattern.compile("\\$\\{([a-zA-Z]+)}"); - final Matcher matcher = pattern.matcher(spec); - final StringBuffer sb = new StringBuffer(); - while (matcher.find()) { - final String group = matcher.group(1); - final String replacement; - if (group.equals("COLLECTED")) { - replacement = globalSettings.getCollectedDirectory().getPath(); - } else if (group.equals("ARCH")) { - replacement = globalSettings.getArchDirectory().getPath(); - } else if (group.equals("MAPS")) { - replacement = globalSettings.getMapsDirectory().getPath(); - } else { - throw new IOException("unknown variable '${" + group + "} in '" + key + "=" + spec + "'"); - } - matcher.appendReplacement(sb, Matcher.quoteReplacement(replacement)); - } - matcher.appendTail(sb); - final String result = sb.toString(); - return IOUtils.getFile(null, result); - } - -} // class AbstractConfigSource Deleted: trunk/src/app/net/sf/gridarta/model/settings/AbstractGlobalSettings.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/settings/AbstractGlobalSettings.java 2010-06-08 16:52:52 UTC (rev 8268) +++ trunk/src/app/net/sf/gridarta/model/settings/AbstractGlobalSettings.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -1,63 +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.settings; - -import net.sf.gridarta.utils.EventListenerList2; -import org.jetbrains.annotations.NotNull; - -/** - * Abstract base class for {@link GlobalSettings} implementations. - * @author Andreas Kirschbaum - */ -public abstract class AbstractGlobalSettings implements GlobalSettings { - - /** - * The {@link GlobalSettingsListener}s to inform of changes. - */ - @NotNull - private final EventListenerList2<GlobalSettingsListener> listenerList = new EventListenerList2<GlobalSettingsListener>(GlobalSettingsListener.class); - - /** - * {@inheritDoc} - */ - @Override - public void addGlobalSettingsListener(@NotNull final GlobalSettingsListener listener) { - listenerList.add(listener); - } - - /** - * {@inheritDoc} - */ - @Override - public void removeGlobalSettingsListener(@NotNull final GlobalSettingsListener listener) { - listenerList.remove(listener); - } - - /** - * Notifies all listeners about a changed visibility of the main toolbar. - */ - protected void fireShowMainToolbarChanged() { - final boolean visible = isShowMainToolbar(); - for (final GlobalSettingsListener listener : listenerList.getListeners()) { - listener.showMainToolbarChanged(visible); - } - } - -} // class AbstractGlobalSettings Added: trunk/src/app/net/sf/gridarta/model/settings/AbstractGlobalSettings.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/settings/AbstractGlobalSettings.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/settings/AbstractGlobalSettings.java 2010-06-08 20:34:57 UTC (rev 8269) @@ -0,0 +1,63 @@ +/* + * 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... [truncated message content] |
From: <aki...@us...> - 2010-06-08 16:52:58
|
Revision: 8268 http://gridarta.svn.sourceforge.net/gridarta/?rev=8268&view=rev Author: akirschbaum Date: 2010-06-08 16:52:52 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Remove dependency to resources from regression tests. Modified Paths: -------------- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObjectTest.java trunk/daimonin/src/test/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObjectTest.java Removed Paths: ------------- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/maparchobject/noAttributes.testdata trunk/daimonin/src/test/net/sf/gridarta/var/daimonin/model/maparchobject/noAttributes.testdata 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-08 16:45:31 UTC (rev 8267) +++ trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/maparchobject/MapArchObjectTest.java 2010-06-08 16:52:52 UTC (rev 8268) @@ -21,8 +21,7 @@ import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.io.StringReader; import net.sf.gridarta.model.io.AbstractMapArchObjectParser; import net.sf.gridarta.model.map.maparchobject.AbstractMapArchObject; import net.sf.gridarta.utils.Size2D; @@ -45,7 +44,8 @@ public void testParseMapArchNoAttributes() throws IOException { final MapArchObject mao = new MapArchObject(); final AbstractMapArchObjectParser<MapArchObject> mapArchObjectParser = new MapArchObjectParser(); - final BufferedReader in = openTestDataReader("noAttributes.testdata"); + final StringReader stringReader = new StringReader("arch map\n" + "end\n"); + final BufferedReader in = new BufferedReader(stringReader); try { mapArchObjectParser.load(in, mao); } finally { @@ -55,18 +55,4 @@ Assert.assertEquals(Size2D.ONE, mao.getMapSize()); } - /** - * Reads test data. - * @param testDataName Name of the test data to open - * @return BufferedReader for reading from testDataName. - */ - private BufferedReader openTestDataReader(final String testDataName) { - final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - final InputStream in = contextClassLoader.getResourceAsStream(getClass().getPackage().getName().replace('.', '/') + "/" + testDataName); - if (in == null) { - Assert.fail("resource " + testDataName + " not found"); - } - return new BufferedReader(new InputStreamReader(in)); - } - } // class MapArchObjectTest Deleted: trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/maparchobject/noAttributes.testdata =================================================================== --- trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/maparchobject/noAttributes.testdata 2010-06-08 16:45:31 UTC (rev 8267) +++ trunk/atrinik/src/test/net/sf/gridarta/var/atrinik/model/maparchobject/noAttributes.testdata 2010-06-08 16:52:52 UTC (rev 8268) @@ -1,2 +0,0 @@ -arch map -end \ No newline at end of file Modified: trunk/daimonin/src/test/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObjectTest.java =================================================================== --- trunk/daimonin/src/test/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObjectTest.java 2010-06-08 16:45:31 UTC (rev 8267) +++ trunk/daimonin/src/test/net/sf/gridarta/var/daimonin/model/maparchobject/MapArchObjectTest.java 2010-06-08 16:52:52 UTC (rev 8268) @@ -21,8 +21,7 @@ import java.io.BufferedReader; import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; +import java.io.StringReader; import net.sf.gridarta.model.io.AbstractMapArchObjectParser; import net.sf.gridarta.model.map.maparchobject.AbstractMapArchObject; import net.sf.gridarta.utils.Size2D; @@ -45,7 +44,8 @@ public void testParseMapArchNoAttributes() throws IOException { final MapArchObject mao = new MapArchObject(); final AbstractMapArchObjectParser<MapArchObject> maop = new MapArchObjectParser(); - final BufferedReader in = openTestDataReader("noAttributes.testdata"); + final StringReader stringReader = new StringReader("arch map\n" + "end\n"); + final BufferedReader in = new BufferedReader(stringReader); try { maop.load(in, mao); } finally { @@ -55,18 +55,4 @@ Assert.assertEquals(Size2D.ONE, mao.getMapSize()); } - /** - * Reads test data. - * @param testDataName Name of the test data to open - * @return BufferedReader for reading from testDataName. - */ - private BufferedReader openTestDataReader(final String testDataName) { - final ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader(); - final InputStream in = contextClassLoader.getResourceAsStream(getClass().getPackage().getName().replace('.', '/') + "/" + testDataName); - if (in == null) { - Assert.fail("resource " + testDataName + " not found"); - } - return new BufferedReader(new InputStreamReader(in)); - } - } // class MapArchObjectTest Deleted: trunk/daimonin/src/test/net/sf/gridarta/var/daimonin/model/maparchobject/noAttributes.testdata =================================================================== --- trunk/daimonin/src/test/net/sf/gridarta/var/daimonin/model/maparchobject/noAttributes.testdata 2010-06-08 16:45:31 UTC (rev 8267) +++ trunk/daimonin/src/test/net/sf/gridarta/var/daimonin/model/maparchobject/noAttributes.testdata 2010-06-08 16:52:52 UTC (rev 8268) @@ -1,2 +0,0 @@ -arch map -end \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-08 16:45:39
|
Revision: 8267 http://gridarta.svn.sourceforge.net/gridarta/?rev=8267&view=rev Author: akirschbaum Date: 2010-06-08 16:45:31 +0000 (Tue, 08 Jun 2010) Log Message: ----------- Make regression tests independent on editor settings. 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/crossfire/src/app/net/sf/gridarta/var/crossfire/validation/checks/NonAbsoluteExitPathChecker.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.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/GridartaEditor.java trunk/src/app/net/sf/gridarta/validation/AbstractValidator.java trunk/src/app/net/sf/gridarta/validation/DelegatingMapValidator.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/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/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/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/PaidItemShopSquareChecker.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/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/validation/AbstractValidatorTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/validation/DefaultValidatorPreferences.java trunk/src/app/net/sf/gridarta/validation/ValidatorPreferences.java trunk/src/test/net/sf/gridarta/validation/TestValidatorPreferences.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-07 19:38:16 UTC (rev 8266) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-06-08 16:45:31 UTC (rev 8267) @@ -103,6 +103,7 @@ import net.sf.gridarta.utils.StringUtils; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.validation.DelegatingMapValidator; +import net.sf.gridarta.validation.ValidatorPreferences; import net.sf.gridarta.validation.checks.AttributeRangeChecker; import net.sf.gridarta.validation.checks.BlockedMobOrSpawnPointChecker; import net.sf.gridarta.validation.checks.BlockedSpawnPointChecker; @@ -208,8 +209,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @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 new DefaultMainControl<GameObject, MapArchObject, Archetype>(FileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @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, @NotNull final ValidatorPreferences validatorPreferences) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(FileFilters.pythonFileFilter, ".py", "Python", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory, validatorPreferences); } /** @@ -312,7 +313,7 @@ * {@inheritDoc} */ @Override - public void initMapValidators(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final GlobalSettings globalSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker) { + public void initMapValidators(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final GlobalSettings globalSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final ValidatorPreferences validatorPreferences) { final GameObjectMatcher monsterMatcher = gameObjectMatchers.getMatcherWarn(errorViewCollector, "system_monster_only", "system_monster", "monster"); if (monsterMatcher != null) { addAttributeRangeChecker(attributeRangeChecker, monsterMatcher, "level", "level", 0, 125); @@ -380,14 +381,14 @@ addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_paralyze", "paralyze (effect)", Integer.MIN_VALUE, 100); addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_snare", "snare (effect)", Integer.MIN_VALUE, 100); } - final CustomTypeChecker<GameObject, MapArchObject, Archetype> customTypeChecker = new CustomTypeChecker<GameObject, MapArchObject, Archetype>(); + final CustomTypeChecker<GameObject, MapArchObject, Archetype> customTypeChecker = new CustomTypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences); customTypeChecker.addIgnore(Archetype.TYPE_MOB, Archetype.TYPE_SPAWN_POINT_MOB, Archetype.TYPE_SPAWN_POINT); - final SlayingChecker<GameObject, MapArchObject, Archetype> slayingChecker = new SlayingChecker<GameObject, MapArchObject, Archetype>(Pattern.compile("^[a-zA-Z_0-9/.]*$")); + final SlayingChecker<GameObject, MapArchObject, Archetype> slayingChecker = new SlayingChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Pattern.compile("^[a-zA-Z_0-9/.]*$")); final GameObjectMatcher environmentSensorMatcher = gameObjectMatchers.getMatcherWarn(errorViewCollector, "system_environment_sensor"); if (environmentSensorMatcher != null) { slayingChecker.addMatcher(environmentSensorMatcher, Pattern.compile("|([0-1][0-9]|2[0-3]):[0-5][0-9]-([0-1][0-9]|2[0-3]):[0-5][0-9]")); } - mapValidators.addValidators(new BlockedSpawnPointChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT), new BlockedMobOrSpawnPointChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_MOB), new BlockedSquareChecker<GameObject, MapArchObject, Archetype>(), new ConnectedInsideContainerChecker<GameObject, MapArchObject, Archetype>(), new ConnectedPickableChecker<GameObject, MapArchObject, Archetype>(), attributeRangeChecker, customTypeChecker, new DoubleTypeChecker<GameObject, MapArchObject, Archetype>(), new DoubleLayerChecker<GameObject, MapArchObject, Archetype>(), new EmptySpawnPointChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT), new ExitChecker<GameObject, MapArchObject, Archetype>(globalSettings, Archetype.TYPE_EXIT), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(), new MobOutsideSpawnPointChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_MOB), new SquareWithoutFloorChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_FLOOR, Archetype.TYPE_SHOP_FLOOR), slayingChecker, new TilePathsChecker<GameObject, MapArchObject, Archetype>(globalSettings, 8), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(), new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(), new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER)); + mapValidators.addValidators(new BlockedSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_SPAWN_POINT), new BlockedMobOrSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_MOB), new BlockedSquareChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new ConnectedInsideContainerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new ConnectedPickableChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), attributeRangeChecker, customTypeChecker, new DoubleTypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new DoubleLayerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new EmptySpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_SPAWN_POINT), new ExitChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, Archetype.TYPE_EXIT), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new MobOutsideSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_MOB), new SquareWithoutFloorChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_FLOOR, Archetype.TYPE_SHOP_FLOOR), slayingChecker, new TilePathsChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, 8), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER)); } private static void addAttributeRangeChecker(@NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final GameObjectMatcher matcher, @NotNull final String name, @NotNull final String displayName, final int minValue, final int maxValue) { 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-07 19:38:16 UTC (rev 8266) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-06-08 16:45:31 UTC (rev 8267) @@ -30,8 +30,8 @@ import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; +import net.sf.gridarta.gui.prefs.AppPreferences; import net.sf.gridarta.gui.prefs.AppPreferencesModel; -import net.sf.gridarta.gui.prefs.AppPreferences; import net.sf.gridarta.gui.prefs.DevPreferences; import net.sf.gridarta.gui.prefs.GUIPreferences; import net.sf.gridarta.gui.prefs.MapValidatorPreferences; @@ -94,6 +94,7 @@ import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.validation.DelegatingMapValidator; +import net.sf.gridarta.validation.ValidatorPreferences; import net.sf.gridarta.validation.checks.AttributeRangeChecker; import net.sf.gridarta.validation.checks.ConnectedInsideContainerChecker; import net.sf.gridarta.validation.checks.ConnectedPickableChecker; @@ -158,8 +159,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @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 new DefaultMainControl<GameObject, MapArchObject, Archetype>(FileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, IGUIConstants.SCRIPTS_DIR, errorView, this, false, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @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, @NotNull final ValidatorPreferences validatorPreferences) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(FileFilters.pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, IGUIConstants.SCRIPTS_DIR, errorView, this, false, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory, validatorPreferences); } /** @@ -266,7 +267,7 @@ * {@inheritDoc} */ @Override - public void initMapValidators(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final GlobalSettings globalSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker) { + public void initMapValidators(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final GlobalSettings globalSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final ValidatorPreferences validatorPreferences) { final GameObjectMatcher monsterMatcher = gameObjectMatchers.getMatcherWarn(errorViewCollector, "system_monster"); if (monsterMatcher != null) { try { @@ -275,15 +276,15 @@ log.warn(ex.getMessage() + " for monster checker"); } } - final CustomTypeChecker<GameObject, MapArchObject, Archetype> customTypeChecker = new CustomTypeChecker<GameObject, MapArchObject, Archetype>(); + final CustomTypeChecker<GameObject, MapArchObject, Archetype> customTypeChecker = new CustomTypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences); customTypeChecker.addIgnore(Archetype.TYPE_MISC, Archetype.TYPE_WALL); customTypeChecker.addIgnore(Archetype.TYPE_MISC, Archetype.TYPE_FLOOR); - final UnsetSlayingChecker<GameObject, MapArchObject, Archetype> unsetSlayingChecker = new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER); + final UnsetSlayingChecker<GameObject, MapArchObject, Archetype> unsetSlayingChecker = new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER); unsetSlayingChecker.addAllowedValue("player"); - mapValidators.addValidators(attributeRangeChecker, new ConnectedInsideContainerChecker<GameObject, MapArchObject, Archetype>(), new ConnectedPickableChecker<GameObject, MapArchObject, Archetype>(), customTypeChecker, new ExitChecker<GameObject, MapArchObject, Archetype>(globalSettings, Archetype.TYPE_EXIT), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(), new TilePathsChecker<GameObject, MapArchObject, Archetype>(globalSettings, 4), new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(), unsetSlayingChecker); + mapValidators.addValidators(attributeRangeChecker, new ConnectedInsideContainerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new ConnectedPickableChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), customTypeChecker, new ExitChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, Archetype.TYPE_EXIT), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new TilePathsChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, 4), new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), unsetSlayingChecker); final GameObjectMatcher exitMatcher = gameObjectMatchers.getMatcherWarn(errorViewCollector, "system_exit"); if (exitMatcher != null) { - mapValidators.addValidator(new NonAbsoluteExitPathChecker(exitMatcher)); + mapValidators.addValidator(new NonAbsoluteExitPathChecker(validatorPreferences, exitMatcher)); } } Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/validation/checks/NonAbsoluteExitPathChecker.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/validation/checks/NonAbsoluteExitPathChecker.java 2010-06-07 19:38:16 UTC (rev 8266) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/validation/checks/NonAbsoluteExitPathChecker.java 2010-06-08 16:45:31 UTC (rev 8267) @@ -27,6 +27,7 @@ import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.validation.AbstractValidator; import net.sf.gridarta.validation.GameObjectValidator; +import net.sf.gridarta.validation.ValidatorPreferences; import net.sf.gridarta.validation.checks.NonAbsoluteExitPathError; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; @@ -49,10 +50,12 @@ /** * Creates a new instance. + * @param validatorPreferences the validator preferences to use * @param exitGameObjectMatcher the game object matcher for matching exit * objects */ - public NonAbsoluteExitPathChecker(@NotNull final GameObjectMatcher exitGameObjectMatcher) { + public NonAbsoluteExitPathChecker(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final GameObjectMatcher exitGameObjectMatcher) { + super(validatorPreferences); this.exitGameObjectMatcher = exitGameObjectMatcher; } 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-07 19:38:16 UTC (rev 8266) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-06-08 16:45:31 UTC (rev 8267) @@ -103,6 +103,7 @@ import net.sf.gridarta.utils.StringUtils; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.validation.DelegatingMapValidator; +import net.sf.gridarta.validation.ValidatorPreferences; import net.sf.gridarta.validation.checks.AttributeRangeChecker; import net.sf.gridarta.validation.checks.BlockedMobOrSpawnPointChecker; import net.sf.gridarta.validation.checks.BlockedSpawnPointChecker; @@ -209,8 +210,8 @@ */ @NotNull @Override - public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @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 new DefaultMainControl<GameObject, MapArchObject, Archetype>(FileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory); + public DefaultMainControl<GameObject, MapArchObject, Archetype> newMainControl(final boolean forceReadFromFiles, @NotNull final ErrorView errorView, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @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, @NotNull final ValidatorPreferences validatorPreferences) { + return new DefaultMainControl<GameObject, MapArchObject, Archetype>(FileFilters.luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, IGUIConstants.SCRIPTS_DIR, errorView, this, forceReadFromFiles, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory, validatorPreferences); } /** @@ -313,7 +314,7 @@ * {@inheritDoc} */ @Override - public void initMapValidators(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final GlobalSettings globalSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker) { + public void initMapValidators(@NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final GlobalSettings globalSettings, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final ValidatorPreferences validatorPreferences) { final GameObjectMatcher monsterMatcher = gameObjectMatchers.getMatcherWarn(errorViewCollector, "system_monster_only", "system_monster", "monster"); if (monsterMatcher != null) { addAttributeRangeChecker(attributeRangeChecker, monsterMatcher, "level", "level", 0, 125); @@ -381,14 +382,14 @@ addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_paralyze", "paralyze (effect)", Integer.MIN_VALUE, 100); addAttributeRangeChecker(attributeRangeChecker, combatValuesObjectsMatcher, "resist_snare", "snare (effect)", Integer.MIN_VALUE, 100); } - final CustomTypeChecker<GameObject, MapArchObject, Archetype> customTypeChecker = new CustomTypeChecker<GameObject, MapArchObject, Archetype>(); + final CustomTypeChecker<GameObject, MapArchObject, Archetype> customTypeChecker = new CustomTypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences); customTypeChecker.addIgnore(Archetype.TYPE_MOB, Archetype.TYPE_SPAWN_POINT_MOB, Archetype.TYPE_SPAWN_POINT); - final SlayingChecker<GameObject, MapArchObject, Archetype> slayingChecker = new SlayingChecker<GameObject, MapArchObject, Archetype>(Pattern.compile("^[a-zA-Z_0-9/.]*$")); + final SlayingChecker<GameObject, MapArchObject, Archetype> slayingChecker = new SlayingChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Pattern.compile("^[a-zA-Z_0-9/.]*$")); final GameObjectMatcher environmentSensorMatcher = gameObjectMatchers.getMatcherWarn(errorViewCollector, "system_environment_sensor"); if (environmentSensorMatcher != null) { slayingChecker.addMatcher(environmentSensorMatcher, Pattern.compile("|([0-1][0-9]|2[0-3]):[0-5][0-9]-([0-1][0-9]|2[0-3]):[0-5][0-9]")); } - mapValidators.addValidators(new BlockedSpawnPointChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT), new BlockedMobOrSpawnPointChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_MOB), new BlockedSquareChecker<GameObject, MapArchObject, Archetype>(), new ConnectedInsideContainerChecker<GameObject, MapArchObject, Archetype>(), new ConnectedPickableChecker<GameObject, MapArchObject, Archetype>(), attributeRangeChecker, customTypeChecker, new DoubleTypeChecker<GameObject, MapArchObject, Archetype>(), new DoubleLayerChecker<GameObject, MapArchObject, Archetype>(), new EmptySpawnPointChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_SPAWN_POINT), new ExitChecker<GameObject, MapArchObject, Archetype>(globalSettings, Archetype.TYPE_EXIT), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(), new MobOutsideSpawnPointChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_MOB), new SquareWithoutFloorChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_FLOOR, Archetype.TYPE_SHOP_FLOOR), slayingChecker, new SysObjectNotOnLayerZeroChecker<GameObject, MapArchObject, Archetype>(), new TilePathsChecker<GameObject, MapArchObject, Archetype>(globalSettings, 8), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(), new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(), new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER)); + mapValidators.addValidators(new BlockedSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_SPAWN_POINT), new BlockedMobOrSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_MOB), new BlockedSquareChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new ConnectedInsideContainerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new ConnectedPickableChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), attributeRangeChecker, customTypeChecker, new DoubleTypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new DoubleLayerChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new EmptySpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_SPAWN_POINT), new ExitChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, Archetype.TYPE_EXIT), new MapDifficultyChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new MobOutsideSpawnPointChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_MOB), new SquareWithoutFloorChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_FLOOR, Archetype.TYPE_SHOP_FLOOR), slayingChecker, new SysObjectNotOnLayerZeroChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new TilePathsChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, globalSettings, 8), new UndefinedArchetypeChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UndefinedFaceChecker<GameObject, MapArchObject, Archetype>(validatorPreferences), new UnsetSlayingChecker<GameObject, MapArchObject, Archetype>(validatorPreferences, Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_DETECTOR, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER)); } private static void addAttributeRangeChecker(@NotNull final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker, @NotNull final GameObjectMatcher matcher, @NotNull final String name, @NotNull final String displayName, final int minValue, final int maxValue) { Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-06-07 19:38:16 UTC (rev 8266) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-06-08 16:45:31 UTC (rev 8267) @@ -97,6 +97,7 @@ import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.utils.XmlHelper; import net.sf.gridarta.validation.DelegatingMapValidator; +import net.sf.gridarta.validation.ValidatorPreferences; import net.sf.gridarta.validation.checks.AttributeRangeChecker; import net.sf.gridarta.validation.checks.ConnectionChecker; import net.sf.gridarta.validation.checks.PaidItemShopSquareChecker; @@ -168,8 +169,9 @@ * @param gameObjectSpells the game object spells to use * @param attributeRangeChecker the attribute range checker to use * @param pluginParameterFactory the plugin parameter factory to use + * @param validatorPreferences the validator preferences to use */ - public DefaultMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, @NotNull final String scriptsDir, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final DelegatingMapValidator<G, A, R> validators, @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) { + public DefaultMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, @NotNull final String scriptsDir, final ErrorView errorView, @NotNull final EditorFactory<G, A, R> editorFactory, final boolean forceReadFromFiles, @NotNull final GlobalSettings globalSettings, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final PathManager pathManager, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final DelegatingMapValidator<G, A, R> validators, @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, @NotNull final ValidatorPreferences validatorPreferences) { final XmlHelper xmlHelper; try { xmlHelper = new XmlHelper(); @@ -185,14 +187,14 @@ } catch (final IOException ex) { gameObjectMatchersErrorViewCollector.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_FILE_INVALID, ex.getMessage()); } - editorFactory.initMapValidators(validators, gameObjectMatchersErrorViewCollector, globalSettings, gameObjectMatchers, attributeRangeChecker); + editorFactory.initMapValidators(validators, gameObjectMatchersErrorViewCollector, globalSettings, gameObjectMatchers, attributeRangeChecker, validatorPreferences); final GameObjectMatcher connectionSourceMatcher = gameObjectMatchers.getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_connection_source"); if (connectionSourceMatcher != null) { final GameObjectMatcher connectionSinkMatcher = gameObjectMatchers.getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_connection_sink"); if (connectionSinkMatcher != null) { final GameObjectMatcher connectionSink2Matcher = gameObjectMatchers.getMatcherWarn(gameObjectMatchersErrorViewCollector, "system_connection_sink2"); if (connectionSink2Matcher != null) { - validators.addValidator(new ConnectionChecker<G, A, R>(connectionSourceMatcher, connectionSinkMatcher, connectionSink2Matcher)); + validators.addValidator(new ConnectionChecker<G, A, R>(validatorPreferences, connectionSourceMatcher, connectionSinkMatcher, connectionSink2Matcher)); } } } @@ -203,12 +205,12 @@ if (shopSquareMatcher != null) { final GameObjectMatcher noSpellsMatcher = gameObjectMatchers.getMatcher("system_no_spells", "no_spells"); if (noSpellsMatcher != null) { - validators.addValidator(new ShopSquareChecker<G, A, R>(shopSquareMatcher, noSpellsMatcher)); + validators.addValidator(new ShopSquareChecker<G, A, R>(validatorPreferences, shopSquareMatcher, noSpellsMatcher)); } final GameObjectMatcher paidItemMatcher = gameObjectMatchers.getMatcher("system_paid_item"); if (paidItemMatcher != null) { - validators.addValidator(new PaidItemShopSquareChecker<G, A, R>(shopSquareMatcher, paidItemMatcher)); + validators.addValidator(new PaidItemShopSquareChecker<G, A, R>(validatorPreferences, shopSquareMatcher, paidItemMatcher)); } } Map<String, TreasureTreeNode> specialTreasureLists; Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-06-07 19:38:16 UTC (rev 8266) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-06-08 16:45:31 UTC (rev 8267) @@ -77,6 +77,7 @@ import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; import net.sf.gridarta.validation.DelegatingMapValidator; +import net.sf.gridarta.validation.ValidatorPreferences; import net.sf.gridarta.validation.checks.AttributeRangeChecker; import net.sf.japi.swing.prefs.PreferencesGroup; import org.jetbrains.annotations.NotNull; @@ -110,10 +111,11 @@ * @param gameObjectSpells the game object spells to use * @param attributeRangeChecker the attribute range checker to use * @param pluginParameterFactory the plugin parameter factory to use + * @param validatorPreferences the validator preferences to use * @return the new instance */ @NotNull - DefaultMainControl<G, A, R> newMainControl(boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull GlobalSettings globalSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AutojoinLists<G, A, R> autojoinLists, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull ScriptModel<G, A, R> scriptModel, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory); + DefaultMainControl<G, A, R> newMainControl(boolean forceReadFromFiles, @NotNull ErrorView errorView, @NotNull GlobalSettings globalSettings, @NotNull ConfigSourceFactory configSourceFactory, @NotNull PathManager pathManager, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull ArchetypeTypeSet archetypeTypeSet, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull AutojoinLists<G, A, R> autojoinLists, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull ScriptModel<G, A, R> scriptModel, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull AbstractResources<G, A, R> resources, @NotNull Spells<NumberSpell> numberSpells, @NotNull Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final ValidatorPreferences validatorPreferences); /** * Returns the offset for drawing double faces. @@ -222,8 +224,9 @@ * @param globalSettings the global settings instance * @param gameObjectMatchers the defined game object matchers * @param attributeRangeChecker the attribute range checker to use + * @param validatorPreferences the validator preferences to use */ - void initMapValidators(@NotNull DelegatingMapValidator<G, A, R> mapValidators, @NotNull ErrorViewCollector errorViewCollector, @NotNull GlobalSettings globalSettings, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull AttributeRangeChecker<G, A, R> attributeRangeChecker); + void initMapValidators(@NotNull DelegatingMapValidator<G, A, R> mapValidators, @NotNull ErrorViewCollector errorViewCollector, @NotNull GlobalSettings globalSettings, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final ValidatorPreferences validatorPreferences); /** * Creates a new {@link AbstractArchetypeParser} instance. Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-06-07 19:38:16 UTC (rev 8266) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-06-08 16:45:31 UTC (rev 8267) @@ -95,7 +95,9 @@ import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SyntaxErrorException; import net.sf.gridarta.utils.SystemIcons; +import net.sf.gridarta.validation.DefaultValidatorPreferences; import net.sf.gridarta.validation.DelegatingMapValidator; +import net.sf.gridarta.validation.ValidatorPreferences; import net.sf.gridarta.validation.checks.AttributeRangeChecker; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; @@ -247,7 +249,8 @@ final AbstractMapManager<G, A, R> mapManager = new DefaultMapManager<G, A, R>(mapReaderFactory, mapControlFactory, globalSettings, faceObjectProviders); final MapManager<G, A, R> pickmapManager = new DefaultPickmapManager<G, A, R>(mapReaderFactory, mapControlFactory, globalSettings, faceObjectProviders); final ScriptModel<G, A, R> scriptModel = new ScriptModel<G, A, R>(); - final DelegatingMapValidator<G, A, R> validators = new DelegatingMapValidator<G, A, R>(); + final ValidatorPreferences validatorPreferences = new DefaultValidatorPreferences(); + final DelegatingMapValidator<G, A, R> validators = new DelegatingMapValidator<G, A, R>(validatorPreferences); final ScriptedEventEditor<G, A, R> scriptedEventEditor = new ScriptedEventEditor<G, A, R>(globalSettings); final NamedFilter defaultFilterList = new NamedFilter(Collections.<NamedGameObjectMatcher>emptyList()); final AbstractArchetypeParser<G, A, R, ?> archetypeParser = editorFactory.newArchetypeParser(errorView, gameObjectParser, animationObjects, archetypeSet, gameObjectFactory, globalSettings); @@ -255,10 +258,10 @@ final DefaultMainControl<G, A, R> mainControl; final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); final Spells<GameObjectSpell<G, A, R>> gameObjectSpells = new Spells<GameObjectSpell<G, A, R>>(); - final AttributeRangeChecker<G, A, R> attributeRangeChecker = new AttributeRangeChecker<G, A, R>(); + final AttributeRangeChecker<G, A, R> attributeRangeChecker = new AttributeRangeChecker<G, A, R>(validatorPreferences); final PluginParameterFactory<G, A, R> pluginParameterFactory = new PluginParameterFactory<G, A, R>(archetypeSet, mapManager, defaultFilterList); try { - mainControl = editorFactory.newMainControl(mode == Mode.COLLECT_ARCHES, errorView, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory); + mainControl = editorFactory.newMainControl(mode == Mode.COLLECT_ARCHES, errorView, globalSettings, configSourceFactory, pathManager, gameObjectMatchers, gameObjectFactory, archetypeTypeSet, archetypeSet, archetypeChooserModel, autojoinLists, mapManager, scriptModel, validators, scriptedEventEditor, resources, numberSpells, gameObjectSpells, attributeRangeChecker, pluginParameterFactory, validatorPreferences); } catch (final RuntimeException ex) { log.fatal(ex.getMessage(), ex); if (doExit) { Modified: trunk/src/app/net/sf/gridarta/validation/AbstractValidator.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/AbstractValidator.java 2010-06-07 19:38:16 UTC (rev 8266) +++ trunk/src/app/net/sf/gridarta/validation/AbstractValidator.java 2010-06-08 16:45:31 UTC (rev 8267) @@ -19,8 +19,6 @@ package net.sf.gridarta.validation; -import java.util.prefs.Preferences; -import net.sf.gridarta.MainControl; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; @@ -47,10 +45,10 @@ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** - * Preferences. + * The {@link ValidatorPreferences} to use. */ @NotNull - private static final Preferences preferences = Preferences.userNodeForPackage(MainControl.class); + private final ValidatorPreferences validatorPreferences; /** * Key. @@ -71,10 +69,12 @@ /** * Create an AbstractMapValidator. The key is generated from the validator's * name, which must end on "Checker". + * @param validatorPreferences the validator preferences to use * @throws IllegalArgumentException in case the validator's name does not * end on "Checker". */ - protected AbstractValidator() throws IllegalArgumentException { + protected AbstractValidator(@NotNull final ValidatorPreferences validatorPreferences) throws IllegalArgumentException { + this.validatorPreferences = validatorPreferences; final String name = getClass().getSimpleName(); if (!name.endsWith("Checker")) { throw new IllegalArgumentException("Class name must end with \"Checker\""); @@ -82,18 +82,20 @@ key = VALIDATOR_PREFIX + name.substring(0, name.indexOf("Checker")); final String defaultEnabledString = ACTION_BUILDER.getString(key + ".default"); defaultEnabled = Boolean.parseBoolean(defaultEnabledString); - enabled = preferences.getBoolean(key, defaultEnabled); + enabled = validatorPreferences.loadEnabled(key, defaultEnabled); } /** * Create an AbstractMapValidator. + * @param validatorPreferences the validator preferences to use * @param key Key */ - protected AbstractValidator(@NotNull final String key) { + protected AbstractValidator(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final String key) { + this.validatorPreferences = validatorPreferences; this.key = key; final String defaultEnabledString = ACTION_BUILDER.getString(key + ".default"); defaultEnabled = Boolean.parseBoolean(defaultEnabledString); - enabled = preferences.getBoolean(key, defaultEnabled); + enabled = validatorPreferences.loadEnabled(key, defaultEnabled); } /** @@ -110,8 +112,12 @@ */ @Override public void setEnabled(final boolean enabled) { + if (this.enabled == enabled) { + return; + } + this.enabled = enabled; - preferences.putBoolean(key, enabled); + validatorPreferences.saveEnabled(key, enabled); } /** Added: trunk/src/app/net/sf/gridarta/validation/DefaultValidatorPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/DefaultValidatorPreferences.java (rev 0) +++ trunk/src/app/net/sf/gridarta/validation/DefaultValidatorPreferences.java 2010-06-08 16:45:31 UTC (rev 8267) @@ -0,0 +1,55 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.validation; + +import java.util.prefs.Preferences; +import net.sf.gridarta.MainControl; +import org.jetbrains.annotations.NotNull; + +/** + * Default {@link ValidatorPreferences} implementations. Stores settings in + * preferences. + * @author Andreas Kirschbaum + */ +public class DefaultValidatorPreferences implements ValidatorPreferences { + + /** + * Preferences. + */ + @NotNull + private static final Preferences preferences = Preferences.userNodeForPackage(MainControl.class); + + /** + * {@inheritDoc} + */ + @Override + public boolean loadEnabled(@NotNull final String key, final boolean defaultEnabled) { + return preferences.getBoolean(key, defaultEnabled); + } + + /** + * {@inheritDoc} + */ + @Override + public void saveEnabled(@NotNull final String key, final boolean enabled) { + preferences.putBoolean(key, enabled); + } + +} // class DefaultValidatorPreferences Property changes on: trunk/src/app/net/sf/gridarta/validation/DefaultValidatorPreferences.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/validation/DelegatingMapValidator.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/DelegatingMapValidator.java 2010-06-07 19:38:16 UTC (rev 8266) +++ trunk/src/app/net/sf/gridarta/validation/DelegatingMapValidator.java 2010-06-08 16:45:31 UTC (rev 8267) @@ -51,17 +51,19 @@ /** * Create a DelegatingMapValidator for the default key. + * @param validatorPreferences the validator preferences to use */ - public DelegatingMapValidator() { - this(DEFAULT_KEY); + public DelegatingMapValidator(@NotNull final ValidatorPreferences validatorPreferences) { + this(validatorPreferences, DEFAULT_KEY); } /** * Create a DelegatingMapValidator for a specific key. + * @param validatorPreferences the validator preferences to use * @param key key */ - private DelegatingMapValidator(@NotNull final String key) { - super(key); + private DelegatingMapValidator(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final String key) { + super(validatorPreferences, key); } /** Added: trunk/src/app/net/sf/gridarta/validation/ValidatorPreferences.java =================================================================== --- trunk/src/app/net/sf/gridarta/validation/ValidatorPreferences.java (rev 0) +++ trunk/src/app/net/sf/gridarta/validation/ValidatorPreferences.java 2010-06-08 16:45:31 UTC (rev 8267) @@ -0,0 +1,45 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.validation; + +import org.jetbrains.annotations.NotNull; + +/** + * Configuration parameters for {@link Vali... [truncated message content] |
From: <aki...@us...> - 2010-06-07 19:38:22
|
Revision: 8266 http://gridarta.svn.sourceforge.net/gridarta/?rev=8266&view=rev Author: akirschbaum Date: 2010-06-07 19:38:16 +0000 (Mon, 07 Jun 2010) Log Message: ----------- Remove tooltips from archetype chooser. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/utils/ArchetypeToolTipProvider.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-06-07 19:06:57 UTC (rev 8265) +++ trunk/atrinik/ChangeLog 2010-06-07 19:38:16 UTC (rev 8266) @@ -1,5 +1,7 @@ 2010-06-07 Andreas Kirschbaum + * Remove tooltips from archetype chooser. + * Retain settings (except for view filters) of "View" menu across editor restarts. 2010-06-06 Andreas Kirschbaum Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-06-07 19:06:57 UTC (rev 8265) +++ trunk/crossfire/ChangeLog 2010-06-07 19:38:16 UTC (rev 8266) @@ -1,5 +1,7 @@ 2010-06-07 Andreas Kirschbaum + * Remove tooltips from archetype chooser. + * Retain settings (except for view filters) of "View" menu across editor restarts. 2010-06-06 Andreas Kirschbaum Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-06-07 19:06:57 UTC (rev 8265) +++ trunk/daimonin/ChangeLog 2010-06-07 19:38:16 UTC (rev 8266) @@ -1,5 +1,7 @@ 2010-06-07 Andreas Kirschbaum + * Remove tooltips from archetype chooser. + * Retain settings (except for view filters) of "View" menu across editor restarts. 2010-06-06 Andreas Kirschbaum Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2010-06-07 19:06:57 UTC (rev 8265) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2010-06-07 19:38:16 UTC (rev 8266) @@ -35,7 +35,6 @@ import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; -import net.sf.gridarta.gui.utils.ArchetypeToolTipProvider; import net.sf.gridarta.gui.utils.GList; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserFolder; @@ -151,7 +150,6 @@ public ArchetypePanel(@NotNull final ArchetypeChooserView<G, A, R> archetypeChooserView, @NotNull final ArchetypeChooserPanel<G, A, R> archetypeChooserPanel) { super(new BorderLayout()); this.archetypeChooserPanel = archetypeChooserPanel; - archetypeList.setToolTipProvider(new ArchetypeToolTipProvider<R>()); archetypeList.setFocusable(false); archetypeList.setBackground(CommonConstants.BG_COLOR); archetypeList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); Deleted: trunk/src/app/net/sf/gridarta/gui/utils/ArchetypeToolTipProvider.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/ArchetypeToolTipProvider.java 2010-06-07 19:06:57 UTC (rev 8265) +++ trunk/src/app/net/sf/gridarta/gui/utils/ArchetypeToolTipProvider.java 2010-06-07 19:38:16 UTC (rev 8266) @@ -1,48 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.utils; - -import net.sf.gridarta.model.archetype.Archetype; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * A {@link ToolTipProvider} for {@link Archetype}s. - * @author Andreas Kirschbaum - */ -public class ArchetypeToolTipProvider<R extends Archetype<?, ?, R>> implements ToolTipProvider<R> { - - /** - * {@inheritDoc} - */ - @Nullable - @Override - public String getToolTipText(@NotNull final R element) { - final StringBuilder sb = new StringBuilder(); - sb.append("<html>Archetype "); - sb.append(element.getArchetypeName()); - sb.append("<br>"); - sb.append(element.getBestName()); - sb.append("<br>"); - sb.append(element.getObjectText().replaceAll("\n$", "").replaceAll("\n", "<br>")); - return sb.toString(); - } - -} // class ArchetypeToolTipProvider This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-07 19:07:03
|
Revision: 8265 http://gridarta.svn.sourceforge.net/gridarta/?rev=8265&view=rev Author: akirschbaum Date: 2010-06-07 19:06:57 +0000 (Mon, 07 Jun 2010) Log Message: ----------- Do not ignore super function. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/utils/GList.java Modified: trunk/src/app/net/sf/gridarta/gui/utils/GList.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/GList.java 2010-06-07 18:58:31 UTC (rev 8264) +++ trunk/src/app/net/sf/gridarta/gui/utils/GList.java 2010-06-07 19:06:57 UTC (rev 8265) @@ -70,12 +70,12 @@ public String getToolTipText(@NotNull final MouseEvent event) { final int index = locationToIndex(event.getPoint()); if (index == -1) { - return null; + return super.getToolTipText(event); } final Rectangle rectangle = getCellBounds(index, index); if (!rectangle.contains(event.getPoint())) { - return null; + return super.getToolTipText(event); } //JList does not use type parameters @@ -83,7 +83,7 @@ final T element = (T) getModel().getElementAt(index); if (toolTipProvider == null) { - return null; + return super.getToolTipText(event); } return toolTipProvider.getToolTipText(element); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-07 18:58:38
|
Revision: 8264 http://gridarta.svn.sourceforge.net/gridarta/?rev=8264&view=rev Author: akirschbaum Date: 2010-06-07 18:58:31 +0000 (Mon, 07 Jun 2010) Log Message: ----------- Add @NotNull annotations. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java 2010-06-07 18:53:04 UTC (rev 8263) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java 2010-06-07 18:58:31 UTC (rev 8264) @@ -57,6 +57,7 @@ /** * The key for saving the display mode selection. */ + @NotNull private static final String DISPLAY_MODE_KEY = "archetypeChooserDisplayMode"; /** @@ -67,11 +68,13 @@ /** * Action Builder. */ + @NotNull private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** * Preferences. */ + @NotNull private static final Preferences preferences = Preferences.userNodeForPackage(MainControl.class); /** @@ -112,12 +115,14 @@ * The tab panel containing the archetype lists. * @serial */ + @NotNull private final JTabbedPane tabDesktop = new JTabbedPane(SwingConstants.TOP); /** * Indicates whether object names are shown. * @serial */ + @NotNull private DisplayMode<G, A, R> displayMode; /** @@ -144,6 +149,7 @@ /** * The change listener attached to {@link #tabDesktop}. */ + @NotNull private final ChangeListener changeListener = new ChangeListener() { /** {@inheritDoc} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-07 18:53:10
|
Revision: 8263 http://gridarta.svn.sourceforge.net/gridarta/?rev=8263&view=rev Author: akirschbaum Date: 2010-06-07 18:53:04 +0000 (Mon, 07 Jun 2010) Log Message: ----------- Retain settings (except for view filters) of "View" menu across editor restarts. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java trunk/src/app/net/sf/gridarta/model/mapviewsettings/DefaultMapViewSettings.java trunk/src/test/net/sf/gridarta/model/mapviewsettings/TestMapViewSettings.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-06-07 18:30:34 UTC (rev 8262) +++ trunk/atrinik/ChangeLog 2010-06-07 18:53:04 UTC (rev 8263) @@ -1,3 +1,7 @@ +2010-06-07 Andreas Kirschbaum + + * Retain settings (except for view filters) of "View" menu across editor restarts. + 2010-06-06 Andreas Kirschbaum * Drop recent menu entries for maps with non-existent map files. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-06-07 18:30:34 UTC (rev 8262) +++ trunk/crossfire/ChangeLog 2010-06-07 18:53:04 UTC (rev 8263) @@ -1,3 +1,7 @@ +2010-06-07 Andreas Kirschbaum + + * Retain settings (except for view filters) of "View" menu across editor restarts. + 2010-06-06 Andreas Kirschbaum * Drop recent menu entries for maps with non-existent map files. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-06-07 18:30:34 UTC (rev 8262) +++ trunk/daimonin/ChangeLog 2010-06-07 18:53:04 UTC (rev 8263) @@ -1,3 +1,7 @@ +2010-06-07 Andreas Kirschbaum + + * Retain settings (except for view filters) of "View" menu across editor restarts. + 2010-06-06 Andreas Kirschbaum * Drop recent menu entries for maps with non-existent map files. Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2010-06-07 18:30:34 UTC (rev 8262) +++ trunk/src/app/net/sf/gridarta/messages.properties 2010-06-07 18:53:04 UTC (rev 8263) @@ -1099,7 +1099,6 @@ prefs.archDirectory=Archetype directory. prefs.archetypeChooserDisplayMode=The display mode of the archetype chooser: 0=game object names, 1=archetype names, 2=icons only. prefs.autoGeneratePreviews=If set, automatically generate map preview images. -prefs.autojoin=Whether autojoining is enabled. prefs.autoValidate=Whether the map validator is run automatically after each change. prefs.bookmarkFilename=Bookmark filename. prefs.bookmarkNum=Number of used bookmark entries. @@ -1123,6 +1122,11 @@ prefs.mapDirectory=Maps directory. prefs.MapSquareBottom=true=display Game Object Attribute Dialog at bottom, false=display at right side. prefs.MapValidator.All=Whether the map validator is enabled. +prefs.mapViewSettings.gridVisible=Whether the map grid is visible. +prefs.mapViewSettings.smoothing=Whether smoothing is active. +prefs.mapViewSettings.doubleFaces=Whether double faces are shown. +prefs.mapViewSettings.alphaType=The settings for alpha faces. +prefs.mapViewSettings.autojoin=Whether autojoining is enabled. prefs.NewMapDialog.difficulty=Last selected map difficulty in New Map Dialog. prefs.NewMapDialog.mapHeight=Last selected map width in New Map Dialog. prefs.NewMapDialog.mapWidth=Last selected map height in New Map Dialog. Modified: trunk/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java 2010-06-07 18:30:34 UTC (rev 8262) +++ trunk/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java 2010-06-07 18:53:04 UTC (rev 8263) @@ -35,27 +35,27 @@ /** * The visibility of the grid. */ - private boolean gridVisible = false; + private boolean gridVisible = loadGridVisible(); /** * Whether smoothing display is active. */ - private boolean smoothing = false; + private boolean smoothing = loadSmoothing(); /** * Whether double faces should be drawn double height. */ - private boolean doubleFaces = false; + private boolean doubleFaces = loadDoubleFaces(); /** * Bit field of edit types to show transparent. */ - private int alphaType = 0; + private int alphaType = loadAlphaType(); /** * Bit field of edit types to show only. */ - private int editType = 0; + private int editType = loadEditType(); /** * Whether autojoining is on/off. @@ -120,6 +120,7 @@ } this.gridVisible = gridVisible; + saveGridVisible(gridVisible); fireGridVisibleChanged(); } @@ -143,6 +144,7 @@ } this.smoothing = smoothing; + saveSmoothing(smoothing); fireSmoothingChanged(); } @@ -167,6 +169,7 @@ } this.doubleFaces = doubleFaces; + saveDoubleFaces(doubleFaces); fireDoubleFacesChanged(); } @@ -194,6 +197,7 @@ } else { alphaType &= ~v; } + saveAlphaType(alphaType); fireAlphaTypeChanged(); } @@ -203,6 +207,7 @@ @Override public void clearAlpha() { alphaType = 0; + saveAlphaType(alphaType); fireAlphaTypeChanged(); } @@ -226,6 +231,7 @@ } this.editType |= editType; + saveEditType(this.editType); fireEditTypeChanged(); } @@ -241,6 +247,7 @@ } this.editType &= ~editType; + saveEditType(this.editType); fireEditTypeChanged(); } @@ -371,6 +378,66 @@ } /** + * Loads the default value for {@link #gridVisible}. + * @return the default value + */ + protected abstract boolean loadGridVisible(); + + /** + * Saves the {@link #gridVisible} value. + * @param gridVisible the grid visible value + */ + protected abstract void saveGridVisible(final boolean gridVisible); + + /** + * Loads the default value for {@link #smoothing}. + * @return the default value + */ + protected abstract boolean loadSmoothing(); + + /** + * Saves the {@link #smoothing} value. + * @param smoothing the smoothing value + */ + protected abstract void saveSmoothing(final boolean smoothing); + + /** + * Loads the default value for {@link #doubleFaces}. + * @return the default value + */ + protected abstract boolean loadDoubleFaces(); + + /** + * Saves the {@link #doubleFaces} value. + * @param doubleFaces the double faces value + */ + protected abstract void saveDoubleFaces(final boolean doubleFaces); + + /** + * Loads the default value for {@link #alphaType}. + * @return the default value + */ + protected abstract int loadAlphaType(); + + /** + * Saves the {@link #alphaType} value. + * @param alphaType the alpha type value + */ + protected abstract void saveAlphaType(final int alphaType); + + /** + * Loads the default value for {@link #editType}. + * @return the default value + */ + protected abstract int loadEditType(); + + /** + * Saves the {@link #editType} }value. + * @param editType the edit type value + */ + protected abstract void saveEditType(final int editType); + + /** * Loads the default value for {@link #autojoin}. * @return the default value */ Modified: trunk/src/app/net/sf/gridarta/model/mapviewsettings/DefaultMapViewSettings.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/mapviewsettings/DefaultMapViewSettings.java 2010-06-07 18:30:34 UTC (rev 8262) +++ trunk/src/app/net/sf/gridarta/model/mapviewsettings/DefaultMapViewSettings.java 2010-06-07 18:53:04 UTC (rev 8263) @@ -32,10 +32,34 @@ public class DefaultMapViewSettings extends AbstractMapViewSettings { /** + * Key for saving {@link #gridVisible} state in preferences. + */ + @NotNull + private static final String GRID_VISIBLE_KEY = "mapViewSettings.gridVisible"; + + /** + * Key for saving {@link #smoothing} state in preferences. + */ + @NotNull + private static final String SMOOTHING_KEY = "mapViewSettings.smoothing"; + + /** + * Key for saving {@link #doubleFaces} state in preferences. + */ + @NotNull + private static final String DOUBLE_FACES_KEY = "mapViewSettings.doubleFaces"; + + /** + * Key for saving {@link #alphaType} state in preferences. + */ + @NotNull + private static final String ALPHA_TYPE_KEY = "mapViewSettings.alphaType"; + + /** * Key for saving {@link #autojoin} state in preferences. */ @NotNull - private static final String AUTOJOIN_KEY = "autojoin"; + private static final String AUTOJOIN_KEY = "mapViewSettings.autojoin"; /** * Preferences. @@ -47,6 +71,86 @@ * {@inheritDoc} */ @Override + protected boolean loadGridVisible() { + return preferences.getBoolean(GRID_VISIBLE_KEY, false); + } + + /** + * {@inheritDoc} + */ + @Override + protected void saveGridVisible(final boolean gridVisible) { + preferences.putBoolean(GRID_VISIBLE_KEY, gridVisible); + } + + /** + * {@inheritDoc} + */ + @Override + protected boolean loadSmoothing() { + return preferences.getBoolean(SMOOTHING_KEY, false); + } + + /** + * {@inheritDoc} + */ + @Override + protected void saveSmoothing(final boolean smoothing) { + preferences.putBoolean(SMOOTHING_KEY, smoothing); + } + + /** + * {@inheritDoc} + */ + @Override + protected boolean loadDoubleFaces() { + return preferences.getBoolean(DOUBLE_FACES_KEY, false); + } + + /** + * {@inheritDoc} + */ + @Override + protected void saveDoubleFaces(final boolean doubleFaces) { + preferences.putBoolean(DOUBLE_FACES_KEY, doubleFaces); + } + + /** + * {@inheritDoc} + */ + @Override + protected int loadAlphaType() { + return preferences.getInt(ALPHA_TYPE_KEY, 0); + } + + /** + * {@inheritDoc} + */ + @Override + protected void saveAlphaType(final int alphaType) { + preferences.putInt(ALPHA_TYPE_KEY, alphaType); + } + + /** + * {@inheritDoc} + */ + @Override + protected int loadEditType() { + return 0; + } + + /** + * {@inheritDoc} + */ + @Override + protected void saveEditType(final int editType) { + // ignore: retaining edit types would be confusing for the user + } + + /** + * {@inheritDoc} + */ + @Override protected boolean loadAutojoin() { return preferences.getBoolean(AUTOJOIN_KEY, false); } Modified: trunk/src/test/net/sf/gridarta/model/mapviewsettings/TestMapViewSettings.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/mapviewsettings/TestMapViewSettings.java 2010-06-07 18:30:34 UTC (rev 8262) +++ trunk/src/test/net/sf/gridarta/model/mapviewsettings/TestMapViewSettings.java 2010-06-07 18:53:04 UTC (rev 8263) @@ -30,6 +30,86 @@ * {@inheritDoc} */ @Override + protected boolean loadGridVisible() { + return false; + } + + /** + * {@inheritDoc} + */ + @Override + protected void saveGridVisible(final boolean gridVisible) { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + protected boolean loadSmoothing() { + return false; + } + + /** + * {@inheritDoc} + */ + @Override + protected void saveSmoothing(final boolean smoothing) { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + protected boolean loadDoubleFaces() { + return false; + } + + /** + * {@inheritDoc} + */ + @Override + protected void saveDoubleFaces(final boolean doubleFaces) { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + protected int loadAlphaType() { + return 0; + } + + /** + * {@inheritDoc} + */ + @Override + protected void saveAlphaType(final int alphaType) { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + protected int loadEditType() { + return 0; + } + + /** + * {@inheritDoc} + */ + @Override + protected void saveEditType(final int editType) { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override protected boolean loadAutojoin() { return false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-06-07 18:30:42
|
Revision: 8262 http://gridarta.svn.sourceforge.net/gridarta/?rev=8262&view=rev Author: akirschbaum Date: 2010-06-07 18:30:34 +0000 (Mon, 07 Jun 2010) Log Message: ----------- Make regression tests independent on editor settings. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java trunk/src/app/net/sf/gridarta/model/mapviewsettings/MapViewSettings.java trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java trunk/src/app/net/sf/gridarta/model/mapviewsettings/DefaultMapViewSettings.java trunk/src/test/net/sf/gridarta/model/mapviewsettings/ trunk/src/test/net/sf/gridarta/model/mapviewsettings/TestMapViewSettings.java Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-06-07 07:41:06 UTC (rev 8261) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-06-07 18:30:34 UTC (rev 8262) @@ -77,6 +77,7 @@ import net.sf.gridarta.model.map.mapcontrol.MapControlFactory; import net.sf.gridarta.model.map.mapmodel.InsertionMode; import net.sf.gridarta.model.map.mapmodel.TopmostInsertionMode; +import net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.NamedGameObjectMatcher; @@ -219,7 +220,7 @@ final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); final ConfigSourceFactory configSourceFactory = new DefaultConfigSourceFactory(); - final MapViewSettings mapViewSettings = new MapViewSettings(); + final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); final GlobalSettings globalSettings = editorFactory.newGlobalSettings(configSourceFactory); final PathManager pathManager = new PathManager(globalSettings); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); Modified: trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2010-06-07 07:41:06 UTC (rev 8261) +++ trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2010-06-07 18:30:34 UTC (rev 8262) @@ -52,6 +52,7 @@ import net.sf.gridarta.model.map.mapcontrol.MapControlFactory; import net.sf.gridarta.model.map.mapmodel.InsertionMode; import net.sf.gridarta.model.map.mapmodel.TopmostInsertionMode; +import net.sf.gridarta.model.mapviewsettings.DefaultMapViewSettings; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.NamedGameObjectMatcher; @@ -103,7 +104,7 @@ final ArchetypeFactory<G, A, R> archetypeFactory = editorFactory.newArchetypeFactory(faceObjectProviders, animationObjects); final GameObjectParser<G, A, R> gameObjectParser = gameObjectParserFactory.newGameObjectParser(); final ArchetypeSet<G, A, R> archetypeSet = editorFactory.newArchetypeSet(globalSettings, archetypeFactory, gameObjectParser, faceObjectProviders); - final MapViewSettings mapViewSettings = new MapViewSettings(); + final MapViewSettings mapViewSettings = new DefaultMapViewSettings(); final MapReaderFactory<G, A> mapReaderFactory = new DefaultMapReaderFactory<G, A, R>(mapArchObjectFactory, mapArchObjectParserFactory, gameObjectParserFactory, archetypeSet, mapViewSettings); final MapWriter<G, A, R> mapWriter = new DefaultMapWriter<G, A, R>(mapArchObjectParserFactory, gameObjectParser); final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(mapViewSettings); Added: trunk/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java 2010-06-07 18:30:34 UTC (rev 8262) @@ -0,0 +1,385 @@ +/* + * 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.mapviewsettings; + +import net.sf.gridarta.gui.utils.GUIConstants; +import net.sf.gridarta.model.baseobject.BaseObject; +import net.sf.gridarta.model.match.ViewGameObjectMatcherManager; +import net.sf.gridarta.utils.EventListenerList2; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Abstract base class for {@link MapViewSettings} implementations. + * @author Andreas Kirschbaum + */ +public abstract class AbstractMapViewSettings implements MapViewSettings { + + /** + * The visibility of the grid. + */ + private boolean gridVisible = false; + + /** + * Whether smoothing display is active. + */ + private boolean smoothing = false; + + /** + * Whether double faces should be drawn double height. + */ + private boolean doubleFaces = false; + + /** + * Bit field of edit types to show transparent. + */ + private int alphaType = 0; + + /** + * Bit field of edit types to show only. + */ + private int editType = 0; + + /** + * Whether autojoining is on/off. + */ + private boolean autojoin = loadAutojoin(); + + /** + * The transparency settings. + */ + // TODO: use this field (it looks unused but usage is planned) + @Nullable + private ViewGameObjectMatcherManager transparencyManager = null; + + /** + * The visibility settings. + */ + // TODO: use this field (it looks unused but usage is planned) + @Nullable + private ViewGameObjectMatcherManager visibilityManager = null; + + /** + * The MapViewSettingsListeners to inform of changes. + */ + @NotNull + private final EventListenerList2<MapViewSettingsListener> listenerList = new EventListenerList2<MapViewSettingsListener>(MapViewSettingsListener.class); + + /** + * {@inheritDoc} + */ + @Override + public void addMapViewSettingsListener(@NotNull final MapViewSettingsListener listener) { + listenerList.add(listener); + } + + /** + * {@inheritDoc} + */ + @Override + public void removeMapViewSettingsListener(@NotNull final MapViewSettingsListener listener) { + listenerList.remove(listener); + } + + /** + * Get the visibility of the grid. + * @return visibility of the grid (<code>true</code> for visible, + * <code>false</code> for invisible) + */ + @Override + public boolean isGridVisible() { + return gridVisible; + } + + /** + * Set the visibility of the grid. + * @param gridVisible new visibility of the grid (<code>true</code> for + * making the grid visible, <code>false</code> for invisible) + */ + @Override + public void setGridVisible(final boolean gridVisible) { + if (this.gridVisible == gridVisible) { + return; + } + + this.gridVisible = gridVisible; + fireGridVisibleChanged(); + } + + /** + * Returns the smoothing setting. + * @return the smoothing setting + */ + @Override + public boolean isSmoothing() { + return smoothing; + } + + /** + * Sets the smoothing setting. + * @param smoothing the new smoothing setting + */ + @Override + public void setSmoothing(final boolean smoothing) { + if (this.smoothing == smoothing) { + return; + } + + this.smoothing = smoothing; + fireSmoothingChanged(); + } + + /** + * Get whether double faces are drawn double height. + * @return <code>true</code> if double faces are drawn double height, + * otherwise <code>false</code> + */ + @Override + public boolean isDoubleFaces() { + return doubleFaces; + } + + /** + * Sets whether double faces should be drawn double height. + * @param doubleFaces whether double faces should be drawn double height + */ + @Override + public void setDoubleFaces(final boolean doubleFaces) { + if (this.doubleFaces == doubleFaces) { + return; + } + + this.doubleFaces = doubleFaces; + fireDoubleFacesChanged(); + } + + /** + * Returns whether the specified edit type is to be shown transparent. + * @param v edit type to check + * @return <code>true</code> if to be displayed transparent, otherwise + * <code>false</code> + */ + @Override + public boolean isAlphaType(final int v) { + return v > 0 && (alphaType & v) == v; + } + + /** + * Sets whether the specified edit type is to be shown transparent. + * @param v edit type to set + * @param state state, <code>true</code> to make edit type <code>v</code> + * transparent, <code>false</code> for opaque + */ + @Override + public void setAlphaType(final int v, final boolean state) { + if (state) { + alphaType |= v; + } else { + alphaType &= ~v; + } + fireAlphaTypeChanged(); + } + + /** + * Clear the transparency. + */ + @Override + public void clearAlpha() { + alphaType = 0; + fireAlphaTypeChanged(); + } + + /** + * Returns the currently set edit type. + * @return the currently set edit type. + */ + @Override + public int getEditType() { + return editType; + } + + /** + * Set the map view to show squares of the given type. (If no edit type is + * set, everything is displayed) + * @param editType edit type bitmask of types to show + */ + private void setEditType(final int editType) { + if ((this.editType & editType) == editType) { + return; + } + + this.editType |= editType; + fireEditTypeChanged(); + } + + /** + * Set the map view to hide squares of the given type. (If no edit type is + * set, everything is displayed) + * @param editType edit type bitmask of types to hide + */ + @Override + public void unsetEditType(final int editType) { + if ((this.editType & editType) == 0) { + return; + } + + this.editType &= ~editType; + fireEditTypeChanged(); + } + + /** + * Get information on the current state of edit type. Are squares of type + * 'editType' displayed? + * @param editType are squares of this type displayed? + * @return <code>true</code> if these squares are currently displayed + */ + @Override + public boolean isEditType(final int editType) { + final int mask = editType == 0 ? GUIConstants.EDIT_TYPE_NONE : editType; + return (this.editType & mask) != 0; + } + + /** + * Get information whether the gameObject is edited. Are squares of type 'v' + * displayed? + * @param gameObject are squares of this type displayed? + * @return true if these squares are currently displayed + */ + @Override + public boolean isEditType(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { + return editType == 0 || isEditType(gameObject.getEditType()); + } + + /** + * Returns whether a editType value is set so that not all squares are + * displayed. + * @return <code>true</code> if a editType value is set, otherwise + * <code>false</code>. + */ + @Override + public boolean isEditTypeSet() { + return (editType & GUIConstants.EDIT_TYPE_NONE) == 0 && editType != 0; + } + + /** + * Toggle an edit type. + * @param editType the edit type to toggle + */ + @Override + public void toggleEditType(final int editType) { + if (isEditType(editType)) { + unsetEditType(editType); + } else { + setEditType(editType); + } + } + + /** + * Returns whether "autojoin" is enabled. + * @return the autojoin state + */ + @Override + public boolean isAutojoin() { + return autojoin; + } + + /** + * Sets the "autojoin" state. + * @param autojoin if set, enable autojoining + */ + @Override + public void setAutojoin(final boolean autojoin) { + if (this.autojoin == autojoin) { + return; + } + + this.autojoin = autojoin; + saveAutojoin(autojoin); + fireAutojoinChanged(); + } + + /** + * Informs all registered listeners that the grid visibility has changed. + */ + private void fireGridVisibleChanged() { + for (final MapViewSettingsListener listener : listenerList.getListeners()) { + listener.gridVisibleChanged(gridVisible); + } + } + + /** + * Informs all registered listeners that the smoothing setting has changed. + */ + private void fireSmoothingChanged() { + for (final MapViewSettingsListener listener : listenerList.getListeners()) { + listener.smoothingChanged(smoothing); + } + } + + /** + * Informs all registered listeners that the double faces visibility has + * changed. + */ + private void fireDoubleFacesChanged() { + for (final MapViewSettingsListener listener : listenerList.getListeners()) { + listener.doubleFacesChanged(doubleFaces); + } + } + + /** + * Informs all registered listeners that the alpha type haves changed. + */ + private void fireAlphaTypeChanged() { + for (final MapViewSettingsListener listener : listenerList.getListeners()) { + listener.alphaTypeChanged(alphaType); + } + } + + /** + * Notify all listeners about changed {@link #editType}. + */ + private void fireEditTypeChanged() { + for (final MapViewSettingsListener listener : listenerList.getListeners()) { + listener.editTypeChanged(editType); + } + } + + /** + * Notify all listeners about changed {@link #autojoin}. + */ + private void fireAutojoinChanged() { + for (final MapViewSettingsListener listener : listenerList.getListeners()) { + listener.autojoinChanged(autojoin); + } + } + + /** + * Loads the default value for {@link #autojoin}. + * @return the default value + */ + protected abstract boolean loadAutojoin(); + + /** + * Saves the autojoin value. + * @param autojoin the autojoin value + */ + protected abstract void saveAutojoin(final boolean autojoin); + +} // class AbstractMapViewSettings Property changes on: trunk/src/app/net/sf/gridarta/model/mapviewsettings/AbstractMapViewSettings.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/model/mapviewsettings/DefaultMapViewSettings.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/mapviewsettings/DefaultMapViewSettings.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/mapviewsettings/DefaultMapViewSettings.java 2010-06-07 18:30:34 UTC (rev 8262) @@ -0,0 +1,62 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.mapviewsettings; + +import java.util.prefs.Preferences; +import net.sf.gridarta.MainControl; +import org.jetbrains.annotations.NotNull; + +/** + * Default {@link MapViewSettings} implementation. Attributes are retained + * across editor restarts. The attributes are stored in the {@link + * Preferences}. + * @author Andreas Kirschbaum + */ +public class DefaultMapViewSettings extends AbstractMapViewSettings { + + /** + * Key for saving {@link #autojoin} state in preferences. + */ + @NotNull + private static final String AUTOJOIN_KEY = "autojoin"; + + /** + * Preferences. + */ + @NotNull + private static final Preferences preferences = Preferences.userNodeForPackage(MainControl.class); + + /** + * {@inheritDoc} + */ + @Override + protected boolean loadAutojoin() { + return preferences.getBoolean(AUTOJOIN_KEY, false); + } + + /** + * {@inheritDoc} + */ + @Override + protected void saveAutojoin(final boolean autojoin) { + preferences.putBoolean(AUTOJOIN_KEY, autojoin); + } + +} // class DefaultMapViewSettings Property changes on: trunk/src/app/net/sf/gridarta/model/mapviewsettings/DefaultMapViewSettings.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/model/mapviewsettings/MapViewSettings.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/mapviewsettings/MapViewSettings.java 2010-06-07 07:41:06 UTC (rev 8261) +++ trunk/src/app/net/sf/gridarta/model/mapviewsettings/MapViewSettings.java 2010-06-07 18:30:34 UTC (rev 8262) @@ -19,230 +19,74 @@ package net.sf.gridarta.model.mapviewsettings; -import java.util.prefs.Preferences; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.gui.utils.GUIConstants; import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.match.ViewGameObjectMatcherManager; -import net.sf.gridarta.utils.EventListenerList2; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Container for settings that affect the rendering of maps. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public class MapViewSettings { +public interface MapViewSettings { /** - * Key for saving {@link #autojoin} state in preferences. - */ - @NotNull - private static final String AUTOJOIN_KEY = "autojoin"; - - /** - * Preferences. - */ - @NotNull - private static final Preferences preferences = Preferences.userNodeForPackage(MainControl.class); - - /** - * The visibility of the grid. - */ - private boolean gridVisible = false; - - /** - * Whether smoothing display is active. - */ - private boolean smoothing = false; - - /** - * Whether double faces should be drawn double height. - */ - private boolean doubleFaces = false; - - /** - * Bit field of edit types to show transparent. - */ - private int alphaType = 0; - - /** - * Bit field of edit types to show only. - */ - private int editType = 0; - - /** - * Whether autojoining is on/off. - */ - private boolean autojoin = preferences.getBoolean(AUTOJOIN_KEY, false); - - /** - * The transparency settings. - */ - // TODO: use this field (it looks unused but usage is planned) - @Nullable - private ViewGameObjectMatcherManager transparencyManager = null; - - /** - * The visibility settings. - */ - // TODO: use this field (it looks unused but usage is planned) - @Nullable - private ViewGameObjectMatcherManager visibilityManager = null; - - /** - * The MapViewSettingsListeners to inform of changes. - */ - @NotNull - private final EventListenerList2<MapViewSettingsListener> listenerList = new EventListenerList2<MapViewSettingsListener>(MapViewSettingsListener.class); - - /** * Register a MapViewSettingsListener. * @param listener MapViewSettingsListener to register */ - public void addMapViewSettingsListener(@NotNull final MapViewSettingsListener listener) { - listenerList.add(listener); - } + void addMapViewSettingsListener(@NotNull MapViewSettingsListener listener); /** * Unregister a MapViewSettingsListener. * @param listener MapViewSettingsListener to unregister */ - public void removeMapViewSettingsListener(@NotNull final MapViewSettingsListener listener) { - listenerList.remove(listener); - } + void removeMapViewSettingsListener(@NotNull MapViewSettingsListener listener); /** - * Informs all registered listeners that the grid visibility has changed. - */ - private void fireGridVisibleChanged() { - for (final MapViewSettingsListener listener : listenerList.getListeners()) { - listener.gridVisibleChanged(gridVisible); - } - } - - /** - * Informs all registered listeners that the smoothing setting has changed. - */ - private void fireSmoothingChanged() { - for (final MapViewSettingsListener listener : listenerList.getListeners()) { - listener.smoothingChanged(smoothing); - } - } - - /** - * Informs all registered listeners that the double faces visibility has - * changed. - */ - private void fireDoubleFacesChanged() { - for (final MapViewSettingsListener listener : listenerList.getListeners()) { - listener.doubleFacesChanged(doubleFaces); - } - } - - /** - * Informs all registered listeners that the alpha type haves changed. - */ - private void fireAlphaTypeChanged() { - for (final MapViewSettingsListener listener : listenerList.getListeners()) { - listener.alphaTypeChanged(alphaType); - } - } - - /** - * Notify all listeners about changed {@link #editType}. - */ - private void fireEditTypeChanged() { - for (final MapViewSettingsListener listener : listenerList.getListeners()) { - listener.editTypeChanged(editType); - } - } - - /** - * Notify all listeners about changed {@link #autojoin}. - */ - private void fireAutojoinChanged() { - for (final MapViewSettingsListener listener : listenerList.getListeners()) { - listener.autojoinChanged(autojoin); - } - } - - /** * Get the visibility of the grid. * @return visibility of the grid (<code>true</code> for visible, * <code>false</code> for invisible) */ - public boolean isGridVisible() { - return gridVisible; - } + boolean isGridVisible(); /** * Set the visibility of the grid. * @param gridVisible new visibility of the grid (<code>true</code> for * making the grid visible, <code>false</code> for invisible) */ - public void setGridVisible(final boolean gridVisible) { - if (this.gridVisible == gridVisible) { - return; - } + void setGridVisible(boolean gridVisible); - this.gridVisible = gridVisible; - fireGridVisibleChanged(); - } - /** * Returns the smoothing setting. * @return the smoothing setting */ - public boolean isSmoothing() { - return smoothing; - } + boolean isSmoothing(); /** * Sets the smoothing setting. * @param smoothing the new smoothing setting */ - public void setSmoothing(final boolean smoothing) { - if (this.smoothing == smoothing) { - return; - } + void setSmoothing(boolean smoothing); - this.smoothing = smoothing; - fireSmoothingChanged(); - } - /** * Get whether double faces are drawn double height. * @return <code>true</code> if double faces are drawn double height, * otherwise <code>false</code> */ - public boolean isDoubleFaces() { - return doubleFaces; - } + boolean isDoubleFaces(); /** * Sets whether double faces should be drawn double height. * @param doubleFaces whether double faces should be drawn double height */ - public void setDoubleFaces(final boolean doubleFaces) { - if (this.doubleFaces == doubleFaces) { - return; - } + void setDoubleFaces(final boolean doubleFaces); - this.doubleFaces = doubleFaces; - fireDoubleFacesChanged(); - } - /** * Returns whether the specified edit type is to be shown transparent. * @param v edit type to check * @return <code>true</code> if to be displayed transparent, otherwise * <code>false</code> */ - public boolean isAlphaType(final int v) { - return v > 0 && (alphaType & v) == v; - } + boolean isAlphaType(int v); /** * Sets whether the specified edit type is to be shown transparent. @@ -250,69 +94,33 @@ * @param state state, <code>true</code> to make edit type <code>v</code> * transparent, <code>false</code> for opaque */ - public void setAlphaType(final int v, final boolean state) { - if (state) { - alphaType |= v; - } else { - alphaType &= ~v; - } - fireAlphaTypeChanged(); - } + void setAlphaType(int v, boolean state); /** * Clear the transparency. */ - public void clearAlpha() { - alphaType = 0; - fireAlphaTypeChanged(); - } + void clearAlpha(); /** * Returns the currently set edit type. * @return the currently set edit type. */ - public int getEditType() { - return editType; - } + int getEditType(); /** - * Set the map view to show squares of the given type. (If no edit type is - * set, everything is displayed) - * @param editType edit type bitmask of types to show - */ - private void setEditType(final int editType) { - if ((this.editType & editType) == editType) { - return; - } - - this.editType |= editType; - fireEditTypeChanged(); - } - - /** * Set the map view to hide squares of the given type. (If no edit type is * set, everything is displayed) * @param editType edit type bitmask of types to hide */ - public void unsetEditType(final int editType) { - if ((this.editType & editType) == 0) { - return; - } + void unsetEditType(int editType); - this.editType &= ~editType; - fireEditTypeChanged(); - } - /** * Get information on the current state of edit type. Are squares of type * 'editType' displayed? * @param editType are squares of this type displayed? * @return <code>true</code> if these squares are currently displayed */ - public boolean isEditType(final int editType) { - final int mask = editType == 0 ? GUIConstants.EDIT_TYPE_NONE : editType; - return (this.editType & mask) != 0; - } + boolean isEditType(int editType); /** * Get information whether the gameObject is edited. Are squares of type 'v' @@ -320,9 +128,7 @@ * @param gameObject are squares of this type displayed? * @return true if these squares are currently displayed */ - public boolean isEditType(@NotNull final BaseObject<?, ?, ?, ?> gameObject) { - return editType == 0 || isEditType(gameObject.getEditType()); - } + boolean isEditType(@NotNull BaseObject<?, ?, ?, ?> gameObject); /** * Returns whether a editType value is set so that not all squares are @@ -330,42 +136,24 @@ * @return <code>true</code> if a editType value is set, otherwise * <code>false</code>. */ - public boolean isEditTypeSet() { - return (editType & GUIConstants.EDIT_TYPE_NONE) == 0 && editType != 0; - } + boolean isEditTypeSet(); /** * Toggle an edit type. * @param editType the edit type to toggle */ - public void toggleEditType(final int editType) { - if (isEditType(editType)) { - unsetEditType(editType); - } else { - setEditType(editType); - } - } + void toggleEditType(int editType); /** * Returns whether "autojoin" is enabled. * @return the autojoin state */ - public boolean isAutojoin() { - return autojoin; - } + boolean isAutojoin(); /** * Sets the "autojoin" state. * @param autojoin if set, enable autojoining */ - public void setAutojoin(final boolean autojoin) { - if (this.autojoin == autojoin) { - return; - } + void setAutojoin(boolean autojoin); - this.autojoin = autojoin; - preferences.putBoolean(AUTOJOIN_KEY, autojoin); - fireAutojoinChanged(); - } - } // class MapViewSettings Modified: trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java 2010-06-07 07:41:06 UTC (rev 8261) +++ trunk/src/test/net/sf/gridarta/gui/map/test/TestMapControlCreator.java 2010-06-07 18:30:34 UTC (rev 8262) @@ -77,6 +77,7 @@ import net.sf.gridarta.model.map.mapmodel.MapSquare; import net.sf.gridarta.model.map.mapmodel.TopmostInsertionMode; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; +import net.sf.gridarta.model.mapviewsettings.TestMapViewSettings; import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.TypeNrsGameObjectMatcher; @@ -233,7 +234,7 @@ archetypeSet = new TestArchetypeSet(archetypeFactory, "archetypes", faceObjectProviders); final MapReaderFactory<TestGameObject, TestMapArchObject> mapReaderFactory = new TestMapReaderFactory(); globalSettings = new TestGlobalSettings(); - mapViewSettings = new MapViewSettings(); + mapViewSettings = new TestMapViewSettings(); final MapWriter<TestGameObject, TestMapArchObject, TestArchetype> mapWriter = new TestMapWriter(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); Modified: trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-06-07 07:41:06 UTC (rev 8261) +++ trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-06-07 18:30:34 UTC (rev 8262) @@ -45,6 +45,7 @@ import net.sf.gridarta.model.map.maparchobject.TestMapArchObject; import net.sf.gridarta.model.map.validation.ErrorCollector; 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; @@ -425,7 +426,7 @@ final TestMapArchObject mapArchObject = new TestMapArchObject(); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); - final MapViewSettings mapViewSettings = new MapViewSettings(); + final MapViewSettings mapViewSettings = new TestMapViewSettings(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); animationObjects = new DefaultAnimationObjects("anim"); final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); Added: trunk/src/test/net/sf/gridarta/model/mapviewsettings/TestMapViewSettings.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/mapviewsettings/TestMapViewSettings.java (rev 0) +++ trunk/src/test/net/sf/gridarta/model/mapviewsettings/TestMapViewSettings.java 2010-06-07 18:30:34 UTC (rev 8262) @@ -0,0 +1,45 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.model.mapviewsettings; + +/** + * A {@link MapViewSettings} implementation for regression tests. The attribute + * values are not retained. + * @author Andreas Kirschbaum + */ +public class TestMapViewSettings extends AbstractMapViewSettings { + + /** + * {@inheritDoc} + */ + @Override + protected boolean loadAutojoin() { + return false; + } + + /** + * {@inheritDoc} + */ + @Override + protected void saveAutojoin(final boolean autojoin) { + // ignore + } + +} // class TestMapViewSettings Property changes on: trunk/src/test/net/sf/gridarta/model/mapviewsettings/TestMapViewSettings.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-06-07 07:41:12
|
Revision: 8261 http://gridarta.svn.sourceforge.net/gridarta/?rev=8261&view=rev Author: akirschbaum Date: 2010-06-07 07:41:06 +0000 (Mon, 07 Jun 2010) Log Message: ----------- Add @Nullable annotations. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/mapviewsettings/MapViewSettings.java Modified: trunk/src/app/net/sf/gridarta/model/mapviewsettings/MapViewSettings.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/mapviewsettings/MapViewSettings.java 2010-06-07 07:40:23 UTC (rev 8260) +++ trunk/src/app/net/sf/gridarta/model/mapviewsettings/MapViewSettings.java 2010-06-07 07:41:06 UTC (rev 8261) @@ -26,6 +26,7 @@ import net.sf.gridarta.model.match.ViewGameObjectMatcherManager; import net.sf.gridarta.utils.EventListenerList2; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; /** * Container for settings that affect the rendering of maps. @@ -80,12 +81,14 @@ * The transparency settings. */ // TODO: use this field (it looks unused but usage is planned) + @Nullable private ViewGameObjectMatcherManager transparencyManager = null; /** * The visibility settings. */ // TODO: use this field (it looks unused but usage is planned) + @Nullable private ViewGameObjectMatcherManager visibilityManager = null; /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |