From: <aki...@us...> - 2008-07-31 22:20:48
|
Revision: 4639 http://gridarta.svn.sourceforge.net/gridarta/?rev=4639&view=rev Author: akirschbaum Date: 2008-07-31 22:20:56 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove call to MainControl.getEditTypes(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/DefaultMapManager.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-31 22:12:44 UTC (rev 4638) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-31 22:20:56 UTC (rev 4639) @@ -103,8 +103,10 @@ * @param key The action factory key */ protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key) { - mapManager = new DefaultMapManager<G, A, R, V>(this, key); - editTypes = new EditTypes(mapManager); + DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key); + editTypes = new EditTypes(tmpMapManager); + tmpMapManager.setEditTypes(editTypes); + mapManager = tmpMapManager; copyBuffer = new CopyBuffer<G, A, R, V>(this, editTypes); this.gridartaObjectsFactory = gridartaObjectsFactory; instance = this; Modified: trunk/src/app/net/sf/gridarta/DefaultMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-07-31 22:12:44 UTC (rev 4638) +++ trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-07-31 22:20:56 UTC (rev 4639) @@ -57,6 +57,10 @@ @NotNull private final MainControl<G, A, R, V> mainControl; + /** The edit types. */ + @NotNull + private EditTypes<G, A, R, V> editTypes = null; + /** The recent manager. */ private RecentManager recentManager = null; @@ -79,6 +83,14 @@ this.mainControl = mainControl; } + /** + * Sets the edit types instance to use. + * @param editTypes + */ + public void setEditTypes(@NotNull final EditTypes<G, A, R, V> editTypes) { + this.editTypes = editTypes; + } + /** {@inheritDoc} */ public void addEditType(final int newType) { for (final MapControl<G, A, R, V> mapControl : levels) { @@ -198,7 +210,7 @@ } final MapView<G, A, R, V> mapView = newMapWithView(decoder.getGameObjects(), decoder.getMapArchObject(), viewPosition, file, file.getPath()); - mapView.getMapControl().setActiveEditType(mainControl.getEditTypes().getEditType()); + mapView.getMapControl().setActiveEditType(editTypes.getEditType()); mapView.getMapControl().resetModified(); recentManager.addRecent(currentMap.getMapModel().getMapArchObject().getMapDisplayName(), file.toString()); Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-31 22:12:44 UTC (rev 4638) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-31 22:20:56 UTC (rev 4639) @@ -387,6 +387,7 @@ final TestArchetypeSet archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, archetypeSet, false); final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, "test"); + final EditTypes editTypes = new EditTypes(mapManager); final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache = new MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(null, mapManager, null, new ImageIcon(), new ImageIcon()); final MapActions mapActions = new TestMapActions(); final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, mainControl, mapImageCache, null, mapArchObject, false, null, archetypeChooserControl, mapActions); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |