From: <aki...@us...> - 2008-08-08 20:03:15
|
Revision: 4806 http://gridarta.svn.sourceforge.net/gridarta/?rev=4806&view=rev Author: akirschbaum Date: 2008-08-08 20:03:10 +0000 (Fri, 08 Aug 2008) Log Message: ----------- Remove MainControl.openAttrDialog(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gui/GameObjectAttributesControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.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-08 19:19:25 UTC (rev 4805) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -235,22 +235,25 @@ final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeSet); - final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, false, archetypeChooserModel); + final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserModel); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); + archetypeChooserControl.init(false, gameObjectAttributesDialogFactory); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); - final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, objectChooser, mapManager, editTypes, mapTileListBottom, null, archetypeSet); + final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, editTypes, mapTileListBottom, null, archetypeSet); final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); - new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, mapManager, selectedSquareControl, selectedSquareView); + new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, gameObjectAttributesDialogFactory, mapManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); GameObject.setArchetypeSet(archetypeSet, SystemIcons.getNofaceTileIcon()); createMapImageCache(CResourceLoader.getHomeFile("thumbnails"), SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, archetypeSet, faceObjects)); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); + gameObjectAttributesDialogFactory.setParent(mainView); new About("cfeditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); updaterManager = new UpdaterManager("cfeditor", this, mapManager, mainView, "CrossfireEditor.jar"); @@ -327,7 +330,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); final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel = new GameObjectAttributesModel<GameObject, MapArchObject, Archetype>(); - gameObjectAttributesControl = new GameObjectAttributesControl(gameObjectAttributesModel, this, objectChooser, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); + gameObjectAttributesControl = new GameObjectAttributesControl(gameObjectAttributesModel, this, gameObjectAttributesDialogFactory, objectChooser, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); PluginParameterFactory.init(archetypeSet, gameObjectAttributesModel, objectChooser, mapManager); final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); final CFilterControl filterControl = new CFilterControl(null, mapManager, defaultNamedFilterList); @@ -383,7 +386,6 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, mainView, archetypeSet, mapManager); } /** @@ -602,11 +604,6 @@ } /** {@inheritDoc} */ - public void openAttrDialog(final GameObject gameObject) { - gameObjectAttributesDialogFactory.showAttribDialog(gameObject); - } - - /** {@inheritDoc} */ public boolean saveLevelAsWanted(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Save Level File As"); Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesControl.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesControl.java 2008-08-08 19:19:25 UTC (rev 4805) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesControl.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -30,6 +30,7 @@ import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.connectionview.LockedItemsControl; +import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributespanel.AnimationTab; import net.sf.gridarta.gui.gameobjectattributespanel.ConnectionsTab; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; @@ -56,8 +57,8 @@ private static final long serialVersionUID = 1L; /* Build Panel */ - public GameObjectAttributesControl(final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @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(gameObjectAttributesModel, mainControl, objectChooser, mapManager, selectedSquareControl); + public GameObjectAttributesControl(final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @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(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, mapManager, selectedSquareControl); addTab(new ArchTab(archetypeTypeSet, gameObjectAttributesModel, gameObjectTextEditor)); addTab(new MsgTextTab<GameObject, MapArchObject, Archetype>(gameObjectAttributesModel)); addTab(new ScriptTab<GameObject, MapArchObject, Archetype>(parent, mainControl, gameObjectAttributesModel)); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-08 19:19:25 UTC (rev 4805) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -298,22 +298,25 @@ final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeSet); - final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, true, archetypeChooserModel); + final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserModel); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, gridartaObjectsFactory, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), mapManager); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, archetypeSet, mapManager); + archetypeChooserControl.init(true, gameObjectAttributesDialogFactory); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); - final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, objectChooser, mapManager, editTypes, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); + final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, gameObjectAttributesDialogFactory, objectChooser, mapManager, 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, mapManager, selectedSquareControl, selectedSquareView); + new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, gameObjectAttributesDialogFactory, mapManager, selectedSquareControl, selectedSquareView); replaceDialogManager.setObjectChooser(objectChooser); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); GameObject.setAnimationObjects(animationObjects, SystemIcons.getNofaceTileIcon()); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, archetypeSet, faceObjects)); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, mapManager, ACTION_FACTORY, mapManagerActions.getCloseAllAction(), statusBar); + gameObjectAttributesDialogFactory.setParent(mainView); new About("daieditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); updaterManager = new UpdaterManager("daieditor", this, mapManager, mainView, "DaimoninEditor.jar"); @@ -393,7 +396,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); final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel = new GameObjectAttributesModel<GameObject, MapArchObject, Archetype>(); - gameObjectAttributesControl = new GameObjectAttributesControl(gameObjectAttributesModel, this, objectChooser, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); + gameObjectAttributesControl = new GameObjectAttributesControl(gameObjectAttributesModel, this, gameObjectAttributesDialogFactory, objectChooser, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserModel, pickmapChooserControl); final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); @@ -461,7 +464,6 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, mainView, archetypeSet, mapManager); } /** @@ -787,11 +789,6 @@ } /** {@inheritDoc} */ - public void openAttrDialog(final GameObject gameObject) { - gameObjectAttributesDialogFactory.showAttribDialog(gameObject); - } - - /** {@inheritDoc} */ public boolean saveLevelAsWanted(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl) { final JFileChooser fileChooser = new JFileChooser(); fileChooser.setDialogTitle("Save Map Or Script As"); Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesControl.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesControl.java 2008-08-08 19:19:25 UTC (rev 4805) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesControl.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -30,6 +30,7 @@ import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.connectionview.LockedItemsControl; +import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributespanel.AnimationTab; import net.sf.gridarta.gui.gameobjectattributespanel.ConnectionsTab; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; @@ -56,8 +57,8 @@ private static final long serialVersionUID = 1L; /* Build Panel */ - public GameObjectAttributesControl(@NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype>gameObjectAttributesModel, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @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(gameObjectAttributesModel, mainControl, objectChooser, mapManager, selectedSquareControl); + public GameObjectAttributesControl(@NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype>gameObjectAttributesModel, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @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(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, mapManager, selectedSquareControl); addTab(new ArchTab(archetypeTypeSet, gameObjectAttributesModel, gameObjectTextEditor)); addTab(new MsgTextTab<GameObject, MapArchObject, Archetype>(gameObjectAttributesModel)); addTab(new ScriptTab<GameObject, MapArchObject, Archetype>(parent, mainControl, gameObjectAttributesModel)); Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-08 19:19:25 UTC (rev 4805) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -101,12 +101,6 @@ void doExit(); /** - * Open an attribute dialog window for the specified gameObject. - * @param gameObject GameObject to open attribute dialog window for. - */ - void openAttrDialog(G gameObject); - - /** * Check a map. * @param map the map to check */ Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-08-08 19:19:25 UTC (rev 4805) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -26,9 +26,9 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; @@ -58,20 +58,27 @@ * The archetype chooser's view. */ @NotNull - private final ArchetypeChooserView<G, A, R, V> archetypeChooserView; + private ArchetypeChooserView<G, A, R, V> archetypeChooserView; /** * Creates a new instance. - * @param mainControl The main control. - * @param createDirectionPane Whether to create a "direction" panel. * @param archetypeChooserModel the archetype chooser model to use */ - public ArchetypeChooserControl(@NotNull final MainControl<G, A, R, V> mainControl, final boolean createDirectionPane, @NotNull final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel) { + public ArchetypeChooserControl(@NotNull final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel) { this.archetypeChooserModel = archetypeChooserModel; - archetypeChooserView = new ArchetypeChooserView<G, A, R, V>(createDirectionPane, mainControl, archetypeChooserModel); } /** + * Initializes the instance. + * @param createDirectionPane Whether to create a "direction" panel. + * @param gameObjectAttributesDialogFactory the faceoty for creating game + * object attributes dialog instances + */ + public void init(final boolean createDirectionPane, final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory) { + archetypeChooserView = new ArchetypeChooserView<G, A, R, V>(createDirectionPane, gameObjectAttributesDialogFactory, archetypeChooserModel); + } + + /** * Returns the currently selected archetype. * @return the selected archetype, or <code>null</code> if none is selected */ Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java 2008-08-08 19:19:25 UTC (rev 4805) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -35,6 +35,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; @@ -81,10 +82,10 @@ private final JToggleButton buttonDisplayIconsOnly = new JToggleButton(ACTION_FACTORY.createAction(true, "displayIconsOnly", this)); /** - * The main control. + * The factory for creating game object attributes dialog instances. */ @NotNull - private final MainControl<G, A, R, V> mainControl; + private final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory; /** * The archetype chooser model. @@ -136,12 +137,13 @@ /** * Creates a new instance. * @param createDirectionPane whether the direction pane should be shown - * @param mainControl the main control + * @param gameObjectAttributesDialogFactory the factory for creating game + * object attributes dialog instances * @param archetypeChooserModel the model to use */ - public ArchetypeChooserView(final boolean createDirectionPane, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel) { + public ArchetypeChooserView(final boolean createDirectionPane, @NotNull final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory, @NotNull final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel) { super(new BorderLayout()); - this.mainControl = mainControl; + this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.archetypeChooserModel = archetypeChooserModel; displayModeGameObjectNames = new DisplayNameCellRenderer<R>(archetypeChooserModel.getArchetypeSet()); displayModeArchetypeNames = new ArchetypeNameCellRenderer<R>(archetypeChooserModel.getArchetypeSet()); @@ -187,7 +189,7 @@ } } - final ArchetypePanel<G, A, R, V> newPanel = new ArchetypePanel<G, A, R, V>(this, archetypeChooserModel, mainControl); + final ArchetypePanel<G, A, R, V> newPanel = new ArchetypePanel<G, A, R, V>(this, archetypeChooserModel, gameObjectAttributesDialogFactory); // insert new panel in alphabetical order int i; Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2008-08-08 19:19:25 UTC (rev 4805) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -38,9 +38,9 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import net.sf.gridarta.CommonConstants; -import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; @@ -98,7 +98,7 @@ * The main control. */ @NotNull - private final MainControl<G, A, R, V> mainControl; + private final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory; /** * The comparator for sorting archetypes in the active panel. @@ -122,12 +122,13 @@ * Creates a new instance. * @param archetypeChooserView the associated archetype chooser view * @param archetypeChooserModel the associated archetype chooser model - * @param mainControl the main control + * @param gameObjectAttributesDialogFactory the factory for creating game + * object attributes dialog instances */ - protected ArchetypePanel(@NotNull final ArchetypeChooserView<G, A, R, V> archetypeChooserView, @NotNull final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final MainControl<G, A, R, V> mainControl) { + protected ArchetypePanel(@NotNull final ArchetypeChooserView<G, A, R, V> archetypeChooserView, @NotNull final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory) { super(new BorderLayout()); this.archetypeChooserModel = archetypeChooserModel; - this.mainControl = mainControl; + this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; comboBox = new JComboBox(); listModel = new DefaultListModel(); archList = new JList(listModel); @@ -265,7 +266,7 @@ /** Action method for the popup menu to edit a default arch. */ @ActionMethod public void editPopup() { - mainControl.openAttrDialog((/*XXX*/G) getSelectedArchetype()); + gameObjectAttributesDialogFactory.showAttribDialog((/*XXX*/G) getSelectedArchetype()); } /** Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-08-08 19:19:25 UTC (rev 4805) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -32,6 +32,7 @@ import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; public class GameObjectAttributesDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { @@ -53,8 +54,8 @@ /** * The parent frame for showing dialog boxes. */ - @NotNull - private JFrame parent; + @Nullable + private JFrame parent = null; /** * The archetype set to use. @@ -71,18 +72,24 @@ /** * Creates a new instance. * @param archetypeTypeSet the list of CF type-data - * @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 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 ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R, V> mapManager) { this.archetypeTypeSet = archetypeTypeSet; - this.parent = parent; this.archetypeSet = archetypeSet; this.mapManager = mapManager; } /** + * Sets the parent frame for dialog boxes. + * @param parent the parent frame for dialog boxes + */ + public void setParent(@NotNull final JFrame parent) { + this.parent = parent; + } + + /** * Shows the game object attributes dialog for a given {@link GameObject} * instance. * @param gameObject the GameObject to be displayed by this dialog Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2008-08-08 19:19:25 UTC (rev 4805) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/GameObjectAttributesControl.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -41,6 +41,7 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.GSplitPane; +import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjecttexteditor.GameObjectTextEditor; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; @@ -73,7 +74,7 @@ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); /** The MainControl to use, e.g. for accessing AnimationObjects. */ - private final MainControl<G, A, R, V> mainControl; + private final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory; /** * The game object text editor. @@ -144,7 +145,7 @@ */ private boolean isInMapTransaction = false; - /** The map manager listener which is attached to {@link #mainControl}. */ + /** The map manager listener. */ private final MapManagerListener<G, A, R, V> mapManagerListener = new MapManagerListener<G, A, R, V>() { /** {@inheritDoc} */ @@ -305,16 +306,16 @@ /** * Create the GameObjectAttributesPanel. * @param gameObjectAttributesModel the model to use - * @param mainControl MainControl to use, e.g. for accessing - * AnimationObjects. + * @param gameObjectAttributesDialogFactory the factory for creating game + * object attributes dialog instances * @param objectChooser the object chooser instance * @param mapManager the map manager instance * @param selectedSquareControl the selected square control instance */ - protected GameObjectAttributesControl(@NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final SelectedSquareControl<G, A, R, V> selectedSquareControl) { + protected GameObjectAttributesControl(@NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final SelectedSquareControl<G, A, R, V> selectedSquareControl) { super(new BorderLayout()); this.gameObjectAttributesModel = gameObjectAttributesModel; - this.mainControl = mainControl; + this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.objectChooser = objectChooser; mapArchPanel.setLayout(new BorderLayout()); @@ -396,7 +397,7 @@ @ActionMethod public void mapArchAttrib() { if (selectedGameObject != null) { - mainControl.openAttrDialog(selectedGameObject); + gameObjectAttributesDialogFactory.showAttribDialog(selectedGameObject); } } Modified: trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java 2008-08-08 19:19:25 UTC (rev 4805) +++ trunk/src/app/net/sf/gridarta/gui/map/MapCursorControl.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -24,6 +24,7 @@ import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.map.MapArchObject; @@ -38,8 +39,10 @@ */ public class MapCursorControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { - /** The MainControl. */ - private final MainControl<G, A, R, V> mainControl; + /** + * The factory for creating game object attributes dialog instances. + */ + private final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory; /** The selected square control. */ private final SelectedSquareControl<G, A, R, V> selectedSquareControl; @@ -59,14 +62,15 @@ /** * Create a MapCursorControl. * @param key The action factory key. - * @param mainControl MainControl to use (used for getting the current map - * etc.) + * @param mainControl the main control + * @param gameObjectAttributesDialogFactory the factory for creating game + * object attributes dialog instances * @param mapManager the map manager * @param selectedSquareControl the selected square control * @param selectedSquareView the selected square view */ - public MapCursorControl(final String key, final MainControl<G, A, R, V> mainControl, final MapManager<G, A, R, V> mapManager, @NotNull final SelectedSquareControl<G, A, R, V> selectedSquareControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { - this.mainControl = mainControl; + public MapCursorControl(final String key, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory, final MapManager<G, A, R, V> mapManager, @NotNull final SelectedSquareControl<G, A, R, V> selectedSquareControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { + this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.selectedSquareControl = selectedSquareControl; this.selectedSquareView = selectedSquareView; goLocationDialogManager = new GoLocationDialogManager<G, A, R, V>(mapManager); @@ -129,7 +133,7 @@ public void archAttributes() { final G arch = selectedSquareView.getSelectedGameObject(); if (arch != null) { - mainControl.openAttrDialog(arch); + gameObjectAttributesDialogFactory.showAttribDialog(arch); } } Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-08-08 19:19:25 UTC (rev 4805) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -27,11 +27,11 @@ import javax.swing.ImageIcon; import javax.swing.event.EventListenerList; import net.sf.gridarta.EditTypes; -import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.objectchooser.ObjectChooser; @@ -54,8 +54,10 @@ */ public final class SelectedSquareControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { - /** Controller of this subview. */ - private final MainControl<G, A, R, V> mainControl; + /** + * The factory for creating game object attributes dialog instances. + */ + private final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory; /** * The object chooser. @@ -77,7 +79,7 @@ public void mousePressed(final MouseEvent e) { if (isSelect(e)) { if (e.getClickCount() > 1) { // LMB Double click - mainControl.openAttrDialog(view.getSelectedGameObject()); + gameObjectAttributesDialogFactory.showAttribDialog(view.getSelectedGameObject()); } } else if (isInsert(e)) { insertGameObjectFromObjectChooser(view.getListIndex(e)); @@ -91,7 +93,8 @@ /** * Create a SelectedSquareControl. * @param actionFactory the action factory - * @param mainControl MainControl, used for icons + * @param gameObjectAttributesDialogFactory the factory for creating game + * object attributes dialog instances * @param objectChooser the object chooser * @param mapManager the map manager to use * @param editTypes the edit types instance @@ -101,8 +104,8 @@ * of the list * @param archetypeSet the archetype set to use */ - public SelectedSquareControl(@NotNull final ActionFactory actionFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final EditTypes<G, A, R, V> editTypes, final boolean mapTileListBottom, @Nullable final ImageIcon compassIcon, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { - this.mainControl = mainControl; + public SelectedSquareControl(@NotNull final ActionFactory actionFactory, @NotNull final GameObjectAttributesDialogFactory<G, A, R, V> gameObjectAttributesDialogFactory, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final EditTypes<G, A, R, V> editTypes, final boolean mapTileListBottom, @Nullable final ImageIcon compassIcon, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { + this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.objectChooser = objectChooser; view = new SelectedSquareView<G, A, R, V>(actionFactory, this, mapManager, editTypes, mapTileListBottom, compassIcon, archetypeSet); Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-08 19:19:25 UTC (rev 4805) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-08 20:03:10 UTC (rev 4806) @@ -456,11 +456,6 @@ } /** {@inheritDoc} */ - public void openAttrDialog(final TestGameObject gameObject) { - throw new AssertionError(); - } - - /** {@inheritDoc} */ public void validateMap(final MapModel<TestGameObject, TestMapArchObject, TestArchetype> map) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |