From: <aki...@us...> - 2008-08-20 19:50:20
|
Revision: 4916 http://gridarta.svn.sourceforge.net/gridarta/?rev=4916&view=rev Author: akirschbaum Date: 2008-08-20 19:50:17 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Extract MapControlFactory from GridartaObjectsFactory. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/CopyBuffer.java trunk/src/app/net/sf/gridarta/DefaultMapManager.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/app/net/sf/gridarta/map/MapControlFactory.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-20 19:11:09 UTC (rev 4915) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -32,6 +32,7 @@ import cfeditor.gui.map.DefaultRendererFactory; import cfeditor.gui.prefs.GUIPrefs; import cfeditor.gui.prefs.ResPrefs; +import cfeditor.map.DefaultMapControlFactory; import cfeditor.map.MapArchObject; import cfeditor.script.ScriptController; import cfeditor.script.ScriptExecException; @@ -211,12 +212,12 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); + super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); 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); - 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, mapControlFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); 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); @@ -326,7 +327,8 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); final ArchetypeParser archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(rendererFactory, faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette, autojoinLists, exitMatcher); + gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette, autojoinLists, exitMatcher); + ((DefaultMapControlFactory) mapControlFactory).init(gridartaObjectsFactory, rendererFactory, mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitMatcher); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-20 19:11:09 UTC (rev 4915) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -25,13 +25,10 @@ import cfeditor.gui.map.CMapViewBasic; import cfeditor.io.GameObjectParser; import cfeditor.io.MapArchObjectParser; -import cfeditor.map.DefaultMapControlFactory; import cfeditor.map.MapArchObject; -import java.awt.Component; import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; -import java.util.List; import java.util.prefs.Preferences; import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.AutojoinLists; @@ -47,13 +44,11 @@ import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.map.RendererFactory; import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; import net.sf.gridarta.map.MapControl; -import net.sf.gridarta.map.MapControlFactory; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -101,10 +96,6 @@ @NotNull private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; - /** The map control factory instance. */ - @NotNull - private MapControlFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControlFactory = null; - /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -145,24 +136,12 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final String mapName, @Nullable final File file) { - return mapControlFactory.newMapControl(this, parent, objects, mapArchObject, mapName, file); - } - - /** {@inheritDoc} */ - @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final File file) { - return mapControlFactory.newPickmapControl(this, parent, objects, mapArchObject, file); - } - - /** {@inheritDoc} */ - @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic(filterControl, editTypes, mapControl, viewPosition, toolPalette, 32, 32, selectedSquareView), ACTION_FACTORY, mapImageCache); } /** {@inheritDoc} */ - public void init(@NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @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, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { + 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, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { this.selectedSquareView = selectedSquareView; this.mainView = mainView; this.editTypes = editTypes; @@ -170,7 +149,6 @@ this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; this.toolPalette = toolPalette; - mapControlFactory = new DefaultMapControlFactory(rendererFactory, mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitTypeGameObjectMatcher); } public void setFilterControl(@NotNull final CFilterControl filterControl) { Modified: trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-08-20 19:11:09 UTC (rev 4915) +++ trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -46,43 +46,56 @@ public class DefaultMapControlFactory extends AbstractMapControlFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { /** + * The {@link GridartaObjectsFactory} instance to use. + */ + @NotNull + private GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory; + + /** * The {@link RendererFactory} instance to use. */ @NotNull - private final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory; + private RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory; /** * The {@link MapActions} instance to use. */ @NotNull - private final MapActions mapActions; + private MapActions mapActions; /** * The {@link ArchetypeChooserModel} instance to use. */ @NotNull - private final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel; + private ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel; /** * The {@link MapImageCache} instance to use. */ @NotNull - private final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache; + private MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache; /** * The {@link AutojoinLists} instacne to use. */ @NotNull - private final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists; + private AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists; /** * The matcher for exit objects. */ @NotNull - private final GameObjectMatcher exitTypeGameObjectMatcher; + private GameObjectMatcher exitTypeGameObjectMatcher; /** * Creates a new instance. + */ + public DefaultMapControlFactory() { + } + + /** + * Initializes the instance. + * @param gridartaObjectsFactory the gridarta objects factory to use * @param rendererFactory the renderer factory to use * @param mapActions the map actions to use * @param archetypeChooserModel the archetype chooser model to use @@ -90,7 +103,8 @@ * @param autojoinLists the autojoin lists to use * @param exitTypeGameObjectMatcher the matcher for exit objects */ - public DefaultMapControlFactory(@NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final MapActions mapActions, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { + public void init(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final MapActions mapActions, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { + this.gridartaObjectsFactory = gridartaObjectsFactory; this.rendererFactory = rendererFactory; this.mapActions = mapActions; this.archetypeChooserModel = archetypeChooserModel; @@ -101,7 +115,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final String mapName, @Nullable final File file) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final String mapName, @Nullable final File file) { final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, rendererFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); mapControl.setMapFile(file); mapControl.setMapFileName(mapName); @@ -110,7 +124,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final File file) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final File file) { final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, rendererFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); mapControl.setMapFile(file); mapControl.setMapFileName(file.getPath()); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 19:11:09 UTC (rev 4915) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -34,6 +34,7 @@ import daieditor.gui.prefs.GUIPrefs; import daieditor.gui.prefs.NetPrefs; import daieditor.gui.prefs.ResPrefs; +import daieditor.map.DefaultMapControlFactory; import daieditor.map.MapArchObject; import daieditor.map.validation.checks.ExitChecker; import daieditor.map.validation.checks.SlayingChecker; @@ -265,12 +266,12 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); + super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); 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); - 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, mapControlFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); 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); @@ -378,7 +379,8 @@ mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, pickmapChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(rendererFactory, faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette, autojoinLists, exitMatcher); + ((DefaultMapControlFactory) mapControlFactory).init(gridartaObjectsFactory, rendererFactory, mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitMatcher); + gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette, autojoinLists, exitMatcher); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-20 19:11:09 UTC (rev 4915) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -25,13 +25,10 @@ import daieditor.gui.map.CMapViewBasic; import daieditor.io.GameObjectParser; import daieditor.io.MapArchObjectParser; -import daieditor.map.DefaultMapControlFactory; import daieditor.map.MapArchObject; -import java.awt.Component; import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; -import java.util.List; import java.util.prefs.Preferences; import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.AutojoinLists; @@ -47,13 +44,11 @@ import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.map.RendererFactory; import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; import net.sf.gridarta.map.MapControl; -import net.sf.gridarta.map.MapControlFactory; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -105,10 +100,6 @@ @NotNull private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; - /** The map control factory instance. */ - @NotNull - private MapControlFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControlFactory = null; - /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -149,24 +140,12 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final String mapName, @Nullable final File file) { - return mapControlFactory.newMapControl(this, parent, objects, mapArchObject, mapName, file); - } - - /** {@inheritDoc} */ - @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final File file) { - return mapControlFactory.newPickmapControl(this, parent, objects, mapArchObject, file); - } - - /** {@inheritDoc} */ - @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, editTypes, mapControl, viewPosition, faceObjects, toolPalette, IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY, mapImageCache); } /** {@inheritDoc} */ - public void init(@NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @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, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { + 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, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { this.faceObjects = faceObjects; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; @@ -176,7 +155,6 @@ this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; this.toolPalette = toolPalette; - mapControlFactory = new DefaultMapControlFactory(rendererFactory, mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitTypeGameObjectMatcher); } } // class DaimoninObjectsFactory Modified: trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-20 19:11:09 UTC (rev 4915) +++ trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -46,43 +46,56 @@ public class DefaultMapControlFactory extends AbstractMapControlFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { /** + * The {@link GridartaObjectsFactory} instance to use. + */ + @NotNull + private GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory; + + /** * The {@link RendererFactory} instance to use. */ @NotNull - private final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory; + private RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory; /** * The {@link MapActions} instance to use. */ @NotNull - private final MapActions mapActions; + private MapActions mapActions; /** * The {@link ArchetypeChooserModel} instance to use. */ @NotNull - private final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel; + private ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel; /** * The {@link MapImageCache} instance to use. */ @NotNull - private final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache; + private MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache; /** * The {@link AutojoinLists} instacne to use. */ @NotNull - private final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists; + private AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists; /** * The matcher for exit objects. */ @NotNull - private final GameObjectMatcher exitTypeGameObjectMatcher; + private GameObjectMatcher exitTypeGameObjectMatcher; /** * Creates a new instance. + */ + public DefaultMapControlFactory() { + } + + /** + * Creates a new instance. + * @param gridartaObjectsFactory the gridarta objects factory to use * @param rendererFactory the renderer factory to use * @param mapActions the map actions to use * @param archetypeChooserModel the archetype chooser model to use @@ -90,7 +103,8 @@ * @param autojoinLists the autojoin lists to use * @param exitTypeGameObjectMatcher the matcher for exit objects */ - public DefaultMapControlFactory(@NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final MapActions mapActions, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { + public void init(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final MapActions mapActions, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { + this.gridartaObjectsFactory = gridartaObjectsFactory; this.rendererFactory = rendererFactory; this.mapActions = mapActions; this.archetypeChooserModel = archetypeChooserModel; @@ -101,7 +115,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final String mapName, @Nullable final File file) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final String mapName, @Nullable final File file) { final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, rendererFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); mapControl.setMapFile(file); mapControl.setMapFileName(mapName); @@ -110,7 +124,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final File file) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final File file) { mapArchObject.setDifficulty(1); final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, rendererFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); mapControl.setMapFile(file); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 19:11:09 UTC (rev 4915) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -47,6 +47,7 @@ import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.map.MapControlFactory; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.gridarta.updater.UpdaterManager; import net.sf.japi.swing.ActionFactory; @@ -82,6 +83,9 @@ /** The gridarta objects factory. */ protected final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + /** The map control factory. */ + protected final MapControlFactory<G, A, R, V> mapControlFactory; + /** The renderer factory. */ protected final RendererFactory<G, A, R> rendererFactory; @@ -145,16 +149,18 @@ * @param globalSettings the global settings instance * @param animationObjects the animation objects instance * @param faceObjects the face objects instance + * @param mapControlFactory the map control instance */ - protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { + protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory) { this.globalSettings = globalSettings; - final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, globalSettings); + this.mapControlFactory = mapControlFactory; + final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, mapControlFactory, globalSettings); 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); + copyBuffer = new CopyBuffer<G, A, R, V>(this, editTypes, mapControlFactory); this.gridartaObjectsFactory = gridartaObjectsFactory; this.rendererFactory = rendererFactory; globalSettings.readGlobalSettings(); Modified: trunk/src/app/net/sf/gridarta/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-08-20 19:11:09 UTC (rev 4915) +++ trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -30,6 +30,7 @@ import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.map.MapControlFactory; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.MapModelListener; import net.sf.gridarta.map.MapSquare; @@ -71,7 +72,7 @@ * The gridarta objects factory instance. */ @NotNull - private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + private final MapControlFactory<G, A, R, V> mapControlFactory; /** Internal map control to store the cut / copied arches. */ private MapControl<G, A, R, V> copyMapCtrl = null; @@ -80,12 +81,12 @@ * Create the copy buffer. * @param mainControl main control * @param editTypes the edit types instance - * @param gridartaObjectsFactory the gridarta objects factory instance + * @param mapControlFactory the gridarta objects factory instance */ - public CopyBuffer(final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory) { + public CopyBuffer(final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory) { this.mainControl = mainControl; // link main control in this.editTypes = editTypes; - this.gridartaObjectsFactory = gridartaObjectsFactory; + this.mapControlFactory = mapControlFactory; } /** @@ -95,7 +96,7 @@ public void init(final A mapArch) { assert copyMapCtrl == null; mapArch.setMapName("cb"); - copyMapCtrl = gridartaObjectsFactory.newMapControl(null, mapArch, mainControl.getMainView(), "cb", null); + copyMapCtrl = mapControlFactory.newMapControl(mainControl.getMainView(), null, mapArch, "cb", null); } /** Modified: trunk/src/app/net/sf/gridarta/DefaultMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-08-20 19:11:09 UTC (rev 4915) +++ trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -36,6 +36,7 @@ import net.sf.gridarta.io.MapReader; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.map.MapControlFactory; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -69,6 +70,12 @@ @NotNull private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + /** + * The map control factory instance. + */ + @NotNull + private final MapControlFactory<G, A, R, V> mapControlFactory; + /** The edit types. */ @NotNull private EditTypes<G, A, R, V> editTypes = null; @@ -90,13 +97,15 @@ * @param mainControl the main control * @param key The action factory key. * @param gridartaObjectsFactory the gridarta objects factory instance + * @param mapControlFactory the map control factory instance * @param globalSettings the global settings instance */ - public DefaultMapManager(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final String key, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings) { + public DefaultMapManager(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final String key, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final GlobalSettings globalSettings) { this.globalSettings = globalSettings; actionFactory = ActionFactory.getFactory(key); this.mainControl = mainControl; this.gridartaObjectsFactory = gridartaObjectsFactory; + this.mapControlFactory = mapControlFactory; } /** @@ -122,7 +131,7 @@ } private MapControl<G, A, R, V> newMap(@Nullable final List<G> objects, @NotNull final A mapArchObject, @Nullable final File file, @NotNull final String mapFileName) { - final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newMapControl(objects, mapArchObject, mainControl.getMainView(), mapFileName, file); + final MapControl<G, A, R, V> mapControl = mapControlFactory.newMapControl(mainControl.getMainView(), objects, mapArchObject, mapFileName, file); levels.add(mapControl); fireMapCreatedEvent(mapControl); setCurrentLevel(mapControl); @@ -258,7 +267,7 @@ return null; } - return gridartaObjectsFactory.newMapControl(decoder.getGameObjects(), decoder.getMapArchObject(), mainControl.getMainView(), file.getPath(), file); + return mapControlFactory.newMapControl(mainControl.getMainView(), decoder.getGameObjects(), decoder.getMapArchObject(), file.getPath(), file); } /** Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-20 19:11:09 UTC (rev 4915) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -19,11 +19,9 @@ package net.sf.gridarta; -import java.awt.Component; import java.awt.Point; import java.io.File; 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; @@ -34,7 +32,6 @@ import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.gui.map.RendererFactory; import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.GameObjectParser; @@ -97,29 +94,6 @@ GameObjectParser<G, A, R> newGameObjectParser(); /** - * Create a new map control instance. - * @param objects The objects to insert into the new map. - * @param mapArchObject The map arch object to use for the new map. - * @param parent the parent component for error messages - * @param mapName the map name - * @param file the associated file - * @return The new map control instance. - */ - @NotNull - MapControl<G, A, R, V> newMapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent, @NotNull String mapName, @Nullable File file); - - /** - * Create a new pickmap map control instance. - * @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 file the associated file - * @return The new pickmap map control instance. - */ - @NotNull - MapControl<G, A, R, V> newPickmapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent, @NotNull File file); - - /** * Creates a new map view instance for a map control. * @param mapControl the map control * @param viewPosition the initiali view position; may be <code>null</code> @@ -132,7 +106,6 @@ /** * Initializes the instance. - * @param rendererFactory the level renderer instance * @param faceObjects the FaceObjects instance * @param archetypeChooserModel the archetype chooser model instance * @param selectedSquareView the selected square view instance @@ -147,6 +120,6 @@ * @param autojoinLists the autojoin lists instance * @param exitTypeGameObjectMatcher the matcher for exit objects */ - void init(@NotNull RendererFactory<G, A, R> rendererFactory, @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, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher); + 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, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher); } // 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-20 19:11:09 UTC (rev 4915) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -33,6 +33,7 @@ import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.map.MapControlFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -131,12 +132,13 @@ * @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 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 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); 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-20 19:11:09 UTC (rev 4915) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -27,6 +27,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.MapControlFactory; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -52,6 +53,13 @@ private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; /** + * The {@link MapControlFactory} instance to use for creating map control + * instances. + */ + @NotNull + private final MapControlFactory<G, A, R, V> mapControlFactory; + + /** * The parent component for error messages. */ @NotNull @@ -61,12 +69,14 @@ * 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 Component parent) { + 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) { this.pickmapChooserModel = pickmapChooserModel; this.gridartaObjectsFactory = gridartaObjectsFactory; + this.mapControlFactory = mapControlFactory; this.parent = parent; } @@ -113,7 +123,7 @@ for (final File file : files) { if (file.isFile()) { try { - folder.addPickmap(file.getName(), gridartaObjectsFactory, this.parent); + folder.addPickmap(file.getName(), gridartaObjectsFactory, 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-20 19:11:09 UTC (rev 4915) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -31,6 +31,7 @@ import net.sf.gridarta.io.MapReader; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.map.MapControlFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -55,6 +56,12 @@ private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; /** + * The {@link MapControlFactory} instance. + */ + @NotNull + private final MapControlFactory<G, A, R, V> mapControlFactory; + + /** * The parent component for error messages. */ @NotNull @@ -80,10 +87,11 @@ * @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 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 MapControlFactory<G, A, R, V> mapControlFactory, @NotNull final Component parent) throws InvalidNameException { if (!isValidPickmapName(name)) { throw new InvalidNameException(name); } @@ -91,6 +99,7 @@ this.folder = folder; this.name = name; this.gridartaObjectsFactory = gridartaObjectsFactory; + this.mapControlFactory = mapControlFactory; this.parent = parent; } @@ -151,7 +160,7 @@ decoder.close(); } - pickmap = gridartaObjectsFactory.newPickmapControl(decoder.getGameObjects(), decoder.getMapArchObject(), parent, file); + pickmap = mapControlFactory.newPickmapControl(parent, decoder.getGameObjects(), decoder.getMapArchObject(), file); 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-20 19:11:09 UTC (rev 4915) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -44,6 +44,7 @@ import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.map.MapControlFactory; import net.sf.gridarta.map.MapControlListener; import net.sf.gridarta.map.MapModel; import net.sf.japi.swing.ActionFactory; @@ -82,6 +83,12 @@ @NotNull private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + /** + * The map control factory instance. + */ + @NotNull + private final MapControlFactory<G, A, R, V> mapControlFactory; + /** The view for this control. */ @NotNull private final PickmapChooserView<G, A, R, V> view; @@ -178,13 +185,15 @@ * @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 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 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); currentPickmapActions = new CurrentPickmapActions<G, A, R, V>(newMapDialogFactory, this); @@ -219,7 +228,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, mapControlFactory, mainControl.getMainView()).load(); } /** @@ -260,12 +269,12 @@ } } - final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newPickmapControl(null, mapArchObject, mainControl.getMainView(), mapFile); + final MapControl<G, A, R, V> mapControl = mapControlFactory.newPickmapControl(mainControl.getMainView(), null, mapArchObject, mapFile); mapControl.save(); final Pickmap<G, A, R, V> pickmap; try { - pickmap = activeFolder.addPickmap(pickmapName, gridartaObjectsFactory, mainControl.getMainView()); + pickmap = activeFolder.addPickmap(pickmapName, gridartaObjectsFactory, mapControlFactory, mainControl.getMainView()); } catch (final InvalidNameException ex) { throw new AssertionError(); // the name has been checked before } Modified: trunk/src/app/net/sf/gridarta/map/MapControlFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-08-20 19:11:09 UTC (rev 4915) +++ trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -22,7 +22,6 @@ import java.awt.Component; import java.io.File; import java.util.List; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; @@ -37,7 +36,6 @@ /** * Create a new map control instance. - * @param gridartaObjectsFactory the gridarta objects factory * @param parent the parent component for error messages * @param objects the objects to insert into the new map * @param mapArchObject the map arch object to use for the new map @@ -46,11 +44,10 @@ * @return the new map control instance */ @NotNull - MapControl<G, A, R, V> newMapControl(@NotNull GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull Component parent, @Nullable List<G> objects, @NotNull A mapArchObject, @NotNull String mapName, @Nullable File file); + MapControl<G, A, R, V> newMapControl(@NotNull Component parent, @Nullable List<G> objects, @NotNull A mapArchObject, @NotNull String mapName, @Nullable File file); /** * Create a new pickmap map control instance. - * @param gridartaObjectsFactory the gridarta objects factory * @param parent the parent component for error messages * @param objects the objects to insert into the new pickmap * @param mapArchObject the map arch object to use for the new pickmap @@ -58,6 +55,6 @@ * @return the new pickmap map control instance */ @NotNull - MapControl<G, A, R, V> newPickmapControl(@NotNull GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull Component parent, @Nullable List<G> objects, @NotNull A mapArchObject, @NotNull File file); + MapControl<G, A, R, V> newPickmapControl(@NotNull Component parent, @Nullable List<G> objects, @NotNull A mapArchObject, @NotNull File file); } // interface MapControlFactory Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 19:11:09 UTC (rev 4915) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 19:50:17 UTC (rev 4916) @@ -81,6 +81,7 @@ import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapArchObjectListener; import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.map.MapControlFactory; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.MapModelEvent; import net.sf.gridarta.map.MapModelListener; @@ -393,16 +394,17 @@ @Before public void setUp() { gridartaObjectsFactory = new TestGridartaObjectsFactory(); + final MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapControlFactory = new TestMapControlFactory(); ... [truncated message content] |
From: <aki...@us...> - 2008-08-20 19:55:44
|
Revision: 4917 http://gridarta.svn.sourceforge.net/gridarta/?rev=4917&view=rev Author: akirschbaum Date: 2008-08-20 19:55:50 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 19:50:17 UTC (rev 4916) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 19:55:50 UTC (rev 4917) @@ -48,7 +48,6 @@ import java.util.List; import java.util.Map; import java.util.MissingResourceException; -import java.util.prefs.Preferences; import javax.swing.JMenu; import javax.swing.SwingUtilities; import javax.swing.filechooser.FileFilter; @@ -59,7 +58,6 @@ import net.sf.gridarta.FileControl; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.XmlHelper; import net.sf.gridarta.archtype.ArchetypeAttributeParser; @@ -153,9 +151,6 @@ /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(CMainControl.class); - /** Preferences. */ - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - /** Preferences key for using System.exit(). */ public static final String PREFS_SYSTEM_EXIT = "systemExit"; @@ -213,7 +208,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); 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); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 19:50:17 UTC (rev 4916) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 19:55:50 UTC (rev 4917) @@ -51,7 +51,6 @@ import java.util.List; import java.util.Map; import java.util.MissingResourceException; -import java.util.prefs.Preferences; import javax.swing.JMenu; import javax.swing.JOptionPane; import javax.swing.SwingUtilities; @@ -63,7 +62,6 @@ import net.sf.gridarta.FileControl; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.XmlHelper; import net.sf.gridarta.archtype.ArchetypeAttributeParser; @@ -174,9 +172,6 @@ /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(CMainControl.class); - /** Preferences. */ - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - /** Preferences key for using System.exit(). */ public static final String PREFS_SYSTEM_EXIT = "systemExit"; @@ -267,7 +262,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); 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); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 19:50:17 UTC (rev 4916) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 19:55:50 UTC (rev 4917) @@ -23,6 +23,7 @@ import java.io.IOException; import java.util.MissingResourceException; import java.util.ResourceBundle; +import java.util.prefs.Preferences; import javax.swing.ImageIcon; import javax.swing.JFileChooser; import javax.swing.JOptionPane; @@ -36,6 +37,7 @@ import net.sf.gridarta.gameobject.scripts.ScriptedEvent; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.HideFileFilterProxy; +import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapPreview; import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.map.MapPreviewAccessory; @@ -74,6 +76,9 @@ /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(AbstractMainControl.class); + /** Preferences. */ + protected static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); @@ -141,6 +146,8 @@ @NotNull protected final NewMapDialogFactory<G, A, R, V> newMapDialogFactory; + protected final boolean mapTileListBottom; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -169,6 +176,7 @@ ScriptedEvent.init(archetypeSet); PathManager.setGlobalSettings(globalSettings); newMapDialogFactory = newNewMapDialogFactory(mapManager, gridartaObjectsFactory); + mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 19:57:31
|
Revision: 4918 http://gridarta.svn.sourceforge.net/gridarta/?rev=4918&view=rev Author: akirschbaum Date: 2008-08-20 19:57:38 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 19:55:50 UTC (rev 4917) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 19:57:38 UTC (rev 4918) @@ -75,7 +75,6 @@ import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; -import net.sf.gridarta.gui.MapManagerActions; import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.RecentManager; import net.sf.gridarta.gui.ReplaceDialogManager; @@ -208,7 +207,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); 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); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 19:55:50 UTC (rev 4917) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 19:57:38 UTC (rev 4918) @@ -82,7 +82,6 @@ import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; -import net.sf.gridarta.gui.MapManagerActions; import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.RecentManager; import net.sf.gridarta.gui.ReplaceDialogManager; @@ -262,7 +261,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); 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); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 19:55:50 UTC (rev 4917) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 19:57:38 UTC (rev 4918) @@ -38,6 +38,7 @@ import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.gui.MapManagerActions; import net.sf.gridarta.gui.MapPreview; import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.map.MapPreviewAccessory; @@ -148,6 +149,8 @@ protected final boolean mapTileListBottom; + protected final MapManagerActions<G, A, R, V> mapManagerActions; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -177,6 +180,7 @@ PathManager.setGlobalSettings(globalSettings); newMapDialogFactory = newNewMapDialogFactory(mapManager, gridartaObjectsFactory); mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); + mapManagerActions = new MapManagerActions<G, A, R, V>(mapManager); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 19:59:12
|
Revision: 4919 http://gridarta.svn.sourceforge.net/gridarta/?rev=4919&view=rev Author: akirschbaum Date: 2008-08-20 19:59:20 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 19:57:38 UTC (rev 4918) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 19:59:20 UTC (rev 4919) @@ -81,7 +81,6 @@ import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; -import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; @@ -207,7 +206,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - 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); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 19:57:38 UTC (rev 4918) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 19:59:20 UTC (rev 4919) @@ -88,7 +88,6 @@ import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; -import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; @@ -261,7 +260,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - 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); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 19:57:38 UTC (rev 4918) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 19:59:20 UTC (rev 4919) @@ -41,6 +41,7 @@ import net.sf.gridarta.gui.MapManagerActions; import net.sf.gridarta.gui.MapPreview; import net.sf.gridarta.gui.StatusBar; +import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; @@ -151,6 +152,8 @@ protected final MapManagerActions<G, A, R, V> mapManagerActions; + protected final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -181,6 +184,7 @@ newMapDialogFactory = newNewMapDialogFactory(mapManager, gridartaObjectsFactory); mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); mapManagerActions = new MapManagerActions<G, A, R, V>(mapManager); + archetypeChooserModel = new ArchetypeChooserModel<G, A, R, V>(archetypeSet); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:00:58
|
Revision: 4920 http://gridarta.svn.sourceforge.net/gridarta/?rev=4920&view=rev Author: akirschbaum Date: 2008-08-20 20:01:05 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 19:59:20 UTC (rev 4919) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:01:05 UTC (rev 4920) @@ -80,7 +80,6 @@ import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; -import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; @@ -206,7 +205,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserModel); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 19:59:20 UTC (rev 4919) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:01:05 UTC (rev 4920) @@ -87,7 +87,6 @@ import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; -import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; @@ -260,7 +259,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserModel); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 19:59:20 UTC (rev 4919) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:01:05 UTC (rev 4920) @@ -41,6 +41,7 @@ import net.sf.gridarta.gui.MapManagerActions; import net.sf.gridarta.gui.MapPreview; import net.sf.gridarta.gui.StatusBar; +import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.gridarta.gui.map.MapView; @@ -154,6 +155,8 @@ protected final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel; + protected final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -185,6 +188,7 @@ mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); mapManagerActions = new MapManagerActions<G, A, R, V>(mapManager); archetypeChooserModel = new ArchetypeChooserModel<G, A, R, V>(archetypeSet); + archetypeChooserControl = new ArchetypeChooserControl<G, A, R, V>(archetypeChooserModel); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:07:07
|
Revision: 4921 http://gridarta.svn.sourceforge.net/gridarta/?rev=4921&view=rev Author: akirschbaum Date: 2008-08-20 20:07:13 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Unify code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/GlobalSettingsImpl.java trunk/src/app/net/sf/gridarta/GlobalSettings.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-20 20:01:05 UTC (rev 4920) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:07:13 UTC (rev 4921) @@ -205,7 +205,7 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); + pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, globalSettings.getPickmapDir(), mapManager); 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); Modified: trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java =================================================================== --- trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java 2008-08-20 20:01:05 UTC (rev 4920) +++ trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java 2008-08-20 20:07:13 UTC (rev 4921) @@ -24,6 +24,7 @@ import net.sf.gridarta.MainControl; import org.apache.log4j.Logger; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.NotNull; /** * Maintains path names to resources. @@ -62,6 +63,12 @@ } /** {@inheritDoc} */ + @NotNull + public File getPickmapDir() { + return new File(getMapDir(), IGUIConstants.PICKMAP_DIR); + } + + /** {@inheritDoc} */ public void readGlobalSettings() { imageSet = prefs.get(USE_IMAGESET, "base"); if (imageSet.equalsIgnoreCase("none")) { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:01:05 UTC (rev 4920) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:07:13 UTC (rev 4921) @@ -259,7 +259,7 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); + pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, globalSettings.getPickmapDir(), mapManager); 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); Modified: trunk/daimonin/src/daieditor/GlobalSettingsImpl.java =================================================================== --- trunk/daimonin/src/daieditor/GlobalSettingsImpl.java 2008-08-20 20:01:05 UTC (rev 4920) +++ trunk/daimonin/src/daieditor/GlobalSettingsImpl.java 2008-08-20 20:07:13 UTC (rev 4921) @@ -23,6 +23,7 @@ import java.util.prefs.Preferences; import net.sf.gridarta.MainControl; import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; /** * Maintains path names to resources. @@ -58,6 +59,12 @@ } /** {@inheritDoc} */ + @NotNull + public File getPickmapDir() { + return new File(getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR); + } + + /** {@inheritDoc} */ public void readGlobalSettings() { initDirs(); Modified: trunk/src/app/net/sf/gridarta/GlobalSettings.java =================================================================== --- trunk/src/app/net/sf/gridarta/GlobalSettings.java 2008-08-20 20:01:05 UTC (rev 4920) +++ trunk/src/app/net/sf/gridarta/GlobalSettings.java 2008-08-20 20:07:13 UTC (rev 4921) @@ -78,4 +78,11 @@ /** {@inheritDoc} */ void setCurrentDir(File currentDir); + /** + * Returns the pickmap directory. + * @return the pickmap directory + */ + @NotNull + File getPickmapDir(); + } // interface GlobalSettings Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 20:01:05 UTC (rev 4920) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 20:07:13 UTC (rev 4921) @@ -961,6 +961,12 @@ throw new AssertionError(); } + /** {@inheritDoc} */ + @NotNull + public File getPickmapDir() { + throw new AssertionError(); + } + } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:10:18
|
Revision: 4922 http://gridarta.svn.sourceforge.net/gridarta/?rev=4922&view=rev Author: akirschbaum Date: 2008-08-20 20:10:25 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:07:13 UTC (rev 4921) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:10:25 UTC (rev 4922) @@ -91,7 +91,6 @@ import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.objectchooser.ObjectChooser; -import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.prefs.MapValidatorPrefs; import net.sf.gridarta.gui.prefs.MiscPrefs; import net.sf.gridarta.gui.prefs.UpdatePrefs; @@ -157,9 +156,6 @@ /** The object chooser. */ private final DefaultObjectChooser<GameObject, MapArchObject, Archetype> objectChooser; - /** The pickmap chooser control. */ - private final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl; - /** The main view. */ private final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView; @@ -205,7 +201,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, globalSettings.getPickmapDir(), mapManager); 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); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:07:13 UTC (rev 4921) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:10:25 UTC (rev 4922) @@ -98,7 +98,6 @@ import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.objectchooser.ObjectChooser; -import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.prefs.MapValidatorPrefs; import net.sf.gridarta.gui.prefs.MiscPrefs; import net.sf.gridarta.gui.prefs.UpdatePrefs; @@ -196,9 +195,6 @@ /** The object chooser. */ private final DefaultObjectChooser<GameObject, MapArchObject, Archetype> objectChooser; - /** The pickmap chooser control. */ - private final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl; - /** The main view. */ private final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView; @@ -259,7 +255,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, globalSettings.getPickmapDir(), mapManager); 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); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:07:13 UTC (rev 4921) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:10:25 UTC (rev 4922) @@ -48,6 +48,7 @@ import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.RendererFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; +import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.help.Help; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.MapArchObject; @@ -157,6 +158,10 @@ protected final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl; + /** The pickmap chooser control. */ + @NotNull + protected final PickmapChooserControl<G, A, R, V> pickmapChooserControl; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -189,6 +194,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); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:11:54
|
Revision: 4923 http://gridarta.svn.sourceforge.net/gridarta/?rev=4923&view=rev Author: akirschbaum Date: 2008-08-20 20:12:00 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:10:25 UTC (rev 4922) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:12:00 UTC (rev 4923) @@ -201,7 +201,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - 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); archetypeChooserControl.init(false, gameObjectAttributesDialogFactory); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:10:25 UTC (rev 4922) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:12:00 UTC (rev 4923) @@ -255,7 +255,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - 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); archetypeChooserControl.init(true, gameObjectAttributesDialogFactory); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:10:25 UTC (rev 4922) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:12:00 UTC (rev 4923) @@ -195,6 +195,7 @@ 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); + newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:13:53
|
Revision: 4924 http://gridarta.svn.sourceforge.net/gridarta/?rev=4924&view=rev Author: akirschbaum Date: 2008-08-20 20:14:00 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:12:00 UTC (rev 4923) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:14:00 UTC (rev 4924) @@ -62,7 +62,6 @@ import net.sf.gridarta.XmlHelper; import net.sf.gridarta.archtype.ArchetypeAttributeParser; import net.sf.gridarta.archtype.ArchetypeTypeParser; -import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.archtype.ArchetypeTypeSetParser; import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.match.GameObjectMatcher; @@ -201,7 +200,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - 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); archetypeChooserControl.init(false, gameObjectAttributesDialogFactory); mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:12:00 UTC (rev 4923) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:14:00 UTC (rev 4924) @@ -66,7 +66,6 @@ import net.sf.gridarta.XmlHelper; import net.sf.gridarta.archtype.ArchetypeAttributeParser; import net.sf.gridarta.archtype.ArchetypeTypeParser; -import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.archtype.ArchetypeTypeSetParser; import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.face.FaceObjectProviders; @@ -255,7 +254,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - 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); archetypeChooserControl.init(true, gameObjectAttributesDialogFactory); final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:12:00 UTC (rev 4923) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:14:00 UTC (rev 4924) @@ -28,6 +28,7 @@ import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; @@ -162,6 +163,9 @@ @NotNull protected final PickmapChooserControl<G, A, R, V> pickmapChooserControl; + @NotNull + protected final ArchetypeTypeSet<G, A, R> archetypeTypeSet; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -196,6 +200,7 @@ archetypeChooserControl = new ArchetypeChooserControl<G, A, R, V>(archetypeChooserModel); pickmapChooserControl = new PickmapChooserControl<G, A, R, V>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, globalSettings.getPickmapDir(), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); + archetypeTypeSet = new ArchetypeTypeSet<G, A, R>(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:15:47
|
Revision: 4925 http://gridarta.svn.sourceforge.net/gridarta/?rev=4925&view=rev Author: akirschbaum Date: 2008-08-20 20:15:53 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:14:00 UTC (rev 4924) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:15:53 UTC (rev 4925) @@ -80,7 +80,6 @@ import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.connectionview.LockedItemsControl; -import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapView; @@ -200,7 +199,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); archetypeChooserControl.init(false, gameObjectAttributesDialogFactory); mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); SystemIcons.init(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:14:00 UTC (rev 4924) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:15:53 UTC (rev 4925) @@ -87,7 +87,6 @@ import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.connectionview.LockedItemsControl; -import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapView; @@ -254,7 +253,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); archetypeChooserControl.init(true, gameObjectAttributesDialogFactory); final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); SystemIcons.init(); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:14:00 UTC (rev 4924) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:15:53 UTC (rev 4925) @@ -44,6 +44,7 @@ import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; @@ -166,6 +167,9 @@ @NotNull protected final ArchetypeTypeSet<G, A, R> archetypeTypeSet; + @NotNull + protected final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -201,6 +205,7 @@ pickmapChooserControl = new PickmapChooserControl<G, A, R, V>(newMapDialogFactory, this, gridartaObjectsFactory, mapControlFactory, globalSettings.getPickmapDir(), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); archetypeTypeSet = new ArchetypeTypeSet<G, A, R>(); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R, V>(archetypeTypeSet, archetypeSet, mapManager); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:18:54
|
Revision: 4926 http://gridarta.svn.sourceforge.net/gridarta/?rev=4926&view=rev Author: akirschbaum Date: 2008-08-20 20:18:58 +0000 (Wed, 20 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-20 20:15:53 UTC (rev 4925) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:18:58 UTC (rev 4926) @@ -198,8 +198,7 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - archetypeChooserControl.init(false, gameObjectAttributesDialogFactory); + super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), false); mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); SystemIcons.init(); createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:15:53 UTC (rev 4925) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:18:58 UTC (rev 4926) @@ -252,8 +252,7 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory()); - archetypeChooserControl.init(true, gameObjectAttributesDialogFactory); + super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), true); final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); SystemIcons.init(); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:15:53 UTC (rev 4925) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:18:58 UTC (rev 4926) @@ -179,8 +179,9 @@ * @param animationObjects the animation objects instance * @param faceObjects the face objects instance * @param mapControlFactory the map control instance + * @param createDirectionPane whether the direction panel should be created */ - protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory) { + protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, final boolean createDirectionPane) { this.globalSettings = globalSettings; this.mapControlFactory = mapControlFactory; final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, mapControlFactory, globalSettings); @@ -206,6 +207,7 @@ newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); archetypeTypeSet = new ArchetypeTypeSet<G, A, R>(); gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R, V>(archetypeTypeSet, archetypeSet, mapManager); + archetypeChooserControl.init(createDirectionPane, gameObjectAttributesDialogFactory); } /** Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 20:15:53 UTC (rev 4925) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 20:18:58 UTC (rev 4926) @@ -431,7 +431,7 @@ * @param mapControlFactory the map control factory instance to use */ protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<TestAnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapControlFactory) { - super(gridartaObjectsFactory, rendererFactory, key, globalSettings, animationObjects, faceObjects, mapControlFactory); + super(gridartaObjectsFactory, rendererFactory, key, globalSettings, animationObjects, faceObjects, mapControlFactory, true); } /** {@inheritDoc} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:21:28
|
Revision: 4927 http://gridarta.svn.sourceforge.net/gridarta/?rev=4927&view=rev Author: akirschbaum Date: 2008-08-20 20:21:35 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:18:58 UTC (rev 4926) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:21:35 UTC (rev 4927) @@ -74,7 +74,6 @@ import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; -import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.RecentManager; import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.StatusBar; @@ -182,12 +181,6 @@ private final GameObjectAttributesControl gameObjectAttributesControl; /** - * The map view manager instance. - */ - @NotNull - private final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager; - - /** * The file control instance. */ @NotNull @@ -199,7 +192,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), false); - mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); SystemIcons.init(); createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:18:58 UTC (rev 4926) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:21:35 UTC (rev 4927) @@ -81,7 +81,6 @@ import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; -import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.RecentManager; import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.StatusBar; @@ -253,7 +252,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), true); - final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager = new MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(); SystemIcons.init(); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:18:58 UTC (rev 4926) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:21:35 UTC (rev 4927) @@ -41,6 +41,7 @@ import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapManagerActions; import net.sf.gridarta.gui.MapPreview; +import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; @@ -171,6 +172,12 @@ protected final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory; /** + * The map view manager instance. + */ + @NotNull + protected final MapViewManager<G, A, R, V> mapViewManager; + + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory * @param rendererFactory the renderer factory @@ -208,6 +215,7 @@ archetypeTypeSet = new ArchetypeTypeSet<G, A, R>(); gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R, V>(archetypeTypeSet, archetypeSet, mapManager); archetypeChooserControl.init(createDirectionPane, gameObjectAttributesDialogFactory); + mapViewManager = new MapViewManager<G, A, R, V>(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:22:47
|
Revision: 4928 http://gridarta.svn.sourceforge.net/gridarta/?rev=4928&view=rev Author: akirschbaum Date: 2008-08-20 20:22:52 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:21:35 UTC (rev 4927) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:22:52 UTC (rev 4928) @@ -192,7 +192,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), false); - SystemIcons.init(); createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, archetypeSet, copyBuffer); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:21:35 UTC (rev 4927) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:22:52 UTC (rev 4928) @@ -252,7 +252,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), true); - SystemIcons.init(); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, archetypeSet, copyBuffer); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:21:35 UTC (rev 4927) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:22:52 UTC (rev 4928) @@ -43,6 +43,7 @@ import net.sf.gridarta.gui.MapPreview; import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.StatusBar; +import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; @@ -216,6 +217,7 @@ gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<G, A, R, V>(archetypeTypeSet, archetypeSet, mapManager); archetypeChooserControl.init(createDirectionPane, gameObjectAttributesDialogFactory); mapViewManager = new MapViewManager<G, A, R, V>(); + SystemIcons.init(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:27:45
|
Revision: 4929 http://gridarta.svn.sourceforge.net/gridarta/?rev=4929&view=rev Author: akirschbaum Date: 2008-08-20 20:27:49 +0000 (Wed, 20 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-20 20:22:52 UTC (rev 4928) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:27:49 UTC (rev 4929) @@ -76,7 +76,6 @@ import net.sf.gridarta.gui.MapFileFilter; import net.sf.gridarta.gui.RecentManager; import net.sf.gridarta.gui.ReplaceDialogManager; -import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; @@ -191,8 +190,7 @@ * @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); - createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); + super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), false, CResourceLoader.getHomeFile("thumbnails")); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, archetypeSet, copyBuffer); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype>(archetypeChooserControl, pickmapChooserControl); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:22:52 UTC (rev 4928) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:27:49 UTC (rev 4929) @@ -83,7 +83,6 @@ import net.sf.gridarta.gui.MapFileFilter; import net.sf.gridarta.gui.RecentManager; import net.sf.gridarta.gui.ReplaceDialogManager; -import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; @@ -251,8 +250,7 @@ * @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); - createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapViewManager, archetypeSet, faceObjects)); + super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), true, null); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, archetypeSet, copyBuffer); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype>(archetypeChooserControl, pickmapChooserControl); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:22:52 UTC (rev 4928) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:27:49 UTC (rev 4929) @@ -188,8 +188,10 @@ * @param faceObjects the face objects instance * @param mapControlFactory the map control instance * @param createDirectionPane whether the direction panel should be created + * @param mapImageCacheDir the map image cache directory or + * <code>null</code> to use the map directory */ - protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, final boolean createDirectionPane) { + protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, final boolean createDirectionPane, @Nullable final File mapImageCacheDir) { this.globalSettings = globalSettings; this.mapControlFactory = mapControlFactory; final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, mapControlFactory, globalSettings); @@ -218,6 +220,7 @@ archetypeChooserControl.init(createDirectionPane, gameObjectAttributesDialogFactory); mapViewManager = new MapViewManager<G, A, R, V>(); SystemIcons.init(); + createMapImageCache(mapImageCacheDir, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<G, A, R, V>(mapManager, mapViewManager, archetypeSet, faceObjects)); } /** Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 20:22:52 UTC (rev 4928) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 20:27:49 UTC (rev 4929) @@ -431,7 +431,7 @@ * @param mapControlFactory the map control factory instance to use */ protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<TestAnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapControlFactory) { - super(gridartaObjectsFactory, rendererFactory, key, globalSettings, animationObjects, faceObjects, mapControlFactory, true); + super(gridartaObjectsFactory, rendererFactory, key, globalSettings, animationObjects, faceObjects, mapControlFactory, true, null); } /** {@inheritDoc} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:30:01
|
Revision: 4930 http://gridarta.svn.sourceforge.net/gridarta/?rev=4930&view=rev Author: akirschbaum Date: 2008-08-20 20:30:07 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:27:49 UTC (rev 4929) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:30:07 UTC (rev 4930) @@ -152,9 +152,6 @@ /** The object chooser. */ private final DefaultObjectChooser<GameObject, MapArchObject, Archetype> objectChooser; - /** The main view. */ - private final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView; - /** The Spells. */ private final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); @@ -191,7 +188,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), false, CResourceLoader.getHomeFile("thumbnails")); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, archetypeSet, copyBuffer); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype>(archetypeChooserControl, pickmapChooserControl); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, null, archetypeSet); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:27:49 UTC (rev 4929) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:30:07 UTC (rev 4930) @@ -191,9 +191,6 @@ /** The object chooser. */ private final DefaultObjectChooser<GameObject, MapArchObject, Archetype> objectChooser; - /** The main view. */ - private final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView; - /** Bit field of edit types to show transparent. */ private int alphaType; @@ -251,7 +248,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), true, null); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, archetypeSet, copyBuffer); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype>(archetypeChooserControl, pickmapChooserControl); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:27:49 UTC (rev 4929) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:30:07 UTC (rev 4930) @@ -178,6 +178,10 @@ @NotNull protected final MapViewManager<G, A, R, V> mapViewManager; + /** The main view. */ + @NotNull + protected final MainView<G, A, R, V> mainView; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -221,6 +225,7 @@ mapViewManager = new MapViewManager<G, A, R, V>(); SystemIcons.init(); createMapImageCache(mapImageCacheDir, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<G, A, R, V>(mapManager, mapViewManager, archetypeSet, faceObjects)); + mainView = new MainView<G, A, R, V>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:32:42
|
Revision: 4931 http://gridarta.svn.sourceforge.net/gridarta/?rev=4931&view=rev Author: akirschbaum Date: 2008-08-20 20:32:48 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:30:07 UTC (rev 4930) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:32:48 UTC (rev 4931) @@ -75,7 +75,6 @@ import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; import net.sf.gridarta.gui.RecentManager; -import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; @@ -188,7 +187,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), false, CResourceLoader.getHomeFile("thumbnails")); - final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, archetypeSet, copyBuffer); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype>(archetypeChooserControl, pickmapChooserControl); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, null, archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:30:07 UTC (rev 4930) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:32:48 UTC (rev 4931) @@ -82,7 +82,6 @@ import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; import net.sf.gridarta.gui.RecentManager; -import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; @@ -248,7 +247,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), true, null); - final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, archetypeSet, copyBuffer); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype>(archetypeChooserControl, pickmapChooserControl); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:30:07 UTC (rev 4930) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:32:48 UTC (rev 4931) @@ -42,6 +42,7 @@ import net.sf.gridarta.gui.MapManagerActions; import net.sf.gridarta.gui.MapPreview; import net.sf.gridarta.gui.MapViewManager; +import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; @@ -182,6 +183,9 @@ @NotNull protected final MainView<G, A, R, V> mainView; + @NotNull + protected final ReplaceDialogManager<G, A, R, V> replaceDialogManager; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -226,6 +230,7 @@ SystemIcons.init(); createMapImageCache(mapImageCacheDir, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<G, A, R, V>(mapManager, mapViewManager, archetypeSet, faceObjects)); mainView = new MainView<G, A, R, V>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); + replaceDialogManager = new ReplaceDialogManager<G, A, R, V>(mainView, archetypeSet, copyBuffer); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:34:34
|
Revision: 4932 http://gridarta.svn.sourceforge.net/gridarta/?rev=4932&view=rev Author: akirschbaum Date: 2008-08-20 20:34:41 +0000 (Wed, 20 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:32:48 UTC (rev 4931) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:34:41 UTC (rev 4932) @@ -84,7 +84,6 @@ import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; -import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.prefs.MapValidatorPrefs; import net.sf.gridarta.gui.prefs.MiscPrefs; @@ -148,9 +147,6 @@ /** Preferences default value for using System.exit(). */ public static final boolean PREFS_SYSTEM_EXIT_DEFAULT = true; - /** The object chooser. */ - private final DefaultObjectChooser<GameObject, MapArchObject, Archetype> objectChooser; - /** The Spells. */ private final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); @@ -187,7 +183,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), false, CResourceLoader.getHomeFile("thumbnails")); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype>(archetypeChooserControl, pickmapChooserControl); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, null, archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:32:48 UTC (rev 4931) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:34:41 UTC (rev 4932) @@ -91,7 +91,6 @@ import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; -import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.prefs.MapValidatorPrefs; import net.sf.gridarta.gui.prefs.MiscPrefs; @@ -187,9 +186,6 @@ /** Preferences default value for editor application. */ public static final String PREFS_APP_EDITOR_DEFAULT = "vim"; - /** The object chooser. */ - private final DefaultObjectChooser<GameObject, MapArchObject, Archetype> objectChooser; - /** Bit field of edit types to show transparent. */ private int alphaType; @@ -247,7 +243,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), true, null); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype>(archetypeChooserControl, pickmapChooserControl); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:32:48 UTC (rev 4931) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:34:41 UTC (rev 4932) @@ -53,6 +53,7 @@ import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.RendererFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; +import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.help.Help; import net.sf.gridarta.io.PathManager; @@ -187,6 +188,12 @@ protected final ReplaceDialogManager<G, A, R, V> replaceDialogManager; /** + * The object chooser. + */ + @NotNull + protected final DefaultObjectChooser<G, A, R> objectChooser; + + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory * @param rendererFactory the renderer factory @@ -231,6 +238,7 @@ createMapImageCache(mapImageCacheDir, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<G, A, R, V>(mapManager, mapViewManager, archetypeSet, faceObjects)); mainView = new MainView<G, A, R, V>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); replaceDialogManager = new ReplaceDialogManager<G, A, R, V>(mainView, archetypeSet, copyBuffer); + objectChooser = new DefaultObjectChooser<G, A, R>(archetypeChooserControl, pickmapChooserControl); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-20 20:40:16
|
Revision: 4933 http://gridarta.svn.sourceforge.net/gridarta/?rev=4933&view=rev Author: akirschbaum Date: 2008-08-20 20:40:23 +0000 (Wed, 20 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-20 20:34:41 UTC (rev 4932) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 20:40:23 UTC (rev 4933) @@ -88,7 +88,6 @@ import net.sf.gridarta.gui.prefs.MapValidatorPrefs; import net.sf.gridarta.gui.prefs.MiscPrefs; import net.sf.gridarta.gui.prefs.UpdatePrefs; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.undo.UndoControl; import net.sf.gridarta.io.IOUtils; @@ -182,8 +181,7 @@ * @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")); - final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, null, archetypeSet); + super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), 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/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:34:41 UTC (rev 4932) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 20:40:23 UTC (rev 4933) @@ -95,7 +95,6 @@ import net.sf.gridarta.gui.prefs.MapValidatorPrefs; import net.sf.gridarta.gui.prefs.MiscPrefs; import net.sf.gridarta.gui.prefs.UpdatePrefs; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.undo.UndoControl; import net.sf.gridarta.gui.utils.GUIUtils; @@ -242,8 +241,7 @@ * @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); - final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); + super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), new DefaultMapControlFactory(), 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/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:34:41 UTC (rev 4932) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 20:40:23 UTC (rev 4933) @@ -55,6 +55,7 @@ import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; +import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.help.Help; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.MapArchObject; @@ -193,6 +194,9 @@ @NotNull protected final DefaultObjectChooser<G, A, R> objectChooser; + @NotNull + protected final SelectedSquareControl<G, A, R, V> selectedSquareControl; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -205,8 +209,10 @@ * @param createDirectionPane whether the direction panel should be created * @param mapImageCacheDir the map image cache directory or * <code>null</code> to use the map directory + * @param compassIcon the icon to display in the selected square view; + * <code>null</code> to not show an icon */ - protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, final boolean createDirectionPane, @Nullable final File mapImageCacheDir) { + protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<G, A, R, V> mapControlFactory, final boolean createDirectionPane, @Nullable final File mapImageCacheDir, @Nullable final ImageIcon compassIcon) { this.globalSettings = globalSettings; this.mapControlFactory = mapControlFactory; final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, mapControlFactory, globalSettings); @@ -239,6 +245,7 @@ mainView = new MainView<G, A, R, V>(this, editTypes, mapManager, mapViewManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); replaceDialogManager = new ReplaceDialogManager<G, A, R, V>(mainView, archetypeSet, copyBuffer); objectChooser = new DefaultObjectChooser<G, A, R>(archetypeChooserControl, pickmapChooserControl); + selectedSquareControl = new SelectedSquareControl<G, A, R, V>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, compassIcon, archetypeSet); } /** Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 20:34:41 UTC (rev 4932) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 20:40:23 UTC (rev 4933) @@ -431,7 +431,7 @@ * @param mapControlFactory the map control factory instance to use */ protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<TestAnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapControlFactory) { - super(gridartaObjectsFactory, rendererFactory, key, globalSettings, animationObjects, faceObjects, mapControlFactory, true, null); + super(gridartaObjectsFactory, rendererFactory, key, globalSettings, animationObjects, faceObjects, mapControlFactory, true, null, null); } /** {@inheritDoc} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
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. |
From: <aki...@us...> - 2008-08-21 18:09:29
|
Revision: 4939 http://gridarta.svn.sourceforge.net/gridarta/?rev=4939&view=rev Author: akirschbaum Date: 2008-08-21 18:09:34 +0000 (Thu, 21 Aug 2008) Log Message: ----------- Remove dependency NewPickmapDialog -> GridartaObjectsFactory. Modified Paths: -------------- trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/map/MapControlFactory.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-08-21 17:51:37 UTC (rev 4938) +++ trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-08-21 18:09:34 UTC (rev 4939) @@ -29,6 +29,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; +import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.RendererFactory; @@ -126,6 +127,19 @@ /** {@inheritDoc} */ @NotNull + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Component parent, @NotNull final Size2D mapSize, @NotNull final String pickmapName, @NotNull final File file) { + final MapArchObject mapArchObject = gridartaObjectsFactory.newMapArchObject(true); + mapArchObject.setMapSize(mapSize); + mapArchObject.setMapName(pickmapName); + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, rendererFactory, parent, autojoinLists, mapImageCache, null, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + mapControl.setMapFile(file); + mapControl.setMapFileName(file.getPath()); + mapControl.resetModified(); + return mapControl; + } + + /** {@inheritDoc} */ + @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final File file) { final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, rendererFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); mapControl.setMapFile(file); Modified: trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-21 17:51:37 UTC (rev 4938) +++ trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-21 18:09:34 UTC (rev 4939) @@ -29,6 +29,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; +import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.RendererFactory; @@ -126,6 +127,20 @@ /** {@inheritDoc} */ @NotNull + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Component parent, @NotNull final Size2D mapSize, @NotNull final String pickmapName, @NotNull final File file) { + final MapArchObject mapArchObject = gridartaObjectsFactory.newMapArchObject(true); + mapArchObject.setMapSize(mapSize); + mapArchObject.setMapName(pickmapName); + mapArchObject.setDifficulty(1); + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, rendererFactory, parent, autojoinLists, mapImageCache, null, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + mapControl.setMapFile(file); + mapControl.setMapFileName(file.getPath()); + mapControl.resetModified(); + return mapControl; + } + + /** {@inheritDoc} */ + @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Component parent, @Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final File file) { mapArchObject.setDifficulty(1); final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, rendererFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java 2008-08-21 17:51:37 UTC (rev 4938) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java 2008-08-21 18:09:34 UTC (rev 4939) @@ -120,7 +120,7 @@ /** Shows a dialog for creating a new pickmap. */ public void showNewPickmapDialog() { - new NewPickmapDialog<G, A, R, V>(mainControl, gridartaObjectsFactory, mainControl.getMainView(), defaultPickmapWidth, defaultPickmapHeight, pickmapChooserControl); + new NewPickmapDialog<G, A, R, V>(mainControl, mainControl.getMainView(), defaultPickmapWidth, defaultPickmapHeight, pickmapChooserControl); } /** Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java 2008-08-21 17:51:37 UTC (rev 4938) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java 2008-08-21 18:09:34 UTC (rev 4939) @@ -26,7 +26,6 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; @@ -36,7 +35,6 @@ import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; -import org.jetbrains.annotations.NotNull; /** * Dialog to create a new pickmap file. @@ -53,12 +51,6 @@ /** The controller of this new level dialog view. */ private final MainControl<G, A, R, V> mainControl; - /** - * The gridarta objects factory instance. - */ - @NotNull - private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; - /** The pickmap chooser control. */ private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; @@ -71,16 +63,14 @@ /** * Creates a "new pickmap" dialog. * @param mainControl the controller of this dialog. - * @param gridartaObjectsFactory the gridarta objects factory instance * @param parentComponent the parent component of this dialog * @param defaultWidth The default width for new maps. * @param defaultHeight The default height for new maps. * @param pickmapChooserControl the pickmap chooser control */ - public NewPickmapDialog(final MainControl<G, A, R, V> mainControl, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, final Component parentComponent, final int defaultWidth, final int defaultHeight, final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { + public NewPickmapDialog(final MainControl<G, A, R, V> mainControl, final Component parentComponent, final int defaultWidth, final int defaultHeight, final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { super(false, defaultWidth, defaultHeight); this.mainControl = mainControl; - this.gridartaObjectsFactory = gridartaObjectsFactory; this.pickmapChooserControl = pickmapChooserControl; init1(parentComponent, ACTION_FACTORY.getString("newPickmap.title")); init2(); @@ -109,14 +99,10 @@ /** {@inheritDoc} */ @Override protected boolean createNew() { - // Create a new level from scratch - final A mapArchObject = gridartaObjectsFactory.newMapArchObject(true); - final Size2D mapSize = getMapSize(); if (mapSize == null) { return false; } - mapArchObject.setMapSize(mapSize); // the map maker must enter a name -- both for maps and pickmaps final String pickmapName = mapNameField.getText(); @@ -127,7 +113,7 @@ } try { - pickmapChooserControl.newPickmap(mapArchObject, pickmapName); + pickmapChooserControl.newPickmap(mapSize, pickmapName); } catch (final DuplicatePickmapException ex) { ACTION_FACTORY.showMessageDialog(this, "pickmapExists", pickmapName); return false; Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-21 17:51:37 UTC (rev 4938) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-21 18:09:34 UTC (rev 4939) @@ -34,6 +34,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.MapManagerListener; +import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; @@ -224,12 +225,12 @@ /** * Add a new pickmap. - * @param mapArchObject the map arch object of the pickmap + * @param mapSize the pickmap size in tiles * @param pickmapName the name of the pickmap * @throws IOException if an I/O error occurs * @throws DuplicatePickmapException if the pickmap name is not unique */ - public void newPickmap(final A mapArchObject, final String pickmapName) throws DuplicatePickmapException, IOException { + public void newPickmap(@NotNull final Size2D mapSize, @NotNull final String pickmapName) throws DuplicatePickmapException, IOException { final Folder<G, A, R, V> activeFolder = view.getActiveFolder(); if (activeFolder == null) { return; @@ -260,8 +261,7 @@ } } - mapArchObject.setMapName(pickmapName); - final MapControl<G, A, R, V> mapControl = mapControlFactory.newPickmapControl(mainControl.getMainView(), null, mapArchObject, mapFile); + final MapControl<G, A, R, V> mapControl = mapControlFactory.newPickmapControl(mainControl.getMainView(), mapSize, pickmapName, mapFile); mapControl.save(); final Pickmap<G, A, R, V> pickmap; Modified: trunk/src/app/net/sf/gridarta/map/MapControlFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-08-21 17:51:37 UTC (rev 4938) +++ trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-08-21 18:09:34 UTC (rev 4939) @@ -23,6 +23,7 @@ import java.io.File; import java.io.IOException; import java.util.List; +import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; @@ -50,6 +51,17 @@ /** * Create a new pickmap map control instance. * @param parent the parent component for error messages + * @param mapSize the pickmap size in tiles + * @param pickmapName the pickmap name + * @param file the associated file + * @return the new pickmap map control instance + */ + @NotNull + MapControl<G, A, R, V> newPickmapControl(@NotNull Component parent, @NotNull Size2D mapSize, @NotNull String pickmapName, @NotNull File file); + + /** + * Create a new pickmap map control instance. + * @param parent the parent component for error messages * @param objects the objects to insert into the new pickmap * @param mapArchObject the map arch object to use for the new pickmap * @param file the associated file Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-21 17:51:37 UTC (rev 4938) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-21 18:09:34 UTC (rev 4939) @@ -1125,9 +1125,16 @@ /** {@inheritDoc} */ @NotNull + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@NotNull final Component parent, @NotNull final Size2D mapSize, @NotNull final String pickmapName, @NotNull final File file) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@NotNull final Component parent, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final File file) { throw new AssertionError(); } } + } // class DefaultMapModelTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-21 20:29:44
|
Revision: 4951 http://gridarta.svn.sourceforge.net/gridarta/?rev=4951&view=rev Author: akirschbaum Date: 2008-08-21 20:29:48 +0000 (Thu, 21 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 20:13:41 UTC (rev 4950) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 20:29:48 UTC (rev 4951) @@ -88,7 +88,6 @@ import net.sf.gridarta.gui.prefs.MapValidatorPrefs; import net.sf.gridarta.gui.prefs.MiscPrefs; import net.sf.gridarta.gui.prefs.UpdatePrefs; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.undo.UndoControl; import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.map.AutoValidator; @@ -183,7 +182,6 @@ */ 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); validators = createMapValidators(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 20:13:41 UTC (rev 4950) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 20:29:48 UTC (rev 4951) @@ -95,7 +95,6 @@ import net.sf.gridarta.gui.prefs.MapValidatorPrefs; import net.sf.gridarta.gui.prefs.MiscPrefs; import net.sf.gridarta.gui.prefs.UpdatePrefs; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.undo.UndoControl; import net.sf.gridarta.gui.utils.GUIUtils; import net.sf.gridarta.io.IOUtils; @@ -243,7 +242,6 @@ */ 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); validators = createMapValidators(); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 20:13:41 UTC (rev 4950) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 20:29:48 UTC (rev 4951) @@ -56,6 +56,7 @@ import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; +import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.help.Help; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.MapArchObject; @@ -194,6 +195,9 @@ @NotNull protected final SelectedSquareControl<G, A, R, V> selectedSquareControl; + @NotNull + protected final SelectedSquareView<G, A, R, V> selectedSquareView; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -243,6 +247,7 @@ replaceDialogManager = new ReplaceDialogManager<G, A, R, V>(mainView, archetypeSet, copyBuffer); objectChooser = new DefaultObjectChooser<G, A, R>(archetypeChooserControl, pickmapChooserControl); selectedSquareControl = new SelectedSquareControl<G, A, R, V>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, compassIcon, archetypeSet); + selectedSquareView = selectedSquareControl.getSelectedSquareView(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-21 20:32:32
|
Revision: 4952 http://gridarta.svn.sourceforge.net/gridarta/?rev=4952&view=rev Author: akirschbaum Date: 2008-08-21 20:32:37 +0000 (Thu, 21 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 20:29:48 UTC (rev 4951) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 20:32:37 UTC (rev 4952) @@ -78,7 +78,6 @@ import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; -import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.tools.DeletionTool; import net.sf.gridarta.gui.map.tools.ToolPalette; @@ -182,7 +181,6 @@ */ 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); - new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); validators = createMapValidators(); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 20:29:48 UTC (rev 4951) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 20:32:37 UTC (rev 4952) @@ -85,7 +85,6 @@ import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; -import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.tools.DeletionTool; import net.sf.gridarta.gui.map.tools.ToolPalette; @@ -242,7 +241,6 @@ */ 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)); - new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); validators = createMapValidators(); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 20:29:48 UTC (rev 4951) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 20:32:37 UTC (rev 4952) @@ -48,6 +48,7 @@ import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; +import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; @@ -248,6 +249,7 @@ objectChooser = new DefaultObjectChooser<G, A, R>(archetypeChooserControl, pickmapChooserControl); selectedSquareControl = new SelectedSquareControl<G, A, R, V>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, compassIcon, archetypeSet); selectedSquareView = selectedSquareControl.getSelectedSquareView(); + new MapCursorControl<G, A, R, V>(key, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-21 20:35:04
|
Revision: 4953 http://gridarta.svn.sourceforge.net/gridarta/?rev=4953&view=rev Author: akirschbaum Date: 2008-08-21 20:35:10 +0000 (Thu, 21 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 20:32:37 UTC (rev 4952) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 20:35:10 UTC (rev 4953) @@ -181,7 +181,6 @@ */ 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); - replaceDialogManager.setObjectChooser(objectChooser); validators = createMapValidators(); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); GameObject.setArchetypeSet(archetypeSet, SystemIcons.getNofaceTileIcon()); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 20:32:37 UTC (rev 4952) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 20:35:10 UTC (rev 4953) @@ -241,7 +241,6 @@ */ 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)); - replaceDialogManager.setObjectChooser(objectChooser); validators = createMapValidators(); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); GameObject.setAnimationObjects(animationObjects, SystemIcons.getNofaceTileIcon()); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 20:32:37 UTC (rev 4952) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 20:35:10 UTC (rev 4953) @@ -250,6 +250,7 @@ selectedSquareControl = new SelectedSquareControl<G, A, R, V>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, mapViewManager, editTypes, mapTileListBottom, compassIcon, archetypeSet); selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<G, A, R, V>(key, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); + replaceDialogManager.setObjectChooser(objectChooser); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-21 20:42:55
|
Revision: 4954 http://gridarta.svn.sourceforge.net/gridarta/?rev=4954&view=rev Author: akirschbaum Date: 2008-08-21 20:42:52 +0000 (Thu, 21 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-21 20:35:10 UTC (rev 4953) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 20:42:52 UTC (rev 4954) @@ -153,9 +153,6 @@ /** The current script controller. */ private final ScriptController scriptControl; - /** The map validators. */ - private final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators; - /** Preferences default for auto validation. */ private static final boolean PREFS_VALIDATOR_AUTO_DEFAULT = true; @@ -181,7 +178,6 @@ */ 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); - validators = createMapValidators(); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); GameObject.setArchetypeSet(archetypeSet, SystemIcons.getNofaceTileIcon()); gameObjectAttributesDialogFactory.setParent(mainView); @@ -329,11 +325,10 @@ return 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); } - /** - * Initializes the map validators. - * @return A MapValidator that delegates to other map validators. - */ - private static DelegatingMapValidator<GameObject, MapArchObject, Archetype> createMapValidators() { + /** {@inheritDoc} */ + @NotNull + @Override + protected DelegatingMapValidator<GameObject, MapArchObject, Archetype> createMapValidators() { final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators = new DelegatingMapValidator<GameObject, MapArchObject, Archetype>(); final AttributeRangeChecker<GameObject, MapArchObject, Archetype> attributeRangeChecker = new AttributeRangeChecker<GameObject, MapArchObject, Archetype>(); // make sure sustenance is [-20..20]; amulet of Sustenance is +15 so +20 should be safe Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 20:35:10 UTC (rev 4953) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 20:42:52 UTC (rev 4954) @@ -201,9 +201,6 @@ /** Server Control Component. */ private ProcessRunner controlServer; - /** The map validators. */ - private final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators; - /** Preferences default for auto validation. */ private static final boolean PREFS_VALIDATOR_AUTO_DEFAULT = false; @@ -241,7 +238,6 @@ */ 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)); - validators = createMapValidators(); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); GameObject.setAnimationObjects(animationObjects, SystemIcons.getNofaceTileIcon()); gameObjectAttributesDialogFactory.setParent(mainView); @@ -405,11 +401,10 @@ return 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); } - /** - * Initializes the map validators. - * @return A MapValidator that delegates to other map validators. - */ - private DelegatingMapValidator<GameObject, MapArchObject, Archetype> createMapValidators() { + /** {@inheritDoc} */ + @NotNull + @Override + protected DelegatingMapValidator<GameObject, MapArchObject, Archetype> createMapValidators() { final DelegatingMapValidator<GameObject, MapArchObject, Archetype> mapValidators = new DelegatingMapValidator<GameObject, MapArchObject, Archetype>(); final CustomTypeChecker<GameObject, MapArchObject, Archetype> customTypeChecker = new CustomTypeChecker<GameObject, MapArchObject, Archetype>(); customTypeChecker.addIgnore(Archetype.TYPE_MOB, Archetype.TYPE_SPAWN_POINT_MOB, Archetype.TYPE_SPAWN_POINT); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 20:35:10 UTC (rev 4953) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 20:42:52 UTC (rev 4954) @@ -63,6 +63,7 @@ import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapControlFactory; +import net.sf.gridarta.map.validation.DelegatingMapValidator; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.gridarta.updater.UpdaterManager; import net.sf.japi.swing.ActionFactory; @@ -199,6 +200,9 @@ @NotNull protected final SelectedSquareView<G, A, R, V> selectedSquareView; + /** The map validators. */ + protected final DelegatingMapValidator<G, A, R> validators; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -251,9 +255,17 @@ selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<G, A, R, V>(key, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); + validators = createMapValidators(); } /** + * Initializes the map validators. + * @return A MapValidator that delegates to other map validators. + */ + @NotNull + protected abstract DelegatingMapValidator<G, A, R> createMapValidators(); + + /** * Creates a new {@link NewMapDialogFactory} instance. * @param mapManager the map manager instance * @param gridartaObjectsFactory the gridarta objects factory instance Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-21 20:35:10 UTC (rev 4953) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-21 20:42:52 UTC (rev 4954) @@ -87,6 +87,7 @@ import net.sf.gridarta.map.MapModelEvent; import net.sf.gridarta.map.MapModelListener; import net.sf.gridarta.map.MapSquare; +import net.sf.gridarta.map.validation.DelegatingMapValidator; import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -491,6 +492,13 @@ throw new AssertionError(); } + /** {@inheritDoc} */ + @NotNull + @Override + protected DelegatingMapValidator<TestGameObject, TestMapArchObject, TestArchetype> createMapValidators() { + throw new AssertionError(); + } + } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-21 20:45:15
|
Revision: 4955 http://gridarta.svn.sourceforge.net/gridarta/?rev=4955&view=rev Author: akirschbaum Date: 2008-08-21 20:45:17 +0000 (Thu, 21 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 Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 20:42:52 UTC (rev 4954) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-21 20:45:17 UTC (rev 4955) @@ -71,7 +71,6 @@ import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.LeftPanel; -import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; import net.sf.gridarta.gui.RecentManager; @@ -156,9 +155,6 @@ /** Preferences default for auto validation. */ private static final boolean PREFS_VALIDATOR_AUTO_DEFAULT = true; - /** Actions used by this instance. */ - private final MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mainActions; - /** The treasure lists. */ private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; @@ -178,7 +174,6 @@ */ 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); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); GameObject.setArchetypeSet(archetypeSet, SystemIcons.getNofaceTileIcon()); gameObjectAttributesDialogFactory.setParent(mainView); new About("cfeditor", mainView); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 20:42:52 UTC (rev 4954) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-21 20:45:17 UTC (rev 4955) @@ -78,7 +78,6 @@ import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.LeftPanel; -import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; import net.sf.gridarta.gui.RecentManager; @@ -216,9 +215,6 @@ /** The ViewGameObjectMatcherManager for alpha. */ private final ViewGameObjectMatcherManager vaommAlpha = new ViewGameObjectMatcherManager(moaomAlpha); - /** Actions used by this instance. */ - private final MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mainActions; - /** The treasure lists. */ private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; @@ -238,7 +234,6 @@ */ 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)); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); GameObject.setAnimationObjects(animationObjects, SystemIcons.getNofaceTileIcon()); gameObjectAttributesDialogFactory.setParent(mainView); new About("daieditor", mainView); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 20:42:52 UTC (rev 4954) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-21 20:45:17 UTC (rev 4955) @@ -38,6 +38,7 @@ import net.sf.gridarta.gameobject.scripts.ScriptedEvent; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.HideFileFilterProxy; +import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapManagerActions; import net.sf.gridarta.gui.MapPreview; @@ -203,6 +204,10 @@ /** The map validators. */ protected final DelegatingMapValidator<G, A, R> validators; + /** Actions used by this instance. */ + @NotNull + protected final MainActions<G, A, R, V> mainActions; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -256,6 +261,7 @@ new MapCursorControl<G, A, R, V>(key, gameObjectAttributesDialogFactory, mapManager, mapViewManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); validators = createMapValidators(); + mainActions = new MainActions<G, A, R, V>(replaceDialogManager, this, validators, editTypes, archetypeSet, copyBuffer, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager, mapViewManager); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |