From: <aki...@us...> - 2008-08-01 22:46:43
|
Revision: 4682 http://gridarta.svn.sourceforge.net/gridarta/?rev=4682&view=rev Author: akirschbaum Date: 2008-08-01 22:46:48 +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/pickmapchooser/PickmapChooserControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 22:43:48 UTC (rev 4681) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 22:46:48 UTC (rev 4682) @@ -240,7 +240,7 @@ 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, 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); + 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>(); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 22:43:48 UTC (rev 4681) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 22:46:48 UTC (rev 4682) @@ -298,7 +298,7 @@ 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, 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); + 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>(); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-01 22:43:48 UTC (rev 4681) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-01 22:46:48 UTC (rev 4682) @@ -29,6 +29,7 @@ import javax.swing.JMenu; import javax.swing.JOptionPane; import javax.swing.JTabbedPane; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.MapManagerListener; @@ -67,6 +68,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 view for this control. */ @NotNull private final PickmapChooserView<G, A, R, V> view; @@ -163,11 +170,13 @@ * Create a PickmapChooserControl. * @param newMapDialogFactory the factory for creating new pickmaps * @param mainControl the main control + * @param gridartaObjectsFactory the gridarta objects factory instance * @param pickmapDir the pickmaps directory * @param mapManager the map manager instance */ - public PickmapChooserControl(@NotNull final NewMapDialogFactory<G, A, R, V> newMapDialogFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final File pickmapDir, @NotNull final MapManager<G, A, R, V> mapManager) { + public PickmapChooserControl(@NotNull final NewMapDialogFactory<G, A, R, V> newMapDialogFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final File pickmapDir, @NotNull final MapManager<G, A, R, V> mapManager) { this.mainControl = mainControl; + this.gridartaObjectsFactory = gridartaObjectsFactory; model = new Model<G, A, R, V>(pickmapDir); currentPickmapActions = new CurrentPickmapActions<G, A, R, V>(newMapDialogFactory, this); folderListActions = new FolderListActions<G, A, R, V>(model, newMapDialogFactory); @@ -199,7 +208,7 @@ * Load all pickmaps and build the pickmap-panel. */ public void loadPickmaps() { - new Loader<G, A, R, V>(model, mainControl.getGridartaObjectsFactory(), mainControl.getMainView()).load(); + new Loader<G, A, R, V>(model, gridartaObjectsFactory, mainControl.getMainView()).load(); } /** @@ -240,7 +249,7 @@ } } - final MapControl<G, A, R, V> mapControl = mainControl.getGridartaObjectsFactory().newPickmapControl(null, mapArchObject, mainControl.getMainView()); + final MapControl<G, A, R, V> mapControl = gridartaObjectsFactory.newPickmapControl(null, mapArchObject, mainControl.getMainView()); mapControl.setMapFile(mapFile); mapControl.setMapFileName(mapFile.getPath()); mapControl.resetModified(); @@ -248,7 +257,7 @@ final Pickmap<G, A, R, V> pickmap; try { - pickmap = activeFolder.addPickmap(pickmapName, mainControl.getGridartaObjectsFactory(), mainControl.getMainView()); + pickmap = activeFolder.addPickmap(pickmapName, gridartaObjectsFactory, mainControl.getMainView()); } catch (final InvalidNameException ex) { throw new AssertionError(); // the name has been checked before } 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:50:52
|
Revision: 4683 http://gridarta.svn.sourceforge.net/gridarta/?rev=4683&view=rev Author: akirschbaum Date: 2008-08-01 22:50:55 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove calls to MainControl.getGridartaObjectsFactory(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/io/DefaultMapWriter.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-01 22:46:48 UTC (rev 4682) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-01 22:50:55 UTC (rev 4683) @@ -151,13 +151,13 @@ /** {@inheritDoc} */ @NotNull 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); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, 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, @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); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, 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-08-01 22:46:48 UTC (rev 4682) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-01 22:50:55 UTC (rev 4683) @@ -154,13 +154,13 @@ /** {@inheritDoc} */ @NotNull 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); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, 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, @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); + final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, parent, autojoinLists, mapImageCache, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, mapActions); mapArchObject.setDifficulty(1); return mapControl; } Modified: trunk/src/app/net/sf/gridarta/io/DefaultMapWriter.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/DefaultMapWriter.java 2008-08-01 22:46:48 UTC (rev 4682) +++ trunk/src/app/net/sf/gridarta/io/DefaultMapWriter.java 2008-08-01 22:50:55 UTC (rev 4683) @@ -26,7 +26,7 @@ import java.io.IOException; import java.io.OutputStreamWriter; import java.io.UnsupportedEncodingException; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -42,22 +42,24 @@ // myOutput.close() is invoked in this.close() public final class DefaultMapWriter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MapWriter<G, A, R> { - /** The main control. */ + /** + * The gridarta objects factory instance. + */ @NotNull - private final MainControl<G, A, R, ?> mainControl; + private final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory; /** The reader to read from. */ private final OutputStreamWriter myOutput; /** * Open a file for reading it as a map. - * @param mainControl The main control. + * @param gridartaObjectsFactory the gridarta objects factory instance * @param file File to open. * @throws FileNotFoundException in case the file couldn't be opened for * writing */ - public DefaultMapWriter(@NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final File file) throws FileNotFoundException { - this.mainControl = mainControl; + public DefaultMapWriter(@NotNull final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory, @NotNull final File file) throws FileNotFoundException { + this.gridartaObjectsFactory = gridartaObjectsFactory; try { myOutput = new OutputStreamWriter(new FileOutputStream(file), IOUtils.MAP_ENCODING); } catch (final UnsupportedEncodingException e) { @@ -70,10 +72,10 @@ public final void encodeMapFile(@NotNull final MapModel<G, A, R> mapModel) throws IOException { final A mapArch = mapModel.getMapArchObject(); - mainControl.getGridartaObjectsFactory().newMapArchObjectParser().save(myOutput, mapArch); + gridartaObjectsFactory.newMapArchObjectParser().save(myOutput, mapArch); // first, write all one tile parts - final GameObjectParser<G, A, R> gameObjectParser = mainControl.getGridartaObjectsFactory().newGameObjectParser(); + final GameObjectParser<G, A, R> gameObjectParser = gridartaObjectsFactory.newGameObjectParser(); final Size2D mapSize = mapArch.getMapSize(); final int width = mapSize.getWidth(); final int height = mapSize.getHeight(); Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-08-01 22:46:48 UTC (rev 4682) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-08-01 22:50:55 UTC (rev 4683) @@ -31,7 +31,6 @@ import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MainControl; import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.Size2D; @@ -72,10 +71,6 @@ @NotNull private final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory; - /** The main control. */ - @NotNull - private final MainControl<G, A, R, V> mainControl; - /** * The parent component for error messages. */ @@ -156,7 +151,6 @@ /** * 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 @@ -167,9 +161,8 @@ * @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 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) { + public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @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; @@ -414,7 +407,7 @@ */ private boolean encodeMapFile(@NotNull final File file) { try { - final MapWriter<G, A, R> mapFileEncoder = new DefaultMapWriter<G, A, R>(mainControl, file); + final MapWriter<G, A, R> mapFileEncoder = new DefaultMapWriter<G, A, R>(gridartaObjectsFactory, file); try { mapFileEncoder.encodeMapFile(mapModel); } finally { Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-01 22:46:48 UTC (rev 4682) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-01 22:50:55 UTC (rev 4683) @@ -512,7 +512,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, new JPanel(), autojoinLists, mapImageCache, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl, mapActions); + super(gridartaObjectsFactory, new JPanel(), autojoinLists, mapImageCache, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl, mapActions); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-01 23:18:01
|
Revision: 4685 http://gridarta.svn.sourceforge.net/gridarta/?rev=4685&view=rev Author: akirschbaum Date: 2008-08-01 23:18:02 +0000 (Fri, 01 Aug 2008) Log Message: ----------- Remove calls to MainControl.getMapManager(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CFilterControl.java 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/DaimoninEditor.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 trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/map/AutoValidator.java trunk/src/app/net/sf/gridarta/map/AutoValidatorProcessor.java trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -33,12 +33,14 @@ import java.util.Locale; import java.util.prefs.Preferences; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.SplashScreen; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.preferences.FilePreferencesFactory; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.tod.TipOfTheDayManager; import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; /** * Main class, launches the level editor application. @@ -147,7 +149,7 @@ // process commandline parameters: if (inlist != null) { try { - processFile(mainControl, inlist); + processFile(mainControl, mainControl.getMapManager(), inlist); } catch (final IOException ex) { System.exit(-1); } @@ -167,21 +169,21 @@ mainControl.openFiles(infiles); } - private static void makeImage(final CMainControl mainControl, final File in, final File out) { + private static void makeImage(final CMainControl mainControl, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final File in, final File out) { if (log.isInfoEnabled()) { log.info("converting " + in + " to " + out); } if (in.canRead()) { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = mainControl.getMapManager().openMapFileWithView(in, null); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = mapManager.openMapFileWithView(in, null); if (mapView != null) { mainControl.createImageWanted(mapView, out); - mainControl.getMapManager().closeView(mapView); + mapManager.closeView(mapView); } } } - private static void processFile(final CMainControl mainControl, final String filelist) throws IOException { + private static void processFile(final CMainControl mainControl, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final String filelist) throws IOException { try { final BufferedReader reader = new BufferedReader(new FileReader(filelist)); try { @@ -192,7 +194,7 @@ log.info("done."); return; } - makeImage(mainControl, new File(in), new File(out)); + makeImage(mainControl, mapManager, new File(in), new File(out)); } } catch (final IOException e) { // XXX:cher:Getting an error and not reporting it is evil. Modified: trunk/crossfire/src/cfeditor/CFilterControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CFilterControl.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/crossfire/src/cfeditor/CFilterControl.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -31,6 +31,7 @@ import cfeditor.map.MapArchObject; import javax.swing.JMenu; import javax.swing.JMenuItem; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.map.MapControl; import org.jetbrains.annotations.NotNull; @@ -67,7 +68,7 @@ /** The main control. */ @NotNull - private final CMainControl mainControl; + private final MapManager<cfeditor.gameobject.GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; @Nullable private final MapControl<cfeditor.gameobject.GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl; @@ -76,12 +77,12 @@ * Create a new FilterControl. Do not highlight anything and does not * filterOut anything * @param mapControl MapControl to create FilterControl for. - * @param mainControl The main control. + * @param mapManager the map manager instance * @param filterList the filter list instance to use */ - public CFilterControl(@Nullable final MapControl<cfeditor.gameobject.GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @NotNull final CMainControl mainControl, final NamedFilterList filterList) { + public CFilterControl(@Nullable final MapControl<cfeditor.gameobject.GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @NotNull final MapManager<cfeditor.gameobject.GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final NamedFilterList filterList) { this.filterList = filterList; - this.mainControl = mainControl; + this.mapManager = mapManager; filterOutConfig = (NamedFilterConfig) filterList.createConfig(); highLightConfig = new NamedFilterConfig[] { (NamedFilterConfig) filterList.createConfig(), @@ -144,7 +145,7 @@ if (mapControl != null) { mapControl.repaint(); } else { - for (final MapControl<cfeditor.gameobject.GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl : mainControl.getMapManager().getOpenedMaps()) { + for (final MapControl<cfeditor.gameobject.GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl : mapManager.getOpenedMaps()) { mapControl.repaint(); } } Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -232,14 +232,14 @@ 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, editTypes, mapTileListBottom, null, archetypeSet); + final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, 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); 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>(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, gridartaObjectsFactory, 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, 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>(); @@ -251,7 +251,7 @@ 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>(mapManager); - updaterManager = new UpdaterManager("cfeditor", this, mainView, "CrossfireEditor.jar"); + updaterManager = new UpdaterManager("cfeditor", this, mapManager, mainView, "CrossfireEditor.jar"); updaterManager.startup(); // initialize the script-editor pad @@ -353,7 +353,7 @@ // load object from a arch file you found final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); - filterControl = new CFilterControl(null, this, defaultNamedFilterList); + filterControl = new CFilterControl(null, mapManager, defaultNamedFilterList); final JMenu menuAnalyze = (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "analyze"); if (menuAnalyze != null) { filterControl.createMenuEntries(menuAnalyze); @@ -375,7 +375,7 @@ } recentManager.initRecent(); validators = createMapValidators(); - new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); + new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, PREFS_VALIDATOR_AUTO_DEFAULT); gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, mainView, archetypeSet, mapManager); } Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -251,7 +251,7 @@ public void mapProperties() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); if (mapView != null) { - MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); + MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, 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-01 22:52:00 UTC (rev 4684) +++ trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -42,6 +42,7 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MapManager; import net.sf.gridarta.Size2D; import net.sf.gridarta.help.Help; import net.sf.gridarta.map.MapControl; @@ -170,12 +171,13 @@ /** * Creates a map-options dialog. * @param mainControl The controller of this dialog. + * @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 GridartaObjectsFactory<?, MapArchObject, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + 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) { okButton.setDefaultCapable(true); setOptions(new Object[] {helpButton, okButton, restoreButton, cancelButton}); @@ -219,7 +221,7 @@ final JPanel weatherPanel = createWeatherPanel(map); tabs.add(ACTION_FACTORY.getString("mapWeatherTabTitle"), weatherPanel); - mapTilePane = new MapTilePane(mainControl, gridartaObjectsFactory, globalSettings, mapControl, mapFileFilter); + mapTilePane = new MapTilePane(mapManager, gridartaObjectsFactory, globalSettings, mapControl, mapFileFilter); final JPanel tilePanel = createTilePathPanel(mapTilePane); tabs.add(ACTION_FACTORY.getString("mapTilesTabTitle"), tilePanel); @@ -629,13 +631,14 @@ * Show a dialog querying the user for map properties. * @param parent the parent component to show dialog on * @param mainControl CMainControl with information + * @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 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); + 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); 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:52:00 UTC (rev 4684) +++ trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -19,13 +19,13 @@ package cfeditor.gui.map; -import cfeditor.CMainControl; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.DirectionLayout; import net.sf.gridarta.gui.map.AbstractMapTilePane; import net.sf.gridarta.map.MapControl; @@ -57,16 +57,15 @@ /** * Create a MapTilePane. - * @param mainControl CMainControl to use for displaying dialogs, getting - * paths etc.. + * @param mapManager the map manager to use * @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 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); + public MapTilePane(final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?>gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + super(mapManager, 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:52:00 UTC (rev 4684) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -288,7 +288,7 @@ 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, editTypes, mapTileListBottom, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), archetypeSet); + final SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareControl = new SelectedSquareControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, this, 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); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); @@ -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, gridartaObjectsFactory, 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, 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>(); @@ -309,7 +309,7 @@ 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>(mapManager); - updaterManager = new UpdaterManager("daieditor", this, mainView, "DaimoninEditor.jar"); + updaterManager = new UpdaterManager("daieditor", this, mapManager, mainView, "DaimoninEditor.jar"); updaterManager.startup(); // initialize & load @@ -449,7 +449,7 @@ } recentManager.initRecent(); validators = createMapValidators(); - new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); + new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mapManager, PREFS_VALIDATOR_AUTO_DEFAULT); gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, mainView, archetypeSet, mapManager); } Modified: trunk/daimonin/src/daieditor/DaimoninEditor.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninEditor.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/daimonin/src/daieditor/DaimoninEditor.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -34,6 +34,7 @@ import java.util.ResourceBundle; import java.util.prefs.Preferences; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.SplashScreen; import net.sf.gridarta.gui.map.MapView; import net.sf.japi.io.args.ArgParser; @@ -93,21 +94,21 @@ ArgParser.simpleParseAndRun(new DaimoninEditor(), args); } - private static void makeImage(final CMainControl mainControl, final File in, final File out) { + private static void makeImage(final CMainControl mainControl, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final File in, final File out) { if (log.isInfoEnabled()) { log.info("converting " + in + " to " + out); } if (in.canRead()) { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = mainControl.getMapManager().openMapFileWithView(in, null); + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = mapManager.openMapFileWithView(in, null); if (mapView != null) { mainControl.createImageWanted(mapView, out); - mainControl.getMapManager().closeView(mapView); + mapManager.closeView(mapView); } } } - private static void processFile(final CMainControl mainControl, final String filelist) { + private static void processFile(final CMainControl mainControl, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final String filelist) { try { final BufferedReader reader = new BufferedReader(new FileReader(filelist)); try { @@ -118,7 +119,7 @@ log.info("done."); System.exit(0); } - makeImage(mainControl, new File(in), new File(out)); + makeImage(mainControl, mapManager, new File(in), new File(out)); } } catch (final IOException e) { // XXX:cher:Getting an error and not reporting it is evil. @@ -229,7 +230,7 @@ for (final String arg : args) { final File in = new File(arg); final File out = new File(arg + ".png"); - makeImage(mainControl, in, out); + makeImage(mainControl, mainControl.getMapManager(), in, out); } } finally { mainControl.doExit(); @@ -255,7 +256,7 @@ final File in = new File(args.get(0)); final File out = new File(args.get(1)); - makeImage(mainControl, in, out); + makeImage(mainControl, mainControl.getMapManager(), in, out); } finally { mainControl.doExit(); } Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -246,7 +246,7 @@ public void mapProperties() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); if (mapView != null) { - MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); + MapPropertiesDialog.showDialog(mapView.getComponent(), mainControl, 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-01 22:52:00 UTC (rev 4684) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -52,6 +52,7 @@ import javax.swing.border.EmptyBorder; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MapManager; import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.help.Help; @@ -156,12 +157,13 @@ /** * Creates a map-options dialog. * @param mainControl The controller of this dialog. + * @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 GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettingsImpl globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + 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) { okButton.setDefaultCapable(true); setOptions(new Object[] {helpButton, okButton, restoreButton, cancelButton}); @@ -176,7 +178,7 @@ final JPanel mainPanel = createMainPanel(map); tabs.add(ACTION_FACTORY.getString("mapMapTabTitle"), mainPanel); - mapTilePane = new MapTilePane(mainControl, gridartaObjectsFactory, globalSettings, mapControl, mapFileFilter); + mapTilePane = new MapTilePane(mapManager, gridartaObjectsFactory, globalSettings, mapControl, mapFileFilter); final JPanel tilePanel = createTilePathPanel(mapTilePane); tabs.add(ACTION_FACTORY.getString("mapTilesTabTitle"), tilePanel); @@ -560,13 +562,14 @@ * Show a dialog querying the user for map properties. * @param parent the parent component to show dialog on * @param mainControl CMainControl with information + * @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 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); + 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); 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:52:00 UTC (rev 4684) +++ trunk/daimonin/src/daieditor/gui/map/MapTilePane.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -19,7 +19,6 @@ package daieditor.gui.map; -import daieditor.CMainControl; import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; import daieditor.map.MapArchObject; @@ -27,6 +26,7 @@ import net.sf.gridarta.CommonConstants; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.DirectionLayout; import net.sf.gridarta.gui.map.AbstractMapTilePane; import net.sf.gridarta.map.MapControl; @@ -105,16 +105,15 @@ /** * Create a MapTilePane. - * @param mainControl CMainControl to use for displaying dialogs, getting - * paths etc.. + * @param mapManager the map manager to use * @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 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); + public MapTilePane(final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + super(mapManager, 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:52:00 UTC (rev 4684) +++ trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -40,7 +40,7 @@ import net.sf.gridarta.CommonConstants; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.DirectionLayout; import net.sf.gridarta.gui.GUIConstants; @@ -68,7 +68,7 @@ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); /** The mainControl to use. */ - private final MainControl<?, A, ?, ?> mainControl; + private final MapManager<?, A, ?, ?> mapManager; /** * The gridarta objects factory instance. @@ -129,13 +129,12 @@ /** * Create an AbstractMapTilePane. - * @param mainControl MainControl to use for displaying dialogs, getting - * paths etc.. + * @param mapManager the map manager to use * @param gridartaObjectsFactory the gridarta objects factory instance * @param globalSettings the global settings instance */ - 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; + private AbstractMapTilePane(final MapManager<?, A, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, A, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final int[][][] tileLink, final DirectionLayout.Direction[] directionMapping, final int[] nextFocus, final FileFilter mapFileFilter) { + this.mapManager = mapManager; this.gridartaObjectsFactory = gridartaObjectsFactory; this.globalSettings = globalSettings; this.tileLink = tileLink; @@ -148,15 +147,14 @@ /** * Create an AbstractMapTilePane. - * @param mainControl MainControl to use for displaying dialogs, getting - * paths etc.. + * @param mapManager the map manager to use * @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 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); + protected AbstractMapTilePane(final MapManager<?, A, ?, ?> mapManager, @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(mapManager, gridartaObjectsFactory, globalSettings, tileLink, directionMapping, nextFocus, mapFileFilter); setMapControl(mapControl); } @@ -310,12 +308,12 @@ /* run through all loaded maps and see we have a map with this path * if unsaved, ask for stop or autosave */ - final MapControl<?, A, ?, ?> level = mainControl.getMapManager().getMapIfOpened(mapPath); + final MapControl<?, A, ?, ?> level = mapManager.getMapIfOpened(mapPath); if (level != null) { // opened map in the editor ! if (!ACTION_FACTORY.showQuestionDialog(this, "mapQueryLoaded")) { return; } - mainControl.getMapManager().saveMapIfOpened(mapPath); + mapManager.saveMapIfOpened(mapPath); } /* now lets check we have perhaps this map opened in the editor - force a "autosave" or stop */ @@ -347,12 +345,12 @@ /* run through all loaded maps and see we have a map with this path * if unsaved, ask for stop or autosave */ - final MapControl<?, A, ?, ?> level = mainControl.getMapManager().getMapIfOpened(mapPath); + final MapControl<?, A, ?, ?> level = mapManager.getMapIfOpened(mapPath); if (level != null) { // opened map in the editor ! if (!ACTION_FACTORY.showQuestionDialog(this, "mapQueryLoaded", level.getMapFileName())) { return; } - mainControl.getMapManager().saveMapIfOpened(mapPath); + mapManager.saveMapIfOpened(mapPath); } tileHeaders[tileLink[i][ii][0]] = openMapFileHeader(link); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -212,7 +212,7 @@ public void close() { final MapView<G, A, R, V> mapView = getCloseEnabled(); if (mapView != null) { - mainControl.getMapManager().closeView(mapView); + mapManager.closeView(mapView); } } 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:52:00 UTC (rev 4684) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -28,7 +28,7 @@ import javax.swing.JTextField; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; @@ -57,8 +57,10 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - /** The controller of this new level dialog view. */ - private final MainControl<G, A, R, V> mainControl; + /** + * The map manager to use. + */ + private final MapManager<G, A, R, V> mapManager; /** * The gridarta objects factory instance. @@ -86,7 +88,7 @@ /** * Creates a "new map" dialog. - * @param mainControl the controller of this dialog. + * @param mapManager the map manager to use * @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 @@ -96,9 +98,9 @@ * @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, @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) { + public NewMapDialog(final MapManager<G, A, R, V> mapManager, @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.mapManager = mapManager; this.gridartaObjectsFactory = gridartaObjectsFactory; this.filename = filename; this.showMapDifficulty = showMapDifficulty; @@ -169,7 +171,7 @@ mapArchObject.setDifficulty(difficulty); } - mainControl.getMapManager().newMapWithView(null, mapArchObject, null, null, filename != null ? filename : CommonConstants.DEF_MAPFNAME); + mapManager.newMapWithView(null, mapArchObject, null, null, filename != null ? filename : CommonConstants.DEF_MAPFNAME); return true; } 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:52:00 UTC (rev 4684) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -21,6 +21,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; @@ -42,6 +43,12 @@ private final MainControl<G, A, R, V> mainControl; /** + * The map manager to use. + */ + @NotNull + private final MapManager<G, A, R, V> mapManager; + + /** * The gridarta objects factory instance. */ @NotNull @@ -75,6 +82,7 @@ /** * Creates a new instance. * @param mainControl the main control instance + * @param mapManager the map manager to use * @param gridartaObjectsFactory the gridarta objects factory instance * @param defaultMapWidth the default width for new maps * @param defaultMapHeight the default height for new maps @@ -84,8 +92,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, @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) { + public NewMapDialogFactory(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapManager<G, A, R, V> mapManager, @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.mapManager = mapManager; this.gridartaObjectsFactory = gridartaObjectsFactory; this.defaultMapWidth = defaultMapWidth; this.defaultMapHeight = defaultMapHeight; @@ -106,7 +115,7 @@ * unknown */ public void showNewMapDialog(final String filename) { - new NewMapDialog<G, A, R, V>(mainControl, gridartaObjectsFactory, mainControl.getMainView(), filename, showMapSizeDefault, showMapDifficulty, defaultMapWidth, defaultMapHeight, defaultMapDifficulty); + new NewMapDialog<G, A, R, V>(mapManager, gridartaObjectsFactory, mainControl.getMainView(), filename, showMapSizeDefault, showMapDifficulty, defaultMapWidth, defaultMapHeight, defaultMapDifficulty); } /** Shows a dialog for creating a new pickmap. */ Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserControl.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -69,6 +69,12 @@ private final MainControl<G, A, R, V> mainControl; /** + * The map manager to use. + */ + @NotNull + private final MapManager<G, A, R, V> mapManager; + + /** * The gridarta objects factory instance. */ @NotNull @@ -176,6 +182,7 @@ */ public PickmapChooserControl(@NotNull final NewMapDialogFactory<G, A, R, V> newMapDialogFactory, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final File pickmapDir, @NotNull final MapManager<G, A, R, V> mapManager) { this.mainControl = mainControl; + this.mapManager = mapManager; this.gridartaObjectsFactory = gridartaObjectsFactory; model = new Model<G, A, R, V>(pickmapDir); currentPickmapActions = new CurrentPickmapActions<G, A, R, V>(newMapDialogFactory, this); @@ -292,7 +299,7 @@ } public void openPickmapMap(@NotNull final Pickmap<G, A, R, V> pickmap) { - mainControl.getMapManager().openMapFileWithView(pickmap.getFile(), null); + mapManager.openMapFileWithView(pickmap.getFile(), null); } public void deletePickmapWanted(@NotNull final Pickmap<G, A, R, V> pickmap) { Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -28,6 +28,7 @@ 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; @@ -83,6 +84,7 @@ * Create a SelectedSquareControl. * @param actionFactory the action factory * @param mainControl MainControl, used for icons + * @param mapManager the map manager to use * @param editTypes the edit types instance * @param mapTileListBottom set if the map tile list should be at the bottom * or on the top of the main view @@ -90,10 +92,10 @@ * of the list * @param archetypeSet the archetype set to use */ - public SelectedSquareControl(@NotNull final ActionFactory actionFactory, final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, final boolean mapTileListBottom, @Nullable final ImageIcon compassIcon, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { + public SelectedSquareControl(@NotNull final ActionFactory actionFactory, @NotNull final MainControl<G, A, R, V> mainControl, @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; - view = new SelectedSquareView<G, A, R, V>(actionFactory, this, mainControl, editTypes, mapTileListBottom, compassIcon, archetypeSet); + view = new SelectedSquareView<G, A, R, V>(actionFactory, this, mapManager, editTypes, mapTileListBottom, compassIcon, archetypeSet); } MouseListener getMouseListener() { Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -39,7 +39,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import net.sf.gridarta.EditTypes; -import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.MapManagerListener; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; @@ -214,7 +214,7 @@ * Create a new instance. * @param actionFactory the action factory * @param control the controller for this view - * @param mainControl the main controller for this view + * @param mapManager the map manager to use * @param editTypes the edit types instance * @param mapTileListBottom set if the map tile list should be at the bottom * or on the top of the main view @@ -222,10 +222,10 @@ * of the list * @param archetypeSet the archetype set to use */ - SelectedSquareView(@NotNull final ActionFactory actionFactory, @NotNull final SelectedSquareControl<G, A, R, V> control, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, final boolean mapTileListBottom, @Nullable final ImageIcon compassIcon, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { + SelectedSquareView(@NotNull final ActionFactory actionFactory, @NotNull final SelectedSquareControl<G, A, R, V> control, @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.editTypes = editTypes; this.control = control; - mapTileSelectionCache = new MapTileSelectionCache<G, A, R, V>(mainControl.getMapManager()); + mapTileSelectionCache = new MapTileSelectionCache<G, A, R, V>(mapManager); setLayout(new BorderLayout()); @@ -260,7 +260,7 @@ list.addMouseListener(control.getMouseListener()); list.setFocusable(false); // XXX Workaround for Mantis #0000154 This is not clean and should be removed as soon as cut/copy/paste of arches is possible - mainControl.getMapManager().addMapManagerListener(mapManagerListener); + mapManager.addMapManagerListener(mapManagerListener); control.fireSelectedGameObjectChangedEvent(null); } Modified: trunk/src/app/net/sf/gridarta/map/AutoValidator.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AutoValidator.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/src/app/net/sf/gridarta/map/AutoValidator.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -25,6 +25,7 @@ import java.util.prefs.PreferenceChangeListener; import java.util.prefs.Preferences; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.MapManagerListener; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -157,16 +158,17 @@ /** * Create a new instance. * @param mainControl The main control. + * @param mapManager the map manager to use * @param autoDefault Whether the auto-validator is enabled by default. */ - public AutoValidator(@NotNull final MainControl<G, A, R, V> mainControl, final boolean autoDefault) { + public AutoValidator(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapManager<G, A, R, V>mapManager, final boolean autoDefault) { setDefaultPreferencesValue(autoDefault); wasEnabled = isEnabled(); // call to isEnabled() must not happen before setDefaultPreferencesValue() prefs.addPreferenceChangeListener(preferenceChangeListener); - autoValidatorProcessor = new AutoValidatorProcessor<G, A, R, V>(mainControl); - mainControl.getMapManager().addMapManagerListener(mapManagerListener); + autoValidatorProcessor = new AutoValidatorProcessor<G, A, R, V>(mainControl, mapManager); + mapManager.addMapManagerListener(mapManagerListener); autoValidatorProcessor.start(); if (wasEnabled) { Modified: trunk/src/app/net/sf/gridarta/map/AutoValidatorProcessor.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/AutoValidatorProcessor.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/src/app/net/sf/gridarta/map/AutoValidatorProcessor.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -24,6 +24,7 @@ import java.util.IdentityHashMap; import java.util.Map; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; @@ -44,6 +45,12 @@ @NotNull private final MainControl<G, A, R, V> mainControl; + /** + * The map manager to use. + */ + @NotNull + private final MapManager<G, A, R, V> mapManager; + /** The map models pending a map validation. */ private final Map<MapModel<G, A, R>, MapModel<G, A, R>> changedMapModels = new IdentityHashMap<MapModel<G, A, R>, MapModel<G, A, R>>(); @@ -83,9 +90,11 @@ /** * Create a new instance. * @param mainControl The main control. + * @param mapManager the map manager to use */ - public AutoValidatorProcessor(@NotNull final MainControl<G, A, R, V> mainControl) { + public AutoValidatorProcessor(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final MapManager<G, A, R, V> mapManager) { this.mainControl = mainControl; + this.mapManager = mapManager; } /** @@ -142,7 +151,7 @@ /** Schedule all opened maps to be validated. */ public void validateAllMaps() { synchronized (changedMapModels) { - for (final MapControl<G, A, R, V> mapControl : mainControl.getMapManager().getOpenedMaps()) { + for (final MapControl<G, A, R, V> mapControl : mapManager.getOpenedMaps()) { final MapModel<G, A, R> mapModel = mapControl.getMapModel(); changedMapModels.put(mapModel, mapModel); } Modified: trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java 2008-08-01 22:52:00 UTC (rev 4684) +++ trunk/src/app/net/sf/gridarta/updater/UpdaterManager.java 2008-08-01 23:18:02 UTC (rev 4685) @@ -23,7 +23,9 @@ import java.util.prefs.Preferences; import javax.swing.Action; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; /** * This class handles updating the map editor. @@ -63,6 +65,11 @@ /** The main control. */ private final MainControl<?, ?, ?, ?> mainControl; + /** + * The map manager to use. + */ + private final MapManager<?, ?, ?, ?> mapManager; + /** The component to show dialogs on. */ private final Component parentComponent; @@ -73,10 +80,12 @@ * Creates a new instance. * @param key the action factory key * @param mainControl The main control. + * @param mapManager the map manager to use * @param parentComponent Component to show dialogs on * @param updateFileName the file to update */ - public UpdaterManager(final String key, final MainControl<?, ?, ?, ?> mainControl, final Component parentComponent, final String updateFileName) { + public UpdaterManager(final String key, @NotNull final MainControl<?, ?, ?, ?> mainControl, @NotNull final MapManager<?, ?, ?, ?> mapManager, final Component parentComponent, final String updateFileName) { + this.mapManager = mapManager; ACTION_FACTORY = ActionFactory.getFactory(key); this.key = key; this.mainControl = mainControl; @@ -102,7 +111,7 @@ /** Perform an update. */ public void update() { - if (mainControl.getMapManager().hasOpenedMap()) { + if (mapManager.hasOpenedMap()) { ACTION_FACTORY.showMessageDialog(parentComponent, "updateCloseMaps"); } else { new Thread(new Updater(parentComponent, mainControl, key, updateFileName)).start(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-02 07:08:01
|
Revision: 4686 http://gridarta.svn.sourceforge.net/gridarta/?rev=4686&view=rev Author: akirschbaum Date: 2008-08-02 07:08:09 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Move code from CFJavaEditor/DaimoninEditor to CMainControl. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninEditor.java Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-08-01 23:18:02 UTC (rev 4685) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-08-02 07:08:09 UTC (rev 4686) @@ -19,28 +19,19 @@ package cfeditor; -import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.GameObject; -import cfeditor.gui.map.CMapViewBasic; -import cfeditor.map.MapArchObject; import java.awt.Component; -import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.prefs.Preferences; import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.SplashScreen; -import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.preferences.FilePreferencesFactory; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.tod.TipOfTheDayManager; import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; /** * Main class, launches the level editor application. @@ -149,7 +140,7 @@ // process commandline parameters: if (inlist != null) { try { - processFile(mainControl, mainControl.getMapManager(), inlist); + mainControl.processFile(inlist); } catch (final IOException ex) { System.exit(-1); } @@ -169,46 +160,6 @@ mainControl.openFiles(infiles); } - private static void makeImage(final CMainControl mainControl, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final File in, final File out) { - if (log.isInfoEnabled()) { - log.info("converting " + in + " to " + out); - } - - if (in.canRead()) { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = mapManager.openMapFileWithView(in, null); - if (mapView != null) { - mainControl.createImageWanted(mapView, out); - mapManager.closeView(mapView); - } - } - } - - private static void processFile(final CMainControl mainControl, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final String filelist) throws IOException { - try { - final BufferedReader reader = new BufferedReader(new FileReader(filelist)); - try { - while (true) { - final String in = reader.readLine(); - final String out = reader.readLine(); - if (in == null || out == null) { - log.info("done."); - return; - } - makeImage(mainControl, mapManager, new File(in), new File(out)); - } - } catch (final IOException e) { - // XXX:cher:Getting an error and not reporting it is evil. - log.info("done."); - return; - } finally { - reader.close(); - } - } catch (final IOException e) { - log.warn("Read error: ", e); - throw e; - } - } - private static void usage() { System.out.println("usage: java -jar CrossfireEditor.jar [option...] [mapfile...]"); System.out.println(""); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-01 23:18:02 UTC (rev 4685) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 07:08:09 UTC (rev 4686) @@ -37,8 +37,10 @@ import cfeditor.script.ScriptController; import cfeditor.script.parameter.PluginParameterFactory; import java.awt.Point; +import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; +import java.io.FileReader; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.Collections; @@ -805,4 +807,44 @@ return mainActions; } + public void processFile(final String filelist) throws IOException { + try { + final BufferedReader reader = new BufferedReader(new FileReader(filelist)); + try { + while (true) { + final String in = reader.readLine(); + final String out = reader.readLine(); + if (in == null || out == null) { + log.info("done."); + return; + } + makeImage(new File(in), new File(out)); + } + } catch (final IOException e) { + // XXX:cher:Getting an error and not reporting it is evil. + log.info("done."); + return; + } finally { + reader.close(); + } + } catch (final IOException e) { + log.warn("Read error: ", e); + throw e; + } + } + + private void makeImage(final File in, final File out) { + if (log.isInfoEnabled()) { + log.info("converting " + in + " to " + out); + } + + if (in.canRead()) { + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = mapManager.openMapFileWithView(in, null); + if (mapView != null) { + createImageWanted(mapView, out); + mapManager.closeView(mapView); + } + } + } + } // class CMainControl Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-01 23:18:02 UTC (rev 4685) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 07:08:09 UTC (rev 4686) @@ -40,12 +40,15 @@ import daieditor.map.validation.checks.SlayingChecker; import daieditor.map.validation.checks.TilePathsChecker; import java.awt.Point; +import java.io.BufferedReader; import java.io.File; import java.io.FileNotFoundException; +import java.io.FileReader; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.util.Arrays; import java.util.Collections; +import java.util.List; import java.util.Map; import java.util.MissingResourceException; import java.util.prefs.Preferences; @@ -135,6 +138,7 @@ import net.sf.gridarta.treasurelist.TreasureLocation; import net.sf.gridarta.treasurelist.TreasureTreeNode; import net.sf.gridarta.updater.UpdaterManager; +import net.sf.japi.io.args.ArgParser; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ActionMethod; import net.sf.japi.swing.prefs.PreferencesGroup; @@ -985,4 +989,92 @@ return mainActions; } + /** + * Run in batch png mode. + * @param args the argument strings that were not parsed away by {@link + * ArgParser}. + * @return return code suitable for passing to {@link System#exit(int)} + * (whether {@link System#exit(int)} is really invoked depends on + * the configuration of the {@link ArgParser}.) + * @throws Exception in case of problems during command execution. + */ + public int runBatchPng(@NotNull final List<String> args) throws Exception { + try { + for (final String arg : args) { + final File in = new File(arg); + final File out = new File(arg + ".png"); + makeImage(in, out); + } + } finally { + doExit(); + } + return 0; + } + + /** + * Run in single png mode. + * @param args the argument strings that were not parsed away by {@link + * ArgParser}. + * @return return code suitable for passing to {@link System#exit(int)} + * (whether {@link System#exit(int)} is really invoked depends on + * the configuration of the {@link ArgParser}.) + * @throws Exception in case of problems during command execution. + */ + public int runSinglePng(@NotNull final List<String> args) throws Exception { + try { + if (args.size() != 2) { + System.err.println("Usage: -s input output"); + return 1; + } + + final File in = new File(args.get(0)); + final File out = new File(args.get(1)); + makeImage(in, out); + } finally { + doExit(); + } + return 0; + } + + private void processFile(final String filelist) { + try { + final BufferedReader reader = new BufferedReader(new FileReader(filelist)); + try { + while (true) { + final String in = reader.readLine(); + final String out = reader.readLine(); + if (in == null || out == null) { + log.info("done."); + System.exit(0); + } + makeImage(new File(in), new File(out)); + } + } catch (final IOException e) { + // XXX:cher:Getting an error and not reporting it is evil. + log.info("done."); + System.exit(0); + } finally { + reader.close(); + } + } catch (final IOException e) { + log.warn("Read error: ", e); + System.exit(-1); + } + System.exit(0); + } + + private void makeImage(final File in, final File out) { + if (log.isInfoEnabled()) { + log.info("converting " + in + " to " + out); + } + + if (in.canRead()) { + final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = mapManager.openMapFileWithView(in, null); + if (mapView != null) { + createImageWanted(mapView, out); + mapManager.closeView(mapView); + } + } + } + } // class CMainControl Modified: trunk/daimonin/src/daieditor/DaimoninEditor.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninEditor.java 2008-08-01 23:18:02 UTC (rev 4685) +++ trunk/daimonin/src/daieditor/DaimoninEditor.java 2008-08-02 07:08:09 UTC (rev 4686) @@ -19,24 +19,14 @@ package daieditor; -import daieditor.gameobject.Archetype; -import daieditor.gameobject.GameObject; -import daieditor.gui.map.CMapViewBasic; -import daieditor.map.MapArchObject; import java.awt.Component; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; import java.util.List; import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; import java.util.prefs.Preferences; import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.SplashScreen; -import net.sf.gridarta.gui.map.MapView; import net.sf.japi.io.args.ArgParser; import net.sf.japi.io.args.BasicCommand; import net.sf.japi.io.args.Option; @@ -94,47 +84,6 @@ ArgParser.simpleParseAndRun(new DaimoninEditor(), args); } - private static void makeImage(final CMainControl mainControl, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final File in, final File out) { - if (log.isInfoEnabled()) { - log.info("converting " + in + " to " + out); - } - - if (in.canRead()) { - final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = mapManager.openMapFileWithView(in, null); - if (mapView != null) { - mainControl.createImageWanted(mapView, out); - mapManager.closeView(mapView); - } - } - } - - private static void processFile(final CMainControl mainControl, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final String filelist) { - try { - final BufferedReader reader = new BufferedReader(new FileReader(filelist)); - try { - while (true) { - final String in = reader.readLine(); - final String out = reader.readLine(); - if (in == null || out == null) { - log.info("done."); - System.exit(0); - } - makeImage(mainControl, mapManager, new File(in), new File(out)); - } - } catch (final IOException e) { - // XXX:cher:Getting an error and not reporting it is evil. - log.info("done."); - System.exit(0); - } finally { - reader.close(); - } - } catch (final IOException e) { - log.warn("Read error: ", e); - System.exit(-1); - } - System.exit(0); - } - /** Sets the mode to normal. This is the default. */ @Option({"n", "normal"}) public void setNormal() { @@ -184,9 +133,9 @@ case NORMAL: return runNormal(args); case BATCH_PNG: - return runBatchPng(args); + return mainControl.runBatchPng(args); case SINGLE_PNG: - return runSinglePng(args); + return mainControl.runSinglePng(args); case COLLECT_ARCHES: return runCollectArches(args); case CREATE_THUMBS: @@ -217,53 +166,6 @@ } /** - * Run in batch png mode. - * @param args the argument strings that were not parsed away by {@link - * ArgParser}. - * @return return code suitable for passing to {@link System#exit(int)} - * (whether {@link System#exit(int)} is really invoked depends on - * the configuration of the {@link ArgParser}.) - * @throws Exception in case of problems during command execution. - */ - private int runBatchPng(@NotNull final List<String> args) throws Exception { - try { - for (final String arg : args) { - final File in = new File(arg); - final File out = new File(arg + ".png"); - makeImage(mainControl, mainControl.getMapManager(), in, out); - } - } finally { - mainControl.doExit(); - } - return 0; - } - - /** - * Run in single png mode. - * @param args the argument strings that were not parsed away by {@link - * ArgParser}. - * @return return code suitable for passing to {@link System#exit(int)} - * (whether {@link System#exit(int)} is really invoked depends on - * the configuration of the {@link ArgParser}.) - * @throws Exception in case of problems during command execution. - */ - private int runSinglePng(@NotNull final List<String> args) throws Exception { - try { - if (args.size() != 2) { - System.err.println("Usage: -s input output"); - return 1; - } - - final File in = new File(args.get(0)); - final File out = new File(args.get(1)); - makeImage(mainControl, mainControl.getMapManager(), in, out); - } finally { - mainControl.doExit(); - } - return 0; - } - - /** * Run in collect arches mode. * @param args the argument strings that were not parsed away by {@link * ArgParser}. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-02 07:12:03
|
Revision: 4688 http://gridarta.svn.sourceforge.net/gridarta/?rev=4688&view=rev Author: akirschbaum Date: 2008-08-02 07:12:11 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Remove MainControl.getNumberSpells(). 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-08-02 07:10:53 UTC (rev 4687) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 07:12:11 UTC (rev 4688) @@ -765,11 +765,6 @@ } /** {@inheritDoc} */ - public Spells<NumberSpell> getNumberSpells() { - return numberSpells; - } - - /** {@inheritDoc} */ public Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> getGameObjectSpells() { return gameObjectSpells; } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 07:10:53 UTC (rev 4687) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 07:12:11 UTC (rev 4688) @@ -947,11 +947,6 @@ } /** {@inheritDoc} */ - public Spells<NumberSpell> getNumberSpells() { - return numberSpells; - } - - /** {@inheritDoc} */ public Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> getGameObjectSpells() { return gameObjectSpells; } Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-02 07:10:53 UTC (rev 4687) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-02 07:12:11 UTC (rev 4688) @@ -31,7 +31,6 @@ import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.spells.GameObjectSpell; -import net.sf.gridarta.spells.NumberSpell; import net.sf.gridarta.spells.Spells; import net.sf.japi.swing.ActionMethod; import org.jetbrains.annotations.NotNull; @@ -102,12 +101,6 @@ String getCollectedDirectory(); /** - * Return the numbered spell objects. - * @return The numbered spell objects. - */ - Spells<NumberSpell> getNumberSpells(); - - /** * Return the game object based spell objects. * @return The game object based spell objects. */ Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-02 07:10:53 UTC (rev 4687) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-02 07:12:11 UTC (rev 4688) @@ -453,11 +453,6 @@ } /** {@inheritDoc} */ - public Spells<NumberSpell> getNumberSpells() { - throw new AssertionError(); - } - - /** {@inheritDoc} */ public Spells<GameObjectSpell<TestGameObject, TestMapArchObject, TestArchetype>> getGameObjectSpells() { 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-02 07:12:39
|
Revision: 4689 http://gridarta.svn.sourceforge.net/gridarta/?rev=4689&view=rev Author: akirschbaum Date: 2008-08-02 07:12:47 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Remove MainControl.getGameObjectSpells(). 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-08-02 07:12:11 UTC (rev 4688) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 07:12:47 UTC (rev 4689) @@ -764,11 +764,6 @@ new MapPreview(gridartaObjectsFactory.newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); } - /** {@inheritDoc} */ - public Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> getGameObjectSpells() { - return gameObjectSpells; - } - /** * Returns the current top map view we are working with. * @return the current top map view we are working with, or Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 07:12:11 UTC (rev 4688) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 07:12:47 UTC (rev 4689) @@ -946,11 +946,6 @@ new MapPreview(gridartaObjectsFactory.newSimpleLevelRenderer(currentMap.getMapModel()).getFullImage()); } - /** {@inheritDoc} */ - public Spells<GameObjectSpell<GameObject, MapArchObject, Archetype>> getGameObjectSpells() { - return gameObjectSpells; - } - /** * Returns the current top map view we are working with. * @return the current top map view we are working with, or Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-02 07:12:11 UTC (rev 4688) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-02 07:12:47 UTC (rev 4689) @@ -100,12 +100,6 @@ @NotNull String getCollectedDirectory(); - /** - * Return the game object based spell objects. - * @return The game object based spell objects. - */ - Spells<GameObjectSpell<G, A, R>> getGameObjectSpells(); - /** Exits from the program. */ void doExit(); Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-02 07:12:11 UTC (rev 4688) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-02 07:12:47 UTC (rev 4689) @@ -453,11 +453,6 @@ } /** {@inheritDoc} */ - public Spells<GameObjectSpell<TestGameObject, TestMapArchObject, TestArchetype>> getGameObjectSpells() { - throw new AssertionError(); - } - - /** {@inheritDoc} */ public void doExit() { 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-02 07:41:22
|
Revision: 4695 http://gridarta.svn.sourceforge.net/gridarta/?rev=4695&view=rev Author: akirschbaum Date: 2008-08-02 07:41:31 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Remove AbstractMainControl.getCopyBuffer(). 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-08-02 07:39:35 UTC (rev 4694) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 07:41:31 UTC (rev 4695) @@ -245,8 +245,8 @@ 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>(); - 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, mapManager); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); 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); @@ -345,7 +345,7 @@ net.sf.gridarta.gameobject.GameObject.initialize(archetypeTypeSet, gameObjectMatchers); - getCopyBuffer().init(gridartaObjectsFactory.newMapArchObject(false)); + copyBuffer.init(gridartaObjectsFactory.newMapArchObject(false)); mainActions.init(); final RecentManager recentManager = new RecentManager(mapManager, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 07:39:35 UTC (rev 4694) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 07:41:31 UTC (rev 4695) @@ -305,8 +305,8 @@ 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>(); - 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, mapManager); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, archetypeSet, faceObjects); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); @@ -405,7 +405,7 @@ net.sf.gridarta.gameobject.GameObject.initialize(archetypeTypeSet, gameObjectMatchers); - getCopyBuffer().init(gridartaObjectsFactory.newMapArchObject(false)); + copyBuffer.init(gridartaObjectsFactory.newMapArchObject(false)); mainActions.init(); // Delete libraries. Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-02 07:39:35 UTC (rev 4694) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-02 07:41:31 UTC (rev 4695) @@ -80,7 +80,7 @@ protected final GlobalSettings globalSettings; /** Buffer managing copy data. */ - private final CopyBuffer<G, A, R, V> copyBuffer; + protected final CopyBuffer<G, A, R, V> copyBuffer; /** The cache for map images. */ private MapImageCache<G, A, R, V> mapImageCache = null; @@ -116,14 +116,6 @@ this.gridartaObjectsFactory = gridartaObjectsFactory; } - /** - * Return the {@link CopyBuffer} instance. - * @return The <code>CopyBuffer</code> instance. - */ - protected CopyBuffer<G, A, R, V> getCopyBuffer() { - return copyBuffer; - } - /** {@inheritDoc} */ protected MapImageCache<G, A, R, V> getMapImageCache() { return mapImageCache; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-02 07:42:43
|
Revision: 4696 http://gridarta.svn.sourceforge.net/gridarta/?rev=4696&view=rev Author: akirschbaum Date: 2008-08-02 07:42:50 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Remove AbstractMainControl.getMapImageCache(). 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-08-02 07:41:31 UTC (rev 4695) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 07:42:50 UTC (rev 4696) @@ -333,7 +333,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, autojoinLists); + gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 07:41:31 UTC (rev 4695) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 07:42:50 UTC (rev 4696) @@ -393,7 +393,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, autojoinLists); + gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists); archetypeSet.loadArchetypes(archetypeParser); if (globalSettings.isAutoPopupDocu()) { Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-02 07:41:31 UTC (rev 4695) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-02 07:42:50 UTC (rev 4696) @@ -83,7 +83,7 @@ protected final CopyBuffer<G, A, R, V> copyBuffer; /** The cache for map images. */ - private MapImageCache<G, A, R, V> mapImageCache = null; + protected MapImageCache<G, A, R, V> mapImageCache = null; /** MapPreviewAccessory. */ private MapPreviewAccessory mapPreviewAccessory; @@ -116,11 +116,6 @@ this.gridartaObjectsFactory = gridartaObjectsFactory; } - /** {@inheritDoc} */ - protected MapImageCache<G, A, R, V> getMapImageCache() { - return mapImageCache; - } - /** * Create the cache instance for map images. * @param baseDir The base directory to store the cached files. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-02 07:49:55
|
Revision: 4697 http://gridarta.svn.sourceforge.net/gridarta/?rev=4697&view=rev Author: akirschbaum Date: 2008-08-02 07:50:03 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Remove AbstractMainControl.getMapPreviewAccessory() and AbstractMainControl.attachToMapPreviewAccessory(). 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-08-02 07:42:50 UTC (rev 4696) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 07:50:03 UTC (rev 4697) @@ -348,7 +348,7 @@ copyBuffer.init(gridartaObjectsFactory.newMapArchObject(false)); mainActions.init(); - final RecentManager recentManager = new RecentManager(mapManager, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); + final RecentManager recentManager = new RecentManager(mapManager, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, mapPreviewAccessory); mapManager.setRecentManager(recentManager); // browse arch archive @@ -514,7 +514,7 @@ if (globalSettings.getMapDir().exists()) { fileChooser.setCurrentDirectory(globalSettings.getMapDir()); } - attachToMapPreviewAccessory(fileChooser); + mapPreviewAccessory.attachTo(fileChooser); } /** Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 07:42:50 UTC (rev 4696) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 07:50:03 UTC (rev 4697) @@ -129,7 +129,6 @@ import net.sf.gridarta.map.validation.checks.UndefinedArchetypeChecker; import net.sf.gridarta.map.validation.checks.UnsetSlayingChecker; import net.sf.gridarta.spells.GameObjectSpell; -import net.sf.gridarta.spells.NumberSpell; import net.sf.gridarta.spells.Spells; import net.sf.gridarta.spells.XMLSpellLoader; import net.sf.gridarta.textedit.scripteditor.ScriptEditControlInstance; @@ -432,7 +431,7 @@ } } - final RecentManager recentManager = new RecentManager(mapManager, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, getMapPreviewAccessory()); + final RecentManager recentManager = new RecentManager(mapManager, (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "recent"), globalSettings, mapPreviewAccessory); mapManager.setRecentManager(recentManager); // browse arch archive @@ -697,7 +696,7 @@ if (globalSettings.getMapDir().exists()) { fileChooser.setCurrentDirectory(globalSettings.getMapDir()); } - attachToMapPreviewAccessory(fileChooser); + mapPreviewAccessory.attachTo(fileChooser); } /** Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-02 07:42:50 UTC (rev 4696) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-08-02 07:50:03 UTC (rev 4697) @@ -86,7 +86,7 @@ protected MapImageCache<G, A, R, V> mapImageCache = null; /** MapPreviewAccessory. */ - private MapPreviewAccessory mapPreviewAccessory; + protected MapPreviewAccessory mapPreviewAccessory; /** The autojoin lists. */ protected final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(); @@ -132,22 +132,6 @@ } - /** - * Return the map preview accessory. - * @return the map preview accessory - */ - protected MapPreviewAccessory getMapPreviewAccessory() { - return mapPreviewAccessory; - } - - /** - * Attach the given file chooser to the map preview accessory. - * @param fileChooser The file chooser to modify. - */ - protected void attachToMapPreviewAccessory(@NotNull final JFileChooser fileChooser) { - mapPreviewAccessory.attachTo(fileChooser); - } - /** {@inheritDoc} */ public File getLocalMapDir() { final MapControl<G, A, R, V> mapControl = mapManager.getCurrentMap(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-02 08:27:55
|
Revision: 4704 http://gridarta.svn.sourceforge.net/gridarta/?rev=4704&view=rev Author: akirschbaum Date: 2008-08-02 08:28:01 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Convert fields to local variables. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 08:26:53 UTC (rev 4703) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 08:28:01 UTC (rev 4704) @@ -167,11 +167,6 @@ /** The main view. */ private final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView; - private final ArchetypeParser archetypeParser; - - /** The Animation Objects. */ - private final AnimationObjects<AnimationObject> animationObjects; - /** The Face Objects. */ private final FaceObjects faceObjects = new FaceObjects(); @@ -205,9 +200,6 @@ /** The treasure lists. */ private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; - /** The filter control. */ - private final CFilterControl filterControl; - /** The factory for creating new maps or pickmaps. */ private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; @@ -229,7 +221,7 @@ globalSettings.readGlobalSettings(); ScriptArchEditor.setGlobalSettings(globalSettings, this); ScriptedEventEditor.setGlobalSettings(globalSettings); - animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); + final AnimationObjects<AnimationObject> animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, ((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); GameObject.setArchetypeSet(archetypeSet); ScriptedEvent.setArchetypeSet(archetypeSet); @@ -329,13 +321,13 @@ gameObjectAttributesPanel = new GameObjectAttributesPanel(this, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); PluginParameterFactory.init(archetypeSet, gameObjectAttributesPanel, objectChooser, mapManager); final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); - filterControl = new CFilterControl(null, mapManager, defaultNamedFilterList); + final CFilterControl filterControl = new CFilterControl(null, mapManager, defaultNamedFilterList); ((CrossfireObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); scriptControl = new ScriptController(this, filterControl, archetypeSet, mainView); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); - archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); + final ArchetypeParser archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists); archetypeSet.loadArchetypes(archetypeParser); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 08:26:53 UTC (rev 4703) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 08:28:01 UTC (rev 4704) @@ -208,11 +208,6 @@ /** Bit field of edit types to show transparent. */ private int alphaType; - private final ArchetypeParser archetypeParser; - - /** The Animation Objects. */ - private final AnimationObjects<AnimationObject> animationObjects; - /** The Face Objects. */ private final FaceObjects faceObjects = new FaceObjects(); @@ -285,7 +280,7 @@ globalSettings.readGlobalSettings(); ScriptArchEditor.setGlobalSettings(globalSettings, this); ScriptedEventEditor.setGlobalSettings(globalSettings); - animationObjects = new daieditor.gameobject.anim.AnimationObjects(); + final AnimationObjects<AnimationObject> animationObjects = new daieditor.gameobject.anim.AnimationObjects(); GameObject.setAnimationObjects(animationObjects); archetypeSet = new ArchetypeSet(this, globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); GameObject.setArchetypeSet(archetypeSet); @@ -391,7 +386,7 @@ 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); + final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists); archetypeSet.loadArchetypes(archetypeParser); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-02 08:34:34
|
Revision: 4708 http://gridarta.svn.sourceforge.net/gridarta/?rev=4708&view=rev Author: akirschbaum Date: 2008-08-02 08:34:42 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Remove MainControl.getMainActions(). 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-08-02 08:34:00 UTC (rev 4707) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 08:34:42 UTC (rev 4708) @@ -776,12 +776,6 @@ return objectChooser; } - /** {@inheritDoc} */ - @NotNull - public MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic> getMainActions() { - return mainActions; - } - public void processFile(final String filelist) throws IOException { try { final BufferedReader reader = new BufferedReader(new FileReader(filelist)); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 08:34:00 UTC (rev 4707) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 08:34:42 UTC (rev 4708) @@ -968,12 +968,6 @@ return objectChooser; } - /** {@inheritDoc} */ - @NotNull - public MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic> getMainActions() { - return mainActions; - } - /** * Run in batch png mode. * @param args the argument strings that were not parsed away by {@link Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-02 08:34:00 UTC (rev 4707) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-02 08:34:42 UTC (rev 4708) @@ -22,7 +22,6 @@ import java.io.File; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.map.MapView; @@ -123,13 +122,6 @@ ObjectChooser<G, A, R> getObjectChooser(); /** - * Returns the main actions. - * @return the main actions - */ - @NotNull - MainActions<G, A, R, V> getMainActions(); - - /** * Returns a guess for a script directory to use. * @return the directory */ Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-02 08:34:00 UTC (rev 4707) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-02 08:34:42 UTC (rev 4708) @@ -476,12 +476,6 @@ public ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> getObjectChooser() { throw new AssertionError(); } - - /** {@inheritDoc} */ - @NotNull - public MainActions<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> getMainActions() { - 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-02 08:38:42
|
Revision: 4709 http://gridarta.svn.sourceforge.net/gridarta/?rev=4709&view=rev Author: akirschbaum Date: 2008-08-02 08:38:48 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Remove calls to MainControl.getObjectChooser(). 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-08-02 08:34:42 UTC (rev 4708) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 08:38:48 UTC (rev 4709) @@ -318,7 +318,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, mainView); + gameObjectAttributesPanel = new GameObjectAttributesPanel(this, objectChooser, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); PluginParameterFactory.init(archetypeSet, gameObjectAttributesPanel, objectChooser, mapManager); final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); final CFilterControl filterControl = new CFilterControl(null, mapManager, defaultNamedFilterList); Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java 2008-08-02 08:34:42 UTC (rev 4708) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java 2008-08-02 08:38:48 UTC (rev 4709) @@ -29,6 +29,7 @@ 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.ObjectChooser; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; @@ -47,8 +48,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, @NotNull final Frame parent) { - super(mainControl, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, parent); + public GameObjectAttributesPanel(@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(mainControl, objectChooser, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, parent); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 08:34:42 UTC (rev 4708) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 08:38:48 UTC (rev 4709) @@ -384,7 +384,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, mainView); + gameObjectAttributesPanel = new GameObjectAttributesPanel(this, objectChooser, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java 2008-08-02 08:34:42 UTC (rev 4708) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java 2008-08-02 08:38:48 UTC (rev 4709) @@ -29,6 +29,7 @@ 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.ObjectChooser; import net.sf.gridarta.gui.connectionview.LockedItemsControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; @@ -47,8 +48,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, @NotNull final Frame parent) { - super(mainControl, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, parent); + public GameObjectAttributesPanel(@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(mainControl, objectChooser, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, parent); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-08-02 08:34:42 UTC (rev 4708) +++ trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-08-02 08:38:48 UTC (rev 4709) @@ -111,6 +111,12 @@ /** The MainControl to use, e.g. for accessing AnimationObjects. */ private final MainControl<G, A, R, V> mainControl; + /** + * The object chooser instance. + */ + @NotNull + private final ObjectChooser<G, A, R> objectChooser; + /** The archetype type set. */ @NotNull private final ArchetypeTypeSet<G, A, R> archetypeTypeSet; @@ -284,14 +290,16 @@ * Create the GameObjectAttributesPanel. * @param mainControl MainControl to use, e.g. for accessing * AnimationObjects. + * @param objectChooser the object chooser instance * @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, @NotNull final Frame parent) { + protected GameObjectAttributesPanel(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @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.objectChooser = objectChooser; this.archetypeTypeSet = archetypeTypeSet; this.mapManager = mapManager; this.animationObjects = animationObjects; @@ -674,7 +682,7 @@ */ @ActionMethod public void mapArchAddInv() { - final G arch = mainControl.getObjectChooser().getObjectChooserHighlight(); + final G arch = objectChooser.getObjectChooserHighlight(); if (arch == null) { // nothing selected? return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-02 19:16:37
|
Revision: 4710 http://gridarta.svn.sourceforge.net/gridarta/?rev=4710&view=rev Author: akirschbaum Date: 2008-08-02 19:16:35 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java trunk/src/app/net/sf/gridarta/map/InsertionMode.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 08:38:48 UTC (rev 4709) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 19:16:35 UTC (rev 4710) @@ -203,7 +203,7 @@ /** The factory for creating new maps or pickmaps. */ private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; - /** + /** * The {@link GameObjectAttributesDialogFactory} to use. */ @NotNull Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-08-02 08:38:48 UTC (rev 4709) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-08-02 19:16:35 UTC (rev 4710) @@ -153,7 +153,7 @@ * into a temporary regular file and returns the copy. * @param faceFile the input file * @return the output file which is a regular file on the file system - * @todo remove this method when CrossfireEditor does not anymore embed crossfire.0 + * @todo remove this method when CrossfireEditor does not anymore embed crossfire.0 */ private static File makeTmpFaceFile(final File faceFile) { if (faceFile.exists()) { Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-08-02 08:38:48 UTC (rev 4709) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-08-02 19:16:35 UTC (rev 4710) @@ -64,6 +64,7 @@ /** The {@link MouseListener} attached to the view to process mouse actions. */ private final MouseListener mouseListener = new MouseAdapter() { + /** {@inheritDoc} */ @Override public void mousePressed(final MouseEvent e) { Modified: trunk/src/app/net/sf/gridarta/map/InsertionMode.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/InsertionMode.java 2008-08-02 08:38:48 UTC (rev 4709) +++ trunk/src/app/net/sf/gridarta/map/InsertionMode.java 2008-08-02 19:16:35 UTC (rev 4710) @@ -27,7 +27,7 @@ /** * Insertion modes. - * @todo make replacement of multi-part objects work + * @todo make replacement of multi-part objects work * @author Andreas Kirschbaum */ public enum InsertionMode { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-02 19:56:25
|
Revision: 4716 http://gridarta.svn.sourceforge.net/gridarta/?rev=4716&view=rev Author: akirschbaum Date: 2008-08-02 19:56:28 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Convert ReplaceDialogManager from utility class to normal class. 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/MainActions.java trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 19:32:08 UTC (rev 4715) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 19:56:28 UTC (rev 4716) @@ -77,6 +77,7 @@ import net.sf.gridarta.gui.MapPreview; import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.RecentManager; +import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; @@ -237,8 +238,10 @@ 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>(); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); + final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, replaceDialogManager, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); + replaceDialogManager.setObjectChooser(objectChooser); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); 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); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 19:32:08 UTC (rev 4715) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 19:56:28 UTC (rev 4716) @@ -86,6 +86,7 @@ import net.sf.gridarta.gui.MapPreview; import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.RecentManager; +import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.StatusBar; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; @@ -300,8 +301,10 @@ 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>(); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); + final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, replaceDialogManager, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); + replaceDialogManager.setObjectChooser(objectChooser); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, archetypeSet, faceObjects); createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); Modified: trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-08-02 19:32:08 UTC (rev 4715) +++ trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-08-02 19:56:28 UTC (rev 4716) @@ -32,7 +32,6 @@ 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; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserListener; @@ -96,14 +95,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 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) { + public DefaultObjectChooser(final MainControl<G, A, R, V> mainControl, @NotNull final ReplaceDialogManager<G, A, R, V> replaceDialogManager, @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; @@ -120,7 +118,7 @@ }); toolPalette = new ToolPalette<G, A, R, V>(mainControl, editTypes, selectedSquareView, this, pickmapChooserControl, copyBuffer); - objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(mainControl, archetypeSet, archetypeTypeSet, copyBuffer, this); + objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(replaceDialogManager, archetypeTypeSet, 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/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-02 19:32:08 UTC (rev 4715) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-02 19:56:28 UTC (rev 4716) @@ -65,6 +65,12 @@ */ public final class MainActions<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { + /** + * The replace dialog manager to use. + */ + @NotNull + private final ReplaceDialogManager<G, A, R, V> replaceDialogManager; + /** The MainControl. */ private final MainControl<G, A, R, V> mainControl; @@ -294,6 +300,7 @@ /** * Create a new instance. + * @param replaceDialogManager the replace dialog manager to use * @param mainControl the MainControl * @param editTypes the edit types instance * @param archetypeSet the archetype set @@ -305,7 +312,8 @@ * @param objectChooser the animation objects instance to use * @param mapManager the map manager instance */ - public MainActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager) { + public MainActions(@NotNull final ReplaceDialogManager<G, A, R, V> replaceDialogManager, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager) { + this.replaceDialogManager = replaceDialogManager; this.mainControl = mainControl; this.editTypes = editTypes; this.archetypeSet = archetypeSet; @@ -462,7 +470,7 @@ public void replace() { final MapView<G, A, R, V> mapView = getReplaceEnabled(); if (mapView != null) { - ReplaceDialogManager.getInstance(mainControl, archetypeSet, copyBuffer, objectChooser).display(mapView); + replaceDialogManager.getInstance().display(mapView); } } Modified: trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java 2008-08-02 19:32:08 UTC (rev 4715) +++ trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java 2008-08-02 19:56:28 UTC (rev 4716) @@ -24,12 +24,9 @@ import java.awt.GridBagLayout; import javax.swing.JLabel; import javax.swing.JPanel; -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; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; @@ -46,21 +43,17 @@ /** Serial Version UID. */ private static final long serialVersionUID = 1L; - /** Controller of this subview. */ - private final MainControl<G, A, R, V> mainControl; - - /** The archetype set. */ + /** + * The replace dialog manager to notify. + * XXX: use callback instead + */ @NotNull - private final ArchetypeSet<G, A, R> archetypeSet; + private final ReplaceDialogManager<G, A, R, V> replaceDialogManager; /** 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; - /** The ObjectChooser to use. */ @NotNull private final ObjectChooser<G, A, R> objectChooser; @@ -81,11 +74,9 @@ private final JLabel archTileText = new JLabel(); - 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; + public ObjectChoiceDisplay(@NotNull final ReplaceDialogManager<G, A, R, V> replaceDialogManager, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final ObjectChooser<G, A, R> objectChooser) { + this.replaceDialogManager = replaceDialogManager; this.archetypeTypeSet = archetypeTypeSet; - this.copyBuffer = copyBuffer; this.objectChooser = objectChooser; setLayout(new GridBagLayout()); @@ -167,8 +158,8 @@ } // notify ReplaceDialog - if (ReplaceDialogManager.isBuilt() && ReplaceDialogManager.getInstance(mainControl, archetypeSet, copyBuffer, objectChooser).isShowing()) { - ReplaceDialogManager.getInstance(mainControl, archetypeSet, copyBuffer, objectChooser).updateArchSelection(headObject, false); + if (replaceDialogManager.isBuilt() && replaceDialogManager.getInstance().isShowing()) { + replaceDialogManager.getInstance().updateArchSelection(headObject, false); } } } Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java 2008-08-02 19:32:08 UTC (rev 4715) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java 2008-08-02 19:56:28 UTC (rev 4716) @@ -8,32 +8,53 @@ import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; -public class ReplaceDialogManager { +public class ReplaceDialogManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { - /** Singleton Instance. */ - private static ReplaceDialog<?, ?, ?, ?> instance = null; - /** - * Private constructor to prevent instantiation. + * Singleton Instance. */ - private ReplaceDialogManager() { + @Nullable + private ReplaceDialog<G, A, R, V> instance = null; + + @NotNull + private final MainControl<G, A, R, V> mainControl; + + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + @NotNull + private final CopyBuffer<G, A, R, V> copyBuffer; + + @NotNull + private ObjectChooser<G, A, R> objectChooser; + + public ReplaceDialogManager(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + this.mainControl = mainControl; + this.archetypeSet = archetypeSet; + this.copyBuffer = copyBuffer; } + public void setObjectChooser(@NotNull final ObjectChooser<G, A, R> objectChooser) { + this.objectChooser = objectChooser; + } + /** * Returns whether this frame has been fully built. * @return <code>true</code> if this frame has been fully built, otherwise * <code>false</code> */ - public static boolean isBuilt() { + public boolean isBuilt() { return instance != null && instance.isBuilt(); } - public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> ReplaceDialog<G, A, R, V> getInstance(@NotNull 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) { + @NotNull + public ReplaceDialog<G, A, R, V> getInstance() { if (instance == null) { instance = new ReplaceDialog<G, A, R, V>(mainControl, archetypeSet, copyBuffer, objectChooser); } - return (ReplaceDialog<G, A, R, V>) instance; + return instance; } } // class ReplaceDialogManager This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-02 20:26:08
|
Revision: 4718 http://gridarta.svn.sourceforge.net/gridarta/?rev=4718&view=rev Author: akirschbaum Date: 2008-08-02 20:25:45 +0000 (Sat, 02 Aug 2008) Log Message: ----------- Move object chooser related classes into separate package. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBox.java trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxEditor.java trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java trunk/crossfire/src/cfeditor/script/parameter/PluginParameterFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/objectchooser/ trunk/src/app/net/sf/gridarta/gui/objectchooser/ArchNPickChangeListener.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/ArchNPickChangeListener.java trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -68,14 +68,12 @@ 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; import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; import net.sf.gridarta.gui.MapManagerActions; import net.sf.gridarta.gui.MapPreview; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.RecentManager; import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.StatusBar; @@ -87,6 +85,8 @@ import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.tools.DeletionTool; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; +import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.prefs.MapValidatorPrefs; import net.sf.gridarta.gui.prefs.MiscPrefs; Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -44,11 +44,11 @@ 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.DefaultObjectChooser; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; +import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; Modified: trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/crossfire/src/cfeditor/gui/GameObjectAttributesPanel.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -29,8 +29,8 @@ 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.ObjectChooser; import net.sf.gridarta.gui.connectionview.LockedItemsControl; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import org.jetbrains.annotations.NotNull; Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBox.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBox.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBox.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -27,7 +27,7 @@ import java.awt.Dimension; import javax.swing.JComboBox; import net.sf.gridarta.gui.GameObjectAttributesPanel; -import net.sf.gridarta.gui.ObjectChooser; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxEditor.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBoxEditor.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -45,7 +45,7 @@ import javax.swing.event.DocumentListener; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.gui.GameObjectAttributesPanel; -import net.sf.gridarta.gui.ObjectChooser; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import org.jetbrains.annotations.Nullable; public class ArchComboBoxEditor implements ComboBoxEditor { Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -31,7 +31,7 @@ import javax.swing.JComponent; import javax.swing.JPanel; import net.sf.gridarta.gui.GameObjectAttributesPanel; -import net.sf.gridarta.gui.ObjectChooser; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import org.jetbrains.annotations.NotNull; public class ArchParameterView implements PluginParameterView { Modified: trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -27,7 +27,7 @@ import cfeditor.gui.script.parameter.PluginParameterView; import cfeditor.map.MapArchObject; import net.sf.gridarta.gui.GameObjectAttributesPanel; -import net.sf.gridarta.gui.ObjectChooser; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import org.jdom.Element; import org.jetbrains.annotations.NotNull; Modified: trunk/crossfire/src/cfeditor/script/parameter/PluginParameterFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/PluginParameterFactory.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/crossfire/src/cfeditor/script/parameter/PluginParameterFactory.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -28,7 +28,7 @@ import java.util.Map; import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.GameObjectAttributesPanel; -import net.sf.gridarta.gui.ObjectChooser; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import org.apache.log4j.Logger; import org.jdom.Element; import org.jetbrains.annotations.NotNull; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -76,7 +76,6 @@ 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; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.MainActions; @@ -84,7 +83,6 @@ import net.sf.gridarta.gui.MapFileFilter; import net.sf.gridarta.gui.MapManagerActions; import net.sf.gridarta.gui.MapPreview; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.RecentManager; import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.StatusBar; @@ -96,6 +94,8 @@ import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.tools.DeletionTool; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; +import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.prefs.MapValidatorPrefs; import net.sf.gridarta.gui.prefs.MiscPrefs; Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -44,11 +44,11 @@ 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.DefaultObjectChooser; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; +import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; Modified: trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/daimonin/src/daieditor/gui/GameObjectAttributesPanel.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -29,8 +29,8 @@ 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.ObjectChooser; import net.sf.gridarta.gui.connectionview.LockedItemsControl; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -29,11 +29,11 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.face.FaceObjects; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.io.MapArchObjectParser; Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -23,9 +23,9 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.MainView; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; Deleted: trunk/src/app/net/sf/gridarta/gui/ArchNPickChangeListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ArchNPickChangeListener.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/ArchNPickChangeListener.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -1,61 +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 net.sf.gridarta.gui; - -import javax.swing.JTabbedPane; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import org.jetbrains.annotations.NotNull; - -/** - * In the left-side panel, archlist and pickmaps are exclusive (only the one - * being displayed is active). This listener gets to know which of them is - * active and keeps the object chooser informed whenever the state changes. - * @author Andreas Kirschbaum - */ -public final class ArchNPickChangeListener implements ChangeListener { - - /** The Object Chooser to inform about changes. */ - private final ObjectChooser<?, ?, ?> objectChooser; - - private final JTabbedPane tabpane; // parent pane for archlist & pickmaps - - private int selectedIndex; // current state of selection - - /** - * Create an ArchNPickChangeListener. - * @param objectChooser The Object Chooser to inform about changes. - * @param pane the JTabbedPane containing both archlist and pickmaps - */ - public ArchNPickChangeListener(@NotNull final ObjectChooser<?, ?, ?> objectChooser, @NotNull final JTabbedPane pane) { - this.objectChooser = objectChooser; - tabpane = pane; - selectedIndex = tabpane.getSelectedIndex(); - } - - public void stateChanged(final ChangeEvent e) { - if (tabpane.getSelectedIndex() != selectedIndex) { - // the state has changed, user has switched panels - objectChooser.setPickmapActive(tabpane.getSelectedIndex() != 0); - selectedIndex = tabpane.getSelectedIndex(); // save new state - } - } - -} // class ArchNPickChangeListener Modified: trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -27,6 +27,7 @@ import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserListener; import net.sf.gridarta.gui.findarchetypes.FindArchetypesDialog; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ToggleAction; Deleted: trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -1,208 +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 net.sf.gridarta.gui; - -import java.awt.BorderLayout; -import java.awt.Point; -import java.util.List; -import javax.swing.JMenu; -import javax.swing.JPanel; -import javax.swing.JSplitPane; -import javax.swing.JTabbedPane; -import javax.swing.SwingConstants; -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.GameObject; -import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; -import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserListener; -import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.gui.map.tools.ToolPalette; -import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; -import net.sf.gridarta.gui.pickmapchooser.PickmapChooserListener; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; -import net.sf.gridarta.map.InsertionMode; -import net.sf.gridarta.map.MapArchObject; -import net.sf.gridarta.map.MapModel; -import net.sf.japi.swing.ActionFactory; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * The object Chooser implementation. - * @author Andreas Kirschbaum - */ -public class DefaultObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends JPanel implements ObjectChooser<G, A, R> { - - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - - /** The serial version UID. */ - private static final long serialVersionUID = 1; - - /** The archetype chooser control. */ - private final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl; - - /** The archetype chooser control. */ - private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; - - /** ToolSelector of this subview. */ - private final ToolPalette<G, A, R, V> toolPalette; - - /** Panel holding both archlist and pickmaps. */ - private final JTabbedPane archAndPickPane = new JTabbedPane(SwingConstants.TOP); - - /** The data/view of selected objects in tab panel. */ - private final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay; - - /** - * The listener attached to {@link #pickmapChooserControl}. - */ - private final PickmapChooserListener pickmapChooserListener = new PickmapChooserListener() { - - /** {@inheritDoc} */ - public void activePickmapChanged() { - showObjectChooserQuickObject(null); - } - - }; - - /** - * <code>true</code> if the PickmapChooser is active, <code>false</code> if - * the Archetype Chooser is active. - */ - private boolean pickmapActive = false; - - /** - * Creates a new instance. - * @param mainControl the main control - * @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 ReplaceDialogManager<G, A, R, V> replaceDialogManager, @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; - archetypeChooserControl.addArchetypeChooserListener(new ArchetypeChooserListener<G, A, R>() { - /** {@inheritDoc} */ - public void selectedArchetypeChanged(@Nullable final G archetype) { - showObjectChooserQuickObject(archetype); - } - - /** {@inheritDoc} */ - public void displayObjectNamesChanged(final boolean displayObjectNames) { - // ignore - } - }); - toolPalette = new ToolPalette<G, A, R, V>(mainControl, editTypes, selectedSquareView, this, pickmapChooserControl, copyBuffer); - - objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(replaceDialogManager, archetypeTypeSet, this); - - // archAndPickPane is the panel containing both archpanel and pickmaps - archAndPickPane.addTab(ACTION_FACTORY.getString("objectChooser.archetypesTabTitle"), archetypeChooserControl.getArchetypePanel()); - archAndPickPane.addTab(ACTION_FACTORY.getString("objectChooser.pickmapsTabTitle"), pickmapChooserControl.getPickmapPanel()); - // this listener informs the mainview which panel is active: archlist or pickmaps? - archAndPickPane.addChangeListener(new ArchNPickChangeListener(this, archAndPickPane)); - - // TODO: introduce a tool registry - final JSplitPane splitPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, toolPalette, archAndPickPane); - splitPane.setContinuousLayout(true); - add(splitPane, BorderLayout.CENTER); - add(objectChoiceDisplay, BorderLayout.SOUTH); - } - - /** {@inheritDoc} */ - public void setPickmapActive(final boolean pickmapActive) { - this.pickmapActive = pickmapActive; - pickmapChooserControl.setActive(pickmapActive); - } - - /** {@inheritDoc} */ - public boolean isPickmapActive() { - return pickmapActive; - } - - /** {@inheritDoc} */ - public void setPickmapFoldersMenu(@Nullable final JMenu folderMenu) { - pickmapChooserControl.setPickmapFoldersMenu(folderMenu); - } - - /** - * Returns whether a given game object matches the selection. - * @param gameObject the game object to check - * @return whether the game object matches - */ - public boolean isMatching(final G gameObject) { - return pickmapActive ? pickmapChooserControl.isMatching(gameObject) : archetypeChooserControl.isMatching(gameObject); - } - - /** {@inheritDoc} */ - @Nullable - public G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point pos, final boolean allowMany, final InsertionMode insertionMode) { - return pickmapActive ? pickmapChooserControl.insertSelectedObject(mapModel, pos, allowMany, insertionMode) : archetypeChooserControl.insertSelectedArchetype(mapModel, pos, allowMany, insertionMode); - } - - /** {@inheritDoc} */ - public void moveArchetypeChooserToFront() { - archAndPickPane.setSelectedIndex(0); - } - - /** {@inheritDoc} */ - public void movePickmapChooserToFront() { - archAndPickPane.setSelectedIndex(1); - } - - /** {@inheritDoc} */ - public void showObjectChooserQuickObject(@Nullable final G gameObject) { - objectChoiceDisplay.showObjectChooserQuickObject(gameObject); - } - - /** {@inheritDoc} */ - @Nullable - public G getObjectChooserHighlight() { - return pickmapActive ? pickmapChooserControl.getSelection() : archetypeChooserControl.getSelection(); - } - - /** {@inheritDoc} */ - @NotNull - public List<G> getObjectChooserSelection() { - return pickmapActive ? pickmapChooserControl.getSelections() : archetypeChooserControl.getSelections(); - } - - /** - * Returns the tool selector pane. - * @return The tool selector pane. - */ - public ToolPalette<G, A, R, V> getToolSelectorPane() { - return toolPalette; - } - - /** {@inheritDoc} */ - public void selectArchetype(final R archetype) { - moveArchetypeChooserToFront(); - archetypeChooserControl.selectArchetype(archetype); - } - -} // class AbstractObjectChooser Modified: trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -60,6 +60,7 @@ import net.sf.gridarta.gui.gameobjecttexteditor.GameObjectTextEditor; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareListener; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -45,6 +45,7 @@ import net.sf.gridarta.gui.map.MapGridListener; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -52,6 +52,7 @@ import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.ViewActions; +import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.help.Help; import net.sf.gridarta.map.MapArchObject; Modified: trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -29,6 +29,7 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.map.MapArchObject; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Deleted: trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -1,119 +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 net.sf.gridarta.gui; - -import java.awt.Point; -import java.util.List; -import javax.swing.JMenu; -import net.sf.gridarta.gameobject.Archetype; -import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.map.InsertionMode; -import net.sf.gridarta.map.MapArchObject; -import net.sf.gridarta.map.MapModel; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * Common base interface for ObjectChoosers. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public interface ObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { - - /** - * Return if the Pickmap Chooser is active. - * @return <code>true</code> if the Pickmap Chooser is active, or - * <code>false</code> if the Archetype Chooser is active. - */ - boolean isPickmapActive(); - - /** - * Set whether the Pickmap Chooser is active. - * @param pickmapActive <code>true</code> if the Pickmap Chooser is active, - * <code>false</code> if the Archetype Chooser is active. - */ - void setPickmapActive(boolean pickmapActive); - - /** - * Show the given game object's attributes in the quick panel. - * @param gameObject the game object to show, or <code>null</code> to clear - * the attributes - */ - void showObjectChooserQuickObject(@Nullable G gameObject); - - /** Move the Archetype Chooser in front of the Pickmap Chooser. */ - void moveArchetypeChooserToFront(); - - /** Move the Pickmap Chooser in front of the Archetype Chooser. */ - void movePickmapChooserToFront(); - - /** - * Returns the active arch in the left-side panel. This can either be a - * default arch from the archlist, or a custom arch from a pickmap. - * IMPORTANT: The returned GameObject is not a clone. A copy must be - * generated before inserting such an arch to the map. - * @return the active arch in the left-side panel - */ - @Nullable - G getObjectChooserHighlight(); - - /** - * Returns the selected arches in the left-side panel. This can either be - * default arches, or custom arches from a pickmap. IMPORTANT: The returned - * GameObject list contains no clone. A copy must be generated before - * inserting such arches to the map. - * @return the selected arches in the left-side panel - */ - @NotNull - List<G> getObjectChooserSelection(); - - /** - * Select an archetype in the archetype chooser. If necessary, activates - * archetype chooser. - * @param archetype The archetype to selected. - */ - void selectArchetype(R archetype); - - /** - * Add the selected game object to the map. - * @param mapModel the map model to add to - * @param pos The location to add to. - * @param allowMany Whether to allow multiple copies of the inserted game - * object. - * @param insertionMode the insertion mode to use - * @return The inserted game object, or <code>null</code> if nothing was - * inserted. - */ - @Nullable - G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull Point pos, boolean allowMany, InsertionMode insertionMode); - - /** - * Sets the pickmap folders menu to manage. - * @param folderMenu the pickmap folders menu - */ - void setPickmapFoldersMenu(@Nullable JMenu folderMenu); - - /** - * Returns whether the current selection matches a given game object. - * @param gameObject the game object to match - * @return whether the game object matches the selection - */ - boolean isMatching(final G gameObject); - -} // interface ObjectChooser Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialog.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -45,6 +45,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -6,6 +6,7 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.map.MapArchObject; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -47,8 +47,8 @@ import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -31,10 +31,10 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.match.GameObjectMatcher; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.event.MouseOpEvent; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.undo.SwingUtils; import net.sf.gridarta.map.MapArchObject; Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/InsertionTool.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -27,10 +27,10 @@ import javax.swing.JPanel; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.event.MouseOpEvent; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.undo.SwingUtils; Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -29,11 +29,11 @@ import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapGrid; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.event.MouseOpEvent; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.undo.SwingUtils; import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -30,9 +30,9 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.event.MouseOpEvent; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.map.MapArchObject; Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -37,8 +37,8 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.map.MapArchObject; Copied: trunk/src/app/net/sf/gridarta/gui/objectchooser/ArchNPickChangeListener.java (from rev 4717, trunk/src/app/net/sf/gridarta/gui/ArchNPickChangeListener.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/ArchNPickChangeListener.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/ArchNPickChangeListener.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -0,0 +1,61 @@ +/* + * 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 net.sf.gridarta.gui.objectchooser; + +import javax.swing.JTabbedPane; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +import org.jetbrains.annotations.NotNull; + +/** + * In the left-side panel, archlist and pickmaps are exclusive (only the one + * being displayed is active). This listener gets to know which of them is + * active and keeps the object chooser informed whenever the state changes. + * @author Andreas Kirschbaum + */ +public final class ArchNPickChangeListener implements ChangeListener { + + /** The Object Chooser to inform about changes. */ + private final ObjectChooser<?, ?, ?> objectChooser; + + private final JTabbedPane tabpane; // parent pane for archlist & pickmaps + + private int selectedIndex; // current state of selection + + /** + * Create an ArchNPickChangeListener. + * @param objectChooser The Object Chooser to inform about changes. + * @param pane the JTabbedPane containing both archlist and pickmaps + */ + public ArchNPickChangeListener(@NotNull final ObjectChooser<?, ?, ?> objectChooser, @NotNull final JTabbedPane pane) { + this.objectChooser = objectChooser; + tabpane = pane; + selectedIndex = tabpane.getSelectedIndex(); + } + + public void stateChanged(final ChangeEvent e) { + if (tabpane.getSelectedIndex() != selectedIndex) { + // the state has changed, user has switched panels + objectChooser.setPickmapActive(tabpane.getSelectedIndex() != 0); + selectedIndex = tabpane.getSelectedIndex(); // save new state + } + } + +} // class ArchNPickChangeListener Property changes on: trunk/src/app/net/sf/gridarta/gui/objectchooser/ArchNPickChangeListener.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF Copied: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java (from rev 4716, trunk/src/app/net/sf/gridarta/gui/DefaultObjectChooser.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -0,0 +1,211 @@ +/* + * 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 net.sf.gridarta.gui.objectchooser; + +import java.awt.BorderLayout; +import java.awt.Point; +import java.util.List; +import javax.swing.JMenu; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.JTabbedPane; +import javax.swing.SwingConstants; +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.GameObject; +import net.sf.gridarta.gui.GSplitPane; +import net.sf.gridarta.gui.ObjectChoiceDisplay; +import net.sf.gridarta.gui.ReplaceDialogManager; +import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; +import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserListener; +import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.map.tools.ToolPalette; +import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; +import net.sf.gridarta.gui.pickmapchooser.PickmapChooserListener; +import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; +import net.sf.gridarta.map.InsertionMode; +import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.MapModel; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * The object Chooser implementation. + * @author Andreas Kirschbaum + */ +public class DefaultObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends JPanel implements ObjectChooser<G, A, R> { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); + + /** The serial version UID. */ + private static final long serialVersionUID = 1; + + /** The archetype chooser control. */ + private final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl; + + /** The archetype chooser control. */ + private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; + + /** ToolSelector of this subview. */ + private final ToolPalette<G, A, R, V> toolPalette; + + /** Panel holding both archlist and pickmaps. */ + private final JTabbedPane archAndPickPane = new JTabbedPane(SwingConstants.TOP); + + /** The data/view of selected objects in tab panel. */ + private final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay; + + /** + * The listener attached to {@link #pickmapChooserControl}. + */ + private final PickmapChooserListener pickmapChooserListener = new PickmapChooserListener() { + + /** {@inheritDoc} */ + public void activePickmapChanged() { + showObjectChooserQuickObject(null); + } + + }; + + /** + * <code>true</code> if the PickmapChooser is active, <code>false</code> if + * the Archetype Chooser is active. + */ + private boolean pickmapActive = false; + + /** + * Creates a new instance. + * @param mainControl the main control + * @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 ReplaceDialogManager<G, A, R, V> replaceDialogManager, @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; + archetypeChooserControl.addArchetypeChooserListener(new ArchetypeChooserListener<G, A, R>() { + /** {@inheritDoc} */ + public void selectedArchetypeChanged(@Nullable final G archetype) { + showObjectChooserQuickObject(archetype); + } + + /** {@inheritDoc} */ + public void displayObjectNamesChanged(final boolean displayObjectNames) { + // ignore + } + }); + toolPalette = new ToolPalette<G, A, R, V>(mainControl, editTypes, selectedSquareView, this, pickmapChooserControl, copyBuffer); + + objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(replaceDialogManager, archetypeTypeSet, this); + + // archAndPickPane is the panel containing both archpanel and pickmaps + archAndPickPane.addTab(ACTION_FACTORY.getString("objectChooser.archetypesTabTitle"), archetypeChooserControl.getArchetypePanel()); + archAndPickPane.addTab(ACTION_FACTORY.getString("objectChooser.pickmapsTabTitle"), pickmapChooserControl.getPickmapPanel()); + // this listener informs the mainview which panel is active: archlist or pickmaps? + archAndPickPane.addChangeListener(new ArchNPickChangeListener(this, archAndPickPane)); + + // TODO: introduce a tool registry + final JSplitPane splitPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, toolPalette, archAndPickPane); + splitPane.setContinuousLayout(true); + add(splitPane, BorderLayout.CENTER); + add(objectChoiceDisplay, BorderLayout.SOUTH); + } + + /** {@inheritDoc} */ + public void setPickmapActive(final boolean pickmapActive) { + this.pickmapActive = pickmapActive; + pickmapChooserControl.setActive(pickmapActive); + } + + /** {@inheritDoc} */ + public boolean isPickmapActive() { + return pickmapActive; + } + + /** {@inheritDoc} */ + public void setPickmapFoldersMenu(@Nullable final JMenu folderMenu) { + pickmapChooserControl.setPickmapFoldersMenu(folderMenu); + } + + /** + * Returns whether a given game object matches the selection. + * @param gameObject the game object to check + * @return whether the game object matches + */ + public boolean isMatching(final G gameObject) { + return pickmapActive ? pickmapChooserControl.isMatching(gameObject) : archetypeChooserControl.isMatching(gameObject); + } + + /** {@inheritDoc} */ + @Nullable + public G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Point pos, final boolean allowMany, final InsertionMode insertionMode) { + return pickmapActive ? pickmapChooserControl.insertSelectedObject(mapModel, pos, allowMany, insertionMode) : archetypeChooserControl.insertSelectedArchetype(mapModel, pos, allowMany, insertionMode); + } + + /** {@inheritDoc} */ + public void moveArchetypeChooserToFront() { + archAndPickPane.setSelectedIndex(0); + } + + /** {@inheritDoc} */ + public void movePickmapChooserToFront() { + archAndPickPane.setSelectedIndex(1); + } + + /** {@inheritDoc} */ + public void showObjectChooserQuickObject(@Nullable final G gameObject) { + objectChoiceDisplay.showObjectChooserQuickObject(gameObject); + } + + /** {@inheritDoc} */ + @Nullable + public G getObjectChooserHighlight() { + return pickmapActive ? pickmapChooserControl.getSelection() : archetypeChooserControl.getSelection(); + } + + /** {@inheritDoc} */ + @NotNull + public List<G> getObjectChooserSelection() { + return pickmapActive ? pickmapChooserControl.getSelections() : archetypeChooserControl.getSelections(); + } + + /** + * Returns the tool selector pane. + * @return The tool selector pane. + */ + public ToolPalette<G, A, R, V> getToolSelectorPane() { + return toolPalette; + } + + /** {@inheritDoc} */ + public void selectArchetype(final R archetype) { + moveArchetypeChooserToFront(); + archetypeChooserControl.selectArchetype(archetype); + } + +} // class AbstractObjectChooser Copied: trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java (from rev 4716, trunk/src/app/net/sf/gridarta/gui/ObjectChooser.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -0,0 +1,119 @@ +/* + * 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 net.sf.gridarta.gui.objectchooser; + +import java.awt.Point; +import java.util.List; +import javax.swing.JMenu; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.InsertionMode; +import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.MapModel; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * Common base interface for ObjectChoosers. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public interface ObjectChooser<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * Return if the Pickmap Chooser is active. + * @return <code>true</code> if the Pickmap Chooser is active, or + * <code>false</code> if the Archetype Chooser is active. + */ + boolean isPickmapActive(); + + /** + * Set whether the Pickmap Chooser is active. + * @param pickmapActive <code>true</code> if the Pickmap Chooser is active, + * <code>false</code> if the Archetype Chooser is active. + */ + void setPickmapActive(boolean pickmapActive); + + /** + * Show the given game object's attributes in the quick panel. + * @param gameObject the game object to show, or <code>null</code> to clear + * the attributes + */ + void showObjectChooserQuickObject(@Nullable G gameObject); + + /** Move the Archetype Chooser in front of the Pickmap Chooser. */ + void moveArchetypeChooserToFront(); + + /** Move the Pickmap Chooser in front of the Archetype Chooser. */ + void movePickmapChooserToFront(); + + /** + * Returns the active arch in the left-side panel. This can either be a + * default arch from the archlist, or a custom arch from a pickmap. + * IMPORTANT: The returned GameObject is not a clone. A copy must be + * generated before inserting such an arch to the map. + * @return the active arch in the left-side panel + */ + @Nullable + G getObjectChooserHighlight(); + + /** + * Returns the selected arches in the left-side panel. This can either be + * default arches, or custom arches from a pickmap. IMPORTANT: The returned + * GameObject list contains no clone. A copy must be generated before + * inserting such arches to the map. + * @return the selected arches in the left-side panel + */ + @NotNull + List<G> getObjectChooserSelection(); + + /** + * Select an archetype in the archetype chooser. If necessary, activates + * archetype chooser. + * @param archetype The archetype to selected. + */ + void selectArchetype(R archetype); + + /** + * Add the selected game object to the map. + * @param mapModel the map model to add to + * @param pos The location to add to. + * @param allowMany Whether to allow multiple copies of the inserted game + * object. + * @param insertionMode the insertion mode to use + * @return The inserted game object, or <code>null</code> if nothing was + * inserted. + */ + @Nullable + G insertSelectedObject(@NotNull final MapModel<G, A, R> mapModel, @NotNull Point pos, boolean allowMany, InsertionMode insertionMode); + + /** + * Sets the pickmap folders menu to manage. + * @param folderMenu the pickmap folders menu + */ + void setPickmapFoldersMenu(@Nullable JMenu folderMenu); + + /** + * Returns whether the current selection matches a given game object. + * @param gameObject the game object to match + * @return whether the game object matches the selection + */ + boolean isMatching(final G gameObject); + +} // interface ObjectChooser Property changes on: trunk/src/app/net/sf/gridarta/gui/objectchooser/ObjectChooser.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-02 20:19:26 UTC (rev 4717) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-02 20:25:45 UTC (rev 4718) @@ -53,11 +53,11 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.GameObjectAttributesPanel; import net.sf.gridarta.gui.MainView; -import net.sf.gridarta.gui.ObjectChooser; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.GameObjectPars... [truncated message content] |
From: <aki...@us...> - 2008-08-03 13:46:13
|
Revision: 4720 http://gridarta.svn.sourceforge.net/gridarta/?rev=4720&view=rev Author: akirschbaum Date: 2008-08-03 13:46:19 +0000 (Sun, 03 Aug 2008) Log Message: ----------- Rewrite/cleanup archetype chooser. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/DirectionPane.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.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 Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserModel.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserModelListener.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserViewListener.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserListener.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 08:12:38 UTC (rev 4719) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 13:46:19 UTC (rev 4720) @@ -358,7 +358,7 @@ } scriptControl.loadScripts(new File(globalSettings.getMapDir(), IGUIConstants.SCRIPTS_DIR)); - archetypeChooserControl.finishBuildProcess(); + archetypeChooserControl.getArchetypeChooserView().finishBuildProcess(); // load the autojoin lists autojoinLists.loadList(archetypeSet, getConfigurationDirectory()); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 08:12:38 UTC (rev 4719) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 13:46:19 UTC (rev 4720) @@ -436,7 +436,7 @@ // browse arch archive // load object from a arch file you found - archetypeChooserControl.finishBuildProcess(); + archetypeChooserControl.getArchetypeChooserView().finishBuildProcess(); // load the autojoin lists autojoinLists.loadList(archetypeSet, getConfigurationDirectory()); Modified: trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java 2008-08-03 08:12:38 UTC (rev 4719) +++ trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java 2008-08-03 13:46:19 UTC (rev 4720) @@ -24,7 +24,8 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; -import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserListener; +import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserView; +import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserViewListener; import net.sf.gridarta.gui.findarchetypes.FindArchetypesDialog; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.objectchooser.ObjectChooser; @@ -32,7 +33,6 @@ import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ToggleAction; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Manages actions in the "archetypes" menu. @@ -47,14 +47,9 @@ private final ToggleAction aDisplayObjectNames; /** The listener to detect attribute changes. */ - private final ArchetypeChooserListener<G, A, R> archetypeChooserListener = new ArchetypeChooserListener<G, A, R>() { + private final ArchetypeChooserViewListener<G, A, R> archetypeChooserViewListener = new ArchetypeChooserViewListener<G, A, R>() { /** {@inheritDoc} */ - public void selectedArchetypeChanged(@Nullable final G archetype) { - // ignore - } - - /** {@inheritDoc} */ public void displayObjectNamesChanged(final boolean displayObjectNames) { updateActions(displayObjectNames); } @@ -65,16 +60,17 @@ * Create a new instance. * @param parent The parent component for the "find archetypes" dialog. * @param archetypeChooserControl The archetype chooser control. + * @param archetypeChooserView the archetype chooser view * @param objectChooser The insertion object chooser to use when selecting * search results in the "find archetypes" dialog. * @param archetypeTypeSet the instance for looking up archetype types */ - public ArchetypesActions(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R> objectChooser, final ArchetypeTypeSet archetypeTypeSet) { + public ArchetypesActions(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final ArchetypeChooserView<G, A, R, V> archetypeChooserView, @NotNull final ObjectChooser<G, A, R> objectChooser, final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { final FindArchetypesDialog<G, A, R> findArchetypesDialog = new FindArchetypesDialog<G, A, R>(parent, archetypeChooserControl, objectChooser, archetypeTypeSet); - aDisplayObjectNames = (ToggleAction) ACTION_FACTORY.createToggle(true, "displayObjectNames", archetypeChooserControl); + aDisplayObjectNames = (ToggleAction) ACTION_FACTORY.createToggle(true, "displayObjectNames", archetypeChooserView); ACTION_FACTORY.createAction(true, "findArchetypes", findArchetypesDialog); - archetypeChooserControl.addArchetypeChooserListener(archetypeChooserListener); - updateActions(archetypeChooserControl.isDisplayObjectNames()); + archetypeChooserView.addArchetypeChooserViewListener(archetypeChooserViewListener); + updateActions(archetypeChooserView.isDisplayObjectNames()); } /** Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-03 08:12:38 UTC (rev 4719) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-03 13:46:19 UTC (rev 4720) @@ -399,7 +399,7 @@ toolbarPanel.add(createCenterPanel(defwidth, defheight, selectedSquareView, mapTileListBottom, gameObjectAttributesPanel, objectChooser), BorderLayout.CENTER); add(toolbarPanel, BorderLayout.CENTER); - archetypesActions = new ArchetypesActions<G, A, R, V>(this, archetypeChooserControl, objectChooser, archetypeTypeSet); + archetypesActions = new ArchetypesActions<G, A, R, V>(this, archetypeChooserControl, archetypeChooserControl.getArchetypeChooserView(), objectChooser, archetypeTypeSet); setJMenuBar(actionFactory.createMenuBar(true, "main")); objectChooser.setPickmapFoldersMenu((JMenu) actionFactory.find(getJMenuBar(), "pickmapFolders")); viewActions.init(gameObjectMatchers); Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-08-03 08:12:38 UTC (rev 4719) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-08-03 13:46:19 UTC (rev 4720) @@ -19,7 +19,6 @@ package net.sf.gridarta.gui.archetypechooser; -import java.awt.BorderLayout; import java.awt.Point; import java.util.ArrayList; import java.util.Collections; @@ -27,16 +26,6 @@ import java.util.Iterator; import java.util.List; import java.util.Map; -import java.util.prefs.Preferences; -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.JTabbedPane; -import javax.swing.SwingConstants; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.event.EventListenerList; -import net.sf.gridarta.CommonConstants; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; @@ -49,88 +38,45 @@ import org.jetbrains.annotations.Nullable; /** - * That archetype chooser. + * That control of the archetype chooser. * @author Andreas Kirschbaum */ public class ArchetypeChooserControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> implements Iterable<R> { - /** Preferences. */ - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - /** - * The key for saving the display mode selection. + * Maps archetype to archetype panel containing the archetype. */ - private static final String DISPLAY_OBJECT_NAMES = "archetypesDisplayObjectNames"; + private final Map<R, ArchetypePanel<G, A, R, V>> archetypes = new HashMap<R, ArchetypePanel<G, A, R, V>>(); - /** The listeners to inform of changes. */ - private final EventListenerList listenerList = new EventListenerList(); - - /** The main control. */ - private final MainControl<G, A, R, V> mainControl; - /** - * The archetype set to display. + * The archetype chooser's model. */ - @NotNull - private final ArchetypeSet<G, A, R> archetypeSet; + private final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel; /** - * Name of the selected archetype. - * @serial include + * The archetype chooser's view. */ - private G selectedArch = null; + private final ArchetypeChooserView<G, A, R, V> archetypeChooserView; - /** The Tab panel with arch lists. */ - private final JTabbedPane tabDesktop = new JTabbedPane(SwingConstants.TOP); - - /** The active panel. */ - private ArchetypePanel<G, A, R, V> selectedPanel; - /** - * The panel which allows setting the direction of newly inserted - * archetypes. - */ - private final DirectionPane<G, A, R> directionPane = new DirectionPane<G, A, R>(); - - /** Maps archetype to panel containing the archetype. */ - private final Map<R, ArchetypePanel<G, A, R, V>> archetypes = new HashMap<R, ArchetypePanel<G, A, R, V>>(); - - /** - * The panel with the ArchetypePanel (tabDesktop) and the direction - * setting. - */ - private final JPanel archPane = new JPanel(new BorderLayout()); - - /** Indicates whether object names are shown. */ - private boolean displayObjectNames = prefs.getBoolean(DISPLAY_OBJECT_NAMES, false); - - /** - * Create a new instance. + * Creates a new instance. * @param mainControl The main control. * @param archetypeSet the archetype set to display * @param createDirectionPane Whether to create a "direction" panel. */ public ArchetypeChooserControl(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, final boolean createDirectionPane) { - this.mainControl = mainControl; - this.archetypeSet = archetypeSet; - tabDesktop.setBorder(BorderFactory.createEmptyBorder(CommonConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); - archPane.add(tabDesktop); - if (createDirectionPane) { - archPane.add(directionPane, BorderLayout.SOUTH); - } + archetypeChooserModel = new ArchetypeChooserModel<G, A, R, V>(archetypeSet); + archetypeChooserView = new ArchetypeChooserView<G, A, R, V>(createDirectionPane, mainControl, archetypeChooserModel); } - public JComponent getArchetypePanel() { - return archPane; - } - /** - * Get the currently selected archetype. + * Returns the currently selected archetype. * @return the selected archetype, or <code>null</code> if none is selected */ @Nullable - public G getSelection() { - return selectedPanel != null ? selectedPanel.getArchListObject() : null; + public R getSelection() { + final ArchetypePanel<G, A, R, V> selectedPanel = archetypeChooserModel.getSelectedPanel(); + return selectedPanel != null ? selectedPanel.getSelectedArchetype() : null; } /** @@ -138,176 +84,30 @@ * @return The selected archetypes. */ @NotNull - public List<G> getSelections() { - final G archObject = getSelection(); + public List<G> getSelections() { // XXX: should return List<R> + final R archObject = getSelection(); if (archObject == null) { return Collections.emptyList(); } final List<G> result = new ArrayList<G>(1); - result.add(archObject); + result.add((G) archObject); return result; } /** - * Return a panel by name. If this panel does not exist, create a new one. - * @param panelName the panel name - * @return the panel - */ - @NotNull - private ArchetypePanel<G, A, R, V> findOrCreatePanel(@NotNull final String panelName) { - for (int i = 0; i < tabDesktop.getTabCount(); i++) { - if (panelName.equals(tabDesktop.getTitleAt(i))) { - return (ArchetypePanel<G, A, R, V>) tabDesktop.getComponentAt(i); - } - } - - final ArchetypePanel<G, A, R, V> newPanel = createArchetypePanel(); - - // insert new panel in alphabetical order - int i; - for (i = 0; i < tabDesktop.getTabCount() && panelName.compareToIgnoreCase(tabDesktop.getTitleAt(i)) > 0; i++) { - ; - } - tabDesktop.insertTab(panelName, null, newPanel, null, i); - - return newPanel; - } - - /** - * After the build process is completed and the panels have been fully - * constructed, we must correct the 'selectedPanel' setting and make sure - * the arch list is properly drawn. - */ - public void finishBuildProcess() { - for (int i = 0; i < tabDesktop.getTabCount(); i++) { - ((ArchetypePanel<?, ?, ?, ?>) tabDesktop.getComponentAt(i)).finishBuildProcess(); - } - - selectedPanel = (ArchetypePanel<G, A, R, V>) tabDesktop.getSelectedComponent(); - if (selectedPanel != null) { - selectedPanel.showArchList(); - } - - // we must set the list of the selected list depend on combo selection - tabDesktop.addChangeListener(new ChangeListener() { - public void stateChanged(final ChangeEvent e) { - final JTabbedPane tabbedPane = (JTabbedPane) e.getSource(); - setSelectedArch(null); - selectedPanel = (ArchetypePanel<G, A, R, V>) tabDesktop.getComponentAt(tabbedPane.getSelectedIndex()); - if (selectedPanel != null) { - selectedPanel.showArchList(); - } - } - }); - } - - /** - * Set selected Arch. - * @param selectedArch name of selected arch in arch panel - */ - public void setSelectedArch(@Nullable final G selectedArch) { - if (this.selectedArch == selectedArch) { - return; - } - - directionPane.setEnabled(selectedArch); - - this.selectedArch = selectedArch; - fireSelectedArchetypeChangedEvent(selectedArch); - } - - /** - * Register a listener. - * @param listener The listener to register. - */ - public void addArchetypeChooserListener(@NotNull final ArchetypeChooserListener<G, A, R> listener) { - listenerList.add(ArchetypeChooserListener.class, listener); - } - - /** - * Remove a listener. - * @param listener The listener to remove. - */ - public void removeArchetypeChooserListener(@NotNull final ArchetypeChooserListener<G, A, R> listener) { - listenerList.remove(ArchetypeChooserListener.class, listener); - } - - /** - * Notify all listeners about a changed selected archetype. - * @param archetype The new selected archetype. - */ - private void fireSelectedArchetypeChangedEvent(@Nullable final G archetype) { - for (final ArchetypeChooserListener<G, A, R> listener : listenerList.getListeners(ArchetypeChooserListener.class)) { - listener.selectedArchetypeChanged(archetype); - } - } - - /** - * Notifies all listeners that the display mode has changed. - */ - private void fireDisplayObjectNamesChangedEvent() { - for (final ArchetypeChooserListener<G, A, R> listener : listenerList.getListeners(ArchetypeChooserListener.class)) { - listener.displayObjectNamesChanged(displayObjectNames); - } - } - - /** - * Add a new archetype. Create the panel and/or folder if necessary. + * Adds a new archetype. Creates the panel and/or folder if necessary. * @param panelName the panel name to add the archetype to * @param folderName the folder name to add the archetype to * @param arch the archetype to add */ public void addArchetype(@NotNull final String panelName, @NotNull final String folderName, @NotNull final R arch) { - final ArchetypePanel<G, A, R, V> panel = findOrCreatePanel(panelName); + final ArchetypePanel<G, A, R, V> panel = archetypeChooserView.findOrCreatePanel(panelName); panel.addArchetype(folderName, arch); archetypes.put(arch, panel); } /** - * Create a new archetype panel. - * @return The new archetype panel. - */ - @NotNull - private ArchetypePanel<G, A, R, V> createArchetypePanel() { - return new ArchetypePanel<G, A, R, V>(this, mainControl, archetypeSet); - } - - /** - * Returns the currently selected direction. - * @return The currently selected direction or <code>null</code> if the - * archetype's default direction should be used. - */ - @Nullable - public Integer getCurrentDirection() { - return directionPane.getCurrentDirection(); - } - - /** - * Action method for "display object names". - * @return <code>true</code> if object names are shown, or - * <code>false</code> if archetype names are shown. - */ - public boolean isDisplayObjectNames() { - return displayObjectNames; - } - - /** - * Sets whether the object or archetype names are shown. - * @param displayObjectNames The new setting. - * @see #isDisplayObjectNames() - */ - public void setDisplayObjectNames(final boolean displayObjectNames) { - if (this.displayObjectNames == displayObjectNames) { - return; - } - - this.displayObjectNames = displayObjectNames; - prefs.putBoolean(DISPLAY_OBJECT_NAMES, displayObjectNames); - fireDisplayObjectNamesChangedEvent(); - } - - /** * Select an archetype. If necessary, select the archetype's tab. * @param archetype The archetype to select. */ @@ -317,9 +117,7 @@ return; } - selectedPanel = panel; - tabDesktop.setSelectedComponent(panel); - panel.showArchList(); + archetypeChooserView.setSelectedPanel(panel); panel.selectArchetype(archetype); } @@ -332,22 +130,13 @@ } /** - * Return whether a given panel is the currently active panel. - * @param panel The panel to check. - * @return Whether the panel is active. - */ - public boolean isSelectedPanel(@NotNull final ArchetypePanel<G, A, R, V> panel) { - return selectedPanel == panel; - } - - /** * Returns whether the selected archetype matches a given game object. - * @param gameObject the game object to match + * @param archetype the archetype to match * @return whether the selected archetype matches; returns * <code>false</code> if no archetype is selected */ - public boolean isMatching(final G gameObject) { - return gameObject.getArchetype() == selectedArch; + public boolean isMatching(final R archetype) { + return archetypeChooserModel.getSelectedArchetype() == archetype; } /** @@ -362,7 +151,44 @@ */ @Nullable public G insertSelectedArchetype(final MapModel<G, A, R> mapModel, final Point pos, final boolean allowMany, final InsertionMode insertionMode) { - return selectedArch == null ? null : mapModel.insertArchetype(selectedArch.getArchetype(), pos, allowMany, true, insertionMode); + final R selectedArchetype = archetypeChooserModel.getSelectedArchetype(); + return selectedArchetype == null ? null : mapModel.insertArchetype(selectedArchetype, pos, allowMany, true, insertionMode); } + /** + * Returns the archetype chooser view. + * @return the archetype chooser view + */ + @Deprecated + @NotNull + public ArchetypeChooserView<G, A, R, V> getArchetypeChooserView() { + return archetypeChooserView; + } + + /** + * Returns the archetype chooser model. + * @return the archetype chooser model + */ + @Deprecated + @NotNull + public ArchetypeChooserModel<G,A,R,?> getArchetypeChooserModel() { + return archetypeChooserModel; + } + + /** + * Adds an archetype chooser model listener to be notified. + * @param listener the listener to add + */ + public void addArchetypeChooserModelListener(final ArchetypeChooserModelListener<G, A, R, V> listener) { + archetypeChooserModel.addArchetypeChooserModelListener(listener); + } + + /** + * Removes an archetype chooser model listener to be notified. + * @param listener the listener to remove + */ + public void removeArchetypeChooserModelListener(final ArchetypeChooserModelListener<G, A, R, V> listener) { + archetypeChooserModel.removeArchetypeChooserModelListener(listener); + } + } // class ArchetypeChooserControl Deleted: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserListener.java 2008-08-03 08:12:38 UTC (rev 4719) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserListener.java 2008-08-03 13:46:19 UTC (rev 4720) @@ -1,47 +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 net.sf.gridarta.gui.archetypechooser; - -import java.util.EventListener; -import net.sf.gridarta.gameobject.Archetype; -import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.map.MapArchObject; -import org.jetbrains.annotations.Nullable; - -/** - * Interface for listeners listening to Archetype Chooser events. - * @author Andreas Kirschbaum - */ -public interface ArchetypeChooserListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends EventListener { - - /** - * The event handler is called when the selected archetype has changed. - * @param archetype The new selected archetype. - */ - void selectedArchetypeChanged(@Nullable G archetype); - - /** - * This event handler is called when an attribute "display object names" has - * changed. - * @param displayObjectNames The new attribute value. - */ - void displayObjectNamesChanged(boolean displayObjectNames); - -} // interface ArchetypeChooserListener Added: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserModel.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserModel.java 2008-08-03 13:46:19 UTC (rev 4720) @@ -0,0 +1,187 @@ +/* + * 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 net.sf.gridarta.gui.archetypechooser; + +import java.util.ArrayList; +import java.util.List; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.map.MapArchObject; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * The view of the archetype chooser. + * @author Andreas Kirschbaum + */ +public class ArchetypeChooserModel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { + + /** + * The registered listeners. + */ + @NotNull + private final List<ArchetypeChooserModelListener<G, A, R, V>> listeners = new ArrayList<ArchetypeChooserModelListener<G, A, R, V>>(); + + /** + * The archetype set to display. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + /** + * The currently selected panel. + */ + @Nullable + private ArchetypePanel<G, A, R, V> selectedPanel = null; + + /** + * The currently selected archetype. + */ + @Nullable + private R selectedArchetype = null; + + /** + * The default direction for game objects created from archetypes. Set to + * <code>null</code> for default direction. + */ + @Nullable + private Integer direction; + + /** + * Creates a new instance. + * @param archetypeSet the archetype set to display + */ + public ArchetypeChooserModel(@NotNull final ArchetypeSet<G, A, R> archetypeSet) { + this.archetypeSet = archetypeSet; + } + + /** + * Returns the archetype set to display. + * @return the archetype set + */ + @NotNull + public final ArchetypeSet<G, A, R> getArchetypeSet() { + return archetypeSet; + } + + /** + * Sets the selected panel. + * @param selectedPanel the new selected panel or <code>null</code> to + * select no panel. + */ + public void setSelectedPanel(@Nullable final ArchetypePanel<G, A, R, V> selectedPanel) { + if (this.selectedPanel == selectedPanel) { + return; + } + + this.selectedPanel = selectedPanel; + if (selectedPanel != null) { + selectedPanel.showArchList(); + } + fireSelectedPanelChangedEvent(); + } + + /** + * Returns the selected archetype panel. + * @return the selected archetype panel or <code>null</code> if none is + * selected. + */ + @Nullable + public ArchetypePanel<G, A, R, V> getSelectedPanel() { + return selectedPanel; + } + + /** + * Sets the selected archetype. + * @param selectedArchetype the new selected archetype or <code>null</code> + * to select no archetype + */ + public void setSelectedArchetype(@Nullable final R selectedArchetype) { + if (this.selectedArchetype == selectedArchetype) { + return; + } + + this.selectedArchetype = selectedArchetype; + fireSelectedArchetypeChangedEvent(); + } + + /** + * Returns the selected archetype. + * @return the selected archetype or <code>null</code> if none is selected + */ + @Nullable + public R getSelectedArchetype() { + return selectedArchetype; + } + + /** + * Adds a listener to be notified. + * @param listener the listener to add + */ + public void addArchetypeChooserModelListener(@NotNull final ArchetypeChooserModelListener<G, A, R, V> listener) { + listeners.add(listener); + } + + /** + * Removes a listener to be notified. + * @param listener the listener to remove + */ + public void removeArchetypeChooserModelListener(@NotNull final ArchetypeChooserModelListener<G, A, R, V> listener) { + listeners.remove(listener); + } + + /** + * Notifies all listener that the selected panel has changed. + */ + private void fireSelectedPanelChangedEvent() { + for (final ArchetypeChooserModelListener<G, A, R, V> listener : listeners) { + listener.selectedPanelChanged(selectedPanel); + } + } + + /** + * Notifies all listener that the selected archetype has changed. + */ + private void fireSelectedArchetypeChangedEvent() { + for (final ArchetypeChooserModelListener<G, A, R, V> listener : listeners) { + listener.selectedArchetypeChanged(selectedArchetype); + } + } + + /** + * Returns the default direction for game objects created from archetypes. + * @return the direction or <code>null</code> for default + */ + @Nullable + public Integer getDirection() { + return direction; + } + + /** + * Sets the default direction for game objects created from archetypes. + * @param direction the direction or <code>null</code> for default + */ + public void setDirection(@Nullable final Integer direction) { + this.direction = direction; + } + +} // class ArchetypeChooserModel Property changes on: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserModel.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserModelListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserModelListener.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserModelListener.java 2008-08-03 13:46:19 UTC (rev 4720) @@ -0,0 +1,47 @@ +/* + * 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 net.sf.gridarta.gui.archetypechooser; + +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 org.jetbrains.annotations.Nullable; + +/** + * Interface for listeners interested in events of {@link + * ArchetypeChooserModel} instances. + * @author Andreas Kirschbaum + */ +public interface ArchetypeChooserModelListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { + + /** + * The selected panel has changed. + * @param selectedPanel the selected panel + */ + void selectedPanelChanged(@Nullable ArchetypePanel<G, A, R, V> selectedPanel); + + /** + * The selected archetype has changed. + * @param selectedArchetype the selected archetype + */ + void selectedArchetypeChanged(@Nullable R selectedArchetype); + +} // interface ArchetypeChooserModelListener Property changes on: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserModelListener.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java 2008-08-03 13:46:19 UTC (rev 4720) @@ -0,0 +1,219 @@ +/* + * 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 net.sf.gridarta.gui.archetypechooser; + +import java.awt.BorderLayout; +import java.util.ArrayList; +import java.util.List; +import java.util.prefs.Preferences; +import javax.swing.BorderFactory; +import javax.swing.JPanel; +import javax.swing.JTabbedPane; +import javax.swing.SwingConstants; +import javax.swing.event.ChangeEvent; +import javax.swing.event.ChangeListener; +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.map.MapViewBasic; +import net.sf.gridarta.map.MapArchObject; +import org.jetbrains.annotations.NotNull; + +/** + * The view of the archetype chooser. + * @author Andreas Kirschbaum + */ +public class ArchetypeChooserView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends JPanel { + + /** + * The key for saving the display mode selection. + */ + private static final String DISPLAY_OBJECT_NAMES = "archetypesDisplayObjectNames"; + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1; + + /** Preferences. */ + private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + + /** + * The registered listeners. + */ + @NotNull + private final List<ArchetypeChooserViewListener<G, A, R>> listeners = new ArrayList<ArchetypeChooserViewListener<G, A, R>>(); + + /** + * The main control. + */ + @NotNull + private final MainControl<G, A, R, V> mainControl; + + /** + * The archetype chooser model. + */ + @NotNull + private final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel; + + /** + * The tab panel containing the archetype lists. + */ + private final JTabbedPane tabDesktop = new JTabbedPane(SwingConstants.TOP); + + /** + * Indicates whether object names are shown. + */ + private boolean displayObjectNames = prefs.getBoolean(DISPLAY_OBJECT_NAMES, false); + + /** + * The change listener attached to {@link #tabDesktop}. + */ + private final ChangeListener changeListener = new ChangeListener() { + + /** {@inheritDoc} */ + public void stateChanged(final ChangeEvent e) { + final JTabbedPane tabbedPane = (JTabbedPane) e.getSource(); + archetypeChooserModel.setSelectedArchetype(null); + archetypeChooserModel.setSelectedPanel((ArchetypePanel<G, A, R, V>) tabDesktop.getComponentAt(tabbedPane.getSelectedIndex())); + } + }; + + /** + * Creates a new instance. + * @param createDirectionPane whether the direction pane should be shown + * @param mainControl the main control + * @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) { + super(new BorderLayout()); + this.mainControl = mainControl; + this.archetypeChooserModel = archetypeChooserModel; + tabDesktop.setBorder(BorderFactory.createEmptyBorder(CommonConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); + add(tabDesktop); + if (createDirectionPane) { + add(new DirectionPane<G, A, R, V>(archetypeChooserModel), BorderLayout.SOUTH); + } + } + + /** + * Returns a panel by name. If this panel does not exist, create a new one. + * @param panelName the panel name + * @return the panel + */ + @NotNull + public ArchetypePanel<G, A, R, V> findOrCreatePanel(@NotNull final String panelName) { + for (int i = 0; i < tabDesktop.getTabCount(); i++) { + if (panelName.equals(tabDesktop.getTitleAt(i))) { + return (ArchetypePanel<G, A, R, V>) tabDesktop.getComponentAt(i); + } + } + + final ArchetypePanel<G, A, R, V> newPanel = new ArchetypePanel<G, A, R, V>(this, archetypeChooserModel, mainControl, archetypeChooserModel.getArchetypeSet()); + + // insert new panel in alphabetical order + int i; + for (i = 0; i < tabDesktop.getTabCount() && panelName.compareToIgnoreCase(tabDesktop.getTitleAt(i)) > 0; i++) { + ; + } + tabDesktop.insertTab(panelName, null, newPanel, null, i); + + return newPanel; + } + + /** + * After the build process is completed and the panels have been fully + * constructed, we must correct the 'selectedPanel' setting and make sure + * the arch list is properly drawn. + */ + public void finishBuildProcess() { + for (int i = 0; i < tabDesktop.getTabCount(); i++) { + ((ArchetypePanel<?, ?, ?, ?>) tabDesktop.getComponentAt(i)).finishBuildProcess(); + } + + archetypeChooserModel.setSelectedPanel((ArchetypePanel<G, A, R, V>) tabDesktop.getSelectedComponent()); + tabDesktop.addChangeListener(changeListener); + } + + /** + * Selects an archetype panel. Does nothing if the panel does not exist. + * @param selectedPanel the archetype panel to show + */ + public void setSelectedPanel(final ArchetypePanel<G, A, R, V> selectedPanel) { + final int selectedIndex = tabDesktop.indexOfComponent(selectedPanel); + if (selectedIndex == -1 || selectedIndex == tabDesktop.getSelectedIndex()) { + return; + } + + archetypeChooserModel.setSelectedPanel(selectedPanel); + tabDesktop.setSelectedIndex(selectedIndex); + } + + /** + * Notifies all listeners that the display mode has changed. + */ + private void fireDisplayObjectNamesChangedEvent() { + for (final ArchetypeChooserViewListener<G, A, R> listener : listeners) { + listener.displayObjectNamesChanged(displayObjectNames); + } + } + + /** + * Action method for "display object names". + * @return <code>true</code> if object names are shown, or + * <code>false</code> if archetype names are shown. + */ + public boolean isDisplayObjectNames() { + return displayObjectNames; + } + + /** + * Sets whether object or archetype names are shown. + * @param displayObjectNames the new setting + * @see #isDisplayObjectNames() + */ + public void setDisplayObjectNames(final boolean displayObjectNames) { + if (this.displayObjectNames == displayObjectNames) { + return; + } + + this.displayObjectNames = displayObjectNames; + prefs.putBoolean(DISPLAY_OBJECT_NAMES, displayObjectNames); + fireDisplayObjectNamesChangedEvent(); + } + + /** + * Adds a listener to be notified of events. + * @param listener the listener to add + */ + public void addArchetypeChooserViewListener(@NotNull final ArchetypeChooserViewListener<G, A, R> listener) { + listeners.add(listener); + } + + /** + * Removes a listener to be notified of events. + * @param listener the listener to remove + */ + public void removeArchetypeChooserViewListener(@NotNull final ArchetypeChooserViewListener<G, A, R> listener) { + listeners.remove(listener); + } + +} // class ArchetypeChooserView Property changes on: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserView.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Added: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserViewListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserViewListener.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserViewListener.java 2008-08-03 13:46:19 UTC (rev 4720) @@ -0,0 +1,40 @@ +/* + * 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 net.sf.gridarta.gui.archetypechooser; + +import java.util.EventListener; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.MapArchObject; + +/** + * Interface for listeners listening to Archetype Chooser events. + * @author Andreas Kirschbaum + */ +public interface ArchetypeChooserViewListener<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends EventListener { + + /** + * This event handler is called when an attribute "display object names" has + * changed. + * @param displayObjectNames The new attribute value. + */ + void displayObjectNamesChanged(boolean displayObjectNames); + +} // interface ArchetypeChooserViewListener Property changes on: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserViewListener.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2008-08-03 08:12:38 UTC (rev 4719) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2008-08-03 13:46:19 UTC (rev 4720) @@ -35,6 +35,7 @@ import javax.swing.JPopupMenu; import javax.swing.JScrollPane; import javax.swing.JViewport; +import javax.swing.ListCellRenderer; import javax.swing.ListSelectionModel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; @@ -51,8 +52,9 @@ import org.jetbrains.annotations.Nullable; /** - * Common base class for the panel for Archetypes. + * A panel showing a set of archetypes. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum */ public class ArchetypePanel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends JPanel { @@ -67,8 +69,8 @@ private final JPopupMenu popupMenu = createListPopupMenu(); /** - * List of archetypes for each folder. The folders correspond to the entries - * in {@link #comboBox}. + * List of archetypes for each folder. The folders correspond to the + * entries in {@link #comboBox}. * @note The first entry contains the union of all following entries. */ private final List<Set<R>> folders = new ArrayList<Set<R>>(); @@ -79,32 +81,57 @@ */ private final JList archList; - private final DefaultListModel model; + /** + * The list model of {@link #archList}. + */ + private final DefaultListModel listModel; + /** + * The combo box for selecting the active archetype panel. + */ private final JComboBox comboBox; - /** The Archetype Chooser. */ - private final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl; + /** + * The associated archetype chooser model. + */ + @NotNull + private final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel; - /** The main control. */ + /** + * The main control. + */ @NotNull private final MainControl<G, A, R, V> mainControl; /** - * The archetype set to display. + * The list cell renderer displaying object names. */ @NotNull - private final ArchetypeSet<G, A, R> archetypeSet; + private final ListCellRenderer displayNameCellRenderer; /** + * The list cell renderer displaying archetype names. + */ + @NotNull + private final ListCellRenderer archetypeNameCellRenderer; + + /** + * The comparator for sorting archetypes in the active panel. + */ + @NotNull + private Comparator<Archetype<?, ?, ?>> comparator; + + /** * Comparator used to sort entries shown in {@link #archList} according to * archetype name. */ private static final Comparator<Archetype<?, ?, ?>> archetypeNameComparator = new Comparator<Archetype<?, ?, ?>>() { + /** {@inheritDoc} */ public int compare(final Archetype<?, ?, ?> o1, final Archetype<?, ?, ?> o2) { return o1.getArchetypeName().compareToIgnoreCase(o2.getArchetypeName()); } + }; /** @@ -112,6 +139,7 @@ * display name. */ private static final Comparator<Archetype<?, ?, ?>> displayNameComparator = new Comparator<Archetype<?, ?, ?>>() { + /** {@inheritDoc} */ public int compare(final Archetype<?, ?, ?> o1, final Archetype<?, ?, ?> o2) { final int cmp = o1.getBestName().compareToIgnoreCase(o2.getBestName()); @@ -121,17 +149,15 @@ return o1.getArchetypeName().compareToIgnoreCase(o2.getArchetypeName()); } + }; - /** The listener to detect attribute changes. */ - private final ArchetypeChooserListener<G, A, R> archetypeChooserListener = new ArchetypeChooserListener<G, A, R>() { + /** + * The listener to detect attribute changes. + */ + private final ArchetypeChooserViewListener<G, A, R> archetypeChooserViewListener = new ArchetypeChooserViewListener<G, A, R>() { /** {@inheritDoc} */ - public void selectedArchetypeChanged(@Nullable final G archetype) { - // ignore - } - - /** {@inheritDoc} */ public void displayObjectNamesChanged(final boolean displayObjectNames) { updateCellRenderer(displayObjectNames); } @@ -139,21 +165,21 @@ }; /** - * Creates an ArchetypePanel. - * @param archetypeChooserControl The Archetype Chooser. - * @param mainControl The main control. + * Creates a new instance. + * @param archetypeChooserView the associated archetype chooser view + * @param archetypeChooserModel the associated archetype chooser model + * @param mainControl the main control * @param archetypeSet the archetype set to display */ - protected ArchetypePanel(@NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { + 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, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { super(new BorderLayout()); - this.archetypeChooserControl = archetypeChooserControl; + this.archetypeChooserModel = archetypeChooserModel; this.mainControl = mainControl; - this.archetypeSet = archetypeSet; - + displayNameCellRenderer = new DisplayNameCellRenderer<R>(archetypeSet); + archetypeNameCellRenderer = new ArchetypeNameCellRenderer<R>(archetypeSet); comboBox = new JComboBox(); - - model = new DefaultListModel(); - archList = new JList(model); + listModel = new DefaultListModel(); + archList = new JList(listModel); //noinspection AbstractMethodCallInConstructor archList.setFocusable(false); archList.setBackground(CommonConstants.BG_COLOR); @@ -163,21 +189,19 @@ add(comboBox, BorderLayout.NORTH); scrollPane.setAutoscrolls(true); scrollPane.getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - comboBox.setAutoscrolls(true); - - archetypeChooserControl.addArchetypeChooserListener(archetypeChooserListener); - updateCellRenderer(archetypeChooserControl.isDisplayObjectNames()); + archetypeChooserView.addArchetypeChooserViewListener(archetypeChooserViewListener); + updateCellRenderer(archetypeChooserView.isDisplayObjectNames()); } /** - * Update the cell renderer according to {@link ArchetypeChooserControl#isDisplayObjectNames()} - * and repaint the list. - * @param displayObjectNames If set, display object names; else display - * archetype names. + * Updates the cell renderer state. + * @param displayObjectNames if set, display object names; else display + * archetype names */ private void updateCellRenderer(final boolean displayObjectNames) { - archList.setCellRenderer(displayObjectNames ? new DisplayNameCellRenderer<R>(archetypeSet) : new ArchetypeNameCellRenderer<R>(archetypeSet)); + comparator = displayObjectNames ? displayNameComparator : archetypeNameComparator; + archList.setCellRenderer(displayObjectNames ? displayNameCellRenderer : archetypeNameCellRenderer); final Object selectedValue = archList.getSelectedValue(); showArchList(); if (selectedValue != null) { @@ -194,28 +218,24 @@ archList.addListSelectionListener(new ListSelectionListener() { public void valueChanged(final ListSelectionEvent e) { - updateSelectedArchListObject(); + final R archetype = (R) archList.getSelectedValue(); + archetypeChooserModel.setSelectedArchetype(archetype); } }); } /** - * Get the GameObject currently selected in the list. - * @return GameObject or <code>null</code> if no selection + * Returns the archetype currently selected in the list. + * @return the archetype or <code>null</code> if no selection exists */ - public G getArchListObject() { - return (G) archList.getSelectedValue(); + @Nullable + public R getSelectedArchetype() { + return (R) archList.getSelectedValue(); } - /** Show the selected archetype. */ - private void updateSelectedArchListObject() { - final G archetype = (G) archList.getSelectedValue(); - archetypeChooserControl.setSelectedArch(archetype); - } - /** - * Add an archetype to this panel. + * Adds an archetype to this panel. * @param folderName the folder to add it to * @param archetype the archetype to add */ @@ -226,7 +246,7 @@ } /** - * Return a folder by name. If this folder does not exist, create a new + * Returns a folder by name. If this folder does not exist, create a new * one. * @param folderName the folder name * @return the folder @@ -262,19 +282,24 @@ } } - /** Update {@link #archList} to contain the currently selected folder. */ + /** + * Updates {@link #archList} to contain the currently selected folder. + */ public void showArchList() { final int index = comboBox.getSelectedIndex(); - synchronized (archList.getTreeLock()) { - model.removeAllElements(); - if (index >= 0 && archetypeChooserControl.isSelectedPanel(this)) { + listModel.removeAllElements(); + if (index >= 0 && archetypeChooserModel.getSelectedPanel() == this) { final List<R> archetypes = new ArrayList<R>(); archetypes.addAll(folders.get(index)); - Collections.sort(archetypes, archetypeChooserControl.isDisplayObjectNames() ? displayNameComparator : archetypeNameComparator); + Collections.sort(archetypes, comparator); for (final R archetype : archetypes) { - model.addElement(archetype); + listModel.addElement(archetype); } + if (!archetypes.isEmpty()) { + archList.setSelectedIndex(0); // XXX: save previously selected index? + archList.ensureIndexIsVisible(0); + } } } } @@ -288,12 +313,12 @@ /** Action method for the popup menu to edit a default arch. */ @ActionMethod public void editPopup() { - mainControl.openAttrDialog(getArchListObject()); + mainControl.openAttrDialog((/*XXX*/G) getSelectedArchetype()); } /** - * Select an archetype. If necessary, switch to the correct sub-folder. - * @param archetype The archetype to select. + * Selects an archetype. If necessary, switches to the correct sub-folder. + * @param archetype the archetype to select */ public void selectArchetype(final R archetype) { for (int index = 1; index < folders.size(); index++) { @@ -307,4 +332,4 @@ } -} // class ArchetypePanel. +} // class ArchetypePanel Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/DirectionPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/DirectionPane.java 2008-08-03 08:12:38 UTC (rev 4719) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/DirectionPane.java 2008-08-03 13:46:19 UTC (rev 4720) @@ -29,12 +29,14 @@ import javax.swing.JToggleButton; 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 net.sf.japi.swing.ActionMethod; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class DirectionPane<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JPanel { +public class DirectionPane<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends JPanel { /** The serial version UID. */ private static final long serialVersionUID = 1; @@ -50,11 +52,26 @@ /** The buttons in {@link #directionButtonGroup}. */ private final List<JToggleButton> directionButtons = new ArrayList<JToggleButton>(); - @Nullable - private Integer currentDirection = null; + @NotNull + private final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel; - public DirectionPane() { + private ArchetypeChooserModelListener<G, A, R, V> archetypeChooserModelListener = new ArchetypeChooserModelListener<G, A, R, V>() { + + /** {@inheritDoc} */ + public void selectedPanelChanged(@Nullable final ArchetypePanel<G, A, R, V> selectedPanel) { + // ignore + } + + /** {@inheritDoc} */ + public void selectedArchetypeChanged(@Nullable final R selectedArchetype) { + updateEnabled(selectedArchetype); + } + + }; + + public DirectionPane(@NotNull final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel) { super(new GridBagLayout()); + this.archetypeChooserModel = archetypeChooserModel; final GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.BOTH; gbc.anchor = GridBagConstraints.CENTER; @@ -70,19 +87,15 @@ createButton(3, this, gbc, 2, 2); gbc.gridwidth = 3; createButton(null, this, gbc, 0, 3); - setEnabled(null); + archetypeChooserModel.addArchetypeChooserModelListener(archetypeChooserModelListener); + updateEnabled(archetypeChooserModel.getSelectedArchetype()); } - @Nullable - public Integer getCurrentDirection() { - return currentDirection; - } - /** * Enable/disable the direction buttons for a given archetype. * @param archetype The archetype to check. */ - public void setEnabled(@Nullable final G archetype) { + private void updateEnabled(@Nullable final R archetype) { final boolean enabled = archetype != null && archetype.usesDirection(); for (final JToggleButton button : directionButtons) { button.setEnabled(enabled); @@ -110,72 +123,64 @@ button.setSelected(true); } - /** - * Action proxy for direction. - * @param direction Direction number - */ - private void direction(final Integer direction) { - currentDirection = direction; - } - /** Action method for direction. */ @ActionMethod public void direction0() { - direction(0); + archetypeChooserModel.setDirection(0); } /** Action method for direction. */ @ActionMethod public void direction1() { - direction(1); + archetypeChooserModel.setDirection(1); } /** Action method for direction. */ @ActionMethod public void direction2() { - direction(2); + archetypeChooserModel.setDirection(2); } /** Action method for direction. */ @ActionMethod public void direction3() { - direction(3);... [truncated message content] |
From: <aki...@us...> - 2008-08-03 14:24:12
|
Revision: 4727 http://gridarta.svn.sourceforge.net/gridarta/?rev=4727&view=rev Author: akirschbaum Date: 2008-08-03 14:24:19 +0000 (Sun, 03 Aug 2008) Log Message: ----------- Remove unused parameters. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 14:21:26 UTC (rev 4726) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 14:24:19 UTC (rev 4727) @@ -239,7 +239,7 @@ 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); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, replaceDialogManager, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); replaceDialogManager.setObjectChooser(objectChooser); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 14:21:26 UTC (rev 4726) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 14:24:19 UTC (rev 4727) @@ -302,7 +302,7 @@ 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); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, replaceDialogManager, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); replaceDialogManager.setObjectChooser(objectChooser); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-08-03 14:21:26 UTC (rev 4726) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-08-03 14:24:19 UTC (rev 4727) @@ -27,7 +27,6 @@ import javax.swing.JTabbedPane; import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.EditTypes; -import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; @@ -68,8 +67,6 @@ /** * Create a ToolPalette. - * @param mainControl MainControl to use (required for {@link - * InsertionTool}). * @param editTypes the edit types instance * @param selectedSquareView the selected square view * @param objectChooser the object chooser to use @@ -77,11 +74,11 @@ * @param objectChoiceDisplay the object choice display to use * @param copyBuffer the copy buffer instance to use */ - public ToolPalette(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + public ToolPalette(@NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { super(new BorderLayout()); - lmbSelector = new ToolSelector<G, A, R, V>("selection", mainControl, editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); - mmbSelector = new ToolSelector<G, A, R, V>("deletion", mainControl, editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); - rmbSelector = new ToolSelector<G, A, R, V>("insertion", mainControl, editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); + lmbSelector = new ToolSelector<G, A, R, V>("selection", editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); + mmbSelector = new ToolSelector<G, A, R, V>("deletion", editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); + rmbSelector = new ToolSelector<G, A, R, V>("insertion", editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); add(new JLabel(ACTION_FACTORY.getString("mouse")), BorderLayout.NORTH); mouseTabs.add(ACTION_FACTORY.getString("left"), lmbSelector); mouseTabs.add(ACTION_FACTORY.getString("middle"), mmbSelector); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-08-03 14:21:26 UTC (rev 4726) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-08-03 14:24:19 UTC (rev 4727) @@ -34,7 +34,6 @@ import javax.swing.JToggleButton; import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.EditTypes; -import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; @@ -90,8 +89,6 @@ /** * Create a ToolSelector component. * @param defaultTool name of the tool that should be selected by default - * @param mainControl MainControl to use (required for {@link - * InsertionTool}). * @param editTypes the edit types instance * @param selectedSquareView the selected square view * @param objectChooser the object chooser to use @@ -99,7 +96,7 @@ * @param pickmapChooserControl the pickmap chooser control to use * @param copyBuffer the copy buffer instance to use */ - public ToolSelector(@NotNull final String defaultTool, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + public ToolSelector(@NotNull final String defaultTool, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { createUI(); for (final Tool<G, A, R, V> toolToAdd : new Tool[] {new VoidTool<G, A, R, V>(), new SelectionTool<G, A, R, V>(objectChooser, objectChoiceDisplay, copyBuffer), new DeletionTool<G, A, R, V>(editTypes, objectChooser, pickmapChooserControl), new InsertionTool<G, A, R, V>(selectedSquareView, objectChooser, pickmapChooserControl)}) { add(toolToAdd, toolToAdd.getId().equals(defaultTool)); Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-03 14:21:26 UTC (rev 4726) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-03 14:24:19 UTC (rev 4727) @@ -29,7 +29,6 @@ import javax.swing.SwingConstants; 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.GameObject; @@ -98,14 +97,13 @@ /** * Creates a new instance. - * @param mainControl the main control * @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 ReplaceDialogManager<G, A, R, V> replaceDialogManager, @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) { + public DefaultObjectChooser(@NotNull final ReplaceDialogManager<G, A, R, V> replaceDialogManager, @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; @@ -122,7 +120,7 @@ }); objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(replaceDialogManager, archetypeTypeSet, this); - toolPalette = new ToolPalette<G, A, R, V>(mainControl, editTypes, selectedSquareView, this, objectChoiceDisplay, pickmapChooserControl, copyBuffer); + toolPalette = new ToolPalette<G, A, R, V>(editTypes, selectedSquareView, this, objectChoiceDisplay, pickmapChooserControl, copyBuffer); // archAndPickPane is the panel containing both archpanel and pickmaps archAndPickPane.addTab(ACTION_FACTORY.getString("objectChooser.archetypesTabTitle"), archetypeChooserControl.getArchetypeChooserView()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-03 14:25:49
|
Revision: 4728 http://gridarta.svn.sourceforge.net/gridarta/?rev=4728&view=rev Author: akirschbaum Date: 2008-08-03 14:25:57 +0000 (Sun, 03 Aug 2008) Log Message: ----------- Remove unneeded variable. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 14:24:19 UTC (rev 4727) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 14:25:57 UTC (rev 4728) @@ -243,8 +243,7 @@ replaceDialogManager.setObjectChooser(objectChooser); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); - 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); + 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); new About("cfeditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 14:24:19 UTC (rev 4727) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 14:25:57 UTC (rev 4728) @@ -306,8 +306,7 @@ replaceDialogManager.setObjectChooser(objectChooser); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); - final StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic> statusBar = new StatusBar<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, archetypeSet, faceObjects); - createMapImageCache(null, SystemIcons.getDefaultIcon(), SystemIcons.getDefaultPreview(), statusBar); + 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); new About("daieditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-03 20:28:30
|
Revision: 4740 http://gridarta.svn.sourceforge.net/gridarta/?rev=4740&view=rev Author: akirschbaum Date: 2008-08-03 20:28:36 +0000 (Sun, 03 Aug 2008) Log Message: ----------- Split off unrelated GUI code from DefaultObjectChooser. 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/MainView.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/LeftPanel.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -69,6 +69,7 @@ import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.HideFileFilterProxy; +import net.sf.gridarta.gui.LeftPanel; import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; @@ -84,7 +85,9 @@ import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.tools.DeletionTool; +import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; +import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; @@ -239,7 +242,7 @@ 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); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); replaceDialogManager.setObjectChooser(objectChooser); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); @@ -326,11 +329,14 @@ final CFilterControl filterControl = new CFilterControl(null, mapManager, defaultNamedFilterList); ((CrossfireObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); scriptControl = new ScriptController(this, filterControl, archetypeSet, mainView); - mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); + final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserControl, pickmapChooserControl); + final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); + final LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic> leftPanel = new LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic>(objectChooser, toolPalette, objectChoiceDisplay); + mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); final ArchetypeParser archetypeParser = new ArchetypeParser(gridartaObjectsFactory, archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists); + gridartaObjectsFactory.init(faceObjects, archetypeChooserControl, selectedSquareView, this, 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-03 15:37:42 UTC (rev 4739) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -47,7 +47,7 @@ import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; +import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; @@ -71,9 +71,6 @@ /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - /** The {@link ObjectChooser} instance to use. */ - private ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser = null; - /** The {@link ArchetypeChooserControl} instance to use. */ @NotNull private ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = null; @@ -113,6 +110,10 @@ @NotNull private CFilterControl filterControl; + /** The tool palette instance. */ + @NotNull + private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -172,12 +173,11 @@ /** {@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, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), 32, 32, selectedSquareView), ACTION_FACTORY, mapImageCache); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, 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 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; + public void init(@NotNull final FaceObjects faceObjects, @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, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; @@ -187,6 +187,7 @@ this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; this.autojoinLists = autojoinLists; + this.toolPalette = toolPalette; } public void setFilterControl(@NotNull final CFilterControl filterControl) { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -78,6 +78,7 @@ import net.sf.gridarta.gui.About; import net.sf.gridarta.gui.GUIUtils; import net.sf.gridarta.gui.HideFileFilterProxy; +import net.sf.gridarta.gui.LeftPanel; import net.sf.gridarta.gui.MainActions; import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.MapFileFilter; @@ -93,7 +94,9 @@ import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.tools.DeletionTool; +import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; +import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; @@ -302,7 +305,7 @@ 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); - objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, editTypes, selectedSquareView, archetypeChooserControl, pickmapChooserControl, copyBuffer); + objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeChooserControl, pickmapChooserControl); replaceDialogManager.setObjectChooser(objectChooser); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, this, editTypes, archetypeSet, copyBuffer, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, mapManager); SystemIcons.init(); @@ -387,10 +390,13 @@ // 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, objectChooser, archetypeTypeSet, mapManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); - mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser); + final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserControl, pickmapChooserControl); + final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); + final LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic> leftPanel = new LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic>(objectChooser, toolPalette, objectChoiceDisplay); + mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); - gridartaObjectsFactory.init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, editTypes, mapImageCache, mapActions, archetypeParser, archetypeSet, autojoinLists); + gridartaObjectsFactory.init(faceObjects, archetypeChooserControl, selectedSquareView, this, 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-03 15:37:42 UTC (rev 4739) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -47,7 +47,7 @@ import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; -import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; +import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; @@ -74,9 +74,6 @@ /** The {@link FaceObjects} instance to use. */ private FaceObjects faceObjects = null; - /** The {@link ObjectChooser} instance to use. */ - private ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser = null; - /** The {@link ArchetypeChooserControl} instance to use. */ @NotNull private ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = null; @@ -113,6 +110,10 @@ @NotNull private AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists = null; + /** The tool palette instance. */ + @NotNull + private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -174,13 +175,12 @@ /** {@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, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY, mapImageCache); + 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); } /** {@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, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists) { + public void init(@NotNull final FaceObjects faceObjects, @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, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { this.faceObjects = faceObjects; - this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; @@ -190,6 +190,7 @@ this.archetypeParser = archetypeParser; this.archetypeSet = archetypeSet; this.autojoinLists = autojoinLists; + this.toolPalette = toolPalette; } } // class DaimoninObjectsFactory Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -33,7 +33,7 @@ import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.gui.objectchooser.ObjectChooser; +import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.io.MapArchObjectParser; @@ -137,7 +137,6 @@ /** * Initializes the instance. * @param faceObjects the FaceObjects instance - * @param objectChooser the ObjectChooser instance * @param archetypeChooserControl the ArchetypeChooserControl instance * @param selectedSquareView the selected square view instance * @param mainControl the main control instance @@ -147,7 +146,8 @@ * @param archetypeParser the archetype parser instance * @param archetypeSet the archetype set instance * @param autojoinLists the autojoin lists instance + * @param toolPalette the tool palette 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, @NotNull final AutojoinLists<G, A, R> autojoinLists); + void init(@NotNull FaceObjects faceObjects, @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, @NotNull ToolPalette<G, A, R, V> toolPalette); } // interface GridartaObjectsFactory Added: trunk/src/app/net/sf/gridarta/gui/LeftPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/LeftPanel.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/LeftPanel.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -0,0 +1,62 @@ +/* + * 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 net.sf.gridarta.gui; + +import java.awt.BorderLayout; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.map.tools.ToolPalette; +import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; +import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; +import net.sf.gridarta.map.MapArchObject; +import org.jetbrains.annotations.NotNull; + +/** + * The gui panel on the left side. It holds the tool palette, the object + * chooser, and the object choice display. + * @author Andreas Kirschbaum + */ +public class LeftPanel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends JPanel { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1; + + /** + * Creates a new instance. + * @param objectChooser the object chooser + * @param toolPalette the tool palette + * @param objectChoiceDisplay the object choice display + */ + public LeftPanel(@NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final ToolPalette<G, A, R, V> toolPalette, @NotNull final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay) { + super(new BorderLayout()); + + // TODO: introduce a tool registry + final JSplitPane splitPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, toolPalette, objectChooser); + splitPane.setContinuousLayout(true); + add(splitPane, BorderLayout.CENTER); + add(objectChoiceDisplay, BorderLayout.SOUTH); + } + +} // class LeftPanel Property changes on: trunk/src/app/net/sf/gridarta/gui/LeftPanel.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -386,7 +386,7 @@ * @param archetypeChooserControl the archetype chooser control * @param objectChooser the object chooser */ - public void init(@NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final ArchetypeTypeSet archetypeTypeSet, final boolean mapTileListBottom, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser) { + public void init(@NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final ArchetypeTypeSet archetypeTypeSet, final boolean mapTileListBottom, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final LeftPanel<G, A, R, V> leftPanel) { // calculate some default values in case there is no settings file final Rectangle screen = getGraphicsConfiguration().getBounds(); final int defwidth = (int) (0.9 * screen.getWidth()); @@ -396,7 +396,7 @@ final JPanel toolbarPanel = new JPanel(new BorderLayout()); toolbarPanel.add(mainToolbar, BorderLayout.NORTH); - toolbarPanel.add(createCenterPanel(defwidth, defheight, selectedSquareView, mapTileListBottom, gameObjectAttributesPanel, objectChooser), BorderLayout.CENTER); + toolbarPanel.add(createCenterPanel(defwidth, defheight, selectedSquareView, mapTileListBottom, gameObjectAttributesPanel, leftPanel), BorderLayout.CENTER); add(toolbarPanel, BorderLayout.CENTER); archetypesActions = new ArchetypesActions<G, A, R, V>(this, archetypeChooserControl, archetypeChooserControl.getArchetypeChooserView(), objectChooser, archetypeTypeSet); @@ -434,9 +434,9 @@ * @param selectedSquareView the selected square view * @param mapTileListBottom whether the map tile should be at the bottom * @return center panel - * @param objectChooser the object chooser + * @param leftPanel the left panel */ - private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser) { + private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final LeftPanel<G, A, R, V> leftPanel) { final JPanel centerPanel = new JPanel(new BorderLayout()); final int divLocationRight = prefs.getInt(DIVIDER_LOCATION_KEY3, (int) (defwidth * 0.62)); @@ -456,7 +456,7 @@ splitDownPane.setDividerLocation(divLocationDown); splitDownPane.setContinuousLayout(true); splitDownPane.setResizeWeight(1); - splitPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, objectChooser, splitDownPane); + splitPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, splitDownPane); splitPane.setDividerLocation(divLocation); splitPane.setContinuousLayout(true); Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -24,22 +24,13 @@ import java.util.List; import javax.swing.JMenu; import javax.swing.JPanel; -import javax.swing.JSplitPane; import javax.swing.JTabbedPane; import javax.swing.SwingConstants; -import net.sf.gridarta.CopyBuffer; -import net.sf.gridarta.EditTypes; -import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.GSplitPane; -import net.sf.gridarta.gui.ReplaceDialogManager; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.gui.map.tools.ToolPalette; -import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapModel; @@ -65,9 +56,6 @@ /** The archetype chooser control. */ private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; - /** ToolSelector of this subview. */ - private final ToolPalette<G, A, R, V> toolPalette; - /** Panel holding both archlist and pickmaps. */ private final JTabbedPane archAndPickPane = new JTabbedPane(SwingConstants.TOP); @@ -79,32 +67,19 @@ /** * Creates a new instance. - * @param replaceDialogManager the replace dialog manager - * @param archetypeTypeSet the archetype type set - * @param editTypes the edit types instance - * @param selectedSquareView the selected square view * @param archetypeChooserControl the archetype chooser control * @param pickmapChooserControl the pickmap chooser control - * @param copyBuffer the copy buffer instance to use */ - public DefaultObjectChooser(@NotNull final ReplaceDialogManager<G, A, R, V> replaceDialogManager, @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) { + public DefaultObjectChooser(@NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { super(new BorderLayout()); this.archetypeChooserControl = archetypeChooserControl; this.pickmapChooserControl = pickmapChooserControl; - final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(replaceDialogManager, archetypeTypeSet, this, archetypeChooserControl, pickmapChooserControl); - toolPalette = new ToolPalette<G, A, R, V>(editTypes, selectedSquareView, this, objectChoiceDisplay, pickmapChooserControl, copyBuffer); // archAndPickPane is the panel containing both archpanel and pickmaps archAndPickPane.addTab(ACTION_FACTORY.getString("objectChooser.archetypesTabTitle"), archetypeChooserControl.getArchetypeChooserView()); archAndPickPane.addTab(ACTION_FACTORY.getString("objectChooser.pickmapsTabTitle"), pickmapChooserControl.getPickmapPanel()); // this listener informs the mainview which panel is active: archlist or pickmaps? archAndPickPane.addChangeListener(new ArchNPickChangeListener(this, archAndPickPane)); - - // TODO: introduce a tool registry - final JSplitPane splitPane = new GSplitPane(JSplitPane.VERTICAL_SPLIT, toolPalette, archAndPickPane); - splitPane.setContinuousLayout(true); - add(splitPane, BorderLayout.CENTER); - add(objectChoiceDisplay, BorderLayout.SOUTH); } /** {@inheritDoc} */ @@ -160,14 +135,6 @@ return pickmapActive ? pickmapChooserControl.getSelections() : archetypeChooserControl.getSelections(); } - /** - * Returns the tool selector pane. - * @return The tool selector pane. - */ - public ToolPalette<G, A, R, V> getToolSelectorPane() { - return toolPalette; - } - /** {@inheritDoc} */ public void selectArchetype(final R archetype) { moveArchetypeChooserToFront(); Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-03 15:37:42 UTC (rev 4739) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-08-03 20:28:36 UTC (rev 4740) @@ -57,6 +57,7 @@ import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.GameObjectParser; @@ -887,7 +888,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, @NotNull final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists) { + public void init(@NotNull final FaceObjects faceObjects, @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, @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. |
From: <aki...@us...> - 2008-08-03 21:05:35
|
Revision: 4741 http://gridarta.svn.sourceforge.net/gridarta/?rev=4741&view=rev Author: akirschbaum Date: 2008-08-03 21:05:44 +0000 (Sun, 03 Aug 2008) Log Message: ----------- Remove unused import statements. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-03 20:28:36 UTC (rev 4740) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-08-03 21:05:44 UTC (rev 4741) @@ -48,7 +48,6 @@ import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.tools.ToolPalette; -import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-03 20:28:36 UTC (rev 4740) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-08-03 21:05:44 UTC (rev 4741) @@ -48,7 +48,6 @@ import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.tools.ToolPalette; -import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-03 21:08:30
|
Revision: 4742 http://gridarta.svn.sourceforge.net/gridarta/?rev=4742&view=rev Author: akirschbaum Date: 2008-08-03 21:08:36 +0000 (Sun, 03 Aug 2008) Log Message: ----------- Move GUI related utility classes to separate package. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java trunk/crossfire/src/cfeditor/gui/script/ScriptView.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/RecentManager.java trunk/src/app/net/sf/gridarta/gui/SystemIcons.java trunk/src/app/net/sf/gridarta/gui/map/MapView.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListActions.java trunk/src/app/net/sf/gridarta/treasurelist/TreasureCellRenderer.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/utils/ trunk/src/app/net/sf/gridarta/gui/utils/GUIUtils.java trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/GUIUtils.java trunk/src/app/net/sf/gridarta/gui/MenuHelper.java Modified: trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java 2008-08-03 21:05:44 UTC (rev 4741) +++ trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -52,7 +52,7 @@ import java.awt.event.MouseEvent; import javax.swing.ImageIcon; import javax.swing.JTabbedPane; -import net.sf.gridarta.gui.GUIUtils; +import net.sf.gridarta.gui.utils.GUIUtils; public class CloseableTabbedPane extends JTabbedPane { Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-08-03 21:05:44 UTC (rev 4741) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -54,7 +54,7 @@ import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; -import net.sf.gridarta.gui.GUIUtils; +import net.sf.gridarta.gui.utils.GUIUtils; import org.apache.log4j.Logger; public class ScriptEditor extends JPanel { Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-08-03 21:05:44 UTC (rev 4741) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -40,7 +40,7 @@ import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; -import net.sf.gridarta.gui.MenuHelper; +import net.sf.gridarta.gui.utils.MenuUtils; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ReflectionAction; import org.apache.log4j.Logger; @@ -130,7 +130,7 @@ return; } - MenuHelper.removeAllToSeparator(menuScripts); + MenuUtils.removeAllToSeparator(menuScripts); int index = 0; for (final String script : control.listScript()) { Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 21:05:44 UTC (rev 4741) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -76,7 +76,6 @@ 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.GUIUtils; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.LeftPanel; import net.sf.gridarta.gui.MainActions; @@ -106,6 +105,7 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.undo.UndoControl; +import net.sf.gridarta.gui.utils.GUIUtils; import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.AutoValidator; Deleted: trunk/src/app/net/sf/gridarta/gui/GUIUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/GUIUtils.java 2008-08-03 21:05:44 UTC (rev 4741) +++ trunk/src/app/net/sf/gridarta/gui/GUIUtils.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -1,128 +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 net.sf.gridarta.gui; - -import java.io.File; -import java.net.URL; -import java.util.HashMap; -import java.util.Map; -import javax.swing.ImageIcon; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.Nullable; - -/** - * <code>CGUtils</code> is a collection of GUI utility methods. Mainly focusing - * on resource management. - * @author <a href="mailto:mic...@no...">Michael Toennies</a> - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public final class GUIUtils { - - /** The Logger for printing log messages. */ - private static final Logger log = Logger.getLogger(GUIUtils.class); - - private static final Map<String, ImageIcon> imageCache = new HashMap<String, ImageIcon>(); - - /** Do not subclass. */ - private GUIUtils() { - /* nothing to do - never invoked. */ - } - - /** - * Returns the image icon for the given icon name. Loads every icon only - * once and uses hashtable to return the same instance if same icon name is - * given. Note: There must not be conflicting icon names from different - * directorys. - * @param dirUri uri of the directory the icon is in - * @param strIconName the icon name (propably one of the constants defined - * in IGUIConstants). - * @return The image icon for the given icon name. - */ - @Nullable - private static ImageIcon getResourceIcon(final String dirUri, final String strIconName) { - if (dirUri.contains("\\")) { - throw new IllegalArgumentException("dirUri must be a URI but was: " + dirUri); - } - // first, look if this icon is already available in the Hashtable - if (imageCache.containsKey(strIconName)) { - return imageCache.get(strIconName); - } - - // Look for the file, replacing '/' with File.separatorChar when necessary. - final File imageFile = new File(File.separatorChar != '/' ? dirUri.replace('/', File.separatorChar) : dirUri, strIconName); - @Nullable final ImageIcon icon; - if (imageFile.exists()) { - // image file exists in expected directory - icon = new ImageIcon(imageFile.getAbsolutePath()); - } else { - // image file is missing, so let's try to load it from jar - final URL fullImageResource = GUIUtils.class.getClassLoader().getResource(dirUri + '/' + strIconName); - - if (fullImageResource != null) { - icon = new ImageIcon(fullImageResource); - } else { - final int slashIndex = dirUri.indexOf('/'); - if (slashIndex != -1) { - // let's try it again without first directory (okay, this may look - // a bit weird, but usually this is the correct icon path in the jar) - final URL strippedImageResource = GUIUtils.class.getClassLoader().getResource(dirUri.substring(slashIndex + 1) + '/' + strIconName); - if (strippedImageResource != null) { - icon = new ImageIcon(strippedImageResource); - } else { - icon = null; - } - } else { - icon = null; - } - } - } - - // put this icon into the Hashtable - if (icon != null) { - imageCache.put(strIconName, icon); - } else { - log.warn("Failed to load icon '" + strIconName + "'!"); - } - - return icon; - } - - /** - * Returns the specified icon as a normal icon resource. - * @param strIconName Name of the icon to return. - * @return The icon or <code>null</code> if the icon couldn't be loaded. - */ - @Nullable - public static ImageIcon getIcon(final String strIconName) { - return getResourceIcon(GUIConstants.ICON_DIR, strIconName); - } - - /** - * Returns the specified icon as a system icon resource. - * @param strIconName Name of the icon to return. - * @return The icon or <code>null</code> if the icon couldn't be loaded. - */ - @Nullable - public static ImageIcon getSysIcon(final String strIconName) { - return getResourceIcon(GUIConstants.SYSTEM_DIR, strIconName); - } - -} // class GUIUtils Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-03 21:05:44 UTC (rev 4741) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -54,6 +54,8 @@ import net.sf.gridarta.gui.map.ViewActions; import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; +import net.sf.gridarta.gui.utils.GUIUtils; +import net.sf.gridarta.gui.utils.MenuUtils; import net.sf.gridarta.help.Help; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; @@ -542,7 +544,7 @@ /** Rebuild the window menu. */ private void rebuildWindowMenu() { final JMenu menuWindow = (JMenu) actionFactory.find(getJMenuBar(), "window"); - MenuHelper.removeAll(menuWindow); + MenuUtils.removeAll(menuWindow); menuWindow.add(aCloseAll); if (!mapViewManager.isEmpty()) { menuWindow.addSeparator(); Deleted: trunk/src/app/net/sf/gridarta/gui/MenuHelper.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MenuHelper.java 2008-08-03 21:05:44 UTC (rev 4741) +++ trunk/src/app/net/sf/gridarta/gui/MenuHelper.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -1,82 +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 net.sf.gridarta.gui; - -import java.awt.Component; -import javax.swing.AbstractButton; -import javax.swing.JMenu; -import javax.swing.JSeparator; -import javax.swing.MenuElement; - -/** - * Utility class implementing menu related functions. - * @author Andreas Kirschbaum - */ -@SuppressWarnings({"ClassNamingConvention"}) -public class MenuHelper { - - /** Private constructor to prevent instantiation. */ - private MenuHelper() { - } - - /** - * Remove all actions attached to menu entries in a given menu element and - * its children. - * @param menuElement the menu element to process - */ - public static void disposeMenuElement(final MenuElement menuElement) { - if (menuElement instanceof AbstractButton) { - ((AbstractButton) menuElement).setAction(null); - } - - for (final MenuElement child : menuElement.getSubElements()) { - disposeMenuElement(child); - } - } - - /** - * Remove all menu entries. - * @param menu the menu to remove the entries from - */ - public static void removeAll(final JMenu menu) { - for (final MenuElement child : menu.getSubElements()) { - disposeMenuElement(child); - } - menu.removeAll(); - } - - /** - * Remove all menu entries up to (but not including) the first separator. - * @param menu the menu to remove the entries from - */ - public static void removeAllToSeparator(final JMenu menu) { - for (; ;) { - final Component menuItem = menu.getMenuComponent(0); - if (menuItem == null || menuItem instanceof JSeparator) { - break; - } - menu.remove(0); - if (menuItem instanceof MenuElement) { - disposeMenuElement((MenuElement) menuItem); - } - } - } - -} // class MenuHelper Modified: trunk/src/app/net/sf/gridarta/gui/RecentManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2008-08-03 21:05:44 UTC (rev 4741) +++ trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -33,6 +33,7 @@ import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.map.MapPreviewAccessory; +import net.sf.gridarta.gui.utils.MenuUtils; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -125,7 +126,7 @@ return; } - MenuHelper.removeAll(recentMenu); + MenuUtils.removeAll(recentMenu); for (final Recent recent : recents) { recentMenu.add(recent); } Modified: trunk/src/app/net/sf/gridarta/gui/SystemIcons.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/SystemIcons.java 2008-08-03 21:05:44 UTC (rev 4741) +++ trunk/src/app/net/sf/gridarta/gui/SystemIcons.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -26,6 +26,7 @@ import java.awt.image.ImageProducer; import javax.swing.ImageIcon; import net.sf.gridarta.gameobject.face.AbstractFaceObjects; +import net.sf.gridarta.gui.utils.GUIUtils; /** * Utility class for system icons. Modified: trunk/src/app/net/sf/gridarta/gui/map/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-08-03 21:05:44 UTC (rev 4741) +++ trunk/src/app/net/sf/gridarta/gui/map/MapView.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -31,7 +31,7 @@ import net.sf.gridarta.MapImageCache; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.MenuHelper; +import net.sf.gridarta.gui.utils.MenuUtils; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.DefaultMapControl; import net.sf.gridarta.map.MapArchObject; @@ -175,7 +175,7 @@ mapControl.removeMapControlListener(mapControlListener); mapControl.getMapModel().removeMapModelListener(mapModelListener); //mapFileActions.closeNotify(); - MenuHelper.disposeMenuElement(getJMenuBar()); + MenuUtils.disposeMenuElement(getJMenuBar()); } /** Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListActions.java 2008-08-03 21:05:44 UTC (rev 4741) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/FolderListActions.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -24,9 +24,9 @@ import javax.swing.JMenu; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.MenuHelper; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; +import net.sf.gridarta.gui.utils.MenuUtils; import net.sf.gridarta.map.MapArchObject; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -115,7 +115,7 @@ return; } - MenuHelper.removeAll(folderMenu); + MenuUtils.removeAll(folderMenu); for (final Folder<G, A, R, V> folder : model) { final JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(); final FolderListAction<G, A, R, V> action = new FolderListAction<G, A, R, V>(folder, menuItem); Copied: trunk/src/app/net/sf/gridarta/gui/utils/GUIUtils.java (from rev 4737, trunk/src/app/net/sf/gridarta/gui/GUIUtils.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/GUIUtils.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/utils/GUIUtils.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -0,0 +1,129 @@ +/* + * 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 net.sf.gridarta.gui.utils; + +import java.io.File; +import java.net.URL; +import java.util.HashMap; +import java.util.Map; +import javax.swing.ImageIcon; +import net.sf.gridarta.gui.GUIConstants; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.Nullable; + +/** + * <code>CGUtils</code> is a collection of GUI utility methods. Mainly focusing + * on resource management. + * @author <a href="mailto:mic...@no...">Michael Toennies</a> + * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + */ +public final class GUIUtils { + + /** The Logger for printing log messages. */ + private static final Logger log = Logger.getLogger(GUIUtils.class); + + private static final Map<String, ImageIcon> imageCache = new HashMap<String, ImageIcon>(); + + /** Do not subclass. */ + private GUIUtils() { + /* nothing to do - never invoked. */ + } + + /** + * Returns the image icon for the given icon name. Loads every icon only + * once and uses hashtable to return the same instance if same icon name is + * given. Note: There must not be conflicting icon names from different + * directorys. + * @param dirUri uri of the directory the icon is in + * @param strIconName the icon name (propably one of the constants defined + * in IGUIConstants). + * @return The image icon for the given icon name. + */ + @Nullable + private static ImageIcon getResourceIcon(final String dirUri, final String strIconName) { + if (dirUri.contains("\\")) { + throw new IllegalArgumentException("dirUri must be a URI but was: " + dirUri); + } + // first, look if this icon is already available in the Hashtable + if (imageCache.containsKey(strIconName)) { + return imageCache.get(strIconName); + } + + // Look for the file, replacing '/' with File.separatorChar when necessary. + final File imageFile = new File(File.separatorChar != '/' ? dirUri.replace('/', File.separatorChar) : dirUri, strIconName); + @Nullable final ImageIcon icon; + if (imageFile.exists()) { + // image file exists in expected directory + icon = new ImageIcon(imageFile.getAbsolutePath()); + } else { + // image file is missing, so let's try to load it from jar + final URL fullImageResource = GUIUtils.class.getClassLoader().getResource(dirUri + '/' + strIconName); + + if (fullImageResource != null) { + icon = new ImageIcon(fullImageResource); + } else { + final int slashIndex = dirUri.indexOf('/'); + if (slashIndex != -1) { + // let's try it again without first directory (okay, this may look + // a bit weird, but usually this is the correct icon path in the jar) + final URL strippedImageResource = GUIUtils.class.getClassLoader().getResource(dirUri.substring(slashIndex + 1) + '/' + strIconName); + if (strippedImageResource != null) { + icon = new ImageIcon(strippedImageResource); + } else { + icon = null; + } + } else { + icon = null; + } + } + } + + // put this icon into the Hashtable + if (icon != null) { + imageCache.put(strIconName, icon); + } else { + log.warn("Failed to load icon '" + strIconName + "'!"); + } + + return icon; + } + + /** + * Returns the specified icon as a normal icon resource. + * @param strIconName Name of the icon to return. + * @return The icon or <code>null</code> if the icon couldn't be loaded. + */ + @Nullable + public static ImageIcon getIcon(final String strIconName) { + return getResourceIcon(GUIConstants.ICON_DIR, strIconName); + } + + /** + * Returns the specified icon as a system icon resource. + * @param strIconName Name of the icon to return. + * @return The icon or <code>null</code> if the icon couldn't be loaded. + */ + @Nullable + public static ImageIcon getSysIcon(final String strIconName) { + return getResourceIcon(GUIConstants.SYSTEM_DIR, strIconName); + } + +} // class GUIUtils Property changes on: trunk/src/app/net/sf/gridarta/gui/utils/GUIUtils.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF Copied: trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java (from rev 4737, trunk/src/app/net/sf/gridarta/gui/MenuHelper.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -0,0 +1,82 @@ +/* + * 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 net.sf.gridarta.gui.utils; + +import java.awt.Component; +import javax.swing.AbstractButton; +import javax.swing.JMenu; +import javax.swing.JSeparator; +import javax.swing.MenuElement; + +/** + * Utility class implementing menu related functions. + * @author Andreas Kirschbaum + */ +@SuppressWarnings({"ClassNamingConvention"}) +public class MenuUtils { + + /** Private constructor to prevent instantiation. */ + private MenuUtils() { + } + + /** + * Remove all actions attached to menu entries in a given menu element and + * its children. + * @param menuElement the menu element to process + */ + public static void disposeMenuElement(final MenuElement menuElement) { + if (menuElement instanceof AbstractButton) { + ((AbstractButton) menuElement).setAction(null); + } + + for (final MenuElement child : menuElement.getSubElements()) { + disposeMenuElement(child); + } + } + + /** + * Remove all menu entries. + * @param menu the menu to remove the entries from + */ + public static void removeAll(final JMenu menu) { + for (final MenuElement child : menu.getSubElements()) { + disposeMenuElement(child); + } + menu.removeAll(); + } + + /** + * Remove all menu entries up to (but not including) the first separator. + * @param menu the menu to remove the entries from + */ + public static void removeAllToSeparator(final JMenu menu) { + for (; ;) { + final Component menuItem = menu.getMenuComponent(0); + if (menuItem == null || menuItem instanceof JSeparator) { + break; + } + menu.remove(0); + if (menuItem instanceof MenuElement) { + disposeMenuElement((MenuElement) menuItem); + } + } + } + +} // class MenuUtils Property changes on: trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/treasurelist/TreasureCellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/treasurelist/TreasureCellRenderer.java 2008-08-03 21:05:44 UTC (rev 4741) +++ trunk/src/app/net/sf/gridarta/treasurelist/TreasureCellRenderer.java 2008-08-03 21:08:36 UTC (rev 4742) @@ -31,7 +31,7 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.GUIConstants; -import net.sf.gridarta.gui.GUIUtils; +import net.sf.gridarta.gui.utils.GUIUtils; import net.sf.gridarta.map.MapArchObject; import org.jetbrains.annotations.NotNull; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-03 23:15:41
|
Revision: 4749 http://gridarta.svn.sourceforge.net/gridarta/?rev=4749&view=rev Author: akirschbaum Date: 2008-08-03 23:15:48 +0000 (Sun, 03 Aug 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/map/tools/SelectionTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 23:12:36 UTC (rev 4748) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 23:15:48 UTC (rev 4749) @@ -330,7 +330,7 @@ ((CrossfireObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); scriptControl = new ScriptController(this, filterControl, archetypeSet, mainView); final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserControl, pickmapChooserControl); - final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); + final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); final LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic> leftPanel = new LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic>(objectChooser, toolPalette, objectChoiceDisplay); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 23:12:36 UTC (rev 4748) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 23:15:48 UTC (rev 4749) @@ -391,7 +391,7 @@ 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, 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, archetypeChooserControl, pickmapChooserControl); - final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); + final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); final LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic> leftPanel = new LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic>(objectChooser, toolPalette, objectChoiceDisplay); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2008-08-03 23:12:36 UTC (rev 4748) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2008-08-03 23:15:48 UTC (rev 4749) @@ -33,12 +33,10 @@ import net.sf.gridarta.gui.map.MapGrid; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.event.MouseOpEvent; -import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.undo.SwingUtils; import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; -import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ToggleAction; import org.jetbrains.annotations.NotNull; @@ -93,10 +91,6 @@ @NotNull private final ObjectChooser<G, ?, ?> objectChooser; - /** The object choice display to update. */ - @NotNull - private final ObjectChoiceDisplay<G, ?, ?, ?> objectChoiceDisplay; - /** * The copy buffer instance to use. */ @@ -111,13 +105,11 @@ /** * Create a BasicAbstractTool. * @param objectChooser the object chooser to update - * @param objectChoiceDisplay the object choice display to update * @param copyBuffer the copy buffer instance to use */ - public SelectionTool(@NotNull final ObjectChooser<G, ?, ?> objectChooser, @NotNull final ObjectChoiceDisplay<G, ?, ?, ?> objectChoiceDisplay, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + public SelectionTool(@NotNull final ObjectChooser<G, ?, ?> objectChooser, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { super("selection"); this.objectChooser = objectChooser; - this.objectChoiceDisplay = objectChoiceDisplay; this.copyBuffer = copyBuffer; selectionToolAutoFillChanged(); } @@ -128,7 +120,6 @@ final Point mapLoc = e.getMapLocation(); final int mod = e.getModifiers(); final MapCursor mapCursor = e.getMapCursor(); - final MapControl<G, A, R, V> mapControl = e.getMapControl(); // left mouse button: select tiles // Throw away old selection if neither SHIFT nor CTRL is not pressed if ((mod & (InputEvent.CTRL_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK)) == 0) { Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-08-03 23:12:36 UTC (rev 4748) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2008-08-03 23:15:48 UTC (rev 4749) @@ -31,7 +31,6 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.event.MouseOpEvent; -import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; @@ -71,14 +70,13 @@ * @param selectedSquareView the selected square view * @param objectChooser the object chooser to use * @param pickmapChooserControl the pickmap chooser control to use - * @param objectChoiceDisplay the object choice display to use * @param copyBuffer the copy buffer instance to use */ - public ToolPalette(@NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + public ToolPalette(@NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { super(new BorderLayout()); - lmbSelector = new ToolSelector<G, A, R, V>("selection", editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); - mmbSelector = new ToolSelector<G, A, R, V>("deletion", editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); - rmbSelector = new ToolSelector<G, A, R, V>("insertion", editTypes, selectedSquareView, objectChooser, objectChoiceDisplay, pickmapChooserControl, copyBuffer); + lmbSelector = new ToolSelector<G, A, R, V>("selection", editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); + mmbSelector = new ToolSelector<G, A, R, V>("deletion", editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); + rmbSelector = new ToolSelector<G, A, R, V>("insertion", editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); add(new JLabel(ACTION_FACTORY.getString("mouse")), BorderLayout.NORTH); mouseTabs.add(ACTION_FACTORY.getString("left"), lmbSelector); mouseTabs.add(ACTION_FACTORY.getString("middle"), mmbSelector); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-08-03 23:12:36 UTC (rev 4748) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2008-08-03 23:15:48 UTC (rev 4749) @@ -37,7 +37,6 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; @@ -92,13 +91,12 @@ * @param editTypes the edit types instance * @param selectedSquareView the selected square view * @param objectChooser the object chooser to use - * @param objectChoiceDisplay the object choice display to use * @param pickmapChooserControl the pickmap chooser control to use * @param copyBuffer the copy buffer instance to use */ - public ToolSelector(@NotNull final String defaultTool, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { + public ToolSelector(@NotNull final String defaultTool, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final CopyBuffer<G, A, R, V> copyBuffer) { createUI(); - for (final Tool<G, A, R, V> toolToAdd : new Tool[] {new VoidTool<G, A, R, V>(), new SelectionTool<G, A, R, V>(objectChooser, objectChoiceDisplay, copyBuffer), new DeletionTool<G, A, R, V>(editTypes, objectChooser, pickmapChooserControl), new InsertionTool<G, A, R, V>(selectedSquareView, objectChooser, pickmapChooserControl)}) { + for (final Tool<G, A, R, V> toolToAdd : new Tool[] {new VoidTool<G, A, R, V>(), new SelectionTool<G, A, R, V>(objectChooser, copyBuffer), new DeletionTool<G, A, R, V>(editTypes, objectChooser, pickmapChooserControl), new InsertionTool<G, A, R, V>(selectedSquareView, objectChooser, pickmapChooserControl)}) { add(toolToAdd, toolToAdd.getId().equals(defaultTool)); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-03 23:18:55
|
Revision: 4750 http://gridarta.svn.sourceforge.net/gridarta/?rev=4750&view=rev Author: akirschbaum Date: 2008-08-03 23:19:03 +0000 (Sun, 03 Aug 2008) Log Message: ----------- Remove calls to ArchetypeChooserControl.getArchetypeChooserModel(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/objectchoicedisplay/ObjectChoiceDisplay.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 23:15:48 UTC (rev 4749) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 23:19:03 UTC (rev 4750) @@ -329,7 +329,7 @@ final CFilterControl filterControl = new CFilterControl(null, mapManager, defaultNamedFilterList); ((CrossfireObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); scriptControl = new ScriptController(this, filterControl, archetypeSet, mainView); - final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserControl, pickmapChooserControl); + final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserControl.getArchetypeChooserModel(), pickmapChooserControl); final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); final LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic> leftPanel = new LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic>(objectChooser, toolPalette, objectChoiceDisplay); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 23:15:48 UTC (rev 4749) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 23:19:03 UTC (rev 4750) @@ -390,7 +390,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, 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, archetypeChooserControl, pickmapChooserControl); + final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserControl.getArchetypeChooserModel(), pickmapChooserControl); final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); final LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic> leftPanel = new LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic>(objectChooser, toolPalette, objectChoiceDisplay); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); Modified: trunk/src/app/net/sf/gridarta/gui/objectchoicedisplay/ObjectChoiceDisplay.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchoicedisplay/ObjectChoiceDisplay.java 2008-08-03 23:15:48 UTC (rev 4749) +++ trunk/src/app/net/sf/gridarta/gui/objectchoicedisplay/ObjectChoiceDisplay.java 2008-08-03 23:19:03 UTC (rev 4750) @@ -30,7 +30,7 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.ReplaceDialogManager; -import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; +import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModelListener; import net.sf.gridarta.gui.archetypechooser.ArchetypePanel; import net.sf.gridarta.gui.map.MapCursor; @@ -76,7 +76,7 @@ * The archetype chooser control to monitor. */ @NotNull - private final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl; + private final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel; private final JLabel archObjNameText = new JLabel(); @@ -174,14 +174,14 @@ * @param replaceDialogManager the replace dialog manager to notify * @param archetypeTypeSet the archetype type set * @param objectChooser the object chooser to monitor - * @param archetypeChooserControl the archetype chooser control to monitor + * @param archetypeChooserModel the archetype chooser control to monitor * @param pickmapChooserControl the pickmap chooser control to monitor */ - public ObjectChoiceDisplay(@NotNull final ReplaceDialogManager<G, A, R, V> replaceDialogManager, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { + public ObjectChoiceDisplay(@NotNull final ReplaceDialogManager<G, A, R, V> replaceDialogManager, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl) { this.replaceDialogManager = replaceDialogManager; this.archetypeTypeSet = archetypeTypeSet; this.objectChooser = objectChooser; - this.archetypeChooserControl = archetypeChooserControl; + this.archetypeChooserModel = archetypeChooserModel; setLayout(new GridBagLayout()); final GridBagConstraints gcl = new GridBagConstraints(); @@ -207,7 +207,7 @@ add(new JLabel("Tile:"), gcl); add(archTileText, gcr); - archetypeChooserControl.getArchetypeChooserModel().addArchetypeChooserModelListener(archetypeChooserModelListener); + archetypeChooserModel.addArchetypeChooserModelListener(archetypeChooserModelListener); pickmapChooserControl.addPickmapChooserListener(pickmapChooserListener); objectChooser.addObjectChooserListener(objectChooserListener); showObjectChooserQuickObject((G) null); @@ -297,7 +297,7 @@ if (pickmapActive) { updatePickmapInfo(activePickmapView != null ? activePickmapView.getMapCursor() : null); } else { - showObjectChooserQuickObject(archetypeChooserControl.getArchetypeChooserModel().getSelectedArchetype()); + showObjectChooserQuickObject(archetypeChooserModel.getSelectedArchetype()); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-03 23:24:39
|
Revision: 4751 http://gridarta.svn.sourceforge.net/gridarta/?rev=4751&view=rev Author: akirschbaum Date: 2008-08-03 23:24:47 +0000 (Sun, 03 Aug 2008) Log Message: ----------- Use weaker types. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/LeftPanel.java trunk/src/app/net/sf/gridarta/gui/MainView.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 23:19:03 UTC (rev 4750) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 23:24:47 UTC (rev 4751) @@ -331,7 +331,7 @@ scriptControl = new ScriptController(this, filterControl, archetypeSet, mainView); final ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic> objectChoiceDisplay = new ObjectChoiceDisplay<GameObject, MapArchObject, Archetype, CMapViewBasic>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserControl.getArchetypeChooserModel(), pickmapChooserControl); final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); - final LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic> leftPanel = new LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic>(objectChooser, toolPalette, objectChoiceDisplay); + final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 23:19:03 UTC (rev 4750) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 23:24:47 UTC (rev 4751) @@ -392,7 +392,7 @@ gameObjectAttributesPanel = new GameObjectAttributesPanel(this, 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, archetypeChooserControl.getArchetypeChooserModel(), pickmapChooserControl); final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = new ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl, copyBuffer); - final LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic> leftPanel = new LeftPanel<GameObject, MapArchObject, Archetype, CMapViewBasic>(objectChooser, toolPalette, objectChoiceDisplay); + final LeftPanel leftPanel = new LeftPanel(objectChooser, toolPalette, objectChoiceDisplay); mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl, objectChooser, leftPanel); mapActions.updateMenuState(); final ArchetypeParser archetypeParser = new ArchetypeParser(archetypeChooserControl, animationObjects, archetypeSet); Modified: trunk/src/app/net/sf/gridarta/gui/LeftPanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/LeftPanel.java 2008-08-03 23:19:03 UTC (rev 4750) +++ trunk/src/app/net/sf/gridarta/gui/LeftPanel.java 2008-08-03 23:24:47 UTC (rev 4751) @@ -20,15 +20,9 @@ package net.sf.gridarta.gui; import java.awt.BorderLayout; +import java.awt.Component; import javax.swing.JPanel; import javax.swing.JSplitPane; -import net.sf.gridarta.gameobject.Archetype; -import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.gui.map.tools.ToolPalette; -import net.sf.gridarta.gui.objectchoicedisplay.ObjectChoiceDisplay; -import net.sf.gridarta.gui.objectchooser.DefaultObjectChooser; -import net.sf.gridarta.map.MapArchObject; import org.jetbrains.annotations.NotNull; /** @@ -36,7 +30,7 @@ * chooser, and the object choice display. * @author Andreas Kirschbaum */ -public class LeftPanel<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> extends JPanel { +public class LeftPanel extends JPanel { /** * The serial version UID. @@ -49,7 +43,7 @@ * @param toolPalette the tool palette * @param objectChoiceDisplay the object choice display */ - public LeftPanel(@NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final ToolPalette<G, A, R, V> toolPalette, @NotNull final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay) { + public LeftPanel(@NotNull final Component objectChooser, @NotNull final Component toolPalette, @NotNull final Component objectChoiceDisplay) { super(new BorderLayout()); // TODO: introduce a tool registry Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-03 23:19:03 UTC (rev 4750) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2008-08-03 23:24:47 UTC (rev 4751) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui; import java.awt.BorderLayout; +import java.awt.Component; import java.awt.Rectangle; import java.awt.Toolkit; import java.awt.event.WindowAdapter; @@ -387,8 +388,9 @@ * @param gameObjectMatchers the game object matchers * @param archetypeChooserControl the archetype chooser control * @param objectChooser the object chooser + * @param leftPanel the left panel instance */ - public void init(@NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final ArchetypeTypeSet archetypeTypeSet, final boolean mapTileListBottom, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final LeftPanel<G, A, R, V> leftPanel) { + public void init(@NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final ArchetypeTypeSet archetypeTypeSet, final boolean mapTileListBottom, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final DefaultObjectChooser<G, A, R, V> objectChooser, @NotNull final LeftPanel leftPanel) { // calculate some default values in case there is no settings file final Rectangle screen = getGraphicsConfiguration().getBounds(); final int defwidth = (int) (0.9 * screen.getWidth()); @@ -436,9 +438,10 @@ * @param selectedSquareView the selected square view * @param mapTileListBottom whether the map tile should be at the bottom * @return center panel + * @param gameObjectAttributesPanel the game object attributes panel * @param leftPanel the left panel */ - private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final LeftPanel<G, A, R, V> leftPanel) { + private JPanel createCenterPanel(final int defwidth, final int defheight, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, final boolean mapTileListBottom, @NotNull final GameObjectAttributesPanel<G, A, R, V> gameObjectAttributesPanel, @NotNull final Component leftPanel) { final JPanel centerPanel = new JPanel(new BorderLayout()); final int divLocationRight = prefs.getInt(DIVIDER_LOCATION_KEY3, (int) (defwidth * 0.62)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-08-04 00:26:58
|
Revision: 4752 http://gridarta.svn.sourceforge.net/gridarta/?rev=4752&view=rev Author: akirschbaum Date: 2008-08-04 00:26:33 +0000 (Mon, 04 Aug 2008) Log Message: ----------- Remove call to MainControl.getObjectChooser(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-03 23:24:47 UTC (rev 4751) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-08-04 00:26:33 UTC (rev 4752) @@ -230,9 +230,6 @@ 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, 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); 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>(mapManager); PathManager.setGlobalSettings(globalSettings); @@ -243,6 +240,9 @@ archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); 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 SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); + new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, 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(); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-08-03 23:24:47 UTC (rev 4751) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-08-04 00:26:33 UTC (rev 4752) @@ -291,9 +291,6 @@ 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, 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); 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); @@ -306,6 +303,9 @@ archetypeTypeSet = new ArchetypeTypeSet<GameObject, MapArchObject, Archetype>(); final ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic> replaceDialogManager = new ReplaceDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, copyBuffer); 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 SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); + new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("daieditor", this, 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(); Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-08-03 23:24:47 UTC (rev 4751) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java 2008-08-04 00:26:33 UTC (rev 4752) @@ -34,6 +34,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; @@ -56,6 +57,12 @@ /** Controller of this subview. */ private final MainControl<G, A, R, V> mainControl; + /** + * The object chooser. + */ + @NotNull + private final ObjectChooser<G, A, R> objectChooser; + /** The view for this controller. */ private final SelectedSquareView<G, A, R, V> view; @@ -85,6 +92,7 @@ * Create a SelectedSquareControl. * @param actionFactory the action factory * @param mainControl MainControl, used for icons + * @param objectChooser the object chooser * @param mapManager the map manager to use * @param editTypes the edit types instance * @param mapTileListBottom set if the map tile list should be at the bottom @@ -93,8 +101,9 @@ * 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 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) { + 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; + this.objectChooser = objectChooser; view = new SelectedSquareView<G, A, R, V>(actionFactory, this, mapManager, editTypes, mapTileListBottom, compassIcon, archetypeSet); } @@ -218,7 +227,7 @@ * @param index the list index to insert at */ private void insertGameObjectFromObjectChooser(@NotNull final MapView<G, A, R, V> mapView, final int index) { - final G gameObject = mainControl.getObjectChooser().getObjectChooserHighlight(); + final G gameObject = objectChooser.getObjectChooserHighlight(); if (gameObject == null) { return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |