From: <aki...@us...> - 2008-07-31 21:30:34
|
Revision: 4625 http://gridarta.svn.sourceforge.net/gridarta/?rev=4625&view=rev Author: akirschbaum Date: 2008-07-31 21:30:38 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove MainControl.getScriptSuffix(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:29:57 UTC (rev 4624) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:30:38 UTC (rev 4625) @@ -479,11 +479,6 @@ return globalSettings; } - /** {@inheritDoc} */ - public String getScriptSuffix() { - return ".py"; - } - /** * Returns the main view. * @return the main view Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:29:57 UTC (rev 4624) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:30:38 UTC (rev 4625) @@ -660,11 +660,6 @@ return globalSettings; } - /** {@inheritDoc} */ - public String getScriptSuffix() { - return ".lua"; - } - /** * Returns the main view. * @return the main view Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-07-31 21:29:57 UTC (rev 4624) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-07-31 21:30:38 UTC (rev 4625) @@ -20,7 +20,6 @@ package net.sf.gridarta; import java.io.File; -import javax.swing.filechooser.FileFilter; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -63,15 +62,6 @@ GlobalSettings getGlobalSettings(); /** - * Get the suffix for script files of this implementation's server side - * scripting language. The returned suffix includes the infix character - * ".". - * @return suffix for script files of this implementation's server side - * scripting language. - */ - String getScriptSuffix(); - - /** * Returns the MainView of this MainControl. * @return The MainView of this MainControl. */ Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-31 21:29:57 UTC (rev 4624) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-31 21:30:38 UTC (rev 4625) @@ -417,11 +417,6 @@ } /** {@inheritDoc} */ - public String getScriptSuffix() { - throw new AssertionError(); - } - - /** {@inheritDoc} */ public MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> getMainView() { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-31 21:34:25
|
Revision: 4628 http://gridarta.svn.sourceforge.net/gridarta/?rev=4628&view=rev Author: akirschbaum Date: 2008-07-31 21:34:30 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove calls to MainControl.getEditTypes(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:32:22 UTC (rev 4627) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:34:30 UTC (rev 4628) @@ -227,11 +227,11 @@ CMainControlInstance.instance = this; globalSettings.readGlobalSettings(); animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); - archetypeSet = new ArchetypeSet(this, getEditTypes(), animationObjects, faceObjects, globalSettings.getImageSet()); + archetypeSet = new ArchetypeSet(this, editTypes, animationObjects, faceObjects, globalSettings.getImageSet()); GameObject.setArchetypeSet(archetypeSet); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, getEditTypes(), mapTileListBottom, null, archetypeSet); + final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, editTypes, mapTileListBottom, null, archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, getMapManager(), selectedSquareControl, selectedSquareView); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); @@ -241,12 +241,12 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); SystemIcons.init(); final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), archetypeSet, faceObjects); createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); new About("cfeditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("cfeditor", this, mainView, "CrossfireEditor.jar"); @@ -330,7 +330,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser, archetypeSet); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, getMapImageCache(), mapActions, archetypeParser, archetypeSet); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:32:22 UTC (rev 4627) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:34:30 UTC (rev 4628) @@ -283,11 +283,11 @@ globalSettings.readGlobalSettings(); animationObjects = new daieditor.gameobject.anim.AnimationObjects(); GameObject.setAnimationObjects(animationObjects); - archetypeSet = new ArchetypeSet(this, getEditTypes(), animationObjects, faceObjects); + archetypeSet = new ArchetypeSet(this, editTypes, animationObjects, faceObjects); GameObject.setArchetypeSet(archetypeSet); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); - final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, getEditTypes(), mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); + final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, editTypes, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, getMapManager(), selectedSquareControl, selectedSquareView); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); @@ -299,12 +299,12 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getEditTypes(), selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); SystemIcons.init(); final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), archetypeSet, faceObjects); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, getEditTypes(), getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); new About("daieditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("daieditor", this, mainView, "DaimoninEditor.jar"); @@ -388,7 +388,7 @@ mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes(), getMapImageCache(), mapActions, archetypeParser, archetypeSet); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, getMapImageCache(), mapActions, archetypeParser, archetypeSet); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-31 21:32:22 UTC (rev 4627) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-31 21:34:30 UTC (rev 4628) @@ -74,7 +74,7 @@ private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; /** The edit types instance. */ - private final EditTypes<G, A, R, V> editTypes; + protected final EditTypes<G, A, R, V> editTypes; /** Buffer managing copy data. */ private final CopyBuffer<G, A, R, V> copyBuffer; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-31 21:44:28
|
Revision: 4630 http://gridarta.svn.sourceforge.net/gridarta/?rev=4630&view=rev Author: akirschbaum Date: 2008-07-31 21:44:34 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove calls to MainControl.getArchetypeTypeSet(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:39:40 UTC (rev 4629) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:44:34 UTC (rev 4630) @@ -241,7 +241,8 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); + archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); SystemIcons.init(); final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), archetypeSet, faceObjects); @@ -263,7 +264,6 @@ log.error("Cannot create XML parser: " + ex.getMessage()); throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); } - archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath()); new ArchetypeSetSpellLoader<GameObject, MapArchObject, Archetype>().load(archetypeSet, Archetype.TYPE_SPELL, gameObjectSpells); gameObjectSpells.sort(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:39:40 UTC (rev 4629) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:44:34 UTC (rev 4630) @@ -299,7 +299,8 @@ newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); + archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); SystemIcons.init(); final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), archetypeSet, faceObjects); @@ -324,7 +325,6 @@ log.error("Cannot create XML parser: " + ex.getMessage()); throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); } - archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath()); gameObjectSpells.sort(); XMLSpellLoader.load(getConfigurationDirectory(), CommonConstants.SPELL_FILE, xmlHelper.getDocumentBuilder(), numberSpells); Modified: trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-31 21:39:40 UTC (rev 4629) +++ trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-07-31 21:44:34 UTC (rev 4630) @@ -30,6 +30,7 @@ import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.EditTypes; import net.sf.gridarta.MainControl; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; @@ -96,12 +97,13 @@ * Creates a new instance. * @param mainControl the main control * @param archetypeSet the archetype set + * @param archetypeTypeSet the archetype type set * @param editTypes the edit types instance * @param archetypeChooserControl the archetype chooser control * @param pickmapChooserControl the pickmap chooser control * @param copyBuffer the copy buffer instance to use */ - public DefaultObjectChooser(final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + public DefaultObjectChooser(final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { super(new BorderLayout()); this.archetypeChooserControl = archetypeChooserControl; this.pickmapChooserControl = pickmapChooserControl; @@ -118,7 +120,7 @@ }); toolPalette = new ToolPalette<G, A, R, V>(mainControl, editTypes, selectedSquareView, this, pickmapChooserControl, copyBuffer); - objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(mainControl, archetypeSet, copyBuffer, this); + objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(mainControl, archetypeSet, archetypeTypeSet, copyBuffer, this); // archAndPickPane is the panel containing both archpanel and pickmaps archAndPickPane.addTab(ACTION_FACTORY.getString("objectChooser.archetypesTabTitle"), archetypeChooserControl.getArchetypePanel()); Modified: trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java 2008-07-31 21:39:40 UTC (rev 4629) +++ trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java 2008-07-31 21:44:34 UTC (rev 4630) @@ -27,6 +27,7 @@ import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.MainControl; import net.sf.gridarta.archtype.ArchetypeType; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; @@ -52,6 +53,10 @@ @NotNull private final ArchetypeSet<G, A, R> archetypeSet; + /** The archetype type set. */ + @NotNull + private final ArchetypeTypeSet<G, A, R> archetypeTypeSet; + /** The copy buffer instance. */ @NotNull private final CopyBuffer<G, A, R, V> copyBuffer; @@ -76,9 +81,10 @@ private final JLabel archTileText = new JLabel(); - public ObjectChoiceDisplay(final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final ObjectChooser<G, A, R> objectChooser) { + public ObjectChoiceDisplay(final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final ObjectChooser<G, A, R> objectChooser) { this.mainControl = mainControl; this.archetypeSet = archetypeSet; + this.archetypeTypeSet = archetypeTypeSet; this.copyBuffer = copyBuffer; this.objectChooser = objectChooser; setLayout(new GridBagLayout()); @@ -151,7 +157,7 @@ archArchNameText.setText(headObject.getArchetypeName()); - final ArchetypeType archetypeType = mainControl.getArchetypeTypeSet().getArchetypeType(headObject.getArchetype()); + final ArchetypeType archetypeType = archetypeTypeSet.getArchetypeType(headObject.getArchetype()); archTypeText.setText(archetypeType.getTypeName() + " (" + archetypeType.getTypeNo() + ')'); if (headObject.isMulti()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-31 21:50:20
|
Revision: 4631 http://gridarta.svn.sourceforge.net/gridarta/?rev=4631&view=rev Author: akirschbaum Date: 2008-07-31 21:50:23 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove calls to MainControl.getArchetypeTypeSet(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:44:34 UTC (rev 4630) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:50:23 UTC (rev 4631) @@ -323,7 +323,7 @@ // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), 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); - gameObjectAttributesPanel = new GameObjectAttributesPanel(this, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); + gameObjectAttributesPanel = new GameObjectAttributesPanel(this, archetypeTypeSet, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); PluginParameterFactory.init(archetypeSet, gameObjectAttributesPanel); scriptControl = new ScriptController(this, archetypeSet, mainView); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java 2008-07-31 21:44:34 UTC (rev 4630) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java 2008-07-31 21:50:23 UTC (rev 4631) @@ -25,6 +25,7 @@ import cfeditor.map.MapArchObject; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.connectionview.LockedItemsControl; @@ -45,8 +46,8 @@ private static final long serialVersionUID = 1L; /* Build Panel */ - public GameObjectAttributesPanel(final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { - super(mainControl, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); + public GameObjectAttributesPanel(final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + super(mainControl, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:44:34 UTC (rev 4630) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:50:23 UTC (rev 4631) @@ -384,7 +384,7 @@ // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), 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); - gameObjectAttributesPanel = new GameObjectAttributesPanel(this, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); + gameObjectAttributesPanel = new GameObjectAttributesPanel(this, archetypeTypeSet, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java 2008-07-31 21:44:34 UTC (rev 4630) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java 2008-07-31 21:50:23 UTC (rev 4631) @@ -25,6 +25,7 @@ import daieditor.map.MapArchObject; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.connectionview.LockedItemsControl; @@ -45,8 +46,8 @@ private static final long serialVersionUID = 1L; /* Build Panel */ - public GameObjectAttributesPanel(final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { - super(mainControl, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); + public GameObjectAttributesPanel(final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + super(mainControl, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-07-31 21:44:34 UTC (rev 4630) +++ trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-07-31 21:50:23 UTC (rev 4631) @@ -48,6 +48,7 @@ import net.sf.gridarta.MapManager; import net.sf.gridarta.MapManagerListener; import net.sf.gridarta.archtype.ArchetypeType; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -109,6 +110,10 @@ /** The MainControl to use, e.g. for accessing AnimationObjects. */ private final MainControl<G, A, R, V> mainControl; + /** The archetype type set. */ + @NotNull + private final ArchetypeTypeSet<G, A, R> archetypeTypeSet; + /** The map manager. */ private final MapManager<G, A, R, V> mapManager; @@ -272,12 +277,14 @@ * Create the GameObjectAttributesPanel. * @param mainControl MainControl to use, e.g. for accessing * AnimationObjects. + * @param archetypeTypeSet the archetype type set * @param monsterMatcher the <code>GameObjectMatcher</code> for matching * monster objects */ - protected GameObjectAttributesPanel(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<G, A, R, V> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<G, A, R, V> selectedSquareControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { + protected GameObjectAttributesPanel(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<G, A, R, V> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<G, A, R, V> selectedSquareControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { super(new BorderLayout()); this.mainControl = mainControl; + this.archetypeTypeSet = archetypeTypeSet; this.mapManager = mapManager; this.animationObjects = animationObjects; errorListView = new ErrorListView<G, A, R, V>(mapManager, selectedSquareView); @@ -970,7 +977,7 @@ archTypeText.setText("Type:"); } else { final StringBuilder typeText = new StringBuilder("Type: "); - final ArchetypeType archetypeType = mainControl.getArchetypeTypeSet().getArchetypeType(gameObject.getArchetype()); + final ArchetypeType archetypeType = archetypeTypeSet.getArchetypeType(gameObject.getArchetype()); typeText.append(archetypeType.getTypeName()); typeText.append(" (").append(archetypeType.getTypeNo()).append(')'); typeText.append(" [").append(gameObject.getArchetypeName()).append(']'); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-31 21:51:02
|
Revision: 4632 http://gridarta.svn.sourceforge.net/gridarta/?rev=4632&view=rev Author: akirschbaum Date: 2008-07-31 21:51:05 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove MainControl.getArchetypeTypeSet(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:50:23 UTC (rev 4631) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:51:05 UTC (rev 4632) @@ -767,11 +767,6 @@ } /** {@inheritDoc} */ - public ArchetypeTypeSet<GameObject, MapArchObject, Archetype> getArchetypeTypeSet() { - return archetypeTypeSet; - } - - /** {@inheritDoc} */ public Spells<NumberSpell> getNumberSpells() { return numberSpells; } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:50:23 UTC (rev 4631) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:51:05 UTC (rev 4632) @@ -947,11 +947,6 @@ } /** {@inheritDoc} */ - public ArchetypeTypeSet<GameObject, MapArchObject, Archetype> getArchetypeTypeSet() { - return archetypeTypeSet; - } - - /** {@inheritDoc} */ public Spells<NumberSpell> getNumberSpells() { return numberSpells; } Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-07-31 21:50:23 UTC (rev 4631) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-07-31 21:51:05 UTC (rev 4632) @@ -129,12 +129,6 @@ MapManager<G, A, R, V> getMapManager(); /** - * Returns the list with the types for the Archetypes and GameObjects. - * @return The list with the types for the Archetypes and GameObjects. - */ - ArchetypeTypeSet<G, A, R> getArchetypeTypeSet(); - - /** * Return the numbered spell objects. * @return The numbered spell objects. */ Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-31 21:50:23 UTC (rev 4631) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-31 21:51:05 UTC (rev 4632) @@ -454,11 +454,6 @@ } /** {@inheritDoc} */ - public ArchetypeTypeSet getArchetypeTypeSet() { - throw new AssertionError(); - } - - /** {@inheritDoc} */ public Spells<NumberSpell> getNumberSpells() { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-31 21:58:15
|
Revision: 4633 http://gridarta.svn.sourceforge.net/gridarta/?rev=4633&view=rev Author: akirschbaum Date: 2008-07-31 21:58:21 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove calls to MainControl.getMapManager(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:51:05 UTC (rev 4632) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:58:21 UTC (rev 4633) @@ -233,23 +233,23 @@ final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, editTypes, mapTileListBottom, null, archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); - new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, getMapManager(), selectedSquareControl, selectedSquareView); + new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, mapManager, selectedSquareControl, selectedSquareView); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); - final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); + final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, false); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); - pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), getMapManager()); + pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); - final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), archetypeSet, faceObjects); + final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, archetypeSet, faceObjects); createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); new About("cfeditor", mainView); - new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); + new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); updaterManager = new UpdaterManager("cfeditor", this, mainView, "CrossfireEditor.jar"); updaterManager.startup(); @@ -293,7 +293,7 @@ log.fatal("GameObjectMatcher 'exit' does not exist"); throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } - final MapActions mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); + final MapActions mapActions = new MapActions(mainView, this, mapManager, exitMatcher, mapFileFilter, selectedSquareView); archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); Map<String, TreasureTreeNode> specialTreasureLists; try { @@ -322,8 +322,8 @@ AbstractScriptArchEditor.initEventTypeBoxes(".py", "Python", ScriptArchUtils.createEventTypeBox(), pythonFileFilter); // Initialize the main view - final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), 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); - gameObjectAttributesPanel = new GameObjectAttributesPanel(this, archetypeTypeSet, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); + final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, 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); + gameObjectAttributesPanel = new GameObjectAttributesPanel(this, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); PluginParameterFactory.init(archetypeSet, gameObjectAttributesPanel); scriptControl = new ScriptController(this, archetypeSet, mainView); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); @@ -345,8 +345,8 @@ getCopyBuffer().init(getGridartaObjectsFactory().newMapArchObject(false)); mainActions.init(); - final RecentManager recentManager = new RecentManager(getMapManager(), (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); - getMapManager().setRecentManager(recentManager); + final RecentManager recentManager = new RecentManager(mapManager, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); + mapManager.setRecentManager(recentManager); // browse arch archive // load object from a arch file you found @@ -375,7 +375,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, archetypeSet, getMapManager()); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, archetypeSet, mapManager); } /** @@ -560,7 +560,7 @@ ScriptEditControlInstance.getInstance().openScriptFile(file.getAbsolutePath()); } else { globalSettings.setCurrentDir(dir); - getMapManager().openMapFileWithView(file, null); + mapManager.openMapFileWithView(file, null); } } else if (!file.exists()) { if (isScriptFile) { @@ -585,7 +585,7 @@ if (isScriptFile) { ScriptEditControlInstance.getInstance().openScriptFile(file.getAbsolutePath()); } else { - getMapManager().openMapFileWithView(file, null); + mapManager.openMapFileWithView(file, null); } } else if (!file.exists()) { if (isScriptFile) { @@ -677,7 +677,7 @@ /** Invoked when user wants to exit from the program. */ public void exit() { - if (ScriptEditControlInstance.getInstance().closeAllTabs() && getMapManager().closeAll() && pickmapChooserControl.canExit() && scriptControl.canExit()) { + if (ScriptEditControlInstance.getInstance().closeAllTabs() && mapManager.closeAll() && pickmapChooserControl.canExit() && scriptControl.canExit()) { doExit(); } } @@ -725,13 +725,13 @@ if (ACTION_FACTORY.showQuestionDialog(mainView, "confirmRevertMap", mapControl.getMapFileName())) { final File mfile = mapControl.getMapFile(); final Point[] viewPositions = mapControl.getViewPositions(); - getMapManager().closeLevel(mapControl, true); + mapManager.closeLevel(mapControl, true); - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView = getMapManager().openMapFileWithView(mfile, viewPositions[0]); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView = mapManager.openMapFileWithView(mfile, viewPositions[0]); if (newMapView != null) { final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl = newMapView.getMapControl(); for (int i = 1; i < viewPositions.length; i++) { - getMapManager().mapCreateView(newMapControl, viewPositions[i]); + mapManager.mapCreateView(newMapControl, viewPositions[i]); } } } @@ -758,7 +758,7 @@ /** Calls for zooming preview tool. */ public void zoom() { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = getMapManager().getCurrentMap(); + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = mapManager.getCurrentMap(); if (currentMap == null) { JOptionPane.showMessageDialog(mainView, "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); return; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:51:05 UTC (rev 4632) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:58:21 UTC (rev 4633) @@ -289,25 +289,25 @@ final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, editTypes, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); - new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, getMapManager(), selectedSquareControl, selectedSquareView); + new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, mapManager, selectedSquareControl, selectedSquareView); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); ACTION_FACTORY.createToggles(true, this, "drawDouble"); ACTION_FACTORY.createAction(true, "collectSpells", this); - final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); + final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, true); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); - pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), getMapManager()); + pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); - final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), archetypeSet, faceObjects); + final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, archetypeSet, faceObjects); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); - mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); + mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); new About("daieditor", mainView); - new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); + new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); updaterManager = new UpdaterManager("daieditor", this, mainView, "DaimoninEditor.jar"); updaterManager.startup(); @@ -354,7 +354,7 @@ log.fatal("GameObjectMatcher 'exit' does not exist"); throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } - final MapActions mapActions = new MapActions(mainView, this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); + final MapActions mapActions = new MapActions(mainView, this, mapManager, exitMatcher, mapFileFilter, selectedSquareView); Map<String, TreasureTreeNode> specialTreasureLists; try { final Document specialTreasureListsDocument = xmlHelper.getDocumentBuilder().parse(IOUtils.getResourceURLAsString(getConfigurationDirectory(), "TreasureLists.xml")); @@ -383,8 +383,8 @@ AbstractScriptArchEditor.initEventTypeBoxes(".lua", "Lua", ScriptArchUtils.createEventTypeBox(), luaFileFilter); // Initialize the main view - final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), 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); - gameObjectAttributesPanel = new GameObjectAttributesPanel(this, archetypeTypeSet, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); + final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, 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); + gameObjectAttributesPanel = new GameObjectAttributesPanel(this, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); @@ -427,8 +427,8 @@ } } - final RecentManager recentManager = new RecentManager(getMapManager(), (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); - getMapManager().setRecentManager(recentManager); + final RecentManager recentManager = new RecentManager(mapManager, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); + mapManager.setRecentManager(recentManager); // browse arch archive // load object from a arch file you found @@ -449,7 +449,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, archetypeSet, getMapManager()); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, archetypeSet, mapManager); } /** @@ -523,7 +523,7 @@ */ @ActionMethod public void cleanCompletelyBlockedSquares() { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = getMapManager().getCurrentMap(); + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = mapManager.getCurrentMap(); if (currentMap == null) { return; } @@ -552,7 +552,7 @@ */ public void setDrawDouble(final boolean drawDouble) { this.drawDouble = drawDouble; - getMapManager().refreshCurrentMap(); + mapManager.refreshCurrentMap(); } /** Control the server. */ @@ -623,17 +623,17 @@ if (state) { alphaType |= v; // XXX THIS IS A BAD HACK - getMapManager().addEditType(v); + mapManager.addEditType(v); } else { alphaType &= ~v; } - getMapManager().refreshCurrentMap(); + mapManager.refreshCurrentMap(); } /** Clear the transparency. */ public void clearAlpha() { alphaType = 0; - getMapManager().refreshCurrentMap(); + mapManager.refreshCurrentMap(); } public void onlineHelp() { @@ -741,7 +741,7 @@ ScriptEditControlInstance.getInstance().openScriptFile(file.getAbsolutePath()); } else { globalSettings.setCurrentDir(dir); - getMapManager().openMapFileWithView(file, null); + mapManager.openMapFileWithView(file, null); } } else if (!file.exists()) { if (isScriptFile) { @@ -766,7 +766,7 @@ if (isScriptFile) { ScriptEditControlInstance.getInstance().openScriptFile(file.getAbsolutePath()); } else { - getMapManager().openMapFileWithView(file, null); + mapManager.openMapFileWithView(file, null); } } else if (!file.exists()) { if (isScriptFile) { @@ -865,7 +865,7 @@ /** Invoked when user wants to exit from the program. */ public void exit() { - if (ScriptEditControlInstance.getInstance().closeAllTabs() && getMapManager().closeAll() && pickmapChooserControl.canExit()) { + if (ScriptEditControlInstance.getInstance().closeAllTabs() && mapManager.closeAll() && pickmapChooserControl.canExit()) { doExit(); } } @@ -913,13 +913,13 @@ if (ACTION_FACTORY.showQuestionDialog(mainView, "confirmRevertMap", mapControl.getMapFileName())) { final File mfile = mapControl.getMapFile(); final Point[] viewPositions = mapControl.getViewPositions(); - getMapManager().closeLevel(mapControl, true); + mapManager.closeLevel(mapControl, true); - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView = getMapManager().openMapFileWithView(mfile, viewPositions[0]); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView = mapManager.openMapFileWithView(mfile, viewPositions[0]); if (newMapView != null) { final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl = newMapView.getMapControl(); for (int i = 1; i < viewPositions.length; i++) { - getMapManager().mapCreateView(newMapControl, viewPositions[i]); + mapManager.mapCreateView(newMapControl, viewPositions[i]); } } } @@ -938,7 +938,7 @@ /** Calls for zooming preview tool. */ public void zoom() { - final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = getMapManager().getCurrentMap(); + final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> currentMap = mapManager.getCurrentMap(); if (currentMap == null) { JOptionPane.showMessageDialog(mainView, "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); return; Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-31 21:51:05 UTC (rev 4632) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-31 21:58:21 UTC (rev 4633) @@ -89,7 +89,7 @@ private final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(); /** The map manager. */ - private final MapManager<G, A, R, V> mapManager; + protected final MapManager<G, A, R, V> mapManager; /** The updater instance. */ protected UpdaterManager updaterManager = null; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-31 22:04:06
|
Revision: 4634 http://gridarta.svn.sourceforge.net/gridarta/?rev=4634&view=rev Author: akirschbaum Date: 2008-07-31 22:04:11 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove call to MainControl.getMainView(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 21:58:21 UTC (rev 4633) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 22:04:11 UTC (rev 4634) @@ -375,7 +375,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, archetypeSet, mapManager); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, mainView, archetypeSet, mapManager); } /** Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 21:58:21 UTC (rev 4633) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 22:04:11 UTC (rev 4634) @@ -449,7 +449,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, archetypeSet, mapManager); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, mainView, archetypeSet, mapManager); } /** Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-31 21:58:21 UTC (rev 4633) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-31 22:04:11 UTC (rev 4634) @@ -109,6 +109,11 @@ private final MainControl<G, A, R, ?> mainControl; /** + * The parent frame for showing dialog boxes. + */ + private final JFrame parent; + + /** * The archetype set to use. */ @NotNull @@ -172,14 +177,16 @@ * @param archetypeTypeSet Reference to the list of archetype types. * @param gameObject GameObject to show dialog for. * @param mainControl MainControl, for retrieving AnimationObjects etc. + * @param parent the parent frame for showing dialog boxes * @param archetypeSet the archetype set to use * @param mapManager the map manager to use */ - public GameObjectAttributesDialog(@NotNull final GameObjectAttributesDialogFactory<G, A, R, ?> gameObjectAttributesDialogFactory, final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R, ?> mapManager) { + public GameObjectAttributesDialog(@NotNull final GameObjectAttributesDialogFactory<G, A, R, ?> gameObjectAttributesDialogFactory, final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final JFrame parent, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R, ?> mapManager) { this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.archetypeTypeSet = archetypeTypeSet; this.gameObject = gameObject.getHead(); this.mainControl = mainControl; + this.parent = parent; this.archetypeSet = archetypeSet; this.mapManager = mapManager; archetype = this.gameObject.getArchetype(); @@ -512,7 +519,7 @@ /** Action method for help. */ public void attribHelp() { - new Help(/* XXX */ mainControl.getMainView(), type.createHtmlDocu()).setVisible(true); + new Help(/* XXX */ parent, type.createHtmlDocu()).setVisible(true); } /** Action method for ok. */ Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-31 21:58:21 UTC (rev 4633) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-31 22:04:11 UTC (rev 4634) @@ -22,6 +22,7 @@ import java.util.HashMap; import java.util.Map; import javax.swing.JDialog; +import javax.swing.JFrame; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; @@ -57,6 +58,12 @@ private final MainControl<G, A, R, V> mainControl; /** + * The parent frame for showing dialog boxes. + */ + @NotNull + private JFrame parent; + + /** * The archetype set to use. */ @NotNull @@ -72,12 +79,14 @@ * Creates a new instance. * @param archetypeTypeSet the list of CF type-data * @param mainControl the main control + * @param parent the parent frame for showing dialog boxes * @param archetypeSet the archetype set to use * @param mapManager the map manager */ - public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R, V> mapManager) { + public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final JFrame parent, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R, V> mapManager) { this.archetypeTypeSet = archetypeTypeSet; this.mainControl = mainControl; + this.parent = parent; this.archetypeSet = archetypeSet; this.mapManager = mapManager; } @@ -92,7 +101,7 @@ if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); } else { - final GameObjectAttributesDialog<G, A, R> pane = new GameObjectAttributesDialog(this, archetypeTypeSet, gameObject, mainControl, archetypeSet, mapManager); + final GameObjectAttributesDialog<G, A, R> pane = new GameObjectAttributesDialog(this, archetypeTypeSet, gameObject, mainControl, parent, archetypeSet, mapManager); final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-31 22:12:37
|
Revision: 4638 http://gridarta.svn.sourceforge.net/gridarta/?rev=4638&view=rev Author: akirschbaum Date: 2008-07-31 22:12:44 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 22:10:40 UTC (rev 4637) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 22:12:44 UTC (rev 4638) @@ -375,7 +375,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, mainView, archetypeSet, mapManager); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, mainView, archetypeSet, mapManager); } /** Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 22:10:40 UTC (rev 4637) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 22:12:44 UTC (rev 4638) @@ -449,7 +449,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, mainView, archetypeSet, mapManager); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, mainView, archetypeSet, mapManager); } /** Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-31 22:10:40 UTC (rev 4637) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-31 22:12:44 UTC (rev 4638) @@ -23,7 +23,6 @@ import java.util.Map; import javax.swing.JDialog; import javax.swing.JFrame; -import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.Archetype; @@ -52,12 +51,6 @@ private final ArchetypeTypeSet<G, A, R> archetypeTypeSet; /** - * The main control. - */ - @NotNull - private final MainControl<G, A, R, V> mainControl; - - /** * The parent frame for showing dialog boxes. */ @NotNull @@ -78,14 +71,12 @@ /** * Creates a new instance. * @param archetypeTypeSet the list of CF type-data - * @param mainControl the main control * @param parent the parent frame for showing dialog boxes * @param archetypeSet the archetype set to use * @param mapManager the map manager */ - public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final JFrame parent, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R, V> mapManager) { + public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final JFrame parent, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R, V> mapManager) { this.archetypeTypeSet = archetypeTypeSet; - this.mainControl = mainControl; this.parent = parent; this.archetypeSet = archetypeSet; this.mapManager = mapManager; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-31 22:26:52
|
Revision: 4644 http://gridarta.svn.sourceforge.net/gridarta/?rev=4644&view=rev Author: akirschbaum Date: 2008-07-31 22:26:59 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove MainControl.getGridartaObjectsFactory(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 22:25:15 UTC (rev 4643) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 22:26:59 UTC (rev 4644) @@ -330,7 +330,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, getMapImageCache(), mapActions, archetypeParser, archetypeSet); + gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, getMapImageCache(), mapActions, archetypeParser, archetypeSet); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { @@ -342,7 +342,7 @@ net.sf.gridarta.gameobject.GameObject.initialize(archetypeTypeSet, gameObjectMatchers); - getCopyBuffer().init(getGridartaObjectsFactory().newMapArchObject(false)); + getCopyBuffer().init(gridartaObjectsFactory.newMapArchObject(false)); mainActions.init(); final RecentManager recentManager = new RecentManager(mapManager, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); @@ -763,7 +763,7 @@ JOptionPane.showMessageDialog(mainView, "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); return; } - new MapPreview(getGridartaObjectsFactory().newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); + new MapPreview(gridartaObjectsFactory.newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 22:25:15 UTC (rev 4643) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 22:26:59 UTC (rev 4644) @@ -388,7 +388,7 @@ mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, getMapImageCache(), mapActions, archetypeParser, archetypeSet); + gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, getMapImageCache(), mapActions, archetypeParser, archetypeSet); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { @@ -400,7 +400,7 @@ net.sf.gridarta.gameobject.GameObject.initialize(archetypeTypeSet, gameObjectMatchers); - getCopyBuffer().init(getGridartaObjectsFactory().newMapArchObject(false)); + getCopyBuffer().init(gridartaObjectsFactory.newMapArchObject(false)); mainActions.init(); // Delete libraries. @@ -943,7 +943,7 @@ JOptionPane.showMessageDialog(mainView, "No map loaded! Please load a map!!", "Error", JOptionPane.ERROR_MESSAGE); return; } - new MapPreview(getGridartaObjectsFactory().newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); + new MapPreview(gridartaObjectsFactory.newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-31 22:25:15 UTC (rev 4643) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-31 22:26:59 UTC (rev 4644) @@ -71,7 +71,7 @@ private static MainControl<?, ?, ?, ?> instance; /** The Gridarta Objects Factory. */ - private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + protected final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; /** The edit types instance. */ protected final EditTypes<G, A, R, V> editTypes; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-31 22:37:14
|
Revision: 4647 http://gridarta.svn.sourceforge.net/gridarta/?rev=4647&view=rev Author: akirschbaum Date: 2008-07-31 22:37:20 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove calls to MainControl.getAutojoinLists(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 22:35:24 UTC (rev 4646) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 22:37:20 UTC (rev 4647) @@ -362,7 +362,7 @@ archetypeChooserControl.finishBuildProcess(); // load the autojoin lists - getAutojoinLists().loadList(archetypeSet, getConfigurationDirectory()); + autojoinLists.loadList(archetypeSet, getConfigurationDirectory()); if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { ACTION_FACTORY.showMessageDialog(mainView, "loadArchesNoArchfiles"); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 22:35:24 UTC (rev 4646) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 22:37:20 UTC (rev 4647) @@ -436,7 +436,7 @@ archetypeChooserControl.finishBuildProcess(); // load the autojoin lists - getAutojoinLists().loadList(archetypeSet, getConfigurationDirectory()); + autojoinLists.loadList(archetypeSet, getConfigurationDirectory()); if (archetypeSet.getLoadStatus() == ArchetypeSet.LoadStatus.EMPTY) { ACTION_FACTORY.showMessageDialog(mainView, "loadArchesNoArchfiles"); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-31 22:35:24 UTC (rev 4646) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-31 22:37:20 UTC (rev 4647) @@ -86,7 +86,7 @@ private MapPreviewAccessory mapPreviewAccessory; /** The autojoin lists. */ - private final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(); + protected final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(); /** The map manager. */ protected final MapManager<G, A, R, V> mapManager; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-31 22:50:46
|
Revision: 4648 http://gridarta.svn.sourceforge.net/gridarta/?rev=4648&view=rev Author: akirschbaum Date: 2008-07-31 22:50:50 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove calls to MainControl.getAutojoinLists(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 22:37:20 UTC (rev 4647) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 22:50:50 UTC (rev 4648) @@ -330,7 +330,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, getMapImageCache(), mapActions, archetypeParser, archetypeSet); + gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, getMapImageCache(), mapActions, archetypeParser, archetypeSet, autojoinLists); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-31 22:37:20 UTC (rev 4647) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-31 22:50:50 UTC (rev 4648) @@ -33,6 +33,7 @@ import java.util.List; import java.util.prefs.Preferences; import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; @@ -104,6 +105,10 @@ @NotNull private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; + /** The {@link AutojoinLists} instance. */ + @NotNull + private AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -145,13 +150,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, autojoinLists, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); } /** {@inheritDoc} */ @@ -167,7 +172,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; @@ -177,6 +182,7 @@ this.mapActions = mapActions; this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; + this.autojoinLists = autojoinLists; } } // class CrossfireObjectsFactory Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 22:37:20 UTC (rev 4647) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 22:50:50 UTC (rev 4648) @@ -388,7 +388,7 @@ mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, getMapImageCache(), mapActions, archetypeParser, archetypeSet); + gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, getMapImageCache(), mapActions, archetypeParser, archetypeSet, autojoinLists); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-31 22:37:20 UTC (rev 4647) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-31 22:50:50 UTC (rev 4648) @@ -33,6 +33,7 @@ import java.util.List; import java.util.prefs.Preferences; import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; @@ -107,6 +108,10 @@ @NotNull private ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet = null; + /** The {@link AutojoinLists} instance. */ + @NotNull + private AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -148,13 +153,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, autojoinLists, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); + final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); mapArchObject.setDifficulty(1); return mapControl; } @@ -172,7 +177,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { this.faceObjects = faceObjects; this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; @@ -183,6 +188,7 @@ this.mapActions = mapActions; this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; + this.autojoinLists = autojoinLists; } } // class DaimoninObjectsFactory Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-31 22:37:20 UTC (rev 4647) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-31 22:50:50 UTC (rev 4648) @@ -143,7 +143,8 @@ * @param mapActions the map actions instance * @param archetypeParser the archetype parser instance * @param archetypeSet the archetype set instance + * @param autojoinLists the autojoin lists instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser, @NotNull ArchetypeSet<G, A, R> archetypeSet); + void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull final AutojoinLists<G, A, R> autojoinLists); } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-31 22:37:20 UTC (rev 4647) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-31 22:50:50 UTC (rev 4648) @@ -27,6 +27,7 @@ import java.util.LinkedList; import java.util.List; import javax.swing.event.EventListenerList; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; @@ -149,6 +150,7 @@ * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory instance * @param mainControl the main control + * @param autojoinLists the autojoin lists instance to use * @param mapImageCache the map image cache instance * @param objects the game objects to insert; my be <code>null</code> * @param mapArchObject the map arch object for this map @@ -157,13 +159,13 @@ * @param archetypeChooserControl the archeype chooser control to use * @param mapActions the map actions to use */ - public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapImageCache<G, A, R, V> mapImageCache, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final MapActions mapActions) { + public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapImageCache<G, A, R, V> mapImageCache, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final MapActions mapActions) { this.gridartaObjectsFactory = gridartaObjectsFactory; this.mainControl = mainControl; this.mapImageCache = mapImageCache; this.isPickmap = isPickmap; // we create model (= data) - mapModel = new DefaultMapModel<G, A, R>(mainControl, this, objects, mapArchObject, exitTypeGameObjectMatcher, archetypeChooserControl, mapActions); + mapModel = new DefaultMapModel<G, A, R>(mainControl, autojoinLists, this, objects, mapArchObject, exitTypeGameObjectMatcher, archetypeChooserControl, mapActions); mapModel.addMapModelListener(mapModelListener); } Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-07-31 22:37:20 UTC (rev 4647) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-07-31 22:50:50 UTC (rev 4648) @@ -27,6 +27,7 @@ import java.util.Set; import javax.swing.event.EventListenerList; import net.sf.gridarta.AutojoinList; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapActions; import net.sf.gridarta.Size2D; @@ -88,6 +89,9 @@ private final transient MainControl<G, A, R, ?> mainControl; @NotNull + private final AutojoinLists<G, A, R> autojoinLists; + + @NotNull private final ArchetypeChooserControl<G, A, R, ?> archetypeChooserControl; /** The {@link GameObjectMatcher} for selecting exit objects. */ @@ -147,6 +151,7 @@ /** * Create an DefaultMapModel. * @param mainControl main controller + * @param autojoinLists the autojoin lists instance to use * @param mapControl MapControl to associate with this model. * @param objects the <code>GameObject</code> list of this map or * <code>null</code> for an empty map @@ -155,10 +160,11 @@ * @param archetypeChooserControl the archetype chooser control * @param mapActions the map actions to use */ - public DefaultMapModel(@NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final MapControl<G, A, R, ?> mapControl, @Nullable final List<G> objects, @NotNull final A mapArchObject, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, ?> archetypeChooserControl, @NotNull final MapActions mapActions) { + public DefaultMapModel(@NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapControl<G, A, R, ?> mapControl, @Nullable final List<G> objects, @NotNull final A mapArchObject, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, ?> archetypeChooserControl, @NotNull final MapActions mapActions) { this.mapControl = mapControl; this.mapArchObject = mapArchObject; this.mainControl = mainControl; + this.autojoinLists = autojoinLists; this.archetypeChooserControl = archetypeChooserControl; this.exitTypeGameObjectMatcher = exitTypeGameObjectMatcher; this.mapActions = mapActions; @@ -602,7 +608,7 @@ // do autojoining final R archetype = gameObject.getArchetype(); if (mapActions.isAutoJoin() && join && !archetype.isMulti()) { - final AutojoinList<G, A, R> autojoinList = mainControl.getAutojoinLists().getAutojoinList(archetype); + final AutojoinList<G, A, R> autojoinList = autojoinLists.getAutojoinList(archetype); if (autojoinList != null) { // remove connections to the deleted arch autojoinList.joinDelete(this, new Point(mapSquare.getMapX(), mapSquare.getMapY())); @@ -719,7 +725,7 @@ } if (mapActions.isAutoJoin() && join && !archetype.isMulti()) { - final AutojoinList<G, A, R> autojoinList = mainControl.getAutojoinLists().getAutojoinList(archetype); + final AutojoinList<G, A, R> autojoinList = autojoinLists.getAutojoinList(archetype); if (autojoinList != null) { // do autojoining if enabled archetype = autojoinList.joinInsert(this, pos); Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-31 22:37:20 UTC (rev 4647) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-31 22:50:50 UTC (rev 4648) @@ -29,6 +29,7 @@ import javax.swing.ImageIcon; import javax.swing.JList; import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.DefaultMapManager; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; @@ -386,8 +387,9 @@ final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, "test"); final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache = new MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(null, mapManager, null, new ImageIcon(), new ImageIcon()); final MapActions mapActions = new TestMapActions(); - final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, mainControl, mapImageCache, null, mapArchObject, false, null, archetypeChooserControl, mapActions); - mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(mainControl, mapControl, null, mapArchObject, null, archetypeChooserControl, mapActions); + final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(); + final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, mainControl, autojoinLists, mapImageCache, null, mapArchObject, false, null, archetypeChooserControl, mapActions); + mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(mainControl, autojoinLists, mapControl, null, mapArchObject, null, archetypeChooserControl, mapActions); result.setLength(0); mapModel.addMapModelListener(mapModelListener); @@ -509,8 +511,8 @@ * @param archetypeChooserControl the archetype chooser control to use * @param mapActions the map actions to use */ - public TestMapControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl, @NotNull final MapActions mapActions) { - super(gridartaObjectsFactory, mainControl, mapImageCache, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl, mapActions); + public TestMapControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl, @NotNull final MapActions mapActions) { + super(gridartaObjectsFactory, mainControl, autojoinLists, mapImageCache, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl, mapActions); } } @@ -899,7 +901,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists) { throw new AssertionError(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-31 23:09:35
|
Revision: 4649 http://gridarta.svn.sourceforge.net/gridarta/?rev=4649&view=rev Author: akirschbaum Date: 2008-07-31 23:09:40 +0000 (Thu, 31 Jul 2008) Log Message: ----------- Remove calls to MainControl.getMainView(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/CopyBuffer.java trunk/src/app/net/sf/gridarta/DefaultMapManager.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-31 22:50:50 UTC (rev 4648) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-31 23:09:40 UTC (rev 4649) @@ -27,6 +27,7 @@ import cfeditor.io.GameObjectParser; import cfeditor.io.MapArchObjectParser; import cfeditor.map.MapArchObject; +import java.awt.Component; import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; @@ -149,14 +150,14 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, autojoinLists, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent) { + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); } /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent) { + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-31 22:50:50 UTC (rev 4648) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-31 23:09:40 UTC (rev 4649) @@ -27,6 +27,7 @@ import daieditor.io.GameObjectParser; import daieditor.io.MapArchObjectParser; import daieditor.map.MapArchObject; +import java.awt.Component; import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; @@ -152,14 +153,14 @@ /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, autojoinLists, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent) { + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, parent, autojoinLists, mapImageCache, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); } /** {@inheritDoc} */ @NotNull - public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); + public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject, @NotNull final Component parent) { + final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); mapArchObject.setDifficulty(1); return mapControl; } Modified: trunk/src/app/net/sf/gridarta/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-07-31 22:50:50 UTC (rev 4648) +++ trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-07-31 23:09:40 UTC (rev 4649) @@ -89,7 +89,7 @@ public void init(final A mapArch) { assert copyMapCtrl == null; mapArch.setMapName("cb"); - copyMapCtrl = mainControl.getGridartaObjectsFactory().newMapControl(null, mapArch); + copyMapCtrl = mainControl.getGridartaObjectsFactory().newMapControl(null, mapArch, mainControl.getMainView()); copyMapCtrl.setMapFileName("cb"); } Modified: trunk/src/app/net/sf/gridarta/DefaultMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-07-31 22:50:50 UTC (rev 4648) +++ trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-07-31 23:09:40 UTC (rev 4649) @@ -112,7 +112,7 @@ @NotNull private MapControl<G, A, R, V> newMap(final List<G> objects, final A mapArchObject, @Nullable final File file, @NotNull final String mapFileName) { - final MapControl<G, A, R, V> mapControl = mainControl.getGridartaObjectsFactory().newMapControl(objects, mapArchObject); + final MapControl<G, A, R, V> mapControl = mainControl.getGridartaObjectsFactory().newMapControl(objects, mapArchObject, mainControl.getMainView()); mapControl.setMapFile(file); mapControl.setMapFileName(mapFileName); return mapControl; Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-31 22:50:50 UTC (rev 4648) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-31 23:09:40 UTC (rev 4649) @@ -19,6 +19,7 @@ package net.sf.gridarta; +import java.awt.Component; import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; @@ -98,19 +99,21 @@ * Create a new map control instance. * @param objects The objects to insert into the new map. * @param mapArchObject The map arch object to use for the new map. + * @param parent the parent component for error messages * @return The new map control instance. */ @NotNull - MapControl<G, A, R, V> newMapControl(@Nullable List<G> objects, @NotNull A mapArchObject); + MapControl<G, A, R, V> newMapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent); /** * Create a new pickmap map control instance. * @param objects The objects to insert into the new pickmap. * @param mapArchObject The map arch object to use for the new pickmap. + * @param parent the parent component for error messages * @return The new pickmap map control instance. */ @NotNull - MapControl<G, A, R, V> newPickmapControl(@Nullable List<G> objects, @NotNull A mapArchObject); + MapControl<G, A, R, V> newPickmapControl(@Nullable List<G> objects, @NotNull A mapArchObject, @NotNull Component parent); /** * Create a new level renderer instance. Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-07-31 22:50:50 UTC (rev 4648) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Folder.java 2008-07-31 23:09:40 UTC (rev 4649) @@ -19,6 +19,7 @@ package net.sf.gridarta.gui.pickmapchooser; +import java.awt.Component; import java.io.File; import java.util.ArrayList; import java.util.Collection; @@ -130,11 +131,12 @@ * @param name the map file name * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> * instance for loading the pickmap map file + * @param parent the parent component for error messages * @return the newly created pickmap * @throws InvalidNameException if the pickmap name is invalid */ - public synchronized Pickmap<G, A, R, V> addPickmap(@NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory) throws InvalidNameException { - final Pickmap<G, A, R, V> pickmap = new Pickmap<G, A, R, V>(this, name, gridartaObjectsFactory); + public synchronized Pickmap<G, A, R, V> addPickmap(@NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent) throws InvalidNameException { + final Pickmap<G, A, R, V> pickmap = new Pickmap<G, A, R, V>(this, name, gridartaObjectsFactory, parent); pickmaps.add(pickmap); for (final FolderListener<G, A, R, V> listener : listeners.getListeners(FolderListener.class)) { listener.pickmapAdded(pickmap); Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java 2008-07-31 22:50:50 UTC (rev 4648) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java 2008-07-31 23:09:40 UTC (rev 4649) @@ -19,6 +19,7 @@ package net.sf.gridarta.gui.pickmapchooser; +import java.awt.Component; import java.io.File; import java.util.Arrays; import net.sf.gridarta.GridartaObjectsFactory; @@ -51,14 +52,22 @@ private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; /** + * The parent component for error messages. + */ + @NotNull + private final Component parent; + + /** * Creates a new instance. * @param model the model to add the loaded pickmaps to * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> + * @param parent the parent component for error messages * instance to use for loading pickmap files */ - public Loader(@NotNull final Model<G, A, R, V> model, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory) { + public Loader(@NotNull final Model<G, A, R, V> model, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent) { this.model = model; this.gridartaObjectsFactory = gridartaObjectsFactory; + this.parent = parent; } /** Loads all pickmap files from a directory and its subdirectories. */ @@ -104,7 +113,7 @@ for (final File file : files) { if (file.isFile()) { try { - folder.addPickmap(file.getName(), gridartaObjectsFactory); + folder.addPickmap(file.getName(), gridartaObjectsFactory, this.parent); } catch (final InvalidNameException ex) { log.warn("ignoring pickmap with invalid name: " + file); } Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-07-31 22:50:50 UTC (rev 4648) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Pickmap.java 2008-07-31 23:09:40 UTC (rev 4649) @@ -19,6 +19,7 @@ package net.sf.gridarta.gui.pickmapchooser; +import java.awt.Component; import java.io.File; import java.io.IOException; import java.util.Collection; @@ -65,6 +66,12 @@ private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; /** + * The parent component for error messages. + */ + @NotNull + private final Component parent; + + /** * The {@link MapControl} instance representing the map file, or * <code>null</code> if the map file is not loaded. */ @@ -84,9 +91,10 @@ * @param name the underlying map file name * @param gridartaObjectsFactory the <code>GridartaObjectsFactory</code> * instance for loading the map file + * @param parent the parent component for error messages * @throws InvalidNameException if <code>name</code> is not valid */ - public Pickmap(@NotNull final Folder<G, A, R, V> folder, @NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory) throws InvalidNameException { + public Pickmap(@NotNull final Folder<G, A, R, V> folder, @NotNull final String name, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final Component parent) throws InvalidNameException { if (!isValidPickmapName(name)) { throw new InvalidNameException(name); } @@ -94,6 +102,7 @@ this.folder = folder; this.name = name; this.gridartaObjectsFactory = gridartaObjectsFactory; + this.parent = parent; } /** @@ -153,7 +162,7 @@ decoder.close(); } - pickmap = gridartaObjectsFactory.newPickmapControl(decoder.getGameObjects(), decoder.getMapArchObject()); + pickmap = gridartaObjectsFactory.newPickmapControl(decoder.getGameObjects(), decoder.getMapArchObject(), parent); pickmap.setMapFile(file); pickmap.setMapFileName(file.getPath()); pickmap.resetModified(); Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-07-31 22:50:50 UTC (rev 4648) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-07-31 23:09:40 UTC (rev 4649) @@ -199,7 +199,7 @@ * Load all pickmaps and build the pickmap-panel. */ public void loadPickmaps() { - new Loader<G, A, R, V>(model, mainControl.getGridartaObjectsFactory()).load(); + new Loader<G, A, R, V>(model, mainControl.getGridartaObjectsFactory(), mainControl.getMainView()).load(); } /** @@ -240,7 +240,7 @@ } } - final MapControl<G, A, R, V> mapControl = mainControl.getGridartaObjectsFactory().newPickmapControl(null, mapArchObject); + final MapControl<G, A, R, V> mapControl = mainControl.getGridartaObjectsFactory().newPickmapControl(null, mapArchObject, mainControl.getMainView()); mapControl.setMapFile(mapFile); mapControl.setMapFileName(mapFile.getPath()); mapControl.resetModified(); @@ -248,7 +248,7 @@ final Pickmap<G, A, R, V> pickmap; try { - pickmap = activeFolder.addPickmap(pickmapName, mainControl.getGridartaObjectsFactory()); + pickmap = activeFolder.addPickmap(pickmapName, mainControl.getGridartaObjectsFactory(), mainControl.getMainView()); } catch (final InvalidNameException ex) { throw new AssertionError(); // the name has been checked before } Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-31 22:50:50 UTC (rev 4648) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-31 23:09:40 UTC (rev 4649) @@ -19,6 +19,7 @@ package net.sf.gridarta.map; +import java.awt.Component; import java.awt.Point; import java.io.File; import java.io.IOException; @@ -75,6 +76,12 @@ @NotNull private final MainControl<G, A, R, V> mainControl; + /** + * The parent component for error messages. + */ + @NotNull + private final Component parent; + /** The map image cache instance. */ @NotNull private final MapImageCache<G, A, R, V> mapImageCache; @@ -150,6 +157,7 @@ * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory instance * @param mainControl the main control + * @param parent the parent component for error messages * @param autojoinLists the autojoin lists instance to use * @param mapImageCache the map image cache instance * @param objects the game objects to insert; my be <code>null</code> @@ -159,13 +167,14 @@ * @param archetypeChooserControl the archeype chooser control to use * @param mapActions the map actions to use */ - public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapImageCache<G, A, R, V> mapImageCache, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final MapActions mapActions) { + public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapImageCache<G, A, R, V> mapImageCache, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final MapActions mapActions) { this.gridartaObjectsFactory = gridartaObjectsFactory; this.mainControl = mainControl; + this.parent = parent; this.mapImageCache = mapImageCache; this.isPickmap = isPickmap; // we create model (= data) - mapModel = new DefaultMapModel<G, A, R>(mainControl, autojoinLists, this, objects, mapArchObject, exitTypeGameObjectMatcher, archetypeChooserControl, mapActions); + mapModel = new DefaultMapModel<G, A, R>(parent, autojoinLists, this, objects, mapArchObject, exitTypeGameObjectMatcher, archetypeChooserControl, mapActions); mapModel.addMapModelListener(mapModelListener); } @@ -414,7 +423,7 @@ mapImageCache.updateCaches(file, this, MapImageCache.ImageType.ICON); } catch (final IOException e) { - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "encodeMapFile", file, e.getMessage()); + ACTION_FACTORY.showMessageDialog(parent, "encodeMapFile", file, e.getMessage()); return false; } return true; Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-07-31 22:50:50 UTC (rev 4648) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-07-31 23:09:40 UTC (rev 4649) @@ -19,6 +19,7 @@ package net.sf.gridarta.map; +import java.awt.Component; import java.awt.Point; import java.util.HashSet; import java.util.Iterator; @@ -28,7 +29,6 @@ import javax.swing.event.EventListenerList; import net.sf.gridarta.AutojoinList; import net.sf.gridarta.AutojoinLists; -import net.sf.gridarta.MainControl; import net.sf.gridarta.MapActions; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; @@ -79,14 +79,10 @@ private final A mapArchObject; /** - * The CMainControl used for various operations. - * @deprecated it's not a good idea to require the MapModel implementation - * to know such a heavy-weight strongly UI-related glue class - * like {@link MainControl}. + * The parent component for error messages. */ - @Deprecated @NotNull - private final transient MainControl<G, A, R, ?> mainControl; + private final Component parent; @NotNull private final AutojoinLists<G, A, R> autojoinLists; @@ -150,7 +146,7 @@ /** * Create an DefaultMapModel. - * @param mainControl main controller + * @param parent the parent component for error messages * @param autojoinLists the autojoin lists instance to use * @param mapControl MapControl to associate with this model. * @param objects the <code>GameObject</code> list of this map or @@ -160,10 +156,10 @@ * @param archetypeChooserControl the archetype chooser control * @param mapActions the map actions to use */ - public DefaultMapModel(@NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapControl<G, A, R, ?> mapControl, @Nullable final List<G> objects, @NotNull final A mapArchObject, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, ?> archetypeChooserControl, @NotNull final MapActions mapActions) { + public DefaultMapModel(@NotNull final Component parent, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull final MapControl<G, A, R, ?> mapControl, @Nullable final List<G> objects, @NotNull final A mapArchObject, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, ?> archetypeChooserControl, @NotNull final MapActions mapActions) { this.mapControl = mapControl; this.mapArchObject = mapArchObject; - this.mainControl = mainControl; + this.parent = parent; this.autojoinLists = autojoinLists; this.archetypeChooserControl = archetypeChooserControl; this.exitTypeGameObjectMatcher = exitTypeGameObjectMatcher; @@ -814,7 +810,7 @@ // TODO: // Think about how this could be handled via an exception and caught much earlier, perhaps already while reading the map, not after it // already has been read. - ACTION_FACTORY.showMessageDialog(mainControl.getMainView(), "mapErrorArchOutOfGrid"); + ACTION_FACTORY.showMessageDialog(parent, "mapErrorArchOutOfGrid"); return; } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-31 22:50:50 UTC (rev 4648) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-31 23:09:40 UTC (rev 4649) @@ -19,6 +19,7 @@ package test.net.sf.gridarta.map; +import java.awt.Component; import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; @@ -28,6 +29,7 @@ import java.util.TreeSet; import javax.swing.ImageIcon; import javax.swing.JList; +import javax.swing.JPanel; import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.DefaultMapManager; @@ -389,7 +391,7 @@ final MapActions mapActions = new TestMapActions(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(); final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, mainControl, autojoinLists, mapImageCache, null, mapArchObject, false, null, archetypeChooserControl, mapActions); - mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(mainControl, autojoinLists, mapControl, null, mapArchObject, null, archetypeChooserControl, mapActions); + mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(new JPanel(), autojoinLists, mapControl, null, mapArchObject, null, archetypeChooserControl, mapActions); result.setLength(0); mapModel.addMapModelListener(mapModelListener); @@ -512,7 +514,7 @@ * @param mapActions the map actions to use */ public TestMapControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl, @NotNull final MapActions mapActions) { - super(gridartaObjectsFactory, mainControl, autojoinLists, mapImageCache, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl, mapActions); + super(gridartaObjectsFactory, mainControl, new JPanel(), autojoinLists, mapImageCache, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl, mapActions); } } @@ -878,13 +880,13 @@ /** {@inheritDoc} */ @NotNull - public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject) { + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent) { throw new AssertionError(); } /** {@inheritDoc} */ @NotNull - public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject) { + public MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newPickmapControl(@Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, @NotNull final Component parent) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 19:53:17
|
Revision: 4650 http://gridarta.svn.sourceforge.net/gridarta/?rev=4650&view=rev Author: akirschbaum Date: 2008-08-01 19:53:02 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove MainControl.getGlobalSettings(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java trunk/crossfire/src/cfeditor/MapActions.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/GlobalSettingsImpl.java trunk/daimonin/src/daieditor/MapActions.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/gui/map/MapTilePane.java trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/GlobalSettings.java trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptUtils.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -26,6 +26,7 @@ import cfeditor.gameobject.GameObject; import cfeditor.gameobject.anim.AnimationObject; import cfeditor.gameobject.face.FaceObjects; +import cfeditor.gameobject.scripts.ScriptArchEditor; import cfeditor.gameobject.scripts.ScriptArchUtils; import cfeditor.gameobject.scripts.ScriptedEvent; import cfeditor.gui.GameObjectAttributesPanel; @@ -63,6 +64,7 @@ import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; +import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.DefaultObjectChooser; import net.sf.gridarta.gui.HideFileFilterProxy; @@ -183,8 +185,6 @@ /** The current script controller. */ private final ScriptController scriptControl; - private final GlobalSettingsImpl globalSettings = new GlobalSettingsImpl(); - /** The list of archtype-data (loaded from "types.xml"). */ private final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet; @@ -223,11 +223,13 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new CrossfireObjectsFactory(), "cfeditor"); + super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl()); CMainControlInstance.instance = this; globalSettings.readGlobalSettings(); + ScriptArchEditor.setGlobalSettings(globalSettings); + ScriptedEventEditor.setGlobalSettings(globalSettings); animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); - archetypeSet = new ArchetypeSet(this, editTypes, animationObjects, faceObjects, globalSettings.getImageSet()); + archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet()); GameObject.setArchetypeSet(archetypeSet); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); @@ -293,7 +295,7 @@ log.fatal("GameObjectMatcher 'exit' does not exist"); throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } - final MapActions mapActions = new MapActions(mainView, this, mapManager, exitMatcher, mapFileFilter, selectedSquareView); + final MapActions mapActions = new MapActions(mainView, this, globalSettings, mapManager, exitMatcher, mapFileFilter, selectedSquareView); archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); Map<String, TreasureTreeNode> specialTreasureLists; try { @@ -319,7 +321,7 @@ log.error("Cannot read " + CommonConstants.TYPEDEF_FILE + ": " + ex.getMessage()); } - AbstractScriptArchEditor.initEventTypeBoxes(".py", "Python", ScriptArchUtils.createEventTypeBox(), pythonFileFilter); + AbstractScriptArchEditor.initEventTypeBoxes(".py", "Python", ScriptArchUtils.createEventTypeBox(), pythonFileFilter, globalSettings); // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, 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); @@ -474,11 +476,6 @@ /** Swing FileFilter for Python scripts. */ public static final FileFilter pythonFileFilter = new HideFileFilterProxy(new EndingFileFilter(true, ACTION_FACTORY.getString("fileDialog.filter.python"), ".py")); - /** {@inheritDoc} */ - public GlobalSettingsImpl getGlobalSettings() { - return globalSettings; - } - /** * Returns the main view. * @return the main view @@ -653,7 +650,7 @@ if (prefsGroup == null) { prefsGroup = new PreferencesGroup( "Gridarta for Crossfire", - new ResPrefs(this), + new ResPrefs((GlobalSettingsImpl) globalSettings), new GUIPrefs(), new MiscPrefs(), new UpdatePrefs(), Modified: trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java =================================================================== --- trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/crossfire/src/cfeditor/GlobalSettingsImpl.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -51,15 +51,17 @@ return imageSet; } + /** {@inheritDoc} */ public boolean isAutoPopupDocu() { return autoPopupDocu; } + /** {@inheritDoc} */ public void setAutoPopupDocu(final boolean autoPopupDocu) { this.autoPopupDocu = autoPopupDocu; } - /** Set all global settings from the preferences. */ + /** {@inheritDoc} */ public void readGlobalSettings() { imageSet = prefs.get(USE_IMAGESET, "base"); if (imageSet.equalsIgnoreCase("none")) { Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -36,6 +36,7 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.CurrentMapListener; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.match.GameObjectMatcher; @@ -110,6 +111,10 @@ /** The main control to use. */ private final CMainControl mainControl; + /** The global settings instance. */ + @NotNull + private final GlobalSettings globalSettings; + /** The map manager. */ private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; @@ -132,14 +137,16 @@ * Create a new instance. * @param parent the component for showing dialog boxes * @param mainControl the main control to use + * @param globalSettings the global settings instance * @param mapManager the map manager * @param exitMatcher the game object matcher selecting exit objects * @param mapFileFilter the Swing file filter to use * @param selectedSquareView the selected square vuew to use */ - public MapActions(@NotNull final Component parent, final CMainControl mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public MapActions(@NotNull final Component parent, final CMainControl mainControl, @NotNull final GlobalSettings globalSettings,final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { this.parent = parent; this.mainControl = mainControl; + this.globalSettings = globalSettings; this.mapManager = mapManager; this.exitMatcher = exitMatcher; this.mapFileFilter = mapFileFilter; @@ -235,7 +242,7 @@ public void mapProperties() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); if (mapView != null) { - MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, mapView.getMapControl(), mapFileFilter); + MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, globalSettings, mapView.getMapControl(), mapFileFilter); } } @@ -366,11 +373,11 @@ ACTION_FACTORY.showMessageDialog(parent, "enterExitRandomDestination"); return; } - newfile = new File(mainControl.getGlobalSettings().getMapDir().getAbsolutePath(), destinationMap); + newfile = new File(globalSettings.getMapDir().getAbsolutePath(), destinationMap); } else if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { // we have an absolute path: - newfile = new File(mainControl.getGlobalSettings().getMapDir().getAbsolutePath(), path.substring(1)); + newfile = new File(globalSettings.getMapDir().getAbsolutePath(), path.substring(1)); } else { // we have a relative path: if (currentMap.getMapFile() == null) { Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -38,6 +38,7 @@ import java.util.List; import javax.swing.ImageIcon; import net.sf.gridarta.EditTypes; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.AbstractArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -70,6 +71,12 @@ private final CMainControl mainControl; + /** + * The global settings instance. + */ + @NotNull + private final GlobalSettings globalSettings; + private final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes; @NotNull @@ -88,14 +95,16 @@ /** * Create the ArchetypeSet. * @param mainControl reference to CMainControl + * @param globalSettings the global settigns instance * @param editTypes the edit types instance * @param animationObjects the animations to use * @param faceObjects the FaceObjects instance to use * @param imageSet the image set to use */ - public ArchetypeSet(final CMainControl mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @Nullable final String imageSet) { + public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @Nullable final String imageSet) { super(mainControl.getGridartaObjectsFactory()); this.mainControl = mainControl; + this.globalSettings = globalSettings; this.editTypes = editTypes; this.animationObjects = animationObjects; this.faceObjects = faceObjects; @@ -127,13 +136,13 @@ final List<GameObject> invObjects = new ArrayList<GameObject>(); final String fname; // here we go... - if (mainControl.getGlobalSettings().isArchLoadedFromCollection()) { + if (globalSettings.isArchLoadedFromCollection()) { loadArchFromCollected(archetypeParser, invObjects); // load arches & images from collection fname = IGUIConstants.ARCH_FILE; } else { FaceObjectProviders.setNormal(new ArchFaceProvider()); setLoadedFromArchive(false); // don't load from the collected files - fname = mainControl.getGlobalSettings().getArchDefaultFolder(); + fname = globalSettings.getArchDefaultFolder(); loadArchetypesFromFiles(archetypeParser, new File(fname), "/", 0, "default", "default", invObjects); // load arches & images from individual files } reportErrors(mainControl.getMainView()); Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -25,11 +25,14 @@ import javax.swing.JDialog; import javax.swing.JOptionPane; import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ScriptArchEditor extends AbstractScriptArchEditor { @@ -39,6 +42,16 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + /** + * The global settings instance. + */ + @Nullable + private static GlobalSettings globalSettings = null; + + public static void setGlobalSettings(@NotNull final GlobalSettings globalSettings) { + ScriptArchEditor.globalSettings = globalSettings; + } + public static boolean createNewEvent(final JDialog frame, final ScriptArchData scriptArchData) { String scriptPath = inputScriptPath.getText().trim(); final String options = inputOptions.getText().trim(); @@ -64,7 +77,7 @@ String absScriptPath; if (scriptPath.startsWith("/")) { // script path is absolute - final File mapDir = new File(AbstractMainControl.getInstance().getGlobalSettings().getMapDefaultFolder()); // global map directory + final File mapDir = new File(globalSettings.getMapDefaultFolder()); // global map directory if (!mapDir.exists()) { // if map dir doesn't exist, this is not going to work frame.setVisible(false); Modified: trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -40,10 +40,12 @@ import javax.swing.JTextField; import javax.swing.border.EmptyBorder; import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.Size2D; import net.sf.gridarta.help.Help; import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; /** * A dialog to change the properties of a map, like several flags and settings @@ -167,10 +169,11 @@ /** * Creates a map-options dialog. * @param mainControl The controller of this dialog. + * @param globalSettings the global settings instance * @param mapControl The level whose properties are shown/edited. * @param mapFileFilter the Swing file filter to use */ - private MapPropertiesDialog(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + private MapPropertiesDialog(final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { okButton.setDefaultCapable(true); setOptions(new Object[] {helpButton, okButton, restoreButton, cancelButton}); @@ -214,7 +217,7 @@ final JPanel weatherPanel = createWeatherPanel(map); tabs.add(ACTION_FACTORY.getString("mapWeatherTabTitle"), weatherPanel); - mapTilePane = new MapTilePane(mainControl, mapControl, mapFileFilter); + mapTilePane = new MapTilePane(mainControl, globalSettings, mapControl, mapFileFilter); final JPanel tilePanel = createTilePathPanel(mapTilePane); tabs.add(ACTION_FACTORY.getString("mapTilesTabTitle"), tilePanel); @@ -624,11 +627,12 @@ * Show a dialog querying the user for map properties. * @param parent the parent component to show dialog on * @param mainControl CMainControl with information + * @param globalSettings the global settings instance * @param level map to show dialog about * @param mapFileFilter the Swing file filter to use */ - public static void showDialog(final Component parent, final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(mainControl, level, mapFileFilter); + public static void showDialog(final Component parent, final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { + final MapPropertiesDialog pane = new MapPropertiesDialog(mainControl, globalSettings, level, mapFileFilter); final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); pane.dialog = dialog; dialog.getRootPane().setDefaultButton(pane.okButton); Modified: trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -24,9 +24,11 @@ import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.gui.DirectionLayout; import net.sf.gridarta.gui.map.AbstractMapTilePane; import net.sf.gridarta.map.MapControl; +import org.jetbrains.annotations.NotNull; /** * A Panel for managing the tiling of maps. Implementation for 4 tile paths. @@ -56,12 +58,13 @@ * Create a MapTilePane. * @param mainControl CMainControl to use for displaying dialogs, getting * paths etc.. + * @param globalSettings the global settings instance * @param mapControl MapControl of the map that's tiles are to be viewed / * controlled * @param mapFileFilter the Swing file filter to use */ - public MapTilePane(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { - super(mainControl, mapControl, tileLink, directionMapping, nextFocus, mapFileFilter); + public MapTilePane(final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + super(mainControl, globalSettings, mapControl, tileLink, directionMapping, nextFocus, mapFileFilter); } } // class MapTilePane Modified: trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/crossfire/src/cfeditor/gui/prefs/ResPrefs.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -19,7 +19,7 @@ package cfeditor.gui.prefs; -import cfeditor.CMainControl; +import cfeditor.GlobalSettingsImpl; import cfeditor.ResourceFileManager; import java.awt.Component; import java.awt.Container; @@ -58,8 +58,8 @@ /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - /** Main Control. */ - private final CMainControl mainControl; + /** The global settings instance to use. */ + private final GlobalSettingsImpl globalSettings; /** TextField for arch directory path. */ private JFileField archField; @@ -81,12 +81,12 @@ /** * Create a ResPrefs pane. - * @param mainControl The controller of this dialog. + * @param globalSettings the global settings instance to use */ - public ResPrefs(final CMainControl mainControl) { + public ResPrefs(final GlobalSettingsImpl globalSettings) { setListLabelText(ACTION_FACTORY.getString("prefsRes.title")); setListLabelIcon(ACTION_FACTORY.getIcon("prefsRes.icon")); - this.mainControl = mainControl; + this.globalSettings = globalSettings; add(createResourcePanel()); add(createGlobalPanel()); @@ -112,16 +112,16 @@ final String imageSet = (String) imageSetBox.getSelectedItem(); prefs.put(GlobalSettings.USE_IMAGESET, imageSet == null || imageSet.equals("disabled") ? "none" : imageSet); - mainControl.getGlobalSettings().readGlobalSettings(); + globalSettings.readGlobalSettings(); ACTION_FACTORY.showOnetimeMessageDialog(this, JOptionPane.WARNING_MESSAGE, "optionsRestart"); } /** {@inheritDoc} */ public void revert() { - archField.setText(mainControl.getGlobalSettings().getArchDefaultFolder()); - mapField.setText(mainControl.getGlobalSettings().getMapDefaultFolder()); - scriptField.setText(mainControl.getGlobalSettings().getScriptDefaultFolder()); - loadArches.setSelected(mainControl.getGlobalSettings().isArchLoadedFromCollection()); + archField.setText(globalSettings.getArchDefaultFolder()); + mapField.setText(globalSettings.getMapDefaultFolder()); + scriptField.setText(globalSettings.getScriptDefaultFolder()); + loadArches.setSelected(globalSettings.isArchLoadedFromCollection()); imageSetBox.setSelectedIndex(linearSearch(imageSets, getCurrentImageSet())); } @@ -139,10 +139,10 @@ final String selectedimageSet = (String) imageSetBox.getSelectedItem(); final String imageSet = selectedimageSet == null ? "disabled" : selectedimageSet; return !( - archField.getText().equals(mainControl.getGlobalSettings().getArchDefaultFolder()) - && mapField.getText().equals(mainControl.getGlobalSettings().getMapDefaultFolder()) - && scriptField.getText().equals(mainControl.getGlobalSettings().getScriptDefaultFolder()) - && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, mainControl.getGlobalSettings().isArchLoadedFromCollection()) + archField.getText().equals(globalSettings.getArchDefaultFolder()) + && mapField.getText().equals(globalSettings.getMapDefaultFolder()) + && scriptField.getText().equals(globalSettings.getScriptDefaultFolder()) + && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, globalSettings.isArchLoadedFromCollection()) && imageSet.equals(getCurrentImageSet()) ); } @@ -170,9 +170,9 @@ private Component createResourcePanel() { final Box resourcePanel = Box.createVerticalBox(); resourcePanel.setBorder(createTitledBorder("optionsResPaths")); - archField = createFileField(resourcePanel, "optionsResArch", mainControl.getGlobalSettings().getArchDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); - mapField = createFileField(resourcePanel, "optionsResMaps", mainControl.getGlobalSettings().getMapDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); - scriptField = createFileField(resourcePanel, "optionsResScripts", mainControl.getGlobalSettings().getScriptDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + archField = createFileField(resourcePanel, "optionsResArch", globalSettings.getArchDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + mapField = createFileField(resourcePanel, "optionsResMaps", globalSettings.getMapDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + scriptField = createFileField(resourcePanel, "optionsResScripts", globalSettings.getScriptDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); return resourcePanel; } @@ -185,9 +185,9 @@ globalPanel.setBorder(createTitledBorder("optionsGlobal")); loadArches = new JCheckBox(ACTION_FACTORY.createToggle(false, "optionsLoadArchColl", this)); - loadArches.setSelected(mainControl.getGlobalSettings().isArchLoadedFromCollection()); + loadArches.setSelected(globalSettings.isArchLoadedFromCollection()); globalPanel.add(loadArches); - if (mainControl.getGlobalSettings().isArchLoadedFromCollection()) { + if (globalSettings.isArchLoadedFromCollection()) { archField.setEnabled(false); } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -25,6 +25,7 @@ import daieditor.gameobject.GameObject; import daieditor.gameobject.anim.AnimationObject; import daieditor.gameobject.face.FaceObjects; +import daieditor.gameobject.scripts.ScriptArchEditor; import daieditor.gameobject.scripts.ScriptArchUtils; import daieditor.gameobject.scripts.ScriptedEvent; import daieditor.gui.GameObjectAttributesPanel; @@ -70,6 +71,7 @@ import net.sf.gridarta.gameobject.match.MutableOrGameObjectMatcher; import net.sf.gridarta.gameobject.match.ViewGameObjectMatcherManager; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; +import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.DefaultObjectChooser; import net.sf.gridarta.gui.GUIUtils; @@ -223,8 +225,6 @@ /** Whether to display double arches like stacked walls in stacked version. */ private boolean drawDouble; - private final GlobalSettingsImpl globalSettings = new GlobalSettingsImpl(); - /** The list of archtype-data (loaded from "types.xml"). */ private final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet; @@ -278,12 +278,14 @@ * @throws RuntimeException If the controller cannot be initialized. */ public CMainControl() { - super(new DaimoninObjectsFactory(), "daieditor"); + super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl()); CMainControlInstance.instance = this; globalSettings.readGlobalSettings(); + ScriptArchEditor.setGlobalSettings(globalSettings); + ScriptedEventEditor.setGlobalSettings(globalSettings); animationObjects = new daieditor.gameobject.anim.AnimationObjects(); GameObject.setAnimationObjects(animationObjects); - archetypeSet = new ArchetypeSet(this, editTypes, animationObjects, faceObjects); + archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects); GameObject.setArchetypeSet(archetypeSet); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); @@ -354,7 +356,7 @@ log.fatal("GameObjectMatcher 'exit' does not exist"); throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } - final MapActions mapActions = new MapActions(mainView, this, mapManager, exitMatcher, mapFileFilter, selectedSquareView); + final MapActions mapActions = new MapActions(mainView, this, (GlobalSettingsImpl) globalSettings, mapManager, exitMatcher, mapFileFilter, selectedSquareView); Map<String, TreasureTreeNode> specialTreasureLists; try { final Document specialTreasureListsDocument = xmlHelper.getDocumentBuilder().parse(IOUtils.getResourceURLAsString(getConfigurationDirectory(), "TreasureLists.xml")); @@ -380,7 +382,7 @@ log.error("Cannot read " + CommonConstants.TYPEDEF_FILE + ": " + ex.getMessage()); } - AbstractScriptArchEditor.initEventTypeBoxes(".lua", "Lua", ScriptArchUtils.createEventTypeBox(), luaFileFilter); + AbstractScriptArchEditor.initEventTypeBoxes(".lua", "Lua", ScriptArchUtils.createEventTypeBox(), luaFileFilter, globalSettings); // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, 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); @@ -655,11 +657,6 @@ /** Swing FileFilter for all unignored files. */ public static final FileFilter unignoredFilter = new HideFileFilterProxy(new EndingFileFilter(true, ACTION_FACTORY.getString("fileDialog.filter.unignored"), "")); - /** {@inheritDoc} */ - public GlobalSettingsImpl getGlobalSettings() { - return globalSettings; - } - /** * Returns the main view. * @return the main view @@ -837,7 +834,7 @@ if (prefsGroup == null) { prefsGroup = new PreferencesGroup( "Gridarta for Daimonin", - new ResPrefs(this), + new ResPrefs((GlobalSettingsImpl) globalSettings), new AppPrefs(), new NetPrefs(), new GUIPrefs(), Modified: trunk/daimonin/src/daieditor/GlobalSettingsImpl.java =================================================================== --- trunk/daimonin/src/daieditor/GlobalSettingsImpl.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/daimonin/src/daieditor/GlobalSettingsImpl.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -47,15 +47,17 @@ return mediaDir; } + /** {@inheritDoc} */ public boolean isAutoPopupDocu() { return autoPopupDocu; } + /** {@inheritDoc} */ public void setAutoPopupDocu(final boolean autoPopupDocu) { this.autoPopupDocu = autoPopupDocu; } - /** Set all global settings from the preferences. */ + /** {@inheritDoc} */ public void readGlobalSettings() { initDirs(); Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -106,6 +106,10 @@ /** The main control to use. */ private final CMainControl mainControl; + /** The global settings instance. */ + @NotNull + private final GlobalSettingsImpl globalSettings; + /** The map manager. */ private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; @@ -128,14 +132,16 @@ * Create a new instance. * @param parent the component for showing dialog boxes * @param mainControl the main control to use + * @param globalSettings the global settings instance * @param mapManager the map manager * @param exitMatcher the game object matcher selecting exit objects * @param mapFileFilter the Swing file filter to use * @param selectedSquareView the selected square vuew to use */ - public MapActions(@NotNull final Component parent, final CMainControl mainControl, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public MapActions(@NotNull final Component parent, final CMainControl mainControl, @NotNull final GlobalSettingsImpl globalSettings, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { this.parent = parent; this.mainControl = mainControl; + this.globalSettings = globalSettings; this.mapManager = mapManager; this.exitMatcher = exitMatcher; this.mapFileFilter = mapFileFilter; @@ -231,7 +237,7 @@ public void mapProperties() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); if (mapView != null) { - MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, mapView.getMapControl(), mapFileFilter); + MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, globalSettings, mapView.getMapControl(), mapFileFilter); } } @@ -340,7 +346,7 @@ @NotNull final File newfile; // new mapfile to open if (path.startsWith(File.pathSeparator) || path.startsWith("/")) { // we have an absolute path: - newfile = new File(mainControl.getGlobalSettings().getMapDir().getAbsolutePath(), path.substring(1)); + newfile = new File(globalSettings.getMapDir().getAbsolutePath(), path.substring(1)); } else { // we have a relative path: if (currentMap.getMapFile() == null) { Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -39,6 +39,7 @@ import java.util.List; import javax.swing.ImageIcon; import net.sf.gridarta.EditTypes; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.AbstractArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -72,6 +73,12 @@ private final CMainControl mainControl; + /** + * The global settings instance. + */ + @NotNull + private final GlobalSettings globalSettings; + /** The edit types instance. */ @NotNull private final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes; @@ -93,13 +100,15 @@ /** * Create the ArchetypeSet. * @param mainControl reference to CMainControl + * @param globalSettings the global settings instance * @param editTypes the edit types instance * @param animationObjects the animations to use * @param faceObjects the FaceObjects instance to use */ - public ArchetypeSet(final CMainControl mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { + public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { super(mainControl.getGridartaObjectsFactory()); this.mainControl = mainControl; + this.globalSettings = globalSettings; this.editTypes = editTypes; this.animationObjects = animationObjects; this.faceObjects = faceObjects; @@ -159,22 +168,22 @@ final List<GameObject> invObjects = new ArrayList<GameObject>(); final String fname; // here we go... - if (mainControl.getGlobalSettings().isArchLoadedFromCollection()) { + if (globalSettings.isArchLoadedFromCollection()) { loadArchFromCollected(archetypeParser, invObjects); // load arches & images from collection fname = IGUIConstants.ARCH_FILE; } else { FaceObjectProviders.setNormal(new ArchFaceProvider()); setLoadedFromArchive(false); // don't load from the collected files animFiles = new ArrayList<File>(); - addPNGFace(new File(mainControl.getGlobalSettings().getArchDefaultFolder(), "dev/editor/bug.101.png").getAbsolutePath(), "bug.101.png"); - fname = mainControl.getGlobalSettings().getArchDefaultFolder(); + addPNGFace(new File(globalSettings.getArchDefaultFolder(), "dev/editor/bug.101.png").getAbsolutePath(), "bug.101.png"); + fname = globalSettings.getArchDefaultFolder(); loadArchetypesFromFiles(archetypeParser, new File(fname), 0, "default", "default", false, invObjects); // load arches & images from individual files loadAnimsFromFiles(); } reportErrors(mainControl.getMainView()); loadArchesFromArtifacts(archetypeParser, mainControl.getCollectedDirectory() + "/" + IGUIConstants.ARTIFACTS_FILE, "Artifacts", "artifacts", invObjects); - loadArchesFromArtifacts(archetypeParser, mainControl.getGlobalSettings().getMapDefaultFolder(), "Artifacts", "maps", invObjects); + loadArchesFromArtifacts(archetypeParser, globalSettings.getMapDefaultFolder(), "Artifacts", "maps", invObjects); mainControl.getGridartaObjectsFactory().newGameObjectParser().collectTempList(mainControl.getMainView(), this, editTypes, invObjects, fname, true); connectFaces(); // attach faces to arches Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -25,11 +25,14 @@ import javax.swing.JDialog; import javax.swing.JOptionPane; import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class ScriptArchEditor extends AbstractScriptArchEditor { @@ -39,6 +42,16 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + /** + * The global settings instance. + */ + @Nullable + private static GlobalSettings globalSettings = null; + + public static void setGlobalSettings(@NotNull final GlobalSettings globalSettings) { + ScriptArchEditor.globalSettings = globalSettings; + } + public static boolean createNewEvent(final JDialog frame, final ScriptArchData scriptArchData) { String scriptPath = inputScriptPath.getText().trim(); final String options = inputOptions.getText().trim(); @@ -64,7 +77,7 @@ String absScriptPath; if (scriptPath.startsWith("/")) { // script path is absolute - final File mapDir = new File(AbstractMainControl.getInstance().getGlobalSettings().getMapDefaultFolder()); // global map directory + final File mapDir = new File(globalSettings.getMapDefaultFolder()); // global map directory if (!mapDir.exists()) { // if map dir doesn't exist, this is not going to work frame.setVisible(false); Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -20,6 +20,7 @@ package daieditor.gui.map; import daieditor.CMainControl; +import daieditor.GlobalSettingsImpl; import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; import daieditor.map.MapArchObject; @@ -56,6 +57,7 @@ import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.misc.JFileChooserButton; +import org.jetbrains.annotations.NotNull; /** * A dialog to change the properties of a map, like several flags and settings @@ -75,6 +77,12 @@ private final CMainControl mainControl; + /** + * The global settings instance. + */ + @NotNull + private final GlobalSettingsImpl globalSettings; + private final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl; private JDialog dialog = null; @@ -147,14 +155,16 @@ /** * Creates a map-options dialog. * @param mainControl The controller of this dialog. + * @param globalSettings the global settings instance * @param mapControl The level whose properties are shown/edited. * @param mapFileFilter the Swing file filter to use */ - private MapPropertiesDialog(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + private MapPropertiesDialog(final CMainControl mainControl, @NotNull final GlobalSettingsImpl globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { okButton.setDefaultCapable(true); setOptions(new Object[] {helpButton, okButton, restoreButton, cancelButton}); this.mainControl = mainControl; + this.globalSettings = globalSettings; this.mapControl = mapControl; final MapArchObject map = mapControl.getMapModel().getMapArchObject(); @@ -164,7 +174,7 @@ final JPanel mainPanel = createMainPanel(map); tabs.add(ACTION_FACTORY.getString("mapMapTabTitle"), mainPanel); - mapTilePane = new MapTilePane(mainControl, mapControl, mapFileFilter); + mapTilePane = new MapTilePane(mainControl, globalSettings, mapControl, mapFileFilter); final JPanel tilePanel = createTilePathPanel(mapTilePane); tabs.add(ACTION_FACTORY.getString("mapTilesTabTitle"), tilePanel); @@ -283,7 +293,7 @@ mapSound.setText(map.getBackgroundMusic()); final JPanel mapSoundPanel = new JPanel(new BorderLayout()); mapSoundPanel.add(mapSound); - mapSoundPanel.add(new JFileChooserButton(new File(mainControl.getGlobalSettings().getMediaDefaultFolder()), mapSound, JFileChooser.FILES_ONLY), BorderLayout.EAST); + mapSoundPanel.add(new JFileChooserButton(new File(globalSettings.getMediaDefaultFolder()), mapSound, JFileChooser.FILES_ONLY), BorderLayout.EAST); mapPanel.add(mapSoundPanel, gbc); mapPanel.add(new JLabel(ACTION_FACTORY.getString("mapWidth")), labelGbc); @@ -548,11 +558,12 @@ * Show a dialog querying the user for map properties. * @param parent the parent component to show dialog on * @param mainControl CMainControl with information + * @param globalSettings the global settings instance * @param level map to show dialog about * @param mapFileFilter the Swing file filter to use */ - public static void showDialog(final Component parent, final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(mainControl, level, mapFileFilter); + public static void showDialog(final Component parent, final CMainControl mainControl, @NotNull final GlobalSettingsImpl globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { + final MapPropertiesDialog pane = new MapPropertiesDialog(mainControl, globalSettings, level, mapFileFilter); final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); pane.dialog = dialog; dialog.getRootPane().setDefaultButton(pane.okButton); Modified: trunk/daimonin/src/daieditor/gui/map/MapTilePane.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapTilePane.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/daimonin/src/daieditor/gui/map/MapTilePane.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -25,9 +25,11 @@ import daieditor.map.MapArchObject; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.CommonConstants; +import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.gui.DirectionLayout; import net.sf.gridarta.gui.map.AbstractMapTilePane; import net.sf.gridarta.map.MapControl; +import org.jetbrains.annotations.NotNull; /** * A Panel for managing the tiling of maps. Implementation for 8 tile paths. @@ -104,12 +106,13 @@ * Create a MapTilePane. * @param mainControl CMainControl to use for displaying dialogs, getting * paths etc.. + * @param globalSettings the global settings instance * @param mapControl MapControl of the map that's tiles are to be viewed / * controlled * @param mapFileFilter the Swing file filter to use */ - public MapTilePane(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { - super(mainControl, mapControl, tileLink, directionMapping, nextFocus, mapFileFilter); + public MapTilePane(final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + super(mainControl, globalSettings, mapControl, tileLink, directionMapping, nextFocus, mapFileFilter); } } // class MapTilePane Modified: trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java =================================================================== --- trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/daimonin/src/daieditor/gui/prefs/ResPrefs.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -19,7 +19,7 @@ package daieditor.gui.prefs; -import daieditor.CMainControl; +import daieditor.GlobalSettingsImpl; import daieditor.ResourceFileManager; import java.awt.Component; import java.awt.Container; @@ -55,8 +55,8 @@ /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - /** Main Control. */ - private final CMainControl mainControl; + /** The global settings instance. */ + private final GlobalSettingsImpl globalSettings; /** TextField for arch directory path. */ private JFileField archField; @@ -75,12 +75,12 @@ /** * Create a ResPrefs pane. - * @param mainControl The controller of this dialog. + * @param globalSettings the global settings instance */ - public ResPrefs(final CMainControl mainControl) { + public ResPrefs(final GlobalSettingsImpl globalSettings) { setListLabelText(ACTION_FACTORY.getString("prefsRes.title")); setListLabelIcon(ACTION_FACTORY.getIcon("prefsRes.icon")); - this.mainControl = mainControl; + this.globalSettings = globalSettings; add(createResourcePanel()); add(createGlobalPanel()); @@ -103,17 +103,17 @@ prefs.put(ResourceFileManager.SCRIPT_DIR_KEY, PathManager.path(scriptField.getText())); prefs.put(ResourceFileManager.MEDIA_DIR_KEY, PathManager.path(mediaField.getText())); prefs.putBoolean(GlobalSettings.LOAD_ARCH_COLL, loadArches.isSelected()); - mainControl.getGlobalSettings().initDirs(); + globalSettings.initDirs(); ACTION_FACTORY.showOnetimeMessageDialog(this, JOptionPane.WARNING_MESSAGE, "optionsRestart"); } /** {@inheritDoc} */ public void revert() { - archField.setText(mainControl.getGlobalSettings().getArchDefaultFolder()); - mapField.setText(mainControl.getGlobalSettings().getMapDefaultFolder()); - scriptField.setText(mainControl.getGlobalSettings().getScriptDefaultFolder()); - mediaField.setText(mainControl.getGlobalSettings().getMediaDefaultFolder()); - loadArches.setSelected(mainControl.getGlobalSettings().isArchLoadedFromCollection()); + archField.setText(globalSettings.getArchDefaultFolder()); + mapField.setText(globalSettings.getMapDefaultFolder()); + scriptField.setText(globalSettings.getScriptDefaultFolder()); + mediaField.setText(globalSettings.getMediaDefaultFolder()); + loadArches.setSelected(globalSettings.isArchLoadedFromCollection()); } /** {@inheritDoc} */ @@ -127,11 +127,11 @@ /** {@inheritDoc} */ public boolean isChanged() { return !( - archField.getText().equals(mainControl.getGlobalSettings().getArchDefaultFolder()) - && mapField.getText().equals(mainControl.getGlobalSettings().getMapDefaultFolder()) - && scriptField.getText().equals(mainControl.getGlobalSettings().getScriptDefaultFolder()) - && mediaField.getText().equals(mainControl.getGlobalSettings().getMediaDefaultFolder()) - && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, mainControl.getGlobalSettings().isArchLoadedFromCollection()) + archField.getText().equals(globalSettings.getArchDefaultFolder()) + && mapField.getText().equals(globalSettings.getMapDefaultFolder()) + && scriptField.getText().equals(globalSettings.getScriptDefaultFolder()) + && mediaField.getText().equals(globalSettings.getMediaDefaultFolder()) + && loadArches.isSelected() == prefs.getBoolean(GlobalSettings.LOAD_ARCH_COLL, globalSettings.isArchLoadedFromCollection()) ); } @@ -158,10 +158,10 @@ private Component createResourcePanel() { final Box resourcePanel = Box.createVerticalBox(); resourcePanel.setBorder(createTitledBorder("optionsResPaths")); - archField = createFileField(resourcePanel, "optionsResArch", mainControl.getGlobalSettings().getArchDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); - mapField = createFileField(resourcePanel, "optionsResMaps", mainControl.getGlobalSettings().getMapDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); - scriptField = createFileField(resourcePanel, "optionsResScripts", mainControl.getGlobalSettings().getScriptDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); - mediaField = createFileField(resourcePanel, "optionsResMedia", mainControl.getGlobalSettings().getMediaDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + archField = createFileField(resourcePanel, "optionsResArch", globalSettings.getArchDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + mapField = createFileField(resourcePanel, "optionsResMaps", globalSettings.getMapDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + scriptField = createFileField(resourcePanel, "optionsResScripts", globalSettings.getScriptDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); + mediaField = createFileField(resourcePanel, "optionsResMedia", globalSettings.getMediaDefaultFolder(), JFileChooser.DIRECTORIES_ONLY); return resourcePanel; } @@ -174,9 +174,9 @@ globalPanel.setBorder(createTitledBorder("optionsGlobal")); loadArches = new JCheckBox(ACTION_FACTORY.createToggle(false, "optionsLoadArchColl", this)); - loadArches.setSelected(mainControl.getGlobalSettings().isArchLoadedFromCollection()); + loadArches.setSelected(globalSettings.isArchLoadedFromCollection()); globalPanel.add(loadArches); - if (mainControl.getGlobalSettings().isArchLoadedFromCollection()) { + if (globalSettings.isArchLoadedFromCollection()) { archField.setEnabled(false); } return globalPanel; Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -76,6 +76,12 @@ /** The edit types instance. */ protected final EditTypes<G, A, R, V> editTypes; + /** + * The global settings instance. + */ + @NotNull + protected final GlobalSettings globalSettings; + /** Buffer managing copy data. */ private final CopyBuffer<G, A, R, V> copyBuffer; @@ -101,8 +107,10 @@ * Creates a new instance. * @param gridartaObjectsFactory the gridarta objects factory * @param key The action factory key + * @param globalSettings the global settings instance */ - protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key) { + protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings) { + this.globalSettings = globalSettings; final DefaultMapManager<G, A, R, V> tmpMapManager = new DefaultMapManager<G, A, R, V>(this, key); editTypes = new EditTypes(tmpMapManager); tmpMapManager.setEditTypes(editTypes); @@ -186,13 +194,13 @@ public File getLocalMapDir() { final MapControl<G, A, R, V> mapControl = mapManager.getCurrentMap(); if (mapControl == null) { - return getGlobalSettings().getMapDir(); + return globalSettings.getMapDir(); } final File mapFile = mapControl.getMapFile(); if (mapFile == null) { ACTION_FACTORY.showMessageDialog(getMainView(), "createNewEventNoMapPath"); - return getGlobalSettings().getMapDir(); + return globalSettings.getMapDir(); } return mapFile.getParentFile(); @@ -208,12 +216,12 @@ /** {@inheritDoc} */ public void createImage(@NotNull final MapView<G, A, R, V> mapView) { - if (getGlobalSettings().getImageDir() == null) { - getGlobalSettings().setImageDir(getGlobalSettings().getMapDir().getAbsolutePath()); + if (globalSettings.getImageDir() == null) { + globalSettings.setImageDir(globalSettings.getMapDir().getAbsolutePath()); } - final File file = new File(getGlobalSettings().getImageDir(), mapView.getMapControl().getMapFileName() + ".png"); - final JFileChooser fileChooser = new JFileChooser(getGlobalSettings().getImageDir()); + final File file = new File(globalSettings.getImageDir(), mapView.getMapControl().getMapFileName() + ".png"); + final JFileChooser fileChooser = new JFileChooser(globalSettings.getImageDir()); fileChooser.setDialogTitle("Save Image As"); fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY); fileChooser.setMultiSelectionEnabled(false); @@ -228,7 +236,7 @@ if (!imageFile.getName().endsWith(".png")) { imageFile = new File(imageFile.getParentFile(), imageFile.getName() + ".png"); } - getGlobalSettings().setImageDir(imageFile.getParentFile().getAbsolutePath()); + globalSettings.setImageDir(imageFile.getParentFile().getAbsolutePath()); if (!imageFile.exists() || ACTION_FACTORY.showConfirmDialog(getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE, "overwriteOtherFile", imageFile) == JOptionPane.YES_OPTION) { try { mapView.getMapViewBasic().getRenderer().printFullImage(imageFile); Modified: trunk/src/app/net/sf/gridarta/GlobalSettings.java =================================================================== --- trunk/src/app/net/sf/gridarta/GlobalSettings.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/src/app/net/sf/gridarta/GlobalSettings.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -63,4 +63,19 @@ void setChangedDir(boolean hasChangedDir); + /** + * Set all global settings from the preferences. + */ + void readGlobalSettings(); + + boolean isAutoPopupDocu(); + + /** {@inheritDoc} */ + void setAutoPopupDocu(boolean autoPopupDocu); + + File getCurrentDir(); + + /** {@inheritDoc} */ + void setCurrentDir(File currentDir); + } // interface GlobalSettings Modified: trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.java =================================================================== --- trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.java 2008-07-31 23:09:40 UTC (rev 4649) +++ trunk/src/app/net/sf/gridarta/GlobalSettingsImpl.java 2008-08-01 19:53:02 UTC (rev 4650) @@ -26,7 +26,7 @@ * Default implementation of {@link GlobalSettings}. * @author Andreas Kirschbaum */ -public class GlobalSettingsImpl implements GlobalSettings { +public abstract class GlobalSettingsImpl implements GlobalSettings { private String archDefaultFolder; @@ -88,10 +88,12 @@ this.scriptDefaultFolder = scriptDefaultFolder; } + /** {@inheritDoc} */ public File getCurrentDir() { return currentDir; } + /** {@inheritDoc} */ public void setCurrentDir(final File currentDir) { ... [truncated message content] |
From: <aki...@us...> - 2008-08-01 20:58:07
|
Revision: 4658 http://gridarta.svn.sourceforge.net/gridarta/?rev=4658&view=rev Author: akirschbaum Date: 2008-08-01 20:57:29 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove call to AbstractMainControl.getInstance(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 20:44:39 UTC (rev 4657) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 20:57:29 UTC (rev 4658) @@ -226,7 +226,7 @@ super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl()); CMainControlInstance.instance = this; globalSettings.readGlobalSettings(); - ScriptArchEditor.setGlobalSettings(globalSettings); + ScriptArchEditor.setGlobalSettings(globalSettings, this); ScriptedEventEditor.setGlobalSettings(globalSettings); animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet()); Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-08-01 20:44:39 UTC (rev 4657) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchEditor.java 2008-08-01 20:57:29 UTC (rev 4658) @@ -19,13 +19,16 @@ package cfeditor.gameobject.scripts; +import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; +import cfeditor.gui.map.CMapViewBasic; +import cfeditor.map.MapArchObject; import java.io.File; import java.io.IOException; import javax.swing.JDialog; import javax.swing.JOptionPane; -import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; @@ -43,13 +46,20 @@ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); /** + * The main control instance. + */ + @Nullable + private static MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; + + /** * The global settings instance. */ @Nullable private static GlobalSettings globalSettings = null; - public static void setGlobalSettings(@NotNull final GlobalSettings globalSettings) { + public static void setGlobalSettings(@NotNull final GlobalSettings globalSettings, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl) { ScriptArchEditor.globalSettings = globalSettings; + ScriptArchEditor.mainControl = mainControl; } public static boolean createNewEvent(final JDialog frame, final ScriptArchData scriptArchData) { @@ -58,7 +68,7 @@ final int eventType = ScriptArchUtils.indexToEventType(eventTypeBox.getSelectedIndex()); final String pluginName = ((String) pluginNameBox.getSelectedItem()).trim(); - final File localMapDir = AbstractMainControl.getInstance().getLocalMapDir(); + final File localMapDir = mainControl.getLocalMapDir(); scriptArchData.setChanged(false); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 20:44:39 UTC (rev 4657) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 20:57:29 UTC (rev 4658) @@ -281,7 +281,7 @@ super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl()); CMainControlInstance.instance = this; globalSettings.readGlobalSettings(); - ScriptArchEditor.setGlobalSettings(globalSettings); + ScriptArchEditor.setGlobalSettings(globalSettings, this); ScriptedEventEditor.setGlobalSettings(globalSettings); animationObjects = new daieditor.gameobject.anim.AnimationObjects(); GameObject.setAnimationObjects(animationObjects); Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-08-01 20:44:39 UTC (rev 4657) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchEditor.java 2008-08-01 20:57:29 UTC (rev 4658) @@ -19,13 +19,16 @@ package daieditor.gameobject.scripts; +import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; +import daieditor.gui.map.CMapViewBasic; +import daieditor.map.MapArchObject; import java.io.File; import java.io.IOException; import javax.swing.JDialog; import javax.swing.JOptionPane; -import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gameobject.scripts.UndefinedEventArchetypeException; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; @@ -48,8 +51,15 @@ @Nullable private static GlobalSettings globalSettings = null; - public static void setGlobalSettings(@NotNull final GlobalSettings globalSettings) { + /** + * The main control instance. + */ + @Nullable + private static MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; + + public static void setGlobalSettings(@NotNull final GlobalSettings globalSettings, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl) { ScriptArchEditor.globalSettings = globalSettings; + ScriptArchEditor.mainControl = mainControl; } public static boolean createNewEvent(final JDialog frame, final ScriptArchData scriptArchData) { @@ -58,7 +68,7 @@ final int eventType = ScriptArchUtils.indexToEventType(eventTypeBox.getSelectedIndex()); final String pluginName = ((String) pluginNameBox.getSelectedItem()).trim(); - final File localMapDir = AbstractMainControl.getInstance().getLocalMapDir(); + final File localMapDir = mainControl.getLocalMapDir(); scriptArchData.setChanged(false); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 21:18:25
|
Revision: 4661 http://gridarta.svn.sourceforge.net/gridarta/?rev=4661&view=rev Author: akirschbaum Date: 2008-08-01 21:18:26 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove calls to AbstractMainControl.getInstance(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 21:00:53 UTC (rev 4660) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 21:18:26 UTC (rev 4661) @@ -325,7 +325,7 @@ // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, 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); - gameObjectAttributesPanel = new GameObjectAttributesPanel(this, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); + gameObjectAttributesPanel = new GameObjectAttributesPanel(this, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); PluginParameterFactory.init(archetypeSet, gameObjectAttributesPanel, objectChooser, mapManager); scriptControl = new ScriptController(this, archetypeSet, mainView); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-08-01 21:00:53 UTC (rev 4660) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-08-01 21:18:26 UTC (rev 4661) @@ -21,6 +21,7 @@ import cfeditor.gameobject.scripts.ScriptArchData; import cfeditor.map.MapArchObject; +import java.awt.Frame; import javax.swing.ImageIcon; import javax.swing.JList; import net.sf.gridarta.gameobject.ArchetypeSet; @@ -256,8 +257,8 @@ /** {@inheritDoc} */ @Override - public void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel) { - AbstractScriptArchEditor.addEventScript(this, scriptArchData); + public void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel, @NotNull final Frame parent) { + AbstractScriptArchEditor.addEventScript(this, scriptArchData, parent); if (!scriptArchData.isEmpty()) { mapanel.setScriptPanelButtonState(true, true, true, true); Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java 2008-08-01 21:00:53 UTC (rev 4660) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java 2008-08-01 21:18:26 UTC (rev 4661) @@ -23,6 +23,7 @@ import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; +import java.awt.Frame; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; @@ -46,8 +47,8 @@ private static final long serialVersionUID = 1L; /* Build Panel */ - public GameObjectAttributesPanel(final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { - super(mainControl, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); + public GameObjectAttributesPanel(final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final Frame parent) { + super(mainControl, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, parent); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 21:00:53 UTC (rev 4660) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 21:18:26 UTC (rev 4661) @@ -386,7 +386,7 @@ // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, 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); - gameObjectAttributesPanel = new GameObjectAttributesPanel(this, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); + gameObjectAttributesPanel = new GameObjectAttributesPanel(this, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-01 21:00:53 UTC (rev 4660) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-01 21:18:26 UTC (rev 4661) @@ -22,6 +22,7 @@ import daieditor.gameobject.anim.AnimationObject; import daieditor.gameobject.scripts.ScriptArchData; import daieditor.map.MapArchObject; +import java.awt.Frame; import javax.swing.ImageIcon; import javax.swing.JList; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -401,8 +402,8 @@ /** {@inheritDoc} */ @Override - public void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel) { - AbstractScriptArchEditor.addEventScript(this, scriptArchData); + public void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel, @NotNull final Frame parent) { + AbstractScriptArchEditor.addEventScript(this, scriptArchData, parent); if (!scriptArchData.isEmpty()) { mapanel.setScriptPanelButtonState(true, true, true, true); Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java 2008-08-01 21:00:53 UTC (rev 4660) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java 2008-08-01 21:18:26 UTC (rev 4661) @@ -23,6 +23,7 @@ import daieditor.gameobject.GameObject; import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; +import java.awt.Frame; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; @@ -46,8 +47,8 @@ private static final long serialVersionUID = 1L; /* Build Panel */ - public GameObjectAttributesPanel(final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { - super(mainControl, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); + public GameObjectAttributesPanel(final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final Frame parent) { + super(mainControl, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, parent); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-08-01 21:00:53 UTC (rev 4660) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-08-01 21:18:26 UTC (rev 4661) @@ -19,6 +19,7 @@ package net.sf.gridarta.gameobject; +import java.awt.Frame; import java.util.HashMap; import java.util.Map; import java.util.regex.Pattern; @@ -1387,8 +1388,9 @@ * @param eventList JList from the MapArchPanel (script tab) which displays * the events * @param mapanel the MapArchPanel + * @param parent the parent frame for the editor */ - public abstract void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<G, A, R, ?> mapanel); + public abstract void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<G, A, R, ?> mapanel, @NotNull final Frame parent); /** {@inheritDoc} */ public int getDirection() { Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java 2008-08-01 21:00:53 UTC (rev 4660) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java 2008-08-01 21:18:26 UTC (rev 4661) @@ -21,6 +21,7 @@ import java.awt.Color; import java.awt.FlowLayout; +import java.awt.Frame; import java.awt.Insets; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; @@ -99,15 +100,16 @@ * @param gameObject GameObject to add event to * @param scriptArchData the <code>ScriptArchData</code> instance to * display + * @param parent the parent frame for the editor */ - public static <G extends GameObject<G, ?, ?>> void addEventScript(final G gameObject, final ScriptArchData<G> scriptArchData) { + public static <G extends GameObject<G, ?, ?>> void addEventScript(final G gameObject, final ScriptArchData<G> scriptArchData, @NotNull final Frame parent) { final String archName = gameObject.getBestName(); // create a reasonable default script name for lazy users :-) final String defScriptName = ScriptUtils.chooseDefaultScriptName(archName, scriptEnding); if (newScriptFrame == null) { // initialize popup frame - newScriptFrame = new JDialog(AbstractMainControl.getInstance().getMainView(), "New Scripted Event", true); + newScriptFrame = new JDialog(parent, "New Scripted Event", true); newScriptFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); final JPanel mainPanel = new JPanel(); @@ -201,7 +203,7 @@ newScriptFrame.getContentPane().add(mainPanel); newScriptFrame.pack(); - newScriptFrame.setLocationRelativeTo(AbstractMainControl.getInstance().getMainView()); + newScriptFrame.setLocationRelativeTo(parent); newScriptFrame.setVisible(true); } else { // just set fields and show Modified: trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-08-01 21:00:53 UTC (rev 4660) +++ trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-08-01 21:18:26 UTC (rev 4661) @@ -22,6 +22,7 @@ import java.awt.BorderLayout; import java.awt.Color; import java.awt.Dimension; +import java.awt.Frame; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.GridLayout; @@ -121,6 +122,12 @@ @NotNull private final AnimationObjects<?> animationObjects; + /** + * The parent frame for dialog boxes. + */ + @NotNull + private final Frame parent; + /** The tabs of this GameObjectAttributesPanel. */ private final JTabbedPane panelDesktop = new JTabbedPane(SwingConstants.TOP); @@ -280,13 +287,15 @@ * @param archetypeTypeSet the archetype type set * @param monsterMatcher the <code>GameObjectMatcher</code> for matching * monster objects + * @param parent the parent frame for dialog boxes */ - protected GameObjectAttributesPanel(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<G, A, R, V> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<G, A, R, V> selectedSquareControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { + protected GameObjectAttributesPanel(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final AnimationObjects<?> animationObjects, final LockedItemsControl<G, A, R, V> lockedItemsControl, @NotNull final GameObjectMatcher monsterMatcher, @NotNull final SelectedSquareControl<G, A, R, V> selectedSquareControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final Frame parent) { super(new BorderLayout()); this.mainControl = mainControl; this.archetypeTypeSet = archetypeTypeSet; this.mapManager = mapManager; this.animationObjects = animationObjects; + this.parent = parent; errorListView = new ErrorListView<G, A, R, V>(mapManager, selectedSquareView); gameObjectTextEditor = new GameObjectTextEditor(); @@ -604,7 +613,7 @@ final MapSquare<G, A, R> mapSquare = selectedGameObject.getHead().getMapSquare(); assert mapSquare != null; mapSquare.getMapModel().beginTransaction("Add event script"); - selectedGameObject.getHead().addEventScript(eventList, this); + selectedGameObject.getHead().addEventScript(eventList, this, parent); mapSquare.getMapModel().endTransaction(); } } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-01 21:00:53 UTC (rev 4660) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-01 21:18:26 UTC (rev 4661) @@ -20,6 +20,7 @@ package test.net.sf.gridarta.map; import java.awt.Component; +import java.awt.Frame; import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; @@ -812,7 +813,7 @@ } /** {@inheritDoc} */ - public void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<TestGameObject, TestMapArchObject, TestArchetype, ?> mapanel) { + public void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<TestGameObject, TestMapArchObject, TestArchetype, ?> mapanel, @NotNull final Frame parent) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 21:24:25
|
Revision: 4663 http://gridarta.svn.sourceforge.net/gridarta/?rev=4663&view=rev Author: akirschbaum Date: 2008-08-01 21:24:32 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove calls to AbstractMainControl.getInstance(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 21:20:43 UTC (rev 4662) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 21:24:32 UTC (rev 4663) @@ -321,7 +321,7 @@ log.error("Cannot read " + CommonConstants.TYPEDEF_FILE + ": " + ex.getMessage()); } - AbstractScriptArchEditor.initEventTypeBoxes(".py", "Python", ScriptArchUtils.createEventTypeBox(), pythonFileFilter, globalSettings); + AbstractScriptArchEditor.initEventTypeBoxes(".py", "Python", ScriptArchUtils.createEventTypeBox(), pythonFileFilter, globalSettings, this); // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, 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); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 21:20:43 UTC (rev 4662) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 21:24:32 UTC (rev 4663) @@ -382,7 +382,7 @@ log.error("Cannot read " + CommonConstants.TYPEDEF_FILE + ": " + ex.getMessage()); } - AbstractScriptArchEditor.initEventTypeBoxes(".lua", "Lua", ScriptArchUtils.createEventTypeBox(), luaFileFilter, globalSettings); + AbstractScriptArchEditor.initEventTypeBoxes(".lua", "Lua", ScriptArchUtils.createEventTypeBox(), luaFileFilter, globalSettings, this); // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, 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); Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java 2008-08-01 21:20:43 UTC (rev 4662) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java 2008-08-01 21:24:32 UTC (rev 4663) @@ -38,8 +38,8 @@ import javax.swing.JTextField; import javax.swing.WindowConstants; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.GameObject; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -59,6 +59,9 @@ @NotNull private static GlobalSettings globalSettings; + @NotNull + private static MainControl<?, ?, ?, ?> mainControl; + protected static JComboBox pluginNameBox; // popup frame for new scripts: @@ -83,7 +86,7 @@ * @param eventTypeBox the <code>JComboBox</code> containing all event * types */ - public static synchronized void initEventTypeBoxes(final String scriptEnding, final String name, final JComboBox eventTypeBox, @NotNull final FileFilter scriptFileFilter, @NotNull final GlobalSettings globalSettings) { + public static synchronized void initEventTypeBoxes(final String scriptEnding, final String name, final JComboBox eventTypeBox, @NotNull final FileFilter scriptFileFilter, @NotNull final GlobalSettings globalSettings, @NotNull final MainControl<?, ?, ?, ?> mainControl) { AbstractScriptArchEditor.scriptEnding = scriptEnding; pluginNameBox = new JComboBox(new String[] {name}); @@ -92,6 +95,7 @@ AbstractScriptArchEditor.eventTypeBox = eventTypeBox; AbstractScriptArchEditor.scriptFileFilter = scriptFileFilter; AbstractScriptArchEditor.globalSettings = globalSettings; + AbstractScriptArchEditor.mainControl = mainControl; } /** @@ -149,7 +153,7 @@ browseb.setMargin(new Insets(0, 10, 0, 10)); browseb.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { - final File home = AbstractMainControl.getInstance().getLocalMapDir(); + final File home = mainControl.getLocalMapDir(); final JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Select Script File"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 21:46:32
|
Revision: 4667 http://gridarta.svn.sourceforge.net/gridarta/?rev=4667&view=rev Author: akirschbaum Date: 2008-08-01 21:46:37 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove calls to AbstractMainControl.getInstance(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptUtils.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-08-01 21:29:18 UTC (rev 4666) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-08-01 21:46:37 UTC (rev 4667) @@ -24,6 +24,7 @@ import java.awt.Frame; import javax.swing.ImageIcon; import javax.swing.JList; +import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gui.GameObjectAttributesPanel; @@ -247,8 +248,8 @@ /** {@inheritDoc} */ @Override - public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel) { - scriptArchData.modifyEventScript(eventType, task, eventList); + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl) { + scriptArchData.modifyEventScript(eventType, task, eventList, mainControl); if (scriptArchData.isEmpty()) { mapanel.setScriptPanelButtonState(true, false, false, false); Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java 2008-08-01 21:29:18 UTC (rev 4666) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java 2008-08-01 21:46:37 UTC (rev 4667) @@ -26,6 +26,7 @@ import javax.swing.JDialog; import javax.swing.JList; import javax.swing.JOptionPane; +import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.GameObjectAttributesPanel; import org.apache.log4j.Logger; @@ -116,8 +117,9 @@ * @param task ID number for task (open script/ edit path/ remove) * @param panelList JList from the MapArchPanel (script tab) which displays * the events + * @param mainControl the main control instance */ - public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList) { + public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MainControl<?, ?, ?, ?> mainControl) { GameObject oldEvent = null; /* Find the event object */ @@ -136,7 +138,7 @@ final ScriptedEvent event = new ScriptedEvent(oldEvent); // now decide what to do: if (task == GameObjectAttributesPanel.SCRIPT_OPEN) { - ScriptedEventEditor.openScript(event.getScriptPath()); + ScriptedEventEditor.openScript(mainControl, event.getScriptPath()); } else if (task == GameObjectAttributesPanel.SCRIPT_EDIT_PATH) { ScriptedEventEditor.editParameters(event); } else if (task == GameObjectAttributesPanel.SCRIPT_REMOVE) { Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-01 21:29:18 UTC (rev 4666) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-01 21:46:37 UTC (rev 4667) @@ -25,6 +25,7 @@ import java.awt.Frame; import javax.swing.ImageIcon; import javax.swing.JList; +import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gui.GameObjectAttributesPanel; @@ -392,8 +393,8 @@ /** {@inheritDoc} */ @Override - public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel) { - scriptArchData.modifyEventScript(eventType, task, eventList); + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl) { + scriptArchData.modifyEventScript(eventType, task, eventList, mainControl); if (scriptArchData.isEmpty()) { mapanel.setScriptPanelButtonState(true, false, false, false); Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java 2008-08-01 21:29:18 UTC (rev 4666) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java 2008-08-01 21:46:37 UTC (rev 4667) @@ -26,6 +26,7 @@ import javax.swing.JDialog; import javax.swing.JList; import javax.swing.JOptionPane; +import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.GameObjectAttributesPanel; import org.apache.log4j.Logger; @@ -117,7 +118,7 @@ * @param panelList JList from the MapArchPanel (script tab) which displays * the events */ - public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList) { + public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MainControl<?, ?, ?, ?> mainControl) { GameObject oldEvent = null; /* Find the event object */ @@ -136,7 +137,7 @@ final ScriptedEvent event = new ScriptedEvent(oldEvent); // now decide what to do: if (task == GameObjectAttributesPanel.SCRIPT_OPEN) { - ScriptedEventEditor.openScript(event.getScriptPath()); + ScriptedEventEditor.openScript(mainControl, event.getScriptPath()); } else if (task == GameObjectAttributesPanel.SCRIPT_EDIT_PATH) { ScriptedEventEditor.editParameters(event); } else if (task == GameObjectAttributesPanel.SCRIPT_REMOVE) { Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-08-01 21:29:18 UTC (rev 4666) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-08-01 21:46:37 UTC (rev 4667) @@ -24,6 +24,7 @@ import java.util.Map; import java.util.regex.Pattern; import javax.swing.JList; +import net.sf.gridarta.MainControl; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.match.GameObjectMatchers; @@ -1378,9 +1379,10 @@ * @param eventList JList from the MapArchPanel (script tab) which displays * the events * @param mapanel the MapArchPanel + * @param mainControl the main control instance * @xxx this method knows things it should never know, it is evil! */ - public abstract void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<G, A, R, ?> mapanel); + public abstract void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<G, A, R, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl); /** * A popup is opened and the user can create a new scripting event which Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java 2008-08-01 21:29:18 UTC (rev 4666) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java 2008-08-01 21:46:37 UTC (rev 4667) @@ -165,7 +165,7 @@ if (fileChooser.showOpenDialog(newScriptFrame) == JFileChooser.APPROVE_OPTION) { // user has selected a file final File f = fileChooser.getSelectedFile(); - inputScriptPath.setText(ScriptUtils.localizeEventPath(f, new File(globalSettings.getMapDefaultFolder()))); + inputScriptPath.setText(ScriptUtils.localizeEventPath(mainControl.getLocalMapDir(), f, new File(globalSettings.getMapDefaultFolder()))); } } }); Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptUtils.java 2008-08-01 21:29:18 UTC (rev 4666) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptUtils.java 2008-08-01 21:46:37 UTC (rev 4667) @@ -21,7 +21,6 @@ import java.io.File; import java.io.IOException; -import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.io.PathManager; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -39,13 +38,12 @@ * This method is called when the user selects a new event to be created. * The path relative to the map dir is calculated, and if reasonable, a * relative path is created (relative to the map the event is on). + * @param localMapDir the base directory * @param f script file * @param mapDir the map directory * @return local event path */ - public static String localizeEventPath(final File f, @NotNull final File mapDir) { - final File localMapDir = AbstractMainControl.getInstance().getLocalMapDir(); - + public static String localizeEventPath(@NotNull final File localMapDir, final File f, @NotNull final File mapDir) { if (!mapDir.exists()) { log.warn("Map directory '" + mapDir.getAbsolutePath() + "' does not exist!"); return f.getName(); Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-08-01 21:29:18 UTC (rev 4666) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-08-01 21:46:37 UTC (rev 4667) @@ -32,6 +32,7 @@ import javax.swing.WindowConstants; import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.MainControl; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; @@ -76,9 +77,10 @@ /** * Opens the script pad to display a script. + * @param mainControl the main control instance * @param scriptPath the script path */ - public static void openScript(final String scriptPath) { + public static void openScript(@NotNull final MainControl<?, ?, ?, ?> mainControl, final String scriptPath) { // trying to get the absolute path to scriptfile: final StringBuilder tmpPath = new StringBuilder(); if (scriptPath.startsWith("/")) { @@ -87,7 +89,7 @@ tmpPath.append(scriptPath); } else { // file path is relative to map dir - final String mapPath = AbstractMainControl.getInstance().getLocalMapDir().getAbsolutePath(); + final String mapPath = mainControl.getLocalMapDir().getAbsolutePath(); tmpPath.append(mapPath); if (!mapPath.endsWith("/")) { tmpPath.append('/'); Modified: trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-08-01 21:29:18 UTC (rev 4666) +++ trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-08-01 21:46:37 UTC (rev 4667) @@ -638,7 +638,7 @@ final MapSquare<G, A, R> mapSquare = selectedGameObject.getMapSquare(); assert mapSquare != null; mapSquare.getMapModel().beginTransaction("Modify event script"); - selectedGameObject.getHead().modifyEventScript(index, task, eventList, this); + selectedGameObject.getHead().modifyEventScript(index, task, eventList, this, mainControl); mapSquare.getMapModel().endTransaction(); } } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-01 21:29:18 UTC (rev 4666) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-01 21:46:37 UTC (rev 4667) @@ -808,7 +808,7 @@ } /** {@inheritDoc} */ - public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<TestGameObject, TestMapArchObject, TestArchetype, ?> mapanel) { + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<TestGameObject, TestMapArchObject, TestArchetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 22:00:06
|
Revision: 4668 http://gridarta.svn.sourceforge.net/gridarta/?rev=4668&view=rev Author: akirschbaum Date: 2008-08-01 22:00:10 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove calls to AbstractMainControl.getInstance(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -248,8 +248,8 @@ /** {@inheritDoc} */ @Override - public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl) { - scriptArchData.modifyEventScript(eventType, task, eventList, mainControl); + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { + scriptArchData.modifyEventScript(eventType, task, eventList, mainControl, parent); if (scriptArchData.isEmpty()) { mapanel.setScriptPanelButtonState(true, false, false, false); Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -21,6 +21,7 @@ import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; +import java.awt.Frame; import java.util.Iterator; import java.util.Vector; import javax.swing.JDialog; @@ -118,8 +119,9 @@ * @param panelList JList from the MapArchPanel (script tab) which displays * the events * @param mainControl the main control instance + * @param parent the parent frame for dialog boxes */ - public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MainControl<?, ?, ?, ?> mainControl) { + public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { GameObject oldEvent = null; /* Find the event object */ @@ -140,7 +142,7 @@ if (task == GameObjectAttributesPanel.SCRIPT_OPEN) { ScriptedEventEditor.openScript(mainControl, event.getScriptPath()); } else if (task == GameObjectAttributesPanel.SCRIPT_EDIT_PATH) { - ScriptedEventEditor.editParameters(event); + ScriptedEventEditor.editParameters(event, parent); } else if (task == GameObjectAttributesPanel.SCRIPT_REMOVE) { // first ask for confirmation if (JOptionPane.showConfirmDialog(panelList, "Are you sure you want to remove this \"" + ScriptArchUtils.typeName(event.getEventType()) + "\" event which is\n" + "linked to the script: '" + event.getScriptPath() + "'?\n" + "(The script file itself is not going to be deleted)", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -393,8 +393,8 @@ /** {@inheritDoc} */ @Override - public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl) { - scriptArchData.modifyEventScript(eventType, task, eventList, mainControl); + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { + scriptArchData.modifyEventScript(eventType, task, eventList, mainControl, parent); if (scriptArchData.isEmpty()) { mapanel.setScriptPanelButtonState(true, false, false, false); Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -21,6 +21,7 @@ import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; +import java.awt.Frame; import java.util.Iterator; import java.util.Vector; import javax.swing.JDialog; @@ -117,8 +118,9 @@ * @param task ID number for task (open script/ edit path/ remove) * @param panelList JList from the MapArchPanel (script tab) which displays * the events + * @param parent the parent frame for dialog boxes */ - public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MainControl<?, ?, ?, ?> mainControl) { + public void modifyEventScript(int eventIndex, final int task, @NotNull final JList panelList, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { GameObject oldEvent = null; /* Find the event object */ @@ -139,7 +141,7 @@ if (task == GameObjectAttributesPanel.SCRIPT_OPEN) { ScriptedEventEditor.openScript(mainControl, event.getScriptPath()); } else if (task == GameObjectAttributesPanel.SCRIPT_EDIT_PATH) { - ScriptedEventEditor.editParameters(event); + ScriptedEventEditor.editParameters(event, parent); } else if (task == GameObjectAttributesPanel.SCRIPT_REMOVE) { // first ask for confirmation if (JOptionPane.showConfirmDialog(panelList, "Are you sure you want to remove this \"" + ScriptArchUtils.typeName(event.getEventType()) + "\" event which is\n" + "linked to the script: '" + event.getScriptPath() + "'?\n" + "(The script file itself is not going to be deleted)", "Confirm", JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION) { Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -1380,9 +1380,10 @@ * the events * @param mapanel the MapArchPanel * @param mainControl the main control instance + * @param parent the parent frame for dialog boxes * @xxx this method knows things it should never know, it is evil! */ - public abstract void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<G, A, R, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl); + public abstract void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<G, A, R, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent); /** * A popup is opened and the user can create a new scripting event which Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -20,6 +20,7 @@ package net.sf.gridarta.gameobject.scripts; import java.awt.FlowLayout; +import java.awt.Frame; import java.io.File; import javax.swing.BorderFactory; import javax.swing.Box; @@ -112,11 +113,12 @@ * Edit path and plugin name for an event. A popup dialog is shown with * input text fields for file path and plugin name. * @param scriptedEvent the event + * @param parent the parent frame for dialog boxes */ - public static void editParameters(final ScriptedEvent<?> scriptedEvent) { + public static void editParameters(final ScriptedEvent<?> scriptedEvent, @NotNull final Frame parent) { if (pathFrame == null) { // initialize popup frame - pathFrame = new JDialog(AbstractMainControl.getInstance().getMainView(), "Edit Parameters", true); + pathFrame = new JDialog(parent, "Edit Parameters", true); pathFrame.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); final JPanel mainPanel = new JPanel(); @@ -166,7 +168,7 @@ pathFrame.getContentPane().add(mainPanel); pathFrame.pack(); - pathFrame.setLocationRelativeTo(AbstractMainControl.getInstance().getMainView()); + pathFrame.setLocationRelativeTo(parent); pathFrame.setVisible(true); } else { // just set fields and show Modified: trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -638,7 +638,7 @@ final MapSquare<G, A, R> mapSquare = selectedGameObject.getMapSquare(); assert mapSquare != null; mapSquare.getMapModel().beginTransaction("Modify event script"); - selectedGameObject.getHead().modifyEventScript(index, task, eventList, this, mainControl); + selectedGameObject.getHead().modifyEventScript(index, task, eventList, this, mainControl, parent); mapSquare.getMapModel().endTransaction(); } } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-01 21:46:37 UTC (rev 4667) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-01 22:00:10 UTC (rev 4668) @@ -808,7 +808,7 @@ } /** {@inheritDoc} */ - public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<TestGameObject, TestMapArchObject, TestArchetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl) { + public void modifyEventScript(final int eventType, final int task, @NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<TestGameObject, TestMapArchObject, TestArchetype, ?> mapanel, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final Frame parent) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 22:03:23
|
Revision: 4669 http://gridarta.svn.sourceforge.net/gridarta/?rev=4669&view=rev Author: akirschbaum Date: 2008-08-01 22:03:30 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove call to AbstractMainControl.getInstance(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java 2008-08-01 22:00:10 UTC (rev 4668) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptArchData.java 2008-08-01 22:03:30 UTC (rev 4669) @@ -140,7 +140,7 @@ final ScriptedEvent event = new ScriptedEvent(oldEvent); // now decide what to do: if (task == GameObjectAttributesPanel.SCRIPT_OPEN) { - ScriptedEventEditor.openScript(mainControl, event.getScriptPath()); + ScriptedEventEditor.openScript(mainControl, event.getScriptPath(), parent); } else if (task == GameObjectAttributesPanel.SCRIPT_EDIT_PATH) { ScriptedEventEditor.editParameters(event, parent); } else if (task == GameObjectAttributesPanel.SCRIPT_REMOVE) { Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java 2008-08-01 22:00:10 UTC (rev 4668) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptArchData.java 2008-08-01 22:03:30 UTC (rev 4669) @@ -139,7 +139,7 @@ final ScriptedEvent event = new ScriptedEvent(oldEvent); // now decide what to do: if (task == GameObjectAttributesPanel.SCRIPT_OPEN) { - ScriptedEventEditor.openScript(mainControl, event.getScriptPath()); + ScriptedEventEditor.openScript(mainControl, event.getScriptPath(), parent); } else if (task == GameObjectAttributesPanel.SCRIPT_EDIT_PATH) { ScriptedEventEditor.editParameters(event, parent); } else if (task == GameObjectAttributesPanel.SCRIPT_REMOVE) { Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-08-01 22:00:10 UTC (rev 4668) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-08-01 22:03:30 UTC (rev 4669) @@ -19,6 +19,7 @@ package net.sf.gridarta.gameobject.scripts; +import java.awt.Component; import java.awt.FlowLayout; import java.awt.Frame; import java.io.File; @@ -31,7 +32,6 @@ import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.WindowConstants; -import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.MainControl; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; @@ -80,8 +80,9 @@ * Opens the script pad to display a script. * @param mainControl the main control instance * @param scriptPath the script path + * @param parent the parent component for dialog boxes */ - public static void openScript(@NotNull final MainControl<?, ?, ?, ?> mainControl, final String scriptPath) { + public static void openScript(@NotNull final MainControl<?, ?, ?, ?> mainControl, final String scriptPath, @NotNull final Component parent) { // trying to get the absolute path to scriptfile: final StringBuilder tmpPath = new StringBuilder(); if (scriptPath.startsWith("/")) { @@ -105,7 +106,7 @@ ScriptEditControlInstance.getInstance().openScriptFile(scriptFile.getAbsolutePath()); } else { // file does not exist! - ACTION_FACTORY.showMessageDialog(AbstractMainControl.getInstance().getMainView(), "openScriptNotFound", path); + ACTION_FACTORY.showMessageDialog(parent, "openScriptNotFound", path); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 22:10:36
|
Revision: 4672 http://gridarta.svn.sourceforge.net/gridarta/?rev=4672&view=rev Author: akirschbaum Date: 2008-08-01 22:10:44 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove CMainControlInstance. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/CMainControlInstance.java trunk/daimonin/src/daieditor/CMainControlInstance.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 22:07:24 UTC (rev 4671) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 22:10:44 UTC (rev 4672) @@ -224,7 +224,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor", new GlobalSettingsImpl()); - CMainControlInstance.instance = this; globalSettings.readGlobalSettings(); ScriptArchEditor.setGlobalSettings(globalSettings, this); ScriptedEventEditor.setGlobalSettings(globalSettings); Deleted: trunk/crossfire/src/cfeditor/CMainControlInstance.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControlInstance.java 2008-08-01 22:07:24 UTC (rev 4671) +++ trunk/crossfire/src/cfeditor/CMainControlInstance.java 2008-08-01 22:10:44 UTC (rev 4672) @@ -1,46 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package cfeditor; - -/** - * Utility class managing the {@link CMainControl} singleton. - * @author Andreas Kirschbaum - */ -public class CMainControlInstance { - - /** - * The singleton instance. - */ - static CMainControl instance = null; - - /** - * Private constructor to prevent instantiation. - */ - private CMainControlInstance() { - } - - public static synchronized CMainControl getInstance() { - if (instance == null) { - instance = new CMainControl(); - } - return instance; - } - -} // class CMainControlInstance Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 22:07:24 UTC (rev 4671) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 22:10:44 UTC (rev 4672) @@ -279,7 +279,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor", new GlobalSettingsImpl()); - CMainControlInstance.instance = this; globalSettings.readGlobalSettings(); ScriptArchEditor.setGlobalSettings(globalSettings, this); ScriptedEventEditor.setGlobalSettings(globalSettings); Deleted: trunk/daimonin/src/daieditor/CMainControlInstance.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControlInstance.java 2008-08-01 22:07:24 UTC (rev 4671) +++ trunk/daimonin/src/daieditor/CMainControlInstance.java 2008-08-01 22:10:44 UTC (rev 4672) @@ -1,46 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package daieditor; - -/** - * Utility class managing the {@link CMainControl} singleton. - * @author Andreas Kirschbaum - */ -public class CMainControlInstance { - - /** - * The singleton instance. - */ - static CMainControl instance = null; - - /** - * Private constructor to prevent instantiation. - */ - private CMainControlInstance() { - } - - public static synchronized CMainControl getInstance() { - if (instance == null) { - instance = new CMainControl(); - } - return instance; - } - -} // class CMainControlInstance This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 22:14:23
|
Revision: 4673 http://gridarta.svn.sourceforge.net/gridarta/?rev=4673&view=rev Author: akirschbaum Date: 2008-08-01 22:14:30 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove calls to MainControl.getGridartaObjectsFactory(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 22:10:44 UTC (rev 4672) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 22:14:30 UTC (rev 4673) @@ -228,7 +228,7 @@ ScriptArchEditor.setGlobalSettings(globalSettings, this); ScriptedEventEditor.setGlobalSettings(globalSettings); animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); - archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet()); + archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); GameObject.setArchetypeSet(archetypeSet); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-08-01 22:10:44 UTC (rev 4672) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-08-01 22:14:30 UTC (rev 4673) @@ -39,6 +39,7 @@ import javax.swing.ImageIcon; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.AbstractArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -100,9 +101,11 @@ * @param animationObjects the animations to use * @param faceObjects the FaceObjects instance to use * @param imageSet the image set to use + * @param gridartaObjectsFactory the gridarta objects factory instance to + * use */ - public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @Nullable final String imageSet) { - super(mainControl.getGridartaObjectsFactory()); + public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @Nullable final String imageSet, @NotNull final GridartaObjectsFactory gridartaObjectsFactory) { + super(gridartaObjectsFactory); this.mainControl = mainControl; this.globalSettings = globalSettings; this.editTypes = editTypes; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 22:10:44 UTC (rev 4672) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 22:14:30 UTC (rev 4673) @@ -284,7 +284,7 @@ ScriptedEventEditor.setGlobalSettings(globalSettings); animationObjects = new daieditor.gameobject.anim.AnimationObjects(); GameObject.setAnimationObjects(animationObjects); - archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects); + archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); GameObject.setArchetypeSet(archetypeSet); ScriptedEvent.setArchetypeSet(archetypeSet); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-08-01 22:10:44 UTC (rev 4672) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-08-01 22:14:30 UTC (rev 4673) @@ -40,6 +40,7 @@ import javax.swing.ImageIcon; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.AbstractArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -104,9 +105,11 @@ * @param editTypes the edit types instance * @param animationObjects the animations to use * @param faceObjects the FaceObjects instance to use + * @param gridartaObjectsFactory the gridarta objects factory instance to + * use */ - public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { - super(mainControl.getGridartaObjectsFactory()); + public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final GridartaObjectsFactory gridartaObjectsFactory) { + super(gridartaObjectsFactory); this.mainControl = mainControl; this.globalSettings = globalSettings; this.editTypes = editTypes; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 22:15:23
|
Revision: 4674 http://gridarta.svn.sourceforge.net/gridarta/?rev=4674&view=rev Author: akirschbaum Date: 2008-08-01 22:15:31 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove calls to MainControl.getGridartaObjectsFactory(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-08-01 22:14:30 UTC (rev 4673) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-08-01 22:15:31 UTC (rev 4674) @@ -150,7 +150,7 @@ } reportErrors(mainControl.getMainView()); - mainControl.getGridartaObjectsFactory().newGameObjectParser().collectTempList(mainControl.getMainView(), this, editTypes, invObjects, fname, true); + gridartaObjectsFactory.newGameObjectParser().collectTempList(mainControl.getMainView(), this, editTypes, invObjects, fname, true); connectFaces(); // attach faces to arches // print message if no arches were found Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-08-01 22:14:30 UTC (rev 4673) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-08-01 22:15:31 UTC (rev 4674) @@ -188,7 +188,7 @@ loadArchesFromArtifacts(archetypeParser, mainControl.getCollectedDirectory() + "/" + IGUIConstants.ARTIFACTS_FILE, "Artifacts", "artifacts", invObjects); loadArchesFromArtifacts(archetypeParser, globalSettings.getMapDefaultFolder(), "Artifacts", "maps", invObjects); - mainControl.getGridartaObjectsFactory().newGameObjectParser().collectTempList(mainControl.getMainView(), this, editTypes, invObjects, fname, true); + gridartaObjectsFactory.newGameObjectParser().collectTempList(mainControl.getMainView(), this, editTypes, invObjects, fname, true); connectFaces(); // attach faces to arches // print message if no arches were found Modified: trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java 2008-08-01 22:14:30 UTC (rev 4673) +++ trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java 2008-08-01 22:15:31 UTC (rev 4674) @@ -57,7 +57,7 @@ /** The objects factory to use. */ @NotNull - private final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory; + protected final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory; /** The load status of this ArchetypeSet. */ private LoadStatus loadStatus = LoadStatus.EMPTY; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 22:20:54
|
Revision: 4676 http://gridarta.svn.sourceforge.net/gridarta/?rev=4676&view=rev Author: akirschbaum Date: 2008-08-01 22:21:01 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove raw types. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-08-01 22:19:50 UTC (rev 4675) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-08-01 22:21:01 UTC (rev 4676) @@ -104,7 +104,7 @@ * @param gridartaObjectsFactory the gridarta objects factory instance to * use */ - public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @Nullable final String imageSet, @NotNull final GridartaObjectsFactory gridartaObjectsFactory) { + public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @Nullable final String imageSet, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { super(gridartaObjectsFactory); this.mainControl = mainControl; this.globalSettings = globalSettings; Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-08-01 22:19:50 UTC (rev 4675) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-08-01 22:21:01 UTC (rev 4676) @@ -108,7 +108,7 @@ * @param gridartaObjectsFactory the gridarta objects factory instance to * use */ - public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final GridartaObjectsFactory gridartaObjectsFactory) { + public ArchetypeSet(@NotNull final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { super(gridartaObjectsFactory); this.mainControl = mainControl; this.globalSettings = globalSettings; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 22:37:07
|
Revision: 4679 http://gridarta.svn.sourceforge.net/gridarta/?rev=4679&view=rev Author: akirschbaum Date: 2008-08-01 22:37:10 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove calls to MainControl.getGridartaObjectsFactory(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/MapActions.java trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/MapActions.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/gui/map/MapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 22:25:29 UTC (rev 4678) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 22:37:10 UTC (rev 4679) @@ -294,7 +294,7 @@ log.fatal("GameObjectMatcher 'exit' does not exist"); throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } - final MapActions mapActions = new MapActions(mainView, this, globalSettings, mapManager, exitMatcher, mapFileFilter, selectedSquareView); + final MapActions mapActions = new MapActions(mainView, this, gridartaObjectsFactory, globalSettings, mapManager, exitMatcher, mapFileFilter, selectedSquareView); archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); Map<String, TreasureTreeNode> specialTreasureLists; try { Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-08-01 22:25:29 UTC (rev 4678) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-08-01 22:37:10 UTC (rev 4679) @@ -37,6 +37,7 @@ import net.sf.gridarta.CommonConstants; import net.sf.gridarta.CurrentMapListener; import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.match.GameObjectMatcher; @@ -111,6 +112,12 @@ /** The main control to use. */ private final CMainControl mainControl; + /** + * The gridarta objects factory instance. + */ + @NotNull + private final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory; + /** The global settings instance. */ @NotNull private final GlobalSettings globalSettings; @@ -137,15 +144,17 @@ * Create a new instance. * @param parent the component for showing dialog boxes * @param mainControl the main control to use + * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance * @param mapManager the map manager * @param exitMatcher the game object matcher selecting exit objects * @param mapFileFilter the Swing file filter to use * @param selectedSquareView the selected square vuew to use */ - public MapActions(@NotNull final Component parent, final CMainControl mainControl, @NotNull final GlobalSettings globalSettings,final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public MapActions(@NotNull final Component parent, final CMainControl mainControl, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings,final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { this.parent = parent; this.mainControl = mainControl; + this.gridartaObjectsFactory = gridartaObjectsFactory; this.globalSettings = globalSettings; this.mapManager = mapManager; this.exitMatcher = exitMatcher; @@ -242,7 +251,7 @@ public void mapProperties() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); if (mapView != null) { - MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, globalSettings, mapView.getMapControl(), mapFileFilter); + MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); } } Modified: trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2008-08-01 22:25:29 UTC (rev 4678) +++ trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2008-08-01 22:37:10 UTC (rev 4679) @@ -41,6 +41,7 @@ import javax.swing.border.EmptyBorder; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.Size2D; import net.sf.gridarta.help.Help; import net.sf.gridarta.map.MapControl; @@ -169,11 +170,12 @@ /** * Creates a map-options dialog. * @param mainControl The controller of this dialog. + * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance * @param mapControl The level whose properties are shown/edited. * @param mapFileFilter the Swing file filter to use */ - private MapPropertiesDialog(final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + private MapPropertiesDialog(final CMainControl mainControl, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { okButton.setDefaultCapable(true); setOptions(new Object[] {helpButton, okButton, restoreButton, cancelButton}); @@ -217,7 +219,7 @@ final JPanel weatherPanel = createWeatherPanel(map); tabs.add(ACTION_FACTORY.getString("mapWeatherTabTitle"), weatherPanel); - mapTilePane = new MapTilePane(mainControl, globalSettings, mapControl, mapFileFilter); + mapTilePane = new MapTilePane(mainControl, gridartaObjectsFactory, globalSettings, mapControl, mapFileFilter); final JPanel tilePanel = createTilePathPanel(mapTilePane); tabs.add(ACTION_FACTORY.getString("mapTilesTabTitle"), tilePanel); @@ -627,12 +629,13 @@ * Show a dialog querying the user for map properties. * @param parent the parent component to show dialog on * @param mainControl CMainControl with information + * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance * @param level map to show dialog about * @param mapFileFilter the Swing file filter to use */ - public static void showDialog(final Component parent, final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(mainControl, globalSettings, level, mapFileFilter); + public static void showDialog(final Component parent, @NotNull final CMainControl mainControl, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { + final MapPropertiesDialog pane = new MapPropertiesDialog(mainControl, gridartaObjectsFactory, globalSettings, level, mapFileFilter); final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); pane.dialog = dialog; dialog.getRootPane().setDefaultButton(pane.okButton); Modified: trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java 2008-08-01 22:25:29 UTC (rev 4678) +++ trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java 2008-08-01 22:37:10 UTC (rev 4679) @@ -25,6 +25,7 @@ import cfeditor.map.MapArchObject; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gui.DirectionLayout; import net.sf.gridarta.gui.map.AbstractMapTilePane; import net.sf.gridarta.map.MapControl; @@ -58,13 +59,14 @@ * Create a MapTilePane. * @param mainControl CMainControl to use for displaying dialogs, getting * paths etc.. + * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance * @param mapControl MapControl of the map that's tiles are to be viewed / * controlled * @param mapFileFilter the Swing file filter to use */ - public MapTilePane(final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { - super(mainControl, globalSettings, mapControl, tileLink, directionMapping, nextFocus, mapFileFilter); + public MapTilePane(final CMainControl mainControl, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?>gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + super(mainControl, gridartaObjectsFactory, globalSettings, mapControl, tileLink, directionMapping, nextFocus, mapFileFilter); } } // class MapTilePane Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 22:25:29 UTC (rev 4678) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 22:37:10 UTC (rev 4679) @@ -355,7 +355,7 @@ log.fatal("GameObjectMatcher 'exit' does not exist"); throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } - final MapActions mapActions = new MapActions(mainView, this, (GlobalSettingsImpl) globalSettings, mapManager, exitMatcher, mapFileFilter, selectedSquareView); + final MapActions mapActions = new MapActions(mainView, this, gridartaObjectsFactory, (GlobalSettingsImpl) globalSettings, mapManager, exitMatcher, mapFileFilter, selectedSquareView); Map<String, TreasureTreeNode> specialTreasureLists; try { final Document specialTreasureListsDocument = xmlHelper.getDocumentBuilder().parse(IOUtils.getResourceURLAsString(getConfigurationDirectory(), "TreasureLists.xml")); Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-08-01 22:25:29 UTC (rev 4678) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-08-01 22:37:10 UTC (rev 4679) @@ -36,6 +36,7 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.CurrentMapListener; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.match.GameObjectMatcher; @@ -106,6 +107,12 @@ /** The main control to use. */ private final CMainControl mainControl; + /** + * The gridarta objects factory instance. + */ + @NotNull + private final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory; + /** The global settings instance. */ @NotNull private final GlobalSettingsImpl globalSettings; @@ -132,15 +139,17 @@ * Create a new instance. * @param parent the component for showing dialog boxes * @param mainControl the main control to use + * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance * @param mapManager the map manager * @param exitMatcher the game object matcher selecting exit objects * @param mapFileFilter the Swing file filter to use * @param selectedSquareView the selected square vuew to use */ - public MapActions(@NotNull final Component parent, final CMainControl mainControl, @NotNull final GlobalSettingsImpl globalSettings, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public MapActions(@NotNull final Component parent, @NotNull final CMainControl mainControl, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettingsImpl globalSettings, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { this.parent = parent; this.mainControl = mainControl; + this.gridartaObjectsFactory = gridartaObjectsFactory; this.globalSettings = globalSettings; this.mapManager = mapManager; this.exitMatcher = exitMatcher; @@ -237,7 +246,7 @@ public void mapProperties() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); if (mapView != null) { - MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, globalSettings, mapView.getMapControl(), mapFileFilter); + MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); } } Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-08-01 22:25:29 UTC (rev 4678) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-08-01 22:37:10 UTC (rev 4679) @@ -51,6 +51,7 @@ import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.help.Help; @@ -155,11 +156,12 @@ /** * Creates a map-options dialog. * @param mainControl The controller of this dialog. + * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance * @param mapControl The level whose properties are shown/edited. * @param mapFileFilter the Swing file filter to use */ - private MapPropertiesDialog(final CMainControl mainControl, @NotNull final GlobalSettingsImpl globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + private MapPropertiesDialog(@NotNull final CMainControl mainControl, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettingsImpl globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { okButton.setDefaultCapable(true); setOptions(new Object[] {helpButton, okButton, restoreButton, cancelButton}); @@ -174,7 +176,7 @@ final JPanel mainPanel = createMainPanel(map); tabs.add(ACTION_FACTORY.getString("mapMapTabTitle"), mainPanel); - mapTilePane = new MapTilePane(mainControl, globalSettings, mapControl, mapFileFilter); + mapTilePane = new MapTilePane(mainControl, gridartaObjectsFactory, globalSettings, mapControl, mapFileFilter); final JPanel tilePanel = createTilePathPanel(mapTilePane); tabs.add(ACTION_FACTORY.getString("mapTilesTabTitle"), tilePanel); @@ -558,12 +560,13 @@ * Show a dialog querying the user for map properties. * @param parent the parent component to show dialog on * @param mainControl CMainControl with information + * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance * @param level map to show dialog about * @param mapFileFilter the Swing file filter to use */ - public static void showDialog(final Component parent, final CMainControl mainControl, @NotNull final GlobalSettingsImpl globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(mainControl, globalSettings, level, mapFileFilter); + public static void showDialog(final Component parent, final CMainControl mainControl, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettingsImpl globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { + final MapPropertiesDialog pane = new MapPropertiesDialog(mainControl, gridartaObjectsFactory, globalSettings, level, mapFileFilter); final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); pane.dialog = dialog; dialog.getRootPane().setDefaultButton(pane.okButton); Modified: trunk/daimonin/src/daieditor/gui/map/MapTilePane.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapTilePane.java 2008-08-01 22:25:29 UTC (rev 4678) +++ trunk/daimonin/src/daieditor/gui/map/MapTilePane.java 2008-08-01 22:37:10 UTC (rev 4679) @@ -26,6 +26,7 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gui.DirectionLayout; import net.sf.gridarta.gui.map.AbstractMapTilePane; import net.sf.gridarta.map.MapControl; @@ -106,13 +107,14 @@ * Create a MapTilePane. * @param mainControl CMainControl to use for displaying dialogs, getting * paths etc.. + * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance * @param mapControl MapControl of the map that's tiles are to be viewed / * controlled * @param mapFileFilter the Swing file filter to use */ - public MapTilePane(final CMainControl mainControl, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { - super(mainControl, globalSettings, mapControl, tileLink, directionMapping, nextFocus, mapFileFilter); + public MapTilePane(final CMainControl mainControl, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + super(mainControl, gridartaObjectsFactory, globalSettings, mapControl, tileLink, directionMapping, nextFocus, mapFileFilter); } } // class MapTilePane Modified: trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java 2008-08-01 22:25:29 UTC (rev 4678) +++ trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java 2008-08-01 22:37:10 UTC (rev 4679) @@ -39,6 +39,7 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.DirectionLayout; @@ -70,6 +71,12 @@ private final MainControl<?, A, ?, ?> mainControl; /** + * The gridarta objects factory instance. + */ + @NotNull + private final GridartaObjectsFactory<?, A, ?, ?> gridartaObjectsFactory; + + /** * The global settings instance. */ @NotNull @@ -124,10 +131,12 @@ * Create an AbstractMapTilePane. * @param mainControl MainControl to use for displaying dialogs, getting * paths etc.. + * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance */ - private AbstractMapTilePane(final MainControl<?, A, ?, ?> mainControl, @NotNull final GlobalSettings globalSettings, final int[][][] tileLink, final DirectionLayout.Direction[] directionMapping, final int[] nextFocus, final FileFilter mapFileFilter) { + private AbstractMapTilePane(final MainControl<?, A, ?, ?> mainControl, @NotNull final GridartaObjectsFactory<?, A, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final int[][][] tileLink, final DirectionLayout.Direction[] directionMapping, final int[] nextFocus, final FileFilter mapFileFilter) { this.mainControl = mainControl; + this.gridartaObjectsFactory = gridartaObjectsFactory; this.globalSettings = globalSettings; this.tileLink = tileLink; this.directionMapping = directionMapping; @@ -141,12 +150,13 @@ * Create an AbstractMapTilePane. * @param mainControl MainControl to use for displaying dialogs, getting * paths etc.. + * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance * @param mapControl MapControl of the map that's tiles are to be viewed / * controlled */ - protected AbstractMapTilePane(final MainControl<?, A, ?, ?> mainControl, @NotNull final GlobalSettings globalSettings, final MapControl<?, A, ?, ?> mapControl, final int[][][] tileLink, final DirectionLayout.Direction[] directionMapping, final int[] nextFocus, final FileFilter mapFileFilter) { - this(mainControl, globalSettings, tileLink, directionMapping, nextFocus, mapFileFilter); + protected AbstractMapTilePane(final MainControl<?, A, ?, ?> mainControl, @NotNull final GridartaObjectsFactory<?, A, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<?, A, ?, ?> mapControl, final int[][][] tileLink, final DirectionLayout.Direction[] directionMapping, final int[] nextFocus, final FileFilter mapFileFilter) { + this(mainControl, gridartaObjectsFactory, globalSettings, tileLink, directionMapping, nextFocus, mapFileFilter); setMapControl(mapControl); } @@ -408,7 +418,7 @@ try { final BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(tileHeader.mapfile), IOUtils.MAP_ENCODING)); try { - mainControl.getGridartaObjectsFactory().newMapArchObjectParser().save(bufferedWriter, (A) tileHeader.mapArchObject); + gridartaObjectsFactory.newMapArchObjectParser().save(bufferedWriter, (A) tileHeader.mapArchObject); final String tail = tileHeader.maptail.toString().trim(); if (tail.length() > 0) { bufferedWriter.write(tail); @@ -545,8 +555,8 @@ final BufferedReader myInput = new BufferedReader(new InputStreamReader(new FileInputStream(file), IOUtils.MAP_ENCODING)); try { // first of all we read the map arch (if that fails we throw an exception) - final A mapArchObject = mainControl.getGridartaObjectsFactory().newMapArchObject(false); - mainControl.getGridartaObjectsFactory().newMapArchObjectParser().load(myInput, mapArchObject); + final A mapArchObject = gridartaObjectsFactory.newMapArchObject(false); + gridartaObjectsFactory.newMapArchObjectParser().load(myInput, mapArchObject); maphead = new TileMapHeader(mapArchObject); // now we store the map arches as tail This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 22:41:26
|
Revision: 4680 http://gridarta.svn.sourceforge.net/gridarta/?rev=4680&view=rev Author: akirschbaum Date: 2008-08-01 22:41:33 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove calls to MainControl.getGridartaObjectsFactory(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 22:37:10 UTC (rev 4679) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 22:41:33 UTC (rev 4680) @@ -239,7 +239,7 @@ final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, false); - newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); + newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 22:37:10 UTC (rev 4679) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 22:41:33 UTC (rev 4680) @@ -297,7 +297,7 @@ final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, true); - newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); + newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java 2008-08-01 22:37:10 UTC (rev 4679) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java 2008-08-01 22:41:33 UTC (rev 4680) @@ -27,12 +27,14 @@ import javax.swing.JPanel; import javax.swing.JTextField; import net.sf.gridarta.CommonConstants; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; /** * Dialog to create a new map file. @@ -58,6 +60,12 @@ /** The controller of this new level dialog view. */ private final MainControl<G, A, R, V> mainControl; + /** + * The gridarta objects factory instance. + */ + @NotNull + private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + /** Desired filename for new map, null if not specified. */ private final String filename; @@ -79,6 +87,7 @@ /** * Creates a "new map" dialog. * @param mainControl the controller of this dialog. + * @param gridartaObjectsFactory the gridarta objects factory instance * @param parentComponent the parent component of this dialog * @param filename desired filename for new map, null if not specified * @param showMapSizeDefault Whether to show the "mapSizeDefault" checkbox. @@ -87,9 +96,10 @@ * @param defaultHeight The default height for new maps. * @param defaultDifficulty The default difficulty for new maps. */ - public NewMapDialog(final MainControl<G, A, R, V> mainControl, final Component parentComponent, final String filename, final boolean showMapSizeDefault, final boolean showMapDifficulty, final int defaultWidth, final int defaultHeight, final int defaultDifficulty) { + public NewMapDialog(final MainControl<G, A, R, V> mainControl, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, final Component parentComponent, final String filename, final boolean showMapSizeDefault, final boolean showMapDifficulty, final int defaultWidth, final int defaultHeight, final int defaultDifficulty) { super(showMapSizeDefault, prefs.getInt(DEFAULT_LEVEL_WIDTH_KEY, defaultWidth), prefs.getInt(DEFAULT_LEVEL_HEIGHT_KEY, defaultHeight)); this.mainControl = mainControl; + this.gridartaObjectsFactory = gridartaObjectsFactory; this.filename = filename; this.showMapDifficulty = showMapDifficulty; this.defaultDifficulty = defaultDifficulty; @@ -125,7 +135,7 @@ @Override protected boolean createNew() { // Create a new level from scratch - final A mapArchObject = mainControl.getGridartaObjectsFactory().newMapArchObject(true); + final A mapArchObject = gridartaObjectsFactory.newMapArchObject(true); if (!setMapSize(mapArchObject)) { return false; Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java 2008-08-01 22:37:10 UTC (rev 4679) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java 2008-08-01 22:41:33 UTC (rev 4680) @@ -19,6 +19,7 @@ package net.sf.gridarta.gui.newmap; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -40,6 +41,12 @@ @NotNull private final MainControl<G, A, R, V> mainControl; + /** + * The gridarta objects factory instance. + */ + @NotNull + private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; + /** The default width for new maps. */ private final int defaultMapWidth; @@ -68,6 +75,7 @@ /** * Creates a new instance. * @param mainControl the main control instance + * @param gridartaObjectsFactory the gridarta objects factory instance * @param defaultMapWidth the default width for new maps * @param defaultMapHeight the default height for new maps * @param defaultMapDifficulty the default difficulty for new maps @@ -76,8 +84,9 @@ * @param defaultPickmapWidth the default width for new pickmaps * @param defaultPickmapHeight the default height for new pickmaps */ - public NewMapDialogFactory(@NotNull final MainControl<G, A, R, V> mainControl, final int defaultMapWidth, final int defaultMapHeight, final int defaultMapDifficulty, final boolean showMapDifficulty, final boolean showMapSizeDefault, final int defaultPickmapWidth, final int defaultPickmapHeight) { + public NewMapDialogFactory(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, final int defaultMapWidth, final int defaultMapHeight, final int defaultMapDifficulty, final boolean showMapDifficulty, final boolean showMapSizeDefault, final int defaultPickmapWidth, final int defaultPickmapHeight) { this.mainControl = mainControl; + this.gridartaObjectsFactory = gridartaObjectsFactory; this.defaultMapWidth = defaultMapWidth; this.defaultMapHeight = defaultMapHeight; this.defaultMapDifficulty = defaultMapDifficulty; @@ -97,7 +106,7 @@ * unknown */ public void showNewMapDialog(final String filename) { - new NewMapDialog<G, A, R, V>(mainControl, mainControl.getMainView(), filename, showMapSizeDefault, showMapDifficulty, defaultMapWidth, defaultMapHeight, defaultMapDifficulty); + new NewMapDialog<G, A, R, V>(mainControl, gridartaObjectsFactory, mainControl.getMainView(), filename, showMapSizeDefault, showMapDifficulty, defaultMapWidth, defaultMapHeight, defaultMapDifficulty); } /** Shows a dialog for creating a new pickmap. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |