From: <aki...@us...> - 2008-07-28 11:03:58
|
Revision: 4542 http://gridarta.svn.sourceforge.net/gridarta/?rev=4542&view=rev Author: akirschbaum Date: 2008-07-28 11:04:02 +0000 (Mon, 28 Jul 2008) Log Message: ----------- Remove calls to MainControl.getArchetypeParser(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/io/GameObjectParser.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/io/GameObjectParser.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -282,7 +282,6 @@ throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } final MapActions mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions); archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); try { final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); @@ -300,6 +299,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser); mainView.getStatusBar().setStatusText("Loading Archetypes..."); archetypeSet.loadArchetypes(archetypeParser); Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -38,6 +38,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; +import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; @@ -95,6 +96,10 @@ @NotNull private MapActions mapActions = null; + /** The {@link ArchetypeParser} instance to use. */ + @NotNull + private ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -130,7 +135,7 @@ /** {@inheritDoc} */ public GameObjectParser newGameObjectParser() { - return new GameObjectParser(this); + return new GameObjectParser(this, archetypeParser); } /** {@inheritDoc} */ @@ -158,7 +163,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser) { this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; @@ -166,6 +171,7 @@ this.editTypes = editTypes; this.mapImageCache = mapImageCache; this.mapActions = mapActions; + this.archetypeParser = archetypeParser; } } // class CrossfireObjectsFactory Modified: trunk/crossfire/src/cfeditor/io/GameObjectParser.java =================================================================== --- trunk/crossfire/src/cfeditor/io/GameObjectParser.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/crossfire/src/cfeditor/io/GameObjectParser.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -29,6 +29,7 @@ import java.util.Map; import java.util.TreeMap; import java.util.regex.Pattern; +import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.io.AbstractGameObjectParser; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -332,9 +333,10 @@ * Create a new instance. * @param gridartaObjectsFactory The gridarta objects factory for creating * new game object instances. + * @param archetypeParser the archetype parser to use */ - public GameObjectParser(@NotNull final CrossfireObjectsFactory gridartaObjectsFactory) { - super(gridartaObjectsFactory); + public GameObjectParser(@NotNull final CrossfireObjectsFactory gridartaObjectsFactory, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser) { + super(gridartaObjectsFactory, archetypeParser); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -343,7 +343,6 @@ throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } final MapActions mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions); try { final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); archetypeTypeSet.loadTypesFromXML(filename); @@ -359,6 +358,7 @@ mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser); mainView.getStatusBar().setStatusText("Loading Archetypes..."); archetypeSet.loadArchetypes(archetypeParser); Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -38,6 +38,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; +import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; @@ -98,6 +99,10 @@ @NotNull private MapActions mapActions = null; + /** The {@link ArchetypeParser} instance to use. */ + @NotNull + private ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -133,7 +138,7 @@ /** {@inheritDoc} */ public GameObjectParser newGameObjectParser() { - return new GameObjectParser(this); + return new GameObjectParser(this, archetypeParser); } /** {@inheritDoc} */ @@ -163,7 +168,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser) { this.faceObjects = faceObjects; this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; @@ -172,6 +177,7 @@ this.editTypes = editTypes; this.mapImageCache = mapImageCache; this.mapActions = mapActions; + this.archetypeParser = archetypeParser; } } // class DaimoninObjectsFactory Modified: trunk/daimonin/src/daieditor/io/GameObjectParser.java =================================================================== --- trunk/daimonin/src/daieditor/io/GameObjectParser.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/daimonin/src/daieditor/io/GameObjectParser.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -25,6 +25,7 @@ import daieditor.map.MapArchObject; import java.io.IOException; import java.util.Formatter; +import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.io.AbstractGameObjectParser; import org.jetbrains.annotations.NotNull; @@ -39,9 +40,10 @@ * Create a new instance. * @param gridartaObjectsFactory The gridarta objects factory for creating * new game object instances. + * @param archetypeParser the archetype parser to use */ - public GameObjectParser(@NotNull final DaimoninObjectsFactory gridartaObjectsFactory) { - super(gridartaObjectsFactory); + public GameObjectParser(@NotNull final DaimoninObjectsFactory gridartaObjectsFactory, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser) { + super(gridartaObjectsFactory, archetypeParser); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -24,6 +24,7 @@ import java.io.FileNotFoundException; import java.util.List; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.face.FaceObjects; @@ -141,7 +142,8 @@ * @param editTypes the edit types instance * @param mapImageCache the map image cache instance * @param mapActions the map actions instance + * @param archetypeParser the archetype parser instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions); + void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser); } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -30,6 +30,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; @@ -52,13 +53,19 @@ @NotNull private final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory; + /** The archetype parser to use. */ + @NotNull + private final ArchetypeParser<G, A, R> archetypeParser; + /** * Create a new instance. * @param gridartaObjectsFactory The gridarta objects factory for creating * new game object instances. + * @param archetypeParser the archetype parser to use */ - protected AbstractGameObjectParser(@NotNull final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory) { + protected AbstractGameObjectParser(@NotNull final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory, @NotNull final ArchetypeParser<G, A, R> archetypeParser) { this.gridartaObjectsFactory = gridartaObjectsFactory; + this.archetypeParser = archetypeParser; } /** {@inheritDoc} */ @@ -192,7 +199,7 @@ gameObject.setObjectFace(); if (!gameObject.isInContainer()) { - mainControl.getArchetypeParser().expandMulti(gameObject, tailList); + archetypeParser.expandMulti(gameObject, tailList); } } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-28 09:03:05 UTC (rev 4541) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-28 11:04:02 UTC (rev 4542) @@ -932,7 +932,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser) { throw new AssertionError(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |