You can subscribe to this list here.
2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(103) |
Jun
(121) |
Jul
(16) |
Aug
(67) |
Sep
(126) |
Oct
(161) |
Nov
(164) |
Dec
(588) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2007 |
Jan
(394) |
Feb
(181) |
Mar
(131) |
Apr
(180) |
May
(255) |
Jun
(11) |
Jul
(79) |
Aug
(70) |
Sep
(274) |
Oct
(138) |
Nov
(195) |
Dec
(8) |
2008 |
Jan
(3) |
Feb
(142) |
Mar
(162) |
Apr
(124) |
May
(148) |
Jun
(157) |
Jul
(425) |
Aug
(373) |
Sep
(264) |
Oct
(315) |
Nov
(225) |
Dec
(6) |
2009 |
Jan
(67) |
Feb
(78) |
Mar
(279) |
Apr
(294) |
May
(92) |
Jun
(65) |
Jul
(134) |
Aug
(41) |
Sep
(138) |
Oct
(125) |
Nov
(126) |
Dec
(122) |
2010 |
Jan
(15) |
Feb
(48) |
Mar
(9) |
Apr
(195) |
May
(373) |
Jun
(507) |
Jul
(42) |
Aug
(16) |
Sep
(38) |
Oct
(81) |
Nov
(64) |
Dec
(18) |
2011 |
Jan
(13) |
Feb
(12) |
Mar
(39) |
Apr
(1) |
May
(2) |
Jun
(27) |
Jul
(27) |
Aug
(31) |
Sep
(14) |
Oct
(102) |
Nov
(20) |
Dec
(37) |
2012 |
Jan
(22) |
Feb
(1) |
Mar
(1) |
Apr
(2) |
May
(2) |
Jun
(18) |
Jul
(6) |
Aug
(1) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2013 |
Jan
(1) |
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
(47) |
Jun
(7) |
Jul
(107) |
Aug
|
Sep
|
Oct
(112) |
Nov
(31) |
Dec
(17) |
2014 |
Jan
(29) |
Feb
(111) |
Mar
(34) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(18) |
Dec
(10) |
From: <aki...@us...> - 2010-04-28 10:42:37
|
Revision: 7650 http://gridarta.svn.sourceforge.net/gridarta/?rev=7650&view=rev Author: akirschbaum Date: 2010-04-28 10:42:28 +0000 (Wed, 28 Apr 2010) Log Message: ----------- Remove MapViewsManager.setMapManager() and setPickmapManager(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java 2010-04-28 10:39:23 UTC (rev 7649) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java 2010-04-28 10:42:28 UTC (rev 7650) @@ -46,7 +46,7 @@ * The {@link MapManager} to use. */ @NotNull - private MapManager<G, A, R> mapManager; + private final MapManager<G, A, R> mapManager; /** * The {@link MapViewFactory} to use. @@ -142,29 +142,15 @@ * Creates a new instance. * @param mapViewSettings the map view settings instance * @param mapViewFactory the map view factory to use + * @param mapManager the map manager to use + * @param pickmapManager the pickmap manager to use */ - public MapViewsManager(@NotNull final MapViewSettings mapViewSettings, @NotNull final MapViewFactory<G, A, R> mapViewFactory) { + public MapViewsManager(@NotNull final MapViewSettings mapViewSettings, @NotNull final MapViewFactory<G, A, R> mapViewFactory, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager) { this.mapViewFactory = mapViewFactory; - mapViewSettings.addMapViewSettingsListener(mapViewSettingsListener); - } - - /** - * Intitializes the instance. - * @param mapManager the map manager to track - */ - @Deprecated - public void setMapManager(@NotNull final MapManager<G, A, R> mapManager) { this.mapManager = mapManager; - setPickmapManager(mapManager); - } - - /** - * Intitializes the instance. - * @param mapManager the map manager to track - */ - @Deprecated - public void setPickmapManager(@NotNull final MapManager<G, A, R> mapManager) { + mapViewSettings.addMapViewSettingsListener(mapViewSettingsListener); mapManager.addMapManagerListener(mapManagerListener); + pickmapManager.addMapManagerListener(mapManagerListener); } /** Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-28 10:39:23 UTC (rev 7649) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-28 10:42:28 UTC (rev 7650) @@ -346,14 +346,12 @@ this.rendererFactory = rendererFactory; this.mapManager = mapManager; final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, pathManager); - mapViewsManager = new MapViewsManager<G, A, R>(mapViewSettings, mapViewFactory); + mapViewsManager = new MapViewsManager<G, A, R>(mapViewSettings, mapViewFactory, mapManager, pickmapManager); this.globalSettings = globalSettings; this.editorFactory = editorFactory; this.scriptExtension = scriptExtension; this.validators = validators; this.scriptExecutor = scriptExecutor; - mapViewsManager.setMapManager(mapManager); - mapViewsManager.setPickmapManager(pickmapManager); final ArchetypeChooserControl<G, A, R> archetypeChooserControl = new ArchetypeChooserControl<G, A, R>(archetypeChooserModel, createDirectionPane, faceObjectProviders); imageCreator = new ImageCreator<G, A, R>(mapManager, rendererFactory); final ImageCreator2<G, A, R> imageCreator2 = new ImageCreator2<G, A, R>(globalSettings, imageCreator); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-28 10:39:30
|
Revision: 7649 http://gridarta.svn.sourceforge.net/gridarta/?rev=7649&view=rev Author: akirschbaum Date: 2010-04-28 10:39:23 +0000 (Wed, 28 Apr 2010) Log Message: ----------- Move creation of MapViewsManager instance from GridartaEditor into GUIMainControl. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-04-27 21:42:37 UTC (rev 7648) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/maincontrol/DefaultEditorFactory.java 2010-04-28 10:39:23 UTC (rev 7649) @@ -509,8 +509,8 @@ /** {@inheritDoc} */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources) { - return mainControl.createGUIMainControl(FileFilters.pythonFileFilter, ".py", true, mapManager, pickmapManager, archetypeSet, mapControlFactory, guiUtils.getSysIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubdirectoryCacheFiles(".dedit"), configSourceFactory, mapViewsManager, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources) { + return mainControl.createGUIMainControl(FileFilters.pythonFileFilter, ".py", true, mapManager, pickmapManager, archetypeSet, mapControlFactory, guiUtils.getSysIcon(IGUIConstants.TILE_NORTH), "AtrinikEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubdirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new int[] { CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-04-27 21:42:37 UTC (rev 7648) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/maincontrol/DefaultEditorFactory.java 2010-04-28 10:39:23 UTC (rev 7649) @@ -366,8 +366,8 @@ /** {@inheritDoc} */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources) { - return mainControl.createGUIMainControl(FileFilters.pythonFileFilter, ".py", false, mapManager, pickmapManager, archetypeSet, mapControlFactory, null, "CrossfireEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, null, this, errorView, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), configSourceFactory, mapViewsManager, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, 0, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, true, scriptedEventEditor, + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources) { + return mainControl.createGUIMainControl(FileFilters.pythonFileFilter, ".py", false, mapManager, pickmapManager, archetypeSet, mapControlFactory, null, "CrossfireEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, null, this, errorView, new DirectoryCacheFiles(ConfigFileUtils.getHomeFile("thumbnails"), ".png"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, 0, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, true, scriptedEventEditor, new int[] { CommonConstants.NORTH, CommonConstants.EAST, Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-04-27 21:42:37 UTC (rev 7648) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/maincontrol/DefaultEditorFactory.java 2010-04-28 10:39:23 UTC (rev 7649) @@ -510,8 +510,8 @@ /** {@inheritDoc} */ @NotNull @Override - public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final MapViewsManager<GameObject, MapArchObject, Archetype> mapViewsManager, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources) { - return mainControl.createGUIMainControl(FileFilters.luaFileFilter, ".lua", true, mapManager, pickmapManager, archetypeSet, mapControlFactory, guiUtils.getSysIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubdirectoryCacheFiles(".dedit"), configSourceFactory, mapViewsManager, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, + public GUIMainControl<GameObject, MapArchObject, Archetype> createGUIMainControl(@NotNull final DefaultMainControl<GameObject, MapArchObject, Archetype> mainControl, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final FilterControl<GameObject, MapArchObject, Archetype> filterControl, @NotNull final ScriptExecutor<GameObject, MapArchObject, Archetype> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<GameObject, MapArchObject, Archetype> mapManager, @NotNull final MapManager<GameObject, MapArchObject, Archetype> pickmapManager, @NotNull final MapControlFactory<GameObject, MapArchObject, Archetype> mapControlFactory, @NotNull final net.sf.gridarta.model.archetype.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<GameObject, MapArchObject, Archetype> topmostInsertionMode, @NotNull final GameObjectFactory<GameObject, MapArchObject, Archetype> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<GameObject, MapArchObject, Archetype> mapReaderFactory, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<GameObject, MapArchObject, Archetype> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype> archetypeChooserModel, @NotNull final ScriptedEventEditor<GameObject, MapArchObject, Archetype> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<GameObject, MapArchObject, Archetype> resources) { + return mainControl.createGUIMainControl(FileFilters.luaFileFilter, ".lua", true, mapManager, pickmapManager, archetypeSet, mapControlFactory, guiUtils.getSysIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", new int[] { Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SPELL_FILE, this, errorView, new SubdirectoryCacheFiles(".dedit"), configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, -1, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, IGUIConstants.SCRIPTS_DIR, scriptModel, animationObjects, archetypeChooserModel, false, scriptedEventEditor, new int[] { CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-04-27 21:42:37 UTC (rev 7648) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2010-04-28 10:39:23 UTC (rev 7649) @@ -33,7 +33,6 @@ import javax.xml.parsers.ParserConfigurationException; import net.sf.gridarta.gui.filter.FilterControl; import net.sf.gridarta.gui.io.FileFilters; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.scripts.DefaultScriptArchEditor; import net.sf.gridarta.gui.scripts.ScriptArchDataUtils; @@ -331,7 +330,6 @@ * @param errorView the error view to add errors to * @param cacheFiles the cache files for icon and preview images * @param configSourceFactory the config source factory to use - * @param mapViewsManager the map views * @param rendererFactory the renderer factory * @param filterControl the filter control to use * @param scriptExecutor the script executor to use @@ -362,8 +360,8 @@ * @param resources the resources * @return the new instance */ - public GUIMainControl<G, A, R> createGUIMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapControlFactory<G, A, R> mapControlFactory, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault, @Nullable final String spellFile, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final CacheFiles cacheFiles, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, final int undefinedSpellIndex, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final String scriptsDir, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, final boolean allowRandomMapParameters, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final int[] directionMap, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<G, A, R> resources) { - return new GUIMainControl<G, A, R>(createDirectionPane, mapManager, pickmapManager, archetypeSet, faceObjects, globalSettings, mapViewSettings, mapControlFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, compassIcon, gridartaJarFilename, FileFilters.mapFileFilter, scriptFileFilter, scriptExtension, validators, resources, gameObjectMatchers, errorView, attributeRangeChecker, lockedItemsTypeNumbers, scriptsDir, scriptModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchData, scriptArchDataUtils, autoValidatorDefault, spellFile, allowRandomMapParameters, directionMap, editorFactory, faceObjectProviders, pluginParameterFactory, defaultFilterList, gameObjectFactory, pathManager, cacheFiles, gameObjectSpells, numberSpells, undefinedSpellIndex, systemIcons, configSourceFactory, topmostInsertionMode, mapViewsManager, rendererFactory, filterControl, scriptExecutor, scriptParameters); + public GUIMainControl<G, A, R> createGUIMainControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapControlFactory<G, A, R> mapControlFactory, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault, @Nullable final String spellFile, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final ErrorView errorView, @NotNull final CacheFiles cacheFiles, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, final int undefinedSpellIndex, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final String scriptsDir, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, final boolean allowRandomMapParameters, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final int[] directionMap, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<G, A, R> resources) { + return new GUIMainControl<G, A, R>(createDirectionPane, mapManager, pickmapManager, archetypeSet, faceObjects, globalSettings, mapViewSettings, mapControlFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, compassIcon, gridartaJarFilename, FileFilters.mapFileFilter, scriptFileFilter, scriptExtension, validators, resources, gameObjectMatchers, errorView, attributeRangeChecker, lockedItemsTypeNumbers, scriptsDir, scriptModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptedEventEditor, scriptArchData, scriptArchDataUtils, autoValidatorDefault, spellFile, allowRandomMapParameters, directionMap, editorFactory, faceObjectProviders, pluginParameterFactory, defaultFilterList, gameObjectFactory, pathManager, cacheFiles, gameObjectSpells, numberSpells, undefinedSpellIndex, systemIcons, configSourceFactory, topmostInsertionMode, rendererFactory, filterControl, scriptExecutor, scriptParameters); } } // class DefaultMainControl Modified: trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-04-27 21:42:37 UTC (rev 7648) +++ trunk/src/app/net/sf/gridarta/maincontrol/EditorFactory.java 2010-04-28 10:39:23 UTC (rev 7649) @@ -349,7 +349,6 @@ * @param errorView the error view to add errors to * @param guiUtils the gui utils for creating icons * @param configSourceFactory the config source factory - * @param mapViewsManager the map views * @param rendererFactory the renderer factory * @param filterControl the filter control * @param scriptExecutor the script executor to use @@ -380,7 +379,7 @@ * @return the new instance */ @NotNull - GUIMainControl<G, A, R> createGUIMainControl(@NotNull DefaultMainControl<G, A, R> mainControl, @NotNull ErrorView errorView, @NotNull GUIUtils guiUtils, @NotNull ConfigSourceFactory configSourceFactory, @NotNull MapViewsManager<G, A, R> mapViewsManager, @NotNull RendererFactory<G, A, R> rendererFactory, @NotNull FilterControl<G, A, R> filterControl, @NotNull ScriptExecutor<G, A, R> scriptExecutor, @NotNull ScriptParameters scriptParameters, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull MapManager<G, A, R> pickmapManager, @NotNull MapControlFactory<G, A, R> mapControlFactory, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull FaceObjects faceObjects, @NotNull GlobalSettings globalSettings, @NotNull MapViewSettings mapViewSettings, @NotNull FaceObjectProviders faceObjectProviders, @NotNull PathManager pathManager, @NotNull InsertionMode<G, A, R> topmostInsertionMode, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull SystemIcons systemIcons, @NotNull ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull MapArchObjectFactory<A> mapArchObjectFactory, @NotNull DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull ScriptModel<G, A, R> scriptModel, @NotNull AnimationObjects animationObjects, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull NamedFilterList defaultFilterList, @NotNull AbstractResources<G, A, R> resources); + GUIMainControl<G, A, R> createGUIMainControl(@NotNull DefaultMainControl<G, A, R> mainControl, @NotNull ErrorView errorView, @NotNull GUIUtils guiUtils, @NotNull ConfigSourceFactory configSourceFactory, @NotNull RendererFactory<G, A, R> rendererFactory, @NotNull FilterControl<G, A, R> filterControl, @NotNull ScriptExecutor<G, A, R> scriptExecutor, @NotNull ScriptParameters scriptParameters, @NotNull AbstractMapManager<G, A, R> mapManager, @NotNull MapManager<G, A, R> pickmapManager, @NotNull MapControlFactory<G, A, R> mapControlFactory, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull FaceObjects faceObjects, @NotNull GlobalSettings globalSettings, @NotNull MapViewSettings mapViewSettings, @NotNull FaceObjectProviders faceObjectProviders, @NotNull PathManager pathManager, @NotNull InsertionMode<G, A, R> topmostInsertionMode, @NotNull GameObjectFactory<G, A, R> gameObjectFactory, @NotNull SystemIcons systemIcons, @NotNull ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull MapArchObjectFactory<A> mapArchObjectFactory, @NotNull DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull DelegatingMapValidator<G, A, R> validators, @NotNull GameObjectMatchers gameObjectMatchers, @NotNull ScriptModel<G, A, R> scriptModel, @NotNull AnimationObjects animationObjects, @NotNull ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull NamedFilterList defaultFilterList, @NotNull AbstractResources<G, A, R> resources); /** * Creates a new {@link AbstractResources} instance. Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-27 21:42:37 UTC (rev 7648) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-28 10:39:23 UTC (rev 7649) @@ -55,6 +55,7 @@ import net.sf.gridarta.gui.map.cursor.MapCursorActions; import net.sf.gridarta.gui.map.mapactions.DefaultMapActions; import net.sf.gridarta.gui.map.mapview.MapView; +import net.sf.gridarta.gui.map.mapview.MapViewFactory; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.map.renderer.ImageCreator; @@ -340,11 +341,12 @@ * @param scriptExecutor the script executor to use * @param scriptParameters the script parameters to use */ - public GUIMainControl(final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapControlFactory<G, A, R> mapControlFactory, @NotNull final MapReaderFactory<G, A> mapReaderFactory, final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AbstractResources<G, A, R> resources, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorView errorView, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final int[] lockedItemsTypeNumbers, @NotNull final String scriptsDir, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AnimationObjects animationObjects, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchData<G, A, R> scriptArchData, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, final boolean autoValidatorDefault, @Nullable final String spellFile, final boolean allowRandomMapParameters, @NotNull final int[] directionMap, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final NamedFilterList defaultFilterList, final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final PathManager pathManager, @NotNull final CacheFiles cacheFiles, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @Deprecated @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters) { + public GUIMainControl(final boolean createDirectionPane, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final MapControlFactory<G, A, R> mapControlFactory, @NotNull final MapReaderFactory<G, A> mapReaderFactory, final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final TreasureTree treasureTree, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final AbstractResources<G, A, R> resources, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ErrorView errorView, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final int[] lockedItemsTypeNumbers, @NotNull final String scriptsDir, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final AnimationObjects animationObjects, @NotNull final ScriptArchEditor<G, A, R> scriptArchEditor, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final ScriptArchData<G, A, R> scriptArchData, @NotNull final ScriptArchDataUtils<G, A, R> scriptArchDataUtils, final boolean autoValidatorDefault, @Nullable final String spellFile, final boolean allowRandomMapParameters, @NotNull final int[] directionMap, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PluginParameterFactory<G, A, R> pluginParameterFactory, @NotNull final NamedFilterList defaultFilterList, final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final PathManager pathManager, @NotNull final CacheFiles cacheFiles, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, @NotNull final SystemIcons systemIcons, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters) { this.configSourceFactory = configSourceFactory; this.rendererFactory = rendererFactory; this.mapManager = mapManager; - this.mapViewsManager = mapViewsManager; + final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, pathManager); + mapViewsManager = new MapViewsManager<G, A, R>(mapViewSettings, mapViewFactory); this.globalSettings = globalSettings; this.editorFactory = editorFactory; this.scriptExtension = scriptExtension; Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-04-27 21:42:37 UTC (rev 7648) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-04-28 10:39:23 UTC (rev 7649) @@ -43,8 +43,6 @@ import net.sf.gridarta.gui.errorview.DefaultErrorView; import net.sf.gridarta.gui.filter.DefaultFilterControl; import net.sf.gridarta.gui.filter.FilterControl; -import net.sf.gridarta.gui.map.mapview.MapViewFactory; -import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.misc.SplashScreen; import net.sf.gridarta.gui.prefs.GUIPrefs; @@ -241,8 +239,6 @@ final GameObjectParser<G, A, R> gameObjectParser = gameObjectParserFactory.newGameObjectParser(); final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(defaultNamedFilterList); final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, gameObjectParser, faceObjectProviders, systemIcons); - final MapViewFactory<G, A, R> mapViewFactory = editorFactory.newMapViewFactory(rendererFactory, pathManager); - final MapViewsManager<G, A, R> mapViewsManager = new MapViewsManager<G, A, R>(mapViewSettings, mapViewFactory); final ArchetypeFactory<G, A, R> archetypeFactory = editorFactory.newArchetypeFactory(faceObjectProviders, animationObjects); final ArchetypeSet<G, A, R> archetypeSet = editorFactory.newArchetypeSet(globalSettings, archetypeFactory, gameObjectParser); final MapArchObjectFactory<A> mapArchObjectFactory = editorFactory.newMapArchObjectFactory(globalSettings); @@ -284,13 +280,13 @@ final ScriptExecutor<G, A, R> scriptExecutor = new ScriptExecutor<G, A, R>(scriptModel, scriptParameters); if (script != null) { - returnCode = runScript(script, editorFactory, mainControl, errorView, args2, guiUtils, configSourceFactory, mapViewsManager, rendererFactory, filterControl, scriptExecutor, scriptParameters, mapManager, pickmapManager, mapControlFactory, archetypeSet, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, scriptModel, animationObjects, archetypeChooserModel, scriptedEventEditor, defaultFilterList, resources); + returnCode = runScript(script, editorFactory, mainControl, errorView, args2, guiUtils, configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, mapManager, pickmapManager, mapControlFactory, archetypeSet, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, scriptModel, animationObjects, archetypeChooserModel, scriptedEventEditor, defaultFilterList, resources); } else { try { switch (mode) { case NORMAL: try { - returnCode = runNormal(args2, mainControl, editorFactory, splashScreen, errorView, guiUtils, configSourceFactory, mapViewsManager, rendererFactory, filterControl, scriptExecutor, scriptParameters, mapManager, pickmapManager, mapControlFactory, archetypeSet, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, scriptModel, animationObjects, archetypeChooserModel, scriptedEventEditor, defaultFilterList, resources); + returnCode = runNormal(args2, mainControl, editorFactory, splashScreen, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, mapManager, pickmapManager, mapControlFactory, archetypeSet, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, scriptModel, animationObjects, archetypeChooserModel, scriptedEventEditor, defaultFilterList, resources); } catch (final Exception ex) { log.fatal(ex.getMessage(), ex); returnCode = 1; @@ -343,7 +339,6 @@ * @param guiUtils the gui utils to use * @param configSourceFactory the config source factory to use * @param rendererFactory the renderer factory to use - * @param mapViewsManager the map views manager to use * @param filterControl the filter control to use * @param scriptExecutor the script executor to use * @param scriptParameters the script parameters to use @@ -372,14 +367,14 @@ * @param resources the resources * @return return code suitable for passing to {@link System#exit(int)} */ - private int runScript(@NotNull final String script, final EditorFactory<G, A, R> editorFactory, final DefaultMainControl<G, A, R> mainControl, final ErrorView errorView, final List<String> args2, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final MapControlFactory<G, A, R> mapControlFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<G, A, R> resources) { + private int runScript(@NotNull final String script, final EditorFactory<G, A, R> editorFactory, final DefaultMainControl<G, A, R> mainControl, final ErrorView errorView, final List<String> args2, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final MapControlFactory<G, A, R> mapControlFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<G, A, R> resources) { final GUIMainControl<G, A, R>[] tmp2 = (GUIMainControl<G, A, R>[]) new GUIMainControl<?, ?, ?>[1]; final Runnable runnable2 = new Runnable() { /** {@inheritDoc} */ @Override public void run() { - tmp2[0] = editorFactory.createGUIMainControl(mainControl, errorView, guiUtils, configSourceFactory, mapViewsManager, rendererFactory, filterControl, scriptExecutor, scriptParameters, mapManager, pickmapManager, mapControlFactory, archetypeSet, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, scriptModel, animationObjects, archetypeChooserModel, scriptedEventEditor, defaultFilterList, resources); + tmp2[0] = editorFactory.createGUIMainControl(mainControl, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, mapManager, pickmapManager, mapControlFactory, archetypeSet, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, scriptModel, animationObjects, archetypeChooserModel, scriptedEventEditor, defaultFilterList, resources); } }; @@ -464,7 +459,6 @@ * @param errorView the error view to add errors to * @param guiUtils the gui utils to use * @param configSourceFactory the config source factory to use - * @param mapViewsManager the map views manager to use * @param rendererFactory the renderer factory to use * @param filterControl the filter control to use * @param scriptExecutor the script executor to use @@ -494,14 +488,14 @@ * @param resources the resources * @return return code suitable for passing to {@link System#exit(int)} */ - private int runNormal(@NotNull final Iterable<String> args, @NotNull final DefaultMainControl<G, A, R> mainControl, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SplashScreen splashScreen, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final MapViewsManager<G, A, R> mapViewsManager, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final MapControlFactory<G, A, R> mapControlFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<G, A, R> resources) { + private int runNormal(@NotNull final Iterable<String> args, @NotNull final DefaultMainControl<G, A, R> mainControl, @NotNull final EditorFactory<G, A, R> editorFactory, @NotNull final SplashScreen splashScreen, @NotNull final ErrorView errorView, @NotNull final GUIUtils guiUtils, @NotNull final ConfigSourceFactory configSourceFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final FilterControl<G, A, R> filterControl, @NotNull final ScriptExecutor<G, A, R> scriptExecutor, @NotNull final ScriptParameters scriptParameters, @NotNull final AbstractMapManager<G, A, R> mapManager, @NotNull final MapManager<G, A, R> pickmapManager, @NotNull final MapControlFactory<G, A, R> mapControlFactory, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final FaceObjects faceObjects, @NotNull final GlobalSettings globalSettings, @NotNull final MapViewSettings mapViewSettings, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final PathManager pathManager, @NotNull final InsertionMode<G, A, R> topmostInsertionMode, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final SystemIcons systemIcons, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final DefaultMapReaderFactory<G, A, R> mapReaderFactory, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ScriptModel<G, A, R> scriptModel, @NotNull final AnimationObjects animationObjects, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel, @NotNull final ScriptedEventEditor<G, A, R> scriptedEventEditor, @NotNull final NamedFilterList defaultFilterList, @NotNull final AbstractResources<G, A, R> resources) { final GUIMainControl<G, A, R>[] guiMainControl = (GUIMainControl<G, A, R>[]) new GUIMainControl<?, ?, ?>[1]; final Runnable runnable = new Runnable() { /** {@inheritDoc} */ @Override public void run() { - guiMainControl[0] = editorFactory.createGUIMainControl(mainControl, errorView, guiUtils, configSourceFactory, mapViewsManager, rendererFactory, filterControl, scriptExecutor, scriptParameters, mapManager, pickmapManager, mapControlFactory, archetypeSet, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, scriptModel, animationObjects, archetypeChooserModel, scriptedEventEditor, defaultFilterList, resources); + guiMainControl[0] = editorFactory.createGUIMainControl(mainControl, errorView, guiUtils, configSourceFactory, rendererFactory, filterControl, scriptExecutor, scriptParameters, mapManager, pickmapManager, mapControlFactory, archetypeSet, faceObjects, globalSettings, mapViewSettings, faceObjectProviders, pathManager, topmostInsertionMode, gameObjectFactory, systemIcons, archetypeTypeSet, mapArchObjectFactory, mapReaderFactory, validators, gameObjectMatchers, scriptModel, animationObjects, archetypeChooserModel, scriptedEventEditor, defaultFilterList, resources); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-27 21:42:43
|
Revision: 7648 http://gridarta.svn.sourceforge.net/gridarta/?rev=7648&view=rev Author: akirschbaum Date: 2010-04-27 21:42:37 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Fix assertion failure when closing maps. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java 2010-04-27 21:34:12 UTC (rev 7647) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java 2010-04-27 21:42:37 UTC (rev 7648) @@ -131,6 +131,7 @@ */ @Override public void mapClosing(@NotNull final MapControl<G, A, R> mapControl) { + getMapViewsInt(mapControl).closeAllViews(); assert getMapViews(mapControl) <= 0; mapViews.remove(mapControl); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-27 21:34:18
|
Revision: 7647 http://gridarta.svn.sourceforge.net/gridarta/?rev=7647&view=rev Author: akirschbaum Date: 2010-04-27 21:34:12 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Remove ObjectChooser.insertSelectedObject(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java 2010-04-27 20:49:35 UTC (rev 7646) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java 2010-04-27 21:34:12 UTC (rev 7647) @@ -34,6 +34,8 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.utils.SwingUtils; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.map.mapcontrol.MapControl; @@ -108,20 +110,28 @@ private final InsertionModeSet<G, A, R> insertionModeSet; /** + * The {@link ArchetypeChooserModel} to use. + */ + @NotNull + private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; + + /** * Create a BasicAbstractTool. * @param selectedSquareView the selected square view * @param selectedSquareModel the selected square model * @param objectChooser the ObjectChooser to use * @param pickmapChooserControl the pickmap chooser control to use * @param insertionModeSet the insertion mode set to use + * @param archetypeChooserModel the archetype chooser model to use */ - public InsertionTool(@NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { + public InsertionTool(@NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel) { super("insertion"); this.selectedSquareView = selectedSquareView; this.selectedSquareModel = selectedSquareModel; this.objectChooser = objectChooser; this.pickmapChooserControl = pickmapChooserControl; this.insertionModeSet = insertionModeSet; + this.archetypeChooserModel = archetypeChooserModel; } /** {@inheritDoc} */ @@ -216,7 +226,8 @@ default: throw new AssertionError(); } - insertedObject = objectChooser.insertSelectedObject(mapModel, p, isPressed || modeIndex == MODE_AUTO, insertionMode); + final BaseObject<G, A, R, ?> selectedArchetype = objectChooser.getSelection(); + insertedObject = selectedArchetype == null ? null : mapModel.insertBaseObject(selectedArchetype, p, isPressed || modeIndex == MODE_AUTO, true, insertionMode, archetypeChooserModel.getDirection()); } selectedSquareView.setSelectedGameObject(insertedObject); } finally { Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2010-04-27 20:49:35 UTC (rev 7646) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2010-04-27 21:34:12 UTC (rev 7647) @@ -33,6 +33,7 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareModel; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.map.mapmodel.InsertionModeSet; @@ -76,12 +77,13 @@ * @param wallGameObjectMatcher the wall matcher to use * @param monsterGameObjectMatcher the monster matcher to use * @param insertionModeSet the insertion mode set to use + * @param archetypeChooserModel the archetype chooser model */ - public ToolPalette(@NotNull final MapViewSettings mapViewSettings, @NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl, @Nullable final GameObjectMatcher floorGameObjectMatcher, @Nullable final GameObjectMatcher wallGameObjectMatcher, @Nullable final GameObjectMatcher monsterGameObjectMatcher, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { + public ToolPalette(@NotNull final MapViewSettings mapViewSettings, @NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl, @Nullable final GameObjectMatcher floorGameObjectMatcher, @Nullable final GameObjectMatcher wallGameObjectMatcher, @Nullable final GameObjectMatcher monsterGameObjectMatcher, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel) { super(new BorderLayout()); - lmbSelector = new ToolSelector<G, A, R>("selection", mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher, insertionModeSet); - mmbSelector = new ToolSelector<G, A, R>("deletion", mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher, insertionModeSet); - rmbSelector = new ToolSelector<G, A, R>("insertion", mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher, insertionModeSet); + lmbSelector = new ToolSelector<G, A, R>("selection", mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher, insertionModeSet, archetypeChooserModel); + mmbSelector = new ToolSelector<G, A, R>("deletion", mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher, insertionModeSet, archetypeChooserModel); + rmbSelector = new ToolSelector<G, A, R>("insertion", mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher, insertionModeSet, archetypeChooserModel); add(new JLabel(ACTION_BUILDER.getString("mouse")), BorderLayout.NORTH); final Container mouseTabs = new JTabbedPane(); mouseTabs.add(ACTION_BUILDER.getString("left"), lmbSelector); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2010-04-27 20:49:35 UTC (rev 7646) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2010-04-27 21:34:12 UTC (rev 7647) @@ -40,6 +40,7 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareModel; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.map.mapmodel.InsertionModeSet; @@ -102,13 +103,14 @@ * @param wallGameObjectMatcher the wall matcher to use * @param monsterGameObjectMatcher the monster matcher to use * @param insertionModeSet the insertion mode set to use + * @param archetypeChooserModel the archetype chooser model to use */ - public ToolSelector(@NotNull final String defaultTool, @NotNull final MapViewSettings mapViewSettings, @NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl, @Nullable final GameObjectMatcher floorGameObjectMatcher, @Nullable final GameObjectMatcher wallGameObjectMatcher, @Nullable final GameObjectMatcher monsterGameObjectMatcher, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { + public ToolSelector(@NotNull final String defaultTool, @NotNull final MapViewSettings mapViewSettings, @NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R> pickmapChooserControl, @Nullable final GameObjectMatcher floorGameObjectMatcher, @Nullable final GameObjectMatcher wallGameObjectMatcher, @Nullable final GameObjectMatcher monsterGameObjectMatcher, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel) { createUI(); addTool(new VoidTool<G, A, R>(), defaultTool); addTool(new SelectionTool<G, A, R>(objectChooser, insertionModeSet), defaultTool); addTool(new DeletionTool<G, A, R>(mapViewSettings, objectChooser, pickmapChooserControl, floorGameObjectMatcher, wallGameObjectMatcher, monsterGameObjectMatcher), defaultTool); - addTool(new InsertionTool<G, A, R>(selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, insertionModeSet), defaultTool); + addTool(new InsertionTool<G, A, R>(selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, insertionModeSet, archetypeChooserModel), defaultTool); } /** Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-04-27 20:49:35 UTC (rev 7646) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-04-27 21:34:12 UTC (rev 7647) @@ -46,7 +46,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.map.mapcontrol.MapControl; -import net.sf.gridarta.model.map.mapmodel.InsertionMode; import net.sf.gridarta.model.map.mapmodel.MapModel; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -305,23 +304,7 @@ } /** {@inheritDoc} */ - @Nullable @Override - public G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point pos, final boolean allowMany, final InsertionMode<G, A, R> insertionMode) { - if (activeTab == null) { - return null; - } - - final BaseObject<G, A, R, ?> selectedArchetype = activeTab.getSelection(); - if (selectedArchetype == null) { - return null; - } - - return mapModel.insertBaseObject(selectedArchetype, pos, allowMany, true, insertionMode, archetypeChooserModel.getDirection()); - } - - /** {@inheritDoc} */ - @Override public void moveArchetypeChooserToFront() { tabbedPane.setSelectedIndex(0); } Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java 2010-04-27 20:49:35 UTC (rev 7646) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java 2010-04-27 21:34:12 UTC (rev 7647) @@ -19,14 +19,11 @@ package net.sf.gridarta.gui.objectchooser; -import java.awt.Point; import java.util.List; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.model.map.mapmodel.InsertionMode; -import net.sf.gridarta.model.map.mapmodel.MapModel; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -79,19 +76,6 @@ List<? extends BaseObject<G, A, R, ?>> getSelections(); /** - * Add the selected game object to the map. - * @param mapModel the map model to add to - * @param pos The location to add to. - * @param allowMany Whether to allow multiple copies of the inserted game - * object. - * @param insertionMode the insertion mode to use - * @return The inserted game object, or <code>null</code> if nothing was - * inserted. - */ - @Nullable - G insertSelectedObject(@NotNull MapModel<G, A, R> mapModel, @NotNull Point pos, boolean allowMany, InsertionMode<G, A, R> insertionMode); - - /** * 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 Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-27 20:49:35 UTC (rev 7646) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-27 21:34:12 UTC (rev 7647) @@ -423,7 +423,7 @@ final File scriptsFile = new File(globalSettings.getMapsDirectory(), scriptsDir); scriptControl = new ScriptController<G, A, R>(filterControl, scriptParameters, mainViewFrame, pluginParameterViewFactory, scriptsFile, scriptModel, pluginParameterFactory, scriptExecutor, systemIcons); final ObjectChoiceDisplay<G, A, R> objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R>(archetypeTypeSet, objectChooser); - final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet); + final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet, archetypeChooserModel); new FindArchetypesDialogManager<G, A, R>(mainViewFrame, archetypeChooserControl, objectChooser, archetypeTypeSet); new UndoControl<G, A, R>(mapManager, gameObjectFactory, gameObjectMatchers); final UpdaterManager updaterManager = new UpdaterManager(exiter, mapManager, mainViewFrame, gridartaJarFilename); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-27 20:49:41
|
Revision: 7646 http://gridarta.svn.sourceforge.net/gridarta/?rev=7646&view=rev Author: akirschbaum Date: 2010-04-27 20:49:35 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Support autojoin when inserting game objects from pickmaps. Modified Paths: -------------- trunk/atrinik/ChangeLog trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooserTab.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java Modified: trunk/atrinik/ChangeLog =================================================================== --- trunk/atrinik/ChangeLog 2010-04-27 20:14:08 UTC (rev 7645) +++ trunk/atrinik/ChangeLog 2010-04-27 20:49:35 UTC (rev 7646) @@ -1,3 +1,7 @@ +2010-04-27 Andreas Kirschbaum + + * Support autojoin when inserting game objects from pickmaps. + 2010-04-23 Andreas Kirschbaum * Allow undo/redo of reverted maps. Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2010-04-27 20:14:08 UTC (rev 7645) +++ trunk/crossfire/ChangeLog 2010-04-27 20:49:35 UTC (rev 7646) @@ -1,3 +1,7 @@ +2010-04-27 Andreas Kirschbaum + + * Support autojoin when inserting game objects from pickmaps. + 2010-04-23 Andreas Kirschbaum * Allow undo/redo of reverted maps. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2010-04-27 20:14:08 UTC (rev 7645) +++ trunk/daimonin/ChangeLog 2010-04-27 20:49:35 UTC (rev 7646) @@ -1,3 +1,7 @@ +2010-04-27 Andreas Kirschbaum + + * Support autojoin when inserting game objects from pickmaps. + 2010-04-23 Andreas Kirschbaum * Allow undo/redo of reverted maps. Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2010-04-27 20:14:08 UTC (rev 7645) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2010-04-27 20:49:35 UTC (rev 7646) @@ -20,7 +20,6 @@ package net.sf.gridarta.gui.archetypechooser; import java.awt.Component; -import java.awt.Point; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -33,12 +32,9 @@ import net.sf.gridarta.model.archetypechooser.ArchetypeChooserFolder; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserPanel; -import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.model.map.mapmodel.InsertionMode; -import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; @@ -141,14 +137,6 @@ /** {@inheritDoc} */ @Nullable @Override - public G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point pos, final boolean allowMany, @NotNull final InsertionMode<G, A, R> insertionMode) { - final BaseObject<G, A, R, ?> selectedArchetype = getSelection(); - return selectedArchetype == null ? null : mapModel.insertBaseObject(selectedArchetype, pos, allowMany, true, insertionMode, archetypeChooserModel.getDirection()); - } - - /** {@inheritDoc} */ - @Nullable - @Override public R getSelection() { final ArchetypeChooserPanel<G, A, R> selectedPanel = archetypeChooserModel.getSelectedPanel(); return selectedPanel != null ? selectedPanel.getSelectedFolder().getSelectedArchetype() : null; // XXX: should not cast Archetype -> GameObject Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-04-27 20:14:08 UTC (rev 7645) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-04-27 20:49:35 UTC (rev 7646) @@ -308,7 +308,16 @@ @Nullable @Override public G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point pos, final boolean allowMany, final InsertionMode<G, A, R> insertionMode) { - return activeTab == null ? null : activeTab.insertSelectedObject(mapModel, pos, allowMany, insertionMode); + if (activeTab == null) { + return null; + } + + final BaseObject<G, A, R, ?> selectedArchetype = activeTab.getSelection(); + if (selectedArchetype == null) { + return null; + } + + return mapModel.insertBaseObject(selectedArchetype, pos, allowMany, true, insertionMode, archetypeChooserModel.getDirection()); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooserTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooserTab.java 2010-04-27 20:14:08 UTC (rev 7645) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooserTab.java 2010-04-27 20:49:35 UTC (rev 7646) @@ -20,14 +20,11 @@ package net.sf.gridarta.gui.objectchooser; import java.awt.Component; -import java.awt.Point; import java.util.List; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.model.map.mapmodel.InsertionMode; -import net.sf.gridarta.model.map.mapmodel.MapModel; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -58,19 +55,6 @@ boolean isMatching(G gameObject); /** - * Adds the selected game object to a map. - * @param mapModel the map model to add to - * @param pos the location to add to - * @param allowMany whether to allow multiple copies of the inserted game - * object - * @param insertionMode the insertion mode to use - * @return the inserted game object, or <code>null</code> if nothing was - * inserted - */ - @Nullable - G insertSelectedObject(@NotNull MapModel<G, A, R> mapModel, @NotNull Point pos, boolean allowMany, @NotNull InsertionMode<G, A, R> insertionMode); - - /** * Returns the selected game object. * @return one of the selected game objects or <code>null</code> if no game * objects are selected Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2010-04-27 20:14:08 UTC (rev 7645) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2010-04-27 20:49:35 UTC (rev 7646) @@ -20,7 +20,6 @@ package net.sf.gridarta.gui.pickmapchooser; import java.awt.Component; -import java.awt.Point; import java.io.File; import java.io.IOException; import java.util.Collection; @@ -47,7 +46,6 @@ import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.mapmanager.MapManagerListener; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.io.MapReaderFactory; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -55,7 +53,6 @@ import net.sf.gridarta.model.map.mapcontrol.DefaultMapControl; import net.sf.gridarta.model.map.mapcontrol.MapControl; import net.sf.gridarta.model.map.mapcontrol.MapControlListener; -import net.sf.gridarta.model.map.mapmodel.InsertionMode; import net.sf.gridarta.model.map.mapmodel.MapModel; import net.sf.gridarta.model.map.mapmodel.MapModelListener; import net.sf.gridarta.model.map.mapmodel.MapSquare; @@ -496,14 +493,6 @@ } /** {@inheritDoc} */ - @Nullable - @Override - public G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point pos, final boolean allowMany, @NotNull final InsertionMode<G, A, R> insertionMode) { - final BaseObject<G, A, R, ?> gameObject = getSelection(); - return gameObject == null ? null : mapModel.insertBaseObject(gameObject, pos, allowMany, false, insertionMode, null); - } - - /** {@inheritDoc} */ @NotNull @Override public List<G> getSelections() { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-27 20:14:14
|
Revision: 7645 http://gridarta.svn.sourceforge.net/gridarta/?rev=7645&view=rev Author: akirschbaum Date: 2010-04-27 20:14:08 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Remove MapModel.insertArchetype(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialogManager.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java Modified: trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java 2010-04-27 19:57:52 UTC (rev 7644) +++ trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java 2010-04-27 20:14:08 UTC (rev 7645) @@ -26,6 +26,7 @@ import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.archetype.ArchetypeSet; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.exitconnector.ExitConnectorModel; import net.sf.gridarta.model.exitconnector.ExitLocation; @@ -89,6 +90,12 @@ private final InsertionModeSet<G, A, R> insertionModeSet; /** + * The {@link ArchetypeChooserModel} to use. + */ + @NotNull + private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; + + /** * Creates a new instance. * @param exitConnectorModel the exit connector model to use * @param exitMatcher the exit matcher to use @@ -97,8 +104,9 @@ * @param fileControl the file control to use * @param pathManager the path manager for converting path names * @param insertionModeSet the insertion mode set to use + * @param archetypeChooserModel the archetype chooser model to use */ - public ExitConnectorActions(@NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ExitMatcher<G, A, R> exitMatcher, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R> mapManager, @NotNull final FileControl<G, A, R> fileControl, @NotNull final PathManager pathManager, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { + public ExitConnectorActions(@NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ExitMatcher<G, A, R> exitMatcher, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R> mapManager, @NotNull final FileControl<G, A, R> fileControl, @NotNull final PathManager pathManager, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel) { this.exitConnectorModel = exitConnectorModel; this.exitMatcher = exitMatcher; this.archetypeSet = archetypeSet; @@ -106,6 +114,7 @@ this.fileControl = fileControl; this.pathManager = pathManager; this.insertionModeSet = insertionModeSet; + this.archetypeChooserModel = archetypeChooserModel; } /** @@ -168,7 +177,7 @@ } else { // paste into newly created exit game object - final R targetArchetype = archetypeSet.getArchetype(exitConnectorModel.getExitArchetypeName()); + final BaseObject<G, A, R, ?> targetArchetype = archetypeSet.getArchetype(exitConnectorModel.getExitArchetypeName()); if (targetArchetype == null) { return false; } @@ -204,7 +213,7 @@ } @Nullable final BaseObject<G, A, R, ?> targetExit; - @Nullable final R targetArchetype; + @Nullable final BaseObject<G, A, R, ?> targetArchetype; //XXX final G selectedExit = exitMatcher.getValidExit(selectedSquareModel.getSelectedGameObject()); //XXX if (selectedExit != null) { //XXX targetExit = selectedExit; @@ -259,7 +268,7 @@ * @param sourceExitLocation the source's exit location @return whether the action was or can be performed * @return whether the action was or can be performed */ - private boolean doExitConnect(final boolean performAction, @Nullable final BaseObject<?, ?, ?, ?> targetExit, @Nullable final R targetArchetype, @NotNull final MapModel<G, A, R> targetMapModel, @NotNull final Point targetLocation, @NotNull final File targetMapFile, @NotNull final MapModel<G, A, R> sourceMapModel, @NotNull final ExitLocation sourceExitLocation) { + private boolean doExitConnect(final boolean performAction, @Nullable final BaseObject<?, ?, ?, ?> targetExit, @Nullable final BaseObject<G, A, R, ?> targetArchetype, @NotNull final MapModel<G, A, R> targetMapModel, @NotNull final Point targetLocation, @NotNull final File targetMapFile, @NotNull final MapModel<G, A, R> sourceMapModel, @NotNull final ExitLocation sourceExitLocation) { final File sourceMapFile = sourceMapModel.getMapFile(); if (sourceMapFile == null) { // source map is unsaved ==> cannot connect @@ -269,7 +278,7 @@ final Point sourceLocation = sourceExitLocation.getMapCoordinate(); @Nullable final BaseObject<G, A, R, ?> sourceExit; - @Nullable final R sourceArchetype; + @Nullable final BaseObject<G, A, R, ?> sourceArchetype; final BaseObject<G, A, R, ?> exit = exitMatcher.getExit(sourceMapModel, sourceLocation); if (exit != null) { sourceExit = exit; @@ -330,10 +339,10 @@ * @param exitLocation the exit information to use * @return whether insertion was successful */ - private boolean pasteExit(@NotNull final Point location, @NotNull final MapModel<G, A, R> mapModel, @NotNull final R archetype, @NotNull final ExitLocation exitLocation) { + private boolean pasteExit(@NotNull final Point location, @NotNull final MapModel<G, A, R> mapModel, @NotNull final BaseObject<G, A, R, ?> archetype, @NotNull final ExitLocation exitLocation) { mapModel.beginTransaction("paste exit"); try { - final BaseObject<G, A, R, ?> newExit = mapModel.insertArchetype(archetype, location, true, false, insertionModeSet.getTopmostInsertionMode()); + final BaseObject<G, A, R, ?> newExit = mapModel.insertBaseObject(archetype, location, true, false, insertionModeSet.getTopmostInsertionMode(), archetypeChooserModel.getDirection()); if (newExit == null) { return false; } Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2010-04-27 19:57:52 UTC (rev 7644) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2010-04-27 20:14:08 UTC (rev 7645) @@ -33,6 +33,7 @@ import net.sf.gridarta.model.archetypechooser.ArchetypeChooserFolder; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserPanel; +import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -141,8 +142,8 @@ @Nullable @Override public G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point pos, final boolean allowMany, @NotNull final InsertionMode<G, A, R> insertionMode) { - final R selectedArchetype = getSelection(); - return selectedArchetype == null ? null : mapModel.insertArchetype(selectedArchetype, pos, allowMany, true, insertionMode); + final BaseObject<G, A, R, ?> selectedArchetype = getSelection(); + return selectedArchetype == null ? null : mapModel.insertBaseObject(selectedArchetype, pos, allowMany, true, insertionMode, archetypeChooserModel.getDirection()); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2010-04-27 19:57:52 UTC (rev 7644) +++ trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2010-04-27 20:14:08 UTC (rev 7645) @@ -47,6 +47,7 @@ import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.objectchooser.ObjectChooserListener; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; @@ -112,6 +113,12 @@ private final InsertionModeSet<G, A, R> insertionModeSet; /** + * The {@link ArchetypeChooserModel} to use. + */ + @NotNull + private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; + + /** * The dialog instance. */ private final JDialog dialog; @@ -208,9 +215,11 @@ * @param faceObjectProviders the face object providers for looking up * faces * @param insertionModeSet the insertion mode set to use + * @param archetypeChooserModel the archetype chooser model to use */ - public ReplaceDialog(@NotNull final Component parent, @NotNull final MapModel<G, A, R> copyBufferMapModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { + public ReplaceDialog(@NotNull final Component parent, @NotNull final MapModel<G, A, R> copyBufferMapModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel) { this.insertionModeSet = insertionModeSet; + this.archetypeChooserModel = archetypeChooserModel; dialog = createDialog(parent, ACTION_BUILDER.getString("replaceTitle")); dialog.setModal(false); dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); @@ -471,7 +480,7 @@ // insert replacement object if (randomArch.isMulti()) { // multi's cannot be inserted properly, so we just put them ontop - mapModel.insertArchetype(randomArch.getArchetype(), new Point(square.getMapX(), square.getMapY()), false, false, insertionModeSet.getTopmostInsertionMode()); + mapModel.insertBaseObject(randomArch.getArchetype(), new Point(square.getMapX(), square.getMapY()), false, false, insertionModeSet.getTopmostInsertionMode(), archetypeChooserModel.getDirection()); // TODO: if from pickmap it could have special attributes -> copy them } else { Modified: trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialogManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialogManager.java 2010-04-27 19:57:52 UTC (rev 7644) +++ trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialogManager.java 2010-04-27 20:14:08 UTC (rev 7645) @@ -25,6 +25,7 @@ import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -68,6 +69,12 @@ @NotNull private final InsertionModeSet<G, A, R> insertionModeSet; + /** + * The {@link ArchetypeChooserModel} to use. + */ + @NotNull + private final ArchetypeChooserModel<G, A, R> archetypeChooserModel; + /** The map view manager listener to detect closed map views. */ private final MapViewManagerListener<G, A, R> mapViewManagerListener = new MapViewManagerListener<G, A, R>() { @@ -97,13 +104,15 @@ * @param faceObjectProviders the face object providers for looking up * faces * @param insertionModeSet the insertion mode set to use + * @param archetypeChooserModel the archetype chooser model to use */ - public ReplaceDialogManager(@NotNull final Component parent, @NotNull final MapModel<G, A, R> copyBufferMapModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { + public ReplaceDialogManager(@NotNull final Component parent, @NotNull final MapModel<G, A, R> copyBufferMapModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final ArchetypeChooserModel<G, A, R> archetypeChooserModel) { this.parent = parent; this.copyBufferMapModel = copyBufferMapModel; this.objectChooser = objectChooser; this.faceObjectProviders = faceObjectProviders; this.insertionModeSet = insertionModeSet; + this.archetypeChooserModel = archetypeChooserModel; mapViewManager.addMapViewManagerListener(mapViewManagerListener); } @@ -119,7 +128,7 @@ @NotNull public ReplaceDialog<G, A, R> getInstance() { if (instance == null) { - instance = new ReplaceDialog<G, A, R>(parent, copyBufferMapModel, objectChooser, faceObjectProviders, insertionModeSet); + instance = new ReplaceDialog<G, A, R>(parent, copyBufferMapModel, objectChooser, faceObjectProviders, insertionModeSet, archetypeChooserModel); } return instance; } Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-27 19:57:52 UTC (rev 7644) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-27 20:14:08 UTC (rev 7645) @@ -387,7 +387,7 @@ final MapModel<G, A, R> copyBufferMapModel = mapControlFactory.newMapModel(mapArchObject, null); final InsertionModeSet<G, A, R> insertionModeSet = new InsertionModeSet<G, A, R>(topmostInsertionMode); final CopyBuffer<G, A, R> copyBuffer = new CopyBuffer<G, A, R>(mapViewSettings, copyBufferMapModel, gameObjectFactory, insertionModeSet); - final ReplaceDialogManager<G, A, R> replaceDialogManager = new ReplaceDialogManager<G, A, R>(mainViewFrame, copyBufferMapModel, objectChooser, mapViewManager, faceObjectProviders, insertionModeSet); + final ReplaceDialogManager<G, A, R> replaceDialogManager = new ReplaceDialogManager<G, A, R>(mainViewFrame, copyBufferMapModel, objectChooser, mapViewManager, faceObjectProviders, insertionModeSet, archetypeChooserModel); new About(mainViewFrame); exiter = new DefaultExiter(mainViewFrame); scriptEditControl = new ScriptEditControl(scriptFileFilter, scriptExtension, mainViewFrame, globalSettings.getMapsDirectory(), prefs, exiter); @@ -432,7 +432,7 @@ final MainToolbar mainToolbar = new MainToolbar(globalSettings); mainView = new MainView(mainViewFrame, exitAction, statusBar, mapDesktop, icon, gameObjectAttributesControl, selectedSquareView, objectChooser, toolPalette, objectChoiceDisplay, exiter, menuBar, globalSettings, mainToolbar.getComponent()); exitConnectorModel = new ExitConnectorModel(); // XXX: should be part of DefaultMainControl - final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, archetypeSet, mapManager, fileControl, pathManager, insertionModeSet); // XXX: should be part of DefaultMainControl + final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, archetypeSet, mapManager, fileControl, pathManager, insertionModeSet, archetypeChooserModel); // XXX: should be part of DefaultMainControl new ExitConnectorController<G, A, R>(exitConnectorActions, exitConnectorModel, mapViewManager); final JMenu windowMenu = getMenu(menuBar, "window"); if (windowMenu == null) { Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-04-27 19:57:52 UTC (rev 7644) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-04-27 20:14:08 UTC (rev 7645) @@ -775,7 +775,7 @@ // put arch on the map if (templateGameObject.isArchetype()) { - newGameObject = insertArchetype(templateGameObject.getArchetype(), pos, true, join, topmostInsertionMode); + newGameObject = insertBaseObject(templateGameObject.getArchetype(), pos, true, join, topmostInsertionMode, archetypeChooserModel.getDirection()); if (newGameObject == null) { return null; } @@ -817,13 +817,6 @@ /** {@inheritDoc} */ @Nullable @Override - public G insertArchetype(@NotNull final R archetype, @NotNull final Point pos, final boolean allowDouble, final boolean join, @NotNull final InsertionMode<G, A, R> insertionMode) { - return insertBaseObject(archetype, pos, allowDouble, join, insertionMode, archetypeChooserModel.getDirection()); - } - - /** {@inheritDoc} */ - @Nullable - @Override public G insertBaseObject(@NotNull final BaseObject<G, A, R, ?> baseObject, @NotNull final Point pos, final boolean allowMany, final boolean join, @NotNull final InsertionMode<G, A, R> insertionMode, @Nullable final Integer direction) { if (!isPointValid(pos)) { return null; @@ -985,7 +978,7 @@ @Override public void addCopyToMap(@NotNull final BaseObject<G, A, R, ?> gameObject, @NotNull final Point pos, final boolean allowDouble, @NotNull final InsertionMode<G, A, R> insertionMode) { if (gameObject.isArchetype()) { - insertArchetype(gameObject.getArchetype(), pos, allowDouble, false, insertionMode); + insertBaseObject(gameObject.getArchetype(), pos, allowDouble, false, insertionMode, archetypeChooserModel.getDirection()); } else { final G newGameObject = gameObject.newInstance(gameObjectFactory); newGameObject.setMapX(pos.x); Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-04-27 19:57:52 UTC (rev 7644) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-04-27 20:14:08 UTC (rev 7645) @@ -319,26 +319,6 @@ void addGameObjectToMap(@NotNull G gameObject, @NotNull InsertionMode<G, A, R> insertionMode); /** - * Creates a game object from an archetype and adds it to the map. - * @param archetype the archetype to insert - * @param pos the insert-location on this map - * @param allowDouble if set, only one arch of the same kind can be - * inserted per square - * @param join if set, auto-joining is supported; autojoining is only done - * if enabled in the main control - * @param insertionMode the insertion mode to use - * @return The head of the inserted object or <code>null</code> if for some - * reason no object could be inserted. - * @todo discuss whether this method really belongs to a map model, as - * implementing this would require the map model to know more than is - * desireable (e.g. ArchObjectStack + MainControl). - * @todo discuss whether in the bad case an exception wouldn't be better - * than returning <code>null</code>. - */ - @Nullable - G insertArchetype(@NotNull R archetype, @NotNull Point pos, boolean allowDouble, boolean join, @NotNull InsertionMode<G, A, R> insertionMode); - - /** * Inserts a {@link BaseObject} to a map. Archetypes are instantiated, * game objects are cloned. * @param baseObject the base object Modified: trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2010-04-27 19:57:52 UTC (rev 7644) +++ trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2010-04-27 20:14:08 UTC (rev 7645) @@ -158,6 +158,11 @@ private GlobalSettings globalSettings; /** + * The {@link ArchetypeChooserModel} instance. + */ + private ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel; + + /** * The "topmost" {@link InsertionMode} instance. */ private InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode; @@ -395,7 +400,7 @@ final MapWriter<TestGameObject, TestMapArchObject, TestArchetype> mapWriter = new TestMapWriter(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); - final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); + archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); pathManager = new PathManager(globalSettings); final ScriptArchData<TestGameObject, TestMapArchObject, TestArchetype> scriptArchData = new TestScriptArchData(); final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(scriptArchData, faceObjectProviders, animationObjects); @@ -423,7 +428,7 @@ * @return the new exit connector actions instance */ private ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype> createActions(@NotNull final ExitConnectorModel model) { - return new ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype>(model, exitMatcher, archetypeSet, mapManager, new TestFileControl(), pathManager, insertionModeSet); + return new ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype>(model, exitMatcher, archetypeSet, mapManager, new TestFileControl(), pathManager, insertionModeSet, archetypeChooserModel); } /** @@ -465,10 +470,10 @@ * @param point the position to insert at * @param archetype the archetype to insert */ - private void insertArchetype(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final Point point, @NotNull final TestArchetype archetype) { + private void insertArchetype(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, @NotNull final Point point, @NotNull final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, ?> archetype) { mapModel.beginTransaction("test"); try { - mapModel.insertArchetype(archetype, point, true, false, topmostInsertionMode); + mapModel.insertBaseObject(archetype, point, true, false, topmostInsertionMode, archetypeChooserModel.getDirection()); } finally { mapModel.endTransaction(); } Modified: trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-04-27 19:57:52 UTC (rev 7644) +++ trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-04-27 20:14:08 UTC (rev 7645) @@ -34,6 +34,7 @@ import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.model.autojoin.AutojoinLists; +import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.DefaultFaceObjects; import net.sf.gridarta.model.face.FaceObjectProviders; @@ -138,6 +139,12 @@ private SystemIcons systemIcons = null; /** + * The {@link ArchetypeChooserModel} instance. + */ + @Nullable + private ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel; + + /** * The {@link AnimationObjects} instance. */ @Nullable @@ -213,7 +220,7 @@ result.setLength(0); mapModel.beginTransaction("TEST"); - for (final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject : mapModel.getMapSquare(new Point(1, 2))) { + for (final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, ?> gameObject : mapModel.getMapSquare(new Point(1, 2))) { gameObject.setAttributeString("key", "value"); } addGameObjectToMap(mapModel, "1", 2, 2, insertionModeSet.getAutoInsertionMode()); @@ -296,7 +303,7 @@ result.setLength(0); mapModel.beginTransaction("TEST"); - for (final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject : mapModel.getMapSquare(new Point(1, 2))) { + for (final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, ?> gameObject : mapModel.getMapSquare(new Point(1, 2))) { gameObject.setAttributeString("key", "value"); } mapModel.endTransaction(); @@ -315,7 +322,7 @@ public void testGetAllGameObjects1() { final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); assert animationObjects != null; - final TestArchetype archetype = new TestArchetype("arch", faceObjectProviders, animationObjects); + final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, TestArchetype> archetype = new TestArchetype("arch", faceObjectProviders, animationObjects); assert animationObjects != null; final TestArchetype archetype2 = new TestArchetype("arch2", faceObjectProviders, animationObjects); archetype2.setMultiY(1); @@ -323,7 +330,9 @@ mapModel.beginTransaction("TEST"); mapModel.resizeMap(new Size2D(1, 2)); - final TestGameObject gameObject = mapModel.insertArchetype(archetype, new Point(0, 0), true, false, insertionModeSet.getAutoInsertionMode()); + assert archetypeChooserModel != null; + final Integer direction = archetypeChooserModel.getDirection(); + final TestGameObject gameObject = mapModel.insertBaseObject(archetype, new Point(0, 0), true, false, insertionModeSet.getAutoInsertionMode(), direction); mapModel.endTransaction(); final List<TestGameObject> gameObjects = mapModel.getAllGameObjects(); @@ -393,7 +402,7 @@ } if (gameObjects != null) { final Collection<String> lines = new TreeSet<String>(); - for (final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject : gameObjects) { + for (final BaseObject<TestGameObject, TestMapArchObject, TestArchetype, ?> gameObject : gameObjects) { lines.add("game object " + gameObject.getMapX() + " " + gameObject.getMapY() + " " + gameObject.getBestName() + "\n"); } for (final String line : lines) { @@ -431,7 +440,7 @@ guiUtils.addToCache(iconName, imageIcon); } final TestMapArchObject mapArchObject = new TestMapArchObject(); - final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); + archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final MapViewSettings mapViewSettings = new MapViewSettings(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); @@ -442,6 +451,7 @@ final InsertionMode<TestGameObject, TestMapArchObject, TestArchetype> topmostInsertionMode = new TopmostInsertionMode<TestGameObject, TestMapArchObject, TestArchetype>(); insertionModeSet = new InsertionModeSet<TestGameObject, TestMapArchObject, TestArchetype>(topmostInsertionMode); insertionModeSet.init(new TypeNrsGameObjectMatcher(), new TypeNrsGameObjectMatcher(), new TypeNrsGameObjectMatcher()); + assert archetypeChooserModel != null; mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(autojoinLists, null, mapArchObject, archetypeChooserModel, 0, gameObjectFactory, gameObjectMatchers, topmostInsertionMode); result.setLength(0); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-27 19:57:58
|
Revision: 7644 http://gridarta.svn.sourceforge.net/gridarta/?rev=7644&view=rev Author: akirschbaum Date: 2010-04-27 19:57:52 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Remove MapModel.insertGameObject(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2010-04-27 19:53:08 UTC (rev 7643) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2010-04-27 19:57:52 UTC (rev 7644) @@ -47,6 +47,7 @@ import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.mapmanager.MapManagerListener; import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.io.MapReaderFactory; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -498,8 +499,8 @@ @Nullable @Override public G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point pos, final boolean allowMany, @NotNull final InsertionMode<G, A, R> insertionMode) { - final G gameObject = getSelection(); - return gameObject == null ? null : mapModel.insertGameObject(gameObject, pos, allowMany, insertionMode); + final BaseObject<G, A, R, ?> gameObject = getSelection(); + return gameObject == null ? null : mapModel.insertBaseObject(gameObject, pos, allowMany, false, insertionMode, null); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-04-27 19:53:08 UTC (rev 7643) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-04-27 19:57:52 UTC (rev 7644) @@ -824,13 +824,6 @@ /** {@inheritDoc} */ @Nullable @Override - public G insertGameObject(@NotNull final G gameObject, @NotNull final Point pos, final boolean allowMany, @NotNull final InsertionMode<G, A, R> insertionMode) { - return insertBaseObject(gameObject, pos, allowMany, false, insertionMode, null); - } - - /** {@inheritDoc} */ - @Nullable - @Override public G insertBaseObject(@NotNull final BaseObject<G, A, R, ?> baseObject, @NotNull final Point pos, final boolean allowMany, final boolean join, @NotNull final InsertionMode<G, A, R> insertionMode, @Nullable final Integer direction) { if (!isPointValid(pos)) { return null; Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-04-27 19:53:08 UTC (rev 7643) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-04-27 19:57:52 UTC (rev 7644) @@ -339,18 +339,6 @@ G insertArchetype(@NotNull R archetype, @NotNull Point pos, boolean allowDouble, boolean join, @NotNull InsertionMode<G, A, R> insertionMode); /** - * Adds a {@link GameObject} to the map. - * @param gameObject the game object to insert - * @param pos the insert-location on this map - * @param allowMany whether duplicates are allowed - * @param insertionMode the insertion mode to use - * @return the inserted game object or <code>null</code> if nothing was - * inserted - */ - @Nullable - G insertGameObject(@NotNull G gameObject, @NotNull Point pos, boolean allowMany, @NotNull InsertionMode<G, A, R> insertionMode); - - /** * Inserts a {@link BaseObject} to a map. Archetypes are instantiated, * game objects are cloned. * @param baseObject the base object This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-27 19:53:15
|
Revision: 7643 http://gridarta.svn.sourceforge.net/gridarta/?rev=7643&view=rev Author: akirschbaum Date: 2010-04-27 19:53:08 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Add MapModel.insertBaseObject(). Use this function to implement MapModel.insertArchetype() and MapModel.insertGameObject(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-04-27 18:12:04 UTC (rev 7642) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/DefaultMapModel.java 2010-04-27 19:53:08 UTC (rev 7643) @@ -818,46 +818,66 @@ @Nullable @Override public G insertArchetype(@NotNull final R archetype, @NotNull final Point pos, final boolean allowDouble, final boolean join, @NotNull final InsertionMode<G, A, R> insertionMode) { + return insertBaseObject(archetype, pos, allowDouble, join, insertionMode, archetypeChooserModel.getDirection()); + } + + /** {@inheritDoc} */ + @Nullable + @Override + public G insertGameObject(@NotNull final G gameObject, @NotNull final Point pos, final boolean allowMany, @NotNull final InsertionMode<G, A, R> insertionMode) { + return insertBaseObject(gameObject, pos, allowMany, false, insertionMode, null); + } + + /** {@inheritDoc} */ + @Nullable + @Override + public G insertBaseObject(@NotNull final BaseObject<G, A, R, ?> baseObject, @NotNull final Point pos, final boolean allowMany, final boolean join, @NotNull final InsertionMode<G, A, R> insertionMode, @Nullable final Integer direction) { if (!isPointValid(pos)) { return null; } + final R realArchetype = baseObject.getArchetype(); final R effectiveArchetype; if (join) { - effectiveArchetype = autojoinLists.joinInsert(this, pos, archetype); + effectiveArchetype = autojoinLists.joinInsert(this, pos, realArchetype); if (effectiveArchetype == null) { return null; // only one autojoin type per square allowed } } else { - effectiveArchetype = archetype; + effectiveArchetype = realArchetype; } - if (!isMultiArchFittingToMap(effectiveArchetype, pos, allowDouble)) { + if (!isMultiArchFittingToMap(effectiveArchetype, pos, allowMany)) { return null; } - final Integer direction = archetypeChooserModel.getDirection(); - - G head = null; - for (R archetypePart = effectiveArchetype; archetypePart != null; archetypePart = archetypePart.getMultiNext()) { - final G part = gameObjectFactory.createGameObjectPart(archetypePart, head); - gameObjectMatchers.updateEditType(part, activeEditType); - if (head == null) { - head = part; + final List<G> parts = new ArrayList<G>(); + BaseObject<G, A, R, ?> baseObjectPart = baseObject; + for (R archetypePart = effectiveArchetype; archetypePart != null; archetypePart = archetypePart.getMultiNext(), baseObjectPart = baseObjectPart.getMultiNext()) { + if (baseObjectPart == null) { + throw new AssertionError("mutlt-parts of base object " + baseObject.getBestName() + " and archetype " + effectiveArchetype.getBestName() + " do not match"); } - - final int mapx = pos.x + part.getMultiX(); - final int mapy = pos.y + part.getMultiY(); - + final G part = baseObjectPart.newInstance(gameObjectFactory); + part.setArchetype(archetypePart); if (direction != null) { part.setAttributeString("direction", direction.toString()); } + if (!parts.isEmpty()) { + parts.get(0).addTailPart(part); + } + parts.add(part); + } + for (final G part : parts) { + gameObjectMatchers.updateEditType(part, activeEditType); + final int mapx = pos.x + part.getMultiX(); + final int mapy = pos.y + part.getMultiY(); part.setMapX(mapx); part.setMapY(mapy); insertionMode.insert(part, mapGrid[mapx][mapy]); } + final G head = parts.get(0); for (final G invObject : effectiveArchetype) { head.addLast(gameObjectFactory.cloneGameObject(invObject, 0, 0)); } @@ -866,40 +886,7 @@ } /** {@inheritDoc} */ - @Nullable @Override - public G insertGameObject(@NotNull final G gameObject, @NotNull final Point pos, final boolean allowMany, @NotNull final InsertionMode<G, A, R> insertionMode) { - if (!allowMany) { - // check if there is already an arch of that kind - for (final BaseObject<G, A, R, ?> t : getMapSquare(pos)) { - if (t.hasSameArchetype(gameObject) || t.getTypeNo() == gameObject.getTypeNo()) { - // there's a match - don't insert a second one - return null; - } - } - } - - if (!gameObject.isMulti()) { - // insert single square from pickmap - final G newObject = gameObjectFactory.cloneGameObject(gameObject, pos.x, pos.y); - addGameObjectToMap(newObject, insertionMode); - return newObject; - } - - // insert multi square from pickmap: - final GameObject<G, A, R> newHead = gameObject.getHead(); - // first insert default arch from archlist - final G newObject = insertArchetype(newHead.getArchetype(), pos, allowMany, false, insertionMode); - if (newObject != null) { - newObject.setObjectText(newHead.getObjectText()); - newObject.setAttributeString(Archetype.NAME, newHead.getObjName()); - newObject.setMsgText(newHead.getMsgText()); - } - return newObject; - } - - /** {@inheritDoc} */ - @Override public void addGameObjectToMap(@NotNull final G gameObject, @NotNull final InsertionMode<G, A, R> insertionMode) { final int mapx = gameObject.getMapX(); final int mapy = gameObject.getMapY(); Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-04-27 18:12:04 UTC (rev 7642) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/MapModel.java 2010-04-27 19:53:08 UTC (rev 7643) @@ -351,6 +351,22 @@ G insertGameObject(@NotNull G gameObject, @NotNull Point pos, boolean allowMany, @NotNull InsertionMode<G, A, R> insertionMode); /** + * Inserts a {@link BaseObject} to a map. Archetypes are instantiated, + * game objects are cloned. + * @param baseObject the base object + * @param pos the insert-location on this map + * @param allowMany whether duplicates are allowed + * @param join if set, auto-joining is supported; autojoining is only done + * if enabled in the main control + * @param insertionMode the insertion mode to use + * @param direction the game object's direction; <code>null</code>=default + * @return the inserted game object or <code>null</code> if nothing was + * inserted + */ + @Nullable + G insertBaseObject(@NotNull BaseObject<G, A, R, ?> baseObject, @NotNull Point pos, boolean allowMany, boolean join, @NotNull InsertionMode<G, A, R> insertionMode, @Nullable Integer direction); + + /** * Checks whether an GameObject (multi-arch) would still fit on this map. * @param archetype the archetype to check * @param pos position of multi-square head This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-27 18:12:11
|
Revision: 7642 http://gridarta.svn.sourceforge.net/gridarta/?rev=7642&view=rev Author: akirschbaum Date: 2010-04-27 18:12:04 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Add @NotNull annotations. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-04-27 18:10:32 UTC (rev 7641) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-04-27 18:12:04 UTC (rev 7642) @@ -288,7 +288,7 @@ * @return whether the game object matches */ @Override - public boolean isMatching(final G gameObject) { + public boolean isMatching(@NotNull final G gameObject) { return activeTab == null ? false : activeTab.isMatching(gameObject); } Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java 2010-04-27 18:10:32 UTC (rev 7641) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java 2010-04-27 18:12:04 UTC (rev 7642) @@ -96,7 +96,7 @@ * @param gameObject the game object to match * @return whether the game object matches the selection */ - boolean isMatching(G gameObject); + boolean isMatching(@NotNull G gameObject); /** * Adds a listener to be notified. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-27 18:10:38
|
Revision: 7641 http://gridarta.svn.sourceforge.net/gridarta/?rev=7641&view=rev Author: akirschbaum Date: 2010-04-27 18:10:32 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Remove unneeded final modifiers. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java 2010-04-27 17:59:53 UTC (rev 7640) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java 2010-04-27 18:10:32 UTC (rev 7641) @@ -89,14 +89,14 @@ * inserted. */ @Nullable - G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull Point pos, boolean allowMany, InsertionMode<G, A, R> insertionMode); + G insertSelectedObject(@NotNull MapModel<G, A, R> mapModel, @NotNull Point pos, boolean allowMany, InsertionMode<G, A, R> insertionMode); /** * 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 */ - boolean isMatching(final G gameObject); + boolean isMatching(G gameObject); /** * Adds a listener to be notified. Modified: trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2010-04-27 17:59:53 UTC (rev 7640) +++ trunk/src/app/net/sf/gridarta/model/baseobject/BaseObject.java 2010-04-27 18:10:32 UTC (rev 7641) @@ -572,6 +572,6 @@ @NotNull G newInstance(@NotNull GameObjectFactory<G, A, R> gameObjectFactory); - void visit(@NotNull final BaseObjectVisitor<G, A, R> baseObjectVisitor); + void visit(@NotNull BaseObjectVisitor<G, A, R> baseObjectVisitor); } // interface BaseObject This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-27 17:59:59
|
Revision: 7640 http://gridarta.svn.sourceforge.net/gridarta/?rev=7640&view=rev Author: akirschbaum Date: 2010-04-27 17:59:53 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2010-04-27 13:39:52 UTC (rev 7639) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2010-04-27 17:59:53 UTC (rev 7640) @@ -134,19 +134,14 @@ /** {@inheritDoc} */ @Override public boolean isMatching(@NotNull final G gameObject) { - final ArchetypeChooserPanel<G, A, R> selectedPanel = archetypeChooserModel.getSelectedPanel(); - return selectedPanel != null && selectedPanel.getSelectedFolder().getSelectedArchetype() == gameObject.getArchetype(); + return getSelection() == gameObject.getArchetype(); } /** {@inheritDoc} */ @Nullable @Override public G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point pos, final boolean allowMany, @NotNull final InsertionMode<G, A, R> insertionMode) { - final ArchetypeChooserPanel<G, A, R> selectedPanel = archetypeChooserModel.getSelectedPanel(); - if (selectedPanel == null) { - return null; - } - final R selectedArchetype = selectedPanel.getSelectedFolder().getSelectedArchetype(); + final R selectedArchetype = getSelection(); return selectedArchetype == null ? null : mapModel.insertArchetype(selectedArchetype, pos, allowMany, true, insertionMode); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-27 13:39:59
|
Revision: 7639 http://gridarta.svn.sourceforge.net/gridarta/?rev=7639&view=rev Author: akirschbaum Date: 2010-04-27 13:39:52 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Move LeftPanel creation from GUIMainControl to MainView. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/app/net/sf/gridarta/gui/misc/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-27 13:39:12 UTC (rev 7638) +++ trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-27 13:39:52 UTC (rev 7639) @@ -82,14 +82,17 @@ * @param icon the application's icon or <code>null</code> for default * @param gameObjectAttributesPanel the game object attributes panel * @param selectedSquareView the selected square view - * @param leftPanel the left panel instance + * @param objectChooser the object chooser + * @param toolPalette the tool palette + * @param objectChoiceDisplay the object choice display * @param exiter the exiter instance * @param menuBar the main menu bar * @param globalSettings the global settings to use * @param mainToolbar the main toolbar component */ - public MainView(@NotNull final JFrame frame, @NotNull final ActionListener exitAction, @NotNull final Component statusBar, @NotNull final Component mapDesktop, @Nullable final ImageIcon icon, @NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, @NotNull final Component leftPanel, @NotNull final Exiter exiter, @NotNull final JMenuBar menuBar, @NotNull final GlobalSettings globalSettings, @NotNull final Component mainToolbar) { + public MainView(@NotNull final JFrame frame, @NotNull final ActionListener exitAction, @NotNull final Component statusBar, @NotNull final Component mapDesktop, @Nullable final ImageIcon icon, @NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, @NotNull final Component objectChooser, @NotNull final Component toolPalette, @NotNull final Component objectChoiceDisplay, @NotNull final Exiter exiter, @NotNull final JMenuBar menuBar, @NotNull final GlobalSettings globalSettings, @NotNull final Component mainToolbar) { this.frame = frame; + final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay, exiter); frame.add(statusBar, BorderLayout.SOUTH); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-27 13:39:12 UTC (rev 7638) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-27 13:39:52 UTC (rev 7639) @@ -70,7 +70,6 @@ import net.sf.gridarta.gui.mapuserlistener.MapUserListenerManager; import net.sf.gridarta.gui.misc.About; import net.sf.gridarta.gui.misc.HelpActions; -import net.sf.gridarta.gui.misc.LeftPanel; import net.sf.gridarta.gui.misc.MainToolbar; import net.sf.gridarta.gui.misc.MainView; import net.sf.gridarta.gui.misc.MapPreview; @@ -427,12 +426,11 @@ final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet); new FindArchetypesDialogManager<G, A, R>(mainViewFrame, archetypeChooserControl, objectChooser, archetypeTypeSet); new UndoControl<G, A, R>(mapManager, gameObjectFactory, gameObjectMatchers); - final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay, exiter); final UpdaterManager updaterManager = new UpdaterManager(exiter, mapManager, mainViewFrame, gridartaJarFilename); updaterManager.startup(); final JMenuBar menuBar = ACTION_BUILDER.createMenuBar(true, "main"); final MainToolbar mainToolbar = new MainToolbar(globalSettings); - mainView = new MainView(mainViewFrame, exitAction, statusBar, mapDesktop, icon, gameObjectAttributesControl, selectedSquareView, leftPanel, exiter, menuBar, globalSettings, mainToolbar.getComponent()); + mainView = new MainView(mainViewFrame, exitAction, statusBar, mapDesktop, icon, gameObjectAttributesControl, selectedSquareView, objectChooser, toolPalette, objectChoiceDisplay, exiter, menuBar, globalSettings, mainToolbar.getComponent()); exitConnectorModel = new ExitConnectorModel(); // XXX: should be part of DefaultMainControl final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, archetypeSet, mapManager, fileControl, pathManager, insertionModeSet); // XXX: should be part of DefaultMainControl new ExitConnectorController<G, A, R>(exitConnectorActions, exitConnectorModel, mapViewManager); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-27 13:39:18
|
Revision: 7638 http://gridarta.svn.sourceforge.net/gridarta/?rev=7638&view=rev Author: akirschbaum Date: 2010-04-27 13:39:12 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Weaken type. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/misc/LeftPanel.java Modified: trunk/src/app/net/sf/gridarta/gui/misc/LeftPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/LeftPanel.java 2010-04-27 12:54:50 UTC (rev 7637) +++ trunk/src/app/net/sf/gridarta/gui/misc/LeftPanel.java 2010-04-27 13:39:12 UTC (rev 7638) @@ -24,7 +24,7 @@ import javax.swing.JPanel; import javax.swing.JSplitPane; import net.sf.gridarta.gui.utils.GSplitPane; -import net.sf.gridarta.mainactions.DefaultExiter; +import net.sf.gridarta.utils.Exiter; import net.sf.gridarta.utils.ExiterListener; import org.jetbrains.annotations.NotNull; @@ -60,7 +60,7 @@ * @param objectChoiceDisplay the object choice display * @param exiter the exiter instance */ - public LeftPanel(@NotNull final Component objectChooser, @NotNull final Component toolPalette, @NotNull final Component objectChoiceDisplay, @NotNull final DefaultExiter exiter) { + public LeftPanel(@NotNull final Component objectChooser, @NotNull final Component toolPalette, @NotNull final Component objectChoiceDisplay, @NotNull final Exiter exiter) { super(new BorderLayout()); // TODO: introduce a tool registry This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-27 12:54:57
|
Revision: 7637 http://gridarta.svn.sourceforge.net/gridarta/?rev=7637&view=rev Author: akirschbaum Date: 2010-04-27 12:54:50 +0000 (Tue, 27 Apr 2010) Log Message: ----------- Remove MainViewPanel.saveLocations(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java trunk/src/app/net/sf/gridarta/gui/misc/MainViewPanel.java Modified: trunk/src/app/net/sf/gridarta/gui/misc/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-26 19:22:25 UTC (rev 7636) +++ trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-27 12:54:50 UTC (rev 7637) @@ -74,12 +74,6 @@ private final Component frame; /** - * The {@link MainViewPanel} that contains all GUI elements. - */ - @Nullable - private final MainViewPanel mainViewPanel; - - /** * Constructs the main view and registers the given main controller. * @param frame the main window of the editor * @param exitAction the action to execute when the window is closed @@ -128,8 +122,6 @@ prefs.putInt(WINDOW_Y, bounds.y); prefs.putInt(WINDOW_WIDTH, bounds.width); prefs.putInt(WINDOW_HEIGHT, bounds.height); - assert mainViewPanel != null; - mainViewPanel.saveLocations(); prefs.putInt(WINDOW_STATE, frame.getExtendedState()); } @@ -149,7 +141,7 @@ final int defwidth = (int) (0.9 * screen.getWidth()); final int defheight = (int) (0.9 * screen.getHeight()); - mainViewPanel = new MainViewPanel(gameObjectAttributesPanel, selectedSquareView, leftPanel, globalSettings, mainToolbar, mapDesktop, getDefaultWidth(), getDefaultHeight()); + final MainViewPanel mainViewPanel = new MainViewPanel(gameObjectAttributesPanel, selectedSquareView, leftPanel, globalSettings, mainToolbar, mapDesktop, getDefaultWidth(), getDefaultHeight(), exiter); frame.add(mainViewPanel.getComponent(), BorderLayout.CENTER); frame.setJMenuBar(menuBar); Modified: trunk/src/app/net/sf/gridarta/gui/misc/MainViewPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/MainViewPanel.java 2010-04-26 19:22:25 UTC (rev 7636) +++ trunk/src/app/net/sf/gridarta/gui/misc/MainViewPanel.java 2010-04-27 12:54:50 UTC (rev 7637) @@ -27,6 +27,8 @@ import net.sf.gridarta.gui.utils.GSplitPane; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.model.settings.GlobalSettingsListener; +import net.sf.gridarta.utils.Exiter; +import net.sf.gridarta.utils.ExiterListener; import org.jetbrains.annotations.NotNull; /** @@ -126,8 +128,9 @@ * @param mapDesktop the map desktop to show * @param defaultWidth the main window's default width * @param defaultHeight the main window's default height + * @param exiter the exiter instance */ - public MainViewPanel(@NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, @NotNull final Component leftPanel, @NotNull final GlobalSettings globalSettings, @NotNull final Component mainToolbar, @NotNull final Component mapDesktop, final int defaultWidth, final int defaultHeight) { + public MainViewPanel(@NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, @NotNull final Component leftPanel, @NotNull final GlobalSettings globalSettings, @NotNull final Component mainToolbar, @NotNull final Component mapDesktop, final int defaultWidth, final int defaultHeight, @NotNull final Exiter exiter) { this.mapDesktop = mapDesktop; this.gameObjectAttributesPanel = gameObjectAttributesPanel; this.selectedSquareView = selectedSquareView; @@ -137,6 +140,37 @@ container.add(mainToolbar, BorderLayout.NORTH); container.add(createCenterPanel(globalSettings.isMapSquareListBottom(), leftPanel), BorderLayout.CENTER); globalSettings.addGlobalSettingsListener(globalSettingsListener); + + final ExiterListener exiterListener = new ExiterListener() { + + /** + * {@inheritDoc} + */ + @Override + public void preExitNotify() { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void appExitNotify() { + splitPane.saveLocation(); + splitDownPane.saveLocation(); + splitRightPane.saveLocation(); + } + + /** + * {@inheritDoc} + */ + @Override + public void waitExitNotify() { + // ignore + } + + }; + exiter.addExiterListener(exiterListener); } /** @@ -187,13 +221,4 @@ splitDownPane.setResizeWeight(1); } - /** - * Saves the current split pane locations. - */ - public void saveLocations() { - splitPane.saveLocation(); - splitDownPane.saveLocation(); - splitRightPane.saveLocation(); - } - } // class MainViewPanel This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-26 19:22:35
|
Revision: 7636 http://gridarta.svn.sourceforge.net/gridarta/?rev=7636&view=rev Author: akirschbaum Date: 2010-04-26 19:22:25 +0000 (Mon, 26 Apr 2010) Log Message: ----------- Remove unused variable. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-26 19:19:59 UTC (rev 7635) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-26 19:22:25 UTC (rev 7636) @@ -400,7 +400,7 @@ fileControl = new DefaultFileControl<G, A, R>(globalSettings, archetypeSet, mapImageCache, mapManager, mapViewsManager, mainViewFrame, FileFilters.mapFileFilter, scriptFileFilter, newMapDialogFactory, scriptExtension, scriptEditControl); new MapFileActions<G, A, R>(imageCreator2, mapManager, mapViewsManager, mapViewManager, fileControl, mainViewFrame); final MapManagerActions<G, A, R> mapManagerActions = new MapManagerActions<G, A, R>(fileControl); - final MainActions<G, A, R> mainActions = new MainActions<G, A, R>(replaceDialogManager, mainViewFrame, globalSettings, validators, mapViewSettings, archetypeSet, copyBuffer, copyBufferMapModel, objectChooser, mapManager, mapViewManager, resources, faceObjectProviders, gameObjectFactory, insertionModeSet, exiter); + new MainActions<G, A, R>(replaceDialogManager, mainViewFrame, globalSettings, validators, mapViewSettings, archetypeSet, copyBuffer, copyBufferMapModel, objectChooser, mapManager, mapViewManager, resources, faceObjectProviders, gameObjectFactory, insertionModeSet, exiter); final GameObjectMatcher floorMatcher = gameObjectMatchers.getMatcher("system_floor", "floor"); final GameObjectMatcher wallMatcher = gameObjectMatchers.getMatcher("system_wall", "wall"); final ErrorViewCollector gameObjectMatchersErrorViewCollector = new ErrorViewCollector(errorView, new File(globalSettings.getConfigurationDirectory(), "GameObjectMatchers.xml")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-26 19:20:05
|
Revision: 7635 http://gridarta.svn.sourceforge.net/gridarta/?rev=7635&view=rev Author: akirschbaum Date: 2010-04-26 19:19:59 +0000 (Mon, 26 Apr 2010) Log Message: ----------- Remove MainView.init(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/app/net/sf/gridarta/gui/misc/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-26 19:12:29 UTC (rev 7634) +++ trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-26 19:19:59 UTC (rev 7635) @@ -35,8 +35,8 @@ import javax.swing.JOptionPane; import javax.swing.WindowConstants; import net.sf.gridarta.MainControl; -import net.sf.gridarta.mainactions.DefaultExiter; import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.utils.Exiter; import net.sf.gridarta.utils.ExiterListener; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -71,40 +71,15 @@ * The main window of the editor. */ @NotNull - private final JFrame frame; + private final Component frame; /** * The {@link MainViewPanel} that contains all GUI elements. */ @Nullable - private MainViewPanel mainViewPanel; + private final MainViewPanel mainViewPanel; /** - * The map desktop. - * @serial - */ - @NotNull - private final Component mapDesktop; - - /** - * The game object attributes panel. - */ - @NotNull - private final Component gameObjectAttributesPanel; - - /** - * The selected square view. - */ - @NotNull - private final Component selectedSquareView; - - /** - * The left panel instance. - */ - @NotNull - private final Component leftPanel; - - /** * Constructs the main view and registers the given main controller. * @param frame the main window of the editor * @param exitAction the action to execute when the window is closed @@ -115,13 +90,12 @@ * @param selectedSquareView the selected square view * @param leftPanel the left panel instance * @param exiter the exiter instance + * @param menuBar the main menu bar + * @param globalSettings the global settings to use + * @param mainToolbar the main toolbar component */ - public MainView(@NotNull final JFrame frame, @NotNull final ActionListener exitAction, @NotNull final Component statusBar, @NotNull final Component mapDesktop, @Nullable final ImageIcon icon, @NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, @NotNull final Component leftPanel, @NotNull final DefaultExiter exiter) { + public MainView(@NotNull final JFrame frame, @NotNull final ActionListener exitAction, @NotNull final Component statusBar, @NotNull final Component mapDesktop, @Nullable final ImageIcon icon, @NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, @NotNull final Component leftPanel, @NotNull final Exiter exiter, @NotNull final JMenuBar menuBar, @NotNull final GlobalSettings globalSettings, @NotNull final Component mainToolbar) { this.frame = frame; - this.mapDesktop = mapDesktop; - this.gameObjectAttributesPanel = gameObjectAttributesPanel; - this.selectedSquareView = selectedSquareView; - this.leftPanel = leftPanel; frame.add(statusBar, BorderLayout.SOUTH); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { @@ -169,16 +143,7 @@ }; exiter.addExiterListener(exiterListener); - } - /** - * Initializes (builds) this view. - * @param menuBar the main menu bar - * @param globalSettings the global settings to use - * @param mainToolbar the main toolbar component - */ - @Deprecated - public void init(@NotNull final JMenuBar menuBar, @NotNull final GlobalSettings globalSettings, @NotNull final Component mainToolbar) { // calculate some default values in case there is no settings file final RectangularShape screen = frame.getGraphicsConfiguration().getBounds(); final int defwidth = (int) (0.9 * screen.getWidth()); Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-26 19:12:29 UTC (rev 7634) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-26 19:19:59 UTC (rev 7635) @@ -428,12 +428,11 @@ new FindArchetypesDialogManager<G, A, R>(mainViewFrame, archetypeChooserControl, objectChooser, archetypeTypeSet); new UndoControl<G, A, R>(mapManager, gameObjectFactory, gameObjectMatchers); final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay, exiter); - mainView = new MainView(mainViewFrame, exitAction, statusBar, mapDesktop, icon, gameObjectAttributesControl, selectedSquareView, leftPanel, exiter); final UpdaterManager updaterManager = new UpdaterManager(exiter, mapManager, mainViewFrame, gridartaJarFilename); updaterManager.startup(); final JMenuBar menuBar = ACTION_BUILDER.createMenuBar(true, "main"); final MainToolbar mainToolbar = new MainToolbar(globalSettings); - mainView.init(menuBar, globalSettings, mainToolbar.getComponent()); + mainView = new MainView(mainViewFrame, exitAction, statusBar, mapDesktop, icon, gameObjectAttributesControl, selectedSquareView, leftPanel, exiter, menuBar, globalSettings, mainToolbar.getComponent()); exitConnectorModel = new ExitConnectorModel(); // XXX: should be part of DefaultMainControl final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, archetypeSet, mapManager, fileControl, pathManager, insertionModeSet); // XXX: should be part of DefaultMainControl new ExitConnectorController<G, A, R>(exitConnectorActions, exitConnectorModel, mapViewManager); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-26 19:12:36
|
Revision: 7634 http://gridarta.svn.sourceforge.net/gridarta/?rev=7634&view=rev Author: akirschbaum Date: 2010-04-26 19:12:29 +0000 (Mon, 26 Apr 2010) Log Message: ----------- Replace dependencies Exiter -> * with ExiterListener callbacks. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/gui/misc/LeftPanel.java trunk/src/app/net/sf/gridarta/gui/misc/MainView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxCellRenderer.java trunk/src/app/net/sf/gridarta/mainactions/MainActions.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java trunk/src/app/net/sf/gridarta/updater/Updater.java trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/mainactions/DefaultExiter.java trunk/src/app/net/sf/gridarta/utils/Exiter.java trunk/src/app/net/sf/gridarta/utils/ExiterListener.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/mainactions/Exiter.java Modified: trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/delayedmapmodel/DelayedMapModelListenerManager.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -36,6 +36,8 @@ import net.sf.gridarta.model.map.mapmodel.MapSquare; import net.sf.gridarta.model.map.validation.ErrorCollector; import net.sf.gridarta.utils.EventListenerList2; +import net.sf.gridarta.utils.Exiter; +import net.sf.gridarta.utils.ExiterListener; import net.sf.gridarta.utils.Size2D; import org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -190,10 +192,46 @@ /** * Creates a new instance. * @param mapManager the map manager to track + * @param exiter the exiter instance */ - public DelayedMapModelListenerManager(@NotNull final MapManager<G, A, R> mapManager) { + public DelayedMapModelListenerManager(@NotNull final MapManager<G, A, R> mapManager, @NotNull final Exiter exiter) { this.mapManager = mapManager; mapManager.addMapManagerListener(mapManagerListener); + + final ExiterListener exiterListener = new ExiterListener() { + + /** + * {@inheritDoc} + */ + @Override + public void preExitNotify() { + thread.interrupt(); + try { + thread.join(); + } catch (final InterruptedException e) { + Thread.currentThread().interrupt(); + log.warn("DelayedMapModelListenerManager was interrupted"); + } + } + + /** + * {@inheritDoc} + */ + @Override + public void appExitNotify() { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void waitExitNotify() { + // ignore + } + + }; + exiter.addExiterListener(exiterListener); } /** @@ -205,15 +243,6 @@ } /** - * Stops execution. The function returns after processing has stopped. - * @throws InterruptedException if this thread is interrupted while waiting - * for the worker thread to terminate - */ - public void stop() throws InterruptedException { - thread.interrupt(); - thread.join(); - } - /** * Adds a {@link DelayedMapModelListener} to be notified. * @param listener the listener */ Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -52,6 +52,7 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareModelListener; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.utils.GSplitPane; +import net.sf.gridarta.mainactions.DefaultExiter; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.mapmanager.MapManagerListener; import net.sf.gridarta.model.anim.AnimationObjects; @@ -73,6 +74,7 @@ import net.sf.gridarta.model.match.GameObjectMatcher; import net.sf.gridarta.model.match.GameObjectMatchers; import net.sf.gridarta.model.scripts.ScriptArchData; +import net.sf.gridarta.utils.ExiterListener; import net.sf.gridarta.utils.Pair; import net.sf.gridarta.utils.Size2D; import net.sf.gridarta.utils.SystemIcons; @@ -415,8 +417,9 @@ * @param gameObjectFactory the game object factory for creating new game * objects * @param gameObjectMatchers the game object matchers to use + * @param exiter the exiter instance */ - public GameObjectAttributesControl(@NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R> mapManager, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers) { + public GameObjectAttributesControl(@NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final GameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R> mapManager, @NotNull final SelectedSquareModel<G, A, R> selectedSquareModel, @NotNull final SelectedSquareView<G, A, R> selectedSquareView, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final DefaultExiter exiter) { super(new BorderLayout()); this.gameObjectAttributesModel = gameObjectAttributesModel; this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; @@ -457,6 +460,35 @@ mapPanel.setLayout(new BorderLayout()); mapPanel.add(panelDesktop[MAP_PANEL], BorderLayout.CENTER); tabbedPane.add(mapPanel, "Map"); + + final ExiterListener exiterListener = new ExiterListener() { + + /** + * {@inheritDoc} + */ + @Override + public void preExitNotify() { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void appExitNotify() { + splitPane.saveLocation(); + } + + /** + * {@inheritDoc} + */ + @Override + public void waitExitNotify() { + // ignore + } + + }; + exiter.addExiterListener(exiterListener); } /** @@ -704,13 +736,6 @@ } /** - * Will be called when the application is exiting. - */ - public void appExitNotify() { - splitPane.saveLocation(); - } - - /** * Calculates the default value for {@link #MAPARCHPANEL_LOCATION_KEY}. * @return the default split pane location */ Modified: trunk/src/app/net/sf/gridarta/gui/misc/LeftPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/LeftPanel.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/gui/misc/LeftPanel.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -24,6 +24,8 @@ import javax.swing.JPanel; import javax.swing.JSplitPane; import net.sf.gridarta.gui.utils.GSplitPane; +import net.sf.gridarta.mainactions.DefaultExiter; +import net.sf.gridarta.utils.ExiterListener; import org.jetbrains.annotations.NotNull; /** @@ -56,8 +58,9 @@ * @param objectChooser the object chooser * @param toolPalette the tool palette * @param objectChoiceDisplay the object choice display + * @param exiter the exiter instance */ - public LeftPanel(@NotNull final Component objectChooser, @NotNull final Component toolPalette, @NotNull final Component objectChoiceDisplay) { + public LeftPanel(@NotNull final Component objectChooser, @NotNull final Component toolPalette, @NotNull final Component objectChoiceDisplay, @NotNull final DefaultExiter exiter) { super(new BorderLayout()); // TODO: introduce a tool registry @@ -65,13 +68,35 @@ splitPane.setContinuousLayout(true); add(splitPane, BorderLayout.CENTER); add(objectChoiceDisplay, BorderLayout.SOUTH); - } - /** - * Will be called when the application is exiting. - */ - public void appExitNotify() { - splitPane.saveLocation(); + final ExiterListener exiterListener = new ExiterListener() { + + /** + * {@inheritDoc} + */ + @Override + public void preExitNotify() { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void appExitNotify() { + splitPane.saveLocation(); + } + + /** + * {@inheritDoc} + */ + @Override + public void waitExitNotify() { + // ignore + } + + }; + exiter.addExiterListener(exiterListener); } } // class LeftPanel Modified: trunk/src/app/net/sf/gridarta/gui/misc/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -35,7 +35,9 @@ import javax.swing.JOptionPane; import javax.swing.WindowConstants; import net.sf.gridarta.MainControl; +import net.sf.gridarta.mainactions.DefaultExiter; import net.sf.gridarta.model.settings.GlobalSettings; +import net.sf.gridarta.utils.ExiterListener; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -112,8 +114,9 @@ * @param gameObjectAttributesPanel the game object attributes panel * @param selectedSquareView the selected square view * @param leftPanel the left panel instance + * @param exiter the exiter instance */ - public MainView(@NotNull final JFrame frame, @NotNull final ActionListener exitAction, @NotNull final Component statusBar, @NotNull final Component mapDesktop, @Nullable final ImageIcon icon, @NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, @NotNull final Component leftPanel) { + public MainView(@NotNull final JFrame frame, @NotNull final ActionListener exitAction, @NotNull final Component statusBar, @NotNull final Component mapDesktop, @Nullable final ImageIcon icon, @NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, @NotNull final Component leftPanel, @NotNull final DefaultExiter exiter) { this.frame = frame; this.mapDesktop = mapDesktop; this.gameObjectAttributesPanel = gameObjectAttributesPanel; @@ -130,6 +133,42 @@ if (icon != null) { frame.setIconImage(icon.getImage()); } + + final ExiterListener exiterListener = new ExiterListener() { + + /** + * {@inheritDoc} + */ + @Override + public void preExitNotify() { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void appExitNotify() { + final Rectangle bounds = frame.getBounds(); + prefs.putInt(WINDOW_X, bounds.x); + prefs.putInt(WINDOW_Y, bounds.y); + prefs.putInt(WINDOW_WIDTH, bounds.width); + prefs.putInt(WINDOW_HEIGHT, bounds.height); + assert mainViewPanel != null; + mainViewPanel.saveLocations(); + prefs.putInt(WINDOW_STATE, frame.getExtendedState()); + } + + /** + * {@inheritDoc} + */ + @Override + public void waitExitNotify() { + // ignore + } + + }; + exiter.addExiterListener(exiterListener); } /** @@ -159,19 +198,6 @@ frame.setExtendedState(prefs.getInt(WINDOW_STATE, frame.getExtendedState())); } - /** Notifies that the application is about to exit. */ - public void appExitNotify() { - // Store the location and size - final Rectangle bounds = frame.getBounds(); - prefs.putInt(WINDOW_X, bounds.x); - prefs.putInt(WINDOW_Y, bounds.y); - prefs.putInt(WINDOW_WIDTH, bounds.width); - prefs.putInt(WINDOW_HEIGHT, bounds.height); - assert mainViewPanel != null; - mainViewPanel.saveLocations(); - prefs.putInt(WINDOW_STATE, frame.getExtendedState()); - } - /** * This implementation displays the exception in a modal message dialog. */ Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxCellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxCellRenderer.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxCellRenderer.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -23,7 +23,6 @@ import javax.swing.ComboBoxEditor; import javax.swing.DefaultListCellRenderer; import javax.swing.JList; -import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.baseobject.BaseObject; import net.sf.gridarta.model.face.FaceObjectProviders; import org.jetbrains.annotations.NotNull; Copied: trunk/src/app/net/sf/gridarta/mainactions/DefaultExiter.java (from rev 7632, trunk/src/app/net/sf/gridarta/mainactions/Exiter.java) =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/DefaultExiter.java (rev 0) +++ trunk/src/app/net/sf/gridarta/mainactions/DefaultExiter.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -0,0 +1,151 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 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.mainactions; + +import java.awt.Window; +import java.lang.reflect.InvocationTargetException; +import java.util.prefs.Preferences; +import javax.swing.SwingUtilities; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.gui.prefs.DevPrefs; +import net.sf.gridarta.utils.EventListenerList2; +import net.sf.gridarta.utils.Exiter; +import net.sf.gridarta.utils.ExiterListener; +import net.sf.japi.swing.action.ActionBuilder; +import net.sf.japi.swing.action.ActionBuilderFactory; +import org.apache.log4j.Category; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; + +/** + * Exits the application. + * @author Andreas Kirschbaum + */ +public class DefaultExiter implements Exiter { + + /** + * The {@link ActionBuilder}. + */ + private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); + + /** + * The logger for printing log messages. + */ + @NotNull + private static final Category log = Logger.getLogger(DefaultExiter.class); + + /** + * The {@link Preferences}. + */ + @NotNull + private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + + /** + * The main window's frame. + */ + @NotNull + private final Window mainViewFrame; + + /** + * The {@link ExiterListener}s to notify. + */ + @NotNull + private final EventListenerList2<ExiterListener> exiterListeners = new EventListenerList2<ExiterListener>(ExiterListener.class); + + /** + * Creates a new instance. + * @param mainViewFrame the main window's frame + */ + public DefaultExiter(@NotNull final Window mainViewFrame) { + this.mainViewFrame = mainViewFrame; + } + + /** + * {@inheritDoc} + */ + @Override + public void addExiterListener(@NotNull final ExiterListener listener) { + exiterListeners.add(listener); + } + + /** + * {@inheritDoc} + */ + @Override + public void removeExiterListener(@NotNull final ExiterListener listener) { + exiterListeners.remove(listener); + } + + /** + * {@inheritDoc} + */ + @Override + public void doExit(final int returnCode) { + mainViewFrame.setEnabled(false); + for (final ExiterListener listener : exiterListeners.getListeners()) { + listener.preExitNotify(); + } + for (final ExiterListener listener : exiterListeners.getListeners()) { + listener.appExitNotify(); + } + final Thread thread = new Thread(new Runnable() { + /** {@inheritDoc} */ + @Override + public void run() { + for (final ExiterListener listener : exiterListeners.getListeners()) { + listener.waitExitNotify(); + } + try { + SwingUtilities.invokeAndWait(new Runnable() { + /** {@inheritDoc} */ + @Override + public void run() { + mainViewFrame.dispose(); + } + }); + } catch (final InterruptedException ex) { + Thread.currentThread().interrupt(); + log.warn("Cannot destroy main view: " + ex.getMessage()); + } catch (final InvocationTargetException ex) { + log.warn("Cannot destroy main view: " + ex.getMessage()); + } + callExit(returnCode); + } + }); + thread.start(); + } + + /** + * Calls {@link System#exit(int)} or does nothing depending on the user's + * settings. + * @param returnCode the return code to pass + */ + public static void callExit(final int returnCode) { + if (prefs.getBoolean(DevPrefs.PREFS_SYSTEM_EXIT, DevPrefs.PREFS_SYSTEM_EXIT_DEFAULT)) { + if (log.isDebugEnabled()) { + log.debug(ACTION_BUILDER.getString("logExitWithExit")); + } + System.exit(returnCode); + } else { + log.debug(ACTION_BUILDER.getString("logExitWithoutExit")); + } + } + +} // class DefaultExiter Property changes on: trunk/src/app/net/sf/gridarta/mainactions/DefaultExiter.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Deleted: trunk/src/app/net/sf/gridarta/mainactions/Exiter.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/Exiter.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/mainactions/Exiter.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -1,188 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 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.mainactions; - -import java.awt.Window; -import java.lang.reflect.InvocationTargetException; -import java.util.prefs.Preferences; -import javax.swing.SwingUtilities; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.delayedmapmodel.DelayedMapModelListenerManager; -import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesControl; -import net.sf.gridarta.gui.misc.LeftPanel; -import net.sf.gridarta.gui.misc.MainView; -import net.sf.gridarta.gui.prefs.DevPrefs; -import net.sf.gridarta.textedit.scripteditor.ScriptEditControl; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; - -/** - * Exits the application. - * @author Andreas Kirschbaum - */ -public class Exiter { - - /** - * The {@link ActionBuilder}. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** - * The logger for printing log messages. - */ - @NotNull - private static final Category log = Logger.getLogger(Exiter.class); - - /** - * The {@link Preferences}. - */ - @NotNull - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - - /** - * The {@link DelayedMapModelListenerManager}. - */ - @NotNull - private final DelayedMapModelListenerManager<?, ?, ?> delayedMapModelListenerManager; - - /** - * The {@link MainView}. - */ - @NotNull - private final MainView mainView; - - /** - * The main window's frame. - */ - @NotNull - private final Window mainViewFrame; - - /** - * The {@link GameObjectAttributesControl}. - */ - @NotNull - private final GameObjectAttributesControl<?, ?, ?> gameObjectAttributesControl; - - /** - * The {@link LeftPanel}. - */ - @NotNull - private final LeftPanel leftPanel; - - /** - * The {@link ScriptEditControl}. - */ - @NotNull - private final ScriptEditControl scriptEditControl; - - /** - * The {@link MainActions}. - */ - @NotNull - private final MainActions<?, ?, ?> mainActions; - - /** - * Creates a new instance. - * @param delayedMapModelListenerManager the delayed map model listener - * manager - * @param mainView the main view - * @param mainViewFrame the main window's frame - * @param gameObjectAttributesControl the game object attributes - * control - * @param leftPanel the left panel - * @param scriptEditControl the script edit control - * @param mainActions the main actions - */ - public Exiter(@NotNull final DelayedMapModelListenerManager<?, ?, ?> delayedMapModelListenerManager, @NotNull final MainView mainView, @NotNull final Window mainViewFrame, @NotNull final GameObjectAttributesControl<?, ?, ?> gameObjectAttributesControl, @NotNull final LeftPanel leftPanel, @NotNull final ScriptEditControl scriptEditControl, @NotNull final MainActions<?, ?, ?> mainActions) { - this.delayedMapModelListenerManager = delayedMapModelListenerManager; - this.mainView = mainView; - this.mainViewFrame = mainViewFrame; - this.gameObjectAttributesControl = gameObjectAttributesControl; - this.leftPanel = leftPanel; - this.scriptEditControl = scriptEditControl; - this.mainActions = mainActions; - } - - /** - * Exits the application. - * @param returnCode the application's return code - */ - public void doExit(final int returnCode) { - try { - delayedMapModelListenerManager.stop(); - } catch (final InterruptedException e) { - Thread.currentThread().interrupt(); - log.warn("DelayedMapModelListenerManager was interrupted"); - } - mainViewFrame.setEnabled(false); - mainView.appExitNotify(); - gameObjectAttributesControl.appExitNotify(); - leftPanel.appExitNotify(); - scriptEditControl.appExitNotify(); - final Thread thread = new Thread(new Runnable() { - /** {@inheritDoc} */ - @Override - public void run() { - try { - mainActions.waitUntilArchCollectionFinished(); - } catch (final InterruptedException ex) { - Thread.currentThread().interrupt(); - log.warn("Archetype collection was interrupted"); - } - try { - SwingUtilities.invokeAndWait(new Runnable() { - /** {@inheritDoc} */ - @Override - public void run() { - mainViewFrame.dispose(); - } - }); - } catch (final InterruptedException ex) { - Thread.currentThread().interrupt(); - log.warn("Cannot destroy main view: " + ex.getMessage()); - } catch (final InvocationTargetException ex) { - log.warn("Cannot destroy main view: " + ex.getMessage()); - } - callExit(returnCode); - } - }); - thread.start(); - } - - /** - * Calls {@link System#exit(int)} or does nothing depending on the user's - * settings. - * @param returnCode the return code to pass - */ - public static void callExit(final int returnCode) { - if (prefs.getBoolean(DevPrefs.PREFS_SYSTEM_EXIT, DevPrefs.PREFS_SYSTEM_EXIT_DEFAULT)) { - if (log.isDebugEnabled()) { - log.debug(ACTION_BUILDER.getString("logExitWithExit")); - } - System.exit(returnCode); - } else { - log.debug(ACTION_BUILDER.getString("logExitWithoutExit")); - } - } - -} // class Exiter Modified: trunk/src/app/net/sf/gridarta/mainactions/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/mainactions/MainActions.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -59,6 +59,8 @@ import net.sf.gridarta.model.mapviewsettings.MapViewSettings; import net.sf.gridarta.model.settings.GlobalSettings; import net.sf.gridarta.resource.AbstractResources; +import net.sf.gridarta.utils.Exiter; +import net.sf.gridarta.utils.ExiterListener; import net.sf.gridarta.utils.Size2D; import net.sf.gridarta.validation.DelegatingMapValidator; import net.sf.japi.swing.action.ActionBuilder; @@ -66,6 +68,8 @@ import net.sf.japi.swing.action.ActionMethod; import net.sf.japi.swing.misc.Progress; import net.sf.japi.swing.misc.ProgressDisplay; +import org.apache.log4j.Category; +import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -79,6 +83,11 @@ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); /** + * The Logger for printing log messages. + */ + private static final Category log = Logger.getLogger(MainActions.class); + + /** * The replace dialog manager to use. */ @NotNull @@ -389,8 +398,9 @@ * faces * @param gameObjectFactory the game object factory to use * @param insertionModeSet the insertion mode set to use + * @param exiter the exiter instance */ - public MainActions(@NotNull final ReplaceDialogManager<G, A, R> replaceDialogManager, @NotNull final JFrame parent, @NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final MapViewSettings mapViewSettings, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R> copyBuffer, @NotNull final MapModel<G, A, R> copyBufferMapModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final AbstractResources<G, A, R> resources, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final InsertionModeSet<G, A, R> insertionModeSet) { + public MainActions(@NotNull final ReplaceDialogManager<G, A, R> replaceDialogManager, @NotNull final JFrame parent, @NotNull final GlobalSettings globalSettings, @NotNull final DelegatingMapValidator<G, A, R> validators, @NotNull final MapViewSettings mapViewSettings, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R> copyBuffer, @NotNull final MapModel<G, A, R> copyBufferMapModel, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final AbstractResources<G, A, R> resources, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final GameObjectFactory<G, A, R> gameObjectFactory, @NotNull final InsertionModeSet<G, A, R> insertionModeSet, @NotNull final Exiter exiter) { this.replaceDialogManager = replaceDialogManager; this.parent = parent; this.globalSettings = globalSettings; @@ -434,6 +444,44 @@ currentMapView = mapViewManager.getActiveMapView(); archetypeSet.addArchetypeSetListener(archetypeSetListener); copyBufferMapModel.addMapModelListener(mapModelListener); + + final ExiterListener exiterListener = new ExiterListener() { + + /** + * {@inheritDoc} + */ + @Override + public void preExitNotify() { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void appExitNotify() { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void waitExitNotify() { + final Collector tmp = collector; + if (tmp != null) { + try { + tmp.waitUntilFinished(); + } catch (final InterruptedException ex) { + Thread.currentThread().interrupt(); + log.warn("DelayedMapModelListenerManager was interrupted"); + } + } + } + + }; + exiter.addExiterListener(exiterListener); + refreshMenus(); } @@ -716,17 +764,6 @@ aCollectArches.setEnabled(isCollectArchesEnabled()); } - /** - * Blocks until archetype collection has finished. - * @throws InterruptedException if waiting was interrupted - */ - public void waitUntilArchCollectionFinished() throws InterruptedException { - final Collector tmp = collector; - if (tmp != null) { - tmp.waitUntilFinished(); - } - } - /** Invoked when the user wants to reload the images. */ public void reloadFaces() { faceObjectProviders.reloadAll(); Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -95,7 +95,7 @@ import net.sf.gridarta.gui.spells.SpellsUtils; import net.sf.gridarta.gui.treasurelist.CFTreasureListTree; import net.sf.gridarta.gui.undo.UndoControl; -import net.sf.gridarta.mainactions.Exiter; +import net.sf.gridarta.mainactions.DefaultExiter; import net.sf.gridarta.mainactions.MainActions; import net.sf.gridarta.mapfiles.Loader; import net.sf.gridarta.mapfiles.MapFolderTree; @@ -288,10 +288,10 @@ private final ConfigSourceFactory configSourceFactory; /** - * The {@link Exiter} for terminating the application. + * The {@link DefaultExiter} for terminating the application. */ @NotNull - private final Exiter exiter; + private final DefaultExiter exiter; /** * Creates a new instance. @@ -390,7 +390,8 @@ final CopyBuffer<G, A, R> copyBuffer = new CopyBuffer<G, A, R>(mapViewSettings, copyBufferMapModel, gameObjectFactory, insertionModeSet); final ReplaceDialogManager<G, A, R> replaceDialogManager = new ReplaceDialogManager<G, A, R>(mainViewFrame, copyBufferMapModel, objectChooser, mapViewManager, faceObjectProviders, insertionModeSet); new About(mainViewFrame); - scriptEditControl = new ScriptEditControl(scriptFileFilter, scriptExtension, mainViewFrame, globalSettings.getMapsDirectory(), prefs); + exiter = new DefaultExiter(mainViewFrame); + scriptEditControl = new ScriptEditControl(scriptFileFilter, scriptExtension, mainViewFrame, globalSettings.getMapsDirectory(), prefs, exiter); final TextAreaDefaults textAreaDefaults = new TextAreaDefaults(scriptEditControl); gameObjectAttributesDialogFactory.setTextAreaDefaults(textAreaDefaults); scriptEditControl.setTextAreaDefaults(textAreaDefaults); @@ -399,7 +400,7 @@ fileControl = new DefaultFileControl<G, A, R>(globalSettings, archetypeSet, mapImageCache, mapManager, mapViewsManager, mainViewFrame, FileFilters.mapFileFilter, scriptFileFilter, newMapDialogFactory, scriptExtension, scriptEditControl); new MapFileActions<G, A, R>(imageCreator2, mapManager, mapViewsManager, mapViewManager, fileControl, mainViewFrame); final MapManagerActions<G, A, R> mapManagerActions = new MapManagerActions<G, A, R>(fileControl); - final MainActions<G, A, R> mainActions = new MainActions<G, A, R>(replaceDialogManager, mainViewFrame, globalSettings, validators, mapViewSettings, archetypeSet, copyBuffer, copyBufferMapModel, objectChooser, mapManager, mapViewManager, resources, faceObjectProviders, gameObjectFactory, insertionModeSet); + final MainActions<G, A, R> mainActions = new MainActions<G, A, R>(replaceDialogManager, mainViewFrame, globalSettings, validators, mapViewSettings, archetypeSet, copyBuffer, copyBufferMapModel, objectChooser, mapManager, mapViewManager, resources, faceObjectProviders, gameObjectFactory, insertionModeSet, exiter); final GameObjectMatcher floorMatcher = gameObjectMatchers.getMatcher("system_floor", "floor"); final GameObjectMatcher wallMatcher = gameObjectMatchers.getMatcher("system_wall", "wall"); final ErrorViewCollector gameObjectMatchersErrorViewCollector = new ErrorViewCollector(errorView, new File(globalSettings.getConfigurationDirectory(), "GameObjectMatchers.xml")); @@ -414,11 +415,11 @@ final MapPropertiesDialogFactory<G, A, R> mapPropertiesDialogFactory = editorFactory.newMapPropertiesDialogFactory(globalSettings, mapManager, mapPathNormalizer, mapViewsManager); new DefaultMapActions<G, A, R>(mainViewFrame, mainViewFrame, mapManager, mapViewManager, exitMatcher, FileFilters.mapFileFilter, selectedSquareModel, directionMap, allowRandomMapParameters, mapPropertiesDialogFactory, mapViewSettings, mapPathNormalizer, mapViewsManager); ArchetypeTypeChecks.addChecks(archetypeTypeSet, attributeRangeChecker); - final DelayedMapModelListenerManager<G, A, R> delayedMapModelListenerManager = new DelayedMapModelListenerManager<G, A, R>(mapManager); + final DelayedMapModelListenerManager<G, A, R> delayedMapModelListenerManager = new DelayedMapModelListenerManager<G, A, R>(mapManager, exiter); final LockedItemsControl<G, A, R> lockedItemsControl = new LockedItemsControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, lockedItemsTypeNumbers); final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel = new GameObjectAttributesModel<G, A, R>(); final SelectedSquareView<G, A, R> selectedSquareView = selectedSquareControl.getSelectedSquareView(); - final GameObjectAttributesControl<G, A, R> gameObjectAttributesControl = new GameObjectAttributesControl<G, A, R>(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, mapManager, selectedSquareModel, selectedSquareView, gameObjectFactory, gameObjectMatchers); + final GameObjectAttributesControl<G, A, R> gameObjectAttributesControl = new GameObjectAttributesControl<G, A, R>(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, mapManager, selectedSquareModel, selectedSquareView, gameObjectFactory, gameObjectMatchers, exiter); final PluginParameterViewFactory<G, A, R> pluginParameterViewFactory = new PluginParameterViewFactory<G, A, R>(archetypeSet, gameObjectAttributesModel, objectChooser, defaultFilterList, mapManager, faceObjectProviders); final File scriptsFile = new File(globalSettings.getMapsDirectory(), scriptsDir); scriptControl = new ScriptController<G, A, R>(filterControl, scriptParameters, mainViewFrame, pluginParameterViewFactory, scriptsFile, scriptModel, pluginParameterFactory, scriptExecutor, systemIcons); @@ -426,9 +427,8 @@ final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet); new FindArchetypesDialogManager<G, A, R>(mainViewFrame, archetypeChooserControl, objectChooser, archetypeTypeSet); new UndoControl<G, A, R>(mapManager, gameObjectFactory, gameObjectMatchers); - final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); - mainView = new MainView(mainViewFrame, exitAction, statusBar, mapDesktop, icon, gameObjectAttributesControl, selectedSquareView, leftPanel); - exiter = new Exiter(delayedMapModelListenerManager, mainView, mainViewFrame, gameObjectAttributesControl, leftPanel, scriptEditControl, mainActions); + final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay, exiter); + mainView = new MainView(mainViewFrame, exitAction, statusBar, mapDesktop, icon, gameObjectAttributesControl, selectedSquareView, leftPanel, exiter); final UpdaterManager updaterManager = new UpdaterManager(exiter, mapManager, mainViewFrame, gridartaJarFilename); updaterManager.startup(); final JMenuBar menuBar = ACTION_BUILDER.createMenuBar(true, "main"); @@ -743,7 +743,7 @@ @Deprecated @NotNull - public Exiter getExiter() { + public DefaultExiter getExiter() { return exiter; } Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -49,7 +49,7 @@ import net.sf.gridarta.gui.misc.SplashScreen; import net.sf.gridarta.gui.prefs.GUIPrefs; import net.sf.gridarta.gui.scripts.ScriptedEventEditor; -import net.sf.gridarta.mainactions.Exiter; +import net.sf.gridarta.mainactions.DefaultExiter; import net.sf.gridarta.mapmanager.AbstractMapManager; import net.sf.gridarta.mapmanager.DefaultMapManager; import net.sf.gridarta.mapmanager.DefaultPickmapManager; @@ -436,7 +436,7 @@ private static void checkForErrors(@NotNull final ErrorView errorView) { if (errorView.hasErrors()) { waitDialog(errorView); - Exiter.callExit(1); + DefaultExiter.callExit(1); throw new AssertionError(); } } @@ -450,7 +450,7 @@ errorView.waitDialog(); } catch (final InterruptedException ex) { Thread.currentThread().interrupt(); - Exiter.callExit(1); + DefaultExiter.callExit(1); throw new AssertionError(); } } Modified: trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditControl.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -32,6 +32,7 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.textedit.textarea.JEditTextArea; import net.sf.gridarta.textedit.textarea.TextAreaDefaults; +import net.sf.gridarta.utils.Exiter; import net.sf.gridarta.utils.FileChooserUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; @@ -70,11 +71,11 @@ @NotNull private final String scriptSuffix; - public ScriptEditControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptSuffix, @NotNull final Frame owner, final File defaultScriptDir, @NotNull final Preferences prefs) { + public ScriptEditControl(@NotNull final FileFilter scriptFileFilter, @NotNull final String scriptSuffix, @NotNull final Frame owner, final File defaultScriptDir, @NotNull final Preferences prefs, @NotNull final Exiter exiter) { this.scriptFileFilter = scriptFileFilter; this.scriptSuffix = scriptSuffix; tabs = new ArrayList<String>(); // start with empty vector - view = new ScriptEditView(this, owner, prefs); // initialize window + view = new ScriptEditView(this, owner, prefs, exiter); // initialize window openFileChooser = createOpenFileChooser(defaultScriptDir); } @@ -83,11 +84,6 @@ view.setTextAreaDefaults(textAreaDefaults); } - /** Must be called when the application is exiting. */ - public void appExitNotify() { - view.appExitNotify(); - } - /** * Register last active popup. When the script pad frame is hidden, this * popup will be closed (if still open). Modified: trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/textedit/scripteditor/ScriptEditView.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -42,6 +42,8 @@ import net.sf.gridarta.textedit.textarea.SyntaxDocument; import net.sf.gridarta.textedit.textarea.TextAreaDefaults; import net.sf.gridarta.textedit.textarea.tokenmarker.TokenMarkerFactory; +import net.sf.gridarta.utils.Exiter; +import net.sf.gridarta.utils.ExiterListener; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.apache.log4j.Category; @@ -107,8 +109,9 @@ * Build frame but keep it hidden (it is shown when first file is opened). * @param owner The owner of this view. * @param prefs the preferences to use + * @param exiter the exiter instance */ - public ScriptEditView(final ScriptEditControl control, @NotNull final Frame owner, @NotNull final Preferences prefs) { + public ScriptEditView(final ScriptEditControl control, @NotNull final Frame owner, @NotNull final Preferences prefs, @NotNull final Exiter exiter) { super(owner, "Script Pad"); this.prefs = prefs; setDefaultCloseOperation(DO_NOTHING_ON_CLOSE); @@ -131,6 +134,39 @@ final int x = prefs.getInt(WINDOW_X, (int) (screen.getX() + (screen.getWidth() - width) / 2)); final int y = prefs.getInt(WINDOW_Y, (int) (screen.getY() + (screen.getHeight() - height) / 2)); setBounds(x, y, width, height); + + final ExiterListener exiterListener = new ExiterListener() { + + /** + * {@inheritDoc} + */ + @Override + public void preExitNotify() { + // ignore + } + + /** + * {@inheritDoc} + */ + @Override + public void appExitNotify() { + final Rectangle bounds = getBounds(); + prefs.putInt(WINDOW_X, bounds.x); + prefs.putInt(WINDOW_Y, bounds.y); + prefs.putInt(WINDOW_WIDTH, bounds.width); + prefs.putInt(WINDOW_HEIGHT, bounds.height); + } + + /** + * {@inheritDoc} + */ + @Override + public void waitExitNotify() { + // ignore + } + + }; + exiter.addExiterListener(exiterListener); } @Deprecated @@ -138,15 +174,6 @@ this.textAreaDefaults = textAreaDefaults; } - /** Must be called when the application is exiting. */ - public void appExitNotify() { - final Rectangle bounds = getBounds(); - prefs.putInt(WINDOW_X, bounds.x); - prefs.putInt(WINDOW_Y, bounds.y); - prefs.putInt(WINDOW_WIDTH, bounds.width); - prefs.putInt(WINDOW_HEIGHT, bounds.height); - } - /** * Add a new TextArea Panel to the TabbedPane. * @param title title of this script (filename) Modified: trunk/src/app/net/sf/gridarta/updater/Updater.java =================================================================== --- trunk/src/app/net/sf/gridarta/updater/Updater.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/updater/Updater.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -39,7 +39,7 @@ import javax.swing.ProgressMonitorInputStream; import net.sf.gridarta.MainControl; import net.sf.gridarta.gui.prefs.NetPrefs; -import net.sf.gridarta.mainactions.Exiter; +import net.sf.gridarta.mainactions.DefaultExiter; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import org.apache.log4j.Category; @@ -77,10 +77,10 @@ private final Component parentComponent; /** - * The {@link Exiter} for terminating the application. + * The {@link DefaultExiter} for terminating the application. */ @NotNull - private final Exiter exiter; + private final DefaultExiter exiter; /** The file to update. */ @NotNull @@ -95,7 +95,7 @@ * @param exiter the exiter for terminating the application * @param updateFileName the file to update */ - public Updater(@Nullable final Component parentComponent, @NotNull final Exiter exiter, @NotNull final String updateFileName) { + public Updater(@Nullable final Component parentComponent, @NotNull final DefaultExiter exiter, @NotNull final String updateFileName) { this.parentComponent = parentComponent; this.exiter = exiter; this.updateFileName = updateFileName; Modified: trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java 2010-04-26 18:32:12 UTC (rev 7633) +++ trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -23,7 +23,7 @@ import java.util.prefs.Preferences; import javax.swing.Action; import net.sf.gridarta.MainControl; -import net.sf.gridarta.mainactions.Exiter; +import net.sf.gridarta.mainactions.DefaultExiter; import net.sf.gridarta.mapmanager.MapManager; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; @@ -62,10 +62,10 @@ }; /** - * The {@link Exiter} for terminating the application. + * The {@link DefaultExiter} for terminating the application. */ @NotNull - private final Exiter exiter; + private final DefaultExiter exiter; /** * The map manager to use. @@ -85,7 +85,7 @@ * @param parentComponent Component to show dialogs on * @param updateFileName the file to update */ - public UpdaterManager(@NotNull final Exiter exiter, @NotNull final MapManager<?, ?, ?> mapManager, final Component parentComponent, final String updateFileName) { + public UpdaterManager(@NotNull final DefaultExiter exiter, @NotNull final MapManager<?, ?, ?> mapManager, final Component parentComponent, final String updateFileName) { this.mapManager = mapManager; this.exiter = exiter; this.parentComponent = parentComponent; Added: trunk/src/app/net/sf/gridarta/utils/Exiter.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/Exiter.java (rev 0) +++ trunk/src/app/net/sf/gridarta/utils/Exiter.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -0,0 +1,48 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 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.utils; + +import org.jetbrains.annotations.NotNull; + +/** + * Exits the application. + * @author Andreas Kirschbaum + */ +public interface Exiter { + + /** + * Adds an {@link ExiterListener} to be notified. + * @param listener the listener + */ + void addExiterListener(@NotNull ExiterListener listener); + + /** + * Removes an {@link ExiterListener} to be notified. + * @param listener the listener + */ + void removeExiterListener(@NotNull ExiterListener listener); + + /** + * Exits the application. + * @param returnCode the application's return code + */ + void doExit(int returnCode); + +} // interface Exiter Property changes on: trunk/src/app/net/sf/gridarta/utils/Exiter.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/utils/ExiterListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/ExiterListener.java (rev 0) +++ trunk/src/app/net/sf/gridarta/utils/ExiterListener.java 2010-04-26 19:12:29 UTC (rev 7634) @@ -0,0 +1,47 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 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.utils; + +import java.util.EventListener; + +/** + * Interface for listeners interested in {@link Exiter} related events. + * @author Andreas Kirschbaum + */ +public interface ExiterListener extends EventListener { + + /** + * Called when the application exits. It is called before {@link + * #appExitNotify()}. + */ + void preExitNotify(); + + /** + * Called when the application exits. + */ + void appExitNotify(); + + /** + * Called when the application exits. It is called after {@link + * #appExitNotify()}. + */ + void waitExitNotify(); + +} // interface ExiterListener Property changes on: trunk/src/app/net/sf/gridarta/utils/ExiterListener.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-26 18:32:18
|
Revision: 7633 http://gridarta.svn.sourceforge.net/gridarta/?rev=7633&view=rev Author: akirschbaum Date: 2010-04-26 18:32:12 +0000 (Mon, 26 Apr 2010) Log Message: ----------- Move parameters from MainView.init() to constructor. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/app/net/sf/gridarta/gui/misc/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-26 07:26:48 UTC (rev 7632) +++ trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-26 18:32:12 UTC (rev 7633) @@ -85,16 +85,40 @@ private final Component mapDesktop; /** + * The game object attributes panel. + */ + @NotNull + private final Component gameObjectAttributesPanel; + + /** + * The selected square view. + */ + @NotNull + private final Component selectedSquareView; + + /** + * The left panel instance. + */ + @NotNull + private final Component leftPanel; + + /** * Constructs the main view and registers the given main controller. * @param frame the main window of the editor * @param exitAction the action to execute when the window is closed * @param statusBar the status bar instance * @param mapDesktop the map desktop to show * @param icon the application's icon or <code>null</code> for default + * @param gameObjectAttributesPanel the game object attributes panel + * @param selectedSquareView the selected square view + * @param leftPanel the left panel instance */ - public MainView(@NotNull final JFrame frame, @NotNull final ActionListener exitAction, @NotNull final Component statusBar, @NotNull final Component mapDesktop, @Nullable final ImageIcon icon) { + public MainView(@NotNull final JFrame frame, @NotNull final ActionListener exitAction, @NotNull final Component statusBar, @NotNull final Component mapDesktop, @Nullable final ImageIcon icon, @NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, @NotNull final Component leftPanel) { this.frame = frame; this.mapDesktop = mapDesktop; + this.gameObjectAttributesPanel = gameObjectAttributesPanel; + this.selectedSquareView = selectedSquareView; + this.leftPanel = leftPanel; frame.add(statusBar, BorderLayout.SOUTH); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { @@ -110,15 +134,12 @@ /** * Initializes (builds) this view. - * @param gameObjectAttributesPanel the game object attributes panel - * @param selectedSquareView the selected square view - * @param leftPanel the left panel instance * @param menuBar the main menu bar * @param globalSettings the global settings to use * @param mainToolbar the main toolbar component */ @Deprecated - public void init(@NotNull final Component gameObjectAttributesPanel, @NotNull final Component selectedSquareView, @NotNull final Component leftPanel, @NotNull final JMenuBar menuBar, @NotNull final GlobalSettings globalSettings, @NotNull final Component mainToolbar) { + public void init(@NotNull final JMenuBar menuBar, @NotNull final GlobalSettings globalSettings, @NotNull final Component mainToolbar) { // calculate some default values in case there is no settings file final RectangularShape screen = frame.getGraphicsConfiguration().getBounds(); final int defwidth = (int) (0.9 * screen.getWidth()); Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-26 07:26:48 UTC (rev 7632) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-26 18:32:12 UTC (rev 7633) @@ -370,7 +370,6 @@ mainViewFrame = new JFrame(ACTION_BUILDER.format("mainWindow.title", getBuildNumberAsString())); final HelpActions helpActions = new HelpActions(mainViewFrame); ACTION_BUILDER.createActions(true, helpActions, "showHelp", "tipOfTheDay"); - mainView = new MainView(mainViewFrame, exitAction, statusBar, mapDesktop, icon); newMapDialogFactory = editorFactory.newNewMapDialogFactory(mapViewsManager, mapArchObjectFactory, mainViewFrame); final PickmapChooserModel<G, A, R> pickmapChooserModel = new PickmapChooserModel<G, A, R>(); final MapFolderTreeActions<G, A, R> mapFolderTreeActions = new MapFolderTreeActions<G, A, R>(mapFolderTree, newMapDialogFactory, "createPickmapFolder", "deletePickmapFolder", "confirmDeletePickmapFolder", "deletePickmapFolderNotEmpty"); @@ -425,15 +424,16 @@ scriptControl = new ScriptController<G, A, R>(filterControl, scriptParameters, mainViewFrame, pluginParameterViewFactory, scriptsFile, scriptModel, pluginParameterFactory, scriptExecutor, systemIcons); final ObjectChoiceDisplay<G, A, R> objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R>(archetypeTypeSet, objectChooser); final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet); + new FindArchetypesDialogManager<G, A, R>(mainViewFrame, archetypeChooserControl, objectChooser, archetypeTypeSet); + new UndoControl<G, A, R>(mapManager, gameObjectFactory, gameObjectMatchers); final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); + mainView = new MainView(mainViewFrame, exitAction, statusBar, mapDesktop, icon, gameObjectAttributesControl, selectedSquareView, leftPanel); exiter = new Exiter(delayedMapModelListenerManager, mainView, mainViewFrame, gameObjectAttributesControl, leftPanel, scriptEditControl, mainActions); final UpdaterManager updaterManager = new UpdaterManager(exiter, mapManager, mainViewFrame, gridartaJarFilename); updaterManager.startup(); - new FindArchetypesDialogManager<G, A, R>(mainViewFrame, archetypeChooserControl, objectChooser, archetypeTypeSet); - new UndoControl<G, A, R>(mapManager, gameObjectFactory, gameObjectMatchers); final JMenuBar menuBar = ACTION_BUILDER.createMenuBar(true, "main"); final MainToolbar mainToolbar = new MainToolbar(globalSettings); - mainView.init(gameObjectAttributesControl, selectedSquareView, leftPanel, menuBar, globalSettings, mainToolbar.getComponent()); + mainView.init(menuBar, globalSettings, mainToolbar.getComponent()); exitConnectorModel = new ExitConnectorModel(); // XXX: should be part of DefaultMainControl final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, archetypeSet, mapManager, fileControl, pathManager, insertionModeSet); // XXX: should be part of DefaultMainControl new ExitConnectorController<G, A, R>(exitConnectorActions, exitConnectorModel, mapViewManager); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-26 07:26:55
|
Revision: 7632 http://gridarta.svn.sourceforge.net/gridarta/?rev=7632&view=rev Author: akirschbaum Date: 2010-04-26 07:26:48 +0000 (Mon, 26 Apr 2010) Log Message: ----------- Fix issues when closing map views. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java 2010-04-25 21:08:32 UTC (rev 7631) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewsManager.java 2010-04-26 07:26:48 UTC (rev 7632) @@ -131,7 +131,7 @@ */ @Override public void mapClosing(@NotNull final MapControl<G, A, R> mapControl) { - closeAllViews(mapControl); + assert getMapViews(mapControl) <= 0; mapViews.remove(mapControl); } @@ -234,14 +234,6 @@ } /** - * Closes all views of a {@link MapControl}. - * @param mapControl the map control - */ - public void closeAllViews(@NotNull final MapControl<G, A, R> mapControl) { - getMapViewsInt(mapControl).closeAllViews(); - } - - /** * Sets a {@link MapView} as the main view. * @param mapView the map view */ @@ -312,6 +304,11 @@ public void closeMapView(@NotNull final MapView<G, A, R> mapView) { final MapControl<G, A, R> mapControl = mapView.getMapControl(); if (getMapViews(mapControl) <= 1) { + if (!mapManager.confirmSaveChanges(mapControl)) { + return; + } + closeView(mapView); + assert mapControl.getUseCounter() <= 0; mapManager.closeLevel(mapControl); } else { closeView(mapView); Modified: trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2010-04-25 21:08:32 UTC (rev 7631) +++ trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2010-04-26 07:26:48 UTC (rev 7632) @@ -147,7 +147,7 @@ /** {@inheritDoc} */ @Override - public boolean closeLevel(@NotNull final MapControl<G, A, R> mapControl) { + public boolean confirmSaveChanges(@NotNull final MapControl<G, A, R> mapControl) { if (mapControl.getMapModel().isModified()) { final int result = fileControl.confirmSaveChanges(mapControl.getMapModel().getMapArchObject().getMapName()); if (result == JOptionPane.YES_OPTION) { @@ -159,10 +159,15 @@ } } - closeMapControl(mapControl); return true; } + /** {@inheritDoc} */ + @Override + public void closeLevel(@NotNull final MapControl<G, A, R> mapControl) { + closeMapControl(mapControl); + } + /** * Load a map file. * @param file the map file to load Modified: trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2010-04-25 21:08:32 UTC (rev 7631) +++ trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2010-04-26 07:26:48 UTC (rev 7632) @@ -241,9 +241,11 @@ break; } - if (!mapManager.closeLevel(mapControl)) { + if (!mapManager.confirmSaveChanges(mapControl)) { return false; } + + mapManager.closeLevel(mapControl); } return true; Modified: trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java 2010-04-25 21:08:32 UTC (rev 7631) +++ trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java 2010-04-26 07:26:48 UTC (rev 7632) @@ -46,12 +46,18 @@ MapControl<G, A, R> openMapFile(@NotNull File file, final boolean isInteractive); /** - * Closes the given level, asking the user whether to save changes. + * Asks the user whether to save changes of a map. Returns + * <code>true</code> (and does not ask the user) if the map is unmodified. + * @param mapControl the map + * @return whether closing the map is allowed + */ + boolean confirmSaveChanges(@NotNull MapControl<G, A, R> mapControl); + + /** + * Closes the given level, ignoring modified status. * @param mapControl throws level to close - * @return <code>true</code> if the level was successfully closed, - * otherwise <code>false</code> */ - boolean closeLevel(@NotNull MapControl<G, A, R> mapControl); + void closeLevel(@NotNull MapControl<G, A, R> mapControl); /** * Creates a new map control without view. The returned instance must be This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-25 21:08:40
|
Revision: 7631 http://gridarta.svn.sourceforge.net/gridarta/?rev=7631&view=rev Author: akirschbaum Date: 2010-04-25 21:08:32 +0000 (Sun, 25 Apr 2010) Log Message: ----------- Extract AnimationObjectsReader from DefaultAnimationObjects. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java trunk/src/app/net/sf/gridarta/model/anim/AnimationObjects.java trunk/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java trunk/src/app/net/sf/gridarta/resource/AbstractResourcesReader.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-04-25 13:56:12 UTC (rev 7630) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/resource/FilesResourcesReader.java 2010-04-25 21:08:32 UTC (rev 7631) @@ -39,6 +39,7 @@ import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.FaceProvider; +import net.sf.gridarta.model.io.AnimationObjectsReader; import net.sf.gridarta.utils.Pair; import net.sf.gridarta.var.atrinik.model.archetype.Archetype; import net.sf.gridarta.var.atrinik.model.gameobject.GameObject; @@ -211,7 +212,7 @@ final String animPath = pair.getFirst(); final File animFile = pair.getSecond(); try { - animationObjects.loadAnims(errorViewCollector, animPath, animFile, "anim ", false); + AnimationObjectsReader.loadAnims(animationObjects, errorViewCollector, animPath, animFile, "anim ", false); } catch (final IOException ex) { errorViewCollector.addWarning(ErrorViewCategory.ANIM_FILE_INVALID, ex.getMessage() + ", " + animFile); } catch (final AnimationParseException ex) { Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-04-25 13:56:12 UTC (rev 7630) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/resource/FilesResourcesReader.java 2010-04-25 21:08:32 UTC (rev 7631) @@ -38,6 +38,7 @@ import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.FaceProvider; +import net.sf.gridarta.model.io.AnimationObjectsReader; import net.sf.gridarta.var.crossfire.model.archetype.Archetype; import net.sf.gridarta.var.crossfire.model.gameobject.GameObject; import net.sf.gridarta.var.crossfire.model.maparchobject.MapArchObject; @@ -207,7 +208,7 @@ try { final Reader in = new BufferedReader(isr); try { - animationObjects.loadAnims(errorViewCollector, in, "animation ", true, filename, null); + AnimationObjectsReader.loadAnims(animationObjects, errorViewCollector, in, "animation ", true, filename, null); } finally { in.close(); } Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-04-25 13:56:12 UTC (rev 7630) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/resource/FilesResourcesReader.java 2010-04-25 21:08:32 UTC (rev 7631) @@ -39,6 +39,7 @@ import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.face.FaceProvider; +import net.sf.gridarta.model.io.AnimationObjectsReader; import net.sf.gridarta.utils.Pair; import net.sf.gridarta.var.daimonin.model.archetype.Archetype; import net.sf.gridarta.var.daimonin.model.gameobject.GameObject; @@ -211,7 +212,7 @@ final String animPath = pair.getFirst(); final File animFile = pair.getSecond(); try { - animationObjects.loadAnims(errorViewCollector, animPath, animFile, "anim ", false); + AnimationObjectsReader.loadAnims(animationObjects, errorViewCollector, animPath, animFile, "anim ", false); } catch (final IOException ex) { errorViewCollector.addWarning(ErrorViewCategory.ANIM_FILE_INVALID, ex.getMessage() + ", " + animFile); } catch (final AnimationParseException ex) { Modified: trunk/src/app/net/sf/gridarta/model/anim/AnimationObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/anim/AnimationObjects.java 2010-04-25 13:56:12 UTC (rev 7630) +++ trunk/src/app/net/sf/gridarta/model/anim/AnimationObjects.java 2010-04-25 21:08:32 UTC (rev 7631) @@ -19,15 +19,9 @@ package net.sf.gridarta.model.anim; -import java.io.File; -import java.io.IOException; -import java.io.Reader; -import java.util.Map; import net.sf.gridarta.model.collectable.Collectable; import net.sf.gridarta.model.data.NamedObjects; -import net.sf.gridarta.model.errorview.ErrorViewCollector; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * AnimationObjects is a container for {@link AnimationObject}s. @@ -45,43 +39,4 @@ */ void addAnimationObject(@NotNull String animName, @NotNull String list, @NotNull String path) throws DuplicateAnimationException, IllegalAnimationException; - /** - * Loads animations from a file. - * @param errorViewCollector the error view collector for reporting errors - * @param path the animation path - * @param animFile file to load animations from - * @param startKey the key that begins an animation block; it must end with - * a space character - * @param ignoreOtherText if set, ignore all text outside animation - * definitions - * @throws IOException in case of I/O errors - * @throws java.io.FileNotFoundException in case the file couldn't be - * opened - * @throws AnimationParseException in case parsing the animation reveals - * errors - */ - void loadAnims(@NotNull ErrorViewCollector errorViewCollector, @NotNull final String path, @NotNull File animFile, @NotNull String startKey, boolean ignoreOtherText) throws IOException, AnimationParseException; - - /** - * Loads any number of animations from a reader. It is not neccessary to - * provide a BufferedReader for buffering. This method will always wrap the - * supplied <var>reader</var> with a BufferedReader if the supplied reader - * isn't already a BufferedReader itself. - * @param errorViewCollector the error view collector for reporting errors - * @param reader Reader to load animations from - * @param startKey the key that begins an animation block; it must end with - * a space character - * @param ignoreOtherText if set, ignore all text outside animation - * definitions - * @param path Path relative to the arch directory, used to create tree - * information; either <code>animations</code> or this parameter must be - * non-<code>null</code> - * @param animations maps animation name to animation path; either - * <code>path</code> or this parameter must be non-<code>null</code> - * @throws IOException in case of I/O errors - * @throws AnimationParseException in case parsing the animation reveals - * errors - */ - void loadAnims(@NotNull ErrorViewCollector errorViewCollector, Reader reader, @NotNull String startKey, boolean ignoreOtherText, @Nullable String path, @Nullable Map<String, String> animations) throws IOException, AnimationParseException; - } // interface AnimationObjects Modified: trunk/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java 2010-04-25 13:56:12 UTC (rev 7630) +++ trunk/src/app/net/sf/gridarta/model/anim/DefaultAnimationObjects.java 2010-04-25 21:08:32 UTC (rev 7631) @@ -19,27 +19,19 @@ package net.sf.gridarta.model.anim; -import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; -import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.io.InputStreamReader; import java.io.OutputStreamWriter; -import java.io.Reader; -import java.util.Map; import net.sf.gridarta.model.data.AbstractNamedObjects; import net.sf.gridarta.model.data.IllegalNamedObjectException; import net.sf.gridarta.model.data.NamedObject; -import net.sf.gridarta.model.errorview.ErrorViewCategory; -import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.utils.IOUtils; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Abstract base implementation of {@link AnimationObjects}. @@ -70,17 +62,6 @@ this.animTreeFile = animTreeFile; } - /** {@inheritDoc} */ - @Override - public void loadAnims(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final String path, @NotNull final File animFile, @NotNull final String startKey, final boolean ignoreOtherText) throws IOException, AnimationParseException { - final Reader in = new InputStreamReader(new FileInputStream(animFile), IOUtils.MAP_ENCODING); - try { - loadAnims(errorViewCollector, in, startKey, ignoreOtherText, path, null); - } finally { - in.close(); - } - } - /** * Adds a new animation object. * @param animName name of the animation object to add @@ -102,69 +83,6 @@ } } - /** {@inheritDoc} */ - @SuppressWarnings({ "IOResourceOpenedButNotSafelyClosed" }) - @Override - public void loadAnims(@NotNull final ErrorViewCollector errorViewCollector, final Reader reader, @NotNull final String startKey, final boolean ignoreOtherText, @Nullable final String path, @Nullable final Map<String, String> animations) throws IOException, AnimationParseException { - if (path == null && animations == null) { - throw new IllegalArgumentException(); - } - if (path != null && animations != null) { - throw new IllegalArgumentException(); - } - final BufferedReader in = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); - boolean inAnim = false; - String animName = null; - final StringBuilder animText = new StringBuilder(); - String line2; - int lineNumber; - for (lineNumber = 1; (line2 = in.readLine()) != null; lineNumber++) { - final String line = line2.trim(); - if (line.startsWith("#") || line.length() == 0) { - /* ignore comment lines. */ - } else if (line.startsWith(startKey)) { - if (inAnim) { - throw new AnimationParseException("mina", line, lineNumber); - } - inAnim = true; - animName = line.substring(startKey.length()); - animText.setLength(0); - } else if ("mina".equals(line)) { - if (!inAnim) { - throw new AnimationParseException(startKey + "...", line, lineNumber); - } - inAnim = false; - final String animPath; - if (path != null) { - animPath = path; - } else { - assert animations != null; - final String tmp = animations.get(animName); - if (tmp == null) { - errorViewCollector.addWarning(ErrorViewCategory.ANIMATIONS_ENTRY_INVALID, "no path found for animation: " + animName); - animPath = "/" + animName; - } else { - animPath = tmp; - } - } - try { - addAnimationObject(animName, animText.toString(), animPath); - } catch (final DuplicateAnimationException ex) { - errorViewCollector.addWarning(ErrorViewCategory.ANIMATIONS_ENTRY_INVALID, "duplicate animation: " + animName); - } catch (final IllegalAnimationException ex) { - errorViewCollector.addWarning(ErrorViewCategory.ANIMATIONS_ENTRY_INVALID, "illegal animation: " + ex.getAnimationObject().getPath()); - } - } else if (inAnim) { - animText.append(line).append('\n'); - } else if (!ignoreOtherText) { - throw new AnimationParseException(startKey + "...", line, lineNumber); - } - } - if (inAnim) { - throw new AnimationParseException("mina", null, lineNumber); - } - } - /** * {@inheritDoc} Collects the Animations. The animation data is written to * "animations". The tree information for the editor is written to Added: trunk/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java 2010-04-25 21:08:32 UTC (rev 7631) @@ -0,0 +1,158 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 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.model.io; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.Map; +import net.sf.gridarta.model.anim.AnimationObjects; +import net.sf.gridarta.model.anim.AnimationParseException; +import net.sf.gridarta.model.anim.DuplicateAnimationException; +import net.sf.gridarta.model.anim.IllegalAnimationException; +import net.sf.gridarta.model.errorview.ErrorViewCategory; +import net.sf.gridarta.model.errorview.ErrorViewCollector; +import net.sf.gridarta.utils.IOUtils; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Utility class for reading {@link AnimationObjects} from files. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + */ +public class AnimationObjectsReader { + + /** + * Private constructor to prevent instantiation. + */ + private AnimationObjectsReader() { + } + + /** + * Loads animations from a file. + * @param animationObjects the animation objects to update + * @param errorViewCollector the error view collector for reporting errors + * @param path the animation path + * @param animFile file to load animations from + * @param startKey the key that begins an animation block; it must end with + * a space character + * @param ignoreOtherText if set, ignore all text outside animation + * definitions + * @throws IOException in case of I/O errors + * @throws java.io.FileNotFoundException in case the file couldn't be + * opened + * @throws AnimationParseException in case parsing the animation reveals + * errors + */ + public static void loadAnims(@NotNull final AnimationObjects animationObjects, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String path, @NotNull final File animFile, @NotNull final String startKey, final boolean ignoreOtherText) throws IOException, AnimationParseException { + final Reader in = new InputStreamReader(new FileInputStream(animFile), IOUtils.MAP_ENCODING); + try { + loadAnims(animationObjects, errorViewCollector, in, startKey, ignoreOtherText, path, null); + } finally { + in.close(); + } + } + + /** + * Loads any number of animations from a reader. It is not neccessary to + * provide a BufferedReader for buffering. This method will always wrap the + * supplied <var>reader</var> with a BufferedReader if the supplied reader + * isn't already a BufferedReader itself. + * @param animationObjects the animation objects to update + * @param errorViewCollector the error view collector for reporting errors + * @param reader Reader to load animations from + * @param startKey the key that begins an animation block; it must end with + * a space character + * @param ignoreOtherText if set, ignore all text outside animation + * definitions + * @param path Path relative to the arch directory, used to create tree + * information; either <code>animations</code> or this parameter must be + * non-<code>null</code> + * @param animations maps animation name to animation path; either + * <code>path</code> or this parameter must be non-<code>null</code> + * @throws IOException in case of I/O errors + * @throws AnimationParseException in case parsing the animation reveals + * errors + */ + public static void loadAnims(@NotNull final AnimationObjects animationObjects, @NotNull final ErrorViewCollector errorViewCollector, final Reader reader, @NotNull final String startKey, final boolean ignoreOtherText, @Nullable final String path, @Nullable final Map<String, String> animations) throws IOException, AnimationParseException { + if (path == null && animations == null) { + throw new IllegalArgumentException(); + } + if (path != null && animations != null) { + throw new IllegalArgumentException(); + } + final BufferedReader in = reader instanceof BufferedReader ? (BufferedReader) reader : new BufferedReader(reader); + boolean inAnim = false; + String animName = null; + final StringBuilder animText = new StringBuilder(); + String line2; + int lineNumber; + for (lineNumber = 1; (line2 = in.readLine()) != null; lineNumber++) { + final String line = line2.trim(); + if (line.startsWith("#") || line.length() == 0) { + /* ignore comment lines. */ + } else if (line.startsWith(startKey)) { + if (inAnim) { + throw new AnimationParseException("mina", line, lineNumber); + } + inAnim = true; + animName = line.substring(startKey.length()); + animText.setLength(0); + } else if ("mina".equals(line)) { + if (!inAnim) { + throw new AnimationParseException(startKey + "...", line, lineNumber); + } + inAnim = false; + final String animPath; + if (path != null) { + animPath = path; + } else { + assert animations != null; + final String tmp = animations.get(animName); + if (tmp == null) { + errorViewCollector.addWarning(ErrorViewCategory.ANIMATIONS_ENTRY_INVALID, "no path found for animation: " + animName); + animPath = "/" + animName; + } else { + animPath = tmp; + } + } + try { + animationObjects.addAnimationObject(animName, animText.toString(), animPath); + } catch (final DuplicateAnimationException ex) { + errorViewCollector.addWarning(ErrorViewCategory.ANIMATIONS_ENTRY_INVALID, "duplicate animation: " + animName); + } catch (final IllegalAnimationException ex) { + errorViewCollector.addWarning(ErrorViewCategory.ANIMATIONS_ENTRY_INVALID, "illegal animation: " + ex.getAnimationObject().getPath()); + } + } else if (inAnim) { + animText.append(line).append('\n'); + } else if (!ignoreOtherText) { + throw new AnimationParseException(startKey + "...", line, lineNumber); + } + } + if (inAnim) { + throw new AnimationParseException("mina", null, lineNumber); + } + } + +} // class AnimationObjectsReader Property changes on: trunk/src/app/net/sf/gridarta/model/io/AnimationObjectsReader.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/resource/AbstractResourcesReader.java =================================================================== --- trunk/src/app/net/sf/gridarta/resource/AbstractResourcesReader.java 2010-04-25 13:56:12 UTC (rev 7630) +++ trunk/src/app/net/sf/gridarta/resource/AbstractResourcesReader.java 2010-04-25 21:08:32 UTC (rev 7631) @@ -42,6 +42,7 @@ import net.sf.gridarta.model.face.FaceProvider; import net.sf.gridarta.model.face.IllegalFaceException; import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.io.AnimationObjectsReader; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.utils.IOUtils; import net.sf.japi.swing.action.ActionBuilder; @@ -115,7 +116,7 @@ try { final Reader bufferedReader = new BufferedReader(reader); try { - animationObjects.loadAnims(errorViewCollector, bufferedReader, "anim ", false, null, animations); + AnimationObjectsReader.loadAnims(animationObjects, errorViewCollector, bufferedReader, "anim ", false, null, animations); } finally { bufferedReader.close(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-25 13:56:18
|
Revision: 7630 http://gridarta.svn.sourceforge.net/gridarta/?rev=7630&view=rev Author: akirschbaum Date: 2010-04-25 13:56:12 +0000 (Sun, 25 Apr 2010) Log Message: ----------- Remove unneeded type parameters from MainView. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java trunk/src/app/net/sf/gridarta/mainactions/Exiter.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/app/net/sf/gridarta/gui/misc/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-25 09:14:02 UTC (rev 7629) +++ trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-25 13:56:12 UTC (rev 7630) @@ -35,9 +35,6 @@ import javax.swing.JOptionPane; import javax.swing.WindowConstants; import net.sf.gridarta.MainControl; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.settings.GlobalSettings; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -48,7 +45,7 @@ * @author <a href="mailto:ch...@ri...">Christian Hujer</a> * @author Andreas Kirschbaum */ -public class MainView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class MainView { /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); Modified: trunk/src/app/net/sf/gridarta/mainactions/Exiter.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/Exiter.java 2010-04-25 09:14:02 UTC (rev 7629) +++ trunk/src/app/net/sf/gridarta/mainactions/Exiter.java 2010-04-25 13:56:12 UTC (rev 7630) @@ -69,7 +69,7 @@ * The {@link MainView}. */ @NotNull - private final MainView<?, ?, ?> mainView; + private final MainView mainView; /** * The main window's frame. @@ -113,7 +113,7 @@ * @param scriptEditControl the script edit control * @param mainActions the main actions */ - public Exiter(@NotNull final DelayedMapModelListenerManager<?, ?, ?> delayedMapModelListenerManager, @NotNull final MainView<?, ?, ?> mainView, @NotNull final Window mainViewFrame, @NotNull final GameObjectAttributesControl<?, ?, ?> gameObjectAttributesControl, @NotNull final LeftPanel leftPanel, @NotNull final ScriptEditControl scriptEditControl, @NotNull final MainActions<?, ?, ?> mainActions) { + public Exiter(@NotNull final DelayedMapModelListenerManager<?, ?, ?> delayedMapModelListenerManager, @NotNull final MainView mainView, @NotNull final Window mainViewFrame, @NotNull final GameObjectAttributesControl<?, ?, ?> gameObjectAttributesControl, @NotNull final LeftPanel leftPanel, @NotNull final ScriptEditControl scriptEditControl, @NotNull final MainActions<?, ?, ?> mainActions) { this.delayedMapModelListenerManager = delayedMapModelListenerManager; this.mainView = mainView; this.mainViewFrame = mainViewFrame; Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-25 09:14:02 UTC (rev 7629) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-25 13:56:12 UTC (rev 7630) @@ -201,7 +201,7 @@ /** The main view. */ @NotNull - private final MainView<G, A, R> mainView; + private final MainView mainView; /** The script controller. */ @NotNull @@ -370,7 +370,7 @@ mainViewFrame = new JFrame(ACTION_BUILDER.format("mainWindow.title", getBuildNumberAsString())); final HelpActions helpActions = new HelpActions(mainViewFrame); ACTION_BUILDER.createActions(true, helpActions, "showHelp", "tipOfTheDay"); - mainView = new MainView<G, A, R>(mainViewFrame, exitAction, statusBar, mapDesktop, icon); + mainView = new MainView(mainViewFrame, exitAction, statusBar, mapDesktop, icon); newMapDialogFactory = editorFactory.newNewMapDialogFactory(mapViewsManager, mapArchObjectFactory, mainViewFrame); final PickmapChooserModel<G, A, R> pickmapChooserModel = new PickmapChooserModel<G, A, R>(); final MapFolderTreeActions<G, A, R> mapFolderTreeActions = new MapFolderTreeActions<G, A, R>(mapFolderTree, newMapDialogFactory, "createPickmapFolder", "deletePickmapFolder", "confirmDeletePickmapFolder", "deletePickmapFolderNotEmpty"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-25 09:14:08
|
Revision: 7629 http://gridarta.svn.sourceforge.net/gridarta/?rev=7629&view=rev Author: akirschbaum Date: 2010-04-25 09:14:02 +0000 (Sun, 25 Apr 2010) Log Message: ----------- Fix typo. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java Modified: trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java 2010-04-25 08:56:32 UTC (rev 7628) +++ trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java 2010-04-25 09:14:02 UTC (rev 7629) @@ -61,4 +61,4 @@ TipOfTheDayManager.show(mainViewFrame); } -} // class StartActions +} // class HelpActions This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-25 08:56:38
|
Revision: 7628 http://gridarta.svn.sourceforge.net/gridarta/?rev=7628&view=rev Author: akirschbaum Date: 2010-04-25 08:56:32 +0000 (Sun, 25 Apr 2010) Log Message: ----------- Move code from GridartaEditor into GUIMainControl; remove GUIMainControl.getMainView(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-25 08:51:45 UTC (rev 7627) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-25 08:56:32 UTC (rev 7628) @@ -19,7 +19,6 @@ package net.sf.gridarta.maincontrol; -import java.awt.Component; import java.awt.Container; import java.io.BufferedReader; import java.io.File; @@ -162,6 +161,7 @@ import net.sf.japi.swing.action.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 org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -618,16 +618,6 @@ return null; } - /** - * Returns the MainView of this MainControl. - * @return The MainView of this MainControl. - */ - @Deprecated - @NotNull - public Component getMainView() { - return mainViewFrame; - } - /** Control the server. */ @ActionMethod public void controlServer() { @@ -757,4 +747,14 @@ return exiter; } + /** + * Starts the editor: makes the main window visible and opens map files. + * @param args the map files to open + */ + public void run(@NotNull final Iterable<String> args) { + mainViewFrame.setVisible(true); + TipOfTheDayManager.showAtStartup(mainViewFrame); + openFiles(args); + } + } // class GUIMainControl Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-04-25 08:51:45 UTC (rev 7627) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2010-04-25 08:56:32 UTC (rev 7628) @@ -21,7 +21,6 @@ import gnu.getopt.Getopt; import gnu.getopt.LongOpt; -import java.awt.Component; import java.io.File; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; @@ -97,7 +96,6 @@ import net.sf.gridarta.validation.DelegatingMapValidator; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; -import net.sf.japi.swing.tod.TipOfTheDayManager; import org.apache.log4j.Category; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -526,12 +524,9 @@ /** {@inheritDoc} */ @Override public void run() { - final Component mainView = guiMainControl[0].getMainView(); - mainView.setVisible(true); + guiMainControl[0].run(args); assert splashScreen != null; splashScreen.hide(); - TipOfTheDayManager.showAtStartup(mainView); - guiMainControl[0].openFiles(args); } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-25 08:51:51
|
Revision: 7627 http://gridarta.svn.sourceforge.net/gridarta/?rev=7627&view=rev Author: akirschbaum Date: 2010-04-25 08:51:45 +0000 (Sun, 25 Apr 2010) Log Message: ----------- Remove MainView.getFrame(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java trunk/src/app/net/sf/gridarta/mainactions/Exiter.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java Modified: trunk/src/app/net/sf/gridarta/gui/misc/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-25 08:45:55 UTC (rev 7626) +++ trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-25 08:51:45 UTC (rev 7627) @@ -112,15 +112,6 @@ } /** - * Returns the main window. - * @return the main window - */ - @NotNull - public JFrame getFrame() { - return frame; - } - - /** * Initializes (builds) this view. * @param gameObjectAttributesPanel the game object attributes panel * @param selectedSquareView the selected square view Modified: trunk/src/app/net/sf/gridarta/mainactions/Exiter.java =================================================================== --- trunk/src/app/net/sf/gridarta/mainactions/Exiter.java 2010-04-25 08:45:55 UTC (rev 7626) +++ trunk/src/app/net/sf/gridarta/mainactions/Exiter.java 2010-04-25 08:51:45 UTC (rev 7627) @@ -19,6 +19,7 @@ package net.sf.gridarta.mainactions; +import java.awt.Window; import java.lang.reflect.InvocationTargetException; import java.util.prefs.Preferences; import javax.swing.SwingUtilities; @@ -71,6 +72,12 @@ private final MainView<?, ?, ?> mainView; /** + * The main window's frame. + */ + @NotNull + private final Window mainViewFrame; + + /** * The {@link GameObjectAttributesControl}. */ @NotNull @@ -99,15 +106,17 @@ * @param delayedMapModelListenerManager the delayed map model listener * manager * @param mainView the main view + * @param mainViewFrame the main window's frame * @param gameObjectAttributesControl the game object attributes * control * @param leftPanel the left panel * @param scriptEditControl the script edit control * @param mainActions the main actions */ - public Exiter(@NotNull final DelayedMapModelListenerManager<?, ?, ?> delayedMapModelListenerManager, @NotNull final MainView<?, ?, ?> mainView, @NotNull final GameObjectAttributesControl<?, ?, ?> gameObjectAttributesControl, @NotNull final LeftPanel leftPanel, @NotNull final ScriptEditControl scriptEditControl, @NotNull final MainActions<?, ?, ?> mainActions) { + public Exiter(@NotNull final DelayedMapModelListenerManager<?, ?, ?> delayedMapModelListenerManager, @NotNull final MainView<?, ?, ?> mainView, @NotNull final Window mainViewFrame, @NotNull final GameObjectAttributesControl<?, ?, ?> gameObjectAttributesControl, @NotNull final LeftPanel leftPanel, @NotNull final ScriptEditControl scriptEditControl, @NotNull final MainActions<?, ?, ?> mainActions) { this.delayedMapModelListenerManager = delayedMapModelListenerManager; this.mainView = mainView; + this.mainViewFrame = mainViewFrame; this.gameObjectAttributesControl = gameObjectAttributesControl; this.leftPanel = leftPanel; this.scriptEditControl = scriptEditControl; @@ -125,7 +134,7 @@ Thread.currentThread().interrupt(); log.warn("DelayedMapModelListenerManager was interrupted"); } - mainView.getFrame().setEnabled(false); + mainViewFrame.setEnabled(false); mainView.appExitNotify(); gameObjectAttributesControl.appExitNotify(); leftPanel.appExitNotify(); @@ -145,7 +154,7 @@ /** {@inheritDoc} */ @Override public void run() { - mainView.getFrame().dispose(); + mainViewFrame.dispose(); } }); } catch (final InterruptedException ex) { Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-25 08:45:55 UTC (rev 7626) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-25 08:51:45 UTC (rev 7627) @@ -193,6 +193,12 @@ @NotNull private final PickmapChooserControl<G, A, R> pickmapChooserControl; + /** + * The main windows's {@link JFrame}. + */ + @NotNull + private final JFrame mainViewFrame; + /** The main view. */ @NotNull private final MainView<G, A, R> mainView; @@ -361,7 +367,7 @@ final ViewActions<G, A, R> viewActions = new ViewActions<G, A, R>(mapViewSettings, mapManager); final MapFolderTree<G, A, R> mapFolderTree = new MapFolderTree<G, A, R>(globalSettings.getPickmapDir()); final ImageIcon icon = systemIcons.getAppIcon(); - final JFrame mainViewFrame = new JFrame(ACTION_BUILDER.format("mainWindow.title", getBuildNumberAsString())); + mainViewFrame = new JFrame(ACTION_BUILDER.format("mainWindow.title", getBuildNumberAsString())); final HelpActions helpActions = new HelpActions(mainViewFrame); ACTION_BUILDER.createActions(true, helpActions, "showHelp", "tipOfTheDay"); mainView = new MainView<G, A, R>(mainViewFrame, exitAction, statusBar, mapDesktop, icon); @@ -420,7 +426,7 @@ final ObjectChoiceDisplay<G, A, R> objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R>(archetypeTypeSet, objectChooser); final ToolPalette<G, A, R> toolPalette = new ToolPalette<G, A, R>(mapViewSettings, selectedSquareView, selectedSquareModel, objectChooser, pickmapChooserControl, floorMatcher, wallMatcher, monsterMatcher, insertionModeSet); final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); - exiter = new Exiter(delayedMapModelListenerManager, mainView, gameObjectAttributesControl, leftPanel, scriptEditControl, mainActions); + exiter = new Exiter(delayedMapModelListenerManager, mainView, mainViewFrame, gameObjectAttributesControl, leftPanel, scriptEditControl, mainActions); final UpdaterManager updaterManager = new UpdaterManager(exiter, mapManager, mainViewFrame, gridartaJarFilename); updaterManager.startup(); new FindArchetypesDialogManager<G, A, R>(mainViewFrame, archetypeChooserControl, objectChooser, archetypeTypeSet); @@ -551,7 +557,7 @@ public void zoom() { final MapControl<G, A, R> mapControl = mapManager.getCurrentMapControl(); if (mapControl == null) { - JOptionPane.showMessageDialog(mainView.getFrame(), "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(mainViewFrame, "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); return; } new MapPreview(rendererFactory.newSimpleLevelRenderer(mapControl.getMapModel()).getFullImage()); @@ -566,7 +572,7 @@ if (prefsGroup == null) { prefsGroup = editorFactory.createPreferencesGroup(globalSettings, validators, appPrefsModel, exitConnectorModel, configSourceFactory); } - PreferencesPane.showPreferencesDialog(mainView.getFrame(), prefsGroup, false); + PreferencesPane.showPreferencesDialog(mainViewFrame, prefsGroup, false); } /** Invoked when user wants to exit from the program. */ @@ -619,7 +625,7 @@ @Deprecated @NotNull public Component getMainView() { - return mainView.getFrame(); + return mainViewFrame; } /** Control the server. */ @@ -627,11 +633,11 @@ public void controlServer() { if (controlServer == null) { controlServer = new ProcessRunner("controlServer", appPrefsModel.getServer()); - ACTION_BUILDER.showOnetimeMessageDialog(mainView.getFrame(), JOptionPane.WARNING_MESSAGE, "controlServerWarning"); + ACTION_BUILDER.showOnetimeMessageDialog(mainViewFrame, JOptionPane.WARNING_MESSAGE, "controlServerWarning"); } else { controlServer.setCommand(appPrefsModel.getServer()); } - controlServer.showDialog(mainView.getFrame()); + controlServer.showDialog(mainViewFrame); } /** Control the client. */ @@ -642,7 +648,7 @@ } else { controlClient.setCommand(appPrefsModel.getClient()); } - controlClient.showDialog(mainView.getFrame()); + controlClient.showDialog(mainViewFrame); } /** @@ -707,7 +713,7 @@ @ActionMethod public void collectSpells() { if (spellUtils != null) { - spellUtils.importSpells(globalSettings.getConfigurationDirectory(), mainView.getFrame()); + spellUtils.importSpells(globalSettings.getConfigurationDirectory(), mainViewFrame); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-25 08:46:02
|
Revision: 7626 http://gridarta.svn.sourceforge.net/gridarta/?rev=7626&view=rev Author: akirschbaum Date: 2010-04-25 08:45:55 +0000 (Sun, 25 Apr 2010) Log Message: ----------- Extract code from GUIMainControl into HelpActions. Modified Paths: -------------- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties trunk/src/app/net/sf/gridarta/action.properties trunk/src/app/net/sf/gridarta/gui/misc/MainView.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.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 Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java Modified: trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties =================================================================== --- trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2010-04-24 21:18:21 UTC (rev 7625) +++ trunk/atrinik/src/app/net/sf/gridarta/var/atrinik/action.properties 2010-04-25 08:45:55 UTC (rev 7626) @@ -36,7 +36,7 @@ view.menu=resetView - gridVisible doubleFaces - prevWindow nextWindow plugins.menu=- editPlugins - savePlugins importPlugin window.menu=closeAll -help.menu=onlineHelp tod about update +help.menu=showHelp tipOfTheDay about update mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor Modified: trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties =================================================================== --- trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties 2010-04-24 21:18:21 UTC (rev 7625) +++ trunk/crossfire/src/app/net/sf/gridarta/var/crossfire/action.properties 2010-04-25 08:45:55 UTC (rev 7626) @@ -36,7 +36,7 @@ view.menu=resetView - gridVisible smoothing - prevWindow nextWindow plugins.menu=- editPlugins - savePlugins importPlugin window.menu=closeAll -help.menu=onlineHelp tod about update +help.menu=showHelp tipOfTheDay about update mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor Modified: trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties =================================================================== --- trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2010-04-24 21:18:21 UTC (rev 7625) +++ trunk/daimonin/src/app/net/sf/gridarta/var/daimonin/action.properties 2010-04-25 08:45:55 UTC (rev 7626) @@ -36,7 +36,7 @@ view.menu=resetView - gridVisible doubleFaces - prevWindow nextWindow plugins.menu=- editPlugins - savePlugins importPlugin window.menu=closeAll -help.menu=onlineHelp tod about update +help.menu=showHelp tipOfTheDay about update mapwindow.menubar=mapwindowFile mapwindowEdit mapwindowMap mapwindowCursor Modified: trunk/src/app/net/sf/gridarta/action.properties =================================================================== --- trunk/src/app/net/sf/gridarta/action.properties 2010-04-24 21:18:21 UTC (rev 7625) +++ trunk/src/app/net/sf/gridarta/action.properties 2010-04-25 08:45:55 UTC (rev 7626) @@ -124,9 +124,9 @@ scriptEditFile.menu=scriptEditNewScript scriptEditOpen - scriptEditSave scriptEditSaveAs - scriptEditClose scriptEditCloseAll scriptEditEdit.menu=scriptEditUndo scriptEditRedo - scriptEditCut scriptEditCopy scriptEditPaste - scriptEditFind scriptEditReplace scriptEditFindAgain -onlineHelp.icon=general/Help16 +showHelp.icon=general/Help16 -tod.icon=general/TipOfTheDay16 +tipOfTheDay.icon=general/TipOfTheDay16 about.icon=general/About16 Added: trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java 2010-04-25 08:45:55 UTC (rev 7626) @@ -0,0 +1,64 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 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.misc; + +import java.awt.Frame; +import net.sf.gridarta.gui.help.Help; +import net.sf.japi.swing.action.ActionMethod; +import net.sf.japi.swing.tod.TipOfTheDayManager; +import org.jetbrains.annotations.NotNull; + +/** + * Actions that are related to displaying help information. + * @author Andreas Kirschbaum + */ +public class HelpActions { + + /** + * The main view {@link Frame}. + */ + @NotNull + private final Frame mainViewFrame; + + /** + * Creates a new instance. + * @param mainViewFrame the main view frame + */ + public HelpActions(@NotNull final Frame mainViewFrame) { + this.mainViewFrame = mainViewFrame; + } + + /** + * Action for creating a new project. + */ + @ActionMethod + public void showHelp() { + new Help(mainViewFrame, "start.html").setVisible(true); + } + + /** + * Action for creating a new project. + */ + @ActionMethod + public void tipOfTheDay() { + TipOfTheDayManager.show(mainViewFrame); + } + +} // class StartActions Property changes on: trunk/src/app/net/sf/gridarta/gui/misc/HelpActions.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/misc/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-24 21:18:21 UTC (rev 7625) +++ trunk/src/app/net/sf/gridarta/gui/misc/MainView.java 2010-04-25 08:45:55 UTC (rev 7626) @@ -39,8 +39,6 @@ import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.settings.GlobalSettings; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -52,11 +50,6 @@ */ public class MainView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { - /** - * The action builder. - */ - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); @@ -96,14 +89,14 @@ /** * Constructs the main view and registers the given main controller. + * @param frame the main window of the editor * @param exitAction the action to execute when the window is closed * @param statusBar the status bar instance - * @param buildNumber the application's build number * @param mapDesktop the map desktop to show * @param icon the application's icon or <code>null</code> for default */ - public MainView(@NotNull final ActionListener exitAction, @NotNull final Component statusBar, @NotNull final String buildNumber, @NotNull final Component mapDesktop, @Nullable final ImageIcon icon) { - frame = new JFrame(ACTION_BUILDER.format("mainWindow.title", buildNumber)); + public MainView(@NotNull final JFrame frame, @NotNull final ActionListener exitAction, @NotNull final Component statusBar, @NotNull final Component mapDesktop, @Nullable final ImageIcon icon) { + this.frame = frame; this.mapDesktop = mapDesktop; frame.add(statusBar, BorderLayout.SOUTH); frame.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-24 21:18:21 UTC (rev 7625) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2010-04-25 08:45:55 UTC (rev 7626) @@ -51,7 +51,6 @@ import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; -import net.sf.gridarta.gui.help.Help; import net.sf.gridarta.gui.io.FileFilters; import net.sf.gridarta.gui.map.MapFileActions; import net.sf.gridarta.gui.map.cursor.MapCursorActions; @@ -71,6 +70,7 @@ import net.sf.gridarta.gui.mappropertiesdialog.MapPropertiesDialogFactory; import net.sf.gridarta.gui.mapuserlistener.MapUserListenerManager; import net.sf.gridarta.gui.misc.About; +import net.sf.gridarta.gui.misc.HelpActions; import net.sf.gridarta.gui.misc.LeftPanel; import net.sf.gridarta.gui.misc.MainToolbar; import net.sf.gridarta.gui.misc.MainView; @@ -162,7 +162,6 @@ import net.sf.japi.swing.action.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 org.apache.log4j.Category; import org.apache.log4j.Logger; @@ -362,8 +361,10 @@ final ViewActions<G, A, R> viewActions = new ViewActions<G, A, R>(mapViewSettings, mapManager); final MapFolderTree<G, A, R> mapFolderTree = new MapFolderTree<G, A, R>(globalSettings.getPickmapDir()); final ImageIcon icon = systemIcons.getAppIcon(); - mainView = new MainView<G, A, R>(exitAction, statusBar, getBuildNumberAsString(), mapDesktop, icon); - final JFrame mainViewFrame = mainView.getFrame(); + final JFrame mainViewFrame = new JFrame(ACTION_BUILDER.format("mainWindow.title", getBuildNumberAsString())); + final HelpActions helpActions = new HelpActions(mainViewFrame); + ACTION_BUILDER.createActions(true, helpActions, "showHelp", "tipOfTheDay"); + mainView = new MainView<G, A, R>(mainViewFrame, exitAction, statusBar, mapDesktop, icon); newMapDialogFactory = editorFactory.newNewMapDialogFactory(mapViewsManager, mapArchObjectFactory, mainViewFrame); final PickmapChooserModel<G, A, R> pickmapChooserModel = new PickmapChooserModel<G, A, R>(); final MapFolderTreeActions<G, A, R> mapFolderTreeActions = new MapFolderTreeActions<G, A, R>(mapFolderTree, newMapDialogFactory, "createPickmapFolder", "deletePickmapFolder", "confirmDeletePickmapFolder", "deletePickmapFolderNotEmpty"); @@ -463,7 +464,7 @@ if (globalSettings.isAutoPopupDocu()) { // do an automated help popup because the docu version has increased // (people won't notice the docu otherwise - nobody expects a docu in opensource) - onlineHelp(); + helpActions.showHelp(); globalSettings.setAutoPopupDocu(false); } @@ -526,11 +527,6 @@ newLevel(); } - /** Open the online help window. */ - public void onlineHelp() { - new Help(mainView.getFrame(), "start.html").setVisible(true); - } - /** Runs the garbage collection. */ @ActionMethod public void gc() { @@ -551,14 +547,6 @@ fileControl.openFile(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.getFrame()); - } - /** Calls for zooming preview tool. */ public void zoom() { final MapControl<G, A, R> mapControl = mapManager.getCurrentMapControl(); Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2010-04-24 21:18:21 UTC (rev 7625) +++ trunk/src/app/net/sf/gridarta/messages.properties 2010-04-25 08:45:55 UTC (rev 7626) @@ -733,12 +733,12 @@ help.text=Help help.mnemonic=H -onlineHelp.text=Help -onlineHelp.mnemonic=H -onlineHelp.accel=F1 +showHelp.text=Help +showHelp.mnemonic=H +showHelp.accel=F1 -tod.text=Tip Of The Day... -tod.mnemonic=T +tipOfTheDay.text=Tip Of The Day... +tipOfTheDay.mnemonic=T about.text=About... about.mnemonic=A Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2010-04-24 21:18:21 UTC (rev 7625) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2010-04-25 08:45:55 UTC (rev 7626) @@ -682,11 +682,11 @@ help.text=Hilfe help.mnemonic=H -onlineHelp.text=Hilfe -onlineHelp.mnemonic=H +showHelp.text=Hilfe +showHelp.mnemonic=H -tod.text=Tipp des Tages... -tod.mnemonic=T +tipOfTheDay.text=Tipp des Tages... +tipOfTheDay.mnemonic=T about.text=\xDCber... about.mnemonic=B Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-04-24 21:18:21 UTC (rev 7625) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2010-04-25 08:45:55 UTC (rev 7626) @@ -677,11 +677,11 @@ help.text=Aide help.mnemonic=D -onlineHelp.text=Aide -onlineHelp.mnemonic=A +showHelp.text=Aide +showHelp.mnemonic=A -#tod.text= -#tod.mnemonic= +#tipOfTheDay.text= +#tipOfTheDay.mnemonic= about.text=\xC0 propos... about.mnemonic=P Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-04-24 21:18:21 UTC (rev 7625) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2010-04-25 08:45:55 UTC (rev 7626) @@ -681,11 +681,11 @@ help.text=Hj\xE4lp help.mnemonic=H -onlineHelp.text=Inbyggd hj\xE4lp -onlineHelp.mnemonic=H +showHelp.text=Inbyggd hj\xE4lp +showHelp.mnemonic=H -tod.text=Dagens tips... -tod.mnemonic=T +tipOfTheDay.text=Dagens tips... +tipOfTheDay.mnemonic=T about.text=Om... about.mnemonic=O This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |