You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2010-05-23 15:59:41
|
Revision: 7935 http://gridarta.svn.sourceforge.net/gridarta/?rev=7935&view=rev Author: akirschbaum Date: 2010-05-23 15:59:32 +0000 (Sun, 23 May 2010) Log Message: ----------- Do not remove event objects having incorrect parameters when loading maps. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java trunk/crossfire/ChangeLog trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/DefaultGameObjectFactory.java trunk/daimonin/ChangeLog trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.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/model/gameobject/AbstractGameObjectFactory.java trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectFactory.java trunk/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEvent.java trunk/src/app/net/sf/gridarta/model/scripts/DefaultScriptArchData.java trunk/src/app/net/sf/gridarta/model/scripts/ScriptArchData.java trunk/src/app/net/sf/gridarta/model/scripts/ScriptedEvent.java trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java trunk/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java trunk/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java trunk/src/test/net/sf/gridarta/model/gameobject/TestGameObjectFactory.java trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java trunk/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java Removed Paths: ------------- trunk/src/test/net/sf/gridarta/model/scripts/TestScriptArchData.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/atrinik/ChangeLog 2010-05-23 15:59:32 UTC (rev 7935) @@ -1,5 +1,8 @@ 2010-05-23 Andreas Kirschbaum + * Do not event objects having incorrect parameters when loading + maps. + * Implement #1717845 (Multitile paste) as File|Paste Tiled: paste the copy buffer into the selection. If the selection is larger than the copy buffer, tiling happens. Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -435,8 +435,8 @@ */ @NotNull @Override - public ScriptArchData<GameObject, MapArchObject, Archetype> newScriptArchData(@NotNull final ScriptedEventFactory<GameObject, MapArchObject, Archetype> scriptedEventFactory) { - return new DefaultScriptArchData<GameObject, MapArchObject, Archetype>("sub_type", Archetype.TYPE_EVENT_OBJECT, scriptedEventFactory); + public ScriptArchData<GameObject, MapArchObject, Archetype> newScriptArchData() { + return new DefaultScriptArchData<GameObject, MapArchObject, Archetype>("sub_type", Archetype.TYPE_EVENT_OBJECT); } /** Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -130,7 +130,6 @@ @Deprecated @Override public void postParseGameObject(@NotNull final GameObject gameObject) { - super.postParseGameObject(gameObject); final BaseObject<GameObject, MapArchObject, Archetype, Archetype> archetype = gameObject.getArchetype(); // if the type is still unset, then we take the default one if (archetype.getMultiShapeID() > 0 && gameObject.getMultiShapeID() == 0) { Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/crossfire/ChangeLog 2010-05-23 15:59:32 UTC (rev 7935) @@ -1,5 +1,8 @@ 2010-05-23 Andreas Kirschbaum + * Do not remove event objects having incorrect parameters when + loading maps. + * Implement #1717845 (Multitile paste) as File|Paste Tiled: paste the copy buffer into the selection. If the selection is larger than the copy buffer, tiling happens. Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -321,8 +321,8 @@ */ @NotNull @Override - public ScriptArchData<GameObject, MapArchObject, Archetype> newScriptArchData(@NotNull final ScriptedEventFactory<GameObject, MapArchObject, Archetype> scriptedEventFactory) { - return new DefaultScriptArchData<GameObject, MapArchObject, Archetype>("subtype", Archetype.TYPE_EVENT_CONNECTOR, scriptedEventFactory); + public ScriptArchData<GameObject, MapArchObject, Archetype> newScriptArchData() { + return new DefaultScriptArchData<GameObject, MapArchObject, Archetype>("subtype", Archetype.TYPE_EVENT_CONNECTOR); } /** Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/DefaultGameObjectFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -129,4 +129,11 @@ return clone; } + /** + * {@inheritDoc} + */ + @Override + public void postParseGameObject(@NotNull final GameObject gameObject) { + } + } // class DefaultGameObjectFactory Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/daimonin/ChangeLog 2010-05-23 15:59:32 UTC (rev 7935) @@ -1,5 +1,8 @@ 2010-05-23 Andreas Kirschbaum + * Do not remove event objects having incorrect parameters when + loading maps. + * Implement #1717845 (Multitile paste) as File|Paste Tiled: paste the copy buffer into the selection. If the selection is larger than the copy buffer, tiling happens. Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -436,8 +436,8 @@ */ @NotNull @Override - public ScriptArchData<GameObject, MapArchObject, Archetype> newScriptArchData(@NotNull final ScriptedEventFactory<GameObject, MapArchObject, Archetype> scriptedEventFactory) { - return new DefaultScriptArchData<GameObject, MapArchObject, Archetype>("sub_type", Archetype.TYPE_EVENT_OBJECT, scriptedEventFactory); + public ScriptArchData<GameObject, MapArchObject, Archetype> newScriptArchData() { + return new DefaultScriptArchData<GameObject, MapArchObject, Archetype>("sub_type", Archetype.TYPE_EVENT_OBJECT); } /** Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -130,7 +130,6 @@ @Deprecated @Override public void postParseGameObject(@NotNull final GameObject gameObject) { - super.postParseGameObject(gameObject); final BaseObject<?, ?, ?, ?> archetype = gameObject.getArchetype(); // if the type is still unset, then we take the default one if (archetype.getMultiShapeID() > 0 && gameObject.getMultiShapeID() == 0) { Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -261,9 +261,8 @@ final ScriptedEventFactory<G, A, R> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, gameObjectFactory, scriptedEventEditor, archetypeSet); scriptArchEditor = new DefaultScriptArchEditor<G, A, R>(scriptedEventFactory, scriptExtension, scriptName, scriptArchUtils, scriptFileFilter, globalSettings, mapManager, pathManager); scriptedEventEditor.setScriptArchEditor(scriptArchEditor); - scriptArchData = editorFactory.newScriptArchData(scriptedEventFactory); + scriptArchData = editorFactory.newScriptArchData(); scriptArchDataUtils = editorFactory.newScriptArchDataUtils(scriptArchUtils, scriptedEventFactory, scriptedEventEditor); - gameObjectFactory.setScriptArchData(scriptArchData); final long timeStart = System.currentTimeMillis(); if (log.isInfoEnabled()) { log.info("Start to load archetypes..."); Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -258,11 +258,10 @@ /** * Creates a new {@link ScriptArchData} instance. - * @param scriptedEventFactory the scripted event factory to use * @return the new instance */ @NotNull - ScriptArchData<G, A, R> newScriptArchData(@NotNull ScriptedEventFactory<G, A, R> scriptedEventFactory); + ScriptArchData<G, A, R> newScriptArchData(); /** * Creates a new {@link ScriptArchDataUtils} instance. Modified: trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -21,9 +21,7 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.model.scripts.ScriptArchData; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Abstract base class for {@link GameObjectFactory} implementations. @@ -32,28 +30,6 @@ public abstract class AbstractGameObjectFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements GameObjectFactory<G, A, R> { /** - * The {@link ScriptArchData} for validating event objects. - */ - @Nullable - private ScriptArchData<G, A, R> scriptArchData; - - /** - * Creates a new instance. - */ - @Deprecated - protected AbstractGameObjectFactory() { - this(null); - } - - /** - * Creates a new instance. - * @param scriptArchData the script arch data for validating event objects - */ - protected AbstractGameObjectFactory(@Nullable final ScriptArchData<G, A, R> scriptArchData) { - this.scriptArchData = scriptArchData; - } - - /** * {@inheritDoc} */ @NotNull @@ -70,19 +46,4 @@ return newHead; } - /** - * {@inheritDoc} - */ - @Deprecated - @Override - public void postParseGameObject(@NotNull final G gameObject) { - scriptArchData.validateAllEvents(gameObject); - } - - @Deprecated - @Override - public void setScriptArchData(@NotNull final ScriptArchData<G, A, R> scriptArchData) { - this.scriptArchData = scriptArchData; - } - } // class DefaultGameObjectFactory Modified: trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectFactory.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/app/net/sf/gridarta/model/gameobject/GameObjectFactory.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -21,7 +21,6 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.model.scripts.ScriptArchData; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -112,7 +111,4 @@ @Deprecated void postParseGameObject(@NotNull G gameObject); - @Deprecated - void setScriptArchData(@NotNull ScriptArchData<G, A, R> scriptArchData); - } // interface GameObjectFactory Modified: trunk/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEvent.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEvent.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -37,34 +37,6 @@ */ private static final Category log = Logger.getLogger(AbstractScriptedEvent.class); - /** - * {@inheritDoc} - */ - @Override - public boolean isValid() { - final String options = getOptions(); - String scriptPath = getScriptPath(); - String pluginName = getPluginName(); - final int eventType = getEventType(); - - if (scriptPath.length() <= 0) { - log.error("Map Error: Found " + typeName(eventType) + " event without file name!"); - return false; - } - - if (pluginName.length() <= 0) { - pluginName = "Python"; - if (log.isInfoEnabled()) { - log.info("Found " + typeName(eventType) + " without plugin name. Setting to \"Python\"."); - } - } - - scriptPath = scriptPath.replace('\\', '/'); // just make sure there are only slashes: '/' - - setEventData(pluginName, scriptPath, options); - return true; - } - @NotNull protected abstract String typeName(final int eventType); Modified: trunk/src/app/net/sf/gridarta/model/scripts/DefaultScriptArchData.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/scripts/DefaultScriptArchData.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/app/net/sf/gridarta/model/scripts/DefaultScriptArchData.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -19,13 +19,10 @@ package net.sf.gridarta.model.scripts; -import java.util.Iterator; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -39,11 +36,6 @@ public class DefaultScriptArchData<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements ScriptArchData<G, A, R> { /** - * The Logger for printing log messages. - */ - private static final Category log = Logger.getLogger(DefaultScriptArchData.class); - - /** * The attribute name for the subtype field. * @serial */ @@ -57,21 +49,13 @@ private final int eventTypeNo; /** - * The {@link ScriptedEventFactory} instance to use. - */ - @NotNull - private final ScriptedEventFactory<G, A, R> scriptedEventFactory; - - /** * Create a ScriptArchData. * @param subtypeAttribute the attribute name for the subtype field * @param eventTypeNo the object type for event objects - * @param scriptedEventFactory the scripted event factory instance to use */ - public DefaultScriptArchData(@NotNull final String subtypeAttribute, final int eventTypeNo, @NotNull final ScriptedEventFactory<G, A, R> scriptedEventFactory) { + public DefaultScriptArchData(@NotNull final String subtypeAttribute, final int eventTypeNo) { this.subtypeAttribute = subtypeAttribute; this.eventTypeNo = eventTypeNo; - this.scriptedEventFactory = scriptedEventFactory; } /** @@ -92,28 +76,6 @@ * {@inheritDoc} */ @Override - public void validateAllEvents(@NotNull final G gameObject) { - final Iterator<G> it = gameObject.iterator(); - while (it.hasNext()) { - final G tmp = it.next(); - if (tmp.getTypeNo() == eventTypeNo) { - final ScriptedEvent<G, A, R> se = scriptedEventFactory.newScriptedEvent(tmp); - // validate this event - if (!se.isValid()) { - // this event is invalid - if (log.isInfoEnabled()) { - log.info("-> Deleting invalid event..."); - } - it.remove(); - } - } - } - } - - /** - * {@inheritDoc} - */ - @Override public boolean isEmpty(@NotNull final G gameObject) { for (final BaseObject<G, A, R, ?> tmp : gameObject) { if (tmp.getTypeNo() == eventTypeNo) { Modified: trunk/src/app/net/sf/gridarta/model/scripts/ScriptArchData.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/scripts/ScriptArchData.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/app/net/sf/gridarta/model/scripts/ScriptArchData.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -46,14 +46,6 @@ G getScriptedEvent(int eventSubtype, @NotNull G gameObject); /** - * This method is called for each arch after loading a map. It checks - * whether all events have enough data to be valid. Invalid or insufficient - * ScriptedEvent objects get removed. - * @param gameObject the game object to operate on - */ - void validateAllEvents(@NotNull G gameObject); - - /** * Returns whether this ScriptArchData is empty (contains no events). (Note * that empty ScriptArchData objects always are removed ASAP.) * @param gameObject the game object to operate on Modified: trunk/src/app/net/sf/gridarta/model/scripts/ScriptedEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/scripts/ScriptedEvent.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/app/net/sf/gridarta/model/scripts/ScriptedEvent.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -53,10 +53,4 @@ int getEventType(); - /** - * Validate this event object: Check if there is sufficient data. - * @return true if this object is valid, otherwise false - */ - boolean isValid(); - } // class ScriptedEvent Modified: trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -65,8 +65,6 @@ 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.scripts.ScriptArchData; -import net.sf.gridarta.model.scripts.TestScriptArchData; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.model.settings.TestGlobalSettings; import net.sf.gridarta.preferences.FilePreferencesFactory; @@ -397,8 +395,7 @@ final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); pathManager = new PathManager(globalSettings); - final ScriptArchData<TestGameObject, TestMapArchObject, TestArchetype> scriptArchData = new TestScriptArchData(); - final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(scriptArchData, faceObjectProviders, animationObjects); + final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); topmostInsertionMode = new TopmostInsertionMode<TestGameObject, TestMapArchObject, TestArchetype>(); insertionModeSet = new InsertionModeSet<TestGameObject, TestMapArchObject, TestArchetype>(topmostInsertionMode); Modified: trunk/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -38,7 +38,6 @@ import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.gameobject.TestGameObjectFactory; import net.sf.gridarta.model.map.maparchobject.TestMapArchObject; -import net.sf.gridarta.model.scripts.TestScriptArchData; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; @@ -167,14 +166,13 @@ * @return the new instance */ public AbstractArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype, TestArchetypeBuilder> newArchetypeParser() { - final TestScriptArchData scriptArchData = new TestScriptArchData(); final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); final FaceObjects faceObjects = new DefaultFaceObjects("png", "facetree", Pattern.compile(".*"), "facetree.output", archFaceProvider); final GUIUtils guiUtils = new GUIUtils(); final SystemIcons systemIcons = new SystemIcons(guiUtils); final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects, systemIcons); final AnimationObjects animationObjects = new DefaultAnimationObjects("animtree"); - final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(scriptArchData, faceObjectProviders, animationObjects); + final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); final TestArchetypeBuilder archetypeBuilder = new TestArchetypeBuilder(gameObjectFactory); final TestArchetypeFactory archetypeFactory = new TestArchetypeFactory(); archetypeSet = new TestArchetypeSet(archetypeFactory, "archetypes"); Modified: trunk/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -47,7 +47,6 @@ import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.gameobject.TestGameObjectFactory; import net.sf.gridarta.model.map.maparchobject.TestMapArchObject; -import net.sf.gridarta.model.scripts.TestScriptArchData; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; import org.junit.Assert; @@ -81,8 +80,7 @@ final File file = new File("*string*"); final TestErrorView errorView = new TestErrorView(); final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, file); - final TestScriptArchData scriptArchData = new TestScriptArchData(); - final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(scriptArchData, faceObjectProviders, animationObjects); + final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); final TestArchetypeBuilder archetypeBuilder = new TestArchetypeBuilder(gameObjectFactory); final AbstractArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype, TestArchetypeBuilder> archetypeParser = new TestArchetypeParser(archetypeBuilder, animationObjects, archetypeSet); final List<TestGameObject> invObjects = new ArrayList<TestGameObject>(); Modified: trunk/src/test/net/sf/gridarta/model/gameobject/TestGameObjectFactory.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/gameobject/TestGameObjectFactory.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/test/net/sf/gridarta/model/gameobject/TestGameObjectFactory.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -23,7 +23,6 @@ import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.map.maparchobject.TestMapArchObject; -import net.sf.gridarta.model.scripts.ScriptArchData; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -47,12 +46,10 @@ /** * Creates a new instance. - * @param scriptArchData the script arch data for validating event objects * @param faceObjectProviders the face object providers to use * @param animationObjects the animation objects for looking up animations */ - public TestGameObjectFactory(@NotNull final ScriptArchData<TestGameObject, TestMapArchObject, TestArchetype> scriptArchData, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { - super(scriptArchData); + public TestGameObjectFactory(@NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects) { this.faceObjectProviders = faceObjectProviders; this.animationObjects = animationObjects; } @@ -123,4 +120,12 @@ return clone; } + /** + * {@inheritDoc} + */ + @Override + public void postParseGameObject(@NotNull final TestGameObject gameObject) { + // ignore + } + } // class TestGameObjectFactory Modified: trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -48,8 +48,6 @@ import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.match.TypeNrsGameObjectMatcher; -import net.sf.gridarta.model.scripts.ScriptArchData; -import net.sf.gridarta.model.scripts.TestScriptArchData; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.Size2D; import net.sf.gridarta.utils.SystemIcons; @@ -470,14 +468,12 @@ final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final MapViewSettings mapViewSettings = new MapViewSettings(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); - final ScriptArchData<TestGameObject, TestMapArchObject, TestArchetype> scriptArchData = new TestScriptArchData(); animationObjects = new DefaultAnimationObjects("anim"); - final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(scriptArchData, faceObjectProviders, animationObjects); + final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(); final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode = new TopmostInsertionMode<TestGameObject, TestMapArchObject, TestArchetype>(); insertionModeSet = new InsertionModeSet<TestGameObject, TestMapArchObject, TestArchetype>(topmostInsertionMode); insertionModeSet.init(new TypeNrsGameObjectMatcher(), new TypeNrsGameObjectMatcher(), new TypeNrsGameObjectMatcher()); - assert archetypeChooserModel != null; mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(autojoinLists, mapArchObject, archetypeChooserModel, 0, gameObjectFactory, gameObjectMatchers, topmostInsertionMode); result.setLength(0); Modified: trunk/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/test/net/sf/gridarta/model/match/NamedGameObjectMatcherTest.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -31,9 +31,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.TestGameObject; import net.sf.gridarta.model.gameobject.TestGameObjectFactory; -import net.sf.gridarta.model.map.maparchobject.TestMapArchObject; -import net.sf.gridarta.model.scripts.ScriptArchData; -import net.sf.gridarta.model.scripts.TestScriptArchData; import net.sf.gridarta.utils.GUIUtils; import net.sf.gridarta.utils.SystemIcons; import org.jetbrains.annotations.NotNull; @@ -62,10 +59,9 @@ public void testTypeNrsGameObjectMatcher1() { final GameObjectMatcher invGameObjectMatcher = new TypeNrsGameObjectMatcher(1); final GameObjectMatcher namedGameObjectMatcher = new NamedGameObjectMatcher(0, "namedGameObjectMatcher", "namedGameObjectMatcher", false, null, invGameObjectMatcher); - final ScriptArchData<TestGameObject, TestMapArchObject, TestArchetype> scriptArchData = new TestScriptArchData(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final AnimationObjects animationObjects = new DefaultAnimationObjects("anim"); - final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(scriptArchData, faceObjectProviders, animationObjects); + final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); Assert.assertTrue(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1))); Assert.assertFalse(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2))); Assert.assertTrue(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1, 1))); @@ -88,10 +84,9 @@ final GameObjectMatcher invGameObjectMatcher = new TypeNrsGameObjectMatcher(1); final GameObjectMatcher envGameObjectMatcher = new TypeNrsGameObjectMatcher(2); final GameObjectMatcher namedGameObjectMatcher = new NamedGameObjectMatcher(0, "namedGameObjectMatcher", "namedGameObjectMatcher", false, envGameObjectMatcher, invGameObjectMatcher); - final ScriptArchData<TestGameObject, TestMapArchObject, TestArchetype> scriptArchData = new TestScriptArchData(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final AnimationObjects animationObjects = new DefaultAnimationObjects("anim"); - final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(scriptArchData, faceObjectProviders, animationObjects); + final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(faceObjectProviders, animationObjects); Assert.assertFalse(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1))); Assert.assertFalse(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 2))); Assert.assertFalse(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, animationObjects, 1, 1))); Deleted: trunk/src/test/net/sf/gridarta/model/scripts/TestScriptArchData.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/scripts/TestScriptArchData.java 2010-05-23 15:41:34 UTC (rev 7934) +++ trunk/src/test/net/sf/gridarta/model/scripts/TestScriptArchData.java 2010-05-23 15:59:32 UTC (rev 7935) @@ -1,57 +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.scripts; - -import net.sf.gridarta.model.archetype.TestArchetype; -import net.sf.gridarta.model.gameobject.TestGameObject; -import net.sf.gridarta.model.map.maparchobject.TestMapArchObject; -import org.jetbrains.annotations.NotNull; - -/** - * A {@link ScriptArchData} for regression tests. - * @author Andreas Kirschbaum - */ -public class TestScriptArchData implements ScriptArchData<TestGameObject, TestMapArchObject, TestArchetype> { - - /** - * {@inheritDoc} - */ - @Override - public TestGameObject getScriptedEvent(final int eventSubtype, @NotNull final TestGameObject gameObject) { - throw new AssertionError(); - } - - /** - * {@inheritDoc} - */ - @Override - public void validateAllEvents(@NotNull final TestGameObject gameObject) { - // always correct - } - - /** - * {@inheritDoc} - */ - @Override - public boolean isEmpty(@NotNull final TestGameObject gameObject) { - throw new AssertionError(); - } - -} // class TestScriptArchData This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 15:41:40
|
Revision: 7934 http://gridarta.svn.sourceforge.net/gridarta/?rev=7934&view=rev Author: akirschbaum Date: 2010-05-23 15:41:34 +0000 (Sun, 23 May 2010) Log Message: ----------- Add @Depreacted annotations. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:40:53 UTC (rev 7933) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:41:34 UTC (rev 7934) @@ -127,6 +127,7 @@ /** * {@inheritDoc} */ + @Deprecated @Override public void postParseGameObject(@NotNull final GameObject gameObject) { super.postParseGameObject(gameObject); Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:40:53 UTC (rev 7933) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:41:34 UTC (rev 7934) @@ -127,6 +127,7 @@ /** * {@inheritDoc} */ + @Deprecated @Override public void postParseGameObject(@NotNull final GameObject gameObject) { super.postParseGameObject(gameObject); Modified: trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java 2010-05-23 15:40:53 UTC (rev 7933) +++ trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java 2010-05-23 15:41:34 UTC (rev 7934) @@ -73,6 +73,7 @@ /** * {@inheritDoc} */ + @Deprecated @Override public void postParseGameObject(@NotNull final G gameObject) { scriptArchData.validateAllEvents(gameObject); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 15:41:00
|
Revision: 7933 http://gridarta.svn.sourceforge.net/gridarta/?rev=7933&view=rev Author: akirschbaum Date: 2010-05-23 15:40:53 +0000 (Sun, 23 May 2010) Log Message: ----------- Move BaseObject.{get,set}Multi{X,Y}() to Archetype. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/DefaultGameObjectFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyMode.java trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java trunk/src/app/net/sf/gridarta/model/archetype/Archetype.java trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java trunk/src/app/net/sf/gridarta/model/gameobject/MultiArchData.java trunk/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/test/net/sf/gridarta/model/gameobject/TestGameObjectFactory.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -103,8 +103,6 @@ @Override public GameObject createGameObjectPart(@NotNull final Archetype archetype, @Nullable final GameObject head) { final GameObject gameObject = new GameObject(archetype, faceObjectProviders, animationObjects, archetypeTypeSet); - gameObject.setMultiX(archetype.getMultiX()); - gameObject.setMultiY(archetype.getMultiY()); gameObject.setLowestPart(archetype.isLowestPart()); gameObject.setMultiPartNr(archetype.getMultiPartNr()); if (head != null) { Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatMapRenderer.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -305,8 +305,8 @@ } else { // this is an oversized image, so it must be shifted // XXX: it must also be clipped to not overwrite filter information - offset.x = IGUIConstants.SQUARE_WIDTH * (node.getMultiX() - node.getMinX()); - offset.y = IGUIConstants.SQUARE_HEIGHT * (node.getMultiY() - node.getMinY()); + offset.x = IGUIConstants.SQUARE_WIDTH * (node.getArchetype().getMultiX() - node.getMinX()); + offset.y = IGUIConstants.SQUARE_HEIGHT * (node.getArchetype().getMultiY() - node.getMinY()); } g.drawImage(img.getImage(), x, y, x + IGUIConstants.SQUARE_WIDTH, y + IGUIConstants.SQUARE_HEIGHT, offset.x, offset.y, offset.x + IGUIConstants.SQUARE_WIDTH, offset.y + IGUIConstants.SQUARE_HEIGHT, this); } Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/FlatPickmapRenderer.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -123,8 +123,8 @@ yy = 0; } else { // this is an oversized image, so it must be shifted - xx = IGUIConstants.SQUARE_WIDTH * (node.getMultiX() - node.getMinX()); - yy = IGUIConstants.SQUARE_HEIGHT * (node.getMultiY() - node.getMinY()); + xx = IGUIConstants.SQUARE_WIDTH * (node.getArchetype().getMultiX() - node.getMinX()); + yy = IGUIConstants.SQUARE_HEIGHT * (node.getArchetype().getMultiY() - node.getMinY()); } grfx.drawImage(img.getImage(), x, y, x + IGUIConstants.SQUARE_WIDTH, y + IGUIConstants.SQUARE_HEIGHT, xx, yy, xx + IGUIConstants.SQUARE_WIDTH, yy + IGUIConstants.SQUARE_HEIGHT, this); } Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/map/renderer/SimpleFlatMapRenderer.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -156,8 +156,8 @@ offset.y = 0; } else { // this is an oversized image, so it must be shifted - offset.x = IGUIConstants.SQUARE_WIDTH * (node.getMultiX() - node.getMinX()); - offset.y = IGUIConstants.SQUARE_HEIGHT * (node.getMultiY() - node.getMinY()); + offset.x = IGUIConstants.SQUARE_WIDTH * (node.getArchetype().getMultiX() - node.getMinX()); + offset.y = IGUIConstants.SQUARE_HEIGHT * (node.getArchetype().getMultiY() - node.getMinY()); } grfx.drawImage(img.getImage(), point.x * IGUIConstants.SQUARE_WIDTH, point.y * IGUIConstants.SQUARE_HEIGHT, point.x * IGUIConstants.SQUARE_WIDTH + IGUIConstants.SQUARE_WIDTH, point.y * IGUIConstants.SQUARE_HEIGHT + IGUIConstants.SQUARE_HEIGHT, offset.x, offset.y, offset.x + IGUIConstants.SQUARE_WIDTH, offset.y + IGUIConstants.SQUARE_HEIGHT, this); if (node.getAttributeInt("smoothlevel", true) > 0) { Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/DefaultGameObjectFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -92,8 +92,6 @@ @Override public GameObject createGameObjectPart(@NotNull final Archetype archetype, @Nullable final GameObject head) { final GameObject gameObject = new GameObject(archetype, faceObjectProviders, animationObjects); - gameObject.setMultiX(archetype.getMultiX()); - gameObject.setMultiY(archetype.getMultiY()); if (head != null) { head.addTailPart(gameObject); } Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/model/gameobject/DefaultGameObjectFactory.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -103,8 +103,6 @@ @Override public GameObject createGameObjectPart(@NotNull final Archetype archetype, @Nullable final GameObject head) { final GameObject gameObject = new GameObject(archetype, faceObjectProviders, animationObjects, archetypeTypeSet); - gameObject.setMultiX(archetype.getMultiX()); - gameObject.setMultiY(archetype.getMultiY()); gameObject.setLowestPart(archetype.isLowestPart()); gameObject.setMultiPartNr(archetype.getMultiPartNr()); if (head != null) { Modified: trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyMode.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyMode.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyMode.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -78,7 +78,7 @@ final G clone = gameObjectFactory.cloneGameObject(gameObject, posx, posy); mapModel.addGameObjectToMap(clone, insertionModeSet.getTopmostInsertionMode()); } - if (gameObject.getMultiX() >= 0 && gameObject.getMultiY() >= 0) { + if (gameObject.getArchetype().getMultiX() >= 0 && gameObject.getArchetype().getMultiY() >= 0) { gameObjectsToDelete.add(gameObject.getHead()); } } Modified: trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetype.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -44,6 +44,20 @@ private String archetypeName; /** + * The x-distance of this part to the head part. Set to zero for single-part + * objects. + * @serial + */ + private int multiX = 0; + + /** + * The y-distance of this part to the head part. Set to zero for single-part + * objects. + * @serial + */ + private int multiY = 0; + + /** * Creates a new instance. * @param archetypeName the name of the archetype * @param faceObjectProviders the face object providers for looking up @@ -171,4 +185,36 @@ } } + /** + * {@inheritDoc} + */ + @Override + public void setMultiX(final int multiX) { + this.multiX = multiX; + } + + /** + * {@inheritDoc} + */ + @Override + public void setMultiY(final int multiY) { + this.multiY = multiY; + } + + /** + * {@inheritDoc} + */ + @Override + public int getMultiX() { + return multiX; + } + + /** + * {@inheritDoc} + */ + @Override + public int getMultiY() { + return multiY; + } + } // class AbstractArchetype Modified: trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -299,7 +299,7 @@ * @param out the writer collecting into * @throws IOException if an I/O error occurs */ - private static void collectStartArch(@NotNull final BaseObject<?, ?, ?, ?> arch, @NotNull final Writer out) throws IOException { + private static void collectStartArch(@NotNull final Archetype<?, ?, ?> arch, @NotNull final Writer out) throws IOException { out.append("Object ").append(arch.getArchetypeName()).append('\n'); // map object hack: x/y is normally a reference for multi Modified: trunk/src/app/net/sf/gridarta/model/archetype/Archetype.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetype/Archetype.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/src/app/net/sf/gridarta/model/archetype/Archetype.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -93,4 +93,32 @@ */ boolean isUndefinedArchetype(); + /** + * Set the x-position of this part of a multi-part object. The x-position is + * relative to the head part. + * @param multiX the x-distance of this part to the head part + */ + void setMultiX(int multiX); + + /** + * Set the y-position of this part of a multi-part object. The y-position is + * relative to the head part. + * @param multiY the y-distance of this part to the head part + */ + void setMultiY(int multiY); + + /** + * Get the x-distance of this part to the head part. For single-part objects + * this is always zero. + * @return the x-distance of this part to the head part + */ + int getMultiX(); + + /** + * Get the y-distance of this part to the head part. For single-part objects + * this is always zero. + * @return the y-distance of this part to the head part + */ + int getMultiY(); + } // interface Archetype Modified: trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -129,20 +129,6 @@ private int mapy = 0; /** - * The x-distance of this part to the head part. Set to zero for single-part - * objects. - * @serial - */ - private int multiX = 0; - - /** - * The y-distance of this part to the head part. Set to zero for single-part - * objects. - * @serial - */ - private int multiY = 0; - - /** * Data for multi-square-arches. Stays <code>null</code> for * singlesquare-arches. * @serial @@ -889,41 +875,9 @@ * {@inheritDoc} */ @Override - public void setMultiX(final int multiX) { - this.multiX = multiX; - } - - /** - * {@inheritDoc} - */ - @Override - public void setMultiY(final int multiY) { - this.multiY = multiY; - } - - /** - * {@inheritDoc} - */ - @Override - public int getMultiX() { - return multiX; - } - - /** - * {@inheritDoc} - */ - @Override - public int getMultiY() { - return multiY; - } - - /** - * {@inheritDoc} - */ - @Override public boolean isDefaultGameObject() { final BaseObject<G, A, R, ?> archetype = getArchetype(); - return archetype != null && artifact == archetype.isArtifact() && getArchetypeName().equals(archetype.getArchetypeName()) && objName.equals(archetype.getObjName()) && !gameObjectText.hasObjectText() && (msgText == null || msgText.toString().equals(archetype.getMsgText())) && multiX == archetype.getMultiY() && multiY == archetype.getMultiX() && (editorFolder == null || editorFolder.equals(archetype.getEditorFolder())) && (faceName == null || faceName.equals(archetype.getFaceName())) && (animName == null || animName.equals(archetype.getAnimName())) && typeNo == archetype.getTypeNo(); + return archetype != null && artifact == archetype.isArtifact() && getArchetypeName().equals(archetype.getArchetypeName()) && objName.equals(archetype.getObjName()) && !gameObjectText.hasObjectText() && (msgText == null || msgText.toString().equals(archetype.getMsgText())) && (editorFolder == null || editorFolder.equals(archetype.getEditorFolder())) && (faceName == null || faceName.equals(archetype.getFaceName())) && (animName == null || animName.equals(archetype.getAnimName())) && typeNo == archetype.getTypeNo(); } /** @@ -944,7 +898,6 @@ // ignore "mapx" // ignore "mapy" // ignore "attributeCache" - && abstractBaseObject.multiX == multiX && abstractBaseObject.multiY == multiY // ignore "multi" // ignore "editType" && (abstractBaseObject.editorFolder == null ? editorFolder == null : abstractBaseObject.editorFolder.equals(editorFolder)) && (abstractBaseObject.faceName == null ? faceName == null : abstractBaseObject.faceName.equals(faceName)) && (abstractBaseObject.animName == null ? animName == null : abstractBaseObject.animName.equals(animName)) && abstractBaseObject.typeNo == typeNo && abstractBaseObject.direction == direction; Modified: trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -434,34 +434,6 @@ void setObjectText(@NotNull String objectText); /** - * Set the x-position of this part of a multi-part object. The x-position is - * relative to the head part. - * @param multiX the x-distance of this part to the head part - */ - void setMultiX(int multiX); - - /** - * Set the y-position of this part of a multi-part object. The y-position is - * relative to the head part. - * @param multiY the y-distance of this part to the head part - */ - void setMultiY(int multiY); - - /** - * Get the x-distance of this part to the head part. For single-part objects - * this is always zero. - * @return the x-distance of this part to the head part - */ - int getMultiX(); - - /** - * Get the y-distance of this part to the head part. For single-part objects - * this is always zero. - * @return the y-distance of this part to the head part - */ - int getMultiY(); - - /** * Return whether this game object is unmodified from its underlying * archetype. * @return Whether this game object is unmodified. Modified: trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/src/app/net/sf/gridarta/model/gameobject/AbstractGameObjectFactory.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -61,7 +61,7 @@ public G cloneMultiGameObject(@NotNull final G gameObject, final int posx, final int posy) { final G newHead = cloneGameObject(gameObject, posx, posy); for (G tmp = gameObject.getMultiNext(); tmp != null; tmp = tmp.getMultiNext()) { - newHead.addTailPart(cloneGameObject(tmp, posx + tmp.getMultiX(), posy + tmp.getMultiY())); + newHead.addTailPart(cloneGameObject(tmp, posx + tmp.getArchetype().getMultiX(), posy + tmp.getArchetype().getMultiY())); } if (newHead.isMulti()) { newHead.setMultiShapeID(gameObject.getMultiShapeID()); @@ -75,9 +75,6 @@ */ @Override public void postParseGameObject(@NotNull final G gameObject) { - gameObject.setMultiX(gameObject.getArchetype().getMultiX()); - gameObject.setMultiY(gameObject.getArchetype().getMultiY()); - scriptArchData.validateAllEvents(gameObject); } Modified: trunk/src/app/net/sf/gridarta/model/gameobject/MultiArchData.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/MultiArchData.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/src/app/net/sf/gridarta/model/gameobject/MultiArchData.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -88,7 +88,7 @@ * @param head the head part of the multi-part object */ public MultiArchData(@NotNull final T head) { - assert head.getMultiX() == 0 && head.getMultiY() == 0; + assert head.getArchetype().getMultiX() == 0 && head.getArchetype().getMultiY() == 0; parts.add(head); } @@ -199,14 +199,14 @@ public void addPart(@NotNull final T tail) { parts.add(tail); - final int x = tail.getMultiX(); + final int x = tail.getArchetype().getMultiX(); if (x < minX) { minX = x; } else if (x > maxX) { maxX = x; } - final int y = tail.getMultiY(); + final int y = tail.getArchetype().getMultiY(); if (y < minY) { minY = y; } else if (y > maxY) { Modified: trunk/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/src/app/net/sf/gridarta/model/io/AbstractGameObjectParser.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -305,8 +305,8 @@ objects.add(newarch); // set map position (x, y) - newarch.setMapX(gameObject.getMapX() + newarch.getMultiX()); - newarch.setMapY(gameObject.getMapY() + newarch.getMultiY()); + newarch.setMapX(gameObject.getMapX() + newarch.getArchetype().getMultiX()); + newarch.setMapY(gameObject.getMapY() + newarch.getArchetype().getMultiY()); } } Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -859,8 +859,8 @@ } for (final G part : parts) { - final int mapX = pos.x + part.getMultiX(); - final int mapY = pos.y + part.getMultiY(); + final int mapX = pos.x + part.getArchetype().getMultiX(); + final int mapY = pos.y + part.getArchetype().getMultiY(); part.setMapX(mapX); part.setMapY(mapY); gameObjectMatchers.updateEditType(part, activeEditType); Modified: trunk/src/test/net/sf/gridarta/model/gameobject/TestGameObjectFactory.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/gameobject/TestGameObjectFactory.java 2010-05-23 15:26:39 UTC (rev 7932) +++ trunk/src/test/net/sf/gridarta/model/gameobject/TestGameObjectFactory.java 2010-05-23 15:40:53 UTC (rev 7933) @@ -92,8 +92,6 @@ @Override public TestGameObject createGameObjectPart(@NotNull final TestArchetype archetype, @Nullable final TestGameObject head) { final TestGameObject gameObject = new TestGameObject(archetype, faceObjectProviders, animationObjects); - gameObject.setMultiX(archetype.getMultiX()); - gameObject.setMultiY(archetype.getMultiY()); if (head != null) { head.addTailPart(gameObject); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 15:26:46
|
Revision: 7932 http://gridarta.svn.sourceforge.net/gridarta/?rev=7932&view=rev Author: akirschbaum Date: 2010-05-23 15:26:39 +0000 (Sun, 23 May 2010) Log Message: ----------- Replace null return value with exception. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java trunk/src/app/net/sf/gridarta/gui/treasurelist/TreasureCellRenderer.java trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java trunk/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java trunk/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java trunk/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEventFactory.java trunk/src/app/net/sf/gridarta/model/scripts/UndefinedEventArchetypeException.java trunk/src/app/net/sf/gridarta/model/scripts/UndefinedEventArchetypeNameException.java trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java trunk/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java trunk/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/archetype/UndefinedArchetypeException.java Modified: trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java 2010-05-23 14:55:44 UTC (rev 7931) +++ trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -26,6 +26,7 @@ import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.exitconnector.ExitConnectorModel; import net.sf.gridarta.model.exitconnector.ExitLocation; @@ -168,8 +169,10 @@ } else { // paste into newly created exit game object - final BaseObject<G, A, R, ?> targetArchetype = archetypeSet.getArchetype(exitConnectorModel.getExitArchetypeName()); - if (targetArchetype == null) { + final BaseObject<G, A, R, ?> targetArchetype; + try { + targetArchetype = archetypeSet.getArchetype(exitConnectorModel.getExitArchetypeName()); + } catch (final UndefinedArchetypeException ignored) { return false; } @@ -216,8 +219,9 @@ targetArchetype = null; } else if (exitConnectorModel.isAutoCreateExit()) { targetExit = null; - targetArchetype = archetypeSet.getArchetype(exitConnectorModel.getExitArchetypeName()); - if (targetArchetype == null) { + try { + targetArchetype = archetypeSet.getArchetype(exitConnectorModel.getExitArchetypeName()); + } catch (final UndefinedArchetypeException ignored) { return false; } } else { @@ -280,8 +284,9 @@ sourceArchetype = null; } else if (exitConnectorModel.isAutoCreateExit()) { sourceExit = null; - sourceArchetype = archetypeSet.getArchetype(exitConnectorModel.getExitArchetypeName()); - if (sourceArchetype == null) { + try { + sourceArchetype = archetypeSet.getArchetype(exitConnectorModel.getExitArchetypeName()); + } catch (final UndefinedArchetypeException ignored) { return false; } } else { Modified: trunk/src/app/net/sf/gridarta/gui/treasurelist/TreasureCellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/treasurelist/TreasureCellRenderer.java 2010-05-23 14:55:44 UTC (rev 7931) +++ trunk/src/app/net/sf/gridarta/gui/treasurelist/TreasureCellRenderer.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -28,7 +28,7 @@ import javax.swing.tree.DefaultTreeCellRenderer; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeSet; -import net.sf.gridarta.model.baseobject.BaseObject; +import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -81,10 +81,9 @@ /** {@inheritDoc} */ @Override public void visit(@NotNull final ArchTreasureObj treasureObj) { - final BaseObject<G, A, R, ?> archetype = archetypeSet.getArchetype(treasureObj.getName()); - if (archetype != null) { - setIcon(faceObjectProviders.getFace(archetype)); - } else { + try { + setIcon(faceObjectProviders.getFace(archetypeSet.getArchetype(treasureObj.getName()))); + } catch (final UndefinedArchetypeException ignored) { setIcon(systemIcons.getNoarchSquareIcon()); } setBorder(BorderFactory.createEmptyBorder(1, 0, 1, 0)); Modified: trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java 2010-05-23 14:55:44 UTC (rev 7931) +++ trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeSet.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -41,7 +41,6 @@ import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Base implementation of ArchetypeSet. @@ -128,10 +127,15 @@ /** * {@inheritDoc} */ - @Nullable + @NotNull @Override - public R getArchetype(@NotNull final String archetypeName) { - return archetypeMap.get(archetypeName); + public R getArchetype(@NotNull final String archetypeName) throws UndefinedArchetypeException { + final R archetype = archetypeMap.get(archetypeName); + if (archetype == null) { + throw new UndefinedArchetypeException(archetypeName); + } + + return archetype; } /** @@ -140,23 +144,22 @@ @NotNull @Override public R getOrCreateArchetype(@NotNull final String archetypeName) { - final R existingArchetype = getArchetype(archetypeName); - if (existingArchetype != null) { - return existingArchetype; - } + try { + return getArchetype(archetypeName); + } catch (final UndefinedArchetypeException ignored) { + synchronized (undefinedArchetypes) { + final WeakReference<R> existingUndefinedArchetypeRef = undefinedArchetypes.get(archetypeName); + if (existingUndefinedArchetypeRef != null) { + final R existingUndefinedArchetype = existingUndefinedArchetypeRef.get(); + if (existingUndefinedArchetype != null) { + return existingUndefinedArchetype; + } + } - synchronized (undefinedArchetypes) { - final WeakReference<R> existingUndefinedArchetypeRef = undefinedArchetypes.get(archetypeName); - if (existingUndefinedArchetypeRef != null) { - final R existingUndefinedArchetype = existingUndefinedArchetypeRef.get(); - if (existingUndefinedArchetype != null) { - return existingUndefinedArchetype; - } + final R newArchetype = archetypeFactory.newUndefinedArchetype(archetypeName); + undefinedArchetypes.put(archetypeName, new WeakReference<R>(newArchetype)); + return newArchetype; } - - final R newArchetype = archetypeFactory.newUndefinedArchetype(archetypeName); - undefinedArchetypes.put(archetypeName, new WeakReference<R>(newArchetype)); - return newArchetype; } } Modified: trunk/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java 2010-05-23 14:55:44 UTC (rev 7931) +++ trunk/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -50,15 +50,15 @@ /** * Get an Archetype by its name. * @param archetypeName name of the Archetype to get - * @return Archetype for <var>archetypeName</var> or <code>null</code> if no - * such Archetype + * @return the archetype + * @throws UndefinedArchetypeException if the no such archetype exists * @see net.sf.gridarta.model.gameobject.GameObjectFactory#newGameObject(String) * for a similar method that instantiates. * @see #getOrCreateArchetype(String) for a similar method that creates * undefined archetypes */ - @Nullable - R getArchetype(@NotNull String archetypeName); + @NotNull + R getArchetype(@NotNull String archetypeName) throws UndefinedArchetypeException; /** * Get an archetype by its name. If this archetype does not exist, return an Added: trunk/src/app/net/sf/gridarta/model/archetype/UndefinedArchetypeException.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetype/UndefinedArchetypeException.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/archetype/UndefinedArchetypeException.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -0,0 +1,43 @@ +/* + * 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.archetype; + +import org.jetbrains.annotations.NotNull; + +/** + * Exception thrown if an {@link Archetype} does not exist. + * @author Andreas Kirschbaum + */ +public class UndefinedArchetypeException extends Exception { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1L; + + /** + * Creates a new instance. + * @param archetypeName the name of the undefined archetype + */ + public UndefinedArchetypeException(@NotNull final String archetypeName) { + super(archetypeName); + } + +} // class UndefinedArchetypeException Property changes on: trunk/src/app/net/sf/gridarta/model/archetype/UndefinedArchetypeException.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java 2010-05-23 14:55:44 UTC (rev 7931) +++ trunk/src/app/net/sf/gridarta/model/artifact/ArtifactParser.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -30,6 +30,7 @@ import net.sf.gridarta.model.archetype.AbstractArchetypeParser; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; @@ -231,19 +232,20 @@ } else if (name == null || name.length() == 0 || defArchName.length() == 0) { errorViewCollector.addWarning(ErrorViewCategory.ARTIFACT_ENTRY_INVALID, "line " + lineCount + ", Object '" + defArchName + "' / '" + name + "' / '" + objTitle + "' has missing name"); } else { - final R archetype = archetypeSet.getArchetype(defArchName); - if (archetype == null) { + try { + final R archetype = archetypeSet.getArchetype(defArchName); + if (editorCode != 0 && editorCode != 2) { // the next line of our file is part of a arch parse until a "end" comes + // now the editor will do the same as the real server: + // get the default arch as base and parse the new values over it + // the extended functions of the artifacts file can be ignored here. + archetypeParser.parseArchetypeFromStream(in, editorCode == 2 ? null : archetype, thisLine, name, panelName, folderName, archPath, invObjects, errorViewCollector); // XXX: editorCode == 2 looks incorrect due to the enclosing condition editorCode != 2 + // note: in the parser is a small part where we handle the title setting + // and the reverse type setting for type == -1 (unique items marker in artifacts file) + } else { + while ((thisLine = in.readLine()) != null && !thisLine.equals("end")) { + } +} } catch (final UndefinedArchetypeException ex) { errorViewCollector.addWarning(ErrorViewCategory.ARTIFACT_ENTRY_INVALID, "line " + lineCount + ", Object '" + defArchName + "' / '" + name + "' / '" + objTitle + "' references undefined defArch"); - } else if (editorCode != 0 && editorCode != 2) { // the next line of our file is part of a arch parse until a "end" comes - // now the editor will do the same as the real server: - // get the default arch as base and parse the new values over it - // the extended functions of the artifacts file can be ignored here. - archetypeParser.parseArchetypeFromStream(in, editorCode == 2 ? null : archetype, thisLine, name, panelName, folderName, archPath, invObjects, errorViewCollector); // XXX: editorCode == 2 looks incorrect due to the enclosing condition editorCode != 2 - // note: in the parser is a small part where we handle the title setting - // and the reverse type setting for type == -1 (unique items marker in artifacts file) - } else { - while ((thisLine = in.readLine()) != null && !thisLine.equals("end")) { - } } } name = null; Modified: trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java 2010-05-23 14:55:44 UTC (rev 7931) +++ trunk/src/app/net/sf/gridarta/model/autojoin/AutojoinListsParser.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -30,6 +30,7 @@ import java.util.List; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.gameobject.GameObject; @@ -112,15 +113,15 @@ } sectionFlag = false; } else { - final R archetype = archetypeSet.getArchetype(line); - if (archetype != null) { + try { + final R archetype = archetypeSet.getArchetype(line); if (archetype.isMulti()) { errorView.addWarning(ErrorViewCategory.AUTOJOIN_ENTRY_INVALID, url + ": list contains multi-part game object: archetype '" + line + "'"); skipList = true; } else { archetypes.add(archetype); } - } else { + } catch (final UndefinedArchetypeException ex) { if (archetypeSet.getArchetypeCount() >= 1) { errorView.addWarning(ErrorViewCategory.AUTOJOIN_ENTRY_INVALID, url + ": Autojoin list references undefined archetype: archetype '" + line + "'"); skipList = true; Modified: trunk/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEventFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEventFactory.java 2010-05-23 14:55:44 UTC (rev 7931) +++ trunk/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEventFactory.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -21,6 +21,7 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -70,9 +71,11 @@ @Override public G newEventGameObject(final int eventType) throws UndefinedEventArchetypeException { final String eventArchetypeName = scriptArchUtils.getArchetypeNameForEventType(eventType); - final R eventArchetype = archetypeSet.getArchetype(eventArchetypeName); - if (eventArchetype == null) { - throw new UndefinedEventArchetypeNameException(eventArchetypeName); + final R eventArchetype; + try { + eventArchetype = archetypeSet.getArchetype(eventArchetypeName); + } catch (final UndefinedArchetypeException ex) { + throw new UndefinedEventArchetypeNameException(eventArchetypeName, ex); } return gameObjectFactory.createGameObject(eventArchetype); } Modified: trunk/src/app/net/sf/gridarta/model/scripts/UndefinedEventArchetypeException.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/scripts/UndefinedEventArchetypeException.java 2010-05-23 14:55:44 UTC (rev 7931) +++ trunk/src/app/net/sf/gridarta/model/scripts/UndefinedEventArchetypeException.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -34,11 +34,20 @@ private static final long serialVersionUID = 1L; /** - * Create a new instance. + * Creates a new instance. * @param msg the exception message */ protected UndefinedEventArchetypeException(@NotNull final String msg) { super(msg); } + /** + * Creates a new instance. + * @param msg the exception message + * @param cause the cause + */ + protected UndefinedEventArchetypeException(@NotNull final String msg, @NotNull final Throwable cause) { + super(msg, cause); + } + } // class UndefinedEventArchetypeException Modified: trunk/src/app/net/sf/gridarta/model/scripts/UndefinedEventArchetypeNameException.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/scripts/UndefinedEventArchetypeNameException.java 2010-05-23 14:55:44 UTC (rev 7931) +++ trunk/src/app/net/sf/gridarta/model/scripts/UndefinedEventArchetypeNameException.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -43,9 +43,10 @@ /** * Create a new instance. * @param archName the archetype that could not be found + * @param cause the cause */ - public UndefinedEventArchetypeNameException(@NotNull final String archName) { - super("undefined archetype " + archName); + public UndefinedEventArchetypeNameException(@NotNull final String archName, @NotNull final Throwable cause) { + super("undefined archetype " + archName, cause); this.archName = archName; } Modified: trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java 2010-05-23 14:55:44 UTC (rev 7931) +++ trunk/src/app/net/sf/gridarta/script/parameter/ArchParameter.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -21,6 +21,7 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import org.jdom.Element; @@ -47,7 +48,7 @@ public void fromXML(@NotNull final Element e) { super.fromXML(e); valueString = e.getChildTextTrim("value"); - setValue(archetypeSet.getArchetype(valueString)); + setValue(archetypeSet.getOrCreateArchetype(valueString)); } /** @@ -75,10 +76,7 @@ @Override public Archetype<G, A, R> getValue() { if (super.getValue() == null) { - final Archetype<G, A, R> o = archetypeSet.getArchetype(valueString); - if (o != null) { - setValue(o); - } + setValue(archetypeSet.getOrCreateArchetype(valueString)); } return super.getValue(); } @@ -88,8 +86,10 @@ */ @Override public boolean setStringValue(@NotNull final String value) { - final Archetype<G, A, R> archetype = archetypeSet.getArchetype(value); - if (archetype == null) { + final Archetype<G, A, R> archetype; + try { + archetype = archetypeSet.getArchetype(value); + } catch (final UndefinedArchetypeException ignored) { return false; } setValue(archetype); Modified: trunk/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2010-05-23 14:55:44 UTC (rev 7931) +++ trunk/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -79,52 +79,52 @@ /** * Checks that msg...endmsg fields are parsed correctly. * @throws IOException if the test fails + * @throws UndefinedArchetypeException if the test fails */ @Test - public void testMsgTextEmpty() throws IOException { + public void testMsgTextEmpty() throws IOException, UndefinedArchetypeException { check("Object test\nmsg\nendmsg\nend\n", false, false, 1); assert archetypeSet != null; final Archetype<TestGameObject, TestMapArchObject, TestArchetype> archetype = archetypeSet.getArchetype("test"); - assert archetype != null; Assert.assertNull(archetype.getMsgText()); } /** * Checks that msg...endmsg fields are parsed correctly. * @throws IOException if the test fails + * @throws UndefinedArchetypeException if the test fails */ @Test - public void testMsgTextLines() throws IOException { + public void testMsgTextLines() throws IOException, UndefinedArchetypeException { check("Object test\nmsg\nabc\ndef\nghi\nendmsg\nend\n", false, false, 1); assert archetypeSet != null; final Archetype<TestGameObject, TestMapArchObject, TestArchetype> archetype = archetypeSet.getArchetype("test"); - assert archetype != null; Assert.assertEquals("abc\ndef\nghi\n", archetype.getMsgText()); } /** * Checks that msg...endmsg fields are parsed correctly. * @throws IOException if the test fails + * @throws UndefinedArchetypeException if the test fails */ @Test - public void testMsgTextTrailingWhitespace() throws IOException { + public void testMsgTextTrailingWhitespace() throws IOException, UndefinedArchetypeException { check("Object test\nmsg\nabc \ndef\nghi \n\nendmsg\nend\n", false, false, 1); assert archetypeSet != null; final Archetype<TestGameObject, TestMapArchObject, TestArchetype> archetype = archetypeSet.getArchetype("test"); - assert archetype != null; Assert.assertEquals("abc\ndef\nghi\n\n", archetype.getMsgText()); } /** * Checks that msg...endmsg fields are parsed correctly. * @throws IOException if the test fails + * @throws UndefinedArchetypeException if the test fails */ @Test - public void testMsgTextLeadingWhitespace() throws IOException { + public void testMsgTextLeadingWhitespace() throws IOException, UndefinedArchetypeException { check("Object test\nmsg\n\n abc\ndef\n ghi\nendmsg\nend\n", false, false, 1); assert archetypeSet != null; final Archetype<TestGameObject, TestMapArchObject, TestArchetype> archetype = archetypeSet.getArchetype("test"); - assert archetype != null; Assert.assertEquals("\n abc\ndef\n ghi\n", archetype.getMsgText()); } Modified: trunk/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java 2010-05-23 14:55:44 UTC (rev 7931) +++ trunk/src/test/net/sf/gridarta/model/artifact/ArtifactParserTest.java 2010-05-23 15:26:39 UTC (rev 7932) @@ -37,6 +37,7 @@ import net.sf.gridarta.model.archetype.TestArchetypeFactory; import net.sf.gridarta.model.archetype.TestArchetypeParser; import net.sf.gridarta.model.archetype.TestArchetypeSet; +import net.sf.gridarta.model.archetype.UndefinedArchetypeException; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.errorview.TestErrorView; import net.sf.gridarta.model.face.ArchFaceProvider; @@ -62,9 +63,10 @@ * Checks that a missing "object" line is detected. * @throws DuplicateArchetypeException if the test fails * @throws IOException if the test fails + * @throws UndefinedArchetypeException if the test fails */ @Test - public void testMissingObject() throws DuplicateArchetypeException, IOException { + public void testMissingObject() throws DuplicateArchetypeException, IOException, UndefinedArchetypeException { final TestArchetypeFactory archetypeFactory = new TestArchetypeFactory(); final TestArchetypeSet archetypeSet = new TestArchetypeSet(archetypeFactory, "archetypes"); final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); @@ -96,7 +98,6 @@ Assert.assertFalse(errorView.hasErrors()); Assert.assertEquals(2, archetypeSet.getArchetypeCount()); final Archetype<TestGameObject, TestMapArchObject, TestArchetype> archetype = archetypeSet.getArchetype("art"); - assert archetype != null; Assert.assertEquals("sp 3\n", archetype.getObjectText()); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 14:55:50
|
Revision: 7931 http://gridarta.svn.sourceforge.net/gridarta/?rev=7931&view=rev Author: akirschbaum Date: 2010-05-23 14:55:44 +0000 (Sun, 23 May 2010) Log Message: ----------- Replace null return value with exception. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/scripts/DefaultScriptArchUtils.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/scripts/DefaultScriptArchUtils.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/scripts/DefaultScriptArchUtils.java trunk/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEventFactory.java trunk/src/app/net/sf/gridarta/model/scripts/ScriptArchUtils.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/scripts/DefaultScriptArchUtils.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/scripts/DefaultScriptArchUtils.java 2010-05-23 14:01:00 UTC (rev 7930) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/gui/scripts/DefaultScriptArchUtils.java 2010-05-23 14:55:44 UTC (rev 7931) @@ -22,7 +22,6 @@ import net.sf.gridarta.gui.scripts.AbstractScriptArchUtils; import net.sf.gridarta.utils.Pair; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class DefaultScriptArchUtils extends AbstractScriptArchUtils { @@ -39,7 +38,7 @@ /** * {@inheritDoc} */ - @Nullable + @NotNull @Override public String getArchetypeNameForEventType(final int eventType) { return "event_obj"; Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/scripts/DefaultScriptArchUtils.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/scripts/DefaultScriptArchUtils.java 2010-05-23 14:01:00 UTC (rev 7930) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/gui/scripts/DefaultScriptArchUtils.java 2010-05-23 14:55:44 UTC (rev 7931) @@ -20,9 +20,9 @@ package net.sf.gridarta.var.crossfire.gui.scripts; import net.sf.gridarta.gui.scripts.AbstractScriptArchUtils; +import net.sf.gridarta.model.scripts.UndefinedEventArchetypeTypeException; import net.sf.gridarta.utils.Pair; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class DefaultScriptArchUtils extends AbstractScriptArchUtils { @@ -39,11 +39,15 @@ /** * {@inheritDoc} */ - @Nullable + @NotNull @Override - public String getArchetypeNameForEventType(final int eventType) { + public String getArchetypeNameForEventType(final int eventType) throws UndefinedEventArchetypeTypeException { final String typeName = getEventType(eventType); - return typeName != null ? "event_" + typeName : null; + if (typeName == null) { + throw new UndefinedEventArchetypeTypeException(eventType); + } + + return "event_" + typeName; } } // class DefaultScriptArchUtils Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/scripts/DefaultScriptArchUtils.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/scripts/DefaultScriptArchUtils.java 2010-05-23 14:01:00 UTC (rev 7930) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/gui/scripts/DefaultScriptArchUtils.java 2010-05-23 14:55:44 UTC (rev 7931) @@ -22,7 +22,6 @@ import net.sf.gridarta.gui.scripts.AbstractScriptArchUtils; import net.sf.gridarta.utils.Pair; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public class DefaultScriptArchUtils extends AbstractScriptArchUtils { @@ -39,7 +38,7 @@ /** * {@inheritDoc} */ - @Nullable + @NotNull @Override public String getArchetypeNameForEventType(final int eventType) { return "event_obj"; Modified: trunk/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEventFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEventFactory.java 2010-05-23 14:01:00 UTC (rev 7930) +++ trunk/src/app/net/sf/gridarta/model/scripts/AbstractScriptedEventFactory.java 2010-05-23 14:55:44 UTC (rev 7931) @@ -70,9 +70,6 @@ @Override public G newEventGameObject(final int eventType) throws UndefinedEventArchetypeException { final String eventArchetypeName = scriptArchUtils.getArchetypeNameForEventType(eventType); - if (eventArchetypeName == null) { - throw new UndefinedEventArchetypeTypeException(eventType); - } final R eventArchetype = archetypeSet.getArchetype(eventArchetypeName); if (eventArchetype == null) { throw new UndefinedEventArchetypeNameException(eventArchetypeName); Modified: trunk/src/app/net/sf/gridarta/model/scripts/ScriptArchUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/scripts/ScriptArchUtils.java 2010-05-23 14:01:00 UTC (rev 7930) +++ trunk/src/app/net/sf/gridarta/model/scripts/ScriptArchUtils.java 2010-05-23 14:55:44 UTC (rev 7931) @@ -22,7 +22,6 @@ import javax.swing.JList; import net.sf.gridarta.model.gameobject.GameObject; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public interface ScriptArchUtils { @@ -37,11 +36,12 @@ /** * Returns the archetype for an event type. * @param eventType the event type - * @return the archetype name, or <code>null</code> if the event type is - * invalid + * @return the archetype name + * @throws UndefinedEventArchetypeTypeException if the event type is + * undefined */ - @Nullable - String getArchetypeNameForEventType(int eventType); + @NotNull + String getArchetypeNameForEventType(int eventType) throws UndefinedEventArchetypeTypeException; /** * Converts a combo box index to an event type. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 14:01:07
|
Revision: 7930 http://gridarta.svn.sourceforge.net/gridarta/?rev=7930&view=rev Author: akirschbaum Date: 2010-05-23 14:01:00 +0000 (Sun, 23 May 2010) Log Message: ----------- Suppress unchecked warnings due to external libraries. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java trunk/src/app/net/sf/gridarta/gui/connectionview/CellRenderer.java trunk/src/app/net/sf/gridarta/gui/connectionview/View.java trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java trunk/src/app/net/sf/gridarta/gui/script/ScriptManager.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/gui/utils/GList.java trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureTreeNode.java trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -244,6 +244,8 @@ */ @NotNull private ArchetypePanel<G, A, R> getArchetypePanel(final int index) { + //JTabbedPane does not use type parameters + //noinspection unchecked return (ArchetypePanel<G, A, R>) tabDesktop.getComponentAt(index); } Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/CellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/CellRenderer.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/CellRenderer.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -55,6 +55,8 @@ public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + //DefaultListCellRenderer does not use type parameters + //noinspection unchecked final Connection<K> connection = (Connection<K>) value; sbForFormat.setLength(0); Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/View.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/View.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/View.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -198,6 +198,8 @@ public Iterable<Connection<K>> getSelectedConnections() { final Collection<Connection<K>> result = new ArrayList<Connection<K>>(); for (final Object selection : connectionList.getSelectedValues()) { + //JList does not use type parameters + //noinspection unchecked result.add((Connection<K>) selection); } return result; Modified: trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -179,6 +179,8 @@ /** {@inheritDoc} */ @Override public void internalFrameActivated(@NotNull final InternalFrameEvent e) { + //InternalFrameEvent does not use type parameters + //noinspection unchecked final MapView<G, A, R> mapView = (MapView<G, A, R>) e.getSource(); mapViewFocusGainedNotify(mapView); } @@ -192,6 +194,8 @@ /** {@inheritDoc} */ @Override public void internalFrameClosing(@NotNull final InternalFrameEvent e) { + //InternalFrameEvent does not use type parameters + //noinspection unchecked mapViewsManager.closeMapView((MapView<G, A, R>) e.getInternalFrame()); } @@ -210,6 +214,8 @@ /** {@inheritDoc} */ @Override public void internalFrameIconified(@NotNull final InternalFrameEvent e) { + //InternalFrameEvent does not use type parameters + //noinspection unchecked final MapView<G, A, R> mapView = (MapView<G, A, R>) e.getSource(); mapViewFocusLostNotify(mapView); } Modified: trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -160,6 +160,8 @@ */ @Override public void apply() { + //JComboBox does not use type parameters + //noinspection unchecked PREFS.put(NET_PREFS_KEY_TYPE, ((Enum<Proxy.Type>) proxyType.getSelectedItem()).name()); PREFS.put(NET_PREFS_KEY_HOST, proxyHost.getText()); PREFS.putInt(NET_PREFS_KEY_PORT, (Integer) proxyPort.getValue()); Modified: trunk/src/app/net/sf/gridarta/gui/script/ScriptManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ScriptManager.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/gui/script/ScriptManager.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -161,6 +161,8 @@ @Override public void valueChanged(final ListSelectionEvent e) { if (!e.getValueIsAdjusting()) { + //JList does not use type parameters + //noinspection unchecked showScript((Script<G, A, R>) scripts.getSelectedValue()); } } @@ -188,6 +190,8 @@ removeScriptBtn.addActionListener(new ActionListener() { @Override public void actionPerformed(final ActionEvent e) { + //JList does not use type parameters + //noinspection unchecked final Script<G, A, R> script = (Script<G, A, R>) scripts.getSelectedValue(); if (script == null) { return; Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -55,6 +55,8 @@ @Override public void itemStateChanged(final ItemEvent e) { if (e.getStateChange() == ItemEvent.SELECTED) { + //JComboBox does not use type parameters + //noinspection unchecked parameter.setValue((Archetype<G, A, R>) value.getSelectedItem()); } } Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -76,6 +76,8 @@ public Component getListCellRendererComponent(final JList list, final Object value, final int index, final boolean isSelected, final boolean cellHasFocus) { super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); + //DefaultListCellRenderer does not use type parameters + //noinspection unchecked GameObject<G, A, R> arch = (GameObject<G, A, R>) value; // arch == null should not happen, but it *can* happen when the active Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -421,6 +421,8 @@ @Nullable G getListGameObject(final int index) { final int actualIndex = getValidIndex(index); + //DefaultListModel does not use type parameters + //noinspection unchecked return actualIndex < model.getSize() ? (G) model.getElementAt(actualIndex) : null; } @@ -461,6 +463,8 @@ if (list.getSelectedIndex() != actualIndex) { list.setSelectedIndex(actualIndex); } + //JList does not use type parameters + //noinspection unchecked selectedSquareModel.setSelectedGameObject((G) list.getSelectedValue(), actualIndex); } Modified: trunk/src/app/net/sf/gridarta/gui/utils/GList.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/GList.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/gui/utils/GList.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -101,6 +101,8 @@ return null; } + //JList does not use type parameters + //noinspection unchecked final T element = (T) getModel().getElementAt(index); if (toolTipProvider == null) { Modified: trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/model/filter/FilterParser.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -106,6 +106,8 @@ final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); filterConfig.setEnabled(enabled); filterConfig.setInverted(Boolean.valueOf(value.getChildTextTrim("inverted"))); + //Element does not use type parameters + //noinspection unchecked final Iterable<Element> it = value.getChildren("subfilter"); for (final Element filterElement : it) { final String name = filterElement.getChildTextTrim("name"); @@ -129,6 +131,8 @@ final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); filterConfig.setEnabled(enabled); + //Element does not use type parameters + //noinspection unchecked final Iterable<Element> properties = value.getChildren("property"); for (final Element property : properties) { final String pName = property.getChildTextTrim("name"); Modified: trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureTreeNode.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureTreeNode.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/model/treasurelist/TreasureTreeNode.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -130,6 +130,8 @@ @NotNull @Override public Enumeration<TreasureTreeNode> children() { + //DefaultMutableTreeNode does not use type parameters + //noinspection unchecked return super.children(); } Modified: trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java 2010-05-23 13:47:12 UTC (rev 7929) +++ trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java 2010-05-23 14:01:00 UTC (rev 7930) @@ -69,6 +69,8 @@ if (mode == null) { isScript = true; } else { + //Element does not use type parameters + //noinspection unchecked final Iterable<Element> modes = mode.getChildren(); for (final Element m : modes) { final boolean b = Boolean.valueOf(m.getTextTrim()); @@ -85,6 +87,8 @@ scriptModel.setAutoboot(isAutoboot); scriptModel.setFilter(isFilter); scriptModel.setScript(isScript); + //Element does not use type parameters + //noinspection unchecked final Collection<Element> params = node.getChildren("parameter"); if (params != null && !params.isEmpty()) { for (final Element parameter : params) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 13:47:18
|
Revision: 7929 http://gridarta.svn.sourceforge.net/gridarta/?rev=7929&view=rev Author: akirschbaum Date: 2010-05-23 13:47:12 +0000 (Sun, 23 May 2010) Log Message: ----------- Remove ArchetypeTypeParser.cloneAttribute(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-23 13:46:23 UTC (rev 7928) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-23 13:47:12 UTC (rev 7929) @@ -168,7 +168,7 @@ for (final ArchetypeAttribute<G, A, R> attrib : archetypeType) { // add all attributes from the default_type which are not in the ignoreTable if (!ignoreTable.containsKey(attrib.getArchetypeAttributeName()) && !autoIgnoreTable.contains(attrib.getArchetypeAttributeName())) { - defList.add(cloneAttribute(attrib)); + defList.add(attrib.clone()); } } @@ -202,19 +202,13 @@ if (!attrib.getSectionName().equals(SectionNames.GENERAL_SECTION)) { // import this attribute: - final ArchetypeAttribute<G, A, R> tmp = cloneAttribute(attrib); - importList.add(tmp); + importList.add(attrib.clone()); } } return importList; } - @NotNull - private ArchetypeAttribute<G, A, R> cloneAttribute(@NotNull final ArchetypeAttribute<G, A, R> attrib) { - return attrib.clone(); - } - @Nullable private static String parseImportName(@NotNull final Element root, @NotNull final String typeName, @NotNull final ErrorViewCollector errorViewCollector) { // load import_type This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 13:46:30
|
Revision: 7928 http://gridarta.svn.sourceforge.net/gridarta/?rev=7928&view=rev Author: akirschbaum Date: 2010-05-23 13:46:23 +0000 (Sun, 23 May 2010) Log Message: ----------- Fix or suppress clone() related compiler warnings. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/MaskChangeAL.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ViewTreasurelistAL.java trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeAction.java trunk/src/app/net/sf/gridarta/gui/misc/Recent.java trunk/src/app/net/sf/gridarta/gui/utils/AnimTreeChooseAction.java trunk/src/app/net/sf/gridarta/gui/utils/FaceTreeChooseAction.java trunk/src/app/net/sf/gridarta/gui/utils/TreeChooseAction.java trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/TabButtonAction.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectText.java trunk/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java trunk/src/app/net/sf/gridarta/model/map/maparchobject/AbstractMapArchObject.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java trunk/src/app/net/sf/gridarta/model/match/SetEnabledAction.java trunk/src/app/net/sf/gridarta/model/match/ViewGameObjectMatcherManager.java trunk/src/test/net/sf/gridarta/model/map/maparchobject/TestMapArchObject.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/MaskChangeAL.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/MaskChangeAL.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/MaskChangeAL.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -154,8 +154,12 @@ * {@inheritDoc} */ @Override - protected Object clone() throws CloneNotSupportedException { - return super.clone(); + protected Object clone() { + try { + return super.clone(); + } catch (final CloneNotSupportedException ex) { + throw new AssertionError(ex); + } } /** Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ViewTreasurelistAL.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ViewTreasurelistAL.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ViewTreasurelistAL.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -75,8 +75,12 @@ * {@inheritDoc} */ @Override - protected Object clone() throws CloneNotSupportedException { - return super.clone(); + protected Object clone() { + try { + return super.clone(); + } catch (final CloneNotSupportedException ex) { + throw new AssertionError(ex); + } } } // class ViewTreasurelistAL Modified: trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/gui/mapdesktop/WindowAction.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -214,8 +214,12 @@ */ @NotNull @Override - public Object clone() throws CloneNotSupportedException { - return super.clone(); + public Object clone() { + try { + return super.clone(); + } catch (final CloneNotSupportedException ex) { + throw new AssertionError(ex); + } } } // class WindowAction Modified: trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeAction.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeAction.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -101,8 +101,12 @@ * {@inheritDoc} */ @Override - protected Object clone() throws CloneNotSupportedException { - return super.clone(); + protected Object clone() { + try { + return super.clone(); + } catch (final CloneNotSupportedException ex) { + throw new AssertionError(ex); + } } } // class MapFolderTreeAction Modified: trunk/src/app/net/sf/gridarta/gui/misc/Recent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/Recent.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/gui/misc/Recent.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -218,8 +218,12 @@ * {@inheritDoc} */ @Override - protected Object clone() throws CloneNotSupportedException { - return super.clone(); + protected Object clone() { + try { + return super.clone(); + } catch (final CloneNotSupportedException ex) { + throw new AssertionError(ex); + } } } // class Recent Modified: trunk/src/app/net/sf/gridarta/gui/utils/AnimTreeChooseAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/AnimTreeChooseAction.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/gui/utils/AnimTreeChooseAction.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -119,7 +119,7 @@ */ @NotNull @Override - protected Object clone() throws CloneNotSupportedException { + protected Object clone() { return super.clone(); } Modified: trunk/src/app/net/sf/gridarta/gui/utils/FaceTreeChooseAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/FaceTreeChooseAction.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/gui/utils/FaceTreeChooseAction.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -105,7 +105,7 @@ */ @NotNull @Override - protected Object clone() throws CloneNotSupportedException { + protected Object clone() { return super.clone(); } Modified: trunk/src/app/net/sf/gridarta/gui/utils/TreeChooseAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/TreeChooseAction.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/gui/utils/TreeChooseAction.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -104,8 +104,12 @@ */ @NotNull @Override - protected Object clone() throws CloneNotSupportedException { - return super.clone(); + protected Object clone() { + try { + return super.clone(); + } catch (final CloneNotSupportedException ex) { + throw new AssertionError(ex); + } } } // class TreeChooseAction Modified: trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/TabButtonAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/TabButtonAction.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/gui/utils/tabbedpanel/TabButtonAction.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -80,8 +80,12 @@ * {@inheritDoc} */ @Override - protected Object clone() throws CloneNotSupportedException { - return super.clone(); + protected Object clone() { + try { + return super.clone(); + } catch (final CloneNotSupportedException ex) { + throw new AssertionError(ex); + } } } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -90,8 +90,13 @@ */ @NotNull @Override - public ArchetypeAttribute<G, A, R> clone() throws CloneNotSupportedException { - return (ArchetypeAttribute<G, A, R>) super.clone(); + @SuppressWarnings({ "unchecked" }) + public ArchetypeAttribute<G, A, R> clone() { + try { + return (ArchetypeAttribute<G, A, R>) super.clone(); + } catch (final CloneNotSupportedException ex) { + throw new AssertionError(ex); + } } /** Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeParser.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -212,11 +212,7 @@ @NotNull private ArchetypeAttribute<G, A, R> cloneAttribute(@NotNull final ArchetypeAttribute<G, A, R> attrib) { - try { - return attrib.clone(); - } catch (final CloneNotSupportedException e) { - throw new AssertionError(); - } + return attrib.clone(); } @Nullable Modified: trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/model/baseobject/AbstractBaseObject.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -754,7 +754,7 @@ @Override @NotNull public Object clone() { - final AbstractBaseObject<G, A, R, T> clone = (AbstractBaseObject<G, A, R, T>) super.clone(); + final AbstractBaseObject<?, ?, ?, ?> clone = (AbstractBaseObject<?, ?, ?, ?>) super.clone(); // clone.archetype = archetype; // will NOT be cloned: archetypes are unique clone.gameObjectText = gameObjectText.clone(); if (msgText != null) { Modified: trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectContainer.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -594,6 +594,7 @@ */ @NotNull @Override + @SuppressWarnings({ "unchecked" }) protected Object clone() { try { final GameObjectContainer<G, A, R> clone = (GameObjectContainer<G, A, R>) super.clone(); Modified: trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectText.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectText.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/model/baseobject/GameObjectText.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -105,7 +105,7 @@ try { clone = (GameObjectText) super.clone(); } catch (final CloneNotSupportedException ex) { - throw new AssertionError(); + throw new AssertionError(ex); } clone.objectText = new StringBuilder(objectText); clone.attributeCache = new HashMap<String, String>(attributeCache); Modified: trunk/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/model/gameobject/DefaultIsoGameObject.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -154,6 +154,7 @@ */ @NotNull @Override + @SuppressWarnings({ "unchecked" }) public DefaultIsoGameObject<G, A, R> clone() { return (DefaultIsoGameObject<G, A, R>) super.clone(); } Modified: trunk/src/app/net/sf/gridarta/model/map/maparchobject/AbstractMapArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/maparchobject/AbstractMapArchObject.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/model/map/maparchobject/AbstractMapArchObject.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -612,7 +612,7 @@ try { clone = (AbstractMapArchObject<?>) super.clone(); } catch (final CloneNotSupportedException ex) { - throw new AssertionError(); + throw new AssertionError(ex); } clone.msgText = new StringBuilder(msgText.toString()); clone.tilePaths = tilePaths.clone(); Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -126,6 +126,7 @@ */ @NotNull @Override + @SuppressWarnings({ "unchecked" }) protected MapSquare<G, A, R> clone() { final MapSquare<G, A, R> clone = (MapSquare<G, A, R>) super.clone(); return clone; Modified: trunk/src/app/net/sf/gridarta/model/match/SetEnabledAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/match/SetEnabledAction.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/model/match/SetEnabledAction.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -101,7 +101,7 @@ try { return (SetEnabledAction) super.clone(); } catch (final CloneNotSupportedException ex) { - throw new AssertionError(); + throw new AssertionError(ex); } } Modified: trunk/src/app/net/sf/gridarta/model/match/ViewGameObjectMatcherManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/match/ViewGameObjectMatcherManager.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/app/net/sf/gridarta/model/match/ViewGameObjectMatcherManager.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -131,8 +131,12 @@ */ @NotNull @Override - protected Object clone() throws CloneNotSupportedException { - return super.clone(); + protected Object clone() { + try { + return super.clone(); + } catch (final CloneNotSupportedException ex) { + throw new AssertionError(ex); + } } } // class ResetAction @@ -217,8 +221,12 @@ */ @NotNull @Override - protected Object clone() throws CloneNotSupportedException { - return super.clone(); + protected Object clone() { + try { + return super.clone(); + } catch (final CloneNotSupportedException ex) { + throw new AssertionError(ex); + } } } // class GameObjectMatcherToggleAction Modified: trunk/src/test/net/sf/gridarta/model/map/maparchobject/TestMapArchObject.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/map/maparchobject/TestMapArchObject.java 2010-05-23 13:22:46 UTC (rev 7927) +++ trunk/src/test/net/sf/gridarta/model/map/maparchobject/TestMapArchObject.java 2010-05-23 13:46:23 UTC (rev 7928) @@ -257,7 +257,7 @@ try { return super.clone(); } catch (final CloneNotSupportedException ex) { - throw new AssertionError(); + throw new AssertionError(ex); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 13:22:52
|
Revision: 7927 http://gridarta.svn.sourceforge.net/gridarta/?rev=7927&view=rev Author: akirschbaum Date: 2010-05-23 13:22:46 +0000 (Sun, 23 May 2010) Log Message: ----------- Implement MapSquare.hashCode() and MapSquare.equals() to remove replaced map squares from the set of changed map squares in MapSquareGrid.clearMap(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java 2010-05-23 13:16:09 UTC (rev 7926) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java 2010-05-23 13:22:46 UTC (rev 7927) @@ -234,4 +234,25 @@ mapModel.endSquareChange(this); } + /** + * {@inheritDoc}} + */ + @Override + public boolean equals(@Nullable final Object obj) { + if (obj == null || obj.getClass() != getClass()) { + return false; + } + + final MapSquare<?, ?, ?> mapSquare = (MapSquare<?, ?, ?>) obj; + return mapModel == mapSquare.mapModel && mapX == mapSquare.mapX && mapY == mapSquare.mapY; + } + + /** + * {@inheritDoc}} + */ + @Override + public int hashCode() { + return System.identityHashCode(mapModel) + 13 * mapX + 65537 * mapY; + } + } // class MapSquare This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 13:16:15
|
Revision: 7926 http://gridarta.svn.sourceforge.net/gridarta/?rev=7926&view=rev Author: akirschbaum Date: 2010-05-23 13:16:09 +0000 (Sun, 23 May 2010) Log Message: ----------- Do not call MapModel functions from MapSquareGrid. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java 2010-05-23 13:11:33 UTC (rev 7925) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquare.java 2010-05-23 13:16:09 UTC (rev 7926) @@ -220,4 +220,18 @@ return result; } + /** + * Method to notify the model that a map square is about to change. + */ + public void beginSquareChange() { + mapModel.beginSquareChange(this); + } + + /** + * Method to notify the model that a map square was changed. + */ + public void endSquareChange() { + mapModel.endSquareChange(this); + } + } // class MapSquare Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java 2010-05-23 13:11:33 UTC (rev 7925) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java 2010-05-23 13:16:09 UTC (rev 7926) @@ -98,11 +98,11 @@ if (mapGrid[x][y] == null) { mapGrid[x][y] = new MapSquare<G, A, R>(mapModel, x, y); } else if (!mapGrid[x][y].isEmpty()) { - mapModel.beginSquareChange(mapGrid[x][y]); + mapGrid[x][y].beginSquareChange(); try { mapGrid[x][y] = new MapSquare<G, A, R>(mapModel, x, y); } finally { - mapModel.endSquareChange(mapGrid[x][y]); + mapGrid[x][y].endSquareChange(); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 13:11:39
|
Revision: 7925 http://gridarta.svn.sourceforge.net/gridarta/?rev=7925&view=rev Author: akirschbaum Date: 2010-05-23 13:11:33 +0000 (Sun, 23 May 2010) Log Message: ----------- Do not call MapModel functions from MapSquareGrid. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-23 13:09:28 UTC (rev 7924) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-23 13:11:33 UTC (rev 7925) @@ -232,7 +232,7 @@ savedSquares = new SavedSquares<G, A, R>(gameObjectFactory, gameObjectMatchers); mapSize = mapArchObject.getMapSize(); mapArchObject.addMapArchObjectListener(mapArchObjectListener); - mapGrid = new MapSquareGrid<G, A, R>(this); + mapGrid = new MapSquareGrid<G, A, R>(this, mapSize); modified = false; } Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java 2010-05-23 13:09:28 UTC (rev 7924) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapSquareGrid.java 2010-05-23 13:11:33 UTC (rev 7925) @@ -59,10 +59,11 @@ /** * Creates a new instance. * @param mapModel the associated map model + * @param mapSize the map size */ - public MapSquareGrid(@NotNull final MapModel<G, A, R> mapModel) { + public MapSquareGrid(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Size2D mapSize) { this.mapModel = mapModel; - mapSize = mapModel.getMapSize(); + this.mapSize = mapSize; mapGrid = (MapSquare<G, A, R>[][]) new MapSquare<?, ?, ?>[mapSize.getWidth()][mapSize.getHeight()]; for (int y = 0; y < mapSize.getHeight(); y++) { for (int x = 0; x < mapSize.getWidth(); x++) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 13:09:34
|
Revision: 7924 http://gridarta.svn.sourceforge.net/gridarta/?rev=7924&view=rev Author: akirschbaum Date: 2010-05-23 13:09:28 +0000 (Sun, 23 May 2010) Log Message: ----------- Remove unneeded code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-23 13:06:48 UTC (rev 7923) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-05-23 13:09:28 UTC (rev 7924) @@ -233,12 +233,6 @@ mapSize = mapArchObject.getMapSize(); mapArchObject.addMapArchObjectListener(mapArchObjectListener); mapGrid = new MapSquareGrid<G, A, R>(this); - beginTransaction("init"); - try { - mapGrid.clearMap(); - } finally { - endTransaction(); - } modified = false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 13:06:54
|
Revision: 7923 http://gridarta.svn.sourceforge.net/gridarta/?rev=7923&view=rev Author: akirschbaum Date: 2010-05-23 13:06:48 +0000 (Sun, 23 May 2010) Log Message: ----------- Suppress warning. Modified Paths: -------------- trunk/gridarta.ipr trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-05-23 13:06:16 UTC (rev 7922) +++ trunk/gridarta.ipr 2010-05-23 13:06:48 UTC (rev 7923) @@ -1151,6 +1151,7 @@ <w>resize</w> <w>resized</w> <w>resizes</w> + <w>rethrown</w> <w>shortdescription</w> <w>startup</w> <w>teleporter</w> Modified: trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2010-05-23 13:06:16 UTC (rev 7922) +++ trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2010-05-23 13:06:48 UTC (rev 7923) @@ -223,6 +223,7 @@ @NotNull private MapReader<G, A> decodeMapFile(@NotNull final File file, final boolean interactive) throws IOException { final MapReader<G, A> decoder; + //noinspection ErrorNotRethrown try { decoder = mapReaderFactory.newMapReader(file); } catch (final OutOfMemoryError ex) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 13:06:23
|
Revision: 7922 http://gridarta.svn.sourceforge.net/gridarta/?rev=7922&view=rev Author: akirschbaum Date: 2010-05-23 13:06:16 +0000 (Sun, 23 May 2010) Log Message: ----------- Do not drop exception. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java Modified: trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2010-05-23 13:05:26 UTC (rev 7921) +++ trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2010-05-23 13:06:16 UTC (rev 7922) @@ -226,7 +226,7 @@ try { decoder = mapReaderFactory.newMapReader(file); } catch (final OutOfMemoryError ex) { - throw new IOException("out of memory"); + throw new IOException("out of memory", ex); } int outOfMapBoundsDeleted = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 13:05:32
|
Revision: 7921 http://gridarta.svn.sourceforge.net/gridarta/?rev=7921&view=rev Author: akirschbaum Date: 2010-05-23 13:05:26 +0000 (Sun, 23 May 2010) Log Message: ----------- Rename variable names. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java Modified: trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2010-05-23 13:04:32 UTC (rev 7920) +++ trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2010-05-23 13:05:26 UTC (rev 7921) @@ -225,7 +225,7 @@ final MapReader<G, A> decoder; try { decoder = mapReaderFactory.newMapReader(file); - } catch (final OutOfMemoryError ignore) { + } catch (final OutOfMemoryError ex) { throw new IOException("out of memory"); } @@ -315,7 +315,7 @@ if (mapControl.getMapModel().getMapFile() != null && mapControl.getMapModel().getMapFile().getCanonicalPath().compareTo(path) == 0) { return mapControl; } - } catch (final IOException e) { + } catch (final IOException ignored) { // ignore, get next map } } @@ -333,7 +333,7 @@ mapControl.save(); return; } - } catch (final IOException e) { + } catch (final IOException ignored) { // ignore, get next map } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 13:04:38
|
Revision: 7920 http://gridarta.svn.sourceforge.net/gridarta/?rev=7920&view=rev Author: akirschbaum Date: 2010-05-23 13:04:32 +0000 (Sun, 23 May 2010) Log Message: ----------- Explicitly initialize field. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java Modified: trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2010-05-23 13:02:46 UTC (rev 7919) +++ trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2010-05-23 13:04:32 UTC (rev 7920) @@ -94,7 +94,7 @@ * The current top map we are working with. */ @Nullable - private MapControl<G, A, R> currentMapControl; + private MapControl<G, A, R> currentMapControl = null; /** * Create a new map manager. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 13:02:53
|
Revision: 7919 http://gridarta.svn.sourceforge.net/gridarta/?rev=7919&view=rev Author: akirschbaum Date: 2010-05-23 13:02:46 +0000 (Sun, 23 May 2010) Log Message: ----------- Disable serialization related warnings. Modified Paths: -------------- trunk/gridarta.ipr Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-05-23 13:00:53 UTC (rev 7918) +++ trunk/gridarta.ipr 2010-05-23 13:02:46 UTC (rev 7919) @@ -544,7 +544,6 @@ <option name="m_onlyLookAtBlocks" value="false" /> </inspection_tool> <inspection_tool class="TransientFieldInNonSerializableClass" enabled="true" level="WARNING" enabled_by_default="true" /> - <inspection_tool class="TransientFieldNotInitialized" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="TrivialStringConcatenation" enabled="true" level="WARNING" enabled_by_default="true" /> <inspection_tool class="TypeMayBeWeakened" enabled="true" level="WARNING" enabled_by_default="true"> <option name="useRighthandTypeAsWeakestTypeInAssignments" value="true" /> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 13:01:00
|
Revision: 7918 http://gridarta.svn.sourceforge.net/gridarta/?rev=7918&view=rev Author: akirschbaum Date: 2010-05-23 13:00:53 +0000 (Sun, 23 May 2010) Log Message: ----------- Fix comment. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/utils/MathUtils.java Modified: trunk/src/app/net/sf/gridarta/utils/MathUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/MathUtils.java 2010-05-23 12:37:46 UTC (rev 7917) +++ trunk/src/app/net/sf/gridarta/utils/MathUtils.java 2010-05-23 13:00:53 UTC (rev 7918) @@ -1,22 +1,20 @@ /* - * This file is part of JXClient, the Fullscreen Java Crossfire Client. + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 The Gridarta Developers. * - * JXClient is free software; you can redistribute it and/or modify + * 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. * - * JXClient is distributed in the hope that it will be useful, + * 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 JXClient; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - * - * Copyright (C) 2005-2008 Yann Chachkoff. - * Copyright (C) 2006-2010 Andreas Kirschbaum. + * 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.utils; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 12:37:53
|
Revision: 7917 http://gridarta.svn.sourceforge.net/gridarta/?rev=7917&view=rev Author: akirschbaum Date: 2010-05-23 12:37:46 +0000 (Sun, 23 May 2010) Log Message: ----------- Implement #1717845 (Multitile paste) as File|Paste Tiled: paste the copy buffer into the selection. If the selection is larger than the copy buffer, tiling happens. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties trunk/crossfire/ChangeLog trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties trunk/daimonin/ChangeLog trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Added Paths: ----------- trunk/src/app/net/sf/gridarta/utils/MathUtils.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-05-23 12:08:06 UTC (rev 7916) +++ trunk/atrinik/ChangeLog 2010-05-23 12:37:46 UTC (rev 7917) @@ -1,3 +1,9 @@ +2010-05-23 Andreas Kirschbaum + + * Implement #1717845 (Multitile paste) as File|Paste Tiled: paste + the copy buffer into the selection. If the selection is larger + than the copy buffer, tiling happens. + 2010-05-22 Andreas Kirschbaum * Fix "Generate Preview" to regenerate previews for all selected Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2010-05-23 12:08:06 UTC (rev 7916) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2010-05-23 12:37:46 UTC (rev 7917) @@ -26,7 +26,7 @@ # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view plugins window help file.menu=newMap openFile recent closeMap - saveMap saveMapAs closeAllMaps revertMap createImage - options shortcuts - exit -edit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection +edit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes #pickmaps.menu: See gridarta @@ -41,7 +41,7 @@ mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor mapwindowFile.menu=saveMap saveMapAs createImage - revertMap - closeMap -mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection +mapwindowEdit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection mapwindowMap.menu=gridVisible enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects mapwindowCursor.menu=moveCursor - exitConnector - selectSquare startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-05-23 12:08:06 UTC (rev 7916) +++ trunk/crossfire/ChangeLog 2010-05-23 12:37:46 UTC (rev 7917) @@ -1,3 +1,9 @@ +2010-05-23 Andreas Kirschbaum + + * Implement #1717845 (Multitile paste) as File|Paste Tiled: paste + the copy buffer into the selection. If the selection is larger + than the copy buffer, tiling happens. + 2010-05-22 Andreas Kirschbaum * Fix "Generate Preview" to regenerate previews for all selected Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties 2010-05-23 12:08:06 UTC (rev 7916) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties 2010-05-23 12:37:46 UTC (rev 7917) @@ -26,7 +26,7 @@ # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view plugins window help file.menu=newMap openFile recent closeMap - saveMap saveMapAs closeAllMaps revertMap createImage - options shortcuts - exit -edit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection +edit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes #pickmaps.menu: See gridarta @@ -41,7 +41,7 @@ mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor mapwindowFile.menu=saveMap saveMapAs createImage - revertMap - closeMap -mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection +mapwindowEdit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection mapwindowMap.menu=gridVisible smoothing enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects mapwindowCursor.menu=moveCursor - exitConnector - selectSquare startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-05-23 12:08:06 UTC (rev 7916) +++ trunk/daimonin/ChangeLog 2010-05-23 12:37:46 UTC (rev 7917) @@ -1,3 +1,9 @@ +2010-05-23 Andreas Kirschbaum + + * Implement #1717845 (Multitile paste) as File|Paste Tiled: paste + the copy buffer into the selection. If the selection is larger + than the copy buffer, tiling happens. + 2010-05-22 Andreas Kirschbaum * Fix "Generate Preview" to regenerate previews for all selected Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2010-05-23 12:08:06 UTC (rev 7916) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2010-05-23 12:37:46 UTC (rev 7917) @@ -26,7 +26,7 @@ # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view plugins window help file.menu=newMap openFile recent closeMap - saveMap saveMapAs closeAllMaps revertMap createImage - options shortcuts - exit -edit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection +edit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes #pickmaps.menu: See gridarta @@ -41,7 +41,7 @@ mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor mapwindowFile.menu=saveMap saveMapAs createImage - revertMap - closeMap -mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection +mapwindowEdit.menu=undo redo - clear cut copy paste pasteTiled - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection mapwindowMap.menu=gridVisible enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects mapwindowCursor.menu=moveCursor - exitConnector - selectSquare startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes Modified: trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java 2010-05-23 12:08:06 UTC (rev 7916) +++ trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java 2010-05-23 12:37:46 UTC (rev 7917) @@ -37,6 +37,7 @@ import net.sf.gridarta.model.map.mapmodel.MapModelListener; import net.sf.gridarta.model.map.mapmodel.MapSquare; import net.sf.gridarta.model.mapviewsettings.MapViewSettings; +import net.sf.gridarta.utils.MathUtils; import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; @@ -175,7 +176,6 @@ * Executing the Paste command. * @param mapView the map view to paste on * @param startLocation the location to paste into - * @todo paste only sub-regions when a region is selected */ public void paste(@NotNull final MapView<G, A, R> mapView, @NotNull final Point startLocation) { final MapModel<G, A, R> mapModel2 = mapView.getMapControl().getMapModel(); @@ -210,6 +210,49 @@ } /** + * Executing the Paste Tiled command. + * @param mapView the map view to paste on + * @param selectedSquares the square to paste into + * @param origin the origin where to start pasting + */ + public void pasteTiled(@NotNull final MapView<G, A, R> mapView, @NotNull final Iterable<MapSquare<G, A, R>> selectedSquares, @NotNull final Point origin) { + final Point sourcePoint = new Point(); + final Point destinationPoint = new Point(); + final MapModel<G, A, R> mapModel2 = mapView.getMapControl().getMapModel(); + final Size2D mapModelSize = mapModel.getMapSize(); + mapModel2.beginTransaction("Paste"); // TODO: I18N/L10N + try { + for (final MapSquare<G, A, R> destinationMapSquare : selectedSquares) { + sourcePoint.x = MathUtils.mod(destinationMapSquare.getMapX() - origin.x, mapModelSize.getWidth()); + sourcePoint.y = MathUtils.mod(destinationMapSquare.getMapY() - origin.y, mapModelSize.getHeight()); + final MapSquare<G, A, R> sourceMapSquare = mapModel.getMapSquare(sourcePoint); + for (final BaseObject<G, A, R, ?> gameObject : sourceMapSquare) { + if (!gameObject.isMulti()) { + destinationPoint.x = destinationMapSquare.getMapX(); + destinationPoint.y = destinationMapSquare.getMapY(); + mapModel2.addCopyToMap(gameObject, destinationPoint, true, insertionModeSet.getTopmostInsertionMode()); + } + } + } + + for (final MapSquare<G, A, R> destinationMapSquare : selectedSquares) { + sourcePoint.x = MathUtils.mod(destinationMapSquare.getMapX() - origin.x, mapModelSize.getWidth()); + sourcePoint.y = MathUtils.mod(destinationMapSquare.getMapY() - origin.y, mapModelSize.getHeight()); + final MapSquare<G, A, R> sourceMapSquare = mapModel.getMapSquare(sourcePoint); + for (final BaseObject<G, A, R, ?> gameObject : sourceMapSquare) { + if (gameObject.isMulti()) { + destinationPoint.x = destinationMapSquare.getMapX(); + destinationPoint.y = destinationMapSquare.getMapY(); + mapModel2.addCopyToMap(gameObject, destinationPoint, true, insertionModeSet.getTopmostInsertionMode()); + } + } + } + } finally { + mapModel2.endTransaction(); + } + } + + /** * Return all game objects. Only top-level head parts are returned; tail * parts are ignored as are objects in inventories. * @return all game objects Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 12:08:06 UTC (rev 7916) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 12:37:46 UTC (rev 7917) @@ -245,6 +245,12 @@ private final Action aPaste; /** + * Action called for "paste tiled". + */ + @NotNull + private final Action aPasteTiled; + + /** * Action called for "replace". */ @NotNull @@ -429,6 +435,7 @@ aCut = ActionUtils.newAction(ACTION_BUILDER, "Copy Buffer", this, "cut"); aCopy = ActionUtils.newAction(ACTION_BUILDER, "Copy Buffer", this, "copy"); aPaste = ActionUtils.newAction(ACTION_BUILDER, "Copy Buffer", this, "paste"); + aPasteTiled = ActionUtils.newAction(ACTION_BUILDER, "Copy Buffer", this, "pasteTiled"); aShiftNorth = ActionUtils.newAction(ACTION_BUILDER, "Map/Shift", this, "shiftNorth"); aShiftNorthEast = ActionUtils.newAction(ACTION_BUILDER, "Map/Shift", this, "shiftNorthEast"); aShiftEast = ActionUtils.newAction(ACTION_BUILDER, "Map/Shift", this, "shiftEast"); @@ -664,6 +671,7 @@ aCut.setEnabled(doCut(false)); aCopy.setEnabled(doCopy(false)); aPaste.setEnabled(doPaste(false)); + aPasteTiled.setEnabled(doPasteTiled(false)); aShiftNorth.setEnabled(doShift(false, 0)); aShiftNorthEast.setEnabled(doShift(false, 4)); aShiftEast.setEnabled(doShift(false, 1)); @@ -722,6 +730,14 @@ } /** + * "Paste Tiled" was selected from the Edit menu. + */ + @ActionMethod + public void pasteTiled() { + doPasteTiled(true); + } + + /** * "Shift North" was selected from the Edit menu. */ @ActionMethod @@ -1031,6 +1047,48 @@ } /** + * Executes the "paste tiled" action. + * @param performAction whether the action should be performed + * @return whether the action was or can be performed + */ + private boolean doPasteTiled(final boolean performAction) { + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + final Point startLocation = mapView.getMapViewBasic().getMapCursor().getLocation(); + if (startLocation == null) { + return false; + } + + if (copyBuffer.isEmpty()) { + return false; + } + + final MapViewBasic<G,A,R> mapViewBasic = mapView.getMapViewBasic(); + final List<MapSquare<G, A, R>> selectedSquares = mapViewBasic.getSelectedSquares(); + if (selectedSquares.isEmpty()) { + return false; + } + + final MapGrid mapGrid = mapViewBasic.getMapGrid(); + final Rectangle selectedRec = mapGrid.getSelectedRec(); + if (selectedRec == null) { + return false; + } + + if (performAction) { + final MapCursor mapCursor = mapViewBasic.getMapCursor(); + final Point cursorLocation = mapCursor.getLocation(); + final Point origin = cursorLocation == null ? selectedRec.getLocation() : cursorLocation; + copyBuffer.pasteTiled(mapView, selectedSquares, origin); + } + + return true; + } + + /** * Executes the "shift" action. * @param performAction whether the action should be performed * @param direction the direction to shift Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2010-05-23 12:08:06 UTC (rev 7916) +++ trunk/src/app/net/sf/gridarta/messages.properties 2010-05-23 12:37:46 UTC (rev 7917) @@ -724,6 +724,10 @@ paste.shortdescription=Pastes the clipboard to map cursor. paste.accel=ctrl pressed V +pasteTiled.text=Paste Tiled +pasteTiled.shortdescription=Pastes the clipboard to selected map squares. +pasteTiled.longdescription=Pastes the clipboard to selected map squares. Pastes the clipboard as tiles if the clipboard''s size is smaller than the selected area. + shift.text=Shift shift.shortdescription=Shifts the selected squares. shift.mnemonic=H Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-23 12:08:06 UTC (rev 7916) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-23 12:37:46 UTC (rev 7917) @@ -679,6 +679,10 @@ paste.mnemonic=E paste.shortdescription=Kopiert die Zwischenablage an das Cursor-Feld. +pasteTiled=Gekachelt einf\xFCgen +pasteTiled.shortdescription=Kopiert die Zwischenablage in die ausgew\xE4hlten Felder. +pasteTiled.longdescription=Kopiert die Zwischenablage in die ausgew\xE4hlten Felder. Falls the Zwischenablage kleiner als die ausgew\xE4hlten Felder ist, wird gekachelt. + shift.text=Verschieben shift.mnemonic=V shift.shortdescription=Verschiebt die ausgew\xE4hlten Felder. Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-05-23 12:08:06 UTC (rev 7916) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-05-23 12:37:46 UTC (rev 7917) @@ -671,6 +671,10 @@ paste.mnemonic=L #paste.shortdescription= +#pasteTiled.text= +#pasteTiled.shortdescription= +#pasteTiled.longdescription= + #shift.text= shift.mnemonic=S #shift.shortdescription= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-05-23 12:08:06 UTC (rev 7916) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-05-23 12:37:46 UTC (rev 7917) @@ -677,6 +677,10 @@ paste.mnemonic=L #paste.shortdescription= +#pasteTiled.text= +#pasteTiled.shortdescription= +#pasteTiled.longdescription= + #shift.text= #shift.mnemonic= #shift.shortdescription= Added: trunk/src/app/net/sf/gridarta/utils/MathUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/MathUtils.java (rev 0) +++ trunk/src/app/net/sf/gridarta/utils/MathUtils.java 2010-05-23 12:37:46 UTC (rev 7917) @@ -0,0 +1,47 @@ +/* + * This file is part of JXClient, the Fullscreen Java Crossfire Client. + * + * JXClient 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. + * + * JXClient 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 JXClient; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + * Copyright (C) 2005-2008 Yann Chachkoff. + * Copyright (C) 2006-2010 Andreas Kirschbaum. + */ + +package net.sf.gridarta.utils; + +/** + * Utility class for mathematical functions. + * @author Andreas Kirschbaum + */ +public class MathUtils { + + /** + * Private constructor to prevent instantiation. + */ + private MathUtils() { + } + + /** + * Calculates the remainder of <code>a/b</code>. + * @param numerator the numerator + * @param denominator the denominator + * @return the quotient + */ + public static int mod(final int numerator, final int denominator) { + final int result = numerator % denominator; + return result < 0 ? result + denominator : result; + } + +} // class MathUtils Property changes on: trunk/src/app/net/sf/gridarta/utils/MathUtils.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 12:08:13
|
Revision: 7916 http://gridarta.svn.sourceforge.net/gridarta/?rev=7916&view=rev Author: akirschbaum Date: 2010-05-23 12:08:06 +0000 (Sun, 23 May 2010) Log Message: ----------- Do not include an empty border around the copy buffer's map model. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java Modified: trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java 2010-05-23 12:06:10 UTC (rev 7915) +++ trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java 2010-05-23 12:08:06 UTC (rev 7916) @@ -146,7 +146,7 @@ private void copyNCut(@NotNull final MapView<G, A, R> mapView, @NotNull final Rectangle selectedRec, @NotNull final CopyMode copyMode) { mapModel.beginTransaction("Cut / Clear"); try { - copyMode.prepare(mapModel, new Size2D(selectedRec.width + 1, selectedRec.height + 1)); + copyMode.prepare(mapModel, new Size2D(selectedRec.width, selectedRec.height)); final MapModel<G, A, R> mapModel2 = mapView.getMapControl().getMapModel(); mapModel2.beginTransaction("Cut / Clear"); // TODO: I18N/L10N This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 12:06:16
|
Revision: 7915 http://gridarta.svn.sourceforge.net/gridarta/?rev=7915&view=rev Author: akirschbaum Date: 2010-05-23 12:06:10 +0000 (Sun, 23 May 2010) Log Message: ----------- Fix typos. Modified Paths: -------------- trunk/gridarta.ipr trunk/src/app/net/sf/gridarta/mainactions/MainActions.java Modified: trunk/gridarta.ipr =================================================================== --- trunk/gridarta.ipr 2010-05-23 12:04:35 UTC (rev 7914) +++ trunk/gridarta.ipr 2010-05-23 12:06:10 UTC (rev 7915) @@ -1135,6 +1135,7 @@ <w>beanshell</w> <w>bitmask</w> <w>daimonin</w> + <w>exiter</w> <w>filter<?, ?></w> <w>goto</w> <w>gridarta</w> @@ -1149,6 +1150,7 @@ <w>pickmaps</w> <w>plugins</w> <w>resize</w> + <w>resized</w> <w>resizes</w> <w>shortdescription</w> <w>startup</w> Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 12:04:35 UTC (rev 7914) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 12:06:10 UTC (rev 7915) @@ -858,7 +858,7 @@ } /** - * Invoked when the user wants to expand the selction of empty map squares + * Invoked when the user wants to expand the selection of empty map squares * to surrounding empty map squares. */ @ActionMethod This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 12:04:42
|
Revision: 7914 http://gridarta.svn.sourceforge.net/gridarta/?rev=7914&view=rev Author: akirschbaum Date: 2010-05-23 12:04:35 +0000 (Sun, 23 May 2010) Log Message: ----------- Remove some fields from MainActions. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 11:54:22 UTC (rev 7913) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 12:04:35 UTC (rev 7914) @@ -354,68 +354,6 @@ private volatile Collector collector = null; /** - * The map manager listener to detect created and closed map views. - */ - @NotNull - private final MapManagerListener<G, A, R> mapManagerListener = new MapManagerListener<G, A, R>() { - - /** {@inheritDoc} */ - @Override - public void currentMapChanged(@Nullable final MapControl<G, A, R> mapControl) { - currentMapControl = mapControl; - refreshMenus(); - } - - /** {@inheritDoc} */ - @Override - public void mapCreated(@NotNull final MapControl<G, A, R> mapControl, final boolean interactive) { - // ignore: a current map changed event will be generated - } - - /** {@inheritDoc} */ - @Override - public void mapClosing(@NotNull final MapControl<G, A, R> mapControl) { - // ignore: a current map changed event will be generated - } - - /** {@inheritDoc} */ - @Override - public void mapClosed(@NotNull final MapControl<G, A, R> mapControl) { - // ignore: a current map changed event will be generated - } - - }; - - /** - * The map manager listener to detect created and closed map views. - */ - @NotNull - private final MapViewManagerListener<G, A, R> mapViewManagerListener = new MapViewManagerListener<G, A, R>() { - - /** {@inheritDoc} */ - @Override - public void activeMapViewChanged(@Nullable final MapView<G, A, R> mapView) { - currentMapView = mapView; - refreshMenus(); - } - - /** {@inheritDoc} */ - @Override - public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) { - mapView.getMapViewBasic().getMapGrid().addMapGridListener(mapGridListener); - mapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); - } - - /** {@inheritDoc} */ - @Override - public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) { - mapView.getMapViewBasic().getMapCursor().removeMapCursorListener(mapCursorListener); - mapView.getMapViewBasic().getMapGrid().removeMapGridListener(mapGridListener); - } - - }; - - /** * The map grid listener used to detect map grid changes. */ @NotNull @@ -456,70 +394,6 @@ }; /** - * The map model listener used to detect copybuffer changes. - */ - @NotNull - private final MapModelListener<G, A, R> mapModelListener = new MapModelListener<G, A, R>() { - - /** {@inheritDoc} */ - @Override - public void mapMetaChanged() { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void mapSizeChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Size2D newSize) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void mapSquaresChanged(@NotNull final Set<MapSquare<G, A, R>> mapSquares) { - refreshMenus(); - } - - /** {@inheritDoc} */ - @Override - public void mapObjectsChanged(@NotNull final Set<G> gameObjects, @NotNull final Set<G> transientGameObjects) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void mapFileChanged(@Nullable final File oldMapFile) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void modifiedChanged(@NotNull final MapModel<G, A, R> mapModel) { - // ignore - } - - }; - - /** - * The archetype set listener used to detect archetype set state changes. - */ - @NotNull - private final ArchetypeSetListener<G, A, R> archetypeSetListener = new ArchetypeSetListener<G, A, R>() { - - /** {@inheritDoc} */ - @Override - public void loadedFromArchiveChanged() { - refreshMenus(); - } - - }; - - /** * Create a new instance. * @param replaceDialogManager the replace dialog manager to use * @param parent the parent component for dialog windows @@ -578,13 +452,172 @@ aCollectArches = ActionUtils.newAction(ACTION_BUILDER, "Tool", this, "collectArches"); aReloadFaces = ActionUtils.newAction(ACTION_BUILDER, "Image,Tool", this, "reloadFaces"); aValidateMap = ActionUtils.newAction(ACTION_BUILDER, "Map,Tool", this, "validateMap"); - mapManager.addMapManagerListener(mapManagerListener); + + mapManager.addMapManagerListener(newMapManagerListener()); currentMapControl = mapManager.getCurrentMap(); - mapViewManager.addMapViewManagerListener(mapViewManagerListener); + + mapViewManager.addMapViewManagerListener(newMapViewManagerListener()); currentMapView = mapViewManager.getActiveMapView(); - archetypeSet.addArchetypeSetListener(archetypeSetListener); - copyBuffer.addMapModelListener(mapModelListener); + archetypeSet.addArchetypeSetListener(newArchetypeSetListener()); + copyBuffer.addMapModelListener(newMapModelListener()); + exiter.addExiterListener(newExiterListener()); + refreshMenus(); + } + + /** + * Creates a new {@link MapManagerListener} that refreshes the actions when + * the current map changes. + * @return the map manager listener + */ + @NotNull + private MapManagerListener<G, A, R> newMapManagerListener() { + final MapManagerListener<G, A, R> mapManagerListener = new MapManagerListener<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void currentMapChanged(@Nullable final MapControl<G, A, R> mapControl) { + currentMapControl = mapControl; + refreshMenus(); + } + + /** {@inheritDoc} */ + @Override + public void mapCreated(@NotNull final MapControl<G, A, R> mapControl, final boolean interactive) { + // ignore: a current map changed event will be generated + } + + /** {@inheritDoc} */ + @Override + public void mapClosing(@NotNull final MapControl<G, A, R> mapControl) { + // ignore: a current map changed event will be generated + } + + /** {@inheritDoc} */ + @Override + public void mapClosed(@NotNull final MapControl<G, A, R> mapControl) { + // ignore: a current map changed event will be generated + } + + }; + return mapManagerListener; + } + + /** + * Creates a new {@link MapManagerListener} that refreshes the actions when + * map views are created or closed. + * @return the map manager listener + */ + @NotNull + private MapViewManagerListener<G, A, R> newMapViewManagerListener() { + final MapViewManagerListener<G, A, R> mapViewManagerListener = new MapViewManagerListener<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void activeMapViewChanged(@Nullable final MapView<G, A, R> mapView) { + currentMapView = mapView; + refreshMenus(); + } + + /** {@inheritDoc} */ + @Override + public void mapViewCreated(@NotNull final MapView<G, A, R> mapView) { + mapView.getMapViewBasic().getMapGrid().addMapGridListener(mapGridListener); + mapView.getMapViewBasic().getMapCursor().addMapCursorListener(mapCursorListener); + } + + /** {@inheritDoc} */ + @Override + public void mapViewClosing(@NotNull final MapView<G, A, R> mapView) { + mapView.getMapViewBasic().getMapCursor().removeMapCursorListener(mapCursorListener); + mapView.getMapViewBasic().getMapGrid().removeMapGridListener(mapGridListener); + } + + }; + return mapViewManagerListener; + } + + /** + * Creates a new {@link ArchetypeSetListener} that refreshes the actions + * when the "load from archive" flag has changed. + * @return the archetype set listener + */ + @NotNull + private ArchetypeSetListener<G, A, R> newArchetypeSetListener() { + final ArchetypeSetListener<G, A, R> archetypeSetListener = new ArchetypeSetListener<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void loadedFromArchiveChanged() { + refreshMenus(); + } + + }; + return archetypeSetListener; + } + + /** + * Creates a new {@link MapModelListener} that refreshes the actions when + * the map contents change. + * @return the map model listener + */ + @NotNull + private MapModelListener<G, A, R> newMapModelListener() { + final MapModelListener<G, A, R> mapModelListener = new MapModelListener<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void mapMetaChanged() { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void mapSizeChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Size2D newSize) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void mapSquaresChanged(@NotNull final Set<MapSquare<G, A, R>> mapSquares) { + refreshMenus(); + } + + /** {@inheritDoc} */ + @Override + public void mapObjectsChanged(@NotNull final Set<G> gameObjects, @NotNull final Set<G> transientGameObjects) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void mapFileChanged(@Nullable final File oldMapFile) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void modifiedChanged(@NotNull final MapModel<G, A, R> mapModel) { + // ignore + } + + }; + return mapModelListener; + } + + /** + * Creates a new {@link ExiterListener} that delays application exit until + * archetype collection has finished. + * @return the exiter listener + */ + @NotNull + private ExiterListener newExiterListener() { final ExiterListener exiterListener = new ExiterListener() { /** @@ -620,9 +653,7 @@ } }; - exiter.addExiterListener(exiterListener); - - refreshMenus(); + return exiterListener; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 11:54:29
|
Revision: 7913 http://gridarta.svn.sourceforge.net/gridarta/?rev=7913&view=rev Author: akirschbaum Date: 2010-05-23 11:54:22 +0000 (Sun, 23 May 2010) Log Message: ----------- Move code from CopyBuffer to MainActions. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java Modified: trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java 2010-05-23 11:45:28 UTC (rev 7912) +++ trunk/src/app/net/sf/gridarta/gui/copybuffer/CopyBuffer.java 2010-05-23 11:54:22 UTC (rev 7913) @@ -39,7 +39,6 @@ import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Common base implementation of CopyBuffer. The CopyBuffer is responsible for @@ -112,135 +111,102 @@ /** * Executing the Clear command. - * @param mapView the map view to clear or <code>null</code> - * @param performAction whether the action should be performed - * @return whether the action was or can be performed + * @param mapView the map view to clear + * @param selectedRec the rectangle to operate on */ - public boolean clear(@Nullable final MapView<G, A, R> mapView, final boolean performAction) { - return copyNCut(mapView, CopyMode.DO_CLEAR, performAction); + public void clear(@NotNull final MapView<G, A, R> mapView, @NotNull final Rectangle selectedRec) { + copyNCut(mapView, selectedRec, CopyMode.DO_CLEAR); } /** * Executing the Cut command. - * @param mapView the map view to cut from or <code>null</code> - * @param performAction whether the action should be performed - * @return whether the action was or can be performed + * @param mapView the map view to cut from + * @param selectedRec the rectangle to operate on */ - public boolean cut(@Nullable final MapView<G, A, R> mapView, final boolean performAction) { - return copyNCut(mapView, CopyMode.DO_CUT, performAction); + public void cut(@NotNull final MapView<G, A, R> mapView, @NotNull final Rectangle selectedRec) { + copyNCut(mapView, selectedRec, CopyMode.DO_CUT); } /** * Executing the Copy command. - * @param mapView the map view to copy from or <code>null</code> - * @param performAction whether the action should be performed - * @return whether the action was or can be performed + * @param mapView the map view to copy from + * @param selectedRec the rectangle to operate on */ - public boolean copy(@Nullable final MapView<G, A, R> mapView, final boolean performAction) { - return copyNCut(mapView, CopyMode.DO_COPY, performAction); + public void copy(@NotNull final MapView<G, A, R> mapView, @NotNull final Rectangle selectedRec) { + copyNCut(mapView, selectedRec, CopyMode.DO_COPY); } /** * copyNCut implements clear, cut and copy in one function (since they are * so similar). * @param mapView the map view to operate on + * @param selectedRec the rectangle to operate on * @param copyMode defines if we have a cut, copy or paste action - * @param performAction whether the action should be performed - * @return whether the action was or can be performed */ - private boolean copyNCut(@Nullable final MapView<G, A, R> mapView, @NotNull final CopyMode copyMode, final boolean performAction) { - if (mapView == null) { - return false; - } - final Rectangle selectedRec = mapView.getMapViewBasic().getMapGrid().getSelectedRec(); - if (selectedRec == null) { - return false; - } + private void copyNCut(@NotNull final MapView<G, A, R> mapView, @NotNull final Rectangle selectedRec, @NotNull final CopyMode copyMode) { + mapModel.beginTransaction("Cut / Clear"); + try { + copyMode.prepare(mapModel, new Size2D(selectedRec.width + 1, selectedRec.height + 1)); - if (performAction) { - mapModel.beginTransaction("Cut / Clear"); + final MapModel<G, A, R> mapModel2 = mapView.getMapControl().getMapModel(); + mapModel2.beginTransaction("Cut / Clear"); // TODO: I18N/L10N try { - copyMode.prepare(mapModel, new Size2D(selectedRec.width + 1, selectedRec.height + 1)); - - final MapModel<G, A, R> mapModel2 = mapView.getMapControl().getMapModel(); - mapModel2.beginTransaction("Cut / Clear"); // TODO: I18N/L10N - try { - final Collection<G> gameObjectsToDelete = new HashSet<G>(); - for (final MapSquare<G, A, R> square : mapView.getMapViewBasic().getSelectedSquares()) { - final int posX = square.getMapX() - selectedRec.x; - final int posY = square.getMapY() - selectedRec.y; - for (final G gameObject : square) { - copyMode.process(mapModel, gameObject, mapViewSettings.isEditType(gameObject), gameObjectsToDelete, posX, posY, gameObjectFactory, insertionModeSet); - } + final Collection<G> gameObjectsToDelete = new HashSet<G>(); + for (final MapSquare<G, A, R> square : mapView.getMapViewBasic().getSelectedSquares()) { + final int posX = square.getMapX() - selectedRec.x; + final int posY = square.getMapY() - selectedRec.y; + for (final G gameObject : square) { + copyMode.process(mapModel, gameObject, mapViewSettings.isEditType(gameObject), gameObjectsToDelete, posX, posY, gameObjectFactory, insertionModeSet); } + } - for (final GameObject<G, A, R> gameObject : gameObjectsToDelete) { - gameObject.remove(); - } - } finally { - mapModel2.endTransaction(); + for (final GameObject<G, A, R> gameObject : gameObjectsToDelete) { + gameObject.remove(); } } finally { - mapModel.endTransaction(); + mapModel2.endTransaction(); } + } finally { + mapModel.endTransaction(); } - - return true; } /** * Executing the Paste command. * @param mapView the map view to paste on - * @param performAction whether the action should be performed - * @return whether the action was or can be performed + * @param startLocation the location to paste into * @todo paste only sub-regions when a region is selected */ - public boolean paste(@Nullable final MapView<G, A, R> mapView, final boolean performAction) { - if (mapView == null) { - return false; - } - final Point startLocation = mapView.getMapViewBasic().getMapCursor().getLocation(); - if (startLocation == null) { - return false; - } - - if (mapModel.isEmpty()) { - return false; - } - - if (performAction) { - final MapModel<G, A, R> mapModel2 = mapView.getMapControl().getMapModel(); - mapModel2.beginTransaction("Paste"); // TODO: I18N/L10N - try { - final Point pos = new Point(); - for (final MapSquare<G, A, R> square : mapModel) { - pos.setLocation(startLocation.x + square.getMapX(), startLocation.y + square.getMapY()); - if (mapModel2.isPointValid(pos)) { - for (final BaseObject<G, A, R, ?> gameObject : square) { - if (!gameObject.isMulti()) { - mapModel2.addCopyToMap(gameObject, pos, true, insertionModeSet.getTopmostInsertionMode()); - } + public void paste(@NotNull final MapView<G, A, R> mapView, @NotNull final Point startLocation) { + final MapModel<G, A, R> mapModel2 = mapView.getMapControl().getMapModel(); + mapModel2.beginTransaction("Paste"); // TODO: I18N/L10N + try { + final Point pos = new Point(); + for (final MapSquare<G, A, R> square : mapModel) { + pos.setLocation(startLocation.x + square.getMapX(), startLocation.y + square.getMapY()); + if (mapModel2.isPointValid(pos)) { + for (final BaseObject<G, A, R, ?> gameObject : square) { + if (!gameObject.isMulti()) { + mapModel2.addCopyToMap(gameObject, pos, true, insertionModeSet.getTopmostInsertionMode()); } } } + } - for (final MapSquare<G, A, R> square : mapModel) { - pos.setLocation(startLocation); - pos.translate(square.getMapX(), square.getMapY()); - if (mapModel2.isPointValid(pos)) { - for (final BaseObject<G, A, R, ?> gameObject : square) { - if (gameObject.isMulti()) { - mapModel2.addCopyToMap(gameObject, pos, true, insertionModeSet.getTopmostInsertionMode()); - } + for (final MapSquare<G, A, R> square : mapModel) { + pos.setLocation(startLocation); + pos.translate(square.getMapX(), square.getMapY()); + if (mapModel2.isPointValid(pos)) { + for (final BaseObject<G, A, R, ?> gameObject : square) { + if (gameObject.isMulti()) { + mapModel2.addCopyToMap(gameObject, pos, true, insertionModeSet.getTopmostInsertionMode()); } } } - } finally { - mapModel2.endTransaction(); } + } finally { + mapModel2.endTransaction(); } - - return true; } /** @@ -253,4 +219,12 @@ return mapModel.getAllGameObjects(); } + /** + * Returns whether this copy buffer contains any game objects. + * @return whether any game objects exist + */ + public boolean isEmpty() { + return mapModel.isEmpty(); + } + } // class CopyBuffer Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 11:45:28 UTC (rev 7912) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 11:54:22 UTC (rev 7913) @@ -21,6 +21,7 @@ import java.awt.Component; import java.awt.Point; +import java.awt.Rectangle; import java.io.File; import java.util.IdentityHashMap; import java.util.List; @@ -908,7 +909,21 @@ * @return whether the action was or can be performed */ private boolean doClear(final boolean performAction) { - return copyBuffer.clear(currentMapView, performAction); + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + final Rectangle selectedRec = mapView.getMapViewBasic().getMapGrid().getSelectedRec(); + if (selectedRec == null) { + return false; + } + + if (performAction) { + copyBuffer.clear(mapView, selectedRec); + } + + return true; } /** @@ -917,7 +932,21 @@ * @return whether the action was or can be performed */ private boolean doCut(final boolean performAction) { - return copyBuffer.cut(currentMapView, performAction); + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + final Rectangle selectedRec = mapView.getMapViewBasic().getMapGrid().getSelectedRec(); + if (selectedRec == null) { + return false; + } + + if (performAction) { + copyBuffer.cut(mapView, selectedRec); + } + + return true; } /** @@ -926,7 +955,21 @@ * @return whether the action was or can be performed */ private boolean doCopy(final boolean performAction) { - return copyBuffer.copy(currentMapView, performAction); + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + final Rectangle selectedRec = mapView.getMapViewBasic().getMapGrid().getSelectedRec(); + if (selectedRec == null) { + return false; + } + + if (performAction) { + copyBuffer.copy(mapView, selectedRec); + } + + return true; } /** @@ -935,7 +978,25 @@ * @return whether the action was or can be performed */ private boolean doPaste(final boolean performAction) { - return copyBuffer.paste(currentMapView, performAction); + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + final Point startLocation = mapView.getMapViewBasic().getMapCursor().getLocation(); + if (startLocation == null) { + return false; + } + + if (copyBuffer.isEmpty()) { + return false; + } + + if (performAction) { + copyBuffer.paste(mapView, startLocation); + } + + return true; } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 11:45:35
|
Revision: 7912 http://gridarta.svn.sourceforge.net/gridarta/?rev=7912&view=rev Author: akirschbaum Date: 2010-05-23 11:45:28 +0000 (Sun, 23 May 2010) Log Message: ----------- Make project compilable. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 11:44:15 UTC (rev 7911) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 11:45:28 UTC (rev 7912) @@ -647,7 +647,7 @@ aRandFillAuto.setEnabled(doRandFillAuto(false)); aRandFillAbove.setEnabled(doRandFillAbove(false)); aRandFillBelow.setEnabled(doRandFillBelow(false)); - aFloodfill.setEnabled(doFloodFill(false)); + aFloodFill.setEnabled(doFloodFill(false)); aSelectAll.setEnabled(doSelectAll(false)); aExpandEmptySelection.setEnabled(doExpandEmptySelection(false)); aGrowSelection.setEnabled(doGrowSelection(false)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-05-23 11:44:22
|
Revision: 7911 http://gridarta.svn.sourceforge.net/gridarta/?rev=7911&view=rev Author: akirschbaum Date: 2010-05-23 11:44:15 +0000 (Sun, 23 May 2010) Log Message: ----------- Rename action 'floodfill' to 'floodFill'. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties trunk/src/app/net/sf/gridarta/action.properties trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties trunk/src/app/net/sf/gridarta/model/floodfill/FillUtils.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2010-05-23 11:40:43 UTC (rev 7910) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2010-05-23 11:44:15 UTC (rev 7911) @@ -26,7 +26,7 @@ # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view plugins window help file.menu=newMap openFile recent closeMap - saveMap saveMapAs closeAllMaps revertMap createImage - options shortcuts - exit -edit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodfill - selectAll expandEmptySelection growSelection shrinkSelection +edit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes #pickmaps.menu: See gridarta @@ -41,7 +41,7 @@ mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor mapwindowFile.menu=saveMap saveMapAs createImage - revertMap - closeMap -mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodfill - selectAll expandEmptySelection growSelection shrinkSelection +mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection mapwindowMap.menu=gridVisible enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects mapwindowCursor.menu=moveCursor - exitConnector - selectSquare startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties 2010-05-23 11:40:43 UTC (rev 7910) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties 2010-05-23 11:44:15 UTC (rev 7911) @@ -26,7 +26,7 @@ # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view plugins window help file.menu=newMap openFile recent closeMap - saveMap saveMapAs closeAllMaps revertMap createImage - options shortcuts - exit -edit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodfill - selectAll expandEmptySelection growSelection shrinkSelection +edit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes #pickmaps.menu: See gridarta @@ -41,7 +41,7 @@ mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor mapwindowFile.menu=saveMap saveMapAs createImage - revertMap - closeMap -mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodfill - selectAll expandEmptySelection growSelection shrinkSelection +mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection mapwindowMap.menu=gridVisible smoothing enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects mapwindowCursor.menu=moveCursor - exitConnector - selectSquare startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2010-05-23 11:40:43 UTC (rev 7910) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2010-05-23 11:44:15 UTC (rev 7911) @@ -26,7 +26,7 @@ # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view plugins window help file.menu=newMap openFile recent closeMap - saveMap saveMapAs closeAllMaps revertMap createImage - options shortcuts - exit -edit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodfill - selectAll expandEmptySelection growSelection shrinkSelection +edit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection map.menu=autoJoin - enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects - gameObjectTextEditor archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes #pickmaps.menu: See gridarta @@ -41,7 +41,7 @@ mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor mapwindowFile.menu=saveMap saveMapAs createImage - revertMap - closeMap -mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodfill - selectAll expandEmptySelection growSelection shrinkSelection +mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodFill - selectAll expandEmptySelection growSelection shrinkSelection mapwindowMap.menu=gridVisible enterExit nextExit prevExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize deleteUnknownObjects mapwindowCursor.menu=moveCursor - exitConnector - selectSquare startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes Modified: trunk/src/app/net/sf/gridarta/action.properties =================================================================== --- trunk/src/app/net/sf/gridarta/action.properties 2010-05-23 11:40:43 UTC (rev 7910) +++ trunk/src/app/net/sf/gridarta/action.properties 2010-05-23 11:44:15 UTC (rev 7911) @@ -75,7 +75,7 @@ randFillBelow.icon=EmptySmallIcon -floodfill.icon=EmptySmallIcon +floodFill.icon=EmptySmallIcon selectAll.icon=EmptySmallIcon Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 11:40:43 UTC (rev 7910) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-05-23 11:44:15 UTC (rev 7911) @@ -286,10 +286,10 @@ private final Action aRandFillBelow; /** - * Action called for "floodfill". + * Action called for "flood fill". */ @NotNull - private final Action aFloodfill; + private final Action aFloodFill; /** * Action called for "select all". @@ -569,7 +569,7 @@ aRandFillAuto = ActionUtils.newAction(ACTION_BUILDER, "Map/Fill", this, "randFillAuto"); aRandFillAbove = ActionUtils.newAction(ACTION_BUILDER, "Map/Fill", this, "randFillAbove"); aRandFillBelow = ActionUtils.newAction(ACTION_BUILDER, "Map/Fill", this, "randFillBelow"); - aFloodfill = ActionUtils.newAction(ACTION_BUILDER, "Map/Fill", this, "floodfill"); + aFloodFill = ActionUtils.newAction(ACTION_BUILDER, "Map/Fill", this, "floodFill"); aSelectAll = ActionUtils.newAction(ACTION_BUILDER, "Map/Selection", this, "selectAll"); aExpandEmptySelection = ActionUtils.newAction(ACTION_BUILDER, "Map/Selection", this, "expandEmptySelection"); aGrowSelection = ActionUtils.newAction(ACTION_BUILDER, "Map/Selection", this, "growSelection"); @@ -810,10 +810,10 @@ } /** - * "Floodfill" was selected from the Edit menu. + * "Flood fill" was selected from the Edit menu. */ @ActionMethod - public void floodfill() { + public void floodFill() { doFloodFill(true); } @@ -1094,7 +1094,7 @@ } if (performAction) { - FillUtils.floodfill(mapView.getMapControl().getMapModel(), mapCursorLocation, objectChooser.getSelections(), insertionModeSet); + FillUtils.floodFill(mapView.getMapControl().getMapModel(), mapCursorLocation, objectChooser.getSelections(), insertionModeSet); } return true; Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2010-05-23 11:40:43 UTC (rev 7910) +++ trunk/src/app/net/sf/gridarta/messages.properties 2010-05-23 11:44:15 UTC (rev 7911) @@ -785,9 +785,9 @@ randFillBelow.longdescription=Randomly fills the selected squares below existing game objects. New game objects are added regardless of already existing game objects. randFillBelow.accel=ctrl shift pressed D -floodfill.text=Flood Fill -floodfill.shortdescription=Fills empty squares. -floodfill.longdescription=Fills empty squares starting from the map cursor square. +floodFill.text=Flood Fill +floodFill.shortdescription=Fills empty squares. +floodFill.longdescription=Fills empty squares starting from the map cursor square. selectAll.text=Select All selectAll.mnemonic=S Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-23 11:40:43 UTC (rev 7910) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2010-05-23 11:44:15 UTC (rev 7911) @@ -735,9 +735,9 @@ randFillBelow.shortdescription=F\xFCllt die ausgew\xE4hlten Felder zuf\xE4llig. Neu eingef\xFCgte Objekte werden unter bereits existierenden Objekten eingef\xFCgt. randFillBelow.longdescription=F\xFCllt die ausgew\xE4hlten Felder zuf\xE4llig. Neu eingef\xFCgte Objekte werden unter bereits existierenden Objekten eingef\xFCgt und ersetzen niemals bereits existierende Objekte. -floodfill.text=Freien Bereich f\xFCllen -floodfill.shortdescription=F\xFCllt freie Felder. -floodfill.longdescription=F\xFCllt freie Felder. Der F\xFCllvorgang beginnt im Cursor-Feld. +floodFill.text=Freien Bereich f\xFCllen +floodFill.shortdescription=F\xFCllt freie Felder. +floodFill.longdescription=F\xFCllt freie Felder. Der F\xFCllvorgang beginnt im Cursor-Feld. selectAll.text=Alles ausw\xE4hlen selectAll.mnemonic=S Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-05-23 11:40:43 UTC (rev 7910) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-05-23 11:44:15 UTC (rev 7911) @@ -727,9 +727,9 @@ #randFillBelow.shortdescription= #randFillBelow.longdescription= -#floodfill.text= -#floodfill.shortdescription= -#floodfill.longdescription= +#floodFill.text= +#floodFill.shortdescription= +#floodFill.longdescription= selectAll.text=Tout s\xE9lectionner selectAll.mnemonic=T Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-05-23 11:40:43 UTC (rev 7910) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-05-23 11:44:15 UTC (rev 7911) @@ -733,9 +733,9 @@ #randFillBelow.shortdescription= #randFillBelow.longdescription= -#floodfill.text= -#floodfill.shortdescription= -#floodfill.longdescription= +#floodFill.text= +#floodFill.shortdescription= +#floodFill.longdescription= selectAll.text=Markera allt selectAll.mnemonic=M Modified: trunk/src/app/net/sf/gridarta/model/floodfill/FillUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/floodfill/FillUtils.java 2010-05-23 11:40:43 UTC (rev 7910) +++ trunk/src/app/net/sf/gridarta/model/floodfill/FillUtils.java 2010-05-23 11:44:15 UTC (rev 7911) @@ -81,7 +81,7 @@ * @param gameObjects the game objects to fill with * @param insertionModeSet the insertion mode set to use */ - public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void floodfill(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point start, @NotNull final List<? extends BaseObject<G, A, R, ?>> gameObjects, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { + public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> void floodFill(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point start, @NotNull final List<? extends BaseObject<G, A, R, ?>> gameObjects, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { if (gameObjects.isEmpty()) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |