From: <aki...@us...> - 2008-08-15 22:49:08
|
Revision: 4872 http://gridarta.svn.sourceforge.net/gridarta/?rev=4872&view=rev Author: akirschbaum Date: 2008-08-15 22:49:17 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 22:44:04 UTC (rev 4871) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 22:49:17 UTC (rev 4872) @@ -166,9 +166,6 @@ /** The main view. */ private final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView; - /** The Face Objects. */ - private final FaceObjects faceObjects = new FaceObjects(); - /** The Spells. */ private final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); @@ -213,7 +210,7 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects()); + super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 22:44:04 UTC (rev 4871) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 22:49:17 UTC (rev 4872) @@ -209,9 +209,6 @@ /** Bit field of edit types to show transparent. */ private int alphaType; - /** The Face Objects. */ - private final FaceObjects faceObjects = new FaceObjects(); - /** The Spells. */ private final daieditor.spells.Spells numberSpells = new daieditor.spells.Spells(); @@ -268,7 +265,7 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects()); + super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 22:44:04 UTC (rev 4871) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 22:49:17 UTC (rev 4872) @@ -32,6 +32,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.StatusBar; @@ -104,6 +105,12 @@ protected final AnimationObjects<? extends AnimationObject> animationObjects; /** + * The face objects instance. + */ + @NotNull + protected final FaceObjects faceObjects; + + /** * The archetype set to use. */ protected ArchetypeSet<G, A, R> archetypeSet; @@ -119,14 +126,17 @@ * @param gridartaObjectsFactory the gridarta objects factory * @param key The action factory key * @param globalSettings the global settings instance + * @param animationObjects the animation objects instance + * @param faceObjects the face objects instance */ - protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects) { + protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { this.globalSettings = globalSettings; final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, globalSettings, autojoinLists); editTypes = new EditTypes<G, A, R, V>(tmpMapManager); tmpMapManager.setEditTypes(editTypes); mapManager = tmpMapManager; this.animationObjects = animationObjects; + this.faceObjects = faceObjects; copyBuffer = new CopyBuffer<G, A, R, V>(this, editTypes, gridartaObjectsFactory, autojoinLists); this.gridartaObjectsFactory = gridartaObjectsFactory; globalSettings.readGlobalSettings(); Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 22:44:04 UTC (rev 4871) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 22:49:17 UTC (rev 4872) @@ -57,7 +57,9 @@ import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.anim.AnimationParseException; import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; +import net.sf.gridarta.gameobject.face.AbstractFaceObjects; import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gameobject.face.DuplicateFaceException; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; @@ -391,7 +393,8 @@ gridartaObjectsFactory = new TestGridartaObjectsFactory(); final GlobalSettings globalSettings = new TestGlobalSettings(); final AnimationObjects<TestAnimationObject> animationObjects = new TestAnimationObjects(); - final TestMainControl mainControl = new TestMainControl(gridartaObjectsFactory, "test", globalSettings, animationObjects); + final FaceObjects faceObjects = new TestFaceObjects(); + final TestMainControl mainControl = new TestMainControl(gridartaObjectsFactory, "test", globalSettings, animationObjects, faceObjects); final TestMapArchObject mapArchObject = new TestMapArchObject(); final TestArchetypeSet archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(archetypeSet); @@ -418,9 +421,10 @@ * @param key the action factory key to use * @param globalSettings the global settings instance to use * @param animationObjects the animation objects instance to use + * @param faceObjects the face objects instance to use */ - protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<TestAnimationObject> animationObjects) { - super(gridartaObjectsFactory, key, globalSettings, animationObjects); + protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<TestAnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { + super(gridartaObjectsFactory, key, globalSettings, animationObjects, faceObjects); } /** {@inheritDoc} */ @@ -1054,4 +1058,26 @@ } + /** + * A {@link FaceObjects} implementation for testing purposes. + */ + private static class TestFaceObjects extends AbstractFaceObjects { + + /** {@inheritDoc} */ + protected void collectTreeFile(@NotNull final Progress progress, @NotNull final File dir) throws IOException { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + protected String getPngFile() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void loadFacesCollection(final File faceFile, final File treeFile) throws IOException, FileNotFoundException, DuplicateFaceException { + throw new AssertionError(); + } + + } + } // class DefaultMapModelTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |