From: <aki...@us...> - 2008-08-15 21:29:31
|
Revision: 4868 http://gridarta.svn.sourceforge.net/gridarta/?rev=4868&view=rev Author: akirschbaum Date: 2008-08-15 21:29:39 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Remove access to autojoinLists field in CrossfireObjectsFactory/DaimoninObjectsFactory. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.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/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-15 21:18:29 UTC (rev 4867) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-15 21:29:39 UTC (rev 4868) @@ -154,7 +154,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserModel, mapActions); } Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-15 21:18:29 UTC (rev 4867) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-15 21:29:39 UTC (rev 4868) @@ -158,7 +158,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserModel, mapActions); } Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 21:18:29 UTC (rev 4867) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 21:29:39 UTC (rev 4868) @@ -108,11 +108,11 @@ */ protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings) { this.globalSettings = globalSettings; - final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, globalSettings); + final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, globalSettings, autojoinLists); editTypes = new EditTypes<G, A, R, V>(tmpMapManager); tmpMapManager.setEditTypes(editTypes); mapManager = tmpMapManager; - copyBuffer = new CopyBuffer<G, A, R, V>(this, editTypes, gridartaObjectsFactory); + copyBuffer = new CopyBuffer<G, A, R, V>(this, editTypes, gridartaObjectsFactory, autojoinLists); this.gridartaObjectsFactory = gridartaObjectsFactory; globalSettings.readGlobalSettings(); ScriptedEventEditor.setGlobalSettings(globalSettings); Modified: trunk/src/app/net/sf/gridarta/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-08-15 21:18:29 UTC (rev 4867) +++ trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-08-15 21:29:39 UTC (rev 4868) @@ -73,6 +73,12 @@ @NotNull private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + /** + * The autojoin lists. + */ + @NotNull + private final AutojoinLists<G, A, R> autojoinLists; + /** Internal map control to store the cut / copied arches. */ private MapControl<G, A, R, V> copyMapCtrl = null; @@ -81,11 +87,13 @@ * @param mainControl main control * @param editTypes the edit types instance * @param gridartaObjectsFactory the gridarta objects factory instance + * @param autojoinLists the autojoin lists */ - 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 GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final AutojoinLists<G, A, R> autojoinLists) { this.mainControl = mainControl; // link main control in this.editTypes = editTypes; this.gridartaObjectsFactory = gridartaObjectsFactory; + this.autojoinLists = autojoinLists; } /** @@ -95,7 +103,7 @@ public void init(final A mapArch) { assert copyMapCtrl == null; mapArch.setMapName("cb"); - copyMapCtrl = gridartaObjectsFactory.newMapControl(null, mapArch, mainControl.getMainView()); + copyMapCtrl = gridartaObjectsFactory.newMapControl(null, mapArch, mainControl.getMainView(), autojoinLists); copyMapCtrl.setMapFileName("cb"); } Modified: trunk/src/app/net/sf/gridarta/DefaultMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-08-15 21:18:29 UTC (rev 4867) +++ trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-08-15 21:29:39 UTC (rev 4868) @@ -69,6 +69,12 @@ @NotNull private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + /** + * The autojoin lists. + */ + @NotNull + private final AutojoinLists<G, A, R> autojoinLists; + /** The edit types. */ @NotNull private EditTypes<G, A, R, V> editTypes = null; @@ -91,9 +97,11 @@ * @param key The action factory key. * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance + * @param autojoinLists the autojoin lists */ - 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 GlobalSettings globalSettings, @NotNull final AutojoinLists<G, A, R> autojoinLists) { this.globalSettings = globalSettings; + this.autojoinLists = autojoinLists; actionFactory = ActionFactory.getFactory(key); this.mainControl = mainControl; this.gridartaObjectsFactory = gridartaObjectsFactory; @@ -128,7 +136,7 @@ @NotNull private MapControl<G, A, R, V> newMap(final List<G> objects, final A mapArchObject, @Nullable final File file, @NotNull final String mapFileName) { - final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newMapControl(objects, mapArchObject, mainControl.getMainView()); + final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newMapControl(objects, mapArchObject, mainControl.getMainView(), autojoinLists); mapControl.setMapFile(file); mapControl.setMapFileName(mapFileName); return mapControl; Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-15 21:18:29 UTC (rev 4867) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-15 21:29:39 UTC (rev 4868) @@ -101,10 +101,11 @@ * @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 autojoinLists the autojoin lists instance * @return The new map control instance. */ @NotNull - MapControl<G, A, R, V> newMapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent); + MapControl<G, A, R, V> newMapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent, @NotNull AutojoinLists<G, A, R> autojoinLists); /** * Create a new pickmap map control instance. Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 21:18:29 UTC (rev 4867) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 21:29:39 UTC (rev 4868) @@ -386,10 +386,10 @@ final TestMapArchObject mapArchObject = new TestMapArchObject(); final TestArchetypeSet archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(archetypeSet); - final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, "test", gridartaObjectsFactory, globalSettings); + final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(); + final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, "test", gridartaObjectsFactory, globalSettings, autojoinLists); final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache = new MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(null, mapManager, null, new ImageIcon(), new ImageIcon()); final MapActions mapActions = new TestMapActions(); - final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(); final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, autojoinLists, mapImageCache, null, mapArchObject, false, null, archetypeChooserModel, mapActions); mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(new JPanel(), autojoinLists, mapControl, null, mapArchObject, null, archetypeChooserModel, mapActions); @@ -845,7 +845,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent) { + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists) { 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-15 21:40:51
|
Revision: 4869 http://gridarta.svn.sourceforge.net/gridarta/?rev=4869&view=rev Author: akirschbaum Date: 2008-08-15 21:40:56 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Remove autojoinLists field from CrossfireObjectsFactory/DaimoninObjectsFactory. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -225,7 +225,7 @@ final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeSet); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserModel); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); - pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); + pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager, autojoinLists); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); @@ -333,7 +333,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); final ArchetypeParser archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); + gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -103,11 +103,7 @@ @NotNull private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; - /** The {@link AutojoinLists} instance. */ @NotNull - private AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists = null; - - @NotNull private CFilterControl filterControl; /** The tool palette instance. */ @@ -160,7 +156,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserModel, mapActions); } @@ -177,7 +173,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { this.archetypeChooserModel = archetypeChooserModel; this.selectedSquareView = selectedSquareView; this.mainView = mainView; @@ -186,7 +182,6 @@ this.mapActions = mapActions; this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; - this.autojoinLists = autojoinLists; this.toolPalette = toolPalette; } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -283,7 +283,7 @@ final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeSet); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserModel); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); - pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); + pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager, autojoinLists); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); @@ -388,7 +388,7 @@ mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); + gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -110,10 +110,6 @@ @NotNull private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; - /** The {@link AutojoinLists} instance. */ - @NotNull - private AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists = null; - /** The tool palette instance. */ @NotNull private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; @@ -164,7 +160,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent) { + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserModel, mapActions); mapArchObject.setDifficulty(1); return mapControl; @@ -183,7 +179,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { this.faceObjects = faceObjects; this.archetypeChooserModel = archetypeChooserModel; this.selectedSquareView = selectedSquareView; @@ -194,7 +190,6 @@ this.mapActions = mapActions; this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; - this.autojoinLists = autojoinLists; this.toolPalette = toolPalette; } Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -112,10 +112,11 @@ * @param objects The objects to insert into the new pickmap. * @param mapArchObject The map arch object to use for the new pickmap. * @param parent the parent component for error messages + * @param autojoinLists the autojoin lists * @return The new pickmap map control instance. */ @NotNull - MapControl<G, A, R, V> newPickmapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent); + MapControl<G, A, R, V> newPickmapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent, @NotNull AutojoinLists<G, A, R> autojoinLists); /** * Create a new level renderer instance. @@ -148,9 +149,8 @@ * @param mapActions the map actions instance * @param archetypeParser the archetype parser instance * @param archetypeSet the archetype set instance - * @param autojoinLists the autojoin lists instance * @param toolPalette the tool palette instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull MainView<G, A, R, V> mainView, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull ToolPalette<G, A, R, V> toolPalette); + void init(@NotNull FaceObjects faceObjects, @NotNull ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull MainView<G, A, R, V> mainView, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ToolPalette<G, A, R, V> toolPalette); } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -27,6 +27,7 @@ import java.util.Iterator; import java.util.List; import javax.swing.event.EventListenerList; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -132,11 +133,12 @@ * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> * instance for loading the pickmap map file * @param parent the parent component for error messages + * @param autojoinLists the autojoin lists * @return the newly created pickmap * @throws InvalidNameException if the pickmap name is invalid */ - public synchronized Pickmap<G, A, R, V> addPickmap(@NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent) throws InvalidNameException { - final Pickmap<G, A, R, V> pickmap = new Pickmap<G, A, R, V>(this, name, gridartaObjectsFactory, parent); + public synchronized Pickmap<G, A, R, V> addPickmap(@NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists) throws InvalidNameException { + final Pickmap<G, A, R, V> pickmap = new Pickmap<G, A, R, V>(this, name, gridartaObjectsFactory, parent, autojoinLists); pickmaps.add(pickmap); for (final FolderListener<G, A, R, V> listener : listeners.getListeners(FolderListener.class)) { listener.pickmapAdded(pickmap); Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -22,6 +22,7 @@ import java.awt.Component; import java.io.File; import java.util.Arrays; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -58,16 +59,24 @@ private final Component parent; /** + * The autojoin lists. + */ + @NotNull + private final AutojoinLists<G, A, R> autojoinLists; + + /** * Creates a new instance. * @param pickmapChooserModel the model to add the loaded pickmaps to * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> * @param parent the parent component for error messages * instance to use for loading pickmap files + * @param autojoinLists the autojoin lists */ - public Loader(@NotNull final PickmapChooserModel<G, A, R, V> pickmapChooserModel, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent) { + public Loader(@NotNull final PickmapChooserModel<G, A, R, V> pickmapChooserModel, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists) { this.pickmapChooserModel = pickmapChooserModel; this.gridartaObjectsFactory = gridartaObjectsFactory; this.parent = parent; + this.autojoinLists = autojoinLists; } /** Loads all pickmap files from a directory and its subdirectories. */ @@ -113,7 +122,7 @@ for (final File file : files) { if (file.isFile()) { try { - folder.addPickmap(file.getName(), gridartaObjectsFactory, this.parent); + folder.addPickmap(file.getName(), gridartaObjectsFactory, this.parent, autojoinLists); } catch (final InvalidNameException ex) { log.warn("ignoring pickmap with invalid name: " + file); } Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -23,6 +23,7 @@ import java.io.File; import java.io.IOException; import java.util.Collection; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -61,6 +62,12 @@ private final Component parent; /** + * The autojoin lists. + */ + @NotNull + private final AutojoinLists<G, A, R> autojoinLists; + + /** * The {@link MapControl} instance representing the map file, or * <code>null</code> if the map file is not loaded. */ @@ -81,9 +88,11 @@ * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> * instance for loading the map file * @param parent the parent component for error messages + * @param autojoinLists the autojoin lists * @throws InvalidNameException if <code>name</code> is not valid */ - public Pickmap(@NotNull final Folder<G, A, R, V> folder, @NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent) throws InvalidNameException { + public Pickmap(@NotNull final Folder<G, A, R, V> folder, @NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists) throws InvalidNameException { + this.autojoinLists = autojoinLists; if (!isValidPickmapName(name)) { throw new InvalidNameException(name); } @@ -151,7 +160,7 @@ decoder.close(); } - pickmap = gridartaObjectsFactory.newPickmapControl(decoder.getGameObjects(), decoder.getMapArchObject(), parent); + pickmap = gridartaObjectsFactory.newPickmapControl(decoder.getGameObjects(), decoder.getMapArchObject(), parent, autojoinLists); pickmap.setMapFile(file); pickmap.setMapFileName(file.getPath()); pickmap.resetModified(); Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -31,6 +31,7 @@ import javax.swing.JTabbedPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; @@ -76,6 +77,12 @@ private final MapManager<G, A, R, V> mapManager; /** + * The autojoin lists. + */ + @NotNull + private final AutojoinLists<G, A, R> autojoinLists; + + /** * The gridarta objects factory instance. */ @NotNull @@ -179,10 +186,12 @@ * @param gridartaObjectsFactory the gridarta objects factory instance * @param pickmapDir the pickmaps directory * @param mapManager the map manager instance + * @param autojoinLists the autojoin lists */ - public PickmapChooserControl(@NotNull final NewMapDialogFactory<G, A, R, V> newMapDialogFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final File pickmapDir, @NotNull final MapManager<G, A, R, V> mapManager) { + public PickmapChooserControl(@NotNull final NewMapDialogFactory<G, A, R, V> newMapDialogFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final File pickmapDir, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final AutojoinLists<G, A, R> autojoinLists) { this.mainControl = mainControl; this.mapManager = mapManager; + this.autojoinLists = autojoinLists; this.gridartaObjectsFactory = gridartaObjectsFactory; pickmapChooserModel = new PickmapChooserModel<G, A, R, V>(pickmapDir); folderListActions = new FolderListActions<G, A, R, V>(pickmapChooserModel, newMapDialogFactory); @@ -218,7 +227,7 @@ * Load all pickmaps and build the pickmap-panel. */ public void loadPickmaps() { - new Loader<G, A, R, V>(pickmapChooserModel, gridartaObjectsFactory, mainControl.getMainView()).load(); + new Loader<G, A, R, V>(pickmapChooserModel, gridartaObjectsFactory, mainControl.getMainView(), autojoinLists).load(); } /** @@ -259,7 +268,7 @@ } } - final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newPickmapControl(null, mapArchObject, mainControl.getMainView()); + final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newPickmapControl(null, mapArchObject, mainControl.getMainView(), autojoinLists); mapControl.setMapFile(mapFile); mapControl.setMapFileName(mapFile.getPath()); mapControl.resetModified(); @@ -267,7 +276,7 @@ final Pickmap<G, A, R, V> pickmap; try { - pickmap = activeFolder.addPickmap(pickmapName, gridartaObjectsFactory, mainControl.getMainView()); + pickmap = activeFolder.addPickmap(pickmapName, gridartaObjectsFactory, mainControl.getMainView(), autojoinLists); } catch (final InvalidNameException ex) { throw new AssertionError(); // the name has been checked before } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 21:29:39 UTC (rev 4868) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 21:40:56 UTC (rev 4869) @@ -851,7 +851,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent) { + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists) { throw new AssertionError(); } @@ -868,7 +868,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainView, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainView, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette) { throw new AssertionError(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 22:11:51
|
Revision: 4870 http://gridarta.svn.sourceforge.net/gridarta/?rev=4870&view=rev Author: akirschbaum Date: 2008-08-15 22:11:57 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/gameobject/anim/AnimationObject.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 21:40:56 UTC (rev 4869) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 22:11:57 UTC (rev 4870) @@ -24,7 +24,7 @@ import cfeditor.gameobject.ArchetypeParser; import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; -import cfeditor.gameobject.anim.AnimationObject; +import cfeditor.gameobject.anim.AnimationObjects; import cfeditor.gameobject.face.FaceObjects; import cfeditor.gameobject.scripts.ScriptArchUtils; import cfeditor.gameobject.scripts.ScriptedEvent; @@ -59,7 +59,6 @@ import net.sf.gridarta.archtype.ArchetypeTypeParser; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.archtype.ArchetypeTypeSetParser; -import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; @@ -214,8 +213,7 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl()); - final AnimationObjects<AnimationObject> animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); + super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects()); final ArchetypeSet archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-08-15 21:40:56 UTC (rev 4869) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-08-15 22:11:57 UTC (rev 4870) @@ -21,7 +21,6 @@ import cfeditor.CMainControl; import cfeditor.IGUIConstants; -import cfeditor.gameobject.anim.AnimationObject; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import java.io.BufferedReader; @@ -42,6 +41,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.AbstractArchetypeSet; +import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.anim.AnimationParseException; import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; @@ -81,7 +81,7 @@ private final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes; @NotNull - private final AnimationObjects<AnimationObject> animationObjects; + private final AnimationObjects<? extends AnimationObject> animationObjects; /** The FaceObjects instance to use. */ @NotNull @@ -104,7 +104,7 @@ * @param gridartaObjectsFactory the gridarta objects factory instance to * use */ - public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @Nullable final String imageSet, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { + public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @Nullable final String imageSet, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { super(gridartaObjectsFactory); this.mainControl = mainControl; this.globalSettings = globalSettings; Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java 2008-08-15 21:40:56 UTC (rev 4869) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java 2008-08-15 22:11:57 UTC (rev 4870) @@ -56,4 +56,9 @@ return null; // TODO } + /** {@inheritDoc} */ + public String getFirstFrame(final int facing) { + return null; + } + } // class AnimationObject Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 21:40:56 UTC (rev 4869) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 22:11:57 UTC (rev 4870) @@ -23,7 +23,7 @@ import daieditor.gameobject.ArchetypeParser; import daieditor.gameobject.ArchetypeSet; import daieditor.gameobject.GameObject; -import daieditor.gameobject.anim.AnimationObject; +import daieditor.gameobject.anim.AnimationObjects; import daieditor.gameobject.face.FaceObjects; import daieditor.gameobject.scripts.ScriptArchUtils; import daieditor.gameobject.scripts.ScriptedEvent; @@ -64,7 +64,6 @@ import net.sf.gridarta.archtype.ArchetypeTypeParser; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.archtype.ArchetypeTypeSetParser; -import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gameobject.match.GameObjectMatchers; @@ -269,8 +268,7 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl()); - final AnimationObjects<AnimationObject> animationObjects = new daieditor.gameobject.anim.AnimationObjects(); + super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects()); final ArchetypeSet archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); GameObject.setArchetypeSet(archetypeSet); ScriptedEvent.setArchetypeSet(archetypeSet); Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-08-15 21:40:56 UTC (rev 4869) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-08-15 22:11:57 UTC (rev 4870) @@ -21,7 +21,6 @@ import daieditor.CMainControl; import daieditor.IGUIConstants; -import daieditor.gameobject.anim.AnimationObject; import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; import java.io.BufferedReader; @@ -43,6 +42,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.AbstractArchetypeSet; +import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.anim.AnimationParseException; import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; @@ -85,7 +85,7 @@ private final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes; @NotNull - private final AnimationObjects<AnimationObject> animationObjects; + private final AnimationObjects<? extends AnimationObject> animationObjects; /** The FaceObjects instance to use. */ @NotNull @@ -108,7 +108,7 @@ * @param gridartaObjectsFactory the gridarta objects factory instance to * use */ - public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { + public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { super(gridartaObjectsFactory); this.mainControl = mainControl; this.globalSettings = globalSettings; Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-15 21:40:56 UTC (rev 4869) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-15 22:11:57 UTC (rev 4870) @@ -19,13 +19,13 @@ package daieditor.gameobject; -import daieditor.gameobject.anim.AnimationObject; import daieditor.gameobject.scripts.ScriptArchData; import daieditor.map.MapArchObject; import java.awt.Frame; import javax.swing.ImageIcon; import javax.swing.JList; import net.sf.gridarta.MapManager; +import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gui.gameobjectattributespanel.ScriptTab; @@ -54,7 +54,7 @@ private static final long serialVersionUID = 1; @Nullable - private static AnimationObjects<AnimationObject> animationObjects = null; + private static AnimationObjects<? extends AnimationObject> animationObjects = null; /** * Face name, can be from animation or face. This is determined by taking @@ -98,7 +98,7 @@ @Nullable private static ImageIcon noFace = null; - public static void setAnimationObjects(@Nullable final AnimationObjects<AnimationObject> animationObjects, @NotNull final ImageIcon noFace) { + public static void setAnimationObjects(@Nullable final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final ImageIcon noFace) { GameObject.animationObjects = animationObjects; GameObject.noFace = noFace; } Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java 2008-08-15 21:40:56 UTC (rev 4869) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java 2008-08-15 22:11:57 UTC (rev 4870) @@ -95,11 +95,7 @@ return frameCount; } - /** - * Get the first frame. - * @param facing facing to get frame for, usually a direction - * @return frame - */ + /** {@inheritDoc} */ public String getFirstFrame(final int facing) { return getFrame(facing, 0); } Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 21:40:56 UTC (rev 4869) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 22:11:57 UTC (rev 4870) @@ -29,6 +29,8 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.anim.AnimationObject; +import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.StatusBar; @@ -94,6 +96,12 @@ /** The map manager. */ protected final MapManager<G, A, R, V> mapManager; + /** + * The animation objects instance. + */ + @NotNull + protected final AnimationObjects<? extends AnimationObject> animationObjects; + /** The updater instance. */ protected UpdaterManager updaterManager = null; @@ -106,12 +114,13 @@ * @param key The action factory key * @param globalSettings the global settings instance */ - protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings) { + protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects) { this.globalSettings = globalSettings; final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, globalSettings, autojoinLists); editTypes = new EditTypes<G, A, R, V>(tmpMapManager); tmpMapManager.setEditTypes(editTypes); mapManager = tmpMapManager; + this.animationObjects = animationObjects; copyBuffer = new CopyBuffer<G, A, R, V>(this, editTypes, gridartaObjectsFactory, autojoinLists); this.gridartaObjectsFactory = gridartaObjectsFactory; globalSettings.readGlobalSettings(); Modified: trunk/src/app/net/sf/gridarta/gameobject/anim/AnimationObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/anim/AnimationObject.java 2008-08-15 21:40:56 UTC (rev 4869) +++ trunk/src/app/net/sf/gridarta/gameobject/anim/AnimationObject.java 2008-08-15 22:11:57 UTC (rev 4870) @@ -49,4 +49,11 @@ */ int getFacings(); + /** + * Get the first frame. + * @param facing facing to get frame for, usually a direction + * @return frame + */ + String getFirstFrame(int facing); + } // interface AnimationObject Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 21:40:56 UTC (rev 4869) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 22:11:57 UTC (rev 4870) @@ -25,6 +25,8 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; +import java.io.Reader; +import java.util.Iterator; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; @@ -43,12 +45,18 @@ import net.sf.gridarta.MapImageCache; import net.sf.gridarta.MapManager; import net.sf.gridarta.Size2D; +import net.sf.gridarta.data.NamedTreeNode; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.AbstractArchetypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.anim.AbstractAnimationObject; +import net.sf.gridarta.gameobject.anim.AnimationObject; +import net.sf.gridarta.gameobject.anim.AnimationObjects; +import net.sf.gridarta.gameobject.anim.AnimationParseException; +import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; @@ -382,7 +390,8 @@ public void setUp() { gridartaObjectsFactory = new TestGridartaObjectsFactory(); final GlobalSettings globalSettings = new TestGlobalSettings(); - final TestMainControl mainControl = new TestMainControl(gridartaObjectsFactory, "test", globalSettings); + final AnimationObjects<TestAnimationObject> animationObjects = new TestAnimationObjects(); + final TestMainControl mainControl = new TestMainControl(gridartaObjectsFactory, "test", globalSettings, animationObjects); final TestMapArchObject mapArchObject = new TestMapArchObject(); final TestArchetypeSet archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(archetypeSet); @@ -408,9 +417,10 @@ * @param gridartaObjectsFactory the gridaarta objects factory to use * @param key the action factory key to use * @param globalSettings the global settings instance to use + * @param animationObjects the animation objects instance to use */ - protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings) { - super(gridartaObjectsFactory, key, globalSettings); + protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<TestAnimationObject> animationObjects) { + super(gridartaObjectsFactory, key, globalSettings, animationObjects); } /** {@inheritDoc} */ @@ -944,4 +954,104 @@ } + /** + * An {@link AnimationObject} implementation for testing purposes. + */ + private static class TestAnimationObject extends AbstractAnimationObject { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1; + + /** + * Creates a new instance. + * @param animName name of the animation + * @param animList list of animations + * @param path the path + */ + protected TestAnimationObject(final String animName, final String animList, final String path) { + super(animName, animList, path); + } + + /** {@inheritDoc} */ + @Nullable + public ImageIcon getDisplayIcon() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public String getFirstFrame(final int facing) { + throw new AssertionError(); + } + + } + + /** + * An {@link AnimationObjects} implementation for testing purposes. + */ + private static class TestAnimationObjects implements AnimationObjects<TestAnimationObject> { + + /** {@inheritDoc} */ + public void addAnimationObject(final String animName, final String list) throws DuplicateAnimationException { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void addAnimPath(final String name, final String path) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void loadAnims(final File animFile, @NotNull final String startKey, final boolean ignoreOtherText) throws FileNotFoundException, IOException, AnimationParseException, DuplicateAnimationException { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void loadAnims(final Reader reader, @NotNull final String startKey, final boolean ignoreOtherText, @Nullable final String path) throws IOException, AnimationParseException, DuplicateAnimationException { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void loadAnimTree(final File animTreeFile) throws FileNotFoundException, IOException { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void collect(@NotNull final Progress progress, @NotNull final File dir) throws IOException { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public NamedTreeNode<TestAnimationObject> getTreeRoot() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public int size() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public TestAnimationObject get(final String objectName) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public boolean containsKey(final String name) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public Iterator<TestAnimationObject> iterator() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public String showNodeChooserDialog(final Component parentComponent, final String initial) { + 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-15 22:43:58
|
Revision: 4871 http://gridarta.svn.sourceforge.net/gridarta/?rev=4871&view=rev Author: akirschbaum Date: 2008-08-15 22:44:04 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/FileControl.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBox.java trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxEditor.java trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxModel.java trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java trunk/crossfire/src/cfeditor/gui/script/parameter/MyCellRenderer.java trunk/crossfire/src/cfeditor/script/ScriptController.java trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java trunk/crossfire/src/cfeditor/script/parameter/PluginParameterFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/FileControl.java trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -214,7 +214,7 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects()); - final ArchetypeSet archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); + archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); @@ -341,7 +341,7 @@ globalSettings.setAutoPopupDocu(false); } - net.sf.gridarta.gameobject.GameObject.initialize(archetypeTypeSet, gameObjectMatchers); + net.sf.gridarta.gameobject.GameObject.initialize(archetypeSet, archetypeTypeSet, gameObjectMatchers); copyBuffer.init(gridartaObjectsFactory.newMapArchObject(false)); mainActions.init(); Modified: trunk/crossfire/src/cfeditor/FileControl.java =================================================================== --- trunk/crossfire/src/cfeditor/FileControl.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/crossfire/src/cfeditor/FileControl.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -20,7 +20,6 @@ package cfeditor; import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; @@ -31,6 +30,7 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.MapManager; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.map.MapControl; @@ -53,7 +53,7 @@ * The archetype set. */ @NotNull - private final ArchetypeSet archetypeSet; + private final ArchetypeSet<?, ?, ?> archetypeSet; /** * The map preview accessory. @@ -105,7 +105,7 @@ * @param scriptFileFilter the script file filter * @param newMapDialogFactory the new map dialog factory */ - public FileControl(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeSet archetypeSet, @NotNull final MapPreviewAccessory mapPreviewAccessory, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final Component parent, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory) { + public FileControl(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeSet<?, ?, ?> archetypeSet, @NotNull final MapPreviewAccessory mapPreviewAccessory, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final Component parent, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory) { this.globalSettings = globalSettings; this.archetypeSet = archetypeSet; this.mapPreviewAccessory = mapPreviewAccessory; Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -27,6 +27,7 @@ import java.util.List; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.AbstractArchetypeParser; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; @@ -59,7 +60,7 @@ /** The archetype set. */ @NotNull - private final ArchetypeSet archetypeSet; + private final ArchetypeSet<?, ?, Archetype> archetypeSet; /** The archetype chooser to add parsed archetypes to. */ private final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl; @@ -73,7 +74,7 @@ * @param animationObjects the animation objects instance to use * @param archetypeSet the archetype set */ - public ArchetypeParser(final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, final AnimationObjects<?> animationObjects, @NotNull final ArchetypeSet archetypeSet) { + public ArchetypeParser(final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, final AnimationObjects<?> animationObjects, @NotNull final ArchetypeSet<?, ?, Archetype> archetypeSet) { this.gridartaObjectsFactory = gridartaObjectsFactory; this.archetypeChooserControl = archetypeChooserControl; this.animationObjects = animationObjects; Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBox.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBox.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBox.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -20,11 +20,11 @@ package cfeditor.gui.script.parameter; import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; import java.awt.Dimension; import javax.swing.JComboBox; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import org.apache.log4j.Logger; @@ -41,7 +41,7 @@ private final ArchComboBoxModel archComboBoxModel; - public ArchComboBox(@NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ArchetypeSet archetypeSet, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser) { + public ArchComboBox(@NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ArchetypeSet<?, ?, Archetype> archetypeSet, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser) { setMaximumRowCount(4); archComboBoxModel = new ArchComboBoxModel(archetypeSet); archComboBoxEditor = new ArchComboBoxEditor(this, archComboBoxModel, objectChooser, gameObjectAttributesModel, archetypeSet); Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxEditor.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxEditor.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -20,7 +20,6 @@ package cfeditor.gui.script.parameter; import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; import java.awt.Color; @@ -43,6 +42,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import net.sf.gridarta.CommonConstants; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import org.jetbrains.annotations.Nullable; @@ -57,7 +57,7 @@ private final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel; - private final ArchetypeSet archetypeSet; + private final ArchetypeSet<?, ?, Archetype> archetypeSet; private JPanel editorPanel = null; @@ -69,7 +69,7 @@ private boolean locked = false; - public ArchComboBoxEditor(final ArchComboBox archComboBox, final ArchComboBoxModel archComboBoxModel, final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, final ArchetypeSet archetypeSet) { + public ArchComboBoxEditor(final ArchComboBox archComboBox, final ArchComboBoxModel archComboBoxModel, final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, final ArchetypeSet<?, ?, Archetype> archetypeSet) { this.archComboBox = archComboBox; this.archComboBoxModel = archComboBoxModel; this.objectChooser = objectChooser; Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxModel.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxModel.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxModel.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -20,12 +20,12 @@ package cfeditor.gui.script.parameter; import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.ArchetypeSet; import java.util.Arrays; import java.util.Collection; import java.util.Comparator; import javax.swing.AbstractListModel; import javax.swing.ComboBoxModel; +import net.sf.gridarta.gameobject.ArchetypeSet; public class ArchComboBoxModel extends AbstractListModel implements ComboBoxModel { @@ -38,7 +38,7 @@ private static final long serialVersionUID = 1L; - public ArchComboBoxModel(final ArchetypeSet archetypeSet) { + public ArchComboBoxModel(final ArchetypeSet<?, ?, Archetype> archetypeSet) { final Collection<Archetype> archetypes = archetypeSet.getArchetypes(); archList = archetypes.toArray(new Archetype[archetypes.size()]); Arrays.sort(archList, new Comparator<Archetype>() { Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -20,7 +20,6 @@ package cfeditor.gui.script.parameter; import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; import cfeditor.script.parameter.ArchParameter; @@ -29,6 +28,7 @@ import java.awt.event.ItemListener; import javax.swing.JComponent; import javax.swing.JPanel; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import org.jetbrains.annotations.NotNull; @@ -49,7 +49,7 @@ return this.value; } - public ArchParameterView(final ArchParameter param, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ArchetypeSet archetypeSet, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser) { + public ArchParameterView(final ArchParameter param, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ArchetypeSet<?, ?, Archetype> archetypeSet, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser) { value = new ArchComboBox(gameObjectAttributesModel, archetypeSet, objectChooser); parameter = param; value.setSelectedItem(param.getValue()); Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/MyCellRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/MyCellRenderer.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/MyCellRenderer.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -20,10 +20,11 @@ package cfeditor.gui.script.parameter; import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.ArchetypeSet; import java.awt.Component; import javax.swing.DefaultListCellRenderer; import javax.swing.JList; +import net.sf.gridarta.gameobject.ArchetypeSet; +import org.jetbrains.annotations.NotNull; class MyCellRenderer extends DefaultListCellRenderer { @@ -31,16 +32,21 @@ private static final long serialVersionUID = 1L; + @NotNull private final ArchComboBoxEditor archComboBoxEditor; - private final ArchetypeSet archetypeSet; + /** + * The archetype set to use. + */ + @NotNull + private final ArchetypeSet<?, ?, Archetype> archetypeSet; /** * Creates a new instance. * @param archComboBoxEditor the instance to use - * @param archetypeSet the instance to use + * @param archetypeSet the archetype set to use */ - public MyCellRenderer(final ArchComboBoxEditor archComboBoxEditor, final ArchetypeSet archetypeSet) { + public MyCellRenderer(@NotNull final ArchComboBoxEditor archComboBoxEditor, @NotNull final ArchetypeSet<?, ?, Archetype> archetypeSet) { this.archComboBoxEditor = archComboBoxEditor; this.archetypeSet = archetypeSet; } Modified: trunk/crossfire/src/cfeditor/script/ScriptController.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -26,7 +26,6 @@ import cfeditor.CFilterControl; import cfeditor.CMainControl; import cfeditor.filter.Filter; -import cfeditor.gameobject.ArchetypeSet; import cfeditor.gui.script.ScriptView; import java.awt.Component; import java.io.CharArrayWriter; @@ -42,6 +41,7 @@ import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.event.EventListenerList; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; import org.jdom.Document; @@ -78,13 +78,13 @@ @NotNull private final CFilterControl filterControl; - private final ArchetypeSet archetypeSet; + private final ArchetypeSet<?, ?, ?> archetypeSet; /** The default directory for saving scripts. */ @Nullable private File scriptsDir = null; - public ScriptController(final CMainControl mainControl, @NotNull final CFilterControl filterControl, final ArchetypeSet archetypeSet, @NotNull final Component parent) { + public ScriptController(final CMainControl mainControl, @NotNull final CFilterControl filterControl, final ArchetypeSet<?, ?, ?> archetypeSet, @NotNull final Component parent) { this.mainControl = mainControl; this.filterControl = filterControl; this.archetypeSet = archetypeSet; Modified: trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -20,11 +20,11 @@ package cfeditor.script.parameter; import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; import cfeditor.gui.script.parameter.ArchParameterView; import cfeditor.gui.script.parameter.PluginParameterView; import cfeditor.map.MapArchObject; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import org.jdom.Element; @@ -33,7 +33,7 @@ public class ArchParameter extends PluginParameter { @NotNull - private static ArchetypeSet archetypeSet; + private static ArchetypeSet<?, ?, Archetype> archetypeSet; private String valueString; @@ -47,7 +47,7 @@ super(getParameterType()); } - public static void init(@NotNull final ArchetypeSet archetypeSet, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser) { + public static void init(@NotNull final ArchetypeSet<?, ?, Archetype> archetypeSet, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser) { ArchParameter.archetypeSet = archetypeSet; ArchParameter.gameObjectAttributesModel = gameObjectAttributesModel; ArchParameter.objectChooser = objectChooser; Modified: trunk/crossfire/src/cfeditor/script/parameter/PluginParameterFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/PluginParameterFactory.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/crossfire/src/cfeditor/script/parameter/PluginParameterFactory.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -20,13 +20,13 @@ package cfeditor.script.parameter; import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import java.util.LinkedHashMap; import java.util.Map; import net.sf.gridarta.MapManager; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import org.apache.log4j.Logger; @@ -45,7 +45,7 @@ private static final Map<String, Class<? extends PluginParameter>> parameterTypes = new LinkedHashMap<String, Class<? extends PluginParameter>>(); - public static void init(@NotNull final ArchetypeSet archetypeSet, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager) { + public static void init(@NotNull final ArchetypeSet<?, ?, Archetype> archetypeSet, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager) { ArchParameter.init(archetypeSet, gameObjectAttributesModel, objectChooser); MapParameter.init(mapManager); parameterTypes.put(StringParameter.getParameterType(), StringParameter.class); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -269,8 +269,7 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects()); - final ArchetypeSet archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); - GameObject.setArchetypeSet(archetypeSet); + archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); @@ -396,7 +395,7 @@ globalSettings.setAutoPopupDocu(false); } - net.sf.gridarta.gameobject.GameObject.initialize(archetypeTypeSet, gameObjectMatchers); + net.sf.gridarta.gameobject.GameObject.initialize(archetypeSet, archetypeTypeSet, gameObjectMatchers); copyBuffer.init(gridartaObjectsFactory.newMapArchObject(false)); mainActions.init(); Modified: trunk/daimonin/src/daieditor/FileControl.java =================================================================== --- trunk/daimonin/src/daieditor/FileControl.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/daimonin/src/daieditor/FileControl.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -20,7 +20,6 @@ package daieditor; import daieditor.gameobject.Archetype; -import daieditor.gameobject.ArchetypeSet; import daieditor.gameobject.GameObject; import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; @@ -31,6 +30,7 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.MapManager; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.map.MapControl; @@ -53,7 +53,7 @@ * The archetype set. */ @NotNull - private final ArchetypeSet archetypeSet; + private final ArchetypeSet<?, ?, ?> archetypeSet; /** * The map preview accessory. @@ -105,7 +105,7 @@ * @param scriptFileFilter the script file filter * @param newMapDialogFactory the new map dialog factory */ - public FileControl(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeSet archetypeSet, @NotNull final MapPreviewAccessory mapPreviewAccessory, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final Component parent, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory) { + public FileControl(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeSet<?, ?, ?> archetypeSet, @NotNull final MapPreviewAccessory mapPreviewAccessory, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final Component parent, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory) { this.globalSettings = globalSettings; this.archetypeSet = archetypeSet; this.mapPreviewAccessory = mapPreviewAccessory; Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -27,6 +27,7 @@ import java.io.IOException; import java.util.List; import net.sf.gridarta.gameobject.AbstractArchetypeParser; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; @@ -57,7 +58,7 @@ /** The archetype set. */ @NotNull - private final ArchetypeSet archetypeSet; + private final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; /** The archetype chooser to add parsed archetypes to. */ private final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl; @@ -69,7 +70,7 @@ * @param animationObjects the animation objects instance to use * @param archetypeSet the archetype set */ - public ArchetypeParser(final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, final AnimationObjects<?> animationObjects, @NotNull final ArchetypeSet archetypeSet) { + public ArchetypeParser(final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, final AnimationObjects<?> animationObjects, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { this.archetypeChooserControl = archetypeChooserControl; this.animationObjects = animationObjects; this.archetypeSet = archetypeSet; Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -25,6 +25,7 @@ import javax.swing.ImageIcon; import javax.swing.JList; import net.sf.gridarta.MapManager; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; @@ -103,13 +104,6 @@ GameObject.noFace = noFace; } - @Nullable - private static ArchetypeSet archetypeSet = null; - - public static void setArchetypeSet(@Nullable final ArchetypeSet archetypeSet) { - GameObject.archetypeSet = archetypeSet; - } - /** {@inheritDoc} */ public int getMultiShapeID() { return multi != null ? multi.getMultiShapeID() : 0; @@ -267,8 +261,8 @@ faceObjSource = FaceSource.FACE_NOT_FOUND; } if (!isArchetype()) { - normalFace = archetypeSet.getFace(this); - transFace = archetypeSet.getTrans(this); + normalFace = ((ArchetypeSet<GameObject, MapArchObject, Archetype>) (ArchetypeSet) archetypeSet).getFace(this); + transFace = ((daieditor.gameobject.ArchetypeSet) (ArchetypeSet) archetypeSet).getTrans(this); } } Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -28,6 +28,7 @@ import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -102,6 +103,11 @@ @NotNull protected final AnimationObjects<? extends AnimationObject> animationObjects; + /** + * The archetype set to use. + */ + protected ArchetypeSet<G, A, R> archetypeSet; + /** The updater instance. */ protected UpdaterManager updaterManager = null; Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-08-15 22:11:57 UTC (rev 4870) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-08-15 22:44:04 UTC (rev 4871) @@ -57,6 +57,11 @@ */ protected static final Pattern lineSeparatorPattern = Pattern.compile("\n"); + /** + * The archetype set to use. + */ + protected static ArchetypeSet<?, ?, ?> archetypeSet = null; + /** Static reference to the ArchetypeTypeSet (find syntax errors). */ protected static ArchetypeTypeSet archetypeTypeSet = null; @@ -184,10 +189,12 @@ /** * Sets the {@link ArchetypeTypeSet} that should be used for finding syntax * errors. + * @param archetypeSet the archetype set to use * @param archetypeTypeSet the archetype type set to use * @param gameObjectMatchers the instance to use */ - public static void initialize(final ArchetypeTypeSet archetypeTypeSet, final GameObjectMatchers gameObjectMatchers) { + public static void initialize(@Nullable final ArchetypeSet<?, ?, ?> archetypeSet, final ArchetypeTypeSet archetypeTypeSet, final GameObjectMatchers gameObjectMatchers) { + GameObject.archetypeSet = archetypeSet; GameObject.archetypeTypeSet = archetypeTypeSet; GameObject.gameObjectMatchers = gameObjectMatchers; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 22:49:08
|
Revision: 4872 http://gridarta.svn.sourceforge.net/gridarta/?rev=4872&view=rev Author: akirschbaum Date: 2008-08-15 22:49:17 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 22:44:04 UTC (rev 4871) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 22:49:17 UTC (rev 4872) @@ -166,9 +166,6 @@ /** The main view. */ private final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView; - /** The Face Objects. */ - private final FaceObjects faceObjects = new FaceObjects(); - /** The Spells. */ private final Spells<NumberSpell> numberSpells = new Spells<NumberSpell>(); @@ -213,7 +210,7 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects()); + super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 22:44:04 UTC (rev 4871) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 22:49:17 UTC (rev 4872) @@ -209,9 +209,6 @@ /** Bit field of edit types to show transparent. */ private int alphaType; - /** The Face Objects. */ - private final FaceObjects faceObjects = new FaceObjects(); - /** The Spells. */ private final daieditor.spells.Spells numberSpells = new daieditor.spells.Spells(); @@ -268,7 +265,7 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects()); + super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 22:44:04 UTC (rev 4871) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 22:49:17 UTC (rev 4872) @@ -32,6 +32,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.StatusBar; @@ -104,6 +105,12 @@ protected final AnimationObjects<? extends AnimationObject> animationObjects; /** + * The face objects instance. + */ + @NotNull + protected final FaceObjects faceObjects; + + /** * The archetype set to use. */ protected ArchetypeSet<G, A, R> archetypeSet; @@ -119,14 +126,17 @@ * @param gridartaObjectsFactory the gridarta objects factory * @param key The action factory key * @param globalSettings the global settings instance + * @param animationObjects the animation objects instance + * @param faceObjects the face objects instance */ - protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects) { + protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { this.globalSettings = globalSettings; final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, globalSettings, autojoinLists); editTypes = new EditTypes<G, A, R, V>(tmpMapManager); tmpMapManager.setEditTypes(editTypes); mapManager = tmpMapManager; this.animationObjects = animationObjects; + this.faceObjects = faceObjects; copyBuffer = new CopyBuffer<G, A, R, V>(this, editTypes, gridartaObjectsFactory, autojoinLists); this.gridartaObjectsFactory = gridartaObjectsFactory; globalSettings.readGlobalSettings(); Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 22:44:04 UTC (rev 4871) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 22:49:17 UTC (rev 4872) @@ -57,7 +57,9 @@ import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.anim.AnimationParseException; import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; +import net.sf.gridarta.gameobject.face.AbstractFaceObjects; import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gameobject.face.DuplicateFaceException; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; @@ -391,7 +393,8 @@ gridartaObjectsFactory = new TestGridartaObjectsFactory(); final GlobalSettings globalSettings = new TestGlobalSettings(); final AnimationObjects<TestAnimationObject> animationObjects = new TestAnimationObjects(); - final TestMainControl mainControl = new TestMainControl(gridartaObjectsFactory, "test", globalSettings, animationObjects); + final FaceObjects faceObjects = new TestFaceObjects(); + final TestMainControl mainControl = new TestMainControl(gridartaObjectsFactory, "test", globalSettings, animationObjects, faceObjects); final TestMapArchObject mapArchObject = new TestMapArchObject(); final TestArchetypeSet archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(archetypeSet); @@ -418,9 +421,10 @@ * @param key the action factory key to use * @param globalSettings the global settings instance to use * @param animationObjects the animation objects instance to use + * @param faceObjects the face objects instance to use */ - protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<TestAnimationObject> animationObjects) { - super(gridartaObjectsFactory, key, globalSettings, animationObjects); + protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<TestAnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { + super(gridartaObjectsFactory, key, globalSettings, animationObjects, faceObjects); } /** {@inheritDoc} */ @@ -1054,4 +1058,26 @@ } + /** + * A {@link FaceObjects} implementation for testing purposes. + */ + private static class TestFaceObjects extends AbstractFaceObjects { + + /** {@inheritDoc} */ + protected void collectTreeFile(@NotNull final Progress progress, @NotNull final File dir) throws IOException { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + protected String getPngFile() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void loadFacesCollection(final File faceFile, final File treeFile) throws IOException, FileNotFoundException, DuplicateFaceException { + throw new AssertionError(); + } + + } + } // class DefaultMapModelTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-15 22:58:13
|
Revision: 4873 http://gridarta.svn.sourceforge.net/gridarta/?rev=4873&view=rev Author: akirschbaum Date: 2008-08-15 22:58:22 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 22:49:17 UTC (rev 4872) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 22:58:22 UTC (rev 4873) @@ -55,6 +55,9 @@ import net.sf.gridarta.CommonConstants; import net.sf.gridarta.MainControl; import net.sf.gridarta.XmlHelper; +import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.EditTypes; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.archtype.ArchetypeAttributeParser; import net.sf.gridarta.archtype.ArchetypeTypeParser; import net.sf.gridarta.archtype.ArchetypeTypeSet; @@ -63,6 +66,7 @@ import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; +import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.LeftPanel; @@ -211,7 +215,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); - archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); @@ -674,4 +677,11 @@ createImageWanted(mapViewManager.getCurrentMapView(), new File(outfile)); // create map image } + /** {@inheritDoc} */ + @NotNull + @Override + protected net.sf.gridarta.gameobject.ArchetypeSet<GameObject, MapArchObject, Archetype> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final net.sf.gridarta.gameobject.anim.AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final net.sf.gridarta.gameobject.face.FaceObjects faceObjects, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { + return new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); + } + } // class CMainControl Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 22:49:17 UTC (rev 4872) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 22:58:22 UTC (rev 4873) @@ -60,6 +60,9 @@ import net.sf.gridarta.CommonConstants; import net.sf.gridarta.MainControl; import net.sf.gridarta.XmlHelper; +import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.EditTypes; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.archtype.ArchetypeAttributeParser; import net.sf.gridarta.archtype.ArchetypeTypeParser; import net.sf.gridarta.archtype.ArchetypeTypeSet; @@ -71,6 +74,7 @@ import net.sf.gridarta.gameobject.match.MutableOrGameObjectMatcher; import net.sf.gridarta.gameobject.match.ViewGameObjectMatcherManager; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; +import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.LeftPanel; @@ -266,7 +270,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); - archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); @@ -937,4 +940,11 @@ } } + /** {@inheritDoc} */ + @NotNull + @Override + protected ArchetypeSet newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final net.sf.gridarta.gameobject.anim.AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final net.sf.gridarta.gameobject.face.FaceObjects faceObjects, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { + return new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); + } + } // class CMainControl Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 22:49:17 UTC (rev 4872) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 22:58:22 UTC (rev 4873) @@ -113,7 +113,8 @@ /** * The archetype set to use. */ - protected ArchetypeSet<G, A, R> archetypeSet; + @NotNull + protected final ArchetypeSet<G, A, R> archetypeSet; /** The updater instance. */ protected UpdaterManager updaterManager = null; @@ -141,9 +142,23 @@ this.gridartaObjectsFactory = gridartaObjectsFactory; globalSettings.readGlobalSettings(); ScriptedEventEditor.setGlobalSettings(globalSettings); + archetypeSet = newArchetypeSet(globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); } /** + * Creates an {@link ArchetypeSet} instance. + * @param globalSettings the global settigns instance + * @param editTypes the edit types instance + * @param animationObjects the animations to use + * @param faceObjects the FaceObjects instance to use + * @param gridartaObjectsFactory the gridarta objects factory instance to + * use + * @return the archetype set instance + */ + @NotNull + protected abstract ArchetypeSet<G, A, R> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory); + + /** * Create the cache instance for map images. * @param baseDir The base directory to store the cached files. * @param defaultIcon The default icon to return if no icon can be created Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 22:49:17 UTC (rev 4872) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 22:58:22 UTC (rev 4873) @@ -468,6 +468,14 @@ public ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> getObjectChooser() { throw new AssertionError(); } + + /** {@inheritDoc} */ + @NotNull + @Override + protected ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory) { + 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-15 23:05:40
|
Revision: 4874 http://gridarta.svn.sourceforge.net/gridarta/?rev=4874&view=rev Author: akirschbaum Date: 2008-08-15 23:05:48 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptedEvent.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptedEvent.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEvent.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 22:58:22 UTC (rev 4873) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 23:05:48 UTC (rev 4874) @@ -27,7 +27,6 @@ import cfeditor.gameobject.anim.AnimationObjects; import cfeditor.gameobject.face.FaceObjects; import cfeditor.gameobject.scripts.ScriptArchUtils; -import cfeditor.gameobject.scripts.ScriptedEvent; import cfeditor.gui.GameObjectAttributesControl; import cfeditor.gui.map.CMapViewBasic; import cfeditor.gui.prefs.GUIPrefs; @@ -53,20 +52,20 @@ import javax.xml.parsers.ParserConfigurationException; import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.CommonConstants; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.XmlHelper; -import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.EditTypes; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MainControl; +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; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; -import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.LeftPanel; @@ -215,7 +214,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); - ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptedEvent.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptedEvent.java 2008-08-15 22:58:22 UTC (rev 4873) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptedEvent.java 2008-08-15 23:05:48 UTC (rev 4874) @@ -21,15 +21,12 @@ import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; -import cfeditor.map.MapArchObject; -import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeNameException; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeTypeException; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Class which stores information about one scripted event. @@ -40,9 +37,6 @@ /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(ScriptedEvent.class); - @Nullable - private static ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; - /** The underlying game object that represents the event. */ private final GameObject event; @@ -68,10 +62,6 @@ setEventData(pluginName, scriptPath, options); } - public static void setArchetypeSet(@Nullable final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - ScriptedEvent.archetypeSet = archetypeSet; - } - /** * Validate this event object: Check if there is sufficient data. * @return true if this object is valid, otherwise false @@ -184,7 +174,7 @@ if (archetypeSet == null) { throw new UndefinedEventArchetypeNameException(eventArchetypeName); } - final Archetype eventArchetype = archetypeSet.getArchetype(eventArchetypeName); + final Archetype eventArchetype = (Archetype) (Object) archetypeSet.getArchetype(eventArchetypeName); if (eventArchetype == null) { throw new UndefinedEventArchetypeNameException(eventArchetypeName); } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 22:58:22 UTC (rev 4873) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 23:05:48 UTC (rev 4874) @@ -26,7 +26,6 @@ import daieditor.gameobject.anim.AnimationObjects; import daieditor.gameobject.face.FaceObjects; import daieditor.gameobject.scripts.ScriptArchUtils; -import daieditor.gameobject.scripts.ScriptedEvent; import daieditor.gui.GameObjectAttributesControl; import daieditor.gui.map.CMapViewBasic; import daieditor.gui.prefs.AppPrefs; @@ -58,15 +57,16 @@ import javax.xml.parsers.ParserConfigurationException; import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.CommonConstants; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.XmlHelper; -import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.EditTypes; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MainControl; +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; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gameobject.match.GameObjectMatchers; @@ -74,7 +74,6 @@ import net.sf.gridarta.gameobject.match.MutableOrGameObjectMatcher; import net.sf.gridarta.gameobject.match.ViewGameObjectMatcherManager; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; -import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.LeftPanel; @@ -270,7 +269,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); - ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); ACTION_FACTORY.createToggles(true, this, "drawDouble"); Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptedEvent.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptedEvent.java 2008-08-15 22:58:22 UTC (rev 4873) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptedEvent.java 2008-08-15 23:05:48 UTC (rev 4874) @@ -21,14 +21,11 @@ import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; -import daieditor.map.MapArchObject; -import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeNameException; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeTypeException; import org.apache.log4j.Logger; -import org.jetbrains.annotations.Nullable; /** * Class which stores information about one scripted event. @@ -39,9 +36,6 @@ /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(ScriptedEvent.class); - @Nullable - private static ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet; - /** The underlying game object that represents the event. */ private final GameObject event; @@ -67,10 +61,6 @@ setEventData(pluginName, scriptPath, options); } - public static void setArchetypeSet(@Nullable final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { - ScriptedEvent.archetypeSet = archetypeSet; - } - /** * Validate this event object: Check if there is sufficient data. * @return true if this object is valid, otherwise false @@ -180,7 +170,7 @@ if (archetypeSet == null) { throw new UndefinedEventArchetypeNameException(eventArchetypeName); } - final Archetype eventArchetype = archetypeSet.getArchetype(eventArchetypeName); + final Archetype eventArchetype = (Archetype) (Object) archetypeSet.getArchetype(eventArchetypeName); if (eventArchetype == null) { throw new UndefinedEventArchetypeNameException(eventArchetypeName); } Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 22:58:22 UTC (rev 4873) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-15 23:05:48 UTC (rev 4874) @@ -33,6 +33,7 @@ import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gameobject.scripts.ScriptedEvent; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.StatusBar; @@ -143,6 +144,7 @@ globalSettings.readGlobalSettings(); ScriptedEventEditor.setGlobalSettings(globalSettings); archetypeSet = newArchetypeSet(globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); + ScriptedEvent.init(archetypeSet); } /** Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEvent.java 2008-08-15 22:58:22 UTC (rev 4873) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEvent.java 2008-08-15 23:05:48 UTC (rev 4874) @@ -19,7 +19,9 @@ package net.sf.gridarta.gameobject.scripts; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; +import org.jetbrains.annotations.Nullable; /** * Class which stores information about one scripted event. @@ -28,6 +30,12 @@ public abstract class ScriptedEvent<G extends GameObject<G, ?, ?>> { /** + * The archetype set to use. + */ + @Nullable + protected static ArchetypeSet<?, ?, ?> archetypeSet; + + /** * Set event path and plugin name according to user input from popup * dialog. */ @@ -47,4 +55,12 @@ public abstract int getEventType(); + /** + * Initializes the module. + * @param archetypeSet the archetype set to use + */ + public static void init(@Nullable final ArchetypeSet<?, ?, ?> archetypeSet) { + ScriptedEvent.archetypeSet = archetypeSet; + } + } // class ScriptedEvent This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-16 06:56:54
|
Revision: 4875 http://gridarta.svn.sourceforge.net/gridarta/?rev=4875&view=rev Author: akirschbaum Date: 2008-08-16 06:57:03 +0000 (Sat, 16 Aug 2008) Log Message: ----------- Move code from MainView to CMainControl. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/MainView.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 23:05:48 UTC (rev 4874) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 06:57:03 UTC (rev 4875) @@ -99,6 +99,7 @@ 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.help.Help; import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.AutoValidator; @@ -453,8 +454,9 @@ fileControl.openFileWanted(false); } + /** Open the online help window. */ public void onlineHelp() { - mainView.openHelpWindow(); + new Help(mainView, null).setVisible(true); } /** Swing FileFilter for map files. */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 23:05:48 UTC (rev 4874) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 06:57:03 UTC (rev 4875) @@ -108,6 +108,7 @@ 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.help.Help; import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.AutoValidator; @@ -623,8 +624,9 @@ mapManager.refreshCurrentMap(); } + /** Open the online help window. */ public void onlineHelp() { - mainView.openHelpWindow(); + new Help(mainView, null).setVisible(true); } /** Swing FileFilter for map files. */ Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-15 23:05:48 UTC (rev 4874) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-16 06:57:03 UTC (rev 4875) @@ -56,7 +56,6 @@ import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.utils.GUIUtils; import net.sf.gridarta.gui.utils.MenuUtils; -import net.sf.gridarta.help.Help; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; @@ -282,11 +281,6 @@ mapViewManager.addMapViewManagerListener(mapViewManagerListener); } - /** Open the online help window. */ - public void openHelpWindow() { - new Help(this, null).setVisible(true); - } - /** * Sets the given level view as the current one. * @param mapView The new current level view. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-16 07:01:08
|
Revision: 4876 http://gridarta.svn.sourceforge.net/gridarta/?rev=4876&view=rev Author: akirschbaum Date: 2008-08-16 07:01:17 +0000 (Sat, 16 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-16 06:57:03 UTC (rev 4875) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 07:01:17 UTC (rev 4876) @@ -99,7 +99,6 @@ 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.help.Help; import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.AutoValidator; @@ -454,11 +453,6 @@ fileControl.openFileWanted(false); } - /** Open the online help window. */ - public void onlineHelp() { - new Help(mainView, null).setVisible(true); - } - /** Swing FileFilter for map files. */ private static final FileFilter mapFileFilter = new HideFileFilterProxy(MapFileFilter.getInstance()); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 06:57:03 UTC (rev 4875) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:01:17 UTC (rev 4876) @@ -108,7 +108,6 @@ 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.help.Help; import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.AutoValidator; @@ -624,11 +623,6 @@ mapManager.refreshCurrentMap(); } - /** Open the online help window. */ - public void onlineHelp() { - new Help(mainView, null).setVisible(true); - } - /** Swing FileFilter for map files. */ private static final FileFilter mapFileFilter = new HideFileFilterProxy(MapFileFilter.getInstance()); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-16 06:57:03 UTC (rev 4875) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-16 07:01:17 UTC (rev 4876) @@ -40,6 +40,7 @@ import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.help.Help; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.gridarta.updater.UpdaterManager; @@ -254,4 +255,9 @@ ScriptEditControlInstance.getInstance().openScriptNew(); } + /** Open the online help window. */ + public void onlineHelp() { + new Help(getMainView(), null).setVisible(true); + } + } // class AbstractMainControl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-16 07:04:45
|
Revision: 4877 http://gridarta.svn.sourceforge.net/gridarta/?rev=4877&view=rev Author: akirschbaum Date: 2008-08-16 07:04:55 +0000 (Sat, 16 Aug 2008) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 07:01:17 UTC (rev 4876) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 07:04:55 UTC (rev 4877) @@ -215,7 +215,7 @@ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); + ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod"); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeSet); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:01:17 UTC (rev 4876) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:04:55 UTC (rev 4877) @@ -270,7 +270,7 @@ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); + ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod"); ACTION_FACTORY.createToggles(true, this, "drawDouble"); ACTION_FACTORY.createAction(true, "collectSpells", this); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-16 07:09:13
|
Revision: 4878 http://gridarta.svn.sourceforge.net/gridarta/?rev=4878&view=rev Author: akirschbaum Date: 2008-08-16 07:09:21 +0000 (Sat, 16 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-16 07:04:55 UTC (rev 4877) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 07:09:21 UTC (rev 4878) @@ -127,7 +127,6 @@ import net.sf.japi.swing.ActionMethod; import net.sf.japi.swing.prefs.PreferencesGroup; import net.sf.japi.swing.prefs.PreferencesPane; -import net.sf.japi.swing.tod.TipOfTheDayManager; import net.sf.japi.util.ThrowableHandler; import net.sf.japi.util.filter.file.EndingFileFilter; import org.apache.log4j.Logger; @@ -531,14 +530,6 @@ PreferencesPane.showPreferencesDialog(mainView, prefsGroup, false); } - /** - * Invoked to show the next tip of the day or bring the tip of the day to - * front. - */ - public void tod() { - TipOfTheDayManager.show(mainView); - } - /** {@inheritDoc} */ public void reloadFaces() { } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:04:55 UTC (rev 4877) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:09:21 UTC (rev 4878) @@ -147,7 +147,6 @@ import net.sf.japi.swing.misc.ConsoleProgress; import net.sf.japi.swing.prefs.PreferencesGroup; import net.sf.japi.swing.prefs.PreferencesPane; -import net.sf.japi.swing.tod.TipOfTheDayManager; import net.sf.japi.util.ThrowableHandler; import net.sf.japi.util.filter.file.EndingFileFilter; import net.sf.japi.util.filter.file.Factory; @@ -713,14 +712,6 @@ PreferencesPane.showPreferencesDialog(mainView, prefsGroup, false); } - /** - * Invoked to show the next tip of the day or bring the tip of the day to - * front. - */ - public void tod() { - TipOfTheDayManager.show(mainView); - } - /** {@inheritDoc} */ public void reloadFaces() { FaceObjectProviders.reloadAll(); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-16 07:04:55 UTC (rev 4877) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-16 07:09:21 UTC (rev 4878) @@ -46,6 +46,7 @@ import net.sf.gridarta.updater.UpdaterManager; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ActionMethod; +import net.sf.japi.swing.tod.TipOfTheDayManager; import net.sf.japi.util.filter.file.EndingFileFilter; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -260,4 +261,12 @@ new Help(getMainView(), null).setVisible(true); } + /** + * Invoked to show the next tip of the day or bring the tip of the day to + * front. + */ + public void tod() { + TipOfTheDayManager.show(getMainView()); + } + } // class AbstractMainControl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-16 07:12:17
|
Revision: 4879 http://gridarta.svn.sourceforge.net/gridarta/?rev=4879&view=rev Author: akirschbaum Date: 2008-08-16 07:12:25 +0000 (Sat, 16 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-16 07:09:21 UTC (rev 4878) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 07:12:25 UTC (rev 4879) @@ -46,7 +46,6 @@ import java.util.MissingResourceException; import java.util.prefs.Preferences; import javax.swing.JMenu; -import javax.swing.JOptionPane; import javax.swing.SwingUtilities; import javax.swing.filechooser.FileFilter; import javax.xml.parsers.ParserConfigurationException; @@ -73,7 +72,6 @@ import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; import net.sf.gridarta.gui.MapManagerActions; -import net.sf.gridarta.gui.MapPreview; import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.RecentManager; import net.sf.gridarta.gui.ReplaceDialogManager; @@ -590,16 +588,6 @@ mainView.handleThrowable(t); } - /** Calls for zooming preview tool. */ - public void zoom() { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = mapManager.getCurrentMap(); - if (currentMap == null) { - JOptionPane.showMessageDialog(mainView, "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); - return; - } - new MapPreview(gridartaObjectsFactory.newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); - } - /** {@inheritDoc} */ @NotNull public String getConfigurationDirectory() { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:09:21 UTC (rev 4878) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:12:25 UTC (rev 4879) @@ -81,7 +81,6 @@ import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; import net.sf.gridarta.gui.MapManagerActions; -import net.sf.gridarta.gui.MapPreview; import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.RecentManager; import net.sf.gridarta.gui.ReplaceDialogManager; @@ -790,16 +789,6 @@ mainView.handleThrowable(t); } - /** Calls for zooming preview tool. */ - public void zoom() { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = mapManager.getCurrentMap(); - if (currentMap == null) { - JOptionPane.showMessageDialog(mainView, "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); - return; - } - new MapPreview(gridartaObjectsFactory.newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); - } - /** {@inheritDoc} */ @NotNull public String getConfigurationDirectory() { Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-16 07:09:21 UTC (rev 4878) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-16 07:12:25 UTC (rev 4879) @@ -36,12 +36,14 @@ 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.MapPreview; import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.help.Help; import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.MapControl; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.gridarta.updater.UpdaterManager; import net.sf.japi.swing.ActionFactory; @@ -269,4 +271,14 @@ TipOfTheDayManager.show(getMainView()); } + /** Calls for zooming preview tool. */ + public void zoom() { + final MapControl<G, A, R, V> currentMap = mapManager.getCurrentMap(); + if (currentMap == null) { + JOptionPane.showMessageDialog(getMainView(), "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); + return; + } + new MapPreview(gridartaObjectsFactory.newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); + } + } // class AbstractMainControl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-16 07:34:40
|
Revision: 4880 http://gridarta.svn.sourceforge.net/gridarta/?rev=4880&view=rev Author: akirschbaum Date: 2008-08-16 07:34:47 +0000 (Sat, 16 Aug 2008) Log Message: ----------- Move FileControl to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/crossfire/src/cfeditor/messages_fr.properties trunk/crossfire/src/cfeditor/messages_sv.properties trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_de.properties trunk/daimonin/src/daieditor/messages_fr.properties trunk/daimonin/src/daieditor/messages_sv.properties trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Added Paths: ----------- trunk/src/app/net/sf/gridarta/FileControl.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/FileControl.java trunk/daimonin/src/daieditor/FileControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 07:34:47 UTC (rev 4880) @@ -52,6 +52,7 @@ import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.EditTypes; +import net.sf.gridarta.FileControl; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; @@ -203,7 +204,7 @@ * The file control instance. */ @NotNull - private final FileControl fileControl; + private final FileControl<GameObject, MapArchObject, Archetype, CMapViewBasic> fileControl; /** * Constructs the main controller and its model and view. @@ -368,7 +369,7 @@ } recentManager.initRecent(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(validators, mapManager, PREFS_VALIDATOR_AUTO_DEFAULT); - fileControl = new FileControl(globalSettings, archetypeSet, mapPreviewAccessory, mapManager, mainView, mapFileFilter, pythonFileFilter, newMapDialogFactory); + fileControl = new FileControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(globalSettings, archetypeSet, mapPreviewAccessory, mapManager, mainView, mapFileFilter, pythonFileFilter, newMapDialogFactory, ".py"); } /** Deleted: trunk/crossfire/src/cfeditor/FileControl.java =================================================================== --- trunk/crossfire/src/cfeditor/FileControl.java 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/crossfire/src/cfeditor/FileControl.java 2008-08-16 07:34:47 UTC (rev 4880) @@ -1,232 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package cfeditor; - -import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.GameObject; -import cfeditor.gui.map.CMapViewBasic; -import cfeditor.map.MapArchObject; -import java.awt.Component; -import java.io.File; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.MapManager; -import net.sf.gridarta.gameobject.ArchetypeSet; -import net.sf.gridarta.gui.map.MapPreviewAccessory; -import net.sf.gridarta.gui.newmap.NewMapDialogFactory; -import net.sf.gridarta.map.MapControl; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; -import net.sf.japi.swing.ActionFactory; -import org.jetbrains.annotations.NotNull; - -public class FileControl { - - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); - - /** - * The global settings instance. - */ - @NotNull - private final GlobalSettings globalSettings; - - /** - * The archetype set. - */ - @NotNull - private final ArchetypeSet<?, ?, ?> archetypeSet; - - /** - * The map preview accessory. - */ - @NotNull - private final MapPreviewAccessory mapPreviewAccessory; - - /** - * The map manager. - */ - @NotNull - private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; - - /** - * The parent component for showing dialog boxes. - */ - @NotNull - private final Component parent; - - /** - * The map file filter. - */ - @NotNull - private final FileFilter mapFileFilter; - - /** - * The script file filter. - */ - @NotNull - private final FileFilter scriptFileFilter; - - /** - * The new map dialog factory. - */ - @NotNull - private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; - - /** JFileChooser for opening a file. */ - private JFileChooser fileChooser; - - /** - * Creates a new instance. - * @param globalSettings the global settings instance - * @param archetypeSet the archetype set - * @param mapPreviewAccessory the map preview accessory - * @param mapManager the map manager - * @param parent the parent component for showing dialog boxes - * @param mapFileFilter the map file filter - * @param scriptFileFilter the script file filter - * @param newMapDialogFactory the new map dialog factory - */ - public FileControl(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeSet<?, ?, ?> archetypeSet, @NotNull final MapPreviewAccessory mapPreviewAccessory, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final Component parent, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory) { - this.globalSettings = globalSettings; - this.archetypeSet = archetypeSet; - this.mapPreviewAccessory = mapPreviewAccessory; - this.mapManager = mapManager; - this.parent = parent; - this.mapFileFilter = mapFileFilter; - this.scriptFileFilter = scriptFileFilter; - this.newMapDialogFactory = newMapDialogFactory; - } - - /** Create the JFileChooser for opening a file. */ - private void createFileChooser() { - fileChooser = new JFileChooser(); - fileChooser.setDialogTitle(ACTION_FACTORY.getString("fileDialog.title")); - fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - fileChooser.setMultiSelectionEnabled(true); - fileChooser.addChoosableFileFilter(scriptFileFilter); - fileChooser.addChoosableFileFilter(mapFileFilter); - if (globalSettings.getMapDir().exists()) { - fileChooser.setCurrentDirectory(globalSettings.getMapDir()); - } - mapPreviewAccessory.attachTo(fileChooser); - } - - /** - * The user wants to open a file. The filefilters and preselected filefilter - * are set accordingly to <var>mapFilter</var>. - * @param mapFilter set to <code>true</code> if the user probably wants to - * open a map, <code>false</code> otherwise - */ - public void openFileWanted(final boolean mapFilter) { - if (fileChooser == null) { - createFileChooser(); - } - if (mapFilter) { - fileChooser.setFileFilter(mapFileFilter); - } else { - fileChooser.setFileFilter(scriptFileFilter); - } - final int returnVal = fileChooser.showOpenDialog(parent); - if (returnVal == JFileChooser.APPROVE_OPTION) { - if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { - // ArchStack is empty -> abort! - ACTION_FACTORY.showMessageDialog(parent, "openFileWantedNoArches"); - return; - } - - globalSettings.setChangedDir(true); // user has chosen an active dir - openFiles(fileChooser.getCurrentDirectory(), fileChooser.getSelectedFiles()); - } - } - - /** - * Invoked when user wants to save a map to certain file. - * @param mapControl the map to be saved - * @return <code>true</code> if the user confirmed saving the map and the - * map was saved successfully, otherwise <code>false</code> - */ - public boolean saveLevelAsWanted(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl) { - final JFileChooser fileChooser = new JFileChooser(); - fileChooser.setDialogTitle("Save Map Or Script As"); - fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setMultiSelectionEnabled(false); - fileChooser.resetChoosableFileFilters(); - fileChooser.addChoosableFileFilter(scriptFileFilter); - fileChooser.setFileFilter(mapFileFilter); - - // default folder is the map-folder at first time, then the active folder - if (!globalSettings.hasChangedDir() && globalSettings.getMapDir().exists()) { - fileChooser.setCurrentDirectory(globalSettings.getMapDir()); - } else if (globalSettings.getCurrentDir().exists()) { - fileChooser.setCurrentDirectory(globalSettings.getCurrentDir()); - } - - // if file already exists, select it - final File mapFile = mapControl.getMapFile(); - if (mapFile != null && mapFile.exists()) { - fileChooser.setSelectedFile(mapFile); - } else { - fileChooser.setSelectedFile(new File(globalSettings.getMapDir(), mapControl.getMapFileName())); - } - - final int returnVal = fileChooser.showSaveDialog(parent); - if (returnVal != JFileChooser.APPROVE_OPTION) { - return false; - } - - globalSettings.setChangedDir(true); // user has chosen an active dir - final File file = fileChooser.getSelectedFile(); - if (!file.exists() || ACTION_FACTORY.showConfirmDialog(parent, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_CANCEL_OPTION, "overwriteOtherFile", file.getName()) == JOptionPane.OK_OPTION) { - mapControl.saveAs(file); - - globalSettings.setCurrentDir(fileChooser.getCurrentDirectory()); - } - return true; - } - - /** - * Load an array of files. - * @param dir directory to load files from - * @param files array of files to load - */ - private void openFiles(final File dir, final File... files) { - for (final File file : files) { - final boolean isScriptFile = file.getName().toLowerCase().endsWith(".py"); - if (file.isFile()) { - if (isScriptFile) { - ScriptEditControlInstance.getInstance().openScriptFile(file.getAbsolutePath()); - } else { - globalSettings.setCurrentDir(dir); - mapManager.openMapFileWithView(file, null); - } - } else if (!file.exists()) { - if (isScriptFile) { - // TODO: pass filename - ScriptEditControlInstance.getInstance().openScriptNew(); - } else { - newMapDialogFactory.showNewMapDialog(file.getName()); - } - } // If neither branch matches, it's a directory - what to do with directories? - } - } - -} // class FileControl Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-08-16 07:34:47 UTC (rev 4880) @@ -39,8 +39,6 @@ closeLevelNullLevel.title=Close map closeLevelNullLevel.message=Map does not exist: {1}; number of existing maps: {0}. -openFileWantedNoArches.title=Cannot open map -openFileWantedNoArches.message=There are currently no arches available!\nYou need to have arches loaded before opening a map. openFileLoadMap.title=Cannot open map openFileLoadMap.message=An I/O error occurred while loading {0}:\n{1} openFileOutOfMapBoundsDeleted.title=Loading mapfile {0} @@ -134,7 +132,6 @@ file.text=File file.mnemonic=F -fileDialog.title=Open map or script files createNew.text=New... createNew.shortdescription=Create new map Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2008-08-16 07:34:47 UTC (rev 4880) @@ -35,8 +35,6 @@ closeLevelNullLevel.title=Kann Karte nicht schlie\xDFen closeLevelNullLevel.message=Die Karte {1} existiert nicht; Anzahl existierender Karten: {0}. -openFileWantedNoArches.title=Kann Karte nicht \xF6ffnen -openFileWantedNoArches.message=Es sind keine Archetypen verf\xFCgbar.\nDiese werden ben\xF6tigt, um eine Karte zu \xF6ffnen. openFileLoadMap.title=Kann Karte nicht \xF6ffnen openFileLoadMap.message=Beim \xD6ffnen der Datei {0} ist ein Ein-/Ausgabefehler aufgetreten:\n{1} openFileOutOfMapBoundsDeleted.title=Karte {0} laden @@ -130,7 +128,6 @@ file.text=Datei file.mnemonic=D -fileDialog.title=Karten- oder Script-Dateien \xF6ffnen createNew.text=Neu... createNew.shortdescription=Erzeuge neue Karte Modified: trunk/crossfire/src/cfeditor/messages_fr.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_fr.properties 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/crossfire/src/cfeditor/messages_fr.properties 2008-08-16 07:34:47 UTC (rev 4880) @@ -36,8 +36,6 @@ #closeLevelNullLevel.title= #closeLevelNullLevel.message= -#openFileWantedNoArches.title= -#openFileWantedNoArches.message= #openFileLoadMap.title= #openFileLoadMap.message= #openFileOutOfMapBoundsDeleted.title= @@ -131,7 +129,6 @@ file.text=Fichier file.mnemonic=F -fileDialog.title=Ouvrir fichier carte ou script createNew.text=Nouveau createNew.shortdescription=Cr\xE9er une nouvelle carte Modified: trunk/crossfire/src/cfeditor/messages_sv.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_sv.properties 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/crossfire/src/cfeditor/messages_sv.properties 2008-08-16 07:34:47 UTC (rev 4880) @@ -34,8 +34,6 @@ closeLevelNullLevel.title=St\xE4ng niv\xE5 closeLevelNullLevel.message=FIND NULL LEVEL : {0} v\xE5r karta: {1}. -openFileWantedNoArches.title=Kan inte \xF6ppna karta -openFileWantedNoArches.message=Det finns inga arketyper (arches) tillg\xE4ngliga!\nDu m\xE5ste ha arketyperna innan du kan \xF6ppna en karta.\nL\xE4s i online-dokumentationen hur du kan skaffa Daimonins arketypfiler.. openFileLoadMap.title=Kunde inte \xF6ppna kartan #openFileLoadMap.message= openFileOutOfMapBoundsDeleted.title=Laddar kartfil {0} @@ -129,7 +127,6 @@ file.text=Arkiv file.mnemonic=A -fileDialog.title=\xD6ppna kart- eller scriptfiler createNew.text=Ny createNew.shortdescription=Ny karta Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:34:47 UTC (rev 4880) @@ -58,6 +58,7 @@ import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.EditTypes; +import net.sf.gridarta.FileControl; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; @@ -259,7 +260,7 @@ * The file control instance. */ @NotNull - private final FileControl fileControl; + private final FileControl<GameObject, MapArchObject, Archetype, CMapViewBasic> fileControl; /** * Constructs the main controller and its model and view. @@ -441,7 +442,7 @@ } recentManager.initRecent(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(validators, mapManager, PREFS_VALIDATOR_AUTO_DEFAULT); - fileControl = new FileControl(globalSettings, archetypeSet, mapPreviewAccessory, mapManager, mainView, mapFileFilter, luaFileFilter, newMapDialogFactory); + fileControl = new FileControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(globalSettings, archetypeSet, mapPreviewAccessory, mapManager, mainView, mapFileFilter, luaFileFilter, newMapDialogFactory, ".lua"); } /** Deleted: trunk/daimonin/src/daieditor/FileControl.java =================================================================== --- trunk/daimonin/src/daieditor/FileControl.java 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/daimonin/src/daieditor/FileControl.java 2008-08-16 07:34:47 UTC (rev 4880) @@ -1,232 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package daieditor; - -import daieditor.gameobject.Archetype; -import daieditor.gameobject.GameObject; -import daieditor.gui.map.CMapViewBasic; -import daieditor.map.MapArchObject; -import java.awt.Component; -import java.io.File; -import javax.swing.JFileChooser; -import javax.swing.JOptionPane; -import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.MapManager; -import net.sf.gridarta.gameobject.ArchetypeSet; -import net.sf.gridarta.gui.map.MapPreviewAccessory; -import net.sf.gridarta.gui.newmap.NewMapDialogFactory; -import net.sf.gridarta.map.MapControl; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; -import net.sf.japi.swing.ActionFactory; -import org.jetbrains.annotations.NotNull; - -public class FileControl { - - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); - - /** - * The global settings instance. - */ - @NotNull - private final GlobalSettings globalSettings; - - /** - * The archetype set. - */ - @NotNull - private final ArchetypeSet<?, ?, ?> archetypeSet; - - /** - * The map preview accessory. - */ - @NotNull - private final MapPreviewAccessory mapPreviewAccessory; - - /** - * The map manager. - */ - @NotNull - private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; - - /** - * The parent component for showing dialog boxes. - */ - @NotNull - private final Component parent; - - /** - * The map file filter. - */ - @NotNull - private final FileFilter mapFileFilter; - - /** - * The script file filter. - */ - @NotNull - private final FileFilter scriptFileFilter; - - /** - * The new map dialog factory. - */ - @NotNull - private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; - - /** JFileChooser for opening a file. */ - private JFileChooser fileChooser; - - /** - * Creates a new instance. - * @param globalSettings the global settings instance - * @param archetypeSet the archetype set - * @param mapPreviewAccessory the map preview accessory - * @param mapManager the map manager - * @param parent the parent component for showing dialog boxes - * @param mapFileFilter the map file filter - * @param scriptFileFilter the script file filter - * @param newMapDialogFactory the new map dialog factory - */ - public FileControl(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeSet<?, ?, ?> archetypeSet, @NotNull final MapPreviewAccessory mapPreviewAccessory, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final Component parent, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory) { - this.globalSettings = globalSettings; - this.archetypeSet = archetypeSet; - this.mapPreviewAccessory = mapPreviewAccessory; - this.mapManager = mapManager; - this.parent = parent; - this.mapFileFilter = mapFileFilter; - this.scriptFileFilter = scriptFileFilter; - this.newMapDialogFactory = newMapDialogFactory; - } - - /** Create the JFileChooser for opening a file. */ - private void createFileChooser() { - fileChooser = new JFileChooser(); - fileChooser.setDialogTitle(ACTION_FACTORY.getString("fileDialog.title")); - fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); - fileChooser.setMultiSelectionEnabled(true); - fileChooser.addChoosableFileFilter(scriptFileFilter); - fileChooser.addChoosableFileFilter(mapFileFilter); - if (globalSettings.getMapDir().exists()) { - fileChooser.setCurrentDirectory(globalSettings.getMapDir()); - } - mapPreviewAccessory.attachTo(fileChooser); - } - - /** - * The user wants to open a file. The filefilters and preselected filefilter - * are set accordingly to <var>mapFilter</var>. - * @param mapFilter set to <code>true</code> if the user probably wants to - * open a map, <code>false</code> otherwise - */ - public void openFileWanted(final boolean mapFilter) { - if (fileChooser == null) { - createFileChooser(); - } - if (mapFilter) { - fileChooser.setFileFilter(mapFileFilter); - } else { - fileChooser.setFileFilter(scriptFileFilter); - } - final int returnVal = fileChooser.showOpenDialog(parent); - if (returnVal == JFileChooser.APPROVE_OPTION) { - if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { - // ArchStack is empty -> abort! - ACTION_FACTORY.showMessageDialog(parent, "openFileWantedNoArches"); - return; - } - - globalSettings.setChangedDir(true); // user has chosen an active dir - openFiles(fileChooser.getCurrentDirectory(), fileChooser.getSelectedFiles()); - } - } - - /** - * Invoked when user wants to save a map to certain file. - * @param mapControl the map to be saved - * @return <code>true</code> if the user confirmed saving the map and the - * map was saved successfully, otherwise <code>false</code> - */ - public boolean saveLevelAsWanted(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl) { - final JFileChooser fileChooser = new JFileChooser(); - fileChooser.setDialogTitle("Save Map Or Script As"); - fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); - fileChooser.setMultiSelectionEnabled(false); - fileChooser.resetChoosableFileFilters(); - fileChooser.addChoosableFileFilter(scriptFileFilter); - fileChooser.setFileFilter(mapFileFilter); - - // default folder is the map-folder at first time, then the active folder - if (!globalSettings.hasChangedDir() && globalSettings.getMapDir().exists()) { - fileChooser.setCurrentDirectory(globalSettings.getMapDir()); - } else if (globalSettings.getCurrentDir().exists()) { - fileChooser.setCurrentDirectory(globalSettings.getCurrentDir()); - } - - // if file already exists, select it - final File mapFile = mapControl.getMapFile(); - if (mapFile != null && mapFile.exists()) { - fileChooser.setSelectedFile(mapFile); - } else { - fileChooser.setSelectedFile(new File(globalSettings.getMapDir(), mapControl.getMapFileName())); - } - - final int returnVal = fileChooser.showSaveDialog(parent); - if (returnVal != JFileChooser.APPROVE_OPTION) { - return false; - } - - globalSettings.setChangedDir(true); // user has chosen an active dir - final File file = fileChooser.getSelectedFile(); - if (!file.exists() || ACTION_FACTORY.showConfirmDialog(parent, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_CANCEL_OPTION, "overwriteOtherFile", file.getName()) == JOptionPane.OK_OPTION) { - mapControl.saveAs(file); - - globalSettings.setCurrentDir(fileChooser.getCurrentDirectory()); - } - return true; - } - - /** - * Load an array of files. - * @param dir directory to load files from - * @param files array of files to load - */ - private void openFiles(final File dir, final File... files) { - for (final File file : files) { - final boolean isScriptFile = file.getName().toLowerCase().endsWith(".lua"); - if (file.isFile()) { - if (isScriptFile) { - ScriptEditControlInstance.getInstance().openScriptFile(file.getAbsolutePath()); - } else { - globalSettings.setCurrentDir(dir); - mapManager.openMapFileWithView(file, null); - } - } else if (!file.exists()) { - if (isScriptFile) { - // TODO: pass filename - ScriptEditControlInstance.getInstance().openScriptNew(); - } else { - newMapDialogFactory.showNewMapDialog(file.getName()); - } - } // If neither branch matches, it's a directory - what to do with directories? - } - } - -} // class FileControl Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/daimonin/src/daieditor/messages.properties 2008-08-16 07:34:47 UTC (rev 4880) @@ -39,8 +39,6 @@ closeLevelNullLevel.title=Close map closeLevelNullLevel.message=Map does not exist: {1}; number of existing maps: {0}. -openFileWantedNoArches.title=Cannot open map -openFileWantedNoArches.message=There are currently no arches available!\nYou need to have arches loaded before opening a map.\nLook into the online help on how to get Daimonin archfiles. openFileLoadMap.title=Cannot open map openFileLoadMap.message=An I/O error occurred while loading {0}:\n{1} openFileOutOfMapBoundsDeleted.title=Loading mapfile {0} @@ -120,14 +118,6 @@ file.text=File file.mnemonic=F -fileDialog.title=Open map or script files -fileDialog.filter.lua=Lua Scripts -fileDialog.filter.arc=Archetype definitions -fileDialog.filter.anim=Animation definitions -fileDialog.filter.txt=Text Files -fileDialog.filter.text=Text Files -fileDialog.filter.py=Python Scripts -fileDialog.filter.unignored=All supported file types createNew.text=New... createNew.shortdescription=Create new map Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/daimonin/src/daieditor/messages_de.properties 2008-08-16 07:34:47 UTC (rev 4880) @@ -39,8 +39,6 @@ closeLevelNullLevel.title=Kann Karte nicht schlie\xDFen closeLevelNullLevel.message=Die Karte {1} existiert nicht; Anzahl existierender Karten: {0}. -openFileWantedNoArches.title=Kann Karte nicht \xF6ffnen -openFileWantedNoArches.message=Es sind keine Archetypen verf\xFCgbar.\nDiese werden ben\xF6tigt, um eine Karte zu \xF6ffnen. openFileLoadMap.title=Kann Karte nicht \xF6ffnen openFileLoadMap.message=Beim \xD6ffnen der Datei {0} ist ein Ein-/Ausgabefehler aufgetreten:\n{1} openFileOutOfMapBoundsDeleted.title=Karte {0} laden @@ -120,14 +118,6 @@ file.text=Datei file.mnemonic=D -fileDialog.title=Karten- oder Script-Dateien \xF6ffnen -fileDialog.filter.lua=Lua-Skripte -fileDialog.filter.arc=Archetypdefinitionen -fileDialog.filter.anim=Animationsdefinitionen -fileDialog.filter.txt=Text-Dateien -fileDialog.filter.text=Text-Dateien -fileDialog.filter.py=Python-Skripte -fileDialog.filter.unignored=Alle Dateien createNew.text=Neu... createNew.shortdescription=Erzeuge neue Karte Modified: trunk/daimonin/src/daieditor/messages_fr.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_fr.properties 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/daimonin/src/daieditor/messages_fr.properties 2008-08-16 07:34:47 UTC (rev 4880) @@ -39,8 +39,6 @@ #closeLevelNullLevel.title= #closeLevelNullLevel.message= -#openFileWantedNoArches.title= -#openFileWantedNoArches.message= #openFileLoadMap.title= #openFileLoadMap.message= #openFileOutOfMapBoundsDeleted.title= @@ -121,11 +119,6 @@ file.text=Fichier file.mnemonic=F -fileDialog.title=Ouvrir fichier carte ou script -fileDialog.filter.lua=Scripts lua -#fileDialog.filter.arc= -#fileDialog.filter.anim= -#fileDialog.filter.unignored= createNew.text=Nouveau createNew.shortdescription=Cr\xE9er une nouvelle carte Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2008-08-16 07:34:47 UTC (rev 4880) @@ -39,8 +39,6 @@ closeLevelNullLevel.title=St\xE4ng niv\xE5 closeLevelNullLevel.message=FIND NULL LEVEL : {0} v\xE5r karta: {1}. -openFileWantedNoArches.title=Kan inte \xF6ppna karta -openFileWantedNoArches.message=Det finns inga arketyper (arches) tillg\xE4ngliga!\nDu m\xE5ste ha arketyperna innan du kan \xF6ppna en karta.\nL\xE4s i online-dokumentationen hur du kan skaffa Daimonins arketypfiler.. openFileLoadMap.title=Kunde inte \xF6ppna kartan #openFileLoadMap.message= openFileOutOfMapBoundsDeleted.title=Laddar kartfil {0} @@ -122,11 +120,6 @@ file.text=Arkiv file.mnemonic=A -fileDialog.title=\xD6ppna kart- eller scriptfiler -fileDialog.filter.lua=Luascript -fileDialog.filter.arc=Arketypdefinitioner -fileDialog.filter.anim=Animationdefinitioner -#fileDialog.filter.unignored= createNew.text=Ny createNew.shortdescription=Ny karta Added: trunk/src/app/net/sf/gridarta/FileControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/FileControl.java (rev 0) +++ trunk/src/app/net/sf/gridarta/FileControl.java 2008-08-16 07:34:47 UTC (rev 4880) @@ -0,0 +1,238 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta; + +import java.awt.Component; +import java.io.File; +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; +import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.map.MapPreviewAccessory; +import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.newmap.NewMapDialogFactory; +import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; + +public class FileControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); + + /** + * The global settings instance. + */ + @NotNull + private final GlobalSettings globalSettings; + + /** + * The archetype set. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + /** + * The map preview accessory. + */ + @NotNull + private final MapPreviewAccessory mapPreviewAccessory; + + /** + * The map manager. + */ + @NotNull + private final MapManager<G, A, R, V> mapManager; + + /** + * The parent component for showing dialog boxes. + */ + @NotNull + private final Component parent; + + /** + * The map file filter. + */ + @NotNull + private final FileFilter mapFileFilter; + + /** + * The script file filter. + */ + @NotNull + private final FileFilter scriptFileFilter; + + /** + * The new map dialog factory. + */ + @NotNull + private final NewMapDialogFactory<G, A, R, V> newMapDialogFactory; + + /** + * The file extension for script files. + */ + @NotNull + private final String scriptExtension; + + /** JFileChooser for opening a file. */ + private JFileChooser fileChooser; + + /** + * Creates a new instance. + * @param globalSettings the global settings instance + * @param archetypeSet the archetype set + * @param mapPreviewAccessory the map preview accessory + * @param mapManager the map manager + * @param parent the parent component for showing dialog boxes + * @param mapFileFilter the map file filter + * @param scriptFileFilter the script file filter + * @param newMapDialogFactory the new map dialog factory + * @param scriptExtension the file extension for script files + */ + public FileControl(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapPreviewAccessory mapPreviewAccessory, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final Component parent, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final NewMapDialogFactory<G, A, R, V> newMapDialogFactory, @NotNull final String scriptExtension) { + this.globalSettings = globalSettings; + this.archetypeSet = archetypeSet; + this.mapPreviewAccessory = mapPreviewAccessory; + this.mapManager = mapManager; + this.parent = parent; + this.mapFileFilter = mapFileFilter; + this.scriptFileFilter = scriptFileFilter; + this.newMapDialogFactory = newMapDialogFactory; + this.scriptExtension = scriptExtension; + } + + /** Create the JFileChooser for opening a file. */ + private void createFileChooser() { + fileChooser = new JFileChooser(); + fileChooser.setDialogTitle(ACTION_FACTORY.getString("fileDialog.title")); + fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); + fileChooser.setMultiSelectionEnabled(true); + fileChooser.addChoosableFileFilter(scriptFileFilter); + fileChooser.addChoosableFileFilter(mapFileFilter); + if (globalSettings.getMapDir().exists()) { + fileChooser.setCurrentDirectory(globalSettings.getMapDir()); + } + mapPreviewAccessory.attachTo(fileChooser); + } + + /** + * The user wants to open a file. The filefilters and preselected filefilter + * are set accordingly to <var>mapFilter</var>. + * @param mapFilter set to <code>true</code> if the user probably wants to + * open a map, <code>false</code> otherwise + */ + public void openFileWanted(final boolean mapFilter) { + if (fileChooser == null) { + createFileChooser(); + } + if (mapFilter) { + fileChooser.setFileFilter(mapFileFilter); + } else { + fileChooser.setFileFilter(scriptFileFilter); + } + final int returnVal = fileChooser.showOpenDialog(parent); + if (returnVal == JFileChooser.APPROVE_OPTION) { + if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { + // ArchStack is empty -> abort! + ACTION_FACTORY.showMessageDialog(parent, "openFileWantedNoArches"); + return; + } + + globalSettings.setChangedDir(true); // user has chosen an active dir + openFiles(fileChooser.getCurrentDirectory(), fileChooser.getSelectedFiles()); + } + } + + /** + * Invoked when user wants to save a map to certain file. + * @param mapControl the map to be saved + * @return <code>true</code> if the user confirmed saving the map and the + * map was saved successfully, otherwise <code>false</code> + */ + public boolean saveLevelAsWanted(@NotNull final MapControl<G, A, R, V> mapControl) { + final JFileChooser fileChooser = new JFileChooser(); + fileChooser.setDialogTitle("Save Map Or Script As"); + fileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); + fileChooser.setMultiSelectionEnabled(false); + fileChooser.resetChoosableFileFilters(); + fileChooser.addChoosableFileFilter(scriptFileFilter); + fileChooser.setFileFilter(mapFileFilter); + + // default folder is the map-folder at first time, then the active folder + if (!globalSettings.hasChangedDir() && globalSettings.getMapDir().exists()) { + fileChooser.setCurrentDirectory(globalSettings.getMapDir()); + } else if (globalSettings.getCurrentDir().exists()) { + fileChooser.setCurrentDirectory(globalSettings.getCurrentDir()); + } + + // if file already exists, select it + final File mapFile = mapControl.getMapFile(); + if (mapFile != null && mapFile.exists()) { + fileChooser.setSelectedFile(mapFile); + } else { + fileChooser.setSelectedFile(new File(globalSettings.getMapDir(), mapControl.getMapFileName())); + } + + final int returnVal = fileChooser.showSaveDialog(parent); + if (returnVal != JFileChooser.APPROVE_OPTION) { + return false; + } + + globalSettings.setChangedDir(true); // user has chosen an active dir + final File file = fileChooser.getSelectedFile(); + if (!file.exists() || ACTION_FACTORY.showConfirmDialog(parent, JOptionPane.WARNING_MESSAGE, JOptionPane.OK_CANCEL_OPTION, "overwriteOtherFile", file.getName()) == JOptionPane.OK_OPTION) { + mapControl.saveAs(file); + + globalSettings.setCurrentDir(fileChooser.getCurrentDirectory()); + } + return true; + } + + /** + * Load an array of files. + * @param dir directory to load files from + * @param files array of files to load + */ + private void openFiles(final File dir, final File... files) { + for (final File file : files) { + final boolean isScriptFile = file.getName().toLowerCase().endsWith(scriptExtension); + if (file.isFile()) { + if (isScriptFile) { + ScriptEditControlInstance.getInstance().openScriptFile(file.getAbsolutePath()); + } else { + globalSettings.setCurrentDir(dir); + mapManager.openMapFileWithView(file, null); + } + } else if (!file.exists()) { + if (isScriptFile) { + // TODO: pass filename + ScriptEditControlInstance.getInstance().openScriptNew(); + } else { + newMapDialogFactory.showNewMapDialog(file.getName()); + } + } // If neither branch matches, it's a directory - what to do with directories? + } + } + +} // class FileControl Property changes on: trunk/src/app/net/sf/gridarta/FileControl.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-08-16 07:34:47 UTC (rev 4880) @@ -988,3 +988,17 @@ #################### # Archetype Chooser editPopup.text=Edit Archetype + + +############## +# File Control +fileDialog.title=Open map or script files +fileDialog.filter.lua=Lua Scripts +fileDialog.filter.arc=Archetype definitions +fileDialog.filter.anim=Animation definitions +fileDialog.filter.txt=Text Files +fileDialog.filter.text=Text Files +fileDialog.filter.py=Python Scripts +fileDialog.filter.unignored=All supported file types +openFileWantedNoArches.title=Cannot open map +openFileWantedNoArches.message=There are currently no archetypes available!\nYou need to have archetypes loaded before opening a map. Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-08-16 07:34:47 UTC (rev 4880) @@ -850,3 +850,17 @@ #################### # Archetype Chooser editPopup.text=Archetyp bearbeiten + + +############## +# File Control +fileDialog.title=Karten- oder Script-Dateien \xF6ffnen +fileDialog.filter.lua=Lua-Skripte +fileDialog.filter.arc=Archetypdefinitionen +fileDialog.filter.anim=Animationsdefinitionen +fileDialog.filter.txt=Text-Dateien +fileDialog.filter.text=Text-Dateien +fileDialog.filter.py=Python-Skripte +fileDialog.filter.unignored=Alle Dateien +openFileWantedNoArches.title=Kann Karte nicht \xF6ffnen +openFileWantedNoArches.message=Es sind keine Archetypen verf\xFCgbar.\nDiese werden ben\xF6tigt, um eine Karte zu \xF6ffnen. Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-08-16 07:34:47 UTC (rev 4880) @@ -849,3 +849,14 @@ #################### # Archetype Chooser #editPopup.text= + + +############## +# File Control +fileDialog.title=Ouvrir fichier carte ou script +fileDialog.filter.lua=Scripts lua +#fileDialog.filter.arc= +#fileDialog.filter.anim= +#fileDialog.filter.unignored= +#openFileWantedNoArches.title= +#openFileWantedNoArches.message= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-08-16 07:12:25 UTC (rev 4879) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-08-16 07:34:47 UTC (rev 4880) @@ -853,3 +853,14 @@ #################### # Archetype Chooser #editPopup.text= + + +############## +# File Control +fileDialog.title=\xD6ppna kart- eller scriptfiler +fileDialog.filter.lua=Luascript +fileDialog.filter.arc=Arketypdefinitioner +fileDialog.filter.anim=Animationdefinitioner +#fileDialog.filter.unignored= +openFileWantedNoArches.title=Kan inte \xF6ppna karta +openFileWantedNoArches.message=Det finns inga arketyper (arches) tillg\xE4ngliga!\nDu m\xE5ste ha arketyperna innan du kan \xF6ppna en karta.\nL\xE4s i online-dokumentationen hur du kan skaffa arketypfiler.. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-16 07:37:27
|
Revision: 4881 http://gridarta.svn.sourceforge.net/gridarta/?rev=4881&view=rev Author: akirschbaum Date: 2008-08-16 07:37:35 +0000 (Sat, 16 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-16 07:34:47 UTC (rev 4880) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 07:37:35 UTC (rev 4881) @@ -99,7 +99,6 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.undo.UndoControl; import net.sf.gridarta.io.IOUtils; -import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.AutoValidator; import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapControl; @@ -215,7 +214,6 @@ final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod"); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); - PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeSet); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserModel); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:34:47 UTC (rev 4880) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:37:35 UTC (rev 4881) @@ -109,7 +109,6 @@ import net.sf.gridarta.gui.undo.UndoControl; import net.sf.gridarta.gui.utils.GUIUtils; import net.sf.gridarta.io.IOUtils; -import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.AutoValidator; import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapControl; @@ -273,7 +272,6 @@ ACTION_FACTORY.createToggles(true, this, "drawDouble"); ACTION_FACTORY.createAction(true, "collectSpells", this); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); - PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeSet); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserModel); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-16 07:34:47 UTC (rev 4880) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-16 07:37:35 UTC (rev 4881) @@ -42,6 +42,7 @@ import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.help.Help; +import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; @@ -149,6 +150,7 @@ ScriptedEventEditor.setGlobalSettings(globalSettings); archetypeSet = newArchetypeSet(globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); ScriptedEvent.init(archetypeSet); + PathManager.setGlobalSettings(globalSettings); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-16 07:40:23
|
Revision: 4882 http://gridarta.svn.sourceforge.net/gridarta/?rev=4882&view=rev Author: akirschbaum Date: 2008-08-16 07:40:32 +0000 (Sat, 16 Aug 2008) Log Message: ----------- Defer code to create actions. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 07:37:35 UTC (rev 4881) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 07:40:32 UTC (rev 4882) @@ -212,7 +212,6 @@ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod"); 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); @@ -321,6 +320,7 @@ final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserModel, pickmapChooserControl); final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl); final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); + ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod"); mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:37:35 UTC (rev 4881) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:40:32 UTC (rev 4882) @@ -268,9 +268,6 @@ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod"); - ACTION_FACTORY.createToggles(true, this, "drawDouble"); - ACTION_FACTORY.createAction(true, "collectSpells", this); 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); @@ -377,6 +374,9 @@ final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserModel, pickmapChooserControl); final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl); final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); + ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod"); + ACTION_FACTORY.createToggles(true, this, "drawDouble"); + ACTION_FACTORY.createAction(true, "collectSpells", this); mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-16 07:54:00
|
Revision: 4883 http://gridarta.svn.sourceforge.net/gridarta/?rev=4883&view=rev Author: akirschbaum Date: 2008-08-16 07:54:09 +0000 (Sat, 16 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-16 07:40:32 UTC (rev 4882) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 07:54:09 UTC (rev 4883) @@ -57,6 +57,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.XmlHelper; +import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeAttributeParser; import net.sf.gridarta.archtype.ArchetypeTypeParser; import net.sf.gridarta.archtype.ArchetypeTypeSet; @@ -187,9 +188,6 @@ /** The treasure lists. */ private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; - /** The factory for creating new maps or pickmaps. */ - private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; - @NotNull private final GameObjectAttributesControl gameObjectAttributesControl; @@ -215,7 +213,6 @@ 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); - newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager, autojoinLists); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); @@ -370,6 +367,13 @@ fileControl = new FileControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(globalSettings, archetypeSet, mapPreviewAccessory, mapManager, mainView, mapFileFilter, pythonFileFilter, newMapDialogFactory, ".py"); } + /** {@inheritDoc} */ + @NotNull + @Override + protected NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newNewMapDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { + 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. Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:40:32 UTC (rev 4882) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 07:54:09 UTC (rev 4883) @@ -63,6 +63,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.XmlHelper; +import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeAttributeParser; import net.sf.gridarta.archtype.ArchetypeTypeParser; import net.sf.gridarta.archtype.ArchetypeTypeSet; @@ -249,9 +250,6 @@ /** The treasure lists. */ private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; - /** The factory for creating new maps or pickmaps. */ - private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; - @NotNull private final GameObjectAttributesControl gameObjectAttributesControl; @@ -271,7 +269,6 @@ 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); - newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager, autojoinLists); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); @@ -443,6 +440,13 @@ fileControl = new FileControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(globalSettings, archetypeSet, mapPreviewAccessory, mapManager, mainView, mapFileFilter, luaFileFilter, newMapDialogFactory, ".lua"); } + /** {@inheritDoc} */ + @NotNull + @Override + protected NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newNewMapDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { + 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. Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-16 07:40:32 UTC (rev 4882) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-16 07:54:09 UTC (rev 4883) @@ -41,6 +41,7 @@ import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.help.Help; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.MapArchObject; @@ -128,6 +129,10 @@ /** The status bar instance. */ protected StatusBar<G, A, R, V> statusBar = null; + /** The factory for creating new maps or pickmaps. */ + @NotNull + protected final NewMapDialogFactory<G, A, R, V> newMapDialogFactory; + /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory @@ -151,9 +156,19 @@ archetypeSet = newArchetypeSet(globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); ScriptedEvent.init(archetypeSet); PathManager.setGlobalSettings(globalSettings); + newMapDialogFactory = newNewMapDialogFactory(mapManager, gridartaObjectsFactory); } /** + * Creates a new {@link NewMapDialogFactory} instance. + * @param mapManager the map manager instance + * @param gridartaObjectsFactory the gridarta objects factory instance + * @return the new new map dialog factory instance + */ + @NotNull + protected abstract NewMapDialogFactory<G, A, R, V> newNewMapDialogFactory(@NotNull final MapManager<G, A, R, V> mapManager, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory); + + /** * Creates an {@link ArchetypeSet} instance. * @param globalSettings the global settigns instance * @param editTypes the edit types instance Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-16 07:40:32 UTC (rev 4882) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-16 07:54:09 UTC (rev 4883) @@ -62,6 +62,7 @@ import net.sf.gridarta.gameobject.face.DuplicateFaceException; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.gameobjectattributespanel.ScriptTab; import net.sf.gridarta.gui.map.LevelRenderer; @@ -472,6 +473,13 @@ /** {@inheritDoc} */ @NotNull @Override + protected NewMapDialogFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newNewMapDialogFactory(@NotNull final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + @Override protected ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory) { 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-16 08:36:32
|
Revision: 4885 http://gridarta.svn.sourceforge.net/gridarta/?rev=4885&view=rev Author: akirschbaum Date: 2008-08-16 08:36:39 +0000 (Sat, 16 Aug 2008) Log Message: ----------- Move code from CMainControl/MainView to CFTreasureListTree. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/crossfire/src/cfeditor/messages_fr.properties trunk/crossfire/src/cfeditor/messages_sv.properties trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/messages.properties trunk/daimonin/src/daieditor/messages_de.properties trunk/daimonin/src/daieditor/messages_fr.properties trunk/daimonin/src/daieditor/messages_sv.properties trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties trunk/src/app/net/sf/gridarta/treasurelist/CFTreasureListTree.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 08:36:39 UTC (rev 4885) @@ -441,12 +441,6 @@ return mapValidators; } - /** View Treasure Lists. */ - @ActionMethod - public void viewTreasurelists() { - treasureListTree.showDialog(); - } - /** Edit an existing script. */ @ActionMethod public void editScript() { Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-08-16 08:36:39 UTC (rev 4885) @@ -238,10 +238,7 @@ reloadFaces.mnemonic=F reloadFaces.accel=ctrl pressed F5 -viewTreasurelists.text=View Treasurelists -viewTreasurelists.mnemonic=T - ######## # Tools Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2008-08-16 08:36:39 UTC (rev 4885) @@ -214,10 +214,7 @@ reloadFaces.text=Grafiken neu laden reloadFaces.mnemonic=F -viewTreasurelists.text=Schatzlisten anschauen -viewTreasurelists.mnemonic=S - ######## # Tools Modified: trunk/crossfire/src/cfeditor/messages_fr.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_fr.properties 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/crossfire/src/cfeditor/messages_fr.properties 2008-08-16 08:36:39 UTC (rev 4885) @@ -215,10 +215,7 @@ #reloadFaces.text= #reloadFaces.mnemonic= -viewTreasurelists.text=Afficher listes de tr\xE9sors -viewTreasurelists.mnemonic=T - ######## # Tools Modified: trunk/crossfire/src/cfeditor/messages_sv.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_sv.properties 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/crossfire/src/cfeditor/messages_sv.properties 2008-08-16 08:36:39 UTC (rev 4885) @@ -213,10 +213,7 @@ reloadFaces.text=Ladda om bilder reloadFaces.mnemonic=L -viewTreasurelists.text=Visa skattlistor -viewTreasurelists.mnemonic=V - ######## # Tools Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 08:36:39 UTC (rev 4885) @@ -579,12 +579,6 @@ numberSpells.importSpellsWanted(getConfigurationDirectory(), mainView); } - /** View Treasure Lists. */ - @ActionMethod - public void viewTreasurelists() { - treasureListTree.showDialog(); - } - /** Edit an existing script. */ @ActionMethod public void editScript() { Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/daimonin/src/daieditor/messages.properties 2008-08-16 08:36:39 UTC (rev 4885) @@ -235,10 +235,7 @@ reloadFaces.mnemonic=F reloadFaces.accel=ctrl pressed F5 -viewTreasurelists.text=View Treasurelists -viewTreasurelists.mnemonic=T - ######## # Tools Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/daimonin/src/daieditor/messages_de.properties 2008-08-16 08:36:39 UTC (rev 4885) @@ -211,10 +211,7 @@ reloadFaces.text=Grafiken neu laden reloadFaces.mnemonic=F -viewTreasurelists.text=Schatzlisten anschauen -viewTreasurelists.mnemonic=S - ######## # Tools Modified: trunk/daimonin/src/daieditor/messages_fr.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_fr.properties 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/daimonin/src/daieditor/messages_fr.properties 2008-08-16 08:36:39 UTC (rev 4885) @@ -212,10 +212,7 @@ #reloadFaces.text= #reloadFaces.mnemonic= -viewTreasurelists.text=Afficher listes de tr\xE9sors -viewTreasurelists.mnemonic=T - ######## # Tools Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2008-08-16 08:36:39 UTC (rev 4885) @@ -213,10 +213,7 @@ reloadFaces.text=Ladda om bilder reloadFaces.mnemonic=L -viewTreasurelists.text=Visa skattlistor -viewTreasurelists.mnemonic=V - ######## # Tools Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-16 08:36:39 UTC (rev 4885) @@ -267,7 +267,6 @@ this.aCloseAll = aCloseAll; aPrevWindow = actionFactory.createAction(true, "prevWindow", this); aNextWindow = actionFactory.createAction(true, "nextWindow", this); - actionFactory.createAction(true, "viewTreasurelists", mainControl); viewActions = new ViewActions<G, A, R, V>(editTypes, mapManager, mapViewManager); Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-08-16 08:36:39 UTC (rev 4885) @@ -100,6 +100,11 @@ saveAll.longdescription=Saves all opened maps +# Resources +viewTreasurelists.text=View Treasurelists +viewTreasurelists.mnemonic=T + + # Zoom zoomMen.text=Zoom zoomMen.mnemonic=Z Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-08-16 08:36:39 UTC (rev 4885) @@ -88,6 +88,11 @@ saveAll.longdescription=Speichert alle ge\xF6ffneten Karten. +# Resources +viewTreasurelists.text=Schatzlisten anschauen +viewTreasurelists.mnemonic=S + + # Zoom zoomMen.text=Vergr\xF6\xDFerung zoomMen.mnemonic=V Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-08-16 08:36:39 UTC (rev 4885) @@ -87,6 +87,11 @@ #saveAll.longdescription= +# Resources +viewTreasurelists.text=Afficher listes de tr\xE9sors +viewTreasurelists.mnemonic=T + + # Zoom #zoomMen.text= #zoomMen.mnemonic= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-08-16 08:36:39 UTC (rev 4885) @@ -87,6 +87,11 @@ #saveAll.longdescription= +# Resources +viewTreasurelists.text=Visa skattlistor +viewTreasurelists.mnemonic=V + + # Zoom zoomMen.text=Zoom zoomMen.mnemonic=Z Modified: trunk/src/app/net/sf/gridarta/treasurelist/CFTreasureListTree.java =================================================================== --- trunk/src/app/net/sf/gridarta/treasurelist/CFTreasureListTree.java 2008-08-16 08:23:25 UTC (rev 4884) +++ trunk/src/app/net/sf/gridarta/treasurelist/CFTreasureListTree.java 2008-08-16 08:36:39 UTC (rev 4885) @@ -45,6 +45,7 @@ import net.sf.gridarta.help.Help; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; +import net.sf.japi.swing.ActionMethod; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -106,6 +107,7 @@ root.add(folder); } treasureTable = new TreasureLoader().parseTreasures(treasures, specialTreasureLists, root); + ACTION_FACTORY.createAction(true, "viewTreasurelists", this); } /** @@ -121,7 +123,8 @@ /** * Wrapper method for showing the dialog from the Resource menu. */ - public void showDialog() { + @ActionMethod + public void viewTreasurelists() { showDialog(null, mainView); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-16 12:23:37
|
Revision: 4887 http://gridarta.svn.sourceforge.net/gridarta/?rev=4887&view=rev Author: akirschbaum Date: 2008-08-16 12:23:45 +0000 (Sat, 16 Aug 2008) Log Message: ----------- Remove ObjectChooser.setPickmapFoldersMenu(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 08:42:06 UTC (rev 4886) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 12:23:45 UTC (rev 4887) @@ -318,7 +318,7 @@ final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl); final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod"); - mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); + mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, pickmapChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); final ArchetypeParser archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 08:42:06 UTC (rev 4886) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 12:23:45 UTC (rev 4887) @@ -374,7 +374,7 @@ ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod"); ACTION_FACTORY.createToggles(true, this, "drawDouble"); ACTION_FACTORY.createAction(true, "collectSpells", this); - mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); + mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, pickmapChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette); Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-16 08:42:06 UTC (rev 4886) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-16 12:23:45 UTC (rev 4887) @@ -54,6 +54,7 @@ import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.ViewActions; import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; +import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.utils.GUIUtils; import net.sf.gridarta.gui.utils.MenuUtils; import net.sf.gridarta.map.MapArchObject; @@ -384,10 +385,11 @@ * bottom monster objects * @param gameObjectMatchers the game object matchers * @param archetypeChooserControl the archetype chooser control + * @param pickmapChooserControl the pickmap chooser control * @param objectChooser the object chooser * @param leftPanel the left panel instance */ - public void init(@NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, final ArchetypeTypeSet<G, A, R> archetypeTypeSet, final boolean mapTileListBottom, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final Component leftPanel) { + public void init(@NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, final ArchetypeTypeSet<G, A, R> archetypeTypeSet, final boolean mapTileListBottom, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final Component leftPanel) { // calculate some default values in case there is no settings file final Rectangle screen = getGraphicsConfiguration().getBounds(); final int defwidth = (int) (0.9 * screen.getWidth()); @@ -402,7 +404,7 @@ archetypesActions = new ArchetypesActions<G, A, R, V>(this, archetypeChooserControl, objectChooser, archetypeTypeSet); setJMenuBar(actionFactory.createMenuBar(true, "main")); - objectChooser.setPickmapFoldersMenu((JMenu) actionFactory.find(getJMenuBar(), "pickmapFolders")); + pickmapChooserControl.setPickmapFoldersMenu((JMenu) actionFactory.find(getJMenuBar(), "pickmapFolders")); viewActions.init(gameObjectMatchers); viewActions.setMenu((JMenu) actionFactory.find(getJMenuBar(), "view")); Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-16 08:42:06 UTC (rev 4886) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-16 12:23:45 UTC (rev 4887) @@ -23,7 +23,6 @@ import java.awt.Point; import java.util.ArrayList; import java.util.List; -import javax.swing.JMenu; import javax.swing.JPanel; import javax.swing.JTabbedPane; import javax.swing.SwingConstants; @@ -134,11 +133,6 @@ return pickmapActive; } - /** {@inheritDoc} */ - public void setPickmapFoldersMenu(@Nullable final JMenu folderMenu) { - pickmapChooserControl.setPickmapFoldersMenu(folderMenu); - } - /** * Returns whether a given game object matches the selection. * @param gameObject the game object to check Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java 2008-08-16 08:42:06 UTC (rev 4886) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java 2008-08-16 12:23:45 UTC (rev 4887) @@ -21,7 +21,6 @@ import java.awt.Point; import java.util.List; -import javax.swing.JMenu; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.map.InsertionMode; @@ -90,12 +89,6 @@ G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull Point pos, boolean allowMany, InsertionMode insertionMode); /** - * Sets the pickmap folders menu to manage. - * @param folderMenu the pickmap folders menu - */ - void setPickmapFoldersMenu(@Nullable JMenu folderMenu); - - /** * Returns whether the current selection matches a given game object. * @param gameObject the game object to match * @return whether the game object matches the selection This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-16 12:45:44
|
Revision: 4891 http://gridarta.svn.sourceforge.net/gridarta/?rev=4891&view=rev Author: akirschbaum Date: 2008-08-16 12:45:52 +0000 (Sat, 16 Aug 2008) Log Message: ----------- Remove unused type parameter. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 12:42:31 UTC (rev 4890) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-16 12:45:52 UTC (rev 4891) @@ -159,7 +159,7 @@ public static final boolean PREFS_SYSTEM_EXIT_DEFAULT = true; /** The object chooser. */ - private final DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChooser; + private final DefaultObjectChooser<GameObject, MapArchObject, Archetype> objectChooser; /** The pickmap chooser control. */ private final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl; @@ -223,7 +223,7 @@ 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); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); + 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-16 12:42:31 UTC (rev 4890) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-16 12:45:52 UTC (rev 4891) @@ -200,7 +200,7 @@ public static final String PREFS_APP_EDITOR_DEFAULT = "vim"; /** The object chooser. */ - private final DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChooser; + private final DefaultObjectChooser<GameObject, MapArchObject, Archetype> objectChooser; /** The pickmap chooser control. */ private final PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> pickmapChooserControl; @@ -279,7 +279,7 @@ 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); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); + 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/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-16 12:42:31 UTC (rev 4890) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-16 12:45:52 UTC (rev 4891) @@ -389,7 +389,7 @@ * @param objectChooser the object chooser * @param leftPanel the left panel instance */ - public void init(@NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, final ArchetypeTypeSet<G, A, R> archetypeTypeSet, final boolean mapTileListBottom, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final Component leftPanel) { + public void init(@NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, final ArchetypeTypeSet<G, A, R> archetypeTypeSet, final boolean mapTileListBottom, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final DefaultObjectChooser<G, A, R> objectChooser, @NotNull final Component leftPanel) { // calculate some default values in case there is no settings file final Rectangle screen = getGraphicsConfiguration().getBounds(); final int defwidth = (int) (0.9 * screen.getWidth()); Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-16 12:42:31 UTC (rev 4890) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-16 12:45:52 UTC (rev 4891) @@ -30,7 +30,6 @@ import javax.swing.event.ChangeListener; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapModel; @@ -41,7 +40,7 @@ * The object Chooser implementation. * @author Andreas Kirschbaum */ -public class DefaultObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends JPanel implements ObjectChooser<G, A, R> { +public class DefaultObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JPanel implements ObjectChooser<G, A, R> { /** The serial version UID. */ private static final long serialVersionUID = 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-16 14:13:16
|
Revision: 4892 http://gridarta.svn.sourceforge.net/gridarta/?rev=4892&view=rev Author: akirschbaum Date: 2008-08-16 14:13:22 +0000 (Sat, 16 Aug 2008) Log Message: ----------- Add "fill" and "fill random". These new fill modes use the "auto" fill mode. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/crossfire/src/cfeditor/action.properties trunk/daimonin/ChangeLog trunk/daimonin/src/daieditor/action.properties trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-08-16 12:45:52 UTC (rev 4891) +++ trunk/crossfire/ChangeLog 2008-08-16 14:13:22 UTC (rev 4892) @@ -1,3 +1,8 @@ +2008-08-16 Andreas Kirschbaum + + * Add "fill" and "fill random". These new fill modes use the + "auto" fill mode. + 2008-08-15 Andreas Kirschbaum * Update archetypes. Modified: trunk/crossfire/src/cfeditor/action.properties =================================================================== --- trunk/crossfire/src/cfeditor/action.properties 2008-08-16 12:45:52 UTC (rev 4891) +++ trunk/crossfire/src/cfeditor/action.properties 2008-08-16 14:13:22 UTC (rev 4892) @@ -28,7 +28,7 @@ # Menus main.menubar=file edit map archetypes pickmaps resources tools analyze view plugins window help file.menu=createNew open recent close - save saveAs saveAll revert createImage - options - exit -edit.menu=undo redo - clear cut copy paste - shift - replace fillAbove fillBelow randFillAbove randFillBelow floodfill - selectAll +edit.menu=undo redo - clear cut copy paste - shift - replace fillAbove fillAuto fillBelow randFillAuto randFillAbove randFillBelow floodfill - selectAll map.menu=autoJoin - enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes #pickmaps.menu: See gridarta @@ -43,7 +43,7 @@ mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor mapwindowFile.menu=save saveAs createImage - revert - close -mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAbove fillBelow randFillAbove randFillBelow floodfill - selectAll +mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodfill - selectAll mapwindowMap.menu=gridVisible enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap tileShow - mapCreateView mapProperties shrinkMapSize mapwindowCursor.menu=moveCursor - selectTile startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-08-16 12:45:52 UTC (rev 4891) +++ trunk/daimonin/ChangeLog 2008-08-16 14:13:22 UTC (rev 4892) @@ -1,3 +1,8 @@ +2008-08-16 Andreas Kirschbaum <xxx> + + * Add "fill" and "fill random". These new fill modes use the + "auto" fill mode. + 2008-08-14 Andreas Kirschbaum * Make "Scripts" tab in game object attributes panel work again. Modified: trunk/daimonin/src/daieditor/action.properties =================================================================== --- trunk/daimonin/src/daieditor/action.properties 2008-08-16 12:45:52 UTC (rev 4891) +++ trunk/daimonin/src/daieditor/action.properties 2008-08-16 14:13:22 UTC (rev 4892) @@ -28,7 +28,7 @@ # Menus main.menubar=file edit map archetypes pickmaps resources tools view window help file.menu=createNew open recent close - save saveAs saveAll revert createImage - options - exit -edit.menu=undo redo - clear cut copy paste - shift - replace fillAbove fillBelow randFillAbove randFillBelow floodfill - selectAll +edit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodfill - selectAll map.menu=autoJoin - enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize archetypes.menu=displayGameObjectNames displayArchetypeNames displayIconsOnly - findArchetypes #pickmaps.menu: See gridarta @@ -46,7 +46,7 @@ mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor mapwindowFile.menu=save saveAs createImage - revert - close -mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAbove fillBelow randFillAbove randFillBelow floodfill - selectAll +mapwindowEdit.menu=undo redo - clear cut copy paste - shift - replace fillAuto fillAbove fillBelow randFillAuto randFillAbove randFillBelow floodfill - selectAll mapwindowMap.menu=gridVisible enterExit enterNorthMap enterEastMap enterSouthMap enterWestMap enterNorthEastMap enterSouthEastMap enterSouthWestMap enterNorthWestMap - mapCreateView mapProperties shrinkMapSize mapwindowCursor.menu=moveCursor - selectTile startStopDrag addToSelection subFromSelection releaseDrag - insertArch deleteArch - selectArchAbove selectArchBelow - archAttributes Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-16 12:45:52 UTC (rev 4891) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-16 14:13:22 UTC (rev 4892) @@ -146,12 +146,18 @@ /** Action called for "replace". */ private final Action aReplace; + /** Action called for "fill". */ + private final Action aFillAuto; + /** Action called for "fill above". */ private final Action aFillAbove; /** Action called for "fill below". */ private final Action aFillBelow; + /** Action called for "random fill". */ + private final Action aRandFillAuto; + /** Action called for "random fill above". */ private final Action aRandFillAbove; @@ -344,8 +350,10 @@ aShiftWest = actionFactory.createAction(true, "shiftWest", this); aShiftNorthWest = actionFactory.createAction(true, "shiftNorthWest", this); aReplace = actionFactory.createAction(true, "replace", this); + aFillAuto = actionFactory.createAction(true, "fillAuto", this); aFillAbove = actionFactory.createAction(true, "fillAbove", this); aFillBelow = actionFactory.createAction(true, "fillBelow", this); + aRandFillAuto = actionFactory.createAction(true, "randFillAuto", this); aRandFillAbove = actionFactory.createAction(true, "randFillAbove", this); aRandFillBelow = actionFactory.createAction(true, "randFillBelow", this); aFloodfill = actionFactory.createAction(true, "floodfill", this); @@ -381,8 +389,10 @@ aShiftWest.setEnabled(getShiftEnabled(3) != null); aShiftNorthWest.setEnabled(getShiftEnabled(7) != null); aReplace.setEnabled(getReplaceEnabled() != null); + aFillAuto.setEnabled(getFillAutoEnabled() != null); aFillAbove.setEnabled(getFillAboveEnabled() != null); aFillBelow.setEnabled(getFillBelowEnabled() != null); + aRandFillAuto.setEnabled(getRandFillAutoEnabled() != null); aRandFillAbove.setEnabled(getRandFillAboveEnabled() != null); aRandFillBelow.setEnabled(getRandFillBelowEnabled() != null); aFloodfill.setEnabled(getFloodfillEnabled() != null); @@ -483,6 +493,14 @@ } } + /** "Fill" was selected from the Edit menu. */ + public void fillAuto() { + final MapView<G, A, R, V> mapView = getFillAutoEnabled(); + if (mapView != null) { + fillWanted(mapView, InsertionMode.AUTO); + } + } + /** "Fill above" was selected from the Edit menu. */ public void fillAbove() { final MapView<G, A, R, V> mapView = getFillAboveEnabled(); @@ -508,6 +526,14 @@ FillUtils.fill(mapView, insertionMode, objectChooser.getSelections(), -1); } + /** "Random fill" was selected from the Edit menu. */ + public void randFillAuto() { + final MapView<G, A, R, V> mapView = getRandFillAutoEnabled(); + if (mapView != null) { + fillRandomWanted(mapView, InsertionMode.AUTO); + } + } + /** "Random fill above" was selected from the Edit menu. */ public void randFillAbove() { final MapView<G, A, R, V> mapView = getRandFillAboveEnabled(); @@ -728,6 +754,16 @@ } /** + * Determine if "fill" is enabled. + * @return the map view to fill if "fill" is enabled, or + * <code>null</code> otherwise + */ + @Nullable + private MapView<G, A, R, V> getFillAutoEnabled() { + return getSelection(); + } + + /** * Determine if "fill above" is enabled. * @return the map view to fill if "fill above" is enabled, or * <code>null</code> otherwise @@ -748,6 +784,16 @@ } /** + * Determine if "random fill" is enabled. + * @return the map view to fill if "random fill" is enabled, or + * <code>null</code> otherwise + */ + @Nullable + private MapView<G, A, R, V> getRandFillAutoEnabled() { + return getSelection(); + } + + /** * Determine if "random fill above" is enabled. * @return the map view to fill if "random fill above" is enabled, or * <code>null</code> otherwise Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-08-16 12:45:52 UTC (rev 4891) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-08-16 14:13:22 UTC (rev 4892) @@ -535,16 +535,21 @@ replace.mnemonic=R replace.accel=ctrl pressed R +fillAuto.text=Fill +fillAuto.mnemonic=F +fillAuto.accel=ctrl pressed F + fillAbove.text=Fill Above fillAbove.mnemonic=A -fillAbove.accel=ctrl pressed F fillBelow.text=Fill Below fillBelow.mnemonic=B fillBelow.accel=ctrl shift pressed F +randFillAuto.text=Random Fill +randFillAuto.accel=ctrl pressed D + randFillAbove.text=Random Fill Above -randFillAbove.accel=ctrl pressed D randFillBelow.text=Random Fill Below randFillBelow.accel=ctrl shift pressed D Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-08-16 12:45:52 UTC (rev 4891) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-08-16 14:13:22 UTC (rev 4892) @@ -501,12 +501,17 @@ replace.text=Ersetzen replace.mnemonic=Z +fillAuto.text=F\xFCllen +fillAuto.mnemonic=F + fillAbove.text=Oben f\xFCllen fillAbove.mnemonic=O fillBelow.text=Unten f\xFCllen fillBelow.mnemonic=U +randFillAuto.text=Zuf\xE4llig f\xFCllen + randFillAbove.text=Zuf\xE4llig oben f\xFCllen randFillBelow.text=Zuf\xE4llig unten f\xFCllen Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-08-16 12:45:52 UTC (rev 4891) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-08-16 14:13:22 UTC (rev 4892) @@ -500,12 +500,17 @@ replace.text=Remplacer replace.mnemonic=R +#fillAuto.text= +#fillAuto.mnemonic= + fillAbove.text=Remplir vers le haut fillAbove.mnemonic=H fillBelow.text=Remplir vers le bas fillBelow.mnemonic=B +#randFillAuto.text= + randFillAbove.text=Remplir en haut al\xE9atoirement randFillBelow.text=Remplir en bas al\xE9atoirement Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-08-16 12:45:52 UTC (rev 4891) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-08-16 14:13:22 UTC (rev 4892) @@ -504,12 +504,17 @@ replace.text=Ers\xE4tt replace.mnemonic=E +#fillAuto.text= +#fillAuto.mnemonic= + fillAbove.text=Fyll ovanf\xF6r fillAbove.mnemonic=O fillBelow.text=Fyll under fillBelow.mnemonic=U +#randFillAuto.text= + randFillAbove.text=Slumpfyll ovanf\xF6r randFillBelow.text=Slumpfyll under This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-19 23:50:13
|
Revision: 4909 http://gridarta.svn.sourceforge.net/gridarta/?rev=4909&view=rev Author: akirschbaum Date: 2008-08-19 23:50:18 +0000 (Tue, 19 Aug 2008) Log Message: ----------- Split off MapControlFactory from GridartaObjectsFactory. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Added Paths: ----------- trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java trunk/src/app/net/sf/gridarta/map/MapControlFactory.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-19 05:15:57 UTC (rev 4908) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-19 23:50:18 UTC (rev 4909) @@ -325,7 +325,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); final ArchetypeParser archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette); + gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette, autojoinLists, exitMatcher); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-19 05:15:57 UTC (rev 4908) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-19 23:50:18 UTC (rev 4909) @@ -26,6 +26,7 @@ import cfeditor.gui.map.SimpleLevelRenderer; import cfeditor.io.GameObjectParser; import cfeditor.io.MapArchObjectParser; +import cfeditor.map.DefaultMapControlFactory; import cfeditor.map.MapArchObject; import java.awt.Component; import java.awt.Point; @@ -43,7 +44,7 @@ import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; -import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.LevelRenderer; @@ -52,8 +53,8 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; -import net.sf.gridarta.map.DefaultMapControl; import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.map.MapControlFactory; import net.sf.gridarta.map.MapModel; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -71,10 +72,6 @@ /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - /** The {@link ArchetypeChooserModel} instance to use. */ - @NotNull - private ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel = null; - /** The {@link SelectedSquareView} instance to use. */ @NotNull private SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = null; @@ -91,10 +88,6 @@ @NotNull private MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache = null; - /** The {@link MapActions} instance to use. */ - @NotNull - private MapActions mapActions = null; - /** The {@link ArchetypeParser} instance to use. */ @NotNull private ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser = null; @@ -110,6 +103,10 @@ @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() { @@ -151,13 +148,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserModel, mapActions); + return mapControlFactory.newMapControl(this, parent, objects, mapArchObject); } /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserModel, mapActions); + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final File file) { + return mapControlFactory.newPickmapControl(this, parent, objects, mapArchObject, file); } /** {@inheritDoc} */ @@ -173,16 +170,15 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { - this.archetypeChooserModel = archetypeChooserModel; + 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; this.mapImageCache = mapImageCache; - this.mapActions = mapActions; this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; this.toolPalette = toolPalette; + mapControlFactory = new DefaultMapControlFactory(mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitTypeGameObjectMatcher); } public void setFilterControl(@NotNull final CFilterControl filterControl) { Added: trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java (rev 0) +++ trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-08-19 23:50:18 UTC (rev 4909) @@ -0,0 +1,109 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package cfeditor.map; + +import cfeditor.gameobject.Archetype; +import cfeditor.gameobject.GameObject; +import cfeditor.gui.map.CMapViewBasic; +import java.awt.Component; +import java.io.File; +import java.util.List; +import net.sf.gridarta.AutojoinLists; +import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MapActions; +import net.sf.gridarta.MapImageCache; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; +import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.map.AbstractMapControlFactory; +import net.sf.gridarta.map.DefaultMapControl; +import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.map.MapControlFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link MapControlFactory} to create Crossfire instance. + * @author Andreas Kirschbaum + */ +public class DefaultMapControlFactory extends AbstractMapControlFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { + + /** + * The {@link MapActions} instance to use. + */ + @NotNull + private final MapActions mapActions; + + /** + * The {@link ArchetypeChooserModel} instance to use. + */ + @NotNull + private final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel; + + /** + * The {@link MapImageCache} instance to use. + */ + @NotNull + private final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache; + + /** + * The {@link AutojoinLists} instacne to use. + */ + @NotNull + private final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists; + + /** + * The matcher for exit objects. + */ + @NotNull + private final GameObjectMatcher exitTypeGameObjectMatcher; + + /** + * Creates a new instance. + * @param mapActions the map actions to use + * @param archetypeChooserModel the archetype chooser model to use + * @param mapImageCache the map image cache to use + * @param autojoinLists the autojoin lists to use + * @param exitTypeGameObjectMatcher the matcher for exit objects + */ + public DefaultMapControlFactory(@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.mapActions = mapActions; + this.archetypeChooserModel = archetypeChooserModel; + this.mapImageCache = mapImageCache; + this.autojoinLists = autojoinLists; + this.exitTypeGameObjectMatcher = exitTypeGameObjectMatcher; + } + + /** {@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) { + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + } + + /** {@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) { + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + mapControl.setMapFile(file); + mapControl.setMapFileName(file.getPath()); + mapControl.resetModified(); + return mapControl; + } + +} // class DefaultMapControlFactory Property changes on: trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-19 05:15:57 UTC (rev 4908) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-19 23:50:18 UTC (rev 4909) @@ -377,7 +377,7 @@ mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, pickmapChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette); + 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-19 05:15:57 UTC (rev 4908) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-19 23:50:18 UTC (rev 4909) @@ -26,6 +26,7 @@ import daieditor.gui.map.SimpleLevelRenderer; import daieditor.io.GameObjectParser; import daieditor.io.MapArchObjectParser; +import daieditor.map.DefaultMapControlFactory; import daieditor.map.MapArchObject; import java.awt.Component; import java.awt.Point; @@ -43,7 +44,7 @@ import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; -import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.LevelRenderer; @@ -52,8 +53,8 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; -import net.sf.gridarta.map.DefaultMapControl; import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.map.MapControlFactory; import net.sf.gridarta.map.MapModel; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -74,10 +75,6 @@ /** The {@link FaceObjects} instance to use. */ private FaceObjects faceObjects = null; - /** The {@link ArchetypeChooserModel} instance to use. */ - @NotNull - private ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel = null; - /** The {@link SelectedSquareView} instance to use. */ @NotNull private SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = null; @@ -98,10 +95,6 @@ @NotNull private MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache = null; - /** The {@link MapActions} instance to use. */ - @NotNull - private MapActions mapActions = null; - /** The {@link ArchetypeParser} instance to use. */ @NotNull private ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser = null; @@ -114,6 +107,10 @@ @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() { @@ -155,15 +152,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserModel, mapActions); + return mapControlFactory.newMapControl(this, parent, objects, mapArchObject); } /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { - final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserModel, mapActions); - mapArchObject.setDifficulty(1); - return mapControl; + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final File file) { + return mapControlFactory.newPickmapControl(this, parent, objects, mapArchObject, file); } /** {@inheritDoc} */ @@ -179,18 +174,17 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { this.faceObjects = faceObjects; - this.archetypeChooserModel = archetypeChooserModel; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; this.mainView = mainView; this.editTypes = editTypes; this.mapImageCache = mapImageCache; - this.mapActions = mapActions; this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; this.toolPalette = toolPalette; + mapControlFactory = new DefaultMapControlFactory(mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitTypeGameObjectMatcher); } } // class DaimoninObjectsFactory Added: trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java (rev 0) +++ trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-19 23:50:18 UTC (rev 4909) @@ -0,0 +1,110 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package daieditor.map; + +import daieditor.gameobject.Archetype; +import daieditor.gameobject.GameObject; +import daieditor.gui.map.CMapViewBasic; +import java.awt.Component; +import java.io.File; +import java.util.List; +import net.sf.gridarta.AutojoinLists; +import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MapActions; +import net.sf.gridarta.MapImageCache; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; +import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.map.AbstractMapControlFactory; +import net.sf.gridarta.map.DefaultMapControl; +import net.sf.gridarta.map.MapControl; +import net.sf.gridarta.map.MapControlFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * A {@link MapControlFactory} to create Crossfire instance. + * @author Andreas Kirschbaum + */ +public class DefaultMapControlFactory extends AbstractMapControlFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { + + /** + * The {@link MapActions} instance to use. + */ + @NotNull + private final MapActions mapActions; + + /** + * The {@link ArchetypeChooserModel} instance to use. + */ + @NotNull + private final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel; + + /** + * The {@link MapImageCache} instance to use. + */ + @NotNull + private final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache; + + /** + * The {@link AutojoinLists} instacne to use. + */ + @NotNull + private final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists; + + /** + * The matcher for exit objects. + */ + @NotNull + private final GameObjectMatcher exitTypeGameObjectMatcher; + + /** + * Creates a new instance. + * @param mapActions the map actions to use + * @param archetypeChooserModel the archetype chooser model to use + * @param mapImageCache the map image cache to use + * @param autojoinLists the autojoin lists to use + * @param exitTypeGameObjectMatcher the matcher for exit objects + */ + public DefaultMapControlFactory(@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.mapActions = mapActions; + this.archetypeChooserModel = archetypeChooserModel; + this.mapImageCache = mapImageCache; + this.autojoinLists = autojoinLists; + this.exitTypeGameObjectMatcher = exitTypeGameObjectMatcher; + } + + /** {@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) { + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + } + + /** {@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) { + mapArchObject.setDifficulty(1); + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + mapControl.setMapFile(file); + mapControl.setMapFileName(file.getPath()); + mapControl.resetModified(); + return mapControl; + } + +} // class DefaultMapControlFactory Property changes on: trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-19 05:15:57 UTC (rev 4908) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-19 23:50:18 UTC (rev 4909) @@ -29,6 +29,7 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.LevelRenderer; @@ -113,10 +114,11 @@ * @param mapArchObject The map arch object to use for the new pickmap. * @param parent the parent component for error messages * @param autojoinLists the autojoin lists + * @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 AutojoinLists<G, A, R> autojoinLists); + MapControl<G, A, R, V> newPickmapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent, @NotNull AutojoinLists<G, A, R> autojoinLists, @NotNull File file); /** * Create a new level renderer instance. @@ -150,7 +152,9 @@ * @param archetypeParser the archetype parser instance * @param archetypeSet the archetype set instance * @param toolPalette the tool palette instance + * @param autojoinLists the autojoin lists instance + * @param exitTypeGameObjectMatcher the matcher for exit objects */ - 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); + 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/Pickmap.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-08-19 05:15:57 UTC (rev 4908) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-08-19 23:50:18 UTC (rev 4909) @@ -160,10 +160,7 @@ decoder.close(); } - pickmap = gridartaObjectsFactory.newPickmapControl(decoder.getGameObjects(), decoder.getMapArchObject(), parent, autojoinLists); - pickmap.setMapFile(file); - pickmap.setMapFileName(file.getPath()); - pickmap.resetModified(); + pickmap = gridartaObjectsFactory.newPickmapControl(decoder.getGameObjects(), decoder.getMapArchObject(), parent, autojoinLists, 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-19 05:15:57 UTC (rev 4908) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-19 23:50:18 UTC (rev 4909) @@ -269,10 +269,7 @@ } } - final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newPickmapControl(null, mapArchObject, mainControl.getMainView(), autojoinLists); - mapControl.setMapFile(mapFile); - mapControl.setMapFileName(mapFile.getPath()); - mapControl.resetModified(); + final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newPickmapControl(null, mapArchObject, mainControl.getMainView(), autojoinLists, mapFile); mapControl.save(); final Pickmap<G, A, R, V> pickmap; Added: trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java (rev 0) +++ trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java 2008-08-19 23:50:18 UTC (rev 4909) @@ -0,0 +1,32 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.map; + +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.map.MapViewBasic; + +/** + * Abstract base class of {@link MapControlFactory} classes. + * @author Andreas Kirschbaum + */ +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> { + +} // class AbstractMapControlFactory Property changes on: trunk/src/app/net/sf/gridarta/map/AbstractMapControlFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/map/MapControlFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapControlFactory.java (rev 0) +++ trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-08-19 23:50:18 UTC (rev 4909) @@ -0,0 +1,61 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.map; + +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; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Factory for creating {@link MapControl} instances. + * @author Andreas Kirschbaum + */ +public interface MapControlFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { + + /** + * 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 + * @return the new map control instance + */ + @NotNull + MapControl<G, A, R, V> newMapControl(@NotNull GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull Component parent, @Nullable final List<G> objects, @NotNull A mapArchObject); + + /** + * 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 + * @param file the associated file + * @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); + +} // interface MapControlFactory Property changes on: trunk/src/app/net/sf/gridarta/map/MapControlFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-19 05:15:57 UTC (rev 4908) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-19 23:50:18 UTC (rev 4909) @@ -881,7 +881,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists) { + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final File file) { throw new AssertionError(); } @@ -898,7 +898,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainView, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainView, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { 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 00:29:18
|
Revision: 4910 http://gridarta.svn.sourceforge.net/gridarta/?rev=4910&view=rev Author: akirschbaum Date: 2008-08-20 00:29:26 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Move more code into DefaultMapControlFactory. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.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/map/MapControlFactory.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-19 23:50:18 UTC (rev 4909) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-20 00:29:26 UTC (rev 4910) @@ -147,8 +147,8 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { - return mapControlFactory.newMapControl(this, parent, objects, mapArchObject); + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final String mapName, @Nullable final File file) { + return mapControlFactory.newMapControl(this, parent, objects, mapArchObject, mapName, file); } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-08-19 23:50:18 UTC (rev 4909) +++ trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-08-20 00:29:26 UTC (rev 4910) @@ -92,8 +92,11 @@ /** {@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) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + 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) { + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + mapControl.setMapFile(file); + mapControl.setMapFileName(mapName); + return mapControl; } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-19 23:50:18 UTC (rev 4909) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-20 00:29:26 UTC (rev 4910) @@ -151,8 +151,8 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { - return mapControlFactory.newMapControl(this, parent, objects, mapArchObject); + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final String mapName, @Nullable final File file) { + return mapControlFactory.newMapControl(this, parent, objects, mapArchObject, mapName, file); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-19 23:50:18 UTC (rev 4909) +++ trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-20 00:29:26 UTC (rev 4910) @@ -92,8 +92,11 @@ /** {@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) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + 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) { + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + mapControl.setMapFile(file); + mapControl.setMapFileName(mapName); + return mapControl; } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-08-19 23:50:18 UTC (rev 4909) +++ trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-08-20 00:29:26 UTC (rev 4910) @@ -103,8 +103,7 @@ public void init(final A mapArch) { assert copyMapCtrl == null; mapArch.setMapName("cb"); - copyMapCtrl = gridartaObjectsFactory.newMapControl(null, mapArch, mainControl.getMainView(), autojoinLists); - copyMapCtrl.setMapFileName("cb"); + copyMapCtrl = gridartaObjectsFactory.newMapControl(null, mapArch, mainControl.getMainView(), autojoinLists, "cb", null); } /** Modified: trunk/src/app/net/sf/gridarta/DefaultMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-08-19 23:50:18 UTC (rev 4909) +++ trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-08-20 00:29:26 UTC (rev 4910) @@ -136,10 +136,7 @@ @NotNull private MapControl<G, A, R, V> newMap(final List<G> objects, final A mapArchObject, @Nullable final File file, @NotNull final String mapFileName) { - final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newMapControl(objects, mapArchObject, mainControl.getMainView(), autojoinLists); - mapControl.setMapFile(file); - mapControl.setMapFileName(mapFileName); - return mapControl; + return gridartaObjectsFactory.newMapControl(objects, mapArchObject, mainControl.getMainView(), autojoinLists, mapFileName, file); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-19 23:50:18 UTC (rev 4909) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-20 00:29:26 UTC (rev 4910) @@ -103,10 +103,12 @@ * @param mapArchObject The map arch object to use for the new map. * @param parent the parent component for error messages * @param autojoinLists the autojoin lists instance + * @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 AutojoinLists<G, A, R> autojoinLists); + MapControl<G, A, R, V> newMapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent, @NotNull AutojoinLists<G, A, R> autojoinLists, @NotNull String mapName, @Nullable File file); /** * Create a new pickmap map control instance. Modified: trunk/src/app/net/sf/gridarta/map/MapControlFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-08-19 23:50:18 UTC (rev 4909) +++ trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-08-20 00:29:26 UTC (rev 4910) @@ -41,10 +41,12 @@ * @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 + * @param mapName the map name + * @param file the associated file * @return the new map control instance */ @NotNull - MapControl<G, A, R, V> newMapControl(@NotNull GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull Component parent, @Nullable final List<G> objects, @NotNull A mapArchObject); + 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); /** * Create a new pickmap map control instance. Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-19 23:50:18 UTC (rev 4909) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 00:29:26 UTC (rev 4910) @@ -875,7 +875,7 @@ /** {@inheritDoc} */ @NotNull - public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists) { + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final String mapName, @Nullable final File file) { 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 00:53:16
|
Revision: 4911 http://gridarta.svn.sourceforge.net/gridarta/?rev=4911&view=rev Author: akirschbaum Date: 2008-08-20 00:53:22 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/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/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 00:29:26 UTC (rev 4910) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -215,7 +215,7 @@ 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, autojoinLists); + pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, 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); Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-20 00:29:26 UTC (rev 4910) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -147,13 +147,13 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final String mapName, @Nullable final File file) { + 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 AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final File file) { + 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); } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 00:29:26 UTC (rev 4910) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -269,7 +269,7 @@ 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, autojoinLists); + pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, 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); Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-20 00:29:26 UTC (rev 4910) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -151,13 +151,13 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final String mapName, @Nullable final File file) { + 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 AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final File file) { + 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); } Modified: trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-20 00:29:26 UTC (rev 4910) +++ trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -93,7 +93,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) { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); mapControl.setMapFile(file); mapControl.setMapFileName(mapName); return mapControl; Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 00:29:26 UTC (rev 4910) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -143,13 +143,13 @@ */ protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { this.globalSettings = globalSettings; - final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, globalSettings, autojoinLists); + final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, 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, autojoinLists); + copyBuffer = new CopyBuffer<G, A, R, V>(this, editTypes, gridartaObjectsFactory); this.gridartaObjectsFactory = gridartaObjectsFactory; globalSettings.readGlobalSettings(); ScriptedEventEditor.setGlobalSettings(globalSettings); Modified: trunk/src/app/net/sf/gridarta/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-08-20 00:29:26 UTC (rev 4910) +++ trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -73,12 +73,6 @@ @NotNull private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; - /** - * The autojoin lists. - */ - @NotNull - private final AutojoinLists<G, A, R> autojoinLists; - /** Internal map control to store the cut / copied arches. */ private MapControl<G, A, R, V> copyMapCtrl = null; @@ -87,13 +81,11 @@ * @param mainControl main control * @param editTypes the edit types instance * @param gridartaObjectsFactory the gridarta objects factory instance - * @param autojoinLists the autojoin lists */ - 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, @NotNull final AutojoinLists<G, A, R> autojoinLists) { + 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) { this.mainControl = mainControl; // link main control in this.editTypes = editTypes; this.gridartaObjectsFactory = gridartaObjectsFactory; - this.autojoinLists = autojoinLists; } /** @@ -103,7 +95,7 @@ public void init(final A mapArch) { assert copyMapCtrl == null; mapArch.setMapName("cb"); - copyMapCtrl = gridartaObjectsFactory.newMapControl(null, mapArch, mainControl.getMainView(), autojoinLists, "cb", null); + copyMapCtrl = gridartaObjectsFactory.newMapControl(null, mapArch, mainControl.getMainView(), "cb", null); } /** Modified: trunk/src/app/net/sf/gridarta/DefaultMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-08-20 00:29:26 UTC (rev 4910) +++ trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -69,12 +69,6 @@ @NotNull private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; - /** - * The autojoin lists. - */ - @NotNull - private final AutojoinLists<G, A, R> autojoinLists; - /** The edit types. */ @NotNull private EditTypes<G, A, R, V> editTypes = null; @@ -97,11 +91,9 @@ * @param key The action factory key. * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance - * @param autojoinLists the autojoin lists */ - 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, @NotNull final AutojoinLists<G, A, R> autojoinLists) { + 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) { this.globalSettings = globalSettings; - this.autojoinLists = autojoinLists; actionFactory = ActionFactory.getFactory(key); this.mainControl = mainControl; this.gridartaObjectsFactory = gridartaObjectsFactory; @@ -136,7 +128,7 @@ @NotNull private MapControl<G, A, R, V> newMap(final List<G> objects, final A mapArchObject, @Nullable final File file, @NotNull final String mapFileName) { - return gridartaObjectsFactory.newMapControl(objects, mapArchObject, mainControl.getMainView(), autojoinLists, mapFileName, file); + return gridartaObjectsFactory.newMapControl(objects, mapArchObject, mainControl.getMainView(), mapFileName, file); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-20 00:29:26 UTC (rev 4910) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -102,25 +102,23 @@ * @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 autojoinLists the autojoin lists instance * @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 AutojoinLists<G, A, R> autojoinLists, @NotNull String mapName, @Nullable File file); + 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 autojoinLists the autojoin lists * @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 AutojoinLists<G, A, R> autojoinLists, @NotNull File file); + MapControl<G, A, R, V> newPickmapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent, @NotNull File file); /** * Create a new level renderer instance. Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-08-20 00:29:26 UTC (rev 4910) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -133,12 +133,11 @@ * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> * instance for loading the pickmap map file * @param parent the parent component for error messages - * @param autojoinLists the autojoin lists * @return the newly created pickmap * @throws InvalidNameException if the pickmap name is invalid */ - public synchronized Pickmap<G, A, R, V> addPickmap(@NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists) throws InvalidNameException { - final Pickmap<G, A, R, V> pickmap = new Pickmap<G, A, R, V>(this, name, gridartaObjectsFactory, parent, autojoinLists); + 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); 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 00:29:26 UTC (rev 4910) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -22,7 +22,6 @@ import java.awt.Component; import java.io.File; import java.util.Arrays; -import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -59,24 +58,16 @@ private final Component parent; /** - * The autojoin lists. - */ - @NotNull - private final AutojoinLists<G, A, R> autojoinLists; - - /** * Creates a new instance. * @param pickmapChooserModel the model to add the loaded pickmaps to * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> * @param parent the parent component for error messages * instance to use for loading pickmap files - * @param autojoinLists the autojoin lists */ - public Loader(@NotNull final PickmapChooserModel<G, A, R, V> pickmapChooserModel, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists) { + public Loader(@NotNull final PickmapChooserModel<G, A, R, V> pickmapChooserModel, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent) { this.pickmapChooserModel = pickmapChooserModel; this.gridartaObjectsFactory = gridartaObjectsFactory; this.parent = parent; - this.autojoinLists = autojoinLists; } /** Loads all pickmap files from a directory and its subdirectories. */ @@ -122,7 +113,7 @@ for (final File file : files) { if (file.isFile()) { try { - folder.addPickmap(file.getName(), gridartaObjectsFactory, this.parent, autojoinLists); + folder.addPickmap(file.getName(), gridartaObjectsFactory, 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 00:29:26 UTC (rev 4910) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -23,7 +23,6 @@ import java.io.File; import java.io.IOException; import java.util.Collection; -import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -62,12 +61,6 @@ private final Component parent; /** - * The autojoin lists. - */ - @NotNull - private final AutojoinLists<G, A, R> autojoinLists; - - /** * The {@link MapControl} instance representing the map file, or * <code>null</code> if the map file is not loaded. */ @@ -88,11 +81,9 @@ * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> * instance for loading the map file * @param parent the parent component for error messages - * @param autojoinLists the autojoin lists * @throws InvalidNameException if <code>name</code> is not valid */ - public Pickmap(@NotNull final Folder<G, A, R, V> folder, @NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists) throws InvalidNameException { - this.autojoinLists = autojoinLists; + 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 { if (!isValidPickmapName(name)) { throw new InvalidNameException(name); } @@ -160,7 +151,7 @@ decoder.close(); } - pickmap = gridartaObjectsFactory.newPickmapControl(decoder.getGameObjects(), decoder.getMapArchObject(), parent, autojoinLists, file); + pickmap = gridartaObjectsFactory.newPickmapControl(decoder.getGameObjects(), decoder.getMapArchObject(), parent, 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 00:29:26 UTC (rev 4910) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -31,7 +31,6 @@ import javax.swing.JOptionPane; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; @@ -78,12 +77,6 @@ private final MapManager<G, A, R, V> mapManager; /** - * The autojoin lists. - */ - @NotNull - private final AutojoinLists<G, A, R> autojoinLists; - - /** * The gridarta objects factory instance. */ @NotNull @@ -187,12 +180,10 @@ * @param gridartaObjectsFactory the gridarta objects factory instance * @param pickmapDir the pickmaps directory * @param mapManager the map manager instance - * @param autojoinLists the autojoin lists */ - public PickmapChooserControl(@NotNull final NewMapDialogFactory<G, A, R, V> newMapDialogFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final File pickmapDir, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final AutojoinLists<G, A, R> autojoinLists) { + 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) { this.mainControl = mainControl; this.mapManager = mapManager; - this.autojoinLists = autojoinLists; this.gridartaObjectsFactory = gridartaObjectsFactory; pickmapChooserModel = new PickmapChooserModel<G, A, R, V>(pickmapDir); folderListActions = new FolderListActions<G, A, R, V>(pickmapChooserModel, newMapDialogFactory); @@ -228,7 +219,7 @@ * Load all pickmaps and build the pickmap-panel. */ public void loadPickmaps() { - new Loader<G, A, R, V>(pickmapChooserModel, gridartaObjectsFactory, mainControl.getMainView(), autojoinLists).load(); + new Loader<G, A, R, V>(pickmapChooserModel, gridartaObjectsFactory, mainControl.getMainView()).load(); } /** @@ -269,12 +260,12 @@ } } - final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newPickmapControl(null, mapArchObject, mainControl.getMainView(), autojoinLists, mapFile); + final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newPickmapControl(null, mapArchObject, mainControl.getMainView(), mapFile); mapControl.save(); final Pickmap<G, A, R, V> pickmap; try { - pickmap = activeFolder.addPickmap(pickmapName, gridartaObjectsFactory, mainControl.getMainView(), autojoinLists); + pickmap = activeFolder.addPickmap(pickmapName, gridartaObjectsFactory, mainControl.getMainView()); } catch (final InvalidNameException ex) { throw new AssertionError(); // the name has been checked before } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 00:29:26 UTC (rev 4910) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 00:53:22 UTC (rev 4911) @@ -400,7 +400,7 @@ final TestArchetypeSet archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(archetypeSet); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(); - final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, "test", gridartaObjectsFactory, globalSettings, autojoinLists); + final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, "test", gridartaObjectsFactory, globalSettings); final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache = new MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(null, mapManager, null, new ImageIcon(), new ImageIcon()); final MapActions mapActions = new TestMapActions(); final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, autojoinLists, mapImageCache, null, mapArchObject, false, null, archetypeChooserModel, mapActions); @@ -875,13 +875,13 @@ /** {@inheritDoc} */ @NotNull - public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final String mapName, @Nullable final File file) { + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent, @NotNull final String mapName, @Nullable final File file) { throw new AssertionError(); } /** {@inheritDoc} */ @NotNull - public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final File file) { + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent, @NotNull final File file) { 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 19:04:26
|
Revision: 4914 http://gridarta.svn.sourceforge.net/gridarta/?rev=4914&view=rev Author: akirschbaum Date: 2008-08-20 19:04:30 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Order import statements. Modified Paths: -------------- trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 17:52:09 UTC (rev 4913) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 19:04:30 UTC (rev 4914) @@ -62,8 +62,8 @@ 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.MapManager; import net.sf.gridarta.archtype.ArchetypeAttributeParser; import net.sf.gridarta.archtype.ArchetypeTypeParser; import net.sf.gridarta.archtype.ArchetypeTypeSet; Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-08-20 17:52:09 UTC (rev 4913) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-08-20 19:04:30 UTC (rev 4914) @@ -27,7 +27,6 @@ import java.util.Iterator; import java.util.List; import javax.swing.event.EventListenerList; -import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 17:52:09 UTC (rev 4913) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 19:04:30 UTC (rev 4914) @@ -58,17 +58,17 @@ import net.sf.gridarta.gameobject.anim.AnimationParseException; import net.sf.gridarta.gameobject.anim.DuplicateAnimationException; import net.sf.gridarta.gameobject.face.AbstractFaceObjects; +import net.sf.gridarta.gameobject.face.DuplicateFaceException; import net.sf.gridarta.gameobject.face.FaceObjects; -import net.sf.gridarta.gameobject.face.DuplicateFaceException; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; -import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.gameobjectattributespanel.ScriptTab; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.tools.ToolPalette; +import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.GameObjectParser; 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:11:11
|
Revision: 4915 http://gridarta.svn.sourceforge.net/gridarta/?rev=4915&view=rev Author: akirschbaum Date: 2008-08-20 19:11:09 +0000 (Wed, 20 Aug 2008) Log Message: ----------- Extract RendererFactory 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/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Added Paths: ----------- trunk/crossfire/src/cfeditor/gui/map/DefaultRendererFactory.java trunk/daimonin/src/daieditor/gui/map/DefaultRendererFactory.java trunk/src/app/net/sf/gridarta/gui/map/RendererFactory.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 19:04:30 UTC (rev 4914) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -29,6 +29,7 @@ import cfeditor.gameobject.scripts.ScriptArchUtils; import cfeditor.gui.GameObjectAttributesControl; import cfeditor.gui.map.CMapViewBasic; +import cfeditor.gui.map.DefaultRendererFactory; import cfeditor.gui.prefs.GUIPrefs; import cfeditor.gui.prefs.ResPrefs; import cfeditor.map.MapArchObject; @@ -210,7 +211,7 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); + super(new CrossfireObjectsFactory(), new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); 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); @@ -325,7 +326,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); final ArchetypeParser archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette, autojoinLists, exitMatcher); + gridartaObjectsFactory.init(rendererFactory, faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette, 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:04:30 UTC (rev 4914) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -23,7 +23,6 @@ import cfeditor.gameobject.GameObject; import cfeditor.gameobject.UndefinedArchetype; import cfeditor.gui.map.CMapViewBasic; -import cfeditor.gui.map.SimpleLevelRenderer; import cfeditor.io.GameObjectParser; import cfeditor.io.MapArchObjectParser; import cfeditor.map.DefaultMapControlFactory; @@ -47,15 +46,14 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.gui.map.LevelRenderer; 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.gridarta.map.MapModel; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -159,18 +157,12 @@ /** {@inheritDoc} */ @NotNull - public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { - return new SimpleLevelRenderer(mapModel); - } - - /** {@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 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 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) { this.selectedSquareView = selectedSquareView; this.mainView = mainView; this.editTypes = editTypes; @@ -178,7 +170,7 @@ this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; this.toolPalette = toolPalette; - mapControlFactory = new DefaultMapControlFactory(mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitTypeGameObjectMatcher); + mapControlFactory = new DefaultMapControlFactory(rendererFactory, mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitTypeGameObjectMatcher); } public void setFilterControl(@NotNull final CFilterControl filterControl) { Added: trunk/crossfire/src/cfeditor/gui/map/DefaultRendererFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultRendererFactory.java (rev 0) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultRendererFactory.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -0,0 +1,42 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package cfeditor.gui.map; + +import cfeditor.gameobject.Archetype; +import cfeditor.gameobject.GameObject; +import cfeditor.map.MapArchObject; +import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.RendererFactory; +import net.sf.gridarta.map.MapModel; +import org.jetbrains.annotations.NotNull; + +/** + * Factory for creating {@link LevelRenderer} instances. + * @author Andreas Kirschbaum + */ +public class DefaultRendererFactory implements RendererFactory<GameObject, MapArchObject, Archetype> { + + /** {@inheritDoc} */ + @NotNull + public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { + return new SimpleLevelRenderer(mapModel); + } + +} // class DefaultRendererFactory Property changes on: trunk/crossfire/src/cfeditor/gui/map/DefaultRendererFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-08-20 19:04:30 UTC (rev 4914) +++ trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -31,6 +31,7 @@ import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.gui.map.RendererFactory; import net.sf.gridarta.map.AbstractMapControlFactory; import net.sf.gridarta.map.DefaultMapControl; import net.sf.gridarta.map.MapControl; @@ -45,6 +46,12 @@ public class DefaultMapControlFactory extends AbstractMapControlFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { /** + * The {@link RendererFactory} instance to use. + */ + @NotNull + private final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory; + + /** * The {@link MapActions} instance to use. */ @NotNull @@ -76,13 +83,15 @@ /** * Creates a new instance. + * @param rendererFactory the renderer factory to use * @param mapActions the map actions to use * @param archetypeChooserModel the archetype chooser model to use * @param mapImageCache the map image cache to use * @param autojoinLists the autojoin lists to use * @param exitTypeGameObjectMatcher the matcher for exit objects */ - public DefaultMapControlFactory(@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 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) { + this.rendererFactory = rendererFactory; this.mapActions = mapActions; this.archetypeChooserModel = archetypeChooserModel; this.mapImageCache = mapImageCache; @@ -93,7 +102,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) { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + 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); return mapControl; @@ -102,7 +111,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) { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + 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()); mapControl.resetModified(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 19:04:30 UTC (rev 4914) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -28,6 +28,7 @@ import daieditor.gameobject.scripts.ScriptArchUtils; import daieditor.gui.GameObjectAttributesControl; import daieditor.gui.map.CMapViewBasic; +import daieditor.gui.map.DefaultRendererFactory; import daieditor.gui.prefs.AppPrefs; import daieditor.gui.prefs.DevPrefs; import daieditor.gui.prefs.GUIPrefs; @@ -264,7 +265,7 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); + super(new DaimoninObjectsFactory(), new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects()); 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); @@ -377,7 +378,7 @@ mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, pickmapChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, toolPalette, autojoinLists, exitMatcher); + gridartaObjectsFactory.init(rendererFactory, 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:04:30 UTC (rev 4914) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -23,7 +23,6 @@ import daieditor.gameobject.GameObject; import daieditor.gameobject.UndefinedArchetype; import daieditor.gui.map.CMapViewBasic; -import daieditor.gui.map.SimpleLevelRenderer; import daieditor.io.GameObjectParser; import daieditor.io.MapArchObjectParser; import daieditor.map.DefaultMapControlFactory; @@ -47,15 +46,14 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.gui.map.LevelRenderer; 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.gridarta.map.MapModel; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -163,18 +161,12 @@ /** {@inheritDoc} */ @NotNull - public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { - return new SimpleLevelRenderer(mapModel); - } - - /** {@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 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 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) { this.faceObjects = faceObjects; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; @@ -184,7 +176,7 @@ this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; this.toolPalette = toolPalette; - mapControlFactory = new DefaultMapControlFactory(mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitTypeGameObjectMatcher); + mapControlFactory = new DefaultMapControlFactory(rendererFactory, mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitTypeGameObjectMatcher); } } // class DaimoninObjectsFactory Added: trunk/daimonin/src/daieditor/gui/map/DefaultRendererFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultRendererFactory.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/DefaultRendererFactory.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -0,0 +1,42 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package daieditor.gui.map; + +import daieditor.gameobject.Archetype; +import daieditor.gameobject.GameObject; +import daieditor.map.MapArchObject; +import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.RendererFactory; +import net.sf.gridarta.map.MapModel; +import org.jetbrains.annotations.NotNull; + +/** + * Factory for creating {@link LevelRenderer} instances. + * @author Andreas Kirschbaum + */ +public class DefaultRendererFactory implements RendererFactory<GameObject, MapArchObject, Archetype> { + + /** {@inheritDoc} */ + @NotNull + public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<GameObject, MapArchObject, Archetype> mapModel) { + return new SimpleLevelRenderer(mapModel); + } + +} // class DefaultRendererFactory Property changes on: trunk/daimonin/src/daieditor/gui/map/DefaultRendererFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-20 19:04:30 UTC (rev 4914) +++ trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -31,6 +31,7 @@ import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.gui.map.RendererFactory; import net.sf.gridarta.map.AbstractMapControlFactory; import net.sf.gridarta.map.DefaultMapControl; import net.sf.gridarta.map.MapControl; @@ -45,6 +46,12 @@ public class DefaultMapControlFactory extends AbstractMapControlFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { /** + * The {@link RendererFactory} instance to use. + */ + @NotNull + private final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory; + + /** * The {@link MapActions} instance to use. */ @NotNull @@ -76,13 +83,15 @@ /** * Creates a new instance. + * @param rendererFactory the renderer factory to use * @param mapActions the map actions to use * @param archetypeChooserModel the archetype chooser model to use * @param mapImageCache the map image cache to use * @param autojoinLists the autojoin lists to use * @param exitTypeGameObjectMatcher the matcher for exit objects */ - public DefaultMapControlFactory(@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 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) { + this.rendererFactory = rendererFactory; this.mapActions = mapActions; this.archetypeChooserModel = archetypeChooserModel; this.mapImageCache = mapImageCache; @@ -93,7 +102,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) { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + 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); return mapControl; @@ -103,7 +112,7 @@ @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) { mapArchObject.setDifficulty(1); - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + 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()); mapControl.resetModified(); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 19:04:30 UTC (rev 4914) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -41,6 +41,7 @@ import net.sf.gridarta.gui.map.MapPreviewAccessory; 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.newmap.NewMapDialogFactory; import net.sf.gridarta.help.Help; import net.sf.gridarta.io.PathManager; @@ -78,9 +79,12 @@ /** 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. */ + /** The gridarta objects factory. */ protected final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + /** The renderer factory. */ + protected final RendererFactory<G, A, R> rendererFactory; + /** The edit types instance. */ protected final EditTypes<G, A, R, V> editTypes; @@ -136,12 +140,13 @@ /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory + * @param rendererFactory the renderer factory * @param key The action factory key * @param globalSettings the global settings instance * @param animationObjects the animation objects instance * @param faceObjects the face objects instance */ - protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @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) { this.globalSettings = globalSettings; final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key, gridartaObjectsFactory, globalSettings); editTypes = new EditTypes<G, A, R, V>(tmpMapManager); @@ -151,6 +156,7 @@ this.faceObjects = faceObjects; copyBuffer = new CopyBuffer<G, A, R, V>(this, editTypes, gridartaObjectsFactory); this.gridartaObjectsFactory = gridartaObjectsFactory; + this.rendererFactory = rendererFactory; globalSettings.readGlobalSettings(); ScriptedEventEditor.setGlobalSettings(globalSettings); archetypeSet = newArchetypeSet(globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); @@ -295,7 +301,7 @@ JOptionPane.showMessageDialog(getMainView(), "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); return; } - new MapPreview(gridartaObjectsFactory.newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); + new MapPreview(rendererFactory.newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); } } // class AbstractMainControl Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-20 19:04:30 UTC (rev 4914) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -32,9 +32,9 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.gui.map.LevelRenderer; 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; @@ -42,7 +42,6 @@ import net.sf.gridarta.io.MapReader; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; -import net.sf.gridarta.map.MapModel; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -121,14 +120,6 @@ MapControl<G, A, R, V> newPickmapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent, @NotNull File file); /** - * Create a new level renderer instance. - * @param mapModel the map model to render - * @return the new level renderer - */ - @NotNull - LevelRenderer newSimpleLevelRenderer(@NotNull MapModel<G, A, R> mapModel); - - /** * 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> @@ -141,6 +132,7 @@ /** * 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 @@ -155,6 +147,6 @@ * @param autojoinLists the autojoin lists instance * @param exitTypeGameObjectMatcher the matcher for exit objects */ - 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); + 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); } // interface GridartaObjectsFactory Added: trunk/src/app/net/sf/gridarta/gui/map/RendererFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/RendererFactory.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/RendererFactory.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -0,0 +1,43 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.map; + +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.MapModel; +import org.jetbrains.annotations.NotNull; + +/** + * Factory for creating {@link LevelRenderer} instances. + * @author Andreas Kirschbaum + */ +public interface RendererFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * Creates a new level renderer instance which paints only tiles but no + * grid, cursor, selection, or errors. + * @param mapModel the map model to render + * @return the new level renderer + */ + @NotNull + LevelRenderer newSimpleLevelRenderer(@NotNull MapModel<G, A, R> mapModel); + +} // interface RendererFactory Property changes on: trunk/src/app/net/sf/gridarta/gui/map/RendererFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-08-20 19:04:30 UTC (rev 4914) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -41,6 +41,7 @@ import net.sf.gridarta.gui.map.LevelRenderer; 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.io.DefaultMapWriter; import net.sf.gridarta.io.MapWriter; import net.sf.japi.swing.ActionFactory; @@ -72,6 +73,12 @@ private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; /** + * The {@link RendererFactory} instance. + */ + @NotNull + private final RendererFactory<G, A, R> rendererFactory; + + /** * The parent component for error messages. */ @NotNull @@ -151,6 +158,7 @@ /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory instance + * @param rendererFactory the renderer factory * @param parent the parent component for error messages * @param autojoinLists the autojoin lists instance to use * @param mapImageCache the map image cache instance @@ -161,8 +169,9 @@ * @param archetypeChooserModel the archeype chooser model to use * @param mapActions the map actions to use */ - public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapImageCache<G, A, R, V> mapImageCache, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final MapActions mapActions) { + public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapImageCache<G, A, R, V> mapImageCache, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final MapActions mapActions) { this.gridartaObjectsFactory = gridartaObjectsFactory; + this.rendererFactory = rendererFactory; this.parent = parent; this.mapImageCache = mapImageCache; this.isPickmap = isPickmap; @@ -392,7 +401,7 @@ final LevelRenderer tmpLevelRenderer = levelRendererReference == null ? null : levelRendererReference.get(); final LevelRenderer levelRenderer; if (tmpLevelRenderer == null) { - levelRenderer = gridartaObjectsFactory.newSimpleLevelRenderer(mapModel); + levelRenderer = rendererFactory.newSimpleLevelRenderer(mapModel); levelRendererReference = new SoftReference<LevelRenderer>(levelRenderer); } else { levelRenderer = tmpLevelRenderer; Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 19:04:30 UTC (rev 4914) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-20 19:11:09 UTC (rev 4915) @@ -67,6 +67,7 @@ import net.sf.gridarta.gui.map.LevelRenderer; 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.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchooser.ObjectChooser; @@ -392,10 +393,11 @@ @Before public void setUp() { gridartaObjectsFactory = new TestGridartaObjectsFactory(); + final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory = new TestRendererFactory(); final GlobalSettings globalSettings = new TestGlobalSettings(); final AnimationObjects<TestAnimationObject> animationObjects = new TestAnimationObjects(); final FaceObjects faceObjects = new TestFaceObjects(); - final TestMainControl mainControl = new TestMainControl(gridartaObjectsFactory, "test", globalSettings, animationObjects, faceObjects); + final TestMainControl mainControl = new TestMainControl(gridartaObjectsFactory, rendererFactory, "test", globalSettings, animationObjects, faceObjects); final TestMapArchObject mapArchObject = new TestMapArchObject(); final TestArchetypeSet archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(archetypeSet); @@ -403,7 +405,7 @@ final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, "test", gridartaObjectsFactory, globalSettings); final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache = new MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(null, mapManager, null, new ImageIcon(), new ImageIcon()); final MapActions mapActions = new TestMapActions(); - final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, autojoinLists, mapImageCache, null, mapArchObject, false, null, archetypeChooserModel, mapActions); + final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, rendererFactory, autojoinLists, mapImageCache, null, mapArchObject, false, null, archetypeChooserModel, mapActions); mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(new JPanel(), autojoinLists, mapControl, null, mapArchObject, null, archetypeChooserModel, mapActions); result.setLength(0); @@ -419,13 +421,14 @@ /** * Creates a new instance. * @param gridartaObjectsFactory the gridaarta objects factory to use + * @param rendererFactory the renderer factory to use * @param key the action factory key to use * @param globalSettings the global settings instance to use * @param animationObjects the animation objects instance to use * @param faceObjects the face objects instance to use */ - protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<TestAnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { - super(gridartaObjectsFactory, key, globalSettings, animationObjects, faceObjects); + 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) { + super(gridartaObjectsFactory, rendererFactory, key, globalSettings, animationObjects, faceObjects); } /** {@inheritDoc} */ @@ -494,6 +497,7 @@ /** * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory to use + * @param rendererFactory the renderer factory to use * @param autojoinLists the autojoin lists instance to use * @param mapImageCache the map image cache instance * @param objects the objects to insert @@ -503,8 +507,8 @@ * @param archetypeChooserModel the archetype chooser model to use * @param mapActions the map actions to use */ - public TestMapControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final MapActions mapActions) { - super(gridartaObjectsFactory, new JPanel(), autojoinLists, mapImageCache, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); + public TestMapControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final MapActions mapActions) { + super(gridartaObjectsFactory, rendererFactory, new JPanel(), autojoinLists, mapImageCache, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); } } @@ -887,18 +891,12 @@ /** {@inheritDoc} */ @NotNull - public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel) { - throw new AssertionError(); - } - - /** {@inheritDoc} */ - @NotNull public MapView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapView(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { throw new AssertionError(); } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainView, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { + public void init(@NotNull final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory, @NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainView, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { throw new AssertionError(); } } @@ -1096,4 +1094,16 @@ } + /** + * A {@link RendererFactory} implementation for testing purposes. + */ + private static class TestRendererFactory implements RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> { + + /** {@inheritDoc} */ + @NotNull + public LevelRenderer newSimpleLevelRenderer(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel) { + throw new AssertionError(); + } + } + } // class DefaultMapModelTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |