From: <aki...@us...> - 2008-08-12 19:04:53
|
Revision: 4823 http://gridarta.svn.sourceforge.net/gridarta/?rev=4823&view=rev Author: akirschbaum Date: 2008-08-12 19:04:57 +0000 (Tue, 12 Aug 2008) Log Message: ----------- Remove dependency MapPropertiesDialog/MapActions -> CMainControl. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/MapActions.java trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/MapActions.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-11 18:38:23 UTC (rev 4822) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-12 19:04:57 UTC (rev 4823) @@ -308,7 +308,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, gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView); + final MapActions mapActions = new MapActions(mainView, mainView, gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, 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-11 18:38:23 UTC (rev 4822) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-08-12 19:04:57 UTC (rev 4823) @@ -32,6 +32,7 @@ import java.io.IOException; import java.util.prefs.Preferences; import javax.swing.Action; +import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.CommonConstants; @@ -110,8 +111,10 @@ @NotNull private final Component parent; - /** The main control to use. */ - private final CMainControl mainControl; + /** + * The parent frame for help windows. + */ + private final JFrame helpParent; /** * The gridarta objects factory instance. @@ -144,7 +147,7 @@ /** * Create a new instance. * @param parent the component for showing dialog boxes - * @param mainControl the main control to use + * @param helpParent the parent frame for help windows * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance * @param mapManager the map manager @@ -153,9 +156,9 @@ * @param mapFileFilter the Swing file filter to use * @param selectedSquareView the selected square vuew to use */ - public MapActions(@NotNull final Component parent, @NotNull final CMainControl mainControl, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { this.parent = parent; - this.mainControl = mainControl; + this.helpParent = helpParent; this.gridartaObjectsFactory = gridartaObjectsFactory; this.globalSettings = globalSettings; this.mapManager = mapManager; @@ -253,7 +256,7 @@ public void mapProperties() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); if (mapView != null) { - MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, mapManager, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); + MapPropertiesDialog.showDialog(mapView.getComponent(), helpParent, mapManager, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); } } Modified: trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2008-08-11 18:38:23 UTC (rev 4822) +++ trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2008-08-12 19:04:57 UTC (rev 4823) @@ -19,7 +19,6 @@ package cfeditor.gui.map; -import cfeditor.CMainControl; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; @@ -32,6 +31,7 @@ import javax.swing.JCheckBox; import javax.swing.JDialog; import javax.swing.JFormattedTextField; +import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -65,7 +65,10 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); - private final CMainControl mainControl; + /** + * The parent frame for help windows. + */ + private final JFrame helpParent; private final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl; @@ -170,18 +173,18 @@ /** * Creates a map-options dialog. - * @param mainControl The controller of this dialog. + * @param helpParent the parent frame for help windows * @param mapManager the map manager to use * @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 MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + private MapPropertiesDialog(final JFrame helpParent, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @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}); - this.mainControl = mainControl; + this.helpParent = helpParent; this.mapControl = mapControl; final MapArchObject map = mapControl.getMapModel().getMapArchObject(); @@ -348,7 +351,7 @@ /** Action method for help. */ public void mapHelp() { - new Help(mainControl.getMainView(), "tut_mapattr.html").setVisible(true); + new Help(helpParent, "tut_mapattr.html").setVisible(true); } /** Action method for okay. */ @@ -630,15 +633,15 @@ /** * Show a dialog querying the user for map properties. * @param parent the parent component to show dialog on - * @param mainControl CMainControl with information + * @param helpParent the parent frame for help windows * @param mapManager the map manager to use * @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, @NotNull final CMainControl mainControl, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @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, mapManager, gridartaObjectsFactory, globalSettings, level, mapFileFilter); + public static void showDialog(final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { + final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, 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/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-11 18:38:23 UTC (rev 4822) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-12 19:04:57 UTC (rev 4823) @@ -374,7 +374,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, gridartaObjectsFactory, (GlobalSettingsImpl) globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView); + final MapActions mapActions = new MapActions(mainView, mainView, gridartaObjectsFactory, (GlobalSettingsImpl) globalSettings, mapManager, mapViewManager, 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-11 18:38:23 UTC (rev 4822) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-08-12 19:04:57 UTC (rev 4823) @@ -32,6 +32,7 @@ import java.io.IOException; import java.util.prefs.Preferences; import javax.swing.Action; +import javax.swing.JFrame; import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.CommonConstants; @@ -105,8 +106,10 @@ @NotNull private final Component parent; - /** The main control to use. */ - private final CMainControl mainControl; + /** + * The parent frame for help windows. + */ + private final JFrame helpParent; /** * The gridarta objects factory instance. @@ -139,7 +142,7 @@ /** * Create a new instance. * @param parent the component for showing dialog boxes - * @param mainControl the main control to use + * @param helpParent the parent frame for help windows * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance * @param mapManager the map manager @@ -148,9 +151,9 @@ * @param mapFileFilter the Swing file filter to use * @param selectedSquareView the selected square vuew to use */ - public MapActions(@NotNull final Component parent, @NotNull final CMainControl mainControl, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettingsImpl globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettingsImpl globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { this.parent = parent; - this.mainControl = mainControl; + this.helpParent = helpParent; this.gridartaObjectsFactory = gridartaObjectsFactory; this.globalSettings = globalSettings; this.mapManager = mapManager; @@ -248,7 +251,7 @@ public void mapProperties() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); if (mapView != null) { - MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, mapManager, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); + MapPropertiesDialog.showDialog(mapView.getComponent(), helpParent, mapManager, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); } } Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-08-11 18:38:23 UTC (rev 4822) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-08-12 19:04:57 UTC (rev 4823) @@ -19,7 +19,6 @@ package daieditor.gui.map; -import daieditor.CMainControl; import daieditor.GlobalSettingsImpl; import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; @@ -40,6 +39,7 @@ import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JFormattedTextField; +import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; @@ -77,7 +77,10 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); - private final CMainControl mainControl; + /** + * The parent frame for help windows. + */ + private final JFrame helpParent; /** * The global settings instance. @@ -156,18 +159,18 @@ /** * Creates a map-options dialog. - * @param mainControl The controller of this dialog. + * @param helpParent the parent frame for help windows * @param mapManager the map manager to use * @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(@NotNull final CMainControl mainControl, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettingsImpl globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + private MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @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}); - this.mainControl = mainControl; + this.helpParent = helpParent; this.globalSettings = globalSettings; this.mapControl = mapControl; final MapArchObject map = mapControl.getMapModel().getMapArchObject(); @@ -345,7 +348,7 @@ /** Action method for help. */ public void mapHelp() { - new Help(mainControl.getMainView(), "tut_mapattr.html").setVisible(true); + new Help(helpParent, "tut_mapattr.html").setVisible(true); } /** Action method for okay. */ @@ -561,15 +564,15 @@ /** * Show a dialog querying the user for map properties. * @param parent the parent component to show dialog on - * @param mainControl CMainControl with information + * @param helpParent the parent frame for help windows * @param mapManager the map manager to use * @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 MapManager<?, MapArchObject, ?, ?> mapManager, @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, mapManager, gridartaObjectsFactory, globalSettings, level, mapFileFilter); + public static void showDialog(final Component parent, final JFrame helpParent, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @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(helpParent, mapManager, 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); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |