From: <aki...@us...> - 2008-09-07 11:14:41
|
Revision: 5058 http://gridarta.svn.sourceforge.net/gridarta/?rev=5058&view=rev Author: akirschbaum Date: 2008-09-07 11:14:50 +0000 (Sun, 07 Sep 2008) Log Message: ----------- Move MainControl.getMainView() to common code base. 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-09-07 11:11:14 UTC (rev 5057) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-07 11:14:50 UTC (rev 5058) @@ -156,7 +156,7 @@ @NotNull @Override protected CFTreasureListTree<GameObject, MapArchObject, Archetype> createTreasureListTree() { - return new CFTreasureListTree<GameObject, MapArchObject, Archetype>(mainView, archetypeSet, specialTreasureLists, + return new CFTreasureListTree<GameObject, MapArchObject, Archetype>(getMainView(), archetypeSet, specialTreasureLists, new TreasureLocation(getCollectedDirectory(), IGUIConstants.TREASURES_FILE) ); } @@ -166,7 +166,7 @@ @Override protected MapActions init1() { archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); - return new MapActions(mainView, mainView, gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView); + return new MapActions(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView); } /** {@inheritDoc} */ @@ -177,13 +177,13 @@ filterControl = new CFilterControl(null, mapManager, defaultNamedFilterList); ((CrossfireObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); final ScriptParameters scriptParameters = new ScriptParameters(archetypeSet, globalSettings, mapManager, validators); - scriptControl = new ScriptController(filterControl, scriptParameters, mainView); + scriptControl = new ScriptController(filterControl, scriptParameters, getMainView()); } /** {@inheritDoc} */ @Override protected void init3() { - scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); + scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(getMainView().getJMenuBar(), "plugins")); } /** {@inheritDoc} */ @@ -194,7 +194,7 @@ /** {@inheritDoc} */ @Override protected void init5() { - final JMenu menuAnalyze = (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "analyze"); + final JMenu menuAnalyze = (JMenu) ACTION_FACTORY.find(getMainView().getJMenuBar(), "analyze"); if (menuAnalyze != null) { filterControl.createMenuEntries(menuAnalyze); } @@ -272,14 +272,6 @@ return mapValidators; } - /** - * Returns the main view. - * @return the main view - */ - public MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> getMainView() { - return mainView; - } - /** Invoked when user wants to open a file. */ public void open() { fileControl.openFileWanted(true); @@ -317,7 +309,7 @@ /** {@inheritDoc} */ public void handleThrowable(final Throwable t) { - mainView.handleThrowable(t); + getMainView().handleThrowable(t); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-09-07 11:11:14 UTC (rev 5057) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-09-07 11:14:50 UTC (rev 5058) @@ -217,7 +217,7 @@ @NotNull @Override protected CFTreasureListTree<GameObject, MapArchObject, Archetype> createTreasureListTree() { - return new CFTreasureListTree<GameObject, MapArchObject, Archetype>(mainView, archetypeSet, specialTreasureLists, + return new CFTreasureListTree<GameObject, MapArchObject, Archetype>(getMainView(), archetypeSet, specialTreasureLists, new TreasureLocation(getCollectedDirectory(), IGUIConstants.TREASURES_FILE), new TreasureLocation(globalSettings.getMapDefaultFolder(), null) ); @@ -227,7 +227,7 @@ @NotNull @Override protected MapActions init1() { - return new MapActions(mainView, mainView, gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView); + return new MapActions(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView); } /** {@inheritDoc} */ @@ -268,7 +268,7 @@ } } } - if (libFiles != null && libFiles.length > 0 && ACTION_FACTORY.showOnetimeConfirmDialog(mainView, JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, "oldLibsFound", libs.toString()) == JOptionPane.YES_OPTION) { + if (libFiles != null && libFiles.length > 0 && ACTION_FACTORY.showOnetimeConfirmDialog(getMainView(), JOptionPane.YES_NO_OPTION, JOptionPane.INFORMATION_MESSAGE, "oldLibsFound", libs.toString()) == JOptionPane.YES_OPTION) { Arrays.sort(libFiles); for (final File libFile : libFiles) { libFile.delete(); @@ -386,11 +386,11 @@ public void controlServer() { if (controlServer == null) { controlServer = new ProcessRunner("controlServer", prefs.get(PREFS_APP_SERVER, PREFS_APP_SERVER_DEFAULT)); - ACTION_FACTORY.showOnetimeMessageDialog(mainView, JOptionPane.WARNING_MESSAGE, "controlServerWarning"); + ACTION_FACTORY.showOnetimeMessageDialog(getMainView(), JOptionPane.WARNING_MESSAGE, "controlServerWarning"); } else { controlServer.setCommand(prefs.get(PREFS_APP_SERVER, PREFS_APP_SERVER_DEFAULT)); } - controlServer.showDialog(mainView); + controlServer.showDialog(getMainView()); } /** Control the client. */ @@ -401,13 +401,13 @@ } else { controlClient.setCommand(prefs.get(PREFS_APP_CLIENT, PREFS_APP_CLIENT_DEFAULT)); } - controlClient.showDialog(mainView); + controlClient.showDialog(getMainView()); } /** Collect Spells. */ @ActionMethod public void collectSpells() { - new SpellsUtils(IGUIConstants.SPELL_FILE).importSpellsWanted(getConfigurationDirectory(), mainView); + new SpellsUtils(IGUIConstants.SPELL_FILE).importSpellsWanted(getConfigurationDirectory(), getMainView()); } /** @@ -443,14 +443,6 @@ mapManager.refreshCurrentMap(); } - /** - * Returns the main view. - * @return the main view - */ - public MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> getMainView() { - return mainView; - } - /** {@inheritDoc} */ public boolean saveLevelAsWanted(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl) { return fileControl.saveLevelAsWanted(mapControl); @@ -480,7 +472,7 @@ /** {@inheritDoc} */ public void revert(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl) { - if (ACTION_FACTORY.showQuestionDialog(mainView, "confirmRevertMap", mapControl.getMapFileName())) { + if (ACTION_FACTORY.showQuestionDialog(getMainView(), "confirmRevertMap", mapControl.getMapFileName())) { final File mfile = mapControl.getMapFile(); final Point[] viewPositions = mapControl.getViewPositions(); mapManager.closeLevel(mapControl, true); @@ -497,7 +489,7 @@ /** {@inheritDoc} */ public void handleThrowable(final Throwable t) { - mainView.handleThrowable(t); + getMainView().handleThrowable(t); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-09-07 11:11:14 UTC (rev 5057) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-09-07 11:14:50 UTC (rev 5058) @@ -229,7 +229,7 @@ /** The main view. */ @NotNull - protected final MainView<G, A, R, V> mainView; + private final MainView<G, A, R, V> mainView; /** * The object chooser. @@ -761,4 +761,9 @@ } } + /** {@inheritDoc} */ + public MainView<G, A, R, V> getMainView() { + return mainView; + } + } // class AbstractMainControl This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |