From: <aki...@us...> - 2008-08-15 21:40:51
|
Revision: 4869 http://gridarta.svn.sourceforge.net/gridarta/?rev=4869&view=rev Author: akirschbaum Date: 2008-08-15 21:40:56 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Remove autojoinLists field from CrossfireObjectsFactory/DaimoninObjectsFactory. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.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/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -225,7 +225,7 @@ final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeSet); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserModel); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); - pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); + pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager, autojoinLists); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); @@ -333,7 +333,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); final ArchetypeParser archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); + gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -103,11 +103,7 @@ @NotNull private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; - /** The {@link AutojoinLists} instance. */ @NotNull - private AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists = null; - - @NotNull private CFilterControl filterControl; /** The tool palette instance. */ @@ -160,7 +156,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserModel, mapActions); } @@ -177,7 +173,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @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, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @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, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { this.archetypeChooserModel = archetypeChooserModel; this.selectedSquareView = selectedSquareView; this.mainView = mainView; @@ -186,7 +182,6 @@ this.mapActions = mapActions; this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; - this.autojoinLists = autojoinLists; this.toolPalette = toolPalette; } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -283,7 +283,7 @@ final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeSet); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserModel); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); - pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); + pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager, autojoinLists); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); @@ -388,7 +388,7 @@ mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); + gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -110,10 +110,6 @@ @NotNull private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; - /** The {@link AutojoinLists} instance. */ - @NotNull - private AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists = null; - /** The tool palette instance. */ @NotNull private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; @@ -164,7 +160,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserModel, mapActions); mapArchObject.setDifficulty(1); return mapControl; @@ -183,7 +179,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @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, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @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, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { this.faceObjects = faceObjects; this.archetypeChooserModel = archetypeChooserModel; this.selectedSquareView = selectedSquareView; @@ -194,7 +190,6 @@ this.mapActions = mapActions; this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; - this.autojoinLists = autojoinLists; this.toolPalette = toolPalette; } Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -112,10 +112,11 @@ * @param objects The objects to insert into the new pickmap. * @param mapArchObject The map arch object to use for the new pickmap. * @param parent the parent component for error messages + * @param autojoinLists the autojoin lists * @return The new pickmap map control instance. */ @NotNull - MapControl<G, A, R, V> newPickmapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent); + MapControl<G, A, R, V> newPickmapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent, @NotNull AutojoinLists<G, A, R> autojoinLists); /** * Create a new level renderer instance. @@ -148,9 +149,8 @@ * @param mapActions the map actions instance * @param archetypeParser the archetype parser instance * @param archetypeSet the archetype set instance - * @param autojoinLists the autojoin lists instance * @param toolPalette the tool palette instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull MainView<G, A, R, V> mainView, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull ToolPalette<G, A, R, V> toolPalette); + void init(@NotNull FaceObjects faceObjects, @NotNull ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull MainView<G, A, R, V> mainView, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ToolPalette<G, A, R, V> toolPalette); } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -27,6 +27,7 @@ import java.util.Iterator; import java.util.List; import javax.swing.event.EventListenerList; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -132,11 +133,12 @@ * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> * instance for loading the pickmap map file * @param parent the parent component for error messages + * @param autojoinLists the autojoin lists * @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 Component parent) throws InvalidNameException { - final Pickmap<G, A, R, V> pickmap = new Pickmap<G, A, R, V>(this, name, gridartaObjectsFactory, parent); + public synchronized Pickmap<G, A, R, V> addPickmap(@NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists) throws InvalidNameException { + final Pickmap<G, A, R, V> pickmap = new Pickmap<G, A, R, V>(this, name, gridartaObjectsFactory, parent, autojoinLists); 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-15 21:29:39 UTC (rev 4868) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -22,6 +22,7 @@ import java.awt.Component; import java.io.File; import java.util.Arrays; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -58,16 +59,24 @@ private final Component parent; /** + * The autojoin lists. + */ + @NotNull + private final AutojoinLists<G, A, R> autojoinLists; + + /** * Creates a new instance. * @param pickmapChooserModel the model to add the loaded pickmaps to * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> * @param parent the parent component for error messages * instance to use for loading pickmap files + * @param autojoinLists the autojoin lists */ - public Loader(@NotNull final PickmapChooserModel<G, A, R, V> pickmapChooserModel, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent) { + public Loader(@NotNull final PickmapChooserModel<G, A, R, V> pickmapChooserModel, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists) { this.pickmapChooserModel = pickmapChooserModel; this.gridartaObjectsFactory = gridartaObjectsFactory; this.parent = parent; + this.autojoinLists = autojoinLists; } /** Loads all pickmap files from a directory and its subdirectories. */ @@ -113,7 +122,7 @@ for (final File file : files) { if (file.isFile()) { try { - folder.addPickmap(file.getName(), gridartaObjectsFactory, this.parent); + folder.addPickmap(file.getName(), gridartaObjectsFactory, this.parent, autojoinLists); } 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-15 21:29:39 UTC (rev 4868) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -23,6 +23,7 @@ import java.io.File; import java.io.IOException; import java.util.Collection; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -61,6 +62,12 @@ private final Component parent; /** + * The autojoin lists. + */ + @NotNull + private final AutojoinLists<G, A, R> autojoinLists; + + /** * The {@link MapControl} instance representing the map file, or * <code>null</code> if the map file is not loaded. */ @@ -81,9 +88,11 @@ * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> * instance for loading the map file * @param parent the parent component for error messages + * @param autojoinLists the autojoin lists * @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 Component parent) throws InvalidNameException { + public Pickmap(@NotNull final Folder<G, A, R, V> folder, @NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists) throws InvalidNameException { + this.autojoinLists = autojoinLists; if (!isValidPickmapName(name)) { throw new InvalidNameException(name); } @@ -151,7 +160,7 @@ decoder.close(); } - pickmap = gridartaObjectsFactory.newPickmapControl(decoder.getGameObjects(), decoder.getMapArchObject(), parent); + pickmap = gridartaObjectsFactory.newPickmapControl(decoder.getGameObjects(), decoder.getMapArchObject(), parent, autojoinLists); pickmap.setMapFile(file); pickmap.setMapFileName(file.getPath()); pickmap.resetModified(); Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -31,6 +31,7 @@ import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; @@ -76,6 +77,12 @@ private final MapManager<G, A, R, V> mapManager; /** + * The autojoin lists. + */ + @NotNull + private final AutojoinLists<G, A, R> autojoinLists; + + /** * The gridarta objects factory instance. */ @NotNull @@ -179,10 +186,12 @@ * @param gridartaObjectsFactory the gridarta objects factory instance * @param pickmapDir the pickmaps directory * @param mapManager the map manager instance + * @param autojoinLists the autojoin lists */ - 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 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 GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final File pickmapDir, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final AutojoinLists<G, A, R> autojoinLists) { this.mainControl = mainControl; this.mapManager = mapManager; + this.autojoinLists = autojoinLists; this.gridartaObjectsFactory = gridartaObjectsFactory; pickmapChooserModel = new PickmapChooserModel<G, A, R, V>(pickmapDir); folderListActions = new FolderListActions<G, A, R, V>(pickmapChooserModel, newMapDialogFactory); @@ -218,7 +227,7 @@ * Load all pickmaps and build the pickmap-panel. */ public void loadPickmaps() { - new Loader<G, A, R, V>(pickmapChooserModel, gridartaObjectsFactory, mainControl.getMainView()).load(); + new Loader<G, A, R, V>(pickmapChooserModel, gridartaObjectsFactory, mainControl.getMainView(), autojoinLists).load(); } /** @@ -259,7 +268,7 @@ } } - final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newPickmapControl(null, mapArchObject, mainControl.getMainView()); + final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newPickmapControl(null, mapArchObject, mainControl.getMainView(), autojoinLists); mapControl.setMapFile(mapFile); mapControl.setMapFileName(mapFile.getPath()); mapControl.resetModified(); @@ -267,7 +276,7 @@ final Pickmap<G, A, R, V> pickmap; try { - pickmap = activeFolder.addPickmap(pickmapName, gridartaObjectsFactory, mainControl.getMainView()); + pickmap = activeFolder.addPickmap(pickmapName, gridartaObjectsFactory, mainControl.getMainView(), autojoinLists); } catch (final InvalidNameException ex) { throw new AssertionError(); // the name has been checked before } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -851,7 +851,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent) { + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists) { throw new AssertionError(); } @@ -868,7 +868,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainView, @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, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainView, @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, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette) { throw new AssertionError(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |