From: <aki...@us...> - 2008-08-21 17:40:29
|
Revision: 4935 http://gridarta.svn.sourceforge.net/gridarta/?rev=4935&view=rev Author: akirschbaum Date: 2008-08-21 17:40:32 +0000 (Thu, 21 Aug 2008) Log Message: ----------- Remove dependency Pickmap -> GridartaObjectsFactory. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninEditor.java trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java trunk/src/app/net/sf/gridarta/map/MapControlFactory.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -142,7 +142,7 @@ // Create the application and give it the parameters final CMainControl mainControl; try { - mainControl = new CMainControl(); + mainControl = new CMainControl(new CrossfireObjectsFactory()); } catch (final RuntimeException ex) { log.fatal(ex.getMessage(), ex); System.exit(1); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -178,10 +178,11 @@ /** * Constructs the main controller and its model and view. + * @param gridartaObjectsFactory the gridarta objects factory to use * @throws RuntimeException If the controller cannot be initialized. */ - public CMainControl() { - super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), false, CResourceLoader.getHomeFile("thumbnails"), null); + public CMainControl(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { + super(gridartaObjectsFactory, new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(gridartaObjectsFactory), false, CResourceLoader.getHomeFile("thumbnails"), null); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); Modified: trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -89,8 +89,10 @@ /** * Creates a new instance. + * @param gridartaObjectsFactory the gridarta objects factory */ - public DefaultMapControlFactory() { + public DefaultMapControlFactory(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { + super(gridartaObjectsFactory); } /** Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -238,10 +238,11 @@ /** * Constructs the main controller and its model and view. + * @param gridartaObjectsFactory the gridarta objects factory to use * @throws RuntimeException If the controller cannot be initialized. */ - public CMainControl() { - super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), true, null, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH)); + public CMainControl(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { + super(gridartaObjectsFactory, new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(gridartaObjectsFactory), true, null, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH)); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); Modified: trunk/daimonin/src/daieditor/DaimoninEditor.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninEditor.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/daimonin/src/daieditor/DaimoninEditor.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -122,7 +122,7 @@ // Create the application and give it the parameters try { - mainControl = new CMainControl(); + mainControl = new CMainControl(new DaimoninObjectsFactory()); } catch (final RuntimeException ex) { log.fatal(ex.getMessage()); System.exit(1); Modified: trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -89,8 +89,10 @@ /** * Creates a new instance. + * @param gridartaObjectsFactory the gridarta objects factory */ - public DefaultMapControlFactory() { + public DefaultMapControlFactory(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { + super(gridartaObjectsFactory); } /** Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -96,9 +96,6 @@ /** Swing FileFilter for png graphics. */ public static final FileFilter pngFileFilter = new HideFileFilterProxy(new EndingFileFilter(true, ACTION_FACTORY.getString("fileDialog.filter.png"), ".png")); - /** The gridarta objects factory. */ - protected final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; - /** The map control factory. */ protected final MapControlFactory<G, A, R, V> mapControlFactory; @@ -222,7 +219,6 @@ this.animationObjects = animationObjects; this.faceObjects = faceObjects; copyBuffer = new CopyBuffer<G, A, R, V>(this, editTypes, mapControlFactory); - this.gridartaObjectsFactory = gridartaObjectsFactory; this.rendererFactory = rendererFactory; globalSettings.readGlobalSettings(); ScriptedEventEditor.setGlobalSettings(globalSettings); @@ -234,7 +230,7 @@ mapManagerActions = new MapManagerActions<G, A, R, V>(mapManager); archetypeChooserModel = new ArchetypeChooserModel<G, A, R, V>(archetypeSet); archetypeChooserControl = new ArchetypeChooserControl<G, A, R, V>(archetypeChooserModel); - pickmapChooserControl = new PickmapChooserControl<G, A, R, V>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, globalSettings.getPickmapDir(), mapManager); + pickmapChooserControl = new PickmapChooserControl<G, A, R, V>(newMapDialogFactory, this, mapControlFactory, globalSettings.getPickmapDir(), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); archetypeTypeSet = new ArchetypeTypeSet<G, A, R>(); gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R, V>(archetypeTypeSet, archetypeSet, mapManager); Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -27,7 +27,6 @@ import java.util.Iterator; import java.util.List; import javax.swing.event.EventListenerList; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; @@ -130,15 +129,13 @@ /** * Adds a new {@link Pickmap} to this folder. * @param name the map file name - * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> - * instance for loading the pickmap map file * @param mapControlFactory the map control factory instance * @param parent the parent component for error messages * @return the newly created pickmap * @throws InvalidNameException if the pickmap name is invalid */ - public synchronized Pickmap<G, A, R, V> addPickmap(@NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final Component parent) throws InvalidNameException { - final Pickmap<G, A, R, V> pickmap = new Pickmap<G, A, R, V>(this, name, gridartaObjectsFactory, mapControlFactory, parent); + public synchronized Pickmap<G, A, R, V> addPickmap(@NotNull final String name, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final Component parent) throws InvalidNameException { + final Pickmap<G, A, R, V> pickmap = new Pickmap<G, A, R, V>(this, name, mapControlFactory, parent); pickmaps.add(pickmap); for (final FolderListener<G, A, R, V> listener : listeners.getListeners(FolderListener.class)) { listener.pickmapAdded(pickmap); Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -22,7 +22,6 @@ import java.awt.Component; import java.io.File; import java.util.Arrays; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; @@ -46,13 +45,6 @@ private final PickmapChooserModel<G, A, R, V> pickmapChooserModel; /** - * The {@link GridartaObjectsFactory} instance to use for loading pickmap - * files. - */ - @NotNull - private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; - - /** * The {@link MapControlFactory} instance to use for creating map control * instances. */ @@ -68,14 +60,12 @@ /** * Creates a new instance. * @param pickmapChooserModel the model to add the loaded pickmaps to - * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> * @param mapControlFactory the map control instance to use * @param parent the parent component for error messages * instance to use for loading pickmap files */ - public Loader(@NotNull final PickmapChooserModel<G, A, R, V> pickmapChooserModel, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final Component parent) { + public Loader(@NotNull final PickmapChooserModel<G, A, R, V> pickmapChooserModel, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final Component parent) { this.pickmapChooserModel = pickmapChooserModel; - this.gridartaObjectsFactory = gridartaObjectsFactory; this.mapControlFactory = mapControlFactory; this.parent = parent; } @@ -123,7 +113,7 @@ for (final File file : files) { if (file.isFile()) { try { - folder.addPickmap(file.getName(), gridartaObjectsFactory, mapControlFactory, this.parent); + folder.addPickmap(file.getName(), mapControlFactory, this.parent); } catch (final InvalidNameException ex) { log.warn("ignoring pickmap with invalid name: " + file); } Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -23,12 +23,10 @@ import java.io.File; import java.io.IOException; import java.util.Collection; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.io.MapReader; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapControlFactory; @@ -51,10 +49,6 @@ @NotNull private final String name; - /** The {@link GridartaObjectsFactory} instance for loading the map file. */ - @NotNull - private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; - /** * The {@link MapControlFactory} instance. */ @@ -85,20 +79,17 @@ * Creates a new instance. * @param folder the folder ths pickmap is part of * @param name the underlying map file name - * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> - * instance for loading the map file * @param mapControlFactory the map control instance * @param parent the parent component for error messages * @throws InvalidNameException if <code>name</code> is not valid */ - public Pickmap(@NotNull final Folder<G, A, R, V> folder, @NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final Component parent) throws InvalidNameException { + public Pickmap(@NotNull final Folder<G, A, R, V> folder, @NotNull final String name, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final Component parent) throws InvalidNameException { if (!isValidPickmapName(name)) { throw new InvalidNameException(name); } this.folder = folder; this.name = name; - this.gridartaObjectsFactory = gridartaObjectsFactory; this.mapControlFactory = mapControlFactory; this.parent = parent; } @@ -152,15 +143,7 @@ return; } - final File file = getFile(); - final MapReader<G, A> decoder = gridartaObjectsFactory.newMapReader(file); - try { - decoder.decodeMapFile(false); - } finally { - decoder.close(); - } - - pickmap = mapControlFactory.newPickmapControl(parent, decoder.getGameObjects(), decoder.getMapArchObject(), file); + pickmap = mapControlFactory.newPickmapControl(parent, getFile()); pickmapView = pickmap.createView(null); } Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -31,7 +31,6 @@ import javax.swing.JOptionPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.MapManagerListener; @@ -78,12 +77,6 @@ private final MapManager<G, A, R, V> mapManager; /** - * The gridarta objects factory instance. - */ - @NotNull - private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; - - /** * The map control factory instance. */ @NotNull @@ -184,15 +177,13 @@ * Create a PickmapChooserControl. * @param newMapDialogFactory the factory for creating new pickmaps * @param mainControl the main control - * @param gridartaObjectsFactory the gridarta objects factory instance * @param mapControlFactory the map control factory instance * @param pickmapDir the pickmaps directory * @param mapManager the map manager instance */ - public PickmapChooserControl(@NotNull final NewMapDialogFactory<G, A, R, V> newMapDialogFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final File pickmapDir, @NotNull final MapManager<G, A, R, V> mapManager) { + public PickmapChooserControl(@NotNull final NewMapDialogFactory<G, A, R, V> newMapDialogFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final File pickmapDir, @NotNull final MapManager<G, A, R, V> mapManager) { this.mainControl = mainControl; this.mapManager = mapManager; - this.gridartaObjectsFactory = gridartaObjectsFactory; this.mapControlFactory = mapControlFactory; pickmapChooserModel = new PickmapChooserModel<G, A, R, V>(pickmapDir); folderListActions = new FolderListActions<G, A, R, V>(pickmapChooserModel, newMapDialogFactory); @@ -228,7 +219,7 @@ * Load all pickmaps and build the pickmap-panel. */ public void loadPickmaps() { - new Loader<G, A, R, V>(pickmapChooserModel, gridartaObjectsFactory, mapControlFactory, mainControl.getMainView()).load(); + new Loader<G, A, R, V>(pickmapChooserModel, mapControlFactory, mainControl.getMainView()).load(); } /** @@ -274,7 +265,7 @@ final Pickmap<G, A, R, V> pickmap; try { - pickmap = activeFolder.addPickmap(pickmapName, gridartaObjectsFactory, mapControlFactory, mainControl.getMainView()); + pickmap = activeFolder.addPickmap(pickmapName, mapControlFactory, mainControl.getMainView()); } catch (final InvalidNameException ex) { throw new AssertionError(); // the name has been checked before } Modified: trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -19,9 +19,15 @@ package net.sf.gridarta.map; +import java.awt.Component; +import java.io.File; +import java.io.IOException; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.io.MapReader; +import org.jetbrains.annotations.NotNull; /** * Abstract base class of {@link MapControlFactory} classes. @@ -29,4 +35,31 @@ */ public abstract class AbstractMapControlFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> implements MapControlFactory<G, A, R, V> { + /** + * The gridarta objects factory. + */ + @NotNull + private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + + /** + * Creates a new instance. + * @param gridartaObjectsFactory the gridarta objects factory + */ + protected AbstractMapControlFactory(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory) { + this.gridartaObjectsFactory = gridartaObjectsFactory; + } + + /** {@inheritDoc} */ + @NotNull + public MapControl<G, A, R, V> newPickmapControl(@NotNull final Component parent, @NotNull final File file) throws IOException { + final MapReader<G, A> decoder = gridartaObjectsFactory.newMapReader(file); + try { + decoder.decodeMapFile(false); + } finally { + decoder.close(); + } + + return newPickmapControl(parent, decoder.getGameObjects(), decoder.getMapArchObject(), file); + } + } // class AbstractMapControlFactory Modified: trunk/src/app/net/sf/gridarta/map/MapControlFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -21,6 +21,7 @@ import java.awt.Component; import java.io.File; +import java.io.IOException; import java.util.List; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -57,4 +58,14 @@ @NotNull MapControl<G, A, R, V> newPickmapControl(@NotNull Component parent, @Nullable List<G> objects, @NotNull A mapArchObject, @NotNull File file); + /** + * Creates a new pickmap map control instanace by loading a file. + * @param parent the parent component for error messages + * @param file the file to load + * @return the new pickmap map control instance + * @throws IOException if the file cannot be loaded + */ + @NotNull + MapControl<G, A, R, V> newPickmapControl(@NotNull Component parent, @NotNull File file) throws IOException; + } // interface MapControlFactory Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-21 05:20:00 UTC (rev 4934) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-21 17:40:32 UTC (rev 4935) @@ -75,6 +75,7 @@ import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.io.MapArchObjectParser; import net.sf.gridarta.io.MapReader; +import net.sf.gridarta.map.AbstractMapControlFactory; import net.sf.gridarta.map.DefaultMapControl; import net.sf.gridarta.map.DefaultMapModel; import net.sf.gridarta.map.InsertionMode; @@ -394,7 +395,7 @@ @Before public void setUp() { gridartaObjectsFactory = new TestGridartaObjectsFactory(); - final MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapControlFactory = new TestMapControlFactory(); + final MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapControlFactory = new TestMapControlFactory(gridartaObjectsFactory); final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory = new TestRendererFactory(); final GlobalSettings globalSettings = new TestGlobalSettings(); final AnimationObjects<TestAnimationObject> animationObjects = new TestAnimationObjects(); @@ -1106,8 +1107,16 @@ /** * A {@link MapControlFactory} implementation for testing purposes. */ - private static class TestMapControlFactory implements MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> { + private static class TestMapControlFactory extends AbstractMapControlFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> { + /** + * Creates a new instance. + * @param gridartaObjectsFactory the gridarta objects factory + */ + protected TestMapControlFactory(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory) { + super(gridartaObjectsFactory); + } + /** {@inheritDoc} */ @NotNull public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControl(@NotNull final Component parent, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final String mapName, @Nullable final File file) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |