From: <aki...@us...> - 2008-08-15 19:03:36
|
Revision: 4848 http://gridarta.svn.sourceforge.net/gridarta/?rev=4848&view=rev Author: akirschbaum Date: 2008-08-15 19:03:37 +0000 (Fri, 15 Aug 2008) Log Message: ----------- Remove dependency WindowAction -> MainControl. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/gui/map/MapView.java trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -338,7 +338,7 @@ mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); final ArchetypeParser archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); + gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -44,6 +44,7 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; +import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; @@ -82,6 +83,10 @@ @NotNull private MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; + /** The {@link MainView} instance to use. */ + @NotNull + private MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView = null; + /** The {@link EditTypes} instance to use. */ @NotNull private EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes = null; @@ -132,7 +137,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, mainControl.getMainView(), archetypeSet, editTypes, file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, mainView, archetypeSet, editTypes, file); } /** {@inheritDoc} */ @@ -172,14 +177,15 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapControl, viewCounter, new CMapViewBasic(filterControl, editTypes, mapControl, viewPosition, toolPalette, 32, 32, selectedSquareView), ACTION_FACTORY, mapImageCache); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic(filterControl, editTypes, mapControl, viewPosition, toolPalette, 32, 32, selectedSquareView), ACTION_FACTORY, mapImageCache); } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { this.archetypeChooserModel = archetypeChooserModel; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; + this.mainView = mainView; this.editTypes = editTypes; this.mapImageCache = mapImageCache; this.mapActions = mapActions; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -393,7 +393,7 @@ mainView.init(gameObjectAttributesControl, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); + gridartaObjectsFactory.init(faceObjects, archetypeChooserModel, selectedSquareView, this, mainView, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists, toolPalette); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -44,6 +44,7 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchersInstance; +import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; @@ -85,6 +86,10 @@ @NotNull private MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; + /** The {@link MainView} instance to use. */ + @NotNull + private MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView = null; + /** The {@link EditTypes} instance to use. */ @NotNull private EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes = null; @@ -132,7 +137,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, mainControl.getMainView(), archetypeSet, editTypes, file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, mainView, archetypeSet, editTypes, file); } /** {@inheritDoc} */ @@ -174,15 +179,16 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, editTypes, mapControl, viewPosition, faceObjects, toolPalette, IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY, mapImageCache); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainView, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, editTypes, mapControl, viewPosition, faceObjects, toolPalette, IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY, mapImageCache); } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<GameObject, MapArchObject, Archetype> archetypeParser, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { this.faceObjects = faceObjects; this.archetypeChooserModel = archetypeChooserModel; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; + this.mainView = mainView; this.editTypes = editTypes; this.mapImageCache = mapImageCache; this.mapActions = mapActions; Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -29,6 +29,7 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; @@ -140,6 +141,7 @@ * @param archetypeChooserModel the archetype chooser model instance * @param selectedSquareView the selected square view instance * @param mainControl the main control instance + * @param mainView the main view instance * @param editTypes the edit types instance * @param mapImageCache the map image cache instance * @param mapActions the map actions instance @@ -148,6 +150,6 @@ * @param autojoinLists the autojoin lists instance * @param toolPalette the tool palette instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull ToolPalette<G, A, R, V> toolPalette); + void init(@NotNull FaceObjects faceObjects, @NotNull ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull MainView<G, A, R, V> mainView, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull MapActions mapActions, @NotNull ArchetypeParser<G, A, R> archetypeParser, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull final AutojoinLists<G, A, R> autojoinLists, @NotNull ToolPalette<G, A, R, V> toolPalette); } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/gui/map/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -28,10 +28,10 @@ import javax.swing.ImageIcon; import javax.swing.JInternalFrame; import javax.swing.JMenu; -import net.sf.gridarta.MainControl; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.utils.MenuUtils; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.DefaultMapControl; @@ -147,21 +147,21 @@ /** * Create a new instance. - * @param mainControl The main control. + * @param mainView the main view * @param mapControl the controller of this view * @param number Each view of a level will get a number * @param mapViewBasic The underlying mapview object. * @param actionFactory Action Factory to create Actions. * @param mapImageCache the map image cache instance */ - public MapView(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapControl<G, A, R, V> mapControl, final int number, @NotNull final V mapViewBasic, @NotNull final ActionFactory actionFactory, @NotNull final MapImageCache<G, A, R, V> mapImageCache) { + public MapView(@NotNull final MainView<G, A, R, V> mainView, @NotNull final MapControl<G, A, R, V> mapControl, final int number, @NotNull final V mapViewBasic, @NotNull final ActionFactory actionFactory, @NotNull final MapImageCache<G, A, R, V> mapImageCache) { super(PathManager.getMapPath(mapControl.getMapFileName()) + " [ " + mapControl.getMapModel().getMapArchObject().getMapDisplayName() + " ] (" + number + ")" + (mapControl.isModified() ? " *" : ""), true, true, true, true); this.mapControl = mapControl; this.number = number; this.mapViewBasic = mapViewBasic; this.mapImageCache = mapImageCache; mapFileActions = null;//new MapFileActions<G, A, R, C, V>(mainControl, mapControl); // XXX: uncomment this after JAPI can create multiple action sets - windowAction = new WindowAction<G, A, R, V>(mainControl, this); + windowAction = new WindowAction<G, A, R, V>(mainView, this); mapControl.getMapModel().addMapModelListener(mapModelListener); mapControl.addMapControlListener(mapControlListener); getContentPane().setLayout(new BorderLayout()); Modified: trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/src/app/net/sf/gridarta/gui/map/WindowAction.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -22,9 +22,9 @@ import java.awt.event.ActionEvent; import javax.swing.AbstractAction; import javax.swing.KeyStroke; -import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.MainView; import net.sf.gridarta.map.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -37,9 +37,11 @@ /** The serial version UID. */ private static final long serialVersionUID = 1; - /** The main control. */ + /** + * The main view. + */ @NotNull - private final MainControl<G, A, R, V> mainControl; + private final MainView<G, A, R, V> mainView; /** The associated map view. */ @NotNull @@ -47,11 +49,11 @@ /** * Create a new instance. - * @param mainControl The main control. + * @param mainView the main view * @param mapView The associated map view. */ - public WindowAction(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapView<G, A, R, V> mapView) { - this.mainControl = mainControl; + public WindowAction(@NotNull final MainView<G, A, R, V> mainView, @NotNull final MapView<G, A, R, V> mapView) { + this.mainView = mainView; this.mapView = mapView; putValue(SHORT_DESCRIPTION, "Switches to map " + mapView.getTitle()); } @@ -75,7 +77,7 @@ /** {@inheritDoc} */ public void actionPerformed(final ActionEvent e) { - mainControl.getMainView().setCurrentLevelView(mapView); + mainView.setCurrentLevelView(mapView); } /** {@inheritDoc} */ Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 18:48:01 UTC (rev 4847) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-15 19:03:37 UTC (rev 4848) @@ -868,7 +868,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainView, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final MapActions mapActions, @NotNull final ArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> archetypeParser, @NotNull final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette) { throw new AssertionError(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |