From: <aki...@us...> - 2009-06-21 20:02:26
|
Revision: 6683 http://gridarta.svn.sourceforge.net/gridarta/?rev=6683&view=rev Author: akirschbaum Date: 2009-06-21 20:02:24 +0000 (Sun, 21 Jun 2009) Log Message: ----------- Do not return duplicates from DefaultMapModel.getAllGameObjects(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/map/mapmodel/DefaultMapModel.java trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java Modified: trunk/src/app/net/sf/gridarta/map/mapmodel/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/mapmodel/DefaultMapModel.java 2009-06-21 19:27:54 UTC (rev 6682) +++ trunk/src/app/net/sf/gridarta/map/mapmodel/DefaultMapModel.java 2009-06-21 20:02:24 UTC (rev 6683) @@ -1060,7 +1060,9 @@ final List<G> gameObjects = new ArrayList<G>(); for (final MapSquare<G, A, R> mapSquare : this) { for (final G gameObject : mapSquare) { - gameObjects.add(gameObject.getHead()); + if (gameObject.isHead()) { + gameObjects.add(gameObject); + } } } return gameObjects; Modified: trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java 2009-06-21 19:27:54 UTC (rev 6682) +++ trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java 2009-06-21 20:02:24 UTC (rev 6683) @@ -21,6 +21,7 @@ import java.awt.Point; import java.awt.image.BufferedImage; +import java.util.List; import java.util.Set; import java.util.SortedSet; import java.util.TreeSet; @@ -269,6 +270,29 @@ } /** + * Test case for {@link DefaultMapModel#getAllGameObjects()}: for a 1x2 + * game object only the head should be returned. + */ + @Test + public void testGetAllGameObjects1() { + final TestArchetype archetype = new TestArchetype("arch"); + archetype.setArchetype(archetype); + final TestArchetype archetype2 = new TestArchetype("arch2"); + archetype2.setArchetype(archetype2); + archetype2.setMultiY(1); + archetype.addTailPart(archetype2); + + mapModel.beginTransaction("TEST"); + mapModel.resizeMap(new Size2D(1, 2)); + final TestGameObject gameObject = mapModel.insertArchetype(archetype, new Point(0, 0), true, false, InsertionMode.AUTO); + mapModel.endTransaction(); + + final List<TestGameObject> gameObjects = mapModel.getAllGameObjects(); + Assert.assertEquals(1, gameObjects.size()); + Assert.assertEquals(gameObject, gameObjects.get(0)); + } + + /** * Inserts a game object into a map. * @param mapModel the map to add to * @param name the name of the game object to add This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-06-27 16:53:17
|
Revision: 6714 http://gridarta.svn.sourceforge.net/gridarta/?rev=6714&view=rev Author: akirschbaum Date: 2009-06-27 16:53:14 +0000 (Sat, 27 Jun 2009) Log Message: ----------- Remove singleton FaceObjectProvidersInstance. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjectProvidersInstance.java Deleted: trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjectProvidersInstance.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjectProvidersInstance.java 2009-06-27 16:38:51 UTC (rev 6713) +++ trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjectProvidersInstance.java 2009-06-27 16:53:14 UTC (rev 6714) @@ -1,30 +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.gameobject.face; - -import org.jetbrains.annotations.NotNull; - -@Deprecated -public class FaceObjectProvidersInstance { - - @NotNull - public static final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); - -} // class FaceObjectProvidersInstance Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2009-06-27 16:38:51 UTC (rev 6713) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2009-06-27 16:53:14 UTC (rev 6714) @@ -56,7 +56,7 @@ import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.anim.DefaultAnimationObjects; import net.sf.gridarta.gameobject.face.ArchFaceProvider; -import net.sf.gridarta.gameobject.face.FaceObjectProvidersInstance; +import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gameobject.match.NamedGameObjectMatcher; @@ -259,6 +259,9 @@ @NotNull private final ScriptArchData<G> scriptArchData; + @NotNull + private final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + /** * Creates a new instance. * @param animationObjectsFilename the filename of the animation objects @@ -290,7 +293,7 @@ mapArchObjectFactory = editorFactory.newMapArchObjectFactory(); mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(); - final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, FaceObjectProvidersInstance.faceObjectProviders); + final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, faceObjectProviders); globalSettings = editorFactory.newGlobalSettings(); globalSettings.readGlobalSettings(); final ArchetypeFactory<G, A, R> archetypeFactory = editorFactory.newArchetypeFactory(); @@ -298,8 +301,8 @@ archetypeSet = editorFactory.newArchetypeSet(globalSettings, archetypeFactory, gameObjectParser); mapReaderFactory = new DefaultMapReaderFactory<G, A, R>(mapArchObjectFactory, mapArchObjectParserFactory, gameObjectParserFactory, archetypeSet, mapViewSettings); final MapWriter<G, A, R> mapWriter = new DefaultMapWriter<G, A, R>(mapArchObjectParserFactory, gameObjectParser); - final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(FaceObjectProvidersInstance.faceObjectProviders); - mapControlFactory = editorFactory.newMapControlFactory(archetypeChooserModel, autojoinLists, mapViewSettings, mapWriter, FaceObjectProvidersInstance.faceObjectProviders); + final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(faceObjectProviders); + mapControlFactory = editorFactory.newMapControlFactory(archetypeChooserModel, autojoinLists, mapViewSettings, mapWriter, faceObjectProviders); mapManager = new DefaultMapManager<G, A, R>(mapReaderFactory, mapControlFactory, globalSettings, mapViewSettings); pickmapManager = new DefaultPickmapManager<G, A, R>(mapReaderFactory, mapControlFactory, globalSettings, mapViewSettings); ScriptedEventEditor.setGlobalSettings(globalSettings); @@ -308,10 +311,10 @@ editorFactory.initGameObject(archetypeTypeSet); SystemIcons.init(); final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - faceObjects = editorFactory.createFaceObjects(archFaceProvider, FaceObjectProvidersInstance.faceObjectProviders); - FaceObjectProvidersInstance.faceObjectProviders.init(doubleFaceOffset, faceObjects); + faceObjects = editorFactory.createFaceObjects(archFaceProvider, faceObjectProviders); + faceObjectProviders.init(doubleFaceOffset, faceObjects); collectables.add(archetypeSet); - animationObjects = new DefaultAnimationObjects(animationObjectsFilename, FaceObjectProvidersInstance.faceObjectProviders); + animationObjects = new DefaultAnimationObjects(animationObjectsFilename, faceObjectProviders); collectables.add(animationObjects); collectables.add(faceObjects); editorFactory.addCollectables(collectables, faceObjects); @@ -359,7 +362,7 @@ } catch (final FileNotFoundException ex) { typesErrorViewCollector.addWarning(ErrorViewCategory.TYPES_FILE_INVALID, ex.getMessage()); } - archetypeChooserControl = new ArchetypeChooserControl<G, A, R>(archetypeChooserModel, createDirectionPane, FaceObjectProvidersInstance.faceObjectProviders); + archetypeChooserControl = new ArchetypeChooserControl<G, A, R>(archetypeChooserModel, createDirectionPane, faceObjectProviders); final AbstractArchetypeParser<G, A, R> archetypeParser = editorFactory.newArchetypeParser(gameObjectParser, archetypeChooserControl, animationObjects, archetypeSet, gameObjectFactory, globalSettings); final ArchetypeTypeList eventTypeSetTmp = archetypeTypeSet.getList("event"); final ArchetypeTypeList eventTypeSet; @@ -370,14 +373,14 @@ eventTypeSet = eventTypeSetTmp; } final ScriptArchUtils scriptArchUtils = editorFactory.newScriptArchUtils(eventTypeSet); - final ScriptedEventFactory<G> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, FaceObjectProvidersInstance.faceObjectProviders); + final ScriptedEventFactory<G> scriptedEventFactory = editorFactory.newScriptedEventFactory(scriptArchUtils, faceObjectProviders); scriptArchEditor = editorFactory.newScriptArchEditor(scriptedEventFactory, scriptExtension, scriptName, scriptArchUtils.createEventTypeBox(), scriptFileFilter, globalSettings, mapManager); scriptArchEditor.initEventTypeBoxes(scriptArchUtils); scriptArchData = editorFactory.newScriptArchData(scriptedEventFactory, scriptArchUtils, scriptArchEditor); DefaultGameObject.initialize(gameObjectMatchers, animationObjects, SystemIcons.getNofaceTileIcon(), scriptArchData); - editorFactory.newArchetypeSetLoader(gameObjectParser, archetypeParser, mapViewSettings, faceObjects, animationObjects, globalSettings, archetypeSet, archFaceProvider, FaceObjectProvidersInstance.faceObjectProviders).loadArchetypes(errorView); + editorFactory.newArchetypeSetLoader(gameObjectParser, archetypeParser, mapViewSettings, faceObjects, animationObjects, globalSettings, archetypeSet, archFaceProvider, faceObjectProviders).loadArchetypes(errorView); if (spellType != 0) { - new ArchetypeSetSpellLoader<G, A, R>().load(archetypeSet, spellType, gameObjectSpells, FaceObjectProvidersInstance.faceObjectProviders); + new ArchetypeSetSpellLoader<G, A, R>().load(archetypeSet, spellType, gameObjectSpells, faceObjectProviders); gameObjectSpells.sort(); } if (spellFile != null) { @@ -409,8 +412,8 @@ public GUIMainControl<G, A, R> createGUIMainControl(@Nullable final File mapImageCacheDir, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault, @Nullable final String spellFile, @NotNull final EditorFactory<G, A, R> editorFactory) { final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(mapManager, defaultNamedFilterList); - final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, FaceObjectProvidersInstance.faceObjectProviders); - return new GUIMainControl<G, A, R>(mapManager, pickmapManager, mapViewManager, archetypeSet, faceObjects, mapImageCacheDir, globalSettings, mapViewSettings, mapControlFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, archetypeChooserControl, compassIcon, gridartaJarFilename, scriptFileFilter, scriptExtension, validators, collectables, gameObjectMatchers, errorView, mapArchObjectParserFactory, attributeRangeChecker, lockedItemsTypeNumbers, scriptsDir, scriptModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptArchData, autoValidatorDefault, rendererFactory, spellFile, allowRandomMapParameters, directionMap, filterControl, editorFactory, FaceObjectProvidersInstance.faceObjectProviders); + final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, faceObjectProviders); + return new GUIMainControl<G, A, R>(mapManager, pickmapManager, mapViewManager, archetypeSet, faceObjects, mapImageCacheDir, globalSettings, mapViewSettings, mapControlFactory, mapReaderFactory, mapArchObjectFactory, treasureTree, archetypeTypeSet, archetypeChooserControl, compassIcon, gridartaJarFilename, scriptFileFilter, scriptExtension, validators, collectables, gameObjectMatchers, errorView, mapArchObjectParserFactory, attributeRangeChecker, lockedItemsTypeNumbers, scriptsDir, scriptModel, archetypeChooserModel, animationObjects, scriptArchEditor, scriptArchData, autoValidatorDefault, rendererFactory, spellFile, allowRandomMapParameters, directionMap, filterControl, editorFactory, faceObjectProviders); } /** {@inheritDoc} */ @@ -437,7 +440,8 @@ final MapArchObjectFactory<A> mapArchObjectFactory = editorFactory.newMapArchObjectFactory(); final MapArchObjectParserFactory<A> mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(); - final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, FaceObjectProvidersInstance.faceObjectProviders); + final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory, faceObjectProviders); final GlobalSettings globalSettings = editorFactory.newGlobalSettings(); globalSettings.readGlobalSettings(); final ArchetypeFactory<G, A, R> archetypeFactory = editorFactory.newArchetypeFactory(); @@ -446,14 +450,14 @@ final MapViewSettings mapViewSettings = new MapViewSettings(); final MapReaderFactory<G, A> mapReaderFactory = new DefaultMapReaderFactory<G, A, R>(mapArchObjectFactory, mapArchObjectParserFactory, gameObjectParserFactory, archetypeSet, mapViewSettings); final MapWriter<G, A, R> mapWriter = new DefaultMapWriter<G, A, R>(mapArchObjectParserFactory, gameObjectParser); - final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(FaceObjectProvidersInstance.faceObjectProviders); + final AutojoinLists<G, A, R> autojoinLists = new AutojoinLists<G, A, R>(faceObjectProviders); final ArchetypeChooserModel<G, A, R> archetypeChooserModel = new ArchetypeChooserModel<G, A, R>(); - final MapControlFactory<G, A, R> mapControlFactory = editorFactory.newMapControlFactory(archetypeChooserModel, autojoinLists, mapViewSettings, mapWriter, FaceObjectProvidersInstance.faceObjectProviders); + final MapControlFactory<G, A, R> mapControlFactory = editorFactory.newMapControlFactory(archetypeChooserModel, autojoinLists, mapViewSettings, mapWriter, faceObjectProviders); final MapManager<G, A, R> mapManager = new DefaultMapManager<G, A, R>(mapReaderFactory, mapControlFactory, globalSettings, mapViewSettings); final Set<NamedGameObjectMatcher> matchers = new HashSet<NamedGameObjectMatcher>(); final NamedFilterList defaultNamedFilterList = new NamedFilterList(matchers); final FilterControl<G, A, R> filterControl = new DefaultFilterControl<G, A, R>(mapManager, defaultNamedFilterList); - final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, FaceObjectProvidersInstance.faceObjectProviders); + final RendererFactory<G, A, R> rendererFactory = editorFactory.newRendererFactory(mapViewSettings, filterControl, faceObjectProviders); return new ImageCreator<G, A, R>(mapManager, rendererFactory); } Modified: trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2009-06-27 16:38:51 UTC (rev 6713) +++ trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2009-06-27 16:53:14 UTC (rev 6714) @@ -31,7 +31,7 @@ import net.sf.gridarta.gameobject.TestArchetypeFactory; import net.sf.gridarta.gameobject.TestArchetypeSet; import net.sf.gridarta.gameobject.TestGameObject; -import net.sf.gridarta.gameobject.face.FaceObjectProvidersInstance; +import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gameobject.match.TypeNrsGameObjectMatcher; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; @@ -375,11 +375,12 @@ globalSettings = new TestGlobalSettings(); final MapViewSettings mapViewSettings = new MapViewSettings(); final MapWriter<TestGameObject, TestMapArchObject, TestArchetype> mapWriter = new TestMapWriter(); - final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(FaceObjectProvidersInstance.faceObjectProviders); + final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(faceObjectProviders); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory = new TestRendererFactory(); final MapViewFactory<TestGameObject, TestMapArchObject, TestArchetype> mapViewFactory = new TestMapViewFactory(rendererFactory); - final MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype> mapControlFactory = new TestMapControlFactory(mapViewFactory, mapWriter, autojoinLists, archetypeChooserModel, mapViewSettings, FaceObjectProvidersInstance.faceObjectProviders); + final MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype> mapControlFactory = new TestMapControlFactory(mapViewFactory, mapWriter, autojoinLists, archetypeChooserModel, mapViewSettings, faceObjectProviders); final AbstractMapManager<TestGameObject, TestMapArchObject, TestArchetype> tmpMapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype>(mapReaderFactory, mapControlFactory, globalSettings, mapViewSettings); tmpMapManager.setFileControl(new TestFileControl()); mapManager = tmpMapManager; Modified: trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java 2009-06-27 16:38:51 UTC (rev 6713) +++ trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java 2009-06-27 16:53:14 UTC (rev 6714) @@ -30,7 +30,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.TestArchetype; import net.sf.gridarta.gameobject.TestGameObject; -import net.sf.gridarta.gameobject.face.FaceObjectProvidersInstance; +import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.mapviewsettings.MapViewSettings; @@ -389,9 +389,10 @@ } final TestMapArchObject mapArchObject = new TestMapArchObject(); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); - final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(FaceObjectProvidersInstance.faceObjectProviders); + final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(faceObjectProviders); final MapViewSettings mapViewSettings = new MapViewSettings(); - mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(autojoinLists, null, mapArchObject, archetypeChooserModel, mapViewSettings, 0, FaceObjectProvidersInstance.faceObjectProviders); + mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(autojoinLists, null, mapArchObject, archetypeChooserModel, mapViewSettings, 0, faceObjectProviders); result.setLength(0); mapModel.addMapModelListener(mapModelListener); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-07-19 17:33:16
|
Revision: 6844 http://gridarta.svn.sourceforge.net/gridarta/?rev=6844&view=rev Author: akirschbaum Date: 2009-07-19 17:33:13 +0000 (Sun, 19 Jul 2009) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/map/maparchobject/AbstractMapArchObject.java trunk/src/app/net/sf/gridarta/map/maparchobject/MapArchObject.java trunk/src/test/net/sf/gridarta/map/maparchobject/TestMapArchObject.java Modified: trunk/src/app/net/sf/gridarta/map/maparchobject/AbstractMapArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/maparchobject/AbstractMapArchObject.java 2009-07-19 17:30:15 UTC (rev 6843) +++ trunk/src/app/net/sf/gridarta/map/maparchobject/AbstractMapArchObject.java 2009-07-19 17:33:13 UTC (rev 6844) @@ -429,12 +429,6 @@ /** {@inheritDoc} */ @Override - public void resetModified() { - attributeHasChanged = true; - } - - /** {@inheritDoc} */ - @Override public void beginTransaction() { if (transactionDepth == 0) { attributeHasChanged = false; Modified: trunk/src/app/net/sf/gridarta/map/maparchobject/MapArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/maparchobject/MapArchObject.java 2009-07-19 17:30:15 UTC (rev 6843) +++ trunk/src/app/net/sf/gridarta/map/maparchobject/MapArchObject.java 2009-07-19 17:33:13 UTC (rev 6844) @@ -203,9 +203,6 @@ */ void removeMapArchObjectListener(@NotNull MapArchObjectListener<A> listener); - /** Mark the map arch object as not modified from its initial state. */ - void resetModified(); - /** * Start a new transaction. Transactions may be nested. Transactions serve * the purpose of firing events to the views when more changes are known to Modified: trunk/src/test/net/sf/gridarta/map/maparchobject/TestMapArchObject.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/maparchobject/TestMapArchObject.java 2009-07-19 17:30:15 UTC (rev 6843) +++ trunk/src/test/net/sf/gridarta/map/maparchobject/TestMapArchObject.java 2009-07-19 17:33:13 UTC (rev 6844) @@ -206,12 +206,6 @@ /** {@inheritDoc} */ @Override - public void resetModified() { - throw new AssertionError(); - } - - /** {@inheritDoc} */ - @Override public void beginTransaction() { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-08-01 13:32:01
|
Revision: 6860 http://gridarta.svn.sourceforge.net/gridarta/?rev=6860&view=rev Author: akirschbaum Date: 2009-08-01 13:31:45 +0000 (Sat, 01 Aug 2009) Log Message: ----------- Move code from AbstractMapManager to DefaultFileControl. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java Modified: trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2009-08-01 13:04:43 UTC (rev 6859) +++ trunk/src/app/net/sf/gridarta/gui/map/MapFileActions.java 2009-08-01 13:31:45 UTC (rev 6860) @@ -19,8 +19,6 @@ package net.sf.gridarta.gui.map; -import java.io.File; -import java.io.IOException; import java.util.Set; import javax.swing.Action; import net.sf.gridarta.gameobject.Archetype; @@ -303,31 +301,16 @@ public void save() { final MapControl<G, A, R> mapControl = getSaveEnabled(); if (mapControl != null) { - try { - mapManager.save(mapControl); - } catch (final IOException e) { - fileControl.reportSaveError(mapControl.getMapModel().getMapFile(), e.getMessage()); - } + fileControl.save(mapControl); } } /** Invoked when the user wants to save the map to a file. */ public void saveAs() { final MapControl<G, A, R> mapControl = getSaveAsEnabled(); - if (mapControl == null) { - return; + if (mapControl != null) { + fileControl.saveAs(mapControl); } - - final File file = fileControl.saveLevelAs(mapControl); - if (file == null) { - return; - } - - try { - mapControl.saveAs(file); - } catch (final IOException e) { - fileControl.reportSaveError(mapControl.getMapModel().getMapFile(), e.getMessage()); - } } /** Invoked when the user wants to create an image file of the map. */ Modified: trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2009-08-01 13:04:43 UTC (rev 6859) +++ trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2009-08-01 13:31:45 UTC (rev 6860) @@ -37,7 +37,6 @@ import net.sf.gridarta.io.MapReaderFactory; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.mapcontrol.MapControl; -import net.sf.gridarta.map.mapmodel.MapModel; import net.sf.gridarta.settings.GlobalSettings; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; @@ -240,12 +239,7 @@ if (mapControl.getMapModel().isModified()) { final int result = fileControl.confirmSaveChanges(mapControl.getMapModel().getMapArchObject().getMapName()); if (result == JOptionPane.YES_OPTION) { - try { - if (!save(mapControl)) { - return false; - } - } catch (final IOException e) { - fileControl.reportSaveError(mapControl.getMapModel().getMapFile(), e.getMessage()); + if (!fileControl.save(mapControl)) { return false; } } else if (result == JOptionPane.CANCEL_OPTION || result == JOptionPane.CLOSED_OPTION) { @@ -484,35 +478,10 @@ /** {@inheritDoc} */ @Override - public boolean save(@NotNull final MapControl<G, A, R> mapControl) throws IOException { - if (mapControl.getMapModel().isPlainSaveEnabled()) { - mapControl.save(); - return true; - } - - final File file = fileControl.saveLevelAs(mapControl); - if (file != null) { - mapControl.saveAs(file); - return true; - } - - return false; - } - - /** {@inheritDoc} */ - @Override public void saveAll() { for (final MapControl<G, A, R> mapControl : getOpenedMaps()) { - final MapModel<G, A, R> mapModel = mapControl.getMapModel(); - if (mapModel.isModified()) { - try { - if (!save(mapControl)) { - return; - } - } catch (final IOException e) { - fileControl.reportSaveError(mapModel.getMapFile(), e.getMessage()); - return; - } + if (mapControl.getMapModel().isModified() && !fileControl.save(mapControl)) { + return; } } } Modified: trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2009-08-01 13:04:43 UTC (rev 6859) +++ trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2009-08-01 13:31:45 UTC (rev 6860) @@ -21,6 +21,7 @@ import java.awt.Component; import java.io.File; +import java.io.IOException; import javax.swing.JFileChooser; import javax.swing.JOptionPane; import javax.swing.filechooser.FileFilter; @@ -192,9 +193,42 @@ } /** {@inheritDoc} */ + @Override + public boolean save(@NotNull final MapControl<G, A, R> mapControl) { + if (mapControl.getMapModel().isPlainSaveEnabled()) { + try { + mapControl.save(); + } catch (final IOException ex) { + reportSaveError(mapControl.getMapModel().getMapFile(), ex.getMessage()); + return false; + } + return true; + } + + return saveAs(mapControl); + } + + /** {@inheritDoc} */ + @Override + public boolean saveAs(@NotNull final MapControl<G, A, R> mapControl) { + final File file = saveLevelAs(mapControl); + if (file == null) { + return false; + } + + try { + mapControl.saveAs(file); + } catch (final IOException ex) { + reportSaveError(file, ex.getMessage()); + return false; + } + + return true; + } + + /** {@inheritDoc} */ @Nullable - @Override - public File saveLevelAs(@NotNull final MapControl<G, A, R> mapControl) { + private File saveLevelAs(@NotNull final MapControl<G, A, R> mapControl) { final JFileChooser saveFileChooser = new JFileChooser(); saveFileChooser.setDialogTitle("Save Map Or Script As"); saveFileChooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); Modified: trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java 2009-08-01 13:04:43 UTC (rev 6859) +++ trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java 2009-08-01 13:31:45 UTC (rev 6860) @@ -25,7 +25,6 @@ import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.mapcontrol.MapControl; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; public interface FileControl<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { @@ -38,13 +37,20 @@ void openFile(boolean mapFilter); /** - * Invoked when user wants to save a map to certain file. - * @param mapControl the map to be saved - * @return the file to save to or <code>null</code> if the user cancelled + * Save one map. + * @param mapControl the map + * @return <code>false</code> if saving failed, <code>true</code> otherwise */ - @Nullable - File saveLevelAs(@NotNull MapControl<G, A, R> mapControl); + boolean save(@NotNull MapControl<G, A, R> mapControl); + /** + * Asks the user for a filename, then saves the map. + * @param mapControl the map + * @return <code>false</code> if the user cancelled the save or if saving + * failed, <code>true</code> otherwise + */ + boolean saveAs(@NotNull MapControl<G, A, R> mapControl); + int confirmSaveChanges(@NotNull String mapName); /** Modified: trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java 2009-08-01 13:04:43 UTC (rev 6859) +++ trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java 2009-08-01 13:31:45 UTC (rev 6860) @@ -21,7 +21,6 @@ import java.awt.Point; import java.io.File; -import java.io.IOException; import java.util.List; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -165,15 +164,6 @@ void refreshAllMaps(); /** - * Save one map. - * @param mapControl the map - * @return <code>false</code> if the user cancelled the save, - * <code>true</code> otherwise - * @throws IOException if saving failed - */ - boolean save(@NotNull final MapControl<G, A, R> mapControl) throws IOException; - - /** * Saves all maps. */ void saveAll(); Modified: trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java =================================================================== --- trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java 2009-08-01 13:04:43 UTC (rev 6859) +++ trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java 2009-08-01 13:31:45 UTC (rev 6860) @@ -46,12 +46,18 @@ /** {@inheritDoc} */ @Override - public File saveLevelAs(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { + public boolean save(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { throw new AssertionError(); } /** {@inheritDoc} */ @Override + public boolean saveAs(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @Override public int confirmSaveChanges(@NotNull final String mapName) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-08-01 18:00:06
|
Revision: 6861 http://gridarta.svn.sourceforge.net/gridarta/?rev=6861&view=rev Author: akirschbaum Date: 2009-08-01 17:59:53 +0000 (Sat, 01 Aug 2009) Log Message: ----------- Remove MapManager.closeAll() and MapManager.saveAll(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/MapManagerActions.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java Modified: trunk/src/app/net/sf/gridarta/gui/MapManagerActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MapManagerActions.java 2009-08-01 13:31:45 UTC (rev 6860) +++ trunk/src/app/net/sf/gridarta/gui/MapManagerActions.java 2009-08-01 17:59:53 UTC (rev 6861) @@ -23,6 +23,7 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.map.maparchobject.MapArchObject; +import net.sf.gridarta.mapmanager.FileControl; import net.sf.gridarta.mapmanager.MapManager; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; @@ -37,22 +38,21 @@ /** Action Builder. */ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - /** The map manager. */ - private final MapManager<G, A, R> mapManager; + /** The {@link FileControl} to forward to. */ + private final FileControl<G, A, R> fileControl; /** Action for "close all map windows". */ - private final Action aCloseAll; + private final Action aCloseAll = ACTION_BUILDER.createAction(true, "closeAll", this); /** The action for "save all". */ private final Action aSaveAll = ACTION_BUILDER.createAction(true, "saveAll", this); /** * Creates a new instance. - * @param mapManager the map manager to forward to + * @param fileControl the file control to forward to */ - public MapManagerActions(@NotNull final MapManager<G, A, R> mapManager) { - this.mapManager = mapManager; - aCloseAll = ACTION_BUILDER.createAction(true, "closeAll", mapManager); + public MapManagerActions(@NotNull final FileControl<G, A, R> fileControl) { + this.fileControl = fileControl; } /** Returns the {@link Action} for "close all map windows". */ @@ -62,7 +62,12 @@ /** Invoked when the user wants to save all map files. */ public void saveAll() { - mapManager.saveAll(); + fileControl.saveAll(); } + /** Invoked when the user wants to close all map files. */ + public void closeAll() { + fileControl.closeAll(); + } + } // class MapManagerActions Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2009-08-01 13:31:45 UTC (rev 6860) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2009-08-01 17:59:53 UTC (rev 6861) @@ -332,7 +332,6 @@ final MapPreviewAccessory mapPreviewAccessory = new MapPreviewAccessory(mapImageCache); final MapDesktop<G, A, R> mapDesktop = new MapDesktop<G, A, R>(mapViewManager, mapManager, mapImageCache); final ViewActions<G, A, R> viewActions = new ViewActions<G, A, R>(mapViewSettings, mapManager); - final MapManagerActions<G, A, R> mapManagerActions = new MapManagerActions<G, A, R>(mapManager); final MapFolderTree<G, A, R> mapFolderTree = new MapFolderTree<G, A, R>(globalSettings.getPickmapDir()); mainView = new MainView<G, A, R>(exitAction, statusBar, getBuildNumberAsString(), mapDesktop); final MapFileActions<G, A, R> mapFileActions = new MapFileActions<G, A, R>(this, mapManager, mapViewManager); @@ -357,6 +356,8 @@ final UpdaterManager updaterManager = new UpdaterManager(this, mapManager, mainView, gridartaJarFilename); updaterManager.startup(); scriptEditControl = new ScriptEditControl(scriptFileFilter, scriptExtension, mainView, globalSettings.getMapsDirectory(), prefs); + fileControl = new DefaultFileControl<G, A, R>(globalSettings, archetypeSet, mapPreviewAccessory, mapManager, mainView, FileFilters.mapFileFilter, scriptFileFilter, newMapDialogFactory, scriptExtension, scriptEditControl); + final MapManagerActions<G, A, R> mapManagerActions = new MapManagerActions<G, A, R>(fileControl); ScriptEditControlInstance.instance = scriptEditControl; mainActions = new MainActions<G, A, R>(replaceDialogManager, mainView, globalSettings, validators, mapViewSettings, archetypeSet, copyBuffer, objectChooser, mapManager, mapViewManager, resources, faceObjectProviders); final GameObjectMatcher floorMatcher = gameObjectMatchers.getMatcher("system_floor", "floor"); @@ -464,7 +465,6 @@ recentManager.initRecent(); } new AutoValidator<G, A, R>(validators, autoValidatorDefault, delayedMapModelListenerManager); - fileControl = new DefaultFileControl<G, A, R>(globalSettings, archetypeSet, mapPreviewAccessory, mapManager, mainView, FileFilters.mapFileFilter, scriptFileFilter, newMapDialogFactory, scriptExtension, scriptEditControl); mapFileActions.setFileControl(fileControl); ((AbstractMapManager<G, A, R>) mapManager).setFileControl(fileControl); checkForErrors(errorView); @@ -634,7 +634,7 @@ * @return whether all modified data has been saved */ private boolean canExit() { - return scriptEditControl.closeAllTabs() && mapManager.closeAll() && pickmapChooserControl.canExit() && scriptControl.canExit(); + return scriptEditControl.closeAllTabs() && fileControl.closeAll() && pickmapChooserControl.canExit() && scriptControl.canExit(); } /** Modified: trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2009-08-01 13:31:45 UTC (rev 6860) +++ trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2009-08-01 17:59:53 UTC (rev 6861) @@ -208,34 +208,29 @@ /** {@inheritDoc} */ @Override - public boolean closeAll() { - while (hasOpenedMap()) { - final MapControl<G, A, R> mapToClose; - if (currentMapControl == null) { - mapToClose = mapControls.get(mapControls.size() - 1); - } else { - mapToClose = currentMapControl; - } - if (!closeLevel(mapToClose)) { - return false; - } - } - return true; + public boolean hasOpenedMap() { + return !mapControls.isEmpty(); } /** {@inheritDoc} */ + @Nullable @Override - public boolean hasOpenedMap() { - return !mapControls.isEmpty(); + public MapControl<G, A, R> getOpenMap() { + if (currentMapControl != null) { + return currentMapControl; + } + + if (!mapControls.isEmpty()) { + return mapControls.get(mapControls.size() - 1); + } + + return null; + } - /** - * Closes the given level, asking the user whether to save changes. - * @param mapControl throws level to close - * @return <code>true</code> if the level was successfully closed, otherwise - * <code>false</code> - */ - private boolean closeLevel(@NotNull final MapControl<G, A, R> mapControl) { + /** {@inheritDoc} */ + @Override + public boolean closeLevel(@NotNull final MapControl<G, A, R> mapControl) { if (mapControl.getMapModel().isModified()) { final int result = fileControl.confirmSaveChanges(mapControl.getMapModel().getMapArchObject().getMapName()); if (result == JOptionPane.YES_OPTION) { @@ -478,16 +473,6 @@ /** {@inheritDoc} */ @Override - public void saveAll() { - for (final MapControl<G, A, R> mapControl : getOpenedMaps()) { - if (mapControl.getMapModel().isModified() && !fileControl.save(mapControl)) { - return; - } - } - } - - /** {@inheritDoc} */ - @Override public void revert(@NotNull final MapControl<G, A, R> mapControl) { final File mapFile = mapControl.getMapModel().getMapFile(); if (mapFile == null) { Modified: trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2009-08-01 13:31:45 UTC (rev 6860) +++ trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2009-08-01 17:59:53 UTC (rev 6861) @@ -210,6 +210,33 @@ /** {@inheritDoc} */ @Override + public void saveAll() { + for (final MapControl<G, A, R> mapControl : mapManager.getOpenedMaps()) { + if (mapControl.getMapModel().isModified() && !save(mapControl)) { + return; + } + } + } + + /** {@inheritDoc} */ + @Override + public boolean closeAll() { + for (;;) { + final MapControl<G, A, R> mapControl = mapManager.getOpenMap(); + if (mapControl == null) { + break; + } + + if (!mapManager.closeLevel(mapControl)) { + return false; + } + } + + return true; + } + + /** {@inheritDoc} */ + @Override public boolean saveAs(@NotNull final MapControl<G, A, R> mapControl) { final File file = saveLevelAs(mapControl); if (file == null) { Modified: trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java 2009-08-01 13:31:45 UTC (rev 6860) +++ trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java 2009-08-01 17:59:53 UTC (rev 6861) @@ -44,6 +44,19 @@ boolean save(@NotNull MapControl<G, A, R> mapControl); /** + * Saves all maps. + */ + void saveAll(); + + + /** + * Invoked when the user wants to close all levels. + * @return <code>true</code> if all levels closed, <code>false</code> if + * user cancelled. + */ + boolean closeAll(); + + /** * Asks the user for a filename, then saves the map. * @param mapControl the map * @return <code>false</code> if the user cancelled the save or if saving Modified: trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java 2009-08-01 13:31:45 UTC (rev 6860) +++ trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java 2009-08-01 17:59:53 UTC (rev 6861) @@ -54,6 +54,14 @@ MapControl<G, A, R> openMapFile(@NotNull File file, final boolean isInteractive); /** + * Closes the given level, asking the user whether to save changes. + * @param mapControl throws level to close + * @return <code>true</code> if the level was successfully closed, + * otherwise <code>false</code> + */ + boolean closeLevel(@NotNull MapControl<G, A, R> mapControl); + + /** * Load a map file and create a map view. * @param file the map file to load * @param viewPosition the view position to show initially; may be @@ -127,6 +135,13 @@ boolean hasOpenedMap(); /** + * Returns one open map. + * @return the map or <code>null</code> if no open maps exist + */ + @Nullable + MapControl<G, A, R> getOpenMap(); + + /** * Invoked when the user wants to close a map view. If there is only 1 view * left the level will be closed. * @param mapView the map view to close @@ -134,13 +149,6 @@ void closeView(@NotNull MapView<G, A, R> mapView); /** - * Invoked when the user wants to close all levels. - * @return <code>true</code> if all levels closed, <code>false</code> if - * user cancelled. - */ - boolean closeAll(); - - /** * Save thep of a file if the file is opened. * @param path path to map file */ @@ -164,11 +172,6 @@ void refreshAllMaps(); /** - * Saves all maps. - */ - void saveAll(); - - /** * Reverts one map. * @param mapControl the map to revert */ Modified: trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java =================================================================== --- trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java 2009-08-01 13:31:45 UTC (rev 6860) +++ trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java 2009-08-01 17:59:53 UTC (rev 6861) @@ -52,6 +52,18 @@ /** {@inheritDoc} */ @Override + public void saveAll() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @Override + public boolean closeAll() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @Override public boolean saveAs(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl) { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-08-30 17:31:14
|
Revision: 6891 http://gridarta.svn.sourceforge.net/gridarta/?rev=6891&view=rev Author: akirschbaum Date: 2009-08-30 17:31:06 +0000 (Sun, 30 Aug 2009) Log Message: ----------- Rewrite GSplitPane to retain divider state more reliably when maximizing the main window. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java Added Paths: ----------- trunk/src/test/net/sf/gridarta/gui/utils/GSplitPaneTestApplication.java Modified: trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java 2009-08-29 06:11:16 UTC (rev 6890) +++ trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java 2009-08-30 17:31:06 UTC (rev 6891) @@ -20,19 +20,46 @@ package net.sf.gridarta.gui.utils; import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.HierarchyEvent; +import java.awt.event.HierarchyListener; +import java.util.ArrayList; +import java.util.List; import java.util.prefs.Preferences; +import javax.swing.AbstractButton; import javax.swing.JSplitPane; +import javax.swing.border.EmptyBorder; import net.sf.gridarta.MainControl; import org.jetbrains.annotations.NotNull; /** - * Splitpane subclass that keeps its size even upon L'n'F change. - * @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> + * A {@link JSplitPane} that keeps its size even upon ancestor layout changes + * and is restored upon editor restarts. + * <p> + * The minimized or maximized state of the oneTouchExpandable buttons cannot be + * set programmatically. Therefore calling {@link + * JSplitPane#setDividerLocation(int)} does not work reliably. This class + * attempts to set the minimized/maximized state by calling the {@link + * ActionListener}s attached to these buttons. + * @author Andreas Kirschbaum */ public class GSplitPane extends JSplitPane { + /** + * The preferences value for a minimized divider. + */ + @NotNull + private static final String MIN = "min"; + + /** + * The preferences value for a maximized divider. + */ + @NotNull + private static final String MAX = "max"; + /** Serial Version UID. */ private static final long serialVersionUID = 1L; @@ -48,6 +75,52 @@ private final String preferencesKey; /** + * The {@link ActionListener}s attached to the "oneTouchExpandable" buttons + * of the {@link JSplitPane}. The size if either two or zero; zero if no + * action listeners could be found. If action listener have been found, + * index <code>0</code> is the minimize button, index <code>1</code> is the + * maximize button. + */ + @NotNull + private final List<ActionListener> actionListeners = new ArrayList<ActionListener>(); + + /** + * The default divider location. Set to <code>null</code> to not change the + * divider location. + */ + private final String defaultDividerLocation; + + /** + * The {@link HierarchyListener} for updating the initial divider location. + */ + @NotNull + private final HierarchyListener hierarchyListener = new HierarchyListener() { + @Override + public void hierarchyChanged(final HierarchyEvent e) { + if ((e.getChangeFlags() & HierarchyEvent.SHOWING_CHANGED) != 0 && isShowing()) { + removeHierarchyListener(hierarchyListener); + if (defaultDividerLocation == null) { // should not happen + // ignore + } else if (defaultDividerLocation.equals(MIN)) { + if (!actionListeners.isEmpty()) { + actionListeners.get(0).actionPerformed(new ActionEvent(GSplitPane.this, 0, "")); + } + } else if (defaultDividerLocation.equals(MAX)) { + if (!actionListeners.isEmpty()) { + actionListeners.get(1).actionPerformed(new ActionEvent(GSplitPane.this, 0, "")); + } + } else { + try { + setDividerLocation(Integer.parseInt(defaultDividerLocation)); + } catch (final NumberFormatException ex) { + // ignore + } + } + } + } + }; + + /** * Create a new GSplitPane. * @param newOrientation {@link JSplitPane#HORIZONTAL_SPLIT} or {@link * JSplitPane#VERTICAL_SPLIT}. @@ -58,36 +131,121 @@ * @param preferencesKey the preferences key for restoring the divider * location * @param defaultDividerLocation the default divider location in case none - * has been saved; <code>-1</code> to not set the divider location when no + * has been saved; <code>-1</code> to not set the divider location if no * default divider location has been saved */ public GSplitPane(final int newOrientation, @NotNull final Component newLeftComponent, @NotNull final Component newRightComponent, @NotNull final String preferencesKey, final int defaultDividerLocation) { super(newOrientation, newLeftComponent, newRightComponent); this.preferencesKey = preferencesKey; setOneTouchExpandable(true); - final int dividerLocation = prefs.getInt(preferencesKey, defaultDividerLocation); - if (dividerLocation != -1) { - setDividerLocation(dividerLocation); + this.defaultDividerLocation = prefs.get(preferencesKey, defaultDividerLocation == -1 ? null : Integer.toString(defaultDividerLocation)); + + // Hacks to circumvent undesired behavior when maximizing/de-maximizing + // the application's main window: without this code, the mimimized or + // maximized state (oneTouchExpandable) does not stick and cannot be + // restored when the editor is restarted. + // + // This code walks the component hierarchy trying to find the + // oneTouchExpandable buttons. The contained ActionListeners are + // replaced with a proxy that shows the left/right component as + // appropriate for the action. + setBorder(new EmptyBorder(0, 0, 0, 0)); + for (final Component component : getComponents()) { + if (component != newLeftComponent && component != newRightComponent) { + if (component instanceof Container) { + final Container container = (Container) component; + for (final Component component2 : container.getComponents()) { + if (component2 instanceof AbstractButton) { + final AbstractButton button = (AbstractButton) component2; + for (final ActionListener actionListener : button.getActionListeners()) { + if (actionListener.getClass().getName().endsWith("$OneTouchActionHandler")) { + actionListeners.add(actionListener); + button.removeActionListener(actionListener); + if (actionListeners.size() == 1) { + button.addActionListener(new ActionListener() { + /** {@inheritDoc} */ + @Override + public void actionPerformed(final ActionEvent e) { + getRightComponent().setVisible(true); + actionListener.actionPerformed(e); + } + }); + } else { + button.addActionListener(new ActionListener() { + /** {@inheritDoc} */ + @Override + public void actionPerformed(final ActionEvent e) { + getLeftComponent().setVisible(true); + actionListener.actionPerformed(e); + } + }); + } + break; + } + } + } + } + } + } } + if (actionListeners.size() != 2) { + actionListeners.clear(); + } + if (this.defaultDividerLocation != null) { + addHierarchyListener(hierarchyListener); + } } /** - * Saves the current divider location. + * Saves the current divider location into the preferences. */ public void saveLocation() { - prefs.putInt(preferencesKey, getDividerLocation()); + final int dividerLocation = getDividerLocation(); + if (dividerLocation != -1) { + final String value; + switch (getState(dividerLocation)) { + case -1: + value = MIN; + break; + + default: + value = Integer.toString(dividerLocation); + break; + + case +1: + value = MAX; + break; + } + prefs.put(preferencesKey, value); + } } /** {@inheritDoc} */ - // Overridden to store and restore the divider location upon UI change. @Override - public void updateUI() { - final int dividerLocationBackup = getDividerLocation(); - final int dividerSizeBackup = getDividerSize(); - super.updateUI(); - setDividerLocation(dividerLocationBackup); - if (dividerSizeBackup > 0) { - setDividerSize(dividerSizeBackup); + public void setDividerLocation(final int location) { + super.setDividerLocation(location); + final int state = getState(location); + getLeftComponent().setVisible(state != -1); + getRightComponent().setVisible(state != +1); + } + + /** + * Returns the minimized/maximimzed state for a given divider location. + * @param dividerLocation the divider location to get the state of + * @return the state: <code>-1</code>=minimized, <code>0</code>=normal, + * <code>+1</code>=maximized + */ + private int getState(final int dividerLocation) { + final Dimension leftSize = leftComponent.getMinimumSize(); + final Dimension rightSize = rightComponent.getMinimumSize(); + final int minLimit = getOrientation() == HORIZONTAL_SPLIT ? leftSize.width : leftSize.height; + final int maxLimit = getOrientation() == HORIZONTAL_SPLIT ? getWidth()-rightSize.width-getDividerSize() : getHeight()-rightSize.height-getDividerSize(); + if (dividerLocation < minLimit) { + return -1; + } else if (dividerLocation > maxLimit) { + return +1; + } else { + return 0; } } Added: trunk/src/test/net/sf/gridarta/gui/utils/GSplitPaneTestApplication.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/utils/GSplitPaneTestApplication.java (rev 0) +++ trunk/src/test/net/sf/gridarta/gui/utils/GSplitPaneTestApplication.java 2009-08-30 17:31:06 UTC (rev 6891) @@ -0,0 +1,111 @@ +/* + * 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.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.lang.reflect.InvocationTargetException; +import javax.swing.AbstractButton; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.SwingUtilities; +import org.jetbrains.annotations.NotNull; + +/** + * Simple application for testing {@link GSplitPane} behavior. Displays a + * {@link JFrame} consisting of colored areas separated by {@link GSplitPane}s. + * @author Andreas Kirschbaum + */ +public class GSplitPaneTestApplication { + + /** + * The minimal size of components. + */ + private static final int MIN_SIZE = 2; + + /** + * Private constructor to prevent instantiation. + */ + private GSplitPaneTestApplication() { + } + + /** + * The entry point of the application. + * @param args the command-line arguments (ignored) + * @throws InterruptedException if an unexpected error occurs + * @throws InvocationTargetException if an unexpected error occurs + */ + public static void main(final String[] args) throws InterruptedException, InvocationTargetException { + SwingUtilities.invokeAndWait(new Runnable() { + @Override + public void run() { + final JPanel green = newPanel(MIN_SIZE, MIN_SIZE, Color.GREEN); + final JPanel blue = newPanel(MIN_SIZE, MIN_SIZE, Color.BLUE); + final JPanel yellow = newPanel(MIN_SIZE, MIN_SIZE, Color.YELLOW); + final JPanel orange = newPanel(MIN_SIZE, MIN_SIZE, Color.ORANGE); + final GSplitPane splitPane1 = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, green, blue, "TEST_GREEN_BLUE", 70); + splitPane1.setResizeWeight(0.5); + final GSplitPane splitPane2 = new GSplitPane(JSplitPane.VERTICAL_SPLIT, splitPane1, yellow, "TEST_GREENBLUE_YELLOW", 40); + final GSplitPane splitPane3 = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, orange, splitPane2, "TEST_ORANGE_GREENBLUEYELLOW", 30); + final AbstractButton button = new JButton("save divider locations and quit"); + final Window frame = new JFrame(); + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(final ActionEvent e) { + splitPane1.saveLocation(); + splitPane2.saveLocation(); + splitPane3.saveLocation(); + frame.setVisible(false); + System.exit(0); + } + }); + frame.setLayout(new BorderLayout()); + frame.add(button, BorderLayout.SOUTH); + frame.add(splitPane3); + frame.pack(); + frame.setSize(new Dimension(800, 600)); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + }); + } + + /** + * Creates a new colored area. + * @param width the minimal width of the area + * @param height the minimal height of the area + * @param color the color of the area + * @return the area + */ + private static JPanel newPanel(final int width, final int height, @NotNull final Color color) { + final JPanel panel = new JPanel(); + panel.setMinimumSize(new Dimension(width, height)); + panel.setOpaque(true); + panel.setBackground(color); + return panel; + } + +} Property changes on: trunk/src/test/net/sf/gridarta/gui/utils/GSplitPaneTestApplication.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-09-27 22:41:34
|
Revision: 6967 http://gridarta.svn.sourceforge.net/gridarta/?rev=6967&view=rev Author: akirschbaum Date: 2009-09-27 22:41:27 +0000 (Sun, 27 Sep 2009) Log Message: ----------- Remove MapManager.reportSaveError(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java Modified: trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java 2009-09-27 22:27:54 UTC (rev 6966) +++ trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java 2009-09-27 22:41:27 UTC (rev 6967) @@ -31,6 +31,7 @@ import net.sf.gridarta.map.mapcontrol.MapControl; import net.sf.gridarta.map.mapmodel.InsertionMode; import net.sf.gridarta.map.mapmodel.MapModel; +import net.sf.gridarta.mapmanager.FileControl; import net.sf.gridarta.mapmanager.MapManager; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -66,6 +67,8 @@ @NotNull private final MapManager<G, A, R> mapManager; + private final FileControl<G, A, R> fileControl; + /** * Creates a new instance. * @param exitConnectorModel the exit connector model to use @@ -73,11 +76,12 @@ * @param archetypeSet the archetype set to use * @param mapManager the map manager for loading maps */ - public ExitConnectorActions(@NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ExitMatcher<G, A, R> exitMatcher, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R> mapManager) { + public ExitConnectorActions(@NotNull final ExitConnectorModel exitConnectorModel, @NotNull final ExitMatcher<G, A, R> exitMatcher, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R> mapManager, @NotNull final FileControl<G, A, R> fileControl) { this.exitConnectorModel = exitConnectorModel; this.exitMatcher = exitMatcher; this.archetypeSet = archetypeSet; this.mapManager = mapManager; + this.fileControl = fileControl; } /** @@ -251,7 +255,7 @@ try { sourceMapControl.save(); } catch (final IOException ex) { - mapManager.reportSaveError(sourceMapControl, ex.getMessage()); + fileControl.reportSaveError(sourceMapControl, ex.getMessage()); } } } finally { Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2009-09-27 22:27:54 UTC (rev 6966) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2009-09-27 22:41:27 UTC (rev 6967) @@ -413,7 +413,7 @@ final MainToolbar mainToolbar = new MainToolbar(globalSettings); mainView.init(gameObjectAttributesControl, selectedSquareView, leftPanel, menuBar, globalSettings, mainToolbar.getComponent()); exitConnectorModel = new ExitConnectorModel(); // XXX: should be part of DefaultMainControl - final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, archetypeSet, mapManager); // XXX: should be part of DefaultMainControl + final ExitConnectorActions<G, A, R> exitConnectorActions = new ExitConnectorActions<G, A, R>(exitConnectorModel, exitMatcher, archetypeSet, mapManager, fileControl); // XXX: should be part of DefaultMainControl new ExitConnectorController<G, A, R>(exitConnectorActions, exitConnectorModel, mapViewManager); final JMenu windowMenu = getMenu(menuBar, "window"); if (windowMenu == null) { Modified: trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2009-09-27 22:27:54 UTC (rev 6966) +++ trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2009-09-27 22:41:27 UTC (rev 6967) @@ -530,13 +530,4 @@ mapControl.levelCloseNotify(); } - /** {@inheritDoc} */ - @Deprecated - @Override - public void reportSaveError(@NotNull final MapControl<G, A, R> mapControl, @NotNull final String message) { - final File file = mapControl.getMapModel().getMapFile(); - assert file != null; - fileControl.reportSaveError(file, message); - } - } // class AbstractMapManager Modified: trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2009-09-27 22:27:54 UTC (rev 6966) +++ trunk/src/app/net/sf/gridarta/mapmanager/DefaultFileControl.java 2009-09-27 22:41:27 UTC (rev 6967) @@ -321,6 +321,14 @@ /** {@inheritDoc} */ @Override + public void reportSaveError(@NotNull final MapControl<G, A, R> mapControl, @NotNull final String message) { + final File file = mapControl.getMapModel().getMapFile(); + assert file != null; + reportSaveError(file, message); + } + + /** {@inheritDoc} */ + @Override public void reportSaveError(@NotNull final File mapFile, @NotNull final String message) { ACTION_BUILDER.showMessageDialog(parent, "encodeMapFile", mapFile, message); } Modified: trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java 2009-09-27 22:27:54 UTC (rev 6966) +++ trunk/src/app/net/sf/gridarta/mapmanager/FileControl.java 2009-09-27 22:41:27 UTC (rev 6967) @@ -73,6 +73,18 @@ */ boolean confirmRevertMap(@NotNull String mapName); + /** + * Reports an error while saving a map file to the user. + * @param mapControl the map control that failed saving + * @param message the error message + */ + void reportSaveError(@NotNull MapControl<G, A, R> mapControl, @NotNull String message); + + /** + * Reports an error while saving a map file to the user. + * @param mapFile the map file that failed saving + * @param message the error message + */ void reportSaveError(@NotNull File mapFile, @NotNull String message); void reportLoadError(@NotNull File file, @NotNull String message); Modified: trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java 2009-09-27 22:27:54 UTC (rev 6966) +++ trunk/src/app/net/sf/gridarta/mapmanager/MapManager.java 2009-09-27 22:41:27 UTC (rev 6967) @@ -193,12 +193,4 @@ */ void release(@NotNull MapControl<G, A, R> mapControl); - /** - * Reports an error while saving a map file to the user. - * @param mapControl the map control that failed saving - * @param message the error message - */ - @Deprecated - void reportSaveError(@NotNull MapControl<G, A, R> mapControl, @NotNull String message); - } // interface MapManager Modified: trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2009-09-27 22:27:54 UTC (rev 6966) +++ trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2009-09-27 22:41:27 UTC (rev 6967) @@ -409,7 +409,7 @@ * @return the new exit connector actions instance */ private ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype> createActions(@NotNull final ExitConnectorModel model) { - return new ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype>(model, exitMatcher, archetypeSet, mapManager); + return new ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype>(model, exitMatcher, archetypeSet, mapManager, new TestFileControl()); } /** Modified: trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java =================================================================== --- trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java 2009-09-27 22:27:54 UTC (rev 6966) +++ trunk/src/test/net/sf/gridarta/mapmanager/TestFileControl.java 2009-09-27 22:41:27 UTC (rev 6967) @@ -82,6 +82,12 @@ /** {@inheritDoc} */ @Override + public void reportSaveError(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl, @NotNull final String message) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @Override public void reportSaveError(@NotNull final File mapFile, @NotNull final String message) { sb.append("reportSaveError: "); sb.append(mapFile); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-09-28 11:01:34
|
Revision: 6969 http://gridarta.svn.sourceforge.net/gridarta/?rev=6969&view=rev Author: akirschbaum Date: 2009-09-28 11:01:08 +0000 (Mon, 28 Sep 2009) Log Message: ----------- Whitespace changes. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeMapPath.java trunk/src/app/net/sf/gridarta/archtype/CAttribBitmask.java trunk/src/app/net/sf/gridarta/filter/BasicFilterConfig.java trunk/src/app/net/sf/gridarta/filter/DefaultFilterControl.java trunk/src/app/net/sf/gridarta/gameobject/GameObjectContainer.java trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java trunk/src/app/net/sf/gridarta/gameobject/match/AttribGameObjectMatcher.java trunk/src/app/net/sf/gridarta/gameobject/match/NamedGameObjectMatcher.java trunk/src/app/net/sf/gridarta/gameobject/match/ViewGameObjectMatcherManager.java trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptedEvent.java trunk/src/app/net/sf/gridarta/gui/MainActions.java trunk/src/app/net/sf/gridarta/gui/RecentManager.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttrib.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribList.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribSpell.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribZSpell.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TreeChooseAction.java trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpAdapter.java trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java trunk/src/app/net/sf/gridarta/gui/map/tools/AbstractTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/BasicAbstractTool.java trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ArchetypeNameMatchCriteria.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ObjectNameMatchCriteria.java trunk/src/app/net/sf/gridarta/gui/script/ClosingIcon.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapSquareSelectionListener.java trunk/src/app/net/sf/gridarta/gui/undo/UndoControl.java trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java trunk/src/app/net/sf/gridarta/gui/utils/HideFileFilterProxy.java trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java trunk/src/app/net/sf/gridarta/help/Help.java trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java trunk/src/app/net/sf/gridarta/io/AbstractMapArchObjectParser.java trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java trunk/src/app/net/sf/gridarta/io/PathManager.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java trunk/src/app/net/sf/gridarta/map/mapmodel/MapSquare.java trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java trunk/src/app/net/sf/gridarta/mapmanager/DelayedMapModelListenerManager.java trunk/src/app/net/sf/gridarta/preferences/Storage.java trunk/src/app/net/sf/gridarta/script/ScriptController.java trunk/src/app/net/sf/gridarta/script/ScriptExecException.java trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java trunk/src/app/net/sf/gridarta/spells/SpellsUtils.java trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java trunk/src/app/net/sf/gridarta/updater/Updater.java trunk/src/app/net/sf/gridarta/utils/IOUtils.java trunk/src/app/net/sf/gridarta/utils/ProcessRunner.java trunk/src/test/net/sf/gridarta/Size2DTest.java trunk/src/test/net/sf/gridarta/gameobject/AttributeListUtilsTest.java trunk/src/test/net/sf/gridarta/gameobject/match/NamedGameObjectMatcherTest.java trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java trunk/src/test/net/sf/gridarta/utils/WrappingStringBuilderTest.java Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeMapPath.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeMapPath.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeMapPath.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -75,7 +75,7 @@ @NotNull @Override public GuiInfo<G, A, R> createGui(@NotNull final G gameObject, @NotNull final R archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final MapSquare<G,A,R> mapSquare = gameObject.getMapSquare(); + final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); File relativeReference = mapSquare == null ? null : mapSquare.getMapModel().getMapFile(); if (relativeReference == null) { relativeReference = new File(globalSettings.getMapDir(), "dummy"); Modified: trunk/src/app/net/sf/gridarta/archtype/CAttribBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/CAttribBitmask.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/archtype/CAttribBitmask.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -200,7 +200,7 @@ * @return <code>String</code> with all entries belonging to the bitmask */ @NotNull - @SuppressWarnings({"FeatureEnvy"}) + @SuppressWarnings({ "FeatureEnvy" }) // feature envy is natural here - WrappingStringBuilder is a kind of library class. public String getText(final int value) { final WrappingStringBuilder sb = new WrappingStringBuilder(MAX_CHARS_PER_LINE); Modified: trunk/src/app/net/sf/gridarta/filter/BasicFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/filter/BasicFilterConfig.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/filter/BasicFilterConfig.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -26,7 +26,7 @@ * Abstract base class for filter configurations. * @author tchize */ -@SuppressWarnings({"AbstractClassWithoutAbstractMethods"}) +@SuppressWarnings({ "AbstractClassWithoutAbstractMethods" }) public abstract class BasicFilterConfig implements FilterConfig { /** The Logger for printing log messages. */ Modified: trunk/src/app/net/sf/gridarta/filter/DefaultFilterControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/filter/DefaultFilterControl.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/filter/DefaultFilterControl.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -121,7 +121,7 @@ public void objectInSquare(@NotNull final FilterState filterState, @NotNull final G gameObject) { for (int i = 0; i < MAX_HIGHLIGHT; i++) { if (highlightConfig[i].isEnabled()) { - if(!filterState.isHighlightedSquare(i)) { + if (!filterState.isHighlightedSquare(i)) { filterState.setHighlightedSquare(i, filterList.match(highlightConfig[i], gameObject)); } } Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObjectContainer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObjectContainer.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObjectContainer.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -41,7 +41,7 @@ * @todo In case of MapSquares, this class is most likely bogus regarding * multipart objects. This needs to be fixed. */ -@SuppressWarnings({"ClassReferencesSubclass"}) +@SuppressWarnings({ "ClassReferencesSubclass" }) public abstract class GameObjectContainer<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Iterable<G>, Serializable { /** Serial Version. */ @@ -584,7 +584,7 @@ /** {@inheritDoc} */ // previous can throw NoSuchElementException but InspectionGadgets doesn't know about that. - @SuppressWarnings({"IteratorNextCanNotThrowNoSuchElementException"}) + @SuppressWarnings({ "IteratorNextCanNotThrowNoSuchElementException" }) @NotNull @Override public T next() { Modified: trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gameobject/face/CollectedFaceProvider.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -38,7 +38,7 @@ * @todo Move parsing of the face files to this class, so the faces can be * easily reloaded while the application is running. */ -@SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) +@SuppressWarnings({ "IOResourceOpenedButNotSafelyClosed" }) public class CollectedFaceProvider extends AbstractFaceProvider { /** Modified: trunk/src/app/net/sf/gridarta/gameobject/match/AttribGameObjectMatcher.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/match/AttribGameObjectMatcher.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gameobject/match/AttribGameObjectMatcher.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -41,7 +41,7 @@ private final String value; /** Operator to use. */ - @SuppressWarnings({"InstanceVariableNamingConvention"}) + @SuppressWarnings({ "InstanceVariableNamingConvention" }) @NotNull private final Op op; @@ -49,7 +49,7 @@ private final boolean useDefArch; /** Operator. */ - @SuppressWarnings({"EnumeratedConstantNamingConvention", "EnumeratedClassNamingConvention"}) + @SuppressWarnings({ "EnumeratedConstantNamingConvention", "EnumeratedClassNamingConvention" }) public enum Op { eq, @@ -76,7 +76,7 @@ } /** {@inheritDoc} */ - @SuppressWarnings({"CallToStringCompareTo"}) + @SuppressWarnings({ "CallToStringCompareTo" }) @Override public boolean isMatching(@NotNull final GameObject<?, ?, ?> arch) { final String actual = arch.getAttributeString(name, useDefArch); Modified: trunk/src/app/net/sf/gridarta/gameobject/match/NamedGameObjectMatcher.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/match/NamedGameObjectMatcher.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gameobject/match/NamedGameObjectMatcher.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -61,7 +61,7 @@ private final GameObjectMatcher gameObjectMatcher; /** The id of this {@link GameObjectMatcher}. */ - @SuppressWarnings({"InstanceVariableNamingConvention"}) + @SuppressWarnings({ "InstanceVariableNamingConvention" }) @NotNull private final String id; Modified: trunk/src/app/net/sf/gridarta/gameobject/match/ViewGameObjectMatcherManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/match/ViewGameObjectMatcherManager.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gameobject/match/ViewGameObjectMatcherManager.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -102,7 +102,7 @@ * Creates a <code>ResetAction</code>. * @param actions the <code>Action</code>s to reset */ - @SuppressWarnings({"AssignmentToCollectionOrArrayFieldFromParameter"}) + @SuppressWarnings({ "AssignmentToCollectionOrArrayFieldFromParameter" }) ResetAction(@NotNull final List<? extends GameObjectMatcherToggleAction> actions) { this.actions = actions; } Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptedEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptedEvent.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptedEvent.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -29,7 +29,7 @@ * Class which stores information about one scripted event. * @author Andreas Kirschbaum */ -public abstract class AbstractScriptedEvent<G extends GameObject<G, ?, ?>> implements ScriptedEvent<G>{ +public abstract class AbstractScriptedEvent<G extends GameObject<G, ?, ?>> implements ScriptedEvent<G> { /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(AbstractScriptedEvent.class); Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -609,7 +609,7 @@ */ private int getFillDensity(@NotNull final String title) { String input = "100"; - for (; ;) { + for (;;) { input = (String) JOptionPane.showInputDialog(parent, "Enter a fill density between 1-100", title, JOptionPane.QUESTION_MESSAGE, null, null, input); if (input == null) { return -1; Modified: trunk/src/app/net/sf/gridarta/gui/RecentManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -63,7 +63,7 @@ private final MapManager<G, A, R> mapManager; /** List with recents. */ - @SuppressWarnings({"CollectionDeclaredAsConcreteClass"}) + @SuppressWarnings({ "CollectionDeclaredAsConcreteClass" }) private final LinkedList<Recent<G, A, R>> recents = new LinkedList<Recent<G, A, R>>(); /** The "recent" menu to update. */ Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -182,7 +182,7 @@ final JButton searchButton = new JButton(ACTION_BUILDER.createAction(false, "findArchetypesSearch", this)); final JButton closeButton = new JButton(ACTION_BUILDER.createAction(false, "findArchetypesClose", this)); - final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new JButton[] {searchButton, closeButton,}, searchButton); + final JOptionPane optionPane = new JOptionPane(panel, JOptionPane.PLAIN_MESSAGE, JOptionPane.DEFAULT_OPTION, null, new JButton[] { searchButton, closeButton, }, searchButton); optionPane.setInitialValue(nameField); dialog = optionPane.createDialog(parent, ACTION_BUILDER.getString("findArchetypesTitle")); dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ConfirmErrorsAL.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -42,7 +42,7 @@ * @param keepB button "keep what is in the textfield" * @param textNew textfield containing the error-text to keep */ - @SuppressWarnings({"PublicConstructorInNonPublicClass"}) + @SuppressWarnings({ "PublicConstructorInNonPublicClass" }) public ConfirmErrorsAL(final JDialog dialog, final GameObject<?, ?, ?> gameObject, final String errors, final JButton keepB, final JTextArea textNew) { this.gameObject = gameObject; keepButton = keepB; Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttrib.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttrib.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttrib.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -55,7 +55,7 @@ } @NotNull - public ArchetypeAttribute<? ,?, ?> getRef() { + public ArchetypeAttribute<?, ?, ?> getRef() { return ref; } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribList.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribList.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribList.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -66,7 +66,7 @@ // get selected index of ComboBox final int attrValTmp = input.getSelectedIndex(); // fetch value according to this list entry: - final int attrVal = archetypeTypeSet.getList(((ArchetypeAttributeList<G, A, R>) getRef()).getListName()).get(attrValTmp).getFirst();// attribute value + final int attrVal = archetypeTypeSet.getList(((ArchetypeAttributeList<G, A, R>) getRef()).getListName()).get(attrValTmp).getFirst(); // attribute value final String archetypeAttributeName = getRef().getArchetypeAttributeName(); if (archetype.getAttributeInt(archetypeAttributeName) != attrVal) { Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribSpell.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribSpell.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -64,7 +64,7 @@ @Override public String getText2(@NotNull final G gameObject, @NotNull final R archetype, final String[] newName, final String[] newMsg, final String[] newAnim, final ArchetypeType<G, A, R> typeStruct, final Component parent) { final int index = input.getSelectedIndex(); - final int attrVal = index == 0 ? 0 : numberSpells.getSpell(index - 1).getNumber();// attribute value + final int attrVal = index == 0 ? 0 : numberSpells.getSpell(index - 1).getNumber(); // attribute value final String archetypeAttributeName = getRef().getArchetypeAttributeName(); if (archetype.getAttributeInt(archetypeAttributeName) != attrVal) { return archetypeAttributeName + " " + attrVal; Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribZSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribZSpell.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribZSpell.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -70,7 +70,7 @@ @Override public String getText2(@NotNull final G gameObject, @NotNull final R archetype, final String[] newName, final String[] newMsg, final String[] newAnim, final ArchetypeType<G, A, R> typeStruct, final Component parent) { final int index = input.getSelectedIndex(); - final int attrVal = index == 0 ? undefinedSpellIndex : numberSpells.getSpell(index - 1).getNumber();// attribute value + final int attrVal = index == 0 ? undefinedSpellIndex : numberSpells.getSpell(index - 1).getNumber(); // attribute value final String archetypeAttributeName = getRef().getArchetypeAttributeName(); if (archetype.getAttributeInt(archetypeAttributeName) != attrVal) { return archetypeAttributeName + " " + attrVal; Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/StringKeyManager.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -21,7 +21,7 @@ * Create a StringKeyManager. * @param box JComboBox to create StringKeyManager for */ - @SuppressWarnings({"PublicConstructorInNonPublicClass"}) + @SuppressWarnings({ "PublicConstructorInNonPublicClass" }) public StringKeyManager(final JComboBox box) { this.box = box; } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TreeChooseAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TreeChooseAction.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/TreeChooseAction.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -27,7 +27,7 @@ * @param textField JTextField to update upon tree selection * @param objects NamedObjects that provide the tree */ - @SuppressWarnings({"PublicConstructorInNonPublicClass"}) + @SuppressWarnings({ "PublicConstructorInNonPublicClass" }) public TreeChooseAction(final String text, final JTextField textField, final NamedObjects<? extends NamedObject> objects) { super(text); this.textField = textField; Modified: trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpAdapter.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpAdapter.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpAdapter.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -27,7 +27,7 @@ * Event Listener Adapater for {@link net.sf.gridarta.gui.map.event.MouseOpListener}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -@SuppressWarnings({"NoopMethodInAbstractClass"}) +@SuppressWarnings({ "NoopMethodInAbstractClass" }) public abstract class MouseOpAdapter<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MouseOpListener<G, A, R> { /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/map/event/MouseOpEvent.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -66,7 +66,7 @@ * The type of event. * @see java.awt.AWTEvent#getID() */ - @SuppressWarnings({"InstanceVariableNamingConvention"}) + @SuppressWarnings({ "InstanceVariableNamingConvention" }) private int id; /** Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -800,7 +800,7 @@ */ @Nullable private MapControl<G, A, R> getTileShowEnabled() { - return null;//currentMapListener.getCurrentMapControl(); + return null; //currentMapListener.getCurrentMapControl(); } /** Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/AbstractTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/AbstractTool.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/AbstractTool.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -28,7 +28,7 @@ * Base class for tools. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -@SuppressWarnings({"AbstractClassWithOnlyOneDirectInheritor"}) +@SuppressWarnings({ "AbstractClassWithOnlyOneDirectInheritor" }) public abstract class AbstractTool<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends MouseOpAdapter<G, A, R> implements Tool<G, A, R> { /** Create an AbstractTool. */ Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/BasicAbstractTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/BasicAbstractTool.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/BasicAbstractTool.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -32,7 +32,7 @@ public abstract class BasicAbstractTool<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractTool<G, A, R> { /** The ID of this tool. */ - @SuppressWarnings({"InstanceVariableNamingConvention"}) + @SuppressWarnings({ "InstanceVariableNamingConvention" }) @NotNull @NonNls private final String id; Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -112,7 +112,7 @@ * Add a tool to this tool selector. * @param tool Tool to add */ - @SuppressWarnings({"MethodOverloadsMethodOfSuperclass"}) + @SuppressWarnings({ "MethodOverloadsMethodOfSuperclass" }) public void add(@NotNull final Tool<G, A, R> tool) { add(tool, false); } Modified: trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/mapdesktop/MapDesktop.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -269,7 +269,7 @@ private void removeLevelView(@NotNull final MapView<G, A, R> mapView) { mapView.removeInternalFrameListener(internalFrameListener); mapViewManager.removeMapView(mapView); - if(windowActions.remove(mapView) == null) + if (windowActions.remove(mapView) == null) { assert false; } Modified: trunk/src/app/net/sf/gridarta/gui/replacedialog/ArchetypeNameMatchCriteria.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/replacedialog/ArchetypeNameMatchCriteria.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/replacedialog/ArchetypeNameMatchCriteria.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -24,7 +24,7 @@ * @param archetypeName the archetype name to match */ public ArchetypeNameMatchCriteria(@NotNull final String archetypeName) { - this.archetypeName = Pattern.compile(GlobFileFilter.createPatternForGlob(archetypeName), Pattern.DOTALL|Pattern.CASE_INSENSITIVE); + this.archetypeName = Pattern.compile(GlobFileFilter.createPatternForGlob(archetypeName), Pattern.DOTALL | Pattern.CASE_INSENSITIVE); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gui/replacedialog/ObjectNameMatchCriteria.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/replacedialog/ObjectNameMatchCriteria.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/replacedialog/ObjectNameMatchCriteria.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -24,7 +24,7 @@ * @param objectName the object name to match */ public ObjectNameMatchCriteria(@NotNull final String objectName) { - this.objectName = Pattern.compile(GlobFileFilter.createPatternForGlob(objectName), Pattern.DOTALL|Pattern.CASE_INSENSITIVE); + this.objectName = Pattern.compile(GlobFileFilter.createPatternForGlob(objectName), Pattern.DOTALL | Pattern.CASE_INSENSITIVE); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/gui/script/ClosingIcon.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ClosingIcon.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/script/ClosingIcon.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -33,10 +33,10 @@ private final Icon icon; - @SuppressWarnings({"InstanceVariableNamingConvention"}) + @SuppressWarnings({ "InstanceVariableNamingConvention" }) private int x = 0; - @SuppressWarnings({"InstanceVariableNamingConvention"}) + @SuppressWarnings({ "InstanceVariableNamingConvention" }) private int y = 0; private int height = 10; Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/CellRenderer.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -100,7 +100,7 @@ int indent = 0; if (arch != null) { - for (; ;) { + for (;;) { final G env = arch.getContainerGameObject(); if (env == null) { break; Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapSquareSelectionListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapSquareSelectionListener.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapSquareSelectionListener.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -39,6 +39,6 @@ * @param gameObject the selected game object * @param index the selected index */ - void selectionChanged(@Nullable MapSquare<G,A,R> mapSquare, @Nullable G gameObject, int index); + void selectionChanged(@Nullable MapSquare<G, A, R> mapSquare, @Nullable G gameObject, int index); } // interface MapSquareSelectionListener Modified: trunk/src/app/net/sf/gridarta/gui/undo/UndoControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/undo/UndoControl.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/undo/UndoControl.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -104,7 +104,7 @@ assert savedUndoState != null; final UndoModel<G, A, R> savedUndoModel = undoModel; assert savedUndoModel != null; - if(savedSquares.isEmpty() + if (savedSquares.isEmpty() && savedUndoState.getMapArchObject().equals(mapModel.getMapArchObject())) { return; } Modified: trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/utils/DirectionLayout.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -37,7 +37,7 @@ * width and height. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -@SuppressWarnings({"EnumeratedConstantNamingConvention", "InstanceVariableNamingConvention"}) +@SuppressWarnings({ "EnumeratedConstantNamingConvention", "InstanceVariableNamingConvention" }) public class DirectionLayout implements LayoutManager2, Serializable { /** Serial Version. */ @@ -58,7 +58,7 @@ * #S}, {@link #W}, {@link #NE}, {@link #SE}, {@link #SW}, {@link #NW}. * @todo this enum is somewhat generic, move it somewhere else */ - @SuppressWarnings({"PublicInnerClass"}) + @SuppressWarnings({ "PublicInnerClass" }) public enum Direction { /** North Layout Position. */ @@ -222,7 +222,7 @@ } /** {@inheritDoc} */ - @SuppressWarnings({"ChainOfInstanceofChecks"}) + @SuppressWarnings({ "ChainOfInstanceofChecks" }) @Override public void addLayoutComponent(final Component comp, final Object constraints) { if (constraints == null) { @@ -281,7 +281,7 @@ /** {@inheritDoc} */ @Override - @SuppressWarnings({"ObjectEquality", "AssignmentToNull"}) + @SuppressWarnings({ "ObjectEquality", "AssignmentToNull" }) public void removeLayoutComponent(final Component comp) { synchronized (comp.getTreeLock()) { if (cC == comp) { Modified: trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/utils/GSplitPane.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -239,7 +239,7 @@ final Dimension leftSize = leftComponent.getMinimumSize(); final Dimension rightSize = rightComponent.getMinimumSize(); final int minLimit = getOrientation() == HORIZONTAL_SPLIT ? leftSize.width : leftSize.height; - final int maxLimit = getOrientation() == HORIZONTAL_SPLIT ? getWidth()-rightSize.width-getDividerSize() : getHeight()-rightSize.height-getDividerSize(); + final int maxLimit = getOrientation() == HORIZONTAL_SPLIT ? getWidth() - rightSize.width - getDividerSize() : getHeight() - rightSize.height - getDividerSize(); if (dividerLocation < minLimit) { return -1; } else if (dividerLocation > maxLimit) { Modified: trunk/src/app/net/sf/gridarta/gui/utils/HideFileFilterProxy.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/HideFileFilterProxy.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/utils/HideFileFilterProxy.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -67,7 +67,7 @@ * checks the other FileFilter. */ // XXX suppression because parameter name depends on class loader search order. - @SuppressWarnings({"ParameterNameDiffersFromOverriddenParameter"}) + @SuppressWarnings({ "ParameterNameDiffersFromOverriddenParameter" }) @Override public boolean accept(final File pathname) { if (pathname.getName().startsWith(".")) { Modified: trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/gui/utils/MenuUtils.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -29,7 +29,7 @@ * Utility class implementing menu related functions. * @author Andreas Kirschbaum */ -@SuppressWarnings({"ClassNamingConvention"}) +@SuppressWarnings({ "ClassNamingConvention" }) public class MenuUtils { /** Private constructor to prevent instantiation. */ @@ -67,7 +67,7 @@ * @param menu the menu to remove the entries from */ public static void removeAllToSeparator(final JMenu menu) { - for (; ;) { + for (;;) { final Component menuItem = menu.getMenuComponent(0); if (menuItem == null || menuItem instanceof JSeparator) { break; Modified: trunk/src/app/net/sf/gridarta/help/Help.java =================================================================== --- trunk/src/app/net/sf/gridarta/help/Help.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/help/Help.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -37,7 +37,7 @@ * @todo add index to help * @deprecated We'll use JavaHelp instead. */ -@SuppressWarnings({"ClassNamingConvention"}) +@SuppressWarnings({ "ClassNamingConvention" }) @Deprecated public class Help extends JDialog { Modified: trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -99,7 +99,7 @@ final G gameObject = gameObjectFactory.newGameObject(archName); boolean msgflag = false; - for (; ;) { + for (;;) { final String thisLine2 = reader.readLine(); if (thisLine2 == null) { throw new IOException("unexpected end of file while reading 'arch " + archName + "'"); Modified: trunk/src/app/net/sf/gridarta/io/AbstractMapArchObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/AbstractMapArchObjectParser.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/io/AbstractMapArchObjectParser.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -41,7 +41,7 @@ int height = 0; boolean archflag = false; // flag for arch<->end boolean msgflag = false; // flag for map-message - for (; ;) { + for (;;) { final String tmp = reader.readLine(); if (tmp == null) { throw new IOException("unexpected end of file in map header"); Modified: trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -42,7 +42,7 @@ * Default implementation of {@link MapReader}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -@SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) +@SuppressWarnings({ "IOResourceOpenedButNotSafelyClosed" }) // myInput.close() is invoked in this.close() public class DefaultMapReader<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements MapReader<G, A> { Modified: trunk/src/app/net/sf/gridarta/io/PathManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/PathManager.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/io/PathManager.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -256,7 +256,7 @@ */ @NotNull public static String getAbsolutePath(@NotNull final String path) { - return relativeToAbsolute(System.getProperty("user.dir")+"/dummy", path(path)); + return relativeToAbsolute(System.getProperty("user.dir") + "/dummy", path(path)); } } // class PathManager Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -560,7 +560,7 @@ } /** Runs the garbage collection. */ - @SuppressWarnings({"InstanceMethodNamingConvention"}) + @SuppressWarnings({ "InstanceMethodNamingConvention" }) @ActionMethod public void gc() { System.gc(); Modified: trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/maincontrol/GridartaEditor.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -385,7 +385,7 @@ } private static void usage(@NotNull final String editorJarName) { - System.out.println("usage: java -jar "+editorJarName+" [option...] [mapfile...]"); + System.out.println("usage: java -jar " + editorJarName + " [option...] [mapfile...]"); System.out.println(""); System.out.println(" -h, --help print this help"); System.out.println(" -b, --batchpng create PNG files for all given maps in their directories"); Modified: trunk/src/app/net/sf/gridarta/map/mapmodel/MapSquare.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/mapmodel/MapSquare.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/map/mapmodel/MapSquare.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -123,7 +123,7 @@ * @param mapSquare the other map square * @return <code>true</code> if this location equals the other location */ - @SuppressWarnings({"ObjectEquality"}) + @SuppressWarnings({ "ObjectEquality" }) public boolean isLocationEqual(@NotNull final MapSquare<G, A, R> mapSquare) { return mapSquare.mapModel == mapModel && mapSquare.mapX == mapX && mapSquare.mapY == mapY; } Modified: trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/mapmanager/AbstractMapManager.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -347,7 +347,7 @@ outOfMapBoundsObjects.append(".."); outOfMapBoundsObjects.append(maxX).append('/').append(maxY); } - } else if (outOfMapBoundsDeleted == DELETED_OBJECTS_TO_REPORT+1) { + } else if (outOfMapBoundsDeleted == DELETED_OBJECTS_TO_REPORT + 1) { outOfMapBoundsObjects.append("\n..."); } } Modified: trunk/src/app/net/sf/gridarta/mapmanager/DelayedMapModelListenerManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapmanager/DelayedMapModelListenerManager.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/mapmanager/DelayedMapModelListenerManager.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -172,7 +172,7 @@ } }); } catch (final InvocationTargetException ex) { - log.error("InvocationTargetException: "+ex.getMessage()); + log.error("InvocationTargetException: " + ex.getMessage()); } mapModels.clear(); } Modified: trunk/src/app/net/sf/gridarta/preferences/Storage.java =================================================================== --- trunk/src/app/net/sf/gridarta/preferences/Storage.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/preferences/Storage.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -263,7 +263,7 @@ String path = defaultPath; final LineNumberReader lnr = new LineNumberReader(isr); try { - for (; ;) { + for (;;) { final String line2 = lnr.readLine(); if (line2 == null) { break; Modified: trunk/src/app/net/sf/gridarta/script/ScriptController.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptController.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/script/ScriptController.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -349,7 +349,7 @@ @NotNull public Action createRunAction(@NotNull final Script<G, A, R> script) { final Action action = ACTION_BUILDER.createAction(true, "runPlugin", this); - action.putValue(ReflectionAction.REFLECTION_ARGUMENTS, new Object[] {script.getName(),}); + action.putValue(ReflectionAction.REFLECTION_ARGUMENTS, new Object[] { script.getName(), }); action.putValue(Action.NAME, ACTION_BUILDER.format("runPlugin.text", script.getName())); return action; } Modified: trunk/src/app/net/sf/gridarta/script/ScriptExecException.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptExecException.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/script/ScriptExecException.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -25,7 +25,7 @@ * Thrown to indicate a problem while executing a script. * @author Andreas Kirschbaum */ -public class ScriptExecException extends Exception{ +public class ScriptExecException extends Exception { /** * The serial version UID. Modified: trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/script/ScriptModelParser.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -105,7 +105,7 @@ final Element c = new Element("code"); n.addContent(scriptModel.getName()); try { - c.addContent(new CDATA(scriptModel.getCode()));// protect code in xml! + c.addContent(new CDATA(scriptModel.getCode())); // protect code in xml! } catch (final IllegalDataException e) { //can't be converted to CDATA :( c.addContent(scriptModel.getCode()); Modified: trunk/src/app/net/sf/gridarta/spells/SpellsUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/spells/SpellsUtils.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/spells/SpellsUtils.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -124,7 +124,7 @@ IOUtils.readUntil(in, "{", null); int counter = 0; - for (; ;) { + for (;;) { IOUtils.readUntil(in, "{", "}"); IOUtils.readUntil(in, "\"", null); final String name = IOUtils.readUntil(in, "\"").trim(); Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -128,7 +128,7 @@ public ReplaceDialog(final JEditTextArea textarea) { this.textarea = textarea; replaceButton.setDefaultCapable(true); - setOptions(new Object[] {replaceButton, cancelButton,}); + setOptions(new Object[] { replaceButton, cancelButton, }); setMessage(createPanel()); } Modified: trunk/src/app/net/sf/gridarta/updater/Updater.java =================================================================== --- trunk/src/app/net/sf/gridarta/updater/Updater.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/updater/Updater.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -232,7 +232,7 @@ */ @NotNull // The stream is closed by caller - @SuppressWarnings({"IOResourceOpenedButNotSafelyClosed"}) + @SuppressWarnings({ "IOResourceOpenedButNotSafelyClosed" }) private InputStream openStream(@NotNull final String url) throws IOException { final Proxy proxy = NetPrefs.getProxy(); final URLConnection con = new URL(url).openConnection(proxy); @@ -302,7 +302,7 @@ * @return <code>true</code> if this versionis newer than * <var>other</var>, otherwise <code>false</code> */ - @SuppressWarnings({"ObjectEquality"}) + @SuppressWarnings({ "ObjectEquality" }) boolean isNewerThan(@NotNull final VersionInfo other) { return this != UNAVAILABLE && (other == UNAVAILABLE || tstamp.compareTo(other.tstamp) > 0); } Modified: trunk/src/app/net/sf/gridarta/utils/IOUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/IOUtils.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/utils/IOUtils.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -133,7 +133,7 @@ * @return Stream for reading from <var>fname</var> * @throws FileNotFoundException In case all tries to open the file failed */ - @SuppressWarnings({"MethodWithMultipleReturnPoints", "MethodWithMoreThanThreeNegations"}) + @SuppressWarnings({ "MethodWithMultipleReturnPoints", "MethodWithMoreThanThreeNegations" }) @NotNull private static InputStream createStreamImpl(@Nullable final File dir, @NotNull final String fname) throws FileNotFoundException { try { // 1st try normal binary file relative to specified directory Modified: trunk/src/app/net/sf/gridarta/utils/ProcessRunner.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/ProcessRunner.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/app/net/sf/gridarta/utils/ProcessRunner.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -290,7 +290,7 @@ /** BufferedReader to read from. */ @Nullable - @SuppressWarnings({"InstanceVariableNamingConvention"}) + @SuppressWarnings({ "InstanceVariableNamingConvention" }) private InputStream in; /** JTextArea to write to. */ Modified: trunk/src/test/net/sf/gridarta/Size2DTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/Size2DTest.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/test/net/sf/gridarta/Size2DTest.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -27,7 +27,7 @@ * Test for {@link Size2D}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -@SuppressWarnings({"FeatureEnvy"}) +@SuppressWarnings({ "FeatureEnvy" }) // This is a test. It has feature envy by definition. public class Size2DTest { @@ -81,4 +81,4 @@ Assert.assertEquals("height MUST be stored", 200, size.getHeight()); } -} // class Size2DTest \ No newline at end of file +} // class Size2DTest Modified: trunk/src/test/net/sf/gridarta/gameobject/AttributeListUtilsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gameobject/AttributeListUtilsTest.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/test/net/sf/gridarta/gameobject/AttributeListUtilsTest.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -26,7 +26,7 @@ * Test for {@link AttributeListUtils}. * @author Andreas Kirschbaum */ -@SuppressWarnings({"FeatureEnvy"}) +@SuppressWarnings({ "FeatureEnvy" }) // This is a test. It has feature envy by definition. public class AttributeListUtilsTest { Modified: trunk/src/test/net/sf/gridarta/gameobject/match/NamedGameObjectMatcherTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gameobject/match/NamedGameObjectMatcherTest.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/test/net/sf/gridarta/gameobject/match/NamedGameObjectMatcherTest.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -96,7 +96,7 @@ TestGameObject gameObject = null; for (final int typeNumber : typeNumbers) { final String name = Integer.toString(typeNumber); - final TestArchetype archetype = newArchetype("arch"+name, typeNumber); + final TestArchetype archetype = newArchetype("arch" + name, typeNumber); final TestGameObject tmp = newGameObject(archetype, name); if (gameObject != null) { tmp.addLast(gameObject); Modified: trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -48,7 +48,7 @@ * Test for {@link DefaultMapModel}. * @author Andreas Kirschbaum */ -@SuppressWarnings({"FeatureEnvy"}) +@SuppressWarnings({ "FeatureEnvy" }) // This is a test. It has feature envy by definition. public class DefaultMapModelTest { Modified: trunk/src/test/net/sf/gridarta/utils/WrappingStringBuilderTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/utils/WrappingStringBuilderTest.java 2009-09-27 22:42:02 UTC (rev 6968) +++ trunk/src/test/net/sf/gridarta/utils/WrappingStringBuilderTest.java 2009-09-28 11:01:08 UTC (rev 6969) @@ -26,7 +26,7 @@ * Test for {@link WrappingStringBuilder}. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -@SuppressWarnings({"FeatureEnvy"}) +@SuppressWarnings({ "FeatureEnvy" }) public class WrappingStringBuilderTest { /** Test for {@link WrappingStringBuilder#append(String)}. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-09-28 11:57:47
|
Revision: 6970 http://gridarta.svn.sourceforge.net/gridarta/?rev=6970&view=rev Author: akirschbaum Date: 2009-09-28 11:57:37 +0000 (Mon, 28 Sep 2009) Log Message: ----------- Weaken types. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/archtype/ArchetypeTypeParser.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeTypeSet.java trunk/src/app/net/sf/gridarta/archtype/CAttribBitmask.java trunk/src/app/net/sf/gridarta/data/NamedTreeNode.java trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java trunk/src/app/net/sf/gridarta/filter/BtnPopup.java trunk/src/app/net/sf/gridarta/filter/NamedFilterList.java trunk/src/app/net/sf/gridarta/filter/SimpleFilterConfig.java trunk/src/app/net/sf/gridarta/gameobject/AnimationValidator.java trunk/src/app/net/sf/gridarta/gameobject/match/GameObjectMatcherParser.java trunk/src/app/net/sf/gridarta/gameobject/match/MutableOrGameObjectMatcher.java trunk/src/app/net/sf/gridarta/gameobject/match/OrGameObjectMatcher.java trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchUtils.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/MapPreview.java trunk/src/app/net/sf/gridarta/gui/RecentManager.java trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java trunk/src/app/net/sf/gridarta/gui/SplashScreen.java trunk/src/app/net/sf/gridarta/gui/SystemIcons.java trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java trunk/src/app/net/sf/gridarta/gui/connectionview/View.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ScrollToVisibleFocusListener.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/MonstersTab.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.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/app/net/sf/gridarta/gui/map/viewaction/ViewAction.java trunk/src/app/net/sf/gridarta/gui/map/viewaction/ViewActions.java trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.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/newmap/NewPickmapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapFolderDialog.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserView.java trunk/src/app/net/sf/gridarta/gui/prefs/MiscPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java trunk/src/app/net/sf/gridarta/gui/script/ScriptEditor.java trunk/src/app/net/sf/gridarta/gui/script/ScriptManager.java trunk/src/app/net/sf/gridarta/gui/script/ScriptView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchComboBoxEditor.java trunk/src/app/net/sf/gridarta/gui/script/parameter/MapParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/MapSquareSelection.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareControl.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareModel.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/gui/shrinkmapsizedialog/ShrinkMapSizeDialog.java trunk/src/app/net/sf/gridarta/gui/undo/SwingUtils.java trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java trunk/src/app/net/sf/gridarta/map/mapmodel/DefaultMapModel.java trunk/src/app/net/sf/gridarta/map/validation/checks/BlockedSquareChecker.java trunk/src/app/net/sf/gridarta/map/validation/checks/ConnectionWithoutSinksError.java trunk/src/app/net/sf/gridarta/map/validation/checks/ConnectionWithoutSourcesError.java trunk/src/app/net/sf/gridarta/map/validation/checks/MobOutsideSpawnPointChecker.java trunk/src/app/net/sf/gridarta/map/validation/checks/SlayingChecker.java trunk/src/app/net/sf/gridarta/map/validation/checks/SquareWithoutFloorChecker.java trunk/src/app/net/sf/gridarta/map/validation/checks/UnsetSlayingChecker.java trunk/src/app/net/sf/gridarta/script/Script.java trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameter.java trunk/src/app/net/sf/gridarta/textedit/scripteditor/CFPythonPopup.java trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java trunk/src/app/net/sf/gridarta/textedit/textarea/ScrollLayout.java trunk/src/app/net/sf/gridarta/textedit/textarea/SyntaxUtilities.java trunk/src/app/net/sf/gridarta/textedit/textarea/actions/Replace.java trunk/src/app/net/sf/gridarta/treasurelist/CFTreasureListTree.java trunk/src/app/net/sf/gridarta/treasurelist/TreasureLoader.java trunk/src/app/net/sf/gridarta/treasurelist/TreasureTree.java trunk/src/app/net/sf/gridarta/utils/ProcessRunner.java trunk/src/test/net/sf/gridarta/gui/map/cursor/MapCursorTest.java Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeTypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeTypeParser.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeTypeParser.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -153,7 +153,7 @@ } @NotNull - private List<ArchetypeAttribute<G, A, R>> importName(@Nullable final String importName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final Set<String> autoIgnoreTable) { + private List<ArchetypeAttribute<G, A, R>> importName(@Nullable final String importName, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final Collection<String> autoIgnoreTable) { if (importName == null) { return Collections.emptyList(); } @@ -363,7 +363,7 @@ } @NotNull - private List<ArchetypeAttribute<G, A, R>> parseAttrList(@NotNull final Element root, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final SectionNames sectionNames, @NotNull final Set<String> autoIgnoreTable, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { + private List<ArchetypeAttribute<G, A, R>> parseAttrList(@NotNull final Element root, @NotNull final ErrorViewCollector errorViewCollector, @NotNull final String typeName, final int typeNo, @NotNull final SectionNames sectionNames, @NotNull final Collection<String> autoIgnoreTable, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { final List<ArchetypeAttribute<G, A, R>> attrList = new ArrayList<ArchetypeAttribute<G, A, R>>(); // now get all children and process them in order: Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeTypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeTypeSet.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeTypeSet.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -143,7 +143,7 @@ * the first (misc) type if no match is found. */ @NotNull - public ArchetypeType<G, A, R> getTypeOfArch(final G object) { + public ArchetypeType<G, A, R> getTypeOfArch(final GameObject<?, ?, ?> object) { // check if the type of the object is present in the definitions for (final ArchetypeType<G, A, R> tmp : archetypeTypeList) { if (tmp.matches(object)) { @@ -224,7 +224,7 @@ * no match was found */ @NotNull - public ArchetypeType<G, A, R> getArchetypeType(@NotNull final R archetype) { + public ArchetypeType<G, A, R> getArchetypeType(@NotNull final Archetype<?, ?, ?> archetype) { for (final ArchetypeType<G, A, R> archetypeType : archetypeTypeList) { if (archetypeType.matches(archetype)) { return archetypeType; Modified: trunk/src/app/net/sf/gridarta/archtype/CAttribBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/CAttribBitmask.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/archtype/CAttribBitmask.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -23,8 +23,8 @@ import java.awt.Container; import java.awt.GridLayout; import java.util.ArrayList; +import java.util.Collection; import java.util.HashMap; -import java.util.List; import java.util.Map; import java.util.regex.Pattern; import javax.swing.JCheckBox; @@ -246,12 +246,12 @@ * @return the string representation of the value */ @NotNull - public List<String> encodeValueAsList(final int value, @NotNull final Map<Integer, String> strings) { - final List<String> result = new ArrayList<String>(); + public Iterable<String> encodeValueAsList(final int value, @NotNull final Map<Integer, String> strings) { + final Collection<String> result = new ArrayList<String>(); final int moveAll = getMaxValue(); - final List<String> negResult = new ArrayList<String>(); + final Collection<String> negResult = new ArrayList<String>(); negResult.add("all"); /* Quick check, and probably fairly common */ Modified: trunk/src/app/net/sf/gridarta/data/NamedTreeNode.java =================================================================== --- trunk/src/app/net/sf/gridarta/data/NamedTreeNode.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/data/NamedTreeNode.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -21,9 +21,9 @@ import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; import java.util.Collections; import java.util.Enumeration; -import java.util.List; import java.util.SortedMap; import java.util.TreeMap; import javax.swing.tree.TreeNode; @@ -173,7 +173,7 @@ * nodes */ @Nullable - public E getNamedObject() { + public NamedObject getNamedObject() { return namedObject; } @@ -271,7 +271,7 @@ */ @NotNull public TreePath getPathFor(@NotNull final String path) { - final List<NamedTreeNode<E>> nodes = new ArrayList<NamedTreeNode<E>>(); + final Collection<NamedTreeNode<E>> nodes = new ArrayList<NamedTreeNode<E>>(); String currentPath = path; // XXX This is ugly but it works, no time to think about it now. String dirPart; Modified: trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -277,7 +277,7 @@ * @param sourceExitLocation the source's exit location @return whether the action was or can be performed * @return whether the action was or can be performed */ - private boolean doExitConnect(final boolean performAction, @Nullable final G targetExit, @Nullable final R targetArchetype, @NotNull final MapModel<G, A, R> targetMapModel, @NotNull final Point targetLocation, @NotNull final File targetMapFile, @NotNull final MapModel<G, A, R> sourceMapModel, @NotNull final ExitLocation sourceExitLocation) { + private boolean doExitConnect(final boolean performAction, @Nullable final GameObject<?, ?, ?> targetExit, @Nullable final R targetArchetype, @NotNull final MapModel<G, A, R> targetMapModel, @NotNull final Point targetLocation, @NotNull final File targetMapFile, @NotNull final MapModel<G, A, R> sourceMapModel, @NotNull final ExitLocation sourceExitLocation) { final File sourceMapFile = sourceMapModel.getMapFile(); if (sourceMapFile == null) { // source map is unsaved ==> cannot connect Modified: trunk/src/app/net/sf/gridarta/filter/BtnPopup.java =================================================================== --- trunk/src/app/net/sf/gridarta/filter/BtnPopup.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/filter/BtnPopup.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -22,6 +22,7 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import javax.swing.JButton; +import javax.swing.JComponent; import javax.swing.JMenu; import javax.swing.JPopupMenu; @@ -42,7 +43,7 @@ }); } - public JButton getButton() { + public JComponent getButton() { return button; } Modified: trunk/src/app/net/sf/gridarta/filter/NamedFilterList.java =================================================================== --- trunk/src/app/net/sf/gridarta/filter/NamedFilterList.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/filter/NamedFilterList.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -55,7 +55,7 @@ * Create a new NameFilterList. * @param matchers the matchers to use */ - public NamedFilterList(@NotNull final Collection<NamedGameObjectMatcher> matchers) { + public NamedFilterList(@NotNull final Iterable<NamedGameObjectMatcher> matchers) { subFilters = new LinkedHashMap<String, Filter>(); for (final NamedGameObjectMatcher matcher : matchers) { // FIXME: use localized name; FIXME: sort by name subFilters.put(matcher.getName(), new NamedGameObjectMatcherFilter(matcher)); @@ -237,7 +237,7 @@ return result; } - public boolean canShow(final GameObject<?, ?, ?> gameObject, final NamedFilterConfig filterOutConfig) { + public boolean canShow(final GameObject<?, ?, ?> gameObject, final FilterConfig filterOutConfig) { reset(filterOutConfig); if (hasGlobalMatch(filterOutConfig)) { match(filterOutConfig, gameObject); @@ -254,7 +254,7 @@ private final NamedFilterConfig config; - private final List<FilterComponent> components = new ArrayList<FilterComponent>(); + private final Collection<FilterComponent> components = new ArrayList<FilterComponent>(); FilterMenuEntry(final NamedFilterConfig config) { super(""); @@ -274,13 +274,13 @@ } public JComponent getMenuBarComponent() { - final JMenu menu = new JMenu(getName()); + final JComponent menu = new JMenu(getName()); populateComponent(menu); return menu; } public JComponent getMenuItemComponent() { - final JMenu menu = new JMenu(getName()); + final JComponent menu = new JMenu(getName()); populateComponent(menu); return menu; } Modified: trunk/src/app/net/sf/gridarta/filter/SimpleFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/filter/SimpleFilterConfig.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/filter/SimpleFilterConfig.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -22,7 +22,6 @@ import java.util.Collections; import java.util.HashMap; import java.util.Map; -import java.util.Set; /** * Simple filter configuration. @@ -46,7 +45,7 @@ return properties.get(name); } - public Set<String> getProperties() { + public Iterable<String> getProperties() { return Collections.unmodifiableSet(properties.keySet()); } Modified: trunk/src/app/net/sf/gridarta/gameobject/AnimationValidator.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/AnimationValidator.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gameobject/AnimationValidator.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -65,7 +65,7 @@ * Validates an {@link AnimationObjects} instance. * @param animationObjects the animation objects instance to validate */ - public void validate(@NotNull final AnimationObjects animationObjects) { + public void validate(@NotNull final Iterable<AnimationObject> animationObjects) { for (final AnimationObject animationObject : animationObjects) { validateAnimation(animationObject); } Modified: trunk/src/app/net/sf/gridarta/gameobject/match/GameObjectMatcherParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/match/GameObjectMatcherParser.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gameobject/match/GameObjectMatcherParser.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -134,7 +134,7 @@ * @throws ParsingException if a parsing error occurs */ @NotNull - private static AndGameObjectMatcher createAndMatcher(@NotNull final Node el) throws ParsingException { + private static GameObjectMatcher createAndMatcher(@NotNull final Node el) throws ParsingException { return new AndGameObjectMatcher(getChildMatchers(el)); } @@ -145,7 +145,7 @@ * @throws ParsingException if a parsing error occurs */ @NotNull - private static OrGameObjectMatcher createOrMatcher(@NotNull final Node el) throws ParsingException { + private static GameObjectMatcher createOrMatcher(@NotNull final Node el) throws ParsingException { return new OrGameObjectMatcher(getChildMatchers(el)); } @@ -177,7 +177,7 @@ * @return the created matcher */ @NotNull - private static AttribGameObjectMatcher createAttribArchObjectMatcher(@NotNull final Element el) { + private static GameObjectMatcher createAttribArchObjectMatcher(@NotNull final Element el) { return new AttribGameObjectMatcher( el.getAttribute("name"), Enum.valueOf(AttribGameObjectMatcher.Op.class, el.getAttribute("op")), @@ -193,7 +193,7 @@ * @throws ParsingException if a parsing error occurs */ @NotNull - private static TypeNrsGameObjectMatcher createTypeNrsArchObjectMatcher(@NotNull final Element el) throws ParsingException { + private static GameObjectMatcher createTypeNrsArchObjectMatcher(@NotNull final Element el) throws ParsingException { final String numbers = el.getAttribute("numbers"); final String[] typeNrs = StringUtils.PATTERN_WHITESPACE.split(numbers, 0); final int[] types = new int[typeNrs.length]; Modified: trunk/src/app/net/sf/gridarta/gameobject/match/MutableOrGameObjectMatcher.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/match/MutableOrGameObjectMatcher.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gameobject/match/MutableOrGameObjectMatcher.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -21,7 +21,7 @@ import java.awt.event.ActionEvent; import java.util.ArrayList; -import java.util.List; +import java.util.Collection; import javax.swing.AbstractAction; import net.sf.gridarta.gameobject.GameObject; import org.jetbrains.annotations.NotNull; @@ -41,7 +41,7 @@ /** The {@link GameObjectMatcher}s to OR. */ @NotNull - private final List<GameObjectMatcher> gameObjectMatchers = new ArrayList<GameObjectMatcher>(); + private final Collection<GameObjectMatcher> gameObjectMatchers = new ArrayList<GameObjectMatcher>(); /** * Creates a <code>MutableOrGameObjectMatcher</code>. Modified: trunk/src/app/net/sf/gridarta/gameobject/match/OrGameObjectMatcher.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/match/OrGameObjectMatcher.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gameobject/match/OrGameObjectMatcher.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -21,7 +21,6 @@ import java.util.ArrayList; import java.util.Collection; -import java.util.List; import net.sf.gridarta.gameobject.GameObject; import org.jetbrains.annotations.NotNull; @@ -36,7 +35,7 @@ /** List of {@link GameObjectMatcher} to Or. */ @NotNull - private final List<GameObjectMatcher> matchers = new ArrayList<GameObjectMatcher>(); + private final Collection<GameObjectMatcher> matchers = new ArrayList<GameObjectMatcher>(); /** * Create an <code>OrGameObjectMatcher</code>. Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchUtils.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchUtils.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -24,7 +24,6 @@ import java.util.List; import java.util.Map; import javax.swing.JComboBox; -import net.sf.gridarta.archtype.ArchetypeTypeList; import net.sf.gridarta.utils.Pair; import net.sf.japi.util.Arrays2; import org.jetbrains.annotations.NotNull; @@ -50,7 +49,7 @@ * Creates a new instance. * @param eventTypes the event types */ - protected AbstractScriptArchUtils(@NotNull final ArchetypeTypeList eventTypes) { + protected AbstractScriptArchUtils(@NotNull final Iterable<Pair<Integer, String>> eventTypes) { for (final Pair<Integer, String> pair : eventTypes) { final int eventType = pair.getFirst(); final String eventName = pair.getSecond(); Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -20,9 +20,11 @@ package net.sf.gridarta.gameobject.scripts; import java.awt.Component; +import java.awt.Container; import java.awt.FlowLayout; import java.awt.Frame; import java.io.File; +import javax.swing.AbstractButton; import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; @@ -116,16 +118,16 @@ mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5)); // input line: script path - final JPanel line1 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - final JLabel text1 = new JLabel("Script:"); + final Container line1 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + final Component text1 = new JLabel("Script:"); line1.add(text1); inputScriptPath = new JTextField(scriptedEvent.getScriptPath(), 20); line1.add(inputScriptPath); mainPanel.add(line1); // input line: plugin options - final JPanel line2 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - final JLabel text2 = new JLabel("Script options:"); + final Container line2 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + final Component text2 = new JLabel("Script options:"); line2.add(text2); inputOptions = new JTextField(scriptedEvent.getOptions(), 20); line2.add(inputOptions); @@ -133,8 +135,8 @@ mainPanel.add(Box.createVerticalStrut(5)); // input line: plugin name - final JPanel line3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - final JLabel text3 = new JLabel("Plugin name:"); + final Container line3 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + final Component text3 = new JLabel("Plugin name:"); line3.add(text3); inputPluginName = new JTextField(scriptedEvent.getPluginName(), 20); line3.add(inputPluginName); @@ -142,14 +144,14 @@ mainPanel.add(Box.createVerticalStrut(5)); // button panel: - final JPanel line4 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); - final JButton okButton = new JButton("OK"); + final Container line4 = new JPanel(new FlowLayout(FlowLayout.RIGHT)); + final AbstractButton okButton = new JButton("OK"); okListener = new PathButtonListener(true, pathFrame, null, null); okListener.setTargetEvent(scriptedEvent); okButton.addActionListener(okListener); line4.add(okButton); - final JButton cancelButton = new JButton("Cancel"); + final AbstractButton cancelButton = new JButton("Cancel"); cancelListener = new PathButtonListener(false, pathFrame, null, null); cancelListener.setTargetEvent(scriptedEvent); cancelButton.addActionListener(cancelListener); Modified: trunk/src/app/net/sf/gridarta/gui/MainView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainView.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/MainView.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -215,7 +215,7 @@ * @param leftPanel the left panel */ private Component createCenterPanel(final boolean mapSquareListBottom, @NotNull final Component leftPanel) { - final JPanel centerPanel = new JPanel(new BorderLayout()); + final Container centerPanel = new JPanel(new BorderLayout()); recreatePanes(mapSquareListBottom); splitPane = new GSplitPane(JSplitPane.HORIZONTAL_SPLIT, leftPanel, splitDownPane, DIVIDER_LOCATION_KEY, (int) (getDefaultWidth() * 0.17)); Modified: trunk/src/app/net/sf/gridarta/gui/MapPreview.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MapPreview.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/MapPreview.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui; import java.awt.Color; +import java.awt.Component; import java.awt.Dimension; import java.awt.Graphics; import java.awt.Image; @@ -93,7 +94,7 @@ // frame.setIconImage(icon.getImage()); //} frame.setJMenuBar(ACTION_BUILDER.createMenuBar(false, "zoomBar", this)); - final JScrollPane scroll = new JScrollPane(this); + final Component scroll = new JScrollPane(this); scroll.setFocusable(true); frame.add(scroll); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); Modified: trunk/src/app/net/sf/gridarta/gui/RecentManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/RecentManager.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -23,7 +23,6 @@ import java.io.File; import java.io.IOException; import java.util.LinkedList; -import java.util.List; import java.util.ListIterator; import java.util.prefs.Preferences; import javax.swing.AbstractAction; @@ -168,7 +167,7 @@ * Update the recent menu. * @param recents current recents */ - private void updateRecent(final List<Recent<G, A, R>> recents) { + private void updateRecent(final Iterable<Recent<G, A, R>> recents) { if (recentMenu == null) { return; } Modified: trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -21,6 +21,7 @@ import java.awt.Point; import java.awt.Rectangle; +import java.util.Collection; import java.util.LinkedList; import java.util.List; import net.sf.gridarta.gameobject.Archetype; @@ -240,7 +241,7 @@ * @param len The length of the row in squares. */ private void shift(final Point pos, final int len) { - final List<G> startGameObjects = new LinkedList<G>(); + final Collection<G> startGameObjects = new LinkedList<G>(); final List<G> gameObjectsToDelete = new LinkedList<G>(); final Point prevPos = new Point(pos.x + dx, pos.y + dy); final Point startPos = new Point(); Modified: trunk/src/app/net/sf/gridarta/gui/SplashScreen.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/SplashScreen.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/SplashScreen.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -22,6 +22,7 @@ import java.awt.BorderLayout; import java.awt.Color; import javax.swing.ImageIcon; +import javax.swing.JComponent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.SwingConstants; @@ -57,7 +58,7 @@ } catch (final NullPointerException e) { /* Just ignore this because it's nothing serious that the image is unavailable. */ } - final JLabel loading = new JLabel("Loading, hold on...", SwingConstants.CENTER); + final JComponent loading = new JLabel("Loading, hold on...", SwingConstants.CENTER); loading.setOpaque(true); loading.setBackground(Color.BLACK); loading.setForeground(Color.WHITE); Modified: trunk/src/app/net/sf/gridarta/gui/SystemIcons.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/SystemIcons.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/SystemIcons.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -94,7 +94,7 @@ final ImageIcon sysIcon = GUIUtils.getSysIcon(GUIConstants.SQUARE_WARNING); final Image image = sysIcon.getImage(); final ImageProducer source = image.getSource(); - final FilteredImageSource producer = new FilteredImageSource(source, alphaFilter); + final ImageProducer producer = new FilteredImageSource(source, alphaFilter); final Image image2 = Toolkit.getDefaultToolkit().createImage(producer); return new ImageIcon(image2); } Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -23,6 +23,7 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.List; +import javax.swing.JPanel; import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionListener; import net.sf.gridarta.gameobject.Archetype; @@ -72,7 +73,7 @@ * @return the view for this controller */ @NotNull - public View<K, G, A, R> getView() { + public JPanel getView() { return view; } Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/View.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/View.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/View.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -158,7 +158,7 @@ * Scans the given map for the contained connections. * @param mapModel the map model to process */ - private void scanMapForConnections(@NotNull final MapModel<G, A, R> mapModel) { + private void scanMapForConnections(@NotNull final Iterable<MapSquare<G, A, R>> mapModel) { for (final MapSquare<G, A, R> mapSquare : mapModel) { for (final G gameObject : mapSquare) { scanGameObjectForConnections(gameObject); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ScrollToVisibleFocusListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ScrollToVisibleFocusListener.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/ScrollToVisibleFocusListener.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -19,19 +19,19 @@ package net.sf.gridarta.gui.gameobjectattributesdialog; +import java.awt.Component; import java.awt.Rectangle; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import javax.swing.JComponent; -import javax.swing.JPanel; public class ScrollToVisibleFocusListener implements FocusListener { /** {@inheritDoc} */ @Override public void focusGained(final FocusEvent e) { - final JComponent c = (JComponent) e.getComponent(); - final JPanel p = (JPanel) c.getParent(); + final Component c = e.getComponent(); + final JComponent p = (JComponent) c.getParent(); final Rectangle r = c.getBounds(); p.scrollRectToVisible(r); } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/MonstersTab.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/MonstersTab.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributespanel/MonstersTab.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -23,6 +23,7 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.match.GameObjectMatcher; +import net.sf.gridarta.gui.connectionview.Control; import net.sf.gridarta.gui.connectionview.MonsterControl; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.map.maparchobject.MapArchObject; @@ -82,7 +83,7 @@ @NotNull @Override public JPanel createPanel() { - final MonsterControl<G, A, R> monsterControl = new MonsterControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, monsterMatcher); + final Control<?, ?, ?, ?> monsterControl = new MonsterControl<G, A, R>(mapViewManager, delayedMapModelListenerManager, monsterMatcher); return monsterControl.getView(); } Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/AbstractMapTilePane.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -19,6 +19,7 @@ package net.sf.gridarta.gui.map.maptilepane; +import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.io.File; @@ -26,6 +27,7 @@ import java.util.regex.Matcher; import javax.swing.BorderFactory; import javax.swing.JButton; +import javax.swing.JComponent; import javax.swing.JPanel; import javax.swing.border.CompoundBorder; import javax.swing.filechooser.FileFilter; @@ -188,8 +190,8 @@ * @return The newly built tile panel. */ @NotNull - private JPanel buildTilePanels(@NotNull final TilePanel[] tilePaths) { - final JPanel tilePanels = new JPanel(new DirectionLayout()); + private Component buildTilePanels(@NotNull final TilePanel[] tilePaths) { + final JComponent tilePanels = new JPanel(new DirectionLayout()); tilePanels.setBorder(new CompoundBorder(BorderFactory.createTitledBorder(ACTION_BUILDER.getString("mapTiles")), GUIConstants.DIALOG_BORDER)); for (final TilePanel tilePath : tilePaths) { tilePanels.add(tilePath, tilePath.getDirection()); @@ -203,8 +205,8 @@ * @return The newly built subPanel. */ @NotNull - private JPanel buildSubPanel() { - final JPanel subPanel = new JPanel(new GridBagLayout()); + private Component buildSubPanel() { + final JComponent subPanel = new JPanel(new GridBagLayout()); subPanel.setBorder(new CompoundBorder(BorderFactory.createTitledBorder(ACTION_BUILDER.getString("mapControl")), GUIConstants.DIALOG_BORDER)); final GridBagConstraints gbc = new GridBagConstraints(); gbc.fill = GridBagConstraints.NONE; Modified: trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/map/maptilepane/TilePanel.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -19,6 +19,7 @@ package net.sf.gridarta.gui.map.maptilepane; +import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; @@ -26,6 +27,7 @@ import java.awt.event.ActionListener; import java.io.File; import java.io.IOException; +import javax.swing.AbstractButton; import javax.swing.Action; import javax.swing.JButton; import javax.swing.JFileChooser; @@ -140,8 +142,8 @@ * @param action the action for the button * @return JButton for key */ - private static JButton iconButton(final Action action) { - final JButton button = new JButton(action); + private static Component iconButton(final Action action) { + final AbstractButton button = new JButton(action); button.setMargin(new Insets(0, 0, 0, 0)); return button; } Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewManager.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.map.mapview; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.List; @@ -52,7 +53,7 @@ * The registered listeners. */ @NotNull - private final List<MapViewManagerListener<G, A, R>> listeners = new ArrayList<MapViewManagerListener<G, A, R>>(); + private final Collection<MapViewManagerListener<G, A, R>> listeners = new ArrayList<MapViewManagerListener<G, A, R>>(); /** * Sets the active map view. The map view will be moved to the front. Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.map.tools; import java.awt.Component; +import java.awt.Container; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Point; @@ -188,7 +189,7 @@ @Nullable @Override public Component createOptionsView() { - final JPanel panel = new JPanel(); + final Container panel = new JPanel(); panel.setLayout(new GridBagLayout()); final GridBagConstraints gbcLabel = new GridBagConstraints(); Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolPalette.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.map.tools; import java.awt.BorderLayout; +import java.awt.Container; import java.awt.event.InputEvent; import java.awt.event.MouseEvent; import javax.swing.JLabel; @@ -28,6 +29,7 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.event.MouseOpEvent; +import net.sf.gridarta.gui.map.event.MouseOpListener; import net.sf.gridarta.gui.map.mapviewsettings.MapViewSettings; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; @@ -53,7 +55,7 @@ private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta.gui.map.tools"); /** The JTabbedPane for the three tabs, one for each mousebutton. */ - private final JTabbedPane mouseTabs = new JTabbedPane(); + private final Container mouseTabs = new JTabbedPane(); /** The ToolSelector for lmb. */ private final ToolSelector<G, A, R> lmbSelector; @@ -92,7 +94,7 @@ * mouse button is not bound to a tool. */ @Nullable - public Tool<G, A, R> getTool(final MouseOpEvent<G, A, R> event) { + public MouseOpListener<G, A, R> getTool(final MouseOpEvent<G, A, R> event) { final int button = event.getButton(); final ToolSelector<G, A, R> toolSelector; switch (button) { Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -22,12 +22,14 @@ import java.awt.BorderLayout; import java.awt.CardLayout; import java.awt.Component; +import java.awt.Container; import java.awt.FlowLayout; import java.awt.Insets; import java.awt.event.ActionEvent; import java.util.HashMap; import java.util.Map; import javax.swing.AbstractAction; +import javax.swing.AbstractButton; import javax.swing.Action; import javax.swing.ButtonGroup; import javax.swing.JPanel; @@ -60,7 +62,7 @@ /** The pane with the selections. */ @NotNull - private final JPanel selectionPane = new JPanel(new FlowLayout()); + private final Container selectionPane = new JPanel(new FlowLayout()); /** The CardLayout for the pane that shows a tool's options. */ @NotNull @@ -72,7 +74,7 @@ /** The pane with the options of a tool. */ @NotNull - private final JPanel optionsPane = new JPanel(optionCards); + private final Container optionsPane = new JPanel(optionCards); /** The currently selected tool. */ @NotNull @@ -125,12 +127,12 @@ */ private void add(@NotNull final Tool<G, A, R> tool, final boolean selected) { @NotNull final Action selectionAction = new SelectionAction(tool); - @NotNull final JToggleButton toggleButton = new JToggleButton(selectionAction); + @NotNull final AbstractButton toggleButton = new JToggleButton(selectionAction); toggleButton.setMargin(EMPTY_MARGIN); @NotNull final Component optionsView = createOptionsView(tool); selectionButtonGroup.add(toggleButton); selectionPane.add(toggleButton); - final JPanel panel = new JPanel(new BorderLayout()); + final Container panel = new JPanel(new BorderLayout()); panel.add(optionsView, BorderLayout.NORTH); optionsPane.add(panel, tool.getId()); toggleButton.setSelected(selected); Modified: trunk/src/app/net/sf/gridarta/gui/map/viewaction/ViewAction.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/viewaction/ViewAction.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/map/viewaction/ViewAction.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -1,7 +1,9 @@ package net.sf.gridarta.gui.map.viewaction; +import java.awt.Component; import java.awt.event.ActionEvent; import javax.swing.AbstractAction; +import javax.swing.AbstractButton; import javax.swing.JCheckBoxMenuItem; import net.sf.gridarta.gameobject.match.NamedGameObjectMatcher; import net.sf.gridarta.gui.map.mapviewsettings.MapViewSettings; @@ -33,7 +35,7 @@ private final int editType; /** The menu item for this action. */ - private final JCheckBoxMenuItem checkBoxMenuItem = new JCheckBoxMenuItem(this); + private final AbstractButton checkBoxMenuItem = new JCheckBoxMenuItem(this); /** * Creates a new instance. @@ -75,7 +77,7 @@ * Returns the menu item for this action. * @return the menu item */ - public JCheckBoxMenuItem getCheckBoxMenuItem() { + public Component getCheckBoxMenuItem() { return checkBoxMenuItem; } Modified: trunk/src/app/net/sf/gridarta/gui/map/viewaction/ViewActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/viewaction/ViewActions.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/map/viewaction/ViewActions.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -19,12 +19,11 @@ package net.sf.gridarta.gui.map.viewaction; +import java.awt.Container; import java.util.Arrays; -import java.util.Collection; import java.util.Comparator; import java.util.LinkedList; import java.util.List; -import javax.swing.JMenu; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.match.NamedGameObjectMatcher; @@ -108,7 +107,7 @@ * Creates the view actions. * @param gameObjectMatchers the game object matchers */ - public void init(@NotNull final Collection<NamedGameObjectMatcher> gameObjectMatchers) { + public void init(@NotNull final Iterable<NamedGameObjectMatcher> gameObjectMatchers) { for (final NamedGameObjectMatcher matcher : gameObjectMatchers) { viewActions.add(new ViewAction(mapViewSettings, matcher)); } @@ -118,7 +117,7 @@ * Sets the menu to add the actions to. * @param viewActionsMenu the menu */ - public void setMenu(@Nullable final JMenu viewActionsMenu) { + public void setMenu(@Nullable final Container viewActionsMenu) { if (viewActionsMenu == null) { return; } Modified: trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/mapfiles/MapFolderTreeActions.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -145,7 +145,7 @@ MenuUtils.removeAll(folderMenu); for (final MapFolder<G, A, R> mapFolder : mapFolderTree) { final JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(); - final MapFolderTreeAction<G, A, R> action = new MapFolderTreeAction<G, A, R>(mapFolderTree, mapFolder, menuItem); + final Action action = new MapFolderTreeAction<G, A, R>(mapFolderTree, mapFolder, menuItem); menuItem.setAction(action); menuItem.setSelected(mapFolder == activeMapFolder); folderMenu.add(menuItem); Modified: trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/newmap/AbstractMapsizeNewMapDialog.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.newmap; import java.awt.GridBagConstraints; +import javax.swing.AbstractButton; import javax.swing.JCheckBox; import javax.swing.JFormattedTextField; import javax.swing.JLabel; @@ -75,7 +76,7 @@ private final int defaultHeight; /** Checkbox to set whether the default width / height should be overridden. */ - private final JCheckBox mapSizeDefaultCheckbox = new JCheckBox(ACTION_BUILDER.createToggle(false, "mapSizeDefault", this)); + private final AbstractButton mapSizeDefaultCheckbox = new JCheckBox(ACTION_BUILDER.createToggle(false, "mapSizeDefault", this)); /** Textfield for the width of the new map. */ private final JFormattedTextField mapWidthField = new JFormattedTextField(); Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -26,6 +26,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.text.JTextComponent; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.mapview.MapViewFactory; @@ -89,7 +90,7 @@ * Textfield for the name of the map. The filename of the new map is unset * and will be specified when the user saves the map for the first time. */ - private final JTextField mapNameField = new JTextField(16); + private final JTextComponent mapNameField = new JTextField(16); /** Textfield for the difficulty of the new map. */ private final JFormattedTextField mapDifficultyField = new JFormattedTextField(); Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -23,7 +23,6 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.mapview.MapViewFactory; -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.map.maparchobject.MapArchObject; @@ -125,7 +124,7 @@ } @Deprecated - public void setObjectChooser(@NotNull final DefaultObjectChooser<G, A, R> objectChooser) { + public void setObjectChooser(@NotNull final ObjectChooser<G, A, R> objectChooser) { this.objectChooser = objectChooser; } Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapDialog.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -26,6 +26,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.text.JTextComponent; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.objectchooser.ObjectChooser; @@ -58,7 +59,7 @@ * Textfield for the name of the map. The filename of the new map is unset * and will be specified when the user saves the map for the first time. */ - private final JTextField mapNameField = new JTextField(16); + private final JTextComponent mapNameField = new JTextField(16); /** * Creates a "new pickmap" dialog. Modified: trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapFolderDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapFolderDialog.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/newmap/NewPickmapFolderDialog.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -26,6 +26,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JTextField; +import javax.swing.text.JTextComponent; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.mapview.MapViewFactory; @@ -69,7 +70,7 @@ * Textfield for the name of the map. The filename of the new map is unset * and will be specified when the user saves the map for the first time. */ - private final JTextField mapNameField = new JTextField(16); + private final JTextComponent mapNameField = new JTextField(16); /** * Creates a "new pickmap folder" dialog. Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserModel.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -21,6 +21,7 @@ import java.io.File; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; @@ -52,7 +53,7 @@ /** * The listeners to notify. */ - private final List<PickmapChooserModelListener<G, A, R>> listeners = new LinkedList<PickmapChooserModelListener<G, A, R>>(); + private final Collection<PickmapChooserModelListener<G, A, R>> listeners = new LinkedList<PickmapChooserModelListener<G, A, R>>(); /** * The map control listener which is attached to all pickmaps to detect Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserView.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/PickmapChooserView.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -19,6 +19,7 @@ package net.sf.gridarta.gui.pickmapchooser; +import java.awt.Component; import java.io.IOException; import javax.swing.BorderFactory; import javax.swing.JPopupMenu; @@ -254,7 +255,7 @@ * Returns the {@link JTabbedPane} with all pickmaps. * @return the <code>JTabbedPane</code> with all pickmaps */ - public JTabbedPane getPickmapPanel() { + public Component getPickmapPanel() { return pickmapPanel; } Modified: trunk/src/app/net/sf/gridarta/gui/prefs/MiscPrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/MiscPrefs.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/prefs/MiscPrefs.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -23,6 +23,7 @@ import java.util.prefs.Preferences; import javax.swing.Box; import javax.swing.JCheckBox; +import javax.swing.JComponent; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.border.Border; @@ -190,7 +191,7 @@ autoCreateExit.setSelected(exitConnectorModel.isAutoCreateExit()); panel.add(autoCreateExit); - final JLabel label = new JLabel(ACTION_BUILDER.getString("optionsExitConnectorExitArchetypeName.text")); + final JComponent label = new JLabel(ACTION_BUILDER.getString("optionsExitConnectorExitArchetypeName.text")); label.setToolTipText(ACTION_BUILDER.getString("optionsExitConnectorExitArchetypeName.shortdescription")); panel.add(label); exitArchetypeName = new JTextField(exitConnectorModel.getExitArchetypeName()); Modified: trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -34,6 +34,7 @@ import javax.swing.border.Border; import javax.swing.border.CompoundBorder; import javax.swing.border.TitledBorder; +import javax.swing.text.JTextComponent; import net.sf.gridarta.MainControl; import net.sf.gridarta.gui.GUIConstants; import net.sf.japi.swing.action.ActionBuilder; @@ -69,7 +70,7 @@ private final JComboBox proxyType = createProxyType(); /** TextField for server executable. */ - private final JTextField proxyHost = new JTextField(PREFS.get(NET_PREFS_KEY_HOST, "")); + private final JTextComponent proxyHost = new JTextField(PREFS.get(NET_PREFS_KEY_HOST, "")); /** TextField for client executable. */ private final JSpinner proxyPort = new JSpinner(new SpinnerNumberModel(PREFS.getInt(NET_PREFS_KEY_PORT, 3128), 1, 65535, 1)); Modified: trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/prefs/UpdatePrefs.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -138,7 +138,7 @@ * Create the JComboBox with the update choices. * @return JComboBox with update choices */ - private JComboBox createComboBox() { + private Component createComboBox() { final String[] items = { ACTION_BUILDER.getString("prefsUpdateAuto0.text"), ACTION_BUILDER.getString("prefsUpdateAuto1.text"), Modified: trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2009-09-28 11:01:08 UTC (rev 6969) +++ trunk/src/app/net/sf/gridarta/gui/replacedialog/ReplaceDialog.java 2009-09-28 11:57:37 UTC (rev 6970) @@ -20,11 +20,13 @@ package net.sf.gridarta.gui.replacedialog; import java.awt.Component; +import java.awt.Container; import java.awt.FlowLayout; import java.awt.Point; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.util.ArrayList; +import java.util.Collection; import java.util.Iterator; import java.util.List; import javax.swing.BorderFactory; @@ -33,6 +35,7 @@ import javax.swing.Icon; import javax.swing.JButton; import javax.swing.JComboBox; +import javax.swing.JComponent; import javax.swing.JDialog; import javax.swing.JLabel; import javax.swing.JOptionPane; @@ -230,8 +233,8 @@ mainPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 2, 5)); // first line: heading - final JPanel line1 = new JPanel(new FlowLayout(FlowLayout.LEFT)); - final JLabel labelon = new JLabel(ACTION_BUILDER.getString("replaceOn")); + final Container line1 = new JPanel(new FlowLayout(FlowLayout.LEFT)); + final JComponent labelon = new JLabel(ACTION_BUILDER.getString("replaceOn")); labelon.setToolTipText(ACTION_BUILDER.getString("replaceOn.shortdescription")); line1.add(labelon); line1.add(Box.createVerticalStrut(3)); @@ -249,8 +252,8 @@ mainPanel.add(line1); // second line: replace what? - final JPanel line2 = new JPanel(new FlowLayout(FlowLayout.LEFT)); - final JLabel label1 = new JLabel(ACTION_BUILDER.getString("replaceDelete")); + final Container line2 = new JPanel(new FlowLayout(FlowLayout.LEFT)); + final JComponent label1 = new JLabel(ACTION_BUILDER.getString("replaceDelete")); label1.setToolTipText(ACTION_BUILDER.getString("replaceDelete.shortdescription")); line2.add(label1); line2.add(Box.createVerticalStrut(5)); @@ -267,8 +270,8 @@ mainPanel.add(line2); // third line: replace by? - final JPanel line3 = new JPanel(new FlowLayout(FlowLayout.LEFT)); - final JLabel label2 = new JLabel(ACTION_BUILDER.getString("replaceBy")); + final Container line3 = new JP... [truncated message content] |
From: <aki...@us...> - 2009-09-28 20:33:38
|
Revision: 6993 http://gridarta.svn.sourceforge.net/gridarta/?rev=6993&view=rev Author: akirschbaum Date: 2009-09-28 20:33:31 +0000 (Mon, 28 Sep 2009) Log Message: ----------- Move MapGrid.SelectionMode to top-level class. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursor.java trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java trunk/src/app/net/sf/gridarta/gui/map/grid/MapGrid.java trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java trunk/src/test/net/sf/gridarta/gui/map/cursor/MapCursorTest.java trunk/src/test/net/sf/gridarta/gui/map/grid/MapGridTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/map/grid/SelectionMode.java Modified: trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2009-09-28 20:31:40 UTC (rev 6992) +++ trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2009-09-28 20:33:31 UTC (rev 6993) @@ -28,6 +28,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.cursor.MapCursor; import net.sf.gridarta.gui.map.grid.MapGrid; +import net.sf.gridarta.gui.map.grid.SelectionMode; import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.map.mapviewsettings.MapViewSettings; import net.sf.gridarta.map.maparchobject.MapArchObject; @@ -258,7 +259,7 @@ assert mapGrid != null; final boolean thisSelection = (mapGrid.getFlags(pos) & MapGrid.GRID_FLAG_SELECTION) > 0; assert mapGrid != null; - mapGrid.select(prevPos, prevPos, thisSelection ? MapGrid.SelectionMode.ADD : MapGrid.SelectionMode.SUB); + mapGrid.select(prevPos, prevPos, thisSelection ? SelectionMode.ADD : SelectionMode.SUB); if (thisSelection) { if (isStart) { isStart = false; @@ -311,7 +312,7 @@ } assert startGameObjects.isEmpty(); assert mapGrid != null; - mapGrid.select(prevPos, prevPos, startSelection ? MapGrid.SelectionMode.ADD : MapGrid.SelectionMode.SUB); + mapGrid.select(prevPos, prevPos, startSelection ? SelectionMode.ADD : SelectionMode.SUB); } } // class ShiftProcessor Modified: trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java 2009-09-28 20:31:40 UTC (rev 6992) +++ trunk/src/app/net/sf/gridarta/gui/connectionview/Control.java 2009-09-28 20:33:31 UTC (rev 6993) @@ -29,6 +29,7 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.grid.MapGrid; +import net.sf.gridarta.gui.map.grid.SelectionMode; import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.map.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -96,7 +97,7 @@ for (final GameObject<?, ?, ?> object : connection) { final GameObject<?, ?, ?> topObject = object.getTopContainer(); point.setLocation(topObject.getMapX(), topObject.getMapY()); - mapGrid.select(point, point, MapGrid.SelectionMode.ADD); + mapGrid.select(point, point, SelectionMode.ADD); } } } Modified: trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursor.java 2009-09-28 20:31:40 UTC (rev 6992) +++ trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursor.java 2009-09-28 20:33:31 UTC (rev 6993) @@ -25,6 +25,7 @@ import net.sf.gridarta.gui.map.grid.MapGrid; import net.sf.gridarta.gui.map.grid.MapGridEvent; import net.sf.gridarta.gui.map.grid.MapGridListener; +import net.sf.gridarta.gui.map.grid.SelectionMode; import net.sf.gridarta.gui.utils.EventListenerList2; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -246,9 +247,9 @@ /** * Leave drag mode and select preselection using selectionMode. * @param selectionMode Mode how to change selection state - * @see MapGrid.SelectionMode + * @see SelectionMode */ - public void dragSelect(final MapGrid.SelectionMode selectionMode) { + public void dragSelect(final SelectionMode selectionMode) { if (dragging) { mapGrid.beginTransaction(); try { Modified: trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java 2009-09-28 20:31:40 UTC (rev 6992) +++ trunk/src/app/net/sf/gridarta/gui/map/cursor/MapCursorActions.java 2009-09-28 20:33:31 UTC (rev 6993) @@ -25,7 +25,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.golocationdialog.GoLocationDialogManager; -import net.sf.gridarta.gui.map.grid.MapGrid; +import net.sf.gridarta.gui.map.grid.SelectionMode; import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; @@ -254,7 +254,7 @@ public void selectSquare() { final MapCursor mapCursor = getSelectSquareEnabled(); if (mapCursor != null) { - selectSquare(mapCursor, MapGrid.SelectionMode.FLIP); + selectSquare(mapCursor, SelectionMode.FLIP); } } @@ -262,7 +262,7 @@ public void addToSelection() { final MapCursor mapCursor = getAddToSelectionEnabled(); if (mapCursor != null) { - selectSquare(mapCursor, MapGrid.SelectionMode.ADD); + selectSquare(mapCursor, SelectionMode.ADD); } } @@ -270,7 +270,7 @@ public void subFromSelection() { final MapCursor mapCursor = getSubFromSelectionEnabled(); if (mapCursor != null) { - selectSquare(mapCursor, MapGrid.SelectionMode.SUB); + selectSquare(mapCursor, SelectionMode.SUB); } } @@ -487,14 +487,14 @@ aArchAttributes.setEnabled(getArchAttributesEnabled() != null); } - private static void selectSquare(@NotNull final MapCursor mapCursor, final MapGrid.SelectionMode mode) { + private static void selectSquare(@NotNull final MapCursor mapCursor, final SelectionMode mode) { mapCursor.dragStart(); mapCursor.dragSelect(mode); } private static void startStopDrag(@NotNull final MapCursor mapCursor) { if (mapCursor.isDragging()) { - mapCursor.dragSelect(MapGrid.SelectionMode.FLIP); + mapCursor.dragSelect(SelectionMode.FLIP); } else { mapCursor.dragStart(); } Modified: trunk/src/app/net/sf/gridarta/gui/map/grid/MapGrid.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/grid/MapGrid.java 2009-09-28 20:31:40 UTC (rev 6992) +++ trunk/src/app/net/sf/gridarta/gui/map/grid/MapGrid.java 2009-09-28 20:33:31 UTC (rev 6993) @@ -728,18 +728,4 @@ } } - /** Modes that describe how squares get selected. */ - public enum SelectionMode { - - /** All squares that are preselected get selected. */ - ADD, - - /** All squares that are preselected get unselected. */ - SUB, - - /** All squares that are preselected change state of selection. */ - FLIP - - } // enum SelectionMode - } // class MapGrid Added: trunk/src/app/net/sf/gridarta/gui/map/grid/SelectionMode.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/grid/SelectionMode.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/grid/SelectionMode.java 2009-09-28 20:33:31 UTC (rev 6993) @@ -0,0 +1,37 @@ +/* + * 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.map.grid; + +/** + * Modes that describe how squares get selected. + * @author <a href="mailto:dlv...@gm...">Daniel Viegas</a> + */ +public enum SelectionMode { + + /** All squares that are preselected get selected. */ + ADD, + + /** All squares that are preselected get unselected. */ + SUB, + + /** All squares that are preselected change state of selection. */ + FLIP + +} // enum SelectionMode Property changes on: trunk/src/app/net/sf/gridarta/gui/map/grid/SelectionMode.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2009-09-28 20:31:40 UTC (rev 6992) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/SelectionTool.java 2009-09-28 20:33:31 UTC (rev 6993) @@ -32,7 +32,7 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.cursor.MapCursor; import net.sf.gridarta.gui.map.event.MouseOpEvent; -import net.sf.gridarta.gui.map.grid.MapGrid; +import net.sf.gridarta.gui.map.grid.SelectionMode; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.undo.SwingUtils; import net.sf.gridarta.map.maparchobject.MapArchObject; @@ -141,14 +141,14 @@ if (mapCursor.isOnGrid(e.getMapLocation())) { if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) { if ((modifiers & InputEvent.CTRL_DOWN_MASK) == 0) { - mapCursor.dragSelect(MapGrid.SelectionMode.ADD); + mapCursor.dragSelect(SelectionMode.ADD); } else { - mapCursor.dragSelect(MapGrid.SelectionMode.FLIP); + mapCursor.dragSelect(SelectionMode.FLIP); } } else if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) { - mapCursor.dragSelect(MapGrid.SelectionMode.SUB); + mapCursor.dragSelect(SelectionMode.SUB); } else { - mapCursor.dragSelect(MapGrid.SelectionMode.ADD); + mapCursor.dragSelect(SelectionMode.ADD); } } else { mapCursor.dragRelease(); Modified: trunk/src/test/net/sf/gridarta/gui/map/cursor/MapCursorTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/cursor/MapCursorTest.java 2009-09-28 20:31:40 UTC (rev 6992) +++ trunk/src/test/net/sf/gridarta/gui/map/cursor/MapCursorTest.java 2009-09-28 20:33:31 UTC (rev 6993) @@ -23,6 +23,7 @@ import java.awt.Point; import junit.framework.JUnit4TestAdapter; import net.sf.gridarta.gui.map.grid.MapGrid; +import net.sf.gridarta.gui.map.grid.SelectionMode; import net.sf.gridarta.utils.CommonConstants; import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; @@ -340,7 +341,7 @@ testEvents(1, 0); Assert.assertTrue("MapCursor should be in drag mode.", cursor.isDragging()); assertSelection(new Point(0, 0), gridMaxIndex, false); - cursor.dragSelect(MapGrid.SelectionMode.ADD); + cursor.dragSelect(SelectionMode.ADD); testEvents(0, 1); assertSelection(start, end, true); //Check if nothing is preselected @@ -351,7 +352,7 @@ testEvents(0, 1); cursor.dragTo(end); testEvents(1, 0); - cursor.dragSelect(MapGrid.SelectionMode.SUB); + cursor.dragSelect(SelectionMode.SUB); testEvents(0, 1); assertSelection(new Point(0, 0), gridMaxIndex, false); cursor.setLocation(start); @@ -360,7 +361,7 @@ testEvents(0, 1); cursor.dragTo(end); testEvents(1, 0); - cursor.dragSelect(MapGrid.SelectionMode.FLIP); + cursor.dragSelect(SelectionMode.FLIP); testEvents(0, 1); assertSelection(start, end, true); start.setLocation(3, 4); @@ -371,7 +372,7 @@ testEvents(0, 1); cursor.dragTo(end); testEvents(1, 0); - cursor.dragSelect(MapGrid.SelectionMode.FLIP); + cursor.dragSelect(SelectionMode.FLIP); testEvents(0, 1); assertSelection(start, new Point(4, 4), false); assertSelection(new Point(3, 2), end, true); Modified: trunk/src/test/net/sf/gridarta/gui/map/grid/MapGridTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/grid/MapGridTest.java 2009-09-28 20:31:40 UTC (rev 6992) +++ trunk/src/test/net/sf/gridarta/gui/map/grid/MapGridTest.java 2009-09-28 20:33:31 UTC (rev 6993) @@ -36,28 +36,28 @@ final MapGrid mapGrid = new MapGrid(new Size2D(4, 3)); checkSelectionBorder(mapGrid, "0000" + "0000" + "0000"); - mapGrid.select(new Point(1, 1), new Point(1, 1), MapGrid.SelectionMode.ADD); + mapGrid.select(new Point(1, 1), new Point(1, 1), SelectionMode.ADD); checkSelectionBorder(mapGrid, "0000" + "0f00" + "0000"); - mapGrid.select(new Point(2, 1), new Point(2, 1), MapGrid.SelectionMode.ADD); + mapGrid.select(new Point(2, 1), new Point(2, 1), SelectionMode.ADD); checkSelectionBorder(mapGrid, "0000" + "0d70" + "0000"); - mapGrid.select(new Point(3, 1), new Point(3, 1), MapGrid.SelectionMode.ADD); + mapGrid.select(new Point(3, 1), new Point(3, 1), SelectionMode.ADD); checkSelectionBorder(mapGrid, "0000" + "0d57" + "0000"); - mapGrid.select(new Point(3, 1), new Point(3, 1), MapGrid.SelectionMode.SUB); + mapGrid.select(new Point(3, 1), new Point(3, 1), SelectionMode.SUB); checkSelectionBorder(mapGrid, "0000" + "0d70" + "0000"); - mapGrid.select(new Point(0, 0), new Point(3, 2), MapGrid.SelectionMode.FLIP); + mapGrid.select(new Point(0, 0), new Point(3, 2), SelectionMode.FLIP); checkSelectionBorder(mapGrid, "9553" + "a00a" + "c556"); - mapGrid.select(new Point(1, 1), new Point(1, 1), MapGrid.SelectionMode.FLIP); + mapGrid.select(new Point(1, 1), new Point(1, 1), SelectionMode.FLIP); checkSelectionBorder(mapGrid, "9153" + "820a" + "c456"); - mapGrid.select(new Point(1, 1), new Point(1, 1), MapGrid.SelectionMode.SUB); + mapGrid.select(new Point(1, 1), new Point(1, 1), SelectionMode.SUB); checkSelectionBorder(mapGrid, "9553" + "a00a" + "c556"); - mapGrid.select(new Point(0, 0), new Point(3, 2), MapGrid.SelectionMode.ADD); + mapGrid.select(new Point(0, 0), new Point(3, 2), SelectionMode.ADD); checkSelectionBorder(mapGrid, "9113" + "8002" + "c446"); mapGrid.resize(new Size2D(2, 1)); @@ -66,7 +66,7 @@ mapGrid.resize(new Size2D(3, 4)); checkSelectionBorder(mapGrid, "d700" + "0000" + "0000"); - mapGrid.select(new Point(0, 0), new Point(2, 3), MapGrid.SelectionMode.ADD); + mapGrid.select(new Point(0, 0), new Point(2, 3), SelectionMode.ADD); checkSelectionBorder(mapGrid, "913" + "802" + "802" + "c46"); mapGrid.resize(new Size2D(4, 3)); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-10-02 07:30:31
|
Revision: 7044 http://gridarta.svn.sourceforge.net/gridarta/?rev=7044&view=rev Author: akirschbaum Date: 2009-10-02 07:30:23 +0000 (Fri, 02 Oct 2009) Log Message: ----------- Remove DefaultGameObject implements Archetype. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gameobject/DefaultGameObject.java trunk/src/test/net/sf/gridarta/gameobject/TestArchetype.java Modified: trunk/src/app/net/sf/gridarta/gameobject/DefaultGameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/DefaultGameObject.java 2009-10-02 07:10:45 UTC (rev 7043) +++ trunk/src/app/net/sf/gridarta/gameobject/DefaultGameObject.java 2009-10-02 07:30:23 UTC (rev 7044) @@ -43,7 +43,7 @@ * Gridarta. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public abstract class DefaultGameObject<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends GameObjectContainer<G, A, R> implements GameObject<G, A, R>, Archetype<G, A, R> { +public abstract class DefaultGameObject<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends GameObjectContainer<G, A, R> implements GameObject<G, A, R> { /** The serial version UID. */ private static final long serialVersionUID = 1L; @@ -758,14 +758,9 @@ * Sets whether this GameObject is an Artifact. * @param artifact <code>true</code> if this GameObject is an Artifact, * otherwise <code>false</code>. - * @throws NotArchetypeException in case this GameObject is not an - * Archetype. * @see #isArtifact() */ public void setArtifact(final boolean artifact) { - if (!isArchetype()) { - throw new NotArchetypeException(this); - } if (this.artifact == artifact) { return; } Modified: trunk/src/test/net/sf/gridarta/gameobject/TestArchetype.java =================================================================== --- trunk/src/test/net/sf/gridarta/gameobject/TestArchetype.java 2009-10-02 07:10:45 UTC (rev 7043) +++ trunk/src/test/net/sf/gridarta/gameobject/TestArchetype.java 2009-10-02 07:30:23 UTC (rev 7044) @@ -19,13 +19,14 @@ package net.sf.gridarta.gameobject; +import net.sf.gridarta.map.maparchobject.TestMapArchObject; import org.jetbrains.annotations.NotNull; /** * An {@link Archetype} implementation for testing purposes. * @author Andreas Kirschbaum */ -public class TestArchetype extends TestGameObject { +public class TestArchetype extends TestGameObject implements Archetype<TestGameObject, TestMapArchObject, TestArchetype> { /** * The serial version UID. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-10-03 20:49:45
|
Revision: 7075 http://gridarta.svn.sourceforge.net/gridarta/?rev=7075&view=rev Author: akirschbaum Date: 2009-10-03 20:49:36 +0000 (Sat, 03 Oct 2009) Log Message: ----------- Add type parameters to GuiInfo and DialogAttrib; remove some type casts. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttribute.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeAnimName.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeBitmask.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeBool.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeBoolSpec.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeFaceName.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeFixed.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeFloat.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeInt.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeInvSpell.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeList.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeLong.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeMapPath.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeScriptFile.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeSpell.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeString.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeText.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeTreasure.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeZSpell.java trunk/src/app/net/sf/gridarta/archtype/GuiInfo.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribAnimName.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribBitmask.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribBool.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribBoolSpec.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribFaceName.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribFloat.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInt.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInvSpell.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribList.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribLong.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribMapPath.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribScriptFile.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribSpell.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribString.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribText.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribTreasure.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribZSpell.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/test/net/sf/gridarta/archtype/ArchetypeTypeSetParserTest.java Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttribute.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttribute.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttribute.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -178,7 +178,7 @@ * @return the GUI elements */ @NotNull - public abstract GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree); + public abstract GuiInfo<G, A, R, ?> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree); /** * Adds attribute range checks for all defined attributes. Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeAnimName.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeAnimName.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeAnimName.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -71,10 +71,10 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeAnimName<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final JTextField input = new JTextField(gameObject.getAttributeString(getArchetypeAttributeName()), TEXTFIELD_COLUMNS); final JButton cLabel = new JButton(new TreeChooseAction(getAttributeName() + ": ", input, animationObjects)); - return new GuiInfo<G, A, R>(new DialogAttribAnimName<G, A, R>(this, input, typeNoEventConnector), cLabel, input, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeAnimName<G, A, R>>(new DialogAttribAnimName<G, A, R>(this, input, typeNoEventConnector), cLabel, input, null, null, false); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeBitmask.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeBitmask.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -74,7 +74,7 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeBitmask<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final JTextArea input = new JTextArea(); final DialogAttribBitmask<G, A, R> tmpAttr = new DialogAttribBitmask<G, A, R>(this, input); @Nullable final JTextArea cComp; @@ -96,7 +96,7 @@ cComp = null; cRow = new JLabel("Error: Undefined Bitmask"); } - return new GuiInfo<G, A, R>(tmpAttr, cLabel, cComp, cRow, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeBitmask<G, A, R>>(tmpAttr, cLabel, cComp, cRow, null, false); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeBool.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeBool.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeBool.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -53,9 +53,9 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeBool<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final JCheckBox input = new JCheckBox(getAttributeName(), gameObject.getAttributeInt(getArchetypeAttributeName()) == 1); - return new GuiInfo<G, A, R>(new DialogAttribBool<G, A, R>(this, input), null, null, input, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeBool<G, A, R>>(new DialogAttribBool<G, A, R>(this, input), null, null, input, null, false); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeBoolSpec.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeBoolSpec.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeBoolSpec.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -69,7 +69,7 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeBoolSpec<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final String attrString = gameObject.getAttributeString(getArchetypeAttributeName()); final boolean defaultValue; if (trueValue.equals("0")) { @@ -78,7 +78,7 @@ defaultValue = attrString.equals(trueValue); } final JCheckBox input = new JCheckBox(getAttributeName(), defaultValue); - return new GuiInfo<G, A, R>(new DialogAttribBoolSpec<G, A, R>(this, input), null, input, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeBoolSpec<G, A, R>>(new DialogAttribBoolSpec<G, A, R>(this, input), null, input, null, null, false); } /** Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeFaceName.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeFaceName.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeFaceName.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -70,12 +70,12 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeFaceName<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final String attributeName = getArchetypeAttributeName(); final String defaultText = gameObject.getAttributeString(attributeName); final JTextField input = new JTextField(defaultText, TEXTFIELD_COLUMNS); final JButton cLabel = new JButton(new TreeChooseAction(getAttributeName() + ": ", input, faceObjects)); - return new GuiInfo<G, A, R>(new DialogAttribFaceName<G, A, R>(this, input, typeNoEventConnector), cLabel, input, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeFaceName<G, A, R>>(new DialogAttribFaceName<G, A, R>(this, input, typeNoEventConnector), cLabel, input, null, null, false); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeFixed.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeFixed.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeFixed.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -50,7 +50,7 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeFixed<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { throw new AssertionError(); } Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeFloat.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeFloat.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeFloat.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -57,7 +57,7 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeFloat<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final JLabel cLabel = new JLabel(getAttributeName() + ": "); cLabel.setForeground(CommonConstants.FLOAT_COLOR); final int fieldLength = getInputLength() == 0 ? TEXTFIELD_COLUMNS : getInputLength(); @@ -71,7 +71,7 @@ final Number value = gameObject.getAttributeDouble(getArchetypeAttributeName()); final JFormattedTextField input = new JFormattedTextField(factory, value); input.setColumns(fieldLength); - return new GuiInfo<G, A, R>(new DialogAttribFloat<G, A, R>(this, input), cLabel, input, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeFloat<G, A, R>>(new DialogAttribFloat<G, A, R>(this, input), cLabel, input, null, null, false); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeInt.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeInt.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeInt.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -86,7 +86,7 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeInt<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final JLabel cLabel = new JLabel(getAttributeName() + ": "); cLabel.setForeground(CommonConstants.INT_COLOR); final int fieldLength = getInputLength() == 0 ? TEXTFIELD_COLUMNS : getInputLength(); @@ -98,7 +98,7 @@ final Number value = gameObject.getAttributeInt(getArchetypeAttributeName()); final JFormattedTextField input = new JFormattedTextField(factory, value); input.setColumns(fieldLength); - return new GuiInfo<G, A, R>(new DialogAttribInt<G, A, R>(this, input), cLabel, input, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeInt<G, A, R>>(new DialogAttribInt<G, A, R>(this, input), cLabel, input, null, null, false); } /** Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeInvSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeInvSpell.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeInvSpell.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -73,12 +73,12 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeInvSpell<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final JLabel cLabel = new JLabel(getAttributeName() + ": "); cLabel.setForeground(CommonConstants.INT_COLOR); // create ComboBox with parsed selection @Nullable final JComboBox input = buildInvSpellBox(gameObjectSpells, gameObject, isOptionalSpell); - return new GuiInfo<G, A, R>(new DialogAttribInvSpell<G, A, R>(isOptionalSpell, this, input, gameObjectSpells), cLabel, input, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeInvSpell<G, A, R>>(new DialogAttribInvSpell<G, A, R>(isOptionalSpell, this, input, gameObjectSpells), cLabel, input, null, null, false); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeList.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeList.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeList.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -72,7 +72,7 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeList<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final JLabel cLabel = new JLabel(getAttributeName() + ": "); cLabel.setForeground(CommonConstants.INT_COLOR); // create ComboBox with parsed selection @@ -88,7 +88,7 @@ input = null; cComp = new JLabel("Error: Undefined List"); } - return new GuiInfo<G, A, R>(new DialogAttribList<G, A, R>(this, input, archetypeTypeSet), cLabel, cComp, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeList<G, A, R>>(new DialogAttribList<G, A, R>(this, input, archetypeTypeSet), cLabel, cComp, null, null, false); } /** Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeLong.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeLong.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeLong.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -57,7 +57,7 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeLong<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final JLabel cLabel = new JLabel(getAttributeName() + ": "); cLabel.setForeground(CommonConstants.INT_COLOR); final int fieldLength = getInputLength() == 0 ? TEXTFIELD_COLUMNS : getInputLength(); @@ -69,7 +69,7 @@ final Number value = gameObject.getAttributeLong(getArchetypeAttributeName()); final JFormattedTextField input = new JFormattedTextField(factory, value); input.setColumns(fieldLength); - return new GuiInfo<G, A, R>(new DialogAttribLong<G, A, R>(this, input), cLabel, input, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeLong<G, A, R>>(new DialogAttribLong<G, A, R>(this, input), cLabel, input, null, null, false); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeMapPath.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeMapPath.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeMapPath.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -74,7 +74,7 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeMapPath<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); File relativeReference = mapSquare == null ? null : mapSquare.getMapModel().getMapFile(); if (relativeReference == null) { @@ -85,7 +85,7 @@ tilePanel.setAbsoluteReference(globalSettings.getMapDir()); tilePanel.setOriginal(gameObject.getAttributeString(getArchetypeAttributeName())); tilePanel.setRelativeReference(relativeReference); - return new GuiInfo<G, A, R>(new DialogAttribMapPath<G, A, R>(this, tilePanel), cLabel, tilePanel, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeMapPath<G, A, R>>(new DialogAttribMapPath<G, A, R>(this, tilePanel), cLabel, tilePanel, null, null, false); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeScriptFile.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeScriptFile.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeScriptFile.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -73,13 +73,13 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeScriptFile<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final JLabel cLabel = new JLabel(getAttributeName() + ": "); final TilePanel tilePanel = new TilePanel(scriptFileFilter, DirectionLayout.Direction.N); tilePanel.setAbsoluteReference(globalSettings.getMapDir()); tilePanel.setOriginal(gameObject.getAttributeString(getArchetypeAttributeName())); tilePanel.setRelativeReference(new File(globalSettings.getMapDir(), "dummy")); - return new GuiInfo<G, A, R>(new DialogAttribScriptFile<G, A, R>(this, tilePanel), cLabel, tilePanel, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeScriptFile<G, A, R>>(new DialogAttribScriptFile<G, A, R>(this, tilePanel), cLabel, tilePanel, null, null, false); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeSpell.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeSpell.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -73,12 +73,12 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeSpell<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final JLabel cLabel = new JLabel(getAttributeName() + ": "); cLabel.setForeground(CommonConstants.INT_COLOR); // create ComboBox with parsed selection @Nullable final JComboBox input = buildSpellBox(gameObject, numberSpells, undefinedSpellIndex, false); - return new GuiInfo<G, A, R>(new DialogAttribSpell<G, A, R>(this, input, numberSpells), cLabel, input, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeSpell<G, A, R>>(new DialogAttribSpell<G, A, R>(this, input, numberSpells), cLabel, input, null, null, false); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeString.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeString.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeString.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -60,11 +60,11 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeString<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final String defaultText = getDefaultText(gameObject, archetype, type); final JTextField input = new JTextField(defaultText, TEXTFIELD_COLUMNS); final JLabel cLabel = new JLabel(getAttributeName() + ": "); - return new GuiInfo<G, A, R>(new DialogAttribString<G, A, R>(this, input, typeNoEventConnector), cLabel, input, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeString<G, A, R>>(new DialogAttribString<G, A, R>(this, input, typeNoEventConnector), cLabel, input, null, null, false); } /** Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeText.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeText.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeText.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -71,7 +71,7 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeText<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { String text = ""; if (getArchetypeAttributeName().equals("msg")) { final String archetypeMsgText = archetype.getMsgText(); @@ -89,7 +89,7 @@ input.setCaretPosition(0); input.setBorder(BorderFactory.createEmptyBorder(3, 7, 0, 0)); input.getPainter().setInvalidLinesPainted(false); - return new GuiInfo<G, A, R>(new DialogAttribText<G, A, R>(this, input), null, null, null, input, true); + return new GuiInfo<G, A, R, ArchetypeAttributeText<G, A, R>>(new DialogAttribText<G, A, R>(this, input), null, null, null, input, true); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeTreasure.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeTreasure.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeTreasure.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -63,7 +63,7 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeTreasure<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { // textfield (no direct input, text is set by the treasurelist dialog) String treasureName = gameObject.getAttributeString(getArchetypeAttributeName()); if (treasureName.trim().length() == 0 || treasureName.trim().equalsIgnoreCase("none")) { @@ -73,7 +73,7 @@ input.setEditable(false); final DialogAttribTreasure<G, A, R> tmpAttr = new DialogAttribTreasure<G, A, R>(this, input, treasureTree); final JButton cLabel = new JButton(new ViewTreasurelistAL<G, A, R>(tmpAttr, parent, treasureListTree)); - return new GuiInfo<G, A, R>(tmpAttr, cLabel, input, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeTreasure<G, A, R>>(tmpAttr, cLabel, input, null, null, false); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeZSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeZSpell.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttributeZSpell.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -73,12 +73,12 @@ /** {@inheritDoc} */ @NotNull @Override - public GuiInfo<G, A, R> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { + public GuiInfo<G, A, R, ArchetypeAttributeZSpell<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { final JLabel cLabel = new JLabel(getAttributeName() + ": "); cLabel.setForeground(CommonConstants.INT_COLOR); // create ComboBox with parsed selection @Nullable final JComboBox input = buildSpellBox(gameObject, numberSpells, undefinedSpellIndex, true); - return new GuiInfo<G, A, R>(new DialogAttribZSpell<G, A, R>(this, input, numberSpells, undefinedSpellIndex), cLabel, input, null, null, false); + return new GuiInfo<G, A, R, ArchetypeAttributeZSpell<G, A, R>>(new DialogAttribZSpell<G, A, R>(this, input, numberSpells, undefinedSpellIndex), cLabel, input, null, null, false); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/archtype/GuiInfo.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/GuiInfo.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/archtype/GuiInfo.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -31,11 +31,11 @@ * Return value for {@link ArchetypeAttribute#createGui(String, ArchetypeAttributeType,G,int)}. * @author Andreas Kirschbaum */ -public class GuiInfo<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public class GuiInfo<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, T extends ArchetypeAttribute<G, A, R>> { // now create the attribute-GUI-instance @NotNull - public final DialogAttrib<G, A, R> newAttr; + public final DialogAttrib<G, A, R, T> newAttr; @Nullable public final JComponent cLabel; @@ -51,7 +51,7 @@ public final boolean isText; - public GuiInfo(@NotNull final DialogAttrib<G, A, R> newAttr, @Nullable final JComponent cLabel, @Nullable final JComponent cComp, @Nullable final JComponent cRow, @Nullable final JComponent cGlue, final boolean isText) { + public GuiInfo(@NotNull final DialogAttrib<G, A, R, T> newAttr, @Nullable final JComponent cLabel, @Nullable final JComponent cComp, @Nullable final JComponent cRow, @Nullable final JComponent cGlue, final boolean isText) { this.newAttr = newAttr; this.cLabel = cLabel; this.cComp = cComp; Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribAnimName.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribAnimName.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribAnimName.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -23,7 +23,7 @@ import javax.swing.JTextField; import javax.swing.text.Document; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeAttributeAnimName; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class DialogAttribAnimName<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribAnimName<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeAnimName<G, A, R>> { /** * The input ui component for editing the value. @@ -49,7 +49,7 @@ * @param input the input ui component for editing the value * @param typeNoEventConnector the game object type for event objects */ - public DialogAttribAnimName(@NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final JTextField input, final int typeNoEventConnector) { + public DialogAttribAnimName(@NotNull final ArchetypeAttributeAnimName<G, A, R> ref, @NotNull final JTextField input, final int typeNoEventConnector) { super(ref); this.input = input; this.typeNoEventConnector = typeNoEventConnector; Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribBitmask.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribBitmask.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -23,7 +23,7 @@ import javax.swing.text.Document; import javax.swing.text.JTextComponent; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeAttributeBitmask; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.archtype.CAttribBitmask; import net.sf.gridarta.gameobject.Archetype; @@ -37,7 +37,7 @@ * DialogAttrib for types with bitmasks to choose from. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public class DialogAttribBitmask<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribBitmask<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeBitmask<G, A, R>> { /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(DialogAttribBitmask.class); @@ -59,7 +59,7 @@ * @param ref reference to the attribute data * @param input the input ui component for editing the value */ - public DialogAttribBitmask(@NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final JTextComponent input) { + public DialogAttribBitmask(@NotNull final ArchetypeAttributeBitmask<G, A, R> ref, @NotNull final JTextComponent input) { super(ref); this.input = input; } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribBool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribBool.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribBool.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -23,7 +23,7 @@ import javax.swing.JCheckBox; import javax.swing.text.Document; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeAttributeBool; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -32,7 +32,7 @@ import org.jetbrains.annotations.Nullable; // a boolean attribute (flag) -public class DialogAttribBool<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribBool<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeBool<G, A, R>> { /** * The input ui component for editing the value. @@ -45,7 +45,7 @@ * @param ref reference to the attribute data * @param input the input ui component for editing the value */ - public DialogAttribBool(@NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final JCheckBox input) { + public DialogAttribBool(@NotNull final ArchetypeAttributeBool<G, A, R> ref, @NotNull final JCheckBox input) { super(ref); this.input = input; } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribBoolSpec.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribBoolSpec.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribBoolSpec.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -23,7 +23,6 @@ import javax.swing.JCheckBox; import javax.swing.text.Document; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; import net.sf.gridarta.archtype.ArchetypeAttributeBoolSpec; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.gameobject.Archetype; @@ -33,7 +32,7 @@ import org.jetbrains.annotations.Nullable; // a boolean attribute with customized true/false values -public class DialogAttribBoolSpec<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribBoolSpec<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeBoolSpec<G, A, R>> { /** * The input ui component for editing the value. @@ -46,7 +45,7 @@ * @param ref reference to the attribute data * @param input the input ui component for editing the value. */ - public DialogAttribBoolSpec(@NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final JCheckBox input) { + public DialogAttribBoolSpec(@NotNull final ArchetypeAttributeBoolSpec<G, A, R> ref, @NotNull final JCheckBox input) { super(ref); this.input = input; } @@ -57,9 +56,9 @@ public String getText2(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, final String[] newName, final String[] newMsg, final String[] newAnim, final ArchetypeType<G, A, R> typeStruct, final Component parent) { final String valString; // value-string to apply if (input.isSelected()) { - valString = ((ArchetypeAttributeBoolSpec<G, A, R>) getRef()).getTrueValue(); + valString = getRef().getTrueValue(); } else { - valString = ((ArchetypeAttributeBoolSpec<G, A, R>) getRef()).getFalseValue(); + valString = getRef().getFalseValue(); } // now see if we need to write it into the archtext or not final String archetypeAttributeName = getRef().getArchetypeAttributeName(); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribFaceName.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribFaceName.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribFaceName.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -23,7 +23,7 @@ import javax.swing.JTextField; import javax.swing.text.Document; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeAttributeFaceName; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class DialogAttribFaceName<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribFaceName<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeFaceName<G, A, R>> { /** * The input ui component for editing the value. @@ -50,7 +50,7 @@ * @param input the input ui component for editing the value * @param typeNoEventConnector the game object type for event objects */ - public DialogAttribFaceName(@NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final JTextField input, final int typeNoEventConnector) { + public DialogAttribFaceName(@NotNull final ArchetypeAttributeFaceName<G, A, R> ref, @NotNull final JTextField input, final int typeNoEventConnector) { super(ref); this.input = input; this.typeNoEventConnector = typeNoEventConnector; Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribFloat.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribFloat.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribFloat.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -24,7 +24,7 @@ import javax.swing.JOptionPane; import javax.swing.text.Document; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeAttributeFloat; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class DialogAttribFloat<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribFloat<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeFloat<G, A, R>> { /** * The input ui component for editing the value. @@ -45,7 +45,7 @@ * @param ref reference to the attribute data * @param input the input ui component for editing the value */ - public DialogAttribFloat(@NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final JFormattedTextField input) { + public DialogAttribFloat(@NotNull final ArchetypeAttributeFloat<G, A, R> ref, @NotNull final JFormattedTextField input) { super(ref); this.input = input; } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInt.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInt.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInt.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -33,7 +33,7 @@ import org.jetbrains.annotations.Nullable; // an int attribute -public class DialogAttribInt<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribInt<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeInt<G, A, R>> { /** * Reference to the attribute data. Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInvSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInvSpell.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribInvSpell.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -23,7 +23,7 @@ import javax.swing.JComboBox; import javax.swing.text.Document; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeAttributeInvSpell; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -33,7 +33,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class DialogAttribInvSpell<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribInvSpell<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeInvSpell<G, A, R>> { /** * Whether the spell game object is optional. @@ -59,7 +59,7 @@ * @param input the input ui component for editing the value * @param gameObjectSpells the game object spells to display */ - public DialogAttribInvSpell(final boolean isOptionalSpell, @NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final JComboBox input, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells) { + public DialogAttribInvSpell(final boolean isOptionalSpell, @NotNull final ArchetypeAttributeInvSpell<G, A, R> ref, @NotNull final JComboBox input, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells) { super(ref); this.isOptionalSpell = isOptionalSpell; this.input = input; Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribList.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribList.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribList.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -23,7 +23,6 @@ import javax.swing.JComboBox; import javax.swing.text.Document; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; import net.sf.gridarta.archtype.ArchetypeAttributeList; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.archtype.ArchetypeTypeSet; @@ -33,7 +32,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class DialogAttribList<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribList<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeList<G, A, R>> { /** * The input ui component for editing the value. @@ -53,7 +52,7 @@ * @param input the input ui component for editing the value * @param archetypeTypeSet the archetype type set */ - public DialogAttribList(@NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final JComboBox input, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { + public DialogAttribList(@NotNull final ArchetypeAttributeList<G, A, R> ref, @NotNull final JComboBox input, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { super(ref); this.input = input; this.archetypeTypeSet = archetypeTypeSet; @@ -66,7 +65,7 @@ // get selected index of ComboBox final int attrValTmp = input.getSelectedIndex(); // fetch value according to this list entry: - final int attrVal = archetypeTypeSet.getList(((ArchetypeAttributeList<G, A, R>) getRef()).getListName()).get(attrValTmp).getFirst(); // attribute value + final int attrVal = archetypeTypeSet.getList(getRef().getListName()).get(attrValTmp).getFirst(); // attribute value final String archetypeAttributeName = getRef().getArchetypeAttributeName(); if (archetype.getAttributeInt(archetypeAttributeName) != attrVal) { Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribLong.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribLong.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribLong.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -24,7 +24,7 @@ import javax.swing.JOptionPane; import javax.swing.text.Document; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeAttributeLong; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -32,7 +32,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class DialogAttribLong<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribLong<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeLong<G, A, R>> { /** * The input ui component for editing the value. @@ -45,7 +45,7 @@ * @param ref reference to the attribute data * @param input the input ui component for editing the value */ - public DialogAttribLong(@NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final JFormattedTextField input) { + public DialogAttribLong(@NotNull final ArchetypeAttributeLong<G, A, R> ref, @NotNull final JFormattedTextField input) { super(ref); this.input = input; } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribMapPath.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribMapPath.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribMapPath.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -22,7 +22,7 @@ import java.awt.Component; import javax.swing.text.Document; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeAttributeMapPath; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class DialogAttribMapPath<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribMapPath<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeMapPath<G, A, R>> { /** * The input ui component for editing the value. @@ -44,7 +44,7 @@ * @param ref reference to the attribute data * @param input the input ui component for editing the value */ - public DialogAttribMapPath(@NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final TilePanel input) { + public DialogAttribMapPath(@NotNull final ArchetypeAttributeMapPath<G, A, R> ref, @NotNull final TilePanel input) { super(ref); this.input = input; } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribScriptFile.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribScriptFile.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribScriptFile.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -22,7 +22,7 @@ import java.awt.Component; import javax.swing.text.Document; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeAttributeScriptFile; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -31,7 +31,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class DialogAttribScriptFile<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribScriptFile<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeScriptFile<G, A, R>> { /** * The input ui component for editing the value. @@ -44,7 +44,7 @@ * @param ref reference to the attribute data * @param input the input ui component for editing the value */ - public DialogAttribScriptFile(@NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final TilePanel input) { + public DialogAttribScriptFile(@NotNull final ArchetypeAttributeScriptFile<G, A, R> ref, @NotNull final TilePanel input) { super(ref); this.input = input; } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribSpell.java 2009-10-03 20:09:19 UTC (rev 7074) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttribSpell.java 2009-10-03 20:49:36 UTC (rev 7075) @@ -23,7 +23,7 @@ import javax.swing.JComboBox; import javax.swing.text.Document; import javax.swing.text.Style; -import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeAttributeSpell; import net.sf.gridarta.archtype.ArchetypeType; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; @@ -33,7 +33,7 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class DialogAttribSpell<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R> { +public class DialogAttribSpell<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends DialogAttrib<G, A, R, ArchetypeAttributeSpell<G, A, R>> { /** * The input ui component for editing the value. @@ -53,7 +53,7 @@ * @param input the input ui component for editing the value * @param numberSpells the number spells to display */ - public DialogAttribSpell(@NotNull final ArchetypeAttribute<G, A, R> ref, @NotNull final JComboBox input, @NotNull final Spells<NumberSpell> numberSpells) { + public DialogAttribSpell(@NotNull final ArchetypeAttributeSpell<G, A, R> r... [truncated message content] |
From: <aki...@us...> - 2009-10-18 08:26:23
|
Revision: 7133 http://gridarta.svn.sourceforge.net/gridarta/?rev=7133&view=rev Author: akirschbaum Date: 2009-10-18 08:26:15 +0000 (Sun, 18 Oct 2009) Log Message: ----------- Remove redundant code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gameobject/DefaultGameObject.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java Modified: trunk/src/app/net/sf/gridarta/gameobject/DefaultGameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/DefaultGameObject.java 2009-10-18 08:21:38 UTC (rev 7132) +++ trunk/src/app/net/sf/gridarta/gameobject/DefaultGameObject.java 2009-10-18 08:26:15 UTC (rev 7133) @@ -77,15 +77,12 @@ @NotNull private FaceSource faceObjSource = FaceSource.FACE_NOT_FOUND; - @Nullable - private static ImageIcon noFace = null; - /** * The normal face. * @serial */ @Nullable - private ImageIcon normalFace = noFace; + private ImageIcon normalFace = null; /** * If this flag is set, this Archetype is not a "real" Archetype but comes @@ -230,7 +227,6 @@ protected DefaultGameObject(@NotNull final String archetypeName) { gameObjectText = new GameObjectText(); faceObjName = null; - normalFace = null; artifact = false; container = null; archetype = null; @@ -253,12 +249,10 @@ * Initializes the instance. * @param gameObjectMatchers the instance to use * @param animationObjects the animation objects to use - * @param noFace the image icons for game objects having no face */ - public static void initialize(@Nullable final GameObjectMatchers gameObjectMatchers, @Nullable final AnimationObjects animationObjects, @NotNull final ImageIcon noFace) { + public static void initialize(@Nullable final GameObjectMatchers gameObjectMatchers, @Nullable final AnimationObjects animationObjects) { DefaultGameObject.gameObjectMatchers = gameObjectMatchers; DefaultGameObject.animationObjects = animationObjects; - DefaultGameObject.noFace = noFace; } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2009-10-18 08:21:38 UTC (rev 7132) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2009-10-18 08:26:15 UTC (rev 7133) @@ -366,7 +366,7 @@ scriptArchEditor.initEventTypeBoxes(scriptArchUtils); scriptArchData = editorFactory.newScriptArchData(scriptedEventFactory, scriptArchUtils, scriptArchEditor, scriptedEventEditor); gameObjectFactory.setScriptArchData(scriptArchData); - DefaultGameObject.initialize(gameObjectMatchers, animationObjects, SystemIcons.getNofaceSquareIcon()); + DefaultGameObject.initialize(gameObjectMatchers, animationObjects); resources = editorFactory.newResources(gameObjectParser, archetypeSet, archetypeParser, mapViewSettings, faceObjects, animationObjects, archFaceProvider, faceObjectProviders); final long timeStart = System.currentTimeMillis(); if (log.isInfoEnabled()) { Modified: trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2009-10-18 08:21:38 UTC (rev 7132) +++ trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2009-10-18 08:26:15 UTC (rev 7133) @@ -21,7 +21,6 @@ import java.awt.Point; import java.io.File; -import javax.swing.ImageIcon; import net.sf.gridarta.autojoin.AutojoinLists; import net.sf.gridarta.gameobject.ArchetypeFactory; import net.sf.gridarta.gameobject.ArchetypeSet; @@ -397,7 +396,7 @@ tmpMapManager.setFileControl(new TestFileControl()); mapManager = tmpMapManager; PathManager.setGlobalSettings(globalSettings); - DefaultGameObject.initialize(null, null, new ImageIcon()); + DefaultGameObject.initialize(null, null); floorArchetype = new TestArchetype("floor"); floorArchetype.setTypeNo(FLOOR_TYPE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-10-23 00:17:27
|
Revision: 7140 http://gridarta.svn.sourceforge.net/gridarta/?rev=7140&view=rev Author: akirschbaum Date: 2009-10-23 00:13:16 +0000 (Fri, 23 Oct 2009) Log Message: ----------- Merge duplicated code. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java trunk/src/app/net/sf/gridarta/map/maparchobject/AbstractMapArchObject.java trunk/src/app/net/sf/gridarta/map/maparchobject/MapArchObject.java trunk/src/test/net/sf/gridarta/map/maparchobject/TestMapArchObject.java Modified: trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java 2009-10-22 23:24:42 UTC (rev 7139) +++ trunk/src/app/net/sf/gridarta/gui/map/mapactions/DefaultMapActions.java 2009-10-23 00:13:16 UTC (rev 7140) @@ -716,10 +716,6 @@ } catch (final SameMapException e) { // path points to the same map if (destinationPoint != null) { - if (destinationPoint.x == -1 && destinationPoint.y == -1) { - destinationPoint.x = currentMapView.getMapControl().getMapModel().getMapArchObject().getEnterX(); - destinationPoint.y = currentMapView.getMapControl().getMapModel().getMapArchObject().getEnterY(); - } showLocation(currentMapView, destinationPoint); } return; @@ -731,10 +727,6 @@ } if (destinationPoint != null) { - if (destinationPoint.x == -1 && destinationPoint.y == -1) { - destinationPoint.x = newMapView.getMapControl().getMapModel().getMapArchObject().getEnterX(); - destinationPoint.y = newMapView.getMapControl().getMapModel().getMapArchObject().getEnterY(); - } showLocation(newMapView, destinationPoint); } else { newMapView.getMapViewBasic().getViewport().setViewPosition(calculateNewViewPosition(currentMapView.getMapViewBasic(), newMapView.getMapViewBasic(), direction)); @@ -752,12 +744,13 @@ * @param point the square */ private void showLocation(@NotNull final MapView<G, A, R> mapView, @NotNull final Point point) { - if (!mapView.getMapControl().getMapModel().isPointValid(point)) { + final Point point2 = point.x == -1 && point.y == -1 ? mapView.getMapControl().getMapModel().getMapArchObject().getEnter() : point; + if (!mapView.getMapControl().getMapModel().isPointValid(point2)) { ACTION_BUILDER.showMessageDialog(parent, "enterExitOutside"); return; } - mapView.getMapViewBasic().getMapCursor().setLocation(point); + mapView.getMapViewBasic().getMapCursor().setLocation(point2); } /** Modified: trunk/src/app/net/sf/gridarta/map/maparchobject/AbstractMapArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/maparchobject/AbstractMapArchObject.java 2009-10-22 23:24:42 UTC (rev 7139) +++ trunk/src/app/net/sf/gridarta/map/maparchobject/AbstractMapArchObject.java 2009-10-23 00:13:16 UTC (rev 7140) @@ -19,6 +19,7 @@ package net.sf.gridarta.map.maparchobject; +import java.awt.Point; import java.util.Arrays; import java.util.prefs.Preferences; import java.util.regex.Matcher; @@ -203,7 +204,14 @@ } /** {@inheritDoc} */ + @NotNull @Override + public Point getEnter() { + return new Point(enterX, enterY); + } + + /** {@inheritDoc} */ + @Override public boolean isOutdoor() { return outdoor; } Modified: trunk/src/app/net/sf/gridarta/map/maparchobject/MapArchObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/maparchobject/MapArchObject.java 2009-10-22 23:24:42 UTC (rev 7139) +++ trunk/src/app/net/sf/gridarta/map/maparchobject/MapArchObject.java 2009-10-23 00:13:16 UTC (rev 7140) @@ -19,6 +19,7 @@ package net.sf.gridarta.map.maparchobject; +import java.awt.Point; import java.io.Serializable; import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; @@ -93,6 +94,13 @@ void setEnterY(int enterY); /** + * Returns the enter coordinates. + * @return the enter coordinates + */ + @NotNull + Point getEnter(); + + /** * Return whether the map is an "outdoor" map. * @return Whether the map is an "outdoor" map. */ Modified: trunk/src/test/net/sf/gridarta/map/maparchobject/TestMapArchObject.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/maparchobject/TestMapArchObject.java 2009-10-22 23:24:42 UTC (rev 7139) +++ trunk/src/test/net/sf/gridarta/map/maparchobject/TestMapArchObject.java 2009-10-23 00:13:16 UTC (rev 7140) @@ -19,6 +19,7 @@ package net.sf.gridarta.map.maparchobject; +import java.awt.Point; import net.sf.gridarta.utils.Size2D; import org.jetbrains.annotations.NotNull; @@ -100,7 +101,14 @@ } /** {@inheritDoc} */ + @NotNull @Override + public Point getEnter() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @Override public boolean isOutdoor() { throw new AssertionError(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-11-17 21:05:04
|
Revision: 7234 http://gridarta.svn.sourceforge.net/gridarta/?rev=7234&view=rev Author: akirschbaum Date: 2009-11-17 21:04:51 +0000 (Tue, 17 Nov 2009) Log Message: ----------- Remove FaceObjectProviders.init(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjectProviders.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java trunk/src/test/net/sf/gridarta/gameobject/DefaultGameObjectTest.java trunk/src/test/net/sf/gridarta/gameobject/match/NamedGameObjectMatcherTest.java trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java Modified: trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjectProviders.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjectProviders.java 2009-11-17 20:43:20 UTC (rev 7233) +++ trunk/src/app/net/sf/gridarta/gameobject/face/FaceObjectProviders.java 2009-11-17 21:04:51 UTC (rev 7234) @@ -125,12 +125,14 @@ /** * The face provider for double faces. */ - private FilterFaceProvider doubleFaceProvider = null; + @NotNull + private final FilterFaceProvider doubleFaceProvider; /** * The face provider for transparent double faces. */ - private FilterFaceProvider doubleAlphaFaceProvider = null; + @NotNull + private final FilterFaceProvider doubleAlphaFaceProvider; /** * The {@link FaceObjects} instance for looking up face names. @@ -138,12 +140,11 @@ private FaceObjects faceObjects = null; /** - * Initializes the double faces face providers. + * Creates a new instance. * @param doubleFaceOffset the offset for shifting double faces * @param faceObjects the face objects instance */ - @Deprecated - public void init(final int doubleFaceOffset, @NotNull final FaceObjects faceObjects) { + public FaceObjectProviders(final int doubleFaceOffset, @NotNull final FaceObjects faceObjects) { this.faceObjects = faceObjects; doubleFaceProvider = new FilterFaceProvider(new DoubleImageFilter(doubleFaceOffset)); doubleAlphaFaceProvider = new FilterFaceProvider(new DoubleImageFilter(doubleFaceOffset)); @@ -153,9 +154,6 @@ * Reloads all providers provided by this FaceObjects. */ public void reloadAll() { - if (doubleFaceProvider == null) { - throw new IllegalStateException(); - } for (final FaceProvider faceProvider : new FaceProvider[] { normalFaceProvider, GRAY, RED, GREEN, BLUE, ALPHA, GRID, doubleFaceProvider, doubleAlphaFaceProvider }) { faceProvider.reload(); } @@ -167,9 +165,6 @@ * @param normalFaceProvider face the provider that provides normal images */ public void setNormal(@NotNull final FaceProvider normalFaceProvider) { - if (doubleFaceProvider == null) { - throw new IllegalStateException(); - } this.normalFaceProvider = normalFaceProvider; GRAY.setParent(normalFaceProvider); RED.setParent(normalFaceProvider); Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2009-11-17 20:43:20 UTC (rev 7233) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2009-11-17 21:04:51 UTC (rev 7234) @@ -235,7 +235,7 @@ private final ScriptArchData<G, A, R> scriptArchData; @NotNull - private final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + private final FaceObjectProviders faceObjectProviders; @NotNull private final PluginParameterFactory<G, A, R> pluginParameterFactory; @@ -275,6 +275,9 @@ this.directionMap = directionMap; mapArchObjectFactory = editorFactory.newMapArchObjectFactory(); final MapArchObjectParserFactory<A> mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); + final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); + faceObjects = editorFactory.createFaceObjects(archFaceProvider); + faceObjectProviders = new FaceObjectProviders(doubleFaceOffset, faceObjects); gameObjectFactory = editorFactory.newGameObjectFactory(faceObjectProviders); final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory); globalSettings = editorFactory.newGlobalSettings(); @@ -293,9 +296,6 @@ pathManager = new PathManager(globalSettings); editorFactory.initGameObject(archetypeTypeSet); SystemIcons.init(); - final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); - faceObjects = editorFactory.createFaceObjects(archFaceProvider); - faceObjectProviders.init(doubleFaceOffset, faceObjects); animationObjects = new DefaultAnimationObjects(animationObjectsFilename); editorFactory.initSmoothFaces(faceObjects); final XmlHelper xmlHelper; Modified: trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2009-11-17 20:43:20 UTC (rev 7233) +++ trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2009-11-17 21:04:51 UTC (rev 7234) @@ -11,7 +11,9 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.GameObjectFactory; +import net.sf.gridarta.gameobject.face.ArchFaceProvider; import net.sf.gridarta.gameobject.face.FaceObjectProviders; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.NamedGameObjectMatcher; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.mapviewsettings.MapViewSettings; @@ -52,7 +54,9 @@ public static <G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> ImageCreator<G, A, R> newImageCreator(@NotNull final EditorFactory<G, A, R> editorFactory) { final MapArchObjectFactory<A> mapArchObjectFactory = editorFactory.newMapArchObjectFactory(); final MapArchObjectParserFactory<A> mapArchObjectParserFactory = editorFactory.newMapArchObjectParserFactory(); - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); + final FaceObjects faceObjects = editorFactory.createFaceObjects(archFaceProvider); + final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects); final GameObjectFactory<G, A, R> gameObjectFactory = editorFactory.newGameObjectFactory(faceObjectProviders); final GameObjectParserFactory<G, A, R> gameObjectParserFactory = editorFactory.newGameObjectParserFactory(gameObjectFactory); final GlobalSettings globalSettings = editorFactory.newGlobalSettings(); Modified: trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2009-11-17 20:43:20 UTC (rev 7233) +++ trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2009-11-17 21:04:51 UTC (rev 7234) @@ -21,6 +21,7 @@ import java.awt.Point; import java.io.File; +import java.util.regex.Pattern; import net.sf.gridarta.autojoin.AutojoinLists; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeFactory; @@ -34,7 +35,10 @@ import net.sf.gridarta.gameobject.TestArchetypeSet; import net.sf.gridarta.gameobject.TestGameObject; import net.sf.gridarta.gameobject.TestGameObjectFactory; +import net.sf.gridarta.gameobject.face.ArchFaceProvider; +import net.sf.gridarta.gameobject.face.DefaultFaceObjects; import net.sf.gridarta.gameobject.face.FaceObjectProviders; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gameobject.match.TypeNrsGameObjectMatcher; import net.sf.gridarta.gameobject.scripts.ScriptArchData; @@ -390,7 +394,7 @@ globalSettings = new TestGlobalSettings(); final MapViewSettings mapViewSettings = new MapViewSettings(); final MapWriter<TestGameObject, TestMapArchObject, TestArchetype> mapWriter = new TestMapWriter(); - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory = new TestRendererFactory(); @@ -509,4 +513,15 @@ } } + /** + * Creates a new {@link FaceObjectProviders} instance. + * @return the face object providers instance + */ + private static FaceObjectProviders newFaceObjectProviders() { + final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); + final FaceObjects faceObjects = new DefaultFaceObjects("test", "bmaps.paths", Pattern.compile("^.*\t\\.?(.*)"), "\\%1$05d\t./arch%2$s", archFaceProvider); + final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects); + return faceObjectProviders; + } + } // class ExitConnectorActionsTest Modified: trunk/src/test/net/sf/gridarta/gameobject/DefaultGameObjectTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gameobject/DefaultGameObjectTest.java 2009-11-17 20:43:20 UTC (rev 7233) +++ trunk/src/test/net/sf/gridarta/gameobject/DefaultGameObjectTest.java 2009-11-17 21:04:51 UTC (rev 7234) @@ -19,7 +19,11 @@ package net.sf.gridarta.gameobject; +import java.util.regex.Pattern; +import net.sf.gridarta.gameobject.face.ArchFaceProvider; +import net.sf.gridarta.gameobject.face.DefaultFaceObjects; import net.sf.gridarta.gameobject.face.FaceObjectProviders; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.map.maparchobject.TestMapArchObject; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -37,7 +41,7 @@ */ @Test public void testSetFaceName1() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", null, faceObjectProviders); Assert.assertNull(archetype.getFaceName()); archetype.setAttributeString("face", "archface"); @@ -81,7 +85,7 @@ */ @Test public void testSetFaceName2() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", "face archface", faceObjectProviders); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders); @@ -98,7 +102,7 @@ */ @Test public void testSetAttributeString() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", "key1 value1\nkey2 value2\n", faceObjectProviders); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = new TestGameObject(archetype, faceObjectProviders); @@ -172,7 +176,7 @@ */ @Test public void testDirection1() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", null, faceObjectProviders); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders); checkDirection(gameObject, 0); @@ -189,7 +193,7 @@ */ @Test public void testDirection2() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", "direction 2", faceObjectProviders); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders); checkDirection(gameObject, 2); @@ -204,7 +208,7 @@ */ @Test public void testDirection3() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype1 = newArchetype("arch", "direction 1", faceObjectProviders); final TestArchetype archetype2 = newArchetype("arch", "direction 2", faceObjectProviders); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype1, "test", faceObjectProviders); @@ -235,7 +239,7 @@ */ @Test public void testType1() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", null, faceObjectProviders); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders); checkType(gameObject, 0); @@ -252,7 +256,7 @@ */ @Test public void testType2() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", "type 2", faceObjectProviders); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype, "test", faceObjectProviders); checkType(gameObject, 2); @@ -267,7 +271,7 @@ */ @Test public void testType3() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype1 = newArchetype("arch", "type 1", faceObjectProviders); final TestArchetype archetype2 = newArchetype("arch", "type 2", faceObjectProviders); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = newGameObject(archetype1, "test", faceObjectProviders); @@ -298,7 +302,7 @@ */ @Test public void testName1() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", null, faceObjectProviders); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = new TestGameObject(archetype, faceObjectProviders); checkName(gameObject, "arch", ""); @@ -315,7 +319,7 @@ */ @Test public void testName2() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = newArchetype("arch", "name 2", faceObjectProviders); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = new TestGameObject(archetype, faceObjectProviders); checkName(gameObject, "2", "2"); @@ -330,7 +334,7 @@ */ @Test public void testName3() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype1 = newArchetype("arch", "name 1", faceObjectProviders); final TestArchetype archetype2 = newArchetype("arch", "name 2", faceObjectProviders); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = new TestGameObject(archetype1, faceObjectProviders); @@ -390,4 +394,15 @@ return gameObject; } + /** + * Creates a new {@link FaceObjectProviders} instance. + * @return the face object providers instance + */ + private static FaceObjectProviders newFaceObjectProviders() { + final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); + final FaceObjects faceObjects = new DefaultFaceObjects("test", "bmaps.paths", Pattern.compile("^.*\t\\.?(.*)"), "\\%1$05d\t./arch%2$s", archFaceProvider); + final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects); + return faceObjectProviders; + } + } // class DefaultGameObjectTest Modified: trunk/src/test/net/sf/gridarta/gameobject/match/NamedGameObjectMatcherTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/gameobject/match/NamedGameObjectMatcherTest.java 2009-11-17 20:43:20 UTC (rev 7233) +++ trunk/src/test/net/sf/gridarta/gameobject/match/NamedGameObjectMatcherTest.java 2009-11-17 21:04:51 UTC (rev 7234) @@ -1,11 +1,15 @@ package net.sf.gridarta.gameobject.match; +import java.util.regex.Pattern; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.TestArchetype; import net.sf.gridarta.gameobject.TestGameObject; import net.sf.gridarta.gameobject.TestGameObjectFactory; +import net.sf.gridarta.gameobject.face.ArchFaceProvider; +import net.sf.gridarta.gameobject.face.DefaultFaceObjects; import net.sf.gridarta.gameobject.face.FaceObjectProviders; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.scripts.ScriptArchData; import net.sf.gridarta.gameobject.scripts.TestScriptArchData; import net.sf.gridarta.map.maparchobject.TestMapArchObject; @@ -28,7 +32,7 @@ final GameObjectMatcher invGameObjectMatcher = new TypeNrsGameObjectMatcher(1); final GameObjectMatcher namedGameObjectMatcher = new NamedGameObjectMatcher(0, "namedGameObjectMatcher", "namedGameObjectMatcher", false, null, invGameObjectMatcher); final ScriptArchData<TestGameObject, TestMapArchObject, TestArchetype> scriptArchData = new TestScriptArchData(); - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(scriptArchData, faceObjectProviders); Assert.assertTrue(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, 1))); Assert.assertFalse(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, 2))); @@ -53,7 +57,7 @@ final GameObjectMatcher envGameObjectMatcher = new TypeNrsGameObjectMatcher(2); final GameObjectMatcher namedGameObjectMatcher = new NamedGameObjectMatcher(0, "namedGameObjectMatcher", "namedGameObjectMatcher", false, envGameObjectMatcher, invGameObjectMatcher); final ScriptArchData<TestGameObject, TestMapArchObject, TestArchetype> scriptArchData = new TestScriptArchData(); - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestGameObjectFactory gameObjectFactory = new TestGameObjectFactory(scriptArchData, faceObjectProviders); Assert.assertFalse(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, 1))); Assert.assertFalse(namedGameObjectMatcher.isMatching(newGameObjects(gameObjectFactory, faceObjectProviders, 2))); @@ -126,4 +130,15 @@ return gameObject; } + /** + * Creates a new {@link FaceObjectProviders} instance. + * @return the face object providers instance + */ + private static FaceObjectProviders newFaceObjectProviders() { + final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); + final FaceObjects faceObjects = new DefaultFaceObjects("test", "bmaps.paths", Pattern.compile("^.*\t\\.?(.*)"), "\\%1$05d\t./arch%2$s", archFaceProvider); + final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects); + return faceObjectProviders; + } + } Modified: trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java 2009-11-17 20:43:20 UTC (rev 7233) +++ trunk/src/test/net/sf/gridarta/map/mapmodel/DefaultMapModelTest.java 2009-11-17 21:04:51 UTC (rev 7234) @@ -25,6 +25,7 @@ import java.util.List; import java.util.Set; import java.util.TreeSet; +import java.util.regex.Pattern; import javax.swing.ImageIcon; import net.sf.gridarta.autojoin.AutojoinLists; import net.sf.gridarta.gameobject.Archetype; @@ -34,7 +35,10 @@ import net.sf.gridarta.gameobject.TestArchetype; import net.sf.gridarta.gameobject.TestGameObject; import net.sf.gridarta.gameobject.TestGameObjectFactory; +import net.sf.gridarta.gameobject.face.ArchFaceProvider; +import net.sf.gridarta.gameobject.face.DefaultFaceObjects; import net.sf.gridarta.gameobject.face.FaceObjectProviders; +import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.scripts.ScriptArchData; import net.sf.gridarta.gameobject.scripts.TestScriptArchData; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; @@ -288,7 +292,7 @@ */ @Test public void testGetAllGameObjects1() { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = new TestArchetype("arch", faceObjectProviders); archetype.setIsArchetype(); final TestArchetype archetype2 = new TestArchetype("arch2", faceObjectProviders); @@ -337,7 +341,7 @@ * @return the game object */ private static GameObject<TestGameObject, TestMapArchObject, TestArchetype> newGameObject(final String objectName) { - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final TestArchetype archetype = new TestArchetype("arch", faceObjectProviders); final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject = new TestGameObject(archetype, faceObjectProviders); gameObject.setAttributeString(Archetype.NAME, objectName); @@ -403,7 +407,7 @@ } final TestMapArchObject mapArchObject = new TestMapArchObject(); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); - final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(); + final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final MapViewSettings mapViewSettings = new MapViewSettings(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); final ScriptArchData<TestGameObject, TestMapArchObject, TestArchetype> scriptArchData = new TestScriptArchData(); @@ -415,4 +419,15 @@ Assert.assertEquals("", result.toString()); } + /** + * Creates a new {@link FaceObjectProviders} instance. + * @return the face object providers instance + */ + private static FaceObjectProviders newFaceObjectProviders() { + final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); + final FaceObjects faceObjects = new DefaultFaceObjects("test", "bmaps.paths", Pattern.compile("^.*\t\\.?(.*)"), "\\%1$05d\t./arch%2$s", archFaceProvider); + final FaceObjectProviders faceObjectProviders = new FaceObjectProviders(0, faceObjects); + return faceObjectProviders; + } + } // class DefaultMapModelTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-11-29 11:37:44
|
Revision: 7244 http://gridarta.svn.sourceforge.net/gridarta/?rev=7244&view=rev Author: akirschbaum Date: 2009-11-29 11:37:38 +0000 (Sun, 29 Nov 2009) Log Message: ----------- Add ArchetypeAttributeVisitor. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttribute.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeAnimName.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBitmask.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBool.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBoolSpec.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFaceName.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFixed.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFloat.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInt.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInvSpell.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeList.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeLong.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeMapPath.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeScriptFile.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeSpell.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeString.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeText.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeTreasure.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeZSpell.java trunk/src/test/net/sf/gridarta/archetypetype/ArchetypeTypeSetParserTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeVisitor.java Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttribute.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttribute.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttribute.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -195,4 +195,10 @@ return archetypeAttributeName + "[" + attributeName + "] section=" + sectionId + "/" + sectionName; } + /** + * Calls the <code>visit()</code> function appropriate for this instance. + * @param visitor the visitor to call + */ + public abstract void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor); + } // class ArchetypeAttribute Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeAnimName.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeAnimName.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeAnimName.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -94,4 +94,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeAnimName Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBitmask.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBitmask.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -108,4 +108,10 @@ } } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeBitmask Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBool.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBool.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBool.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -64,4 +64,10 @@ attributeRangeChecker.add(typeNo, getArchetypeAttributeName(), getAttributeName(), 0, 1); } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeBool Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBoolSpec.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBoolSpec.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBoolSpec.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -105,4 +105,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeBoolSpec Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFaceName.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFaceName.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFaceName.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -93,4 +93,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeFaceName Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFixed.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFixed.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFixed.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -60,4 +60,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeFixed Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFloat.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFloat.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFloat.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -80,4 +80,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeBoolSpec Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInt.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInt.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInt.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -123,4 +123,10 @@ attributeRangeChecker.add(typeNo, getArchetypeAttributeName(), getAttributeName(), minCheckValue, maxCheckValue); } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeInt Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInvSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInvSpell.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInvSpell.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -87,4 +87,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeInvSpell Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeList.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeList.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeList.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -106,4 +106,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeList Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeLong.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeLong.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeLong.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -78,4 +78,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeLong Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeMapPath.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeMapPath.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeMapPath.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -94,4 +94,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeMapPath Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeScriptFile.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeScriptFile.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeScriptFile.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -88,4 +88,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeScriptFile Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeSpell.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeSpell.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -87,4 +87,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeSpell Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeString.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeString.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeString.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -104,4 +104,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeString Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeText.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeText.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeText.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -98,4 +98,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeText Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeTreasure.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeTreasure.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeTreasure.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -82,4 +82,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeTreasure Added: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeVisitor.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeVisitor.java (rev 0) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeVisitor.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -0,0 +1,141 @@ +/* + * 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.archetypetype; + +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.maparchobject.MapArchObject; +import org.jetbrains.annotations.NotNull; + +/** + * Interface for visitors of {@link ArchetypeAttribute}s. + * @author Andreas Kirschbaum + */ +public interface ArchetypeAttributeVisitor<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeAnimName<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeBitmask<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeBool<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeBoolSpec<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeFaceName<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeFixed<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeFloat<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeInt<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeInvSpell<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeList<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeLong<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeMapPath<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeScriptFile<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeSpell<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeString<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeText<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeTreasure<G,A,R> archetypeAttribute); + + /** + * Visitor callback function. + * @param archetypeAttribute the visited node + */ + void visit(@NotNull ArchetypeAttributeZSpell<G,A,R> archetypeAttribute); + +} // interface ArchetypeAttributeVisitor Property changes on: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeVisitor.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeZSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeZSpell.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeZSpell.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -87,4 +87,10 @@ // XXX: missing } + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { + visitor.visit(this); + } + } // class ArchetypeAttributeZSpell Modified: trunk/src/test/net/sf/gridarta/archetypetype/ArchetypeTypeSetParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/archetypetype/ArchetypeTypeSetParserTest.java 2009-11-29 11:15:49 UTC (rev 7243) +++ trunk/src/test/net/sf/gridarta/archetypetype/ArchetypeTypeSetParserTest.java 2009-11-29 11:37:38 UTC (rev 7244) @@ -600,6 +600,12 @@ } /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeVisitor<TestGameObject, TestMapArchObject, TestArchetype> visitor) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ @NotNull @Override public GuiInfo<TestGameObject, TestMapArchObject, TestArchetype, ArchetypeAttribute<TestGameObject, TestMapArchObject, TestArchetype>> createGui(@NotNull final GameObject<TestGameObject, TestMapArchObject, TestArchetype> gameObject, @NotNull final Archetype<TestGameObject, TestMapArchObject, TestArchetype> archetype, @NotNull final ArchetypeType<TestGameObject, TestMapArchObject, TestArchetype> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<TestGameObject, TestMapArchObject, TestArchetype> treasureListTree) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-11-29 13:09:29
|
Revision: 7245 http://gridarta.svn.sourceforge.net/gridarta/?rev=7245&view=rev Author: akirschbaum Date: 2009-11-29 13:09:19 +0000 (Sun, 29 Nov 2009) Log Message: ----------- Remove GUI related code from ArchetypeAttributes; add it to GameObjectAttributesDialog. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/archetypetype/AbstractArchetypeAttributeInvSpell.java trunk/src/app/net/sf/gridarta/archetypetype/AbstractArchetypeAttributeList.java trunk/src/app/net/sf/gridarta/archetypetype/AbstractArchetypeAttributeSpell.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttribute.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeAnimName.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBitmask.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBool.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBoolSpec.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFaceName.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFixed.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFloat.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInt.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInvSpell.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeList.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeLong.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeMapPath.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeScriptFile.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeSpell.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeString.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeText.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeTreasure.java trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeZSpell.java trunk/src/app/net/sf/gridarta/archetypetype/DefaultArchetypeAttributeFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/test/net/sf/gridarta/archetypetype/ArchetypeTypeSetParserTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GuiInfo.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/archetypetype/GuiInfo.java Modified: trunk/src/app/net/sf/gridarta/archetypetype/AbstractArchetypeAttributeInvSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/AbstractArchetypeAttributeInvSpell.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/AbstractArchetypeAttributeInvSpell.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,17 +19,10 @@ package net.sf.gridarta.archetypetype; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JComboBox; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.StringKeyManager; import net.sf.gridarta.map.maparchobject.MapArchObject; -import net.sf.gridarta.spells.GameObjectSpell; -import net.sf.gridarta.spells.Spell; -import net.sf.gridarta.spells.Spells; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * Abstract base class for {@link ArchetypeAttribute}s for inventory spells. @@ -49,61 +42,4 @@ super(archetypeAttributeName, attributeName, description, inputLength, sectionName); } - /** - * Constructs the combobox of the available spells. - * @param gameObjectSpells the game object spells to use - * @param isOptionalSpell whether the entry <none> should be shown - * @param gameObject the associated game object - * @return the completed <code>JComboBox</code> - */ - @NotNull - protected JComboBox buildInvSpellBox(@NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull final GameObject<G, A, R> gameObject, final boolean isOptionalSpell) { - final int selectedIndex; - @Nullable final String title; - switch (gameObject.countInvObjects()) { - case 0: - selectedIndex = gameObjectSpells.size(); - title = isOptionalSpell ? null : "<none>"; - break; - - default: - selectedIndex = gameObjectSpells.size() + (isOptionalSpell ? 1 : 0); - title = "<multiple>"; - break; - - case 1: - final GameObject<G, A, R> invObject = gameObject.iterator().next(); - final String invObjectArchetypeName = invObject.getArchetype().getArchetypeName(); - int index = 0; - @Nullable String tmpTitle = "<customized spell>"; - for (final GameObjectSpell<G, A, R> spellObject : gameObjectSpells) { - if (invObjectArchetypeName.equals(spellObject.getArchetypeName())) { - tmpTitle = invObject.isDefaultGameObject() ? null : spellObject.getName() + " <customized>"; - break; - } - index++; - } - selectedIndex = tmpTitle != null ? gameObjectSpells.size() + (isOptionalSpell ? 1 : 0) : index; - title = tmpTitle; - break; - } - - final DefaultComboBoxModel model = new DefaultComboBoxModel(); - for (final Spell spell : gameObjectSpells) { - model.addElement(spell.getName()); - } - if (isOptionalSpell) { - model.addElement("<none>"); - } - if (title != null) { - model.addElement(title); - } - final JComboBox comboBox = new JComboBox(model); - comboBox.setSelectedIndex(selectedIndex); - comboBox.setMaximumRowCount(10); - comboBox.setKeySelectionManager(new StringKeyManager(comboBox)); - comboBox.setName(getAttributeName()); - return comboBox; - } - } // class AbstractArchetypeAttributeInvSpell Modified: trunk/src/app/net/sf/gridarta/archetypetype/AbstractArchetypeAttributeList.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/AbstractArchetypeAttributeList.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/AbstractArchetypeAttributeList.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,10 +19,8 @@ package net.sf.gridarta.archetypetype; -import javax.swing.JComboBox; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.StringKeyManager; import net.sf.gridarta.map.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; @@ -44,35 +42,4 @@ super(archetypeAttributeName, attributeName, description, inputLength, sectionName); } - /** - * Constructs the combobox for arrays of "list data". - * @param listData list with list items and corresponding values - * @param gameObject the associated game object - * @return the completed <code>JComboBox</code> - */ - @NotNull - protected JComboBox buildArrayBox(@NotNull final ArchetypeTypeList listData, @NotNull final GameObject<?, ?, ?> gameObject) { - // build the array of list-items - final String[] array = new String[listData.size()]; - boolean hasSelection = false; - int active = gameObject.getAttributeInt(getArchetypeAttributeName()); - for (int i = 0; i < array.length; i++) { - array[i] = listData.get(i).getSecond(); // put string to array - if (!hasSelection && listData.get(i).getFirst() == active) { - hasSelection = true; // the selection is valid - active = i; // set selection to this index in the array - } - } - // if there is no valid pre-selection, show first element of list - if (!hasSelection) { - active = 0; - } - final JComboBox arraysel = new JComboBox(array); // set "content" - arraysel.setSelectedIndex(active); // set active selection - arraysel.setMaximumRowCount(10); - arraysel.setKeySelectionManager(new StringKeyManager(arraysel)); - arraysel.setName(getAttributeName()); - return arraysel; - } - } // class AbstractArchetypeAttributeList Modified: trunk/src/app/net/sf/gridarta/archetypetype/AbstractArchetypeAttributeSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/AbstractArchetypeAttributeSpell.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/AbstractArchetypeAttributeSpell.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,14 +19,10 @@ package net.sf.gridarta.archetypetype; -import javax.swing.DefaultComboBoxModel; -import javax.swing.JComboBox; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.StringKeyManager; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.spells.NumberSpell; -import net.sf.gridarta.spells.Spell; import net.sf.gridarta.spells.Spells; import org.jetbrains.annotations.NotNull; @@ -49,51 +45,12 @@ } /** - * Constructs the combobox of the available spells. - * @param gameObject the associated game object - * @param numberSpells the number spells to use - * @param undefinedSpellIndex the index to use for the undefined spell - * @param isZSpell whther a zspell or a spell combobox is built - * @return the completed <code>JComboBox</code> - */ - @NotNull - protected JComboBox buildSpellBox(@NotNull final GameObject<?, ?, ?> gameObject, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex, final boolean isZSpell) { - // first parse the spell-number value from gameObject - int spnum = gameObject.getAttributeInt(getArchetypeAttributeName()); // spell number - - if (spnum < 0 || spnum >= numberSpells.size()) { - spnum = undefinedSpellIndex; - } - - // do we have "none" spell? - final int selectedIndex; - if (spnum == undefinedSpellIndex && isZSpell) { - selectedIndex = 0; - } else { - // now look up the spell-number in the array of spells - selectedIndex = 1 + findSpellIndex(numberSpells, spnum); - } - - final DefaultComboBoxModel model = new DefaultComboBoxModel(); - model.addElement("<none>"); - for (final Spell spell : numberSpells) { - model.addElement(spell.getName()); - } - final JComboBox comboBox = new JComboBox(model); - comboBox.setSelectedIndex(selectedIndex); - comboBox.setMaximumRowCount(10); - comboBox.setKeySelectionManager(new StringKeyManager(comboBox)); - comboBox.setName(getAttributeName()); - return comboBox; - } - - /** * Returns the spell index for a spell number. * @param numberSpells the number spells to use * @param number The spell number. * @return the spell index or <code>-1</code> if not found */ - private static int findSpellIndex(@NotNull final Spells<NumberSpell> numberSpells, final int number) { + public static int findSpellIndex(@NotNull final Spells<NumberSpell> numberSpells, final int number) { for (int i = 0; i < numberSpells.size(); i++) { if (numberSpells.getSpell(i).getNumber() == number) { return i; Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttribute.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttribute.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttribute.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,14 +19,11 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.map.validation.checks.InvalidCheckException; -import net.sf.gridarta.treasurelist.CFTreasureListTree; import org.jetbrains.annotations.NotNull; /** @@ -36,7 +33,7 @@ public abstract class ArchetypeAttribute<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements Cloneable { /** The width (columns) for input fields like textfields or JChooseBoxes. */ - protected static final int TEXTFIELD_COLUMNS = 18; + public static final int TEXTFIELD_COLUMNS = 18; /** * The archetype attribute name. @@ -163,24 +160,11 @@ * Returns the input length in characters for text input fields. * @return the input length */ - protected int getInputLength() { + public int getInputLength() { return inputLength; } /** - * Creates the GUI elements for this attribute. - * @param gameObject the associated game object - * @param archetype the game object's archetype - * @param type the archetype type - * @param background the background color - * @param parent the parent component - * @param treasureListTree the treasure list tree to display - * @return the GUI elements - */ - @NotNull - public abstract GuiInfo<G, A, R, ?> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree); - - /** * Adds attribute range checks for all defined attributes. * @param typeNo the game object type to match * @param attributeRangeChecker the attribute range checker to add to Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeAnimName.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeAnimName.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeAnimName.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,18 +19,10 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import javax.swing.JLabel; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gameobject.anim.AnimationObjects; -import net.sf.gridarta.gameobject.face.FaceObjectProviders; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribAnimName; -import net.sf.gridarta.gui.utils.AnimComponent; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.treasurelist.CFTreasureListTree; import org.jetbrains.annotations.NotNull; /** @@ -41,55 +33,20 @@ public class ArchetypeAttributeAnimName<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends ArchetypeAttribute<G, A, R> { /** - * The game object type for event objects. - */ - private final int typeNoEventConnector; - - /** - * The {@link AnimationObjects} instance for choosing animation names. - */ - @NotNull - private final AnimationObjects animationObjects; - - /** - * The {@link FaceObjectProviders} for looking up faces. - */ - @NotNull - private final FaceObjectProviders faceObjectProviders; - - /** * Creates a new instance. * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields * @param sectionName the section name for the new attribute - * @param typeNoEventConnector the game object type for event objects - * @param animationObjects the animation objects instance for choosing - * animation names - * @param faceObjectProviders the face object providers for looking up * faces */ - public ArchetypeAttributeAnimName(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, final int typeNoEventConnector, @NotNull final AnimationObjects animationObjects, @NotNull final FaceObjectProviders faceObjectProviders) { + public ArchetypeAttributeAnimName(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { super(archetypeAttributeName, attributeName, description, inputLength, sectionName); - this.typeNoEventConnector = typeNoEventConnector; - this.animationObjects = animationObjects; - this.faceObjectProviders = faceObjectProviders; } /** {@inheritDoc} */ - @NotNull @Override - public GuiInfo<G, A, R, ArchetypeAttributeAnimName<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final String atrributeName = getArchetypeAttributeName(); - final String defaultText = gameObject.getAttributeString(atrributeName); - final AnimComponent input = new AnimComponent(defaultText, animationObjects, faceObjectProviders); - final JLabel cLabel = new JLabel(getAttributeName() + ": "); - return new GuiInfo<G, A, R, ArchetypeAttributeAnimName<G, A, R>>(new DialogAttribAnimName<G, A, R>(this, input, typeNoEventConnector), cLabel, input, null, null, false); - } - - /** {@inheritDoc} */ - @Override public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { // XXX: missing } Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBitmask.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBitmask.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,22 +19,12 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import javax.swing.BorderFactory; -import javax.swing.JButton; -import javax.swing.JLabel; -import javax.swing.JTextArea; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribBitmask; -import net.sf.gridarta.gui.gameobjectattributesdialog.MaskChangeAL; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.map.validation.checks.InvalidCheckException; -import net.sf.gridarta.treasurelist.CFTreasureListTree; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * An {@link ArchetypeAttribute} for selecting bitmask values. @@ -72,35 +62,7 @@ } /** {@inheritDoc} */ - @NotNull @Override - public GuiInfo<G, A, R, ArchetypeAttributeBitmask<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final JTextArea input = new JTextArea(); - final DialogAttribBitmask<G, A, R> tmpAttr = new DialogAttribBitmask<G, A, R>(this, input); - @Nullable final JTextArea cComp; - @Nullable final JButton cLabel; - @Nullable final JLabel cRow; - final CAttribBitmask<G, A, R> bitmask = archetypeTypeSet.getBitmask(bitmaskName); - if (bitmask != null) { - tmpAttr.setBitmask(bitmask); - cLabel = new JButton(new MaskChangeAL<G, A, R>(getAttributeName() + ":", tmpAttr)); - input.setBackground(background); - input.setEditable(false); - input.setBorder(BorderFactory.createLineBorder(Color.gray)); - input.setText(bitmask.getText(tmpAttr.getValue())); - cComp = input; - tmpAttr.setEncodedValue(gameObject.getAttributeString(getArchetypeAttributeName())); - cRow = null; - } else { - cLabel = null; - cComp = null; - cRow = new JLabel("Error: Undefined Bitmask"); - } - return new GuiInfo<G, A, R, ArchetypeAttributeBitmask<G, A, R>>(tmpAttr, cLabel, cComp, cRow, null, false); - } - - /** {@inheritDoc} */ - @Override public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) throws InvalidCheckException { final CAttribBitmask<G, A, R> bitmask = archetypeTypeSet.getBitmask(bitmaskName); if (bitmask != null) { @@ -114,4 +76,13 @@ visitor.visit(this); } + /** + * Returns the bitmask name. + * @return + */ + @NotNull + public String getBitmaskName() { + return bitmaskName; + } + } // class ArchetypeAttributeBitmask Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBool.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBool.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBool.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,16 +19,11 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import javax.swing.JCheckBox; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribBool; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.map.validation.checks.InvalidCheckException; -import net.sf.gridarta.treasurelist.CFTreasureListTree; import org.jetbrains.annotations.NotNull; /** @@ -51,15 +46,7 @@ } /** {@inheritDoc} */ - @NotNull @Override - public GuiInfo<G, A, R, ArchetypeAttributeBool<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final JCheckBox input = new JCheckBox(getAttributeName(), gameObject.getAttributeInt(getArchetypeAttributeName()) == 1); - return new GuiInfo<G, A, R, ArchetypeAttributeBool<G, A, R>>(new DialogAttribBool<G, A, R>(this, input), null, null, input, null, false); - } - - /** {@inheritDoc} */ - @Override public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) throws InvalidCheckException { attributeRangeChecker.add(typeNo, getArchetypeAttributeName(), getAttributeName(), 0, 1); } Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBoolSpec.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBoolSpec.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeBoolSpec.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,15 +19,10 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import javax.swing.JCheckBox; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribBoolSpec; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.treasurelist.CFTreasureListTree; import org.jetbrains.annotations.NotNull; /** @@ -66,21 +61,6 @@ this.falseValue = falseValue; } - /** {@inheritDoc} */ - @NotNull - @Override - public GuiInfo<G, A, R, ArchetypeAttributeBoolSpec<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final CharSequence attrString = gameObject.getAttributeString(getArchetypeAttributeName()); - final boolean defaultValue; - if (trueValue.equals("0")) { - defaultValue = attrString.length() == 0 || attrString.equals("0"); - } else { - defaultValue = attrString.equals(trueValue); - } - final JCheckBox input = new JCheckBox(getAttributeName(), defaultValue); - return new GuiInfo<G, A, R, ArchetypeAttributeBoolSpec<G, A, R>>(new DialogAttribBoolSpec<G, A, R>(this, input), null, input, null, null, false); - } - /** * Returns the true value. * @return the true value Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFaceName.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFaceName.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFaceName.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,18 +19,10 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import javax.swing.JLabel; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gameobject.face.FaceObjectProviders; -import net.sf.gridarta.gameobject.face.FaceObjects; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribFaceName; -import net.sf.gridarta.gui.utils.FaceComponent; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.treasurelist.CFTreasureListTree; import org.jetbrains.annotations.NotNull; /** @@ -41,54 +33,19 @@ public class ArchetypeAttributeFaceName<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends ArchetypeAttribute<G, A, R> { /** - * The game object type for event objects. - */ - private final int typeNoEventConnector; - - /** - * The {@link FaceObjects} instance for choosing face names. - */ - @NotNull - private final FaceObjects faceObjects; - - /** - * The {@link FaceObjectProviders} for looking up faces. - */ - @NotNull - private final FaceObjectProviders faceObjectProviders; - - /** * Creates a new instance. * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields * @param sectionName the section name for the new attribute - * @param typeNoEventConnector the game object type for event objects - * @param faceObjects the face objects instance for choosing face names - * @param faceObjectProviders the face object providers for looking up - * faces */ - public ArchetypeAttributeFaceName(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, final int typeNoEventConnector, @NotNull final FaceObjects faceObjects, @NotNull final FaceObjectProviders faceObjectProviders) { + public ArchetypeAttributeFaceName(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { super(archetypeAttributeName, attributeName, description, inputLength, sectionName); - this.typeNoEventConnector = typeNoEventConnector; - this.faceObjects = faceObjects; - this.faceObjectProviders = faceObjectProviders; } /** {@inheritDoc} */ - @NotNull @Override - public GuiInfo<G, A, R, ArchetypeAttributeFaceName<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final String attributeName = getArchetypeAttributeName(); - final String defaultText = gameObject.getAttributeString(attributeName); - final FaceComponent input = new FaceComponent(defaultText, faceObjects, faceObjectProviders); - final JLabel cLabel = new JLabel(getAttributeName() + ":"); - return new GuiInfo<G, A, R, ArchetypeAttributeFaceName<G, A, R>>(new DialogAttribFaceName<G, A, R>(this, input, typeNoEventConnector), cLabel, input, null, null, false); - } - - /** {@inheritDoc} */ - @Override public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { // XXX: missing } Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFixed.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFixed.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFixed.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,13 +19,10 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.treasurelist.CFTreasureListTree; import org.jetbrains.annotations.NotNull; /** @@ -48,14 +45,7 @@ } /** {@inheritDoc} */ - @NotNull @Override - public GuiInfo<G, A, R, ArchetypeAttributeFixed<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - throw new AssertionError(); - } - - /** {@inheritDoc} */ - @Override public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { // XXX: missing } Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFloat.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFloat.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeFloat.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,20 +19,10 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import java.text.DecimalFormat; -import javax.swing.JFormattedTextField; -import javax.swing.JLabel; -import javax.swing.text.DefaultFormatterFactory; -import javax.swing.text.NumberFormatter; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribFloat; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.treasurelist.CFTreasureListTree; -import net.sf.gridarta.utils.CommonConstants; import org.jetbrains.annotations.NotNull; /** @@ -55,27 +45,7 @@ } /** {@inheritDoc} */ - @NotNull @Override - public GuiInfo<G, A, R, ArchetypeAttributeFloat<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final JLabel cLabel = new JLabel(getAttributeName() + ": "); - cLabel.setForeground(CommonConstants.FLOAT_COLOR); - final int fieldLength = getInputLength() == 0 ? TEXTFIELD_COLUMNS : getInputLength(); - final DecimalFormat format = new DecimalFormat("#0.0#"); - format.setMaximumFractionDigits(10); - format.setGroupingUsed(false); - final NumberFormatter formatter = new NumberFormatter(format); - formatter.setValueClass(Double.class); - final DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter); - // parse value from gameObject - final Number value = gameObject.getAttributeDouble(getArchetypeAttributeName()); - final JFormattedTextField input = new JFormattedTextField(factory, value); - input.setColumns(fieldLength); - return new GuiInfo<G, A, R, ArchetypeAttributeFloat<G, A, R>>(new DialogAttribFloat<G, A, R>(this, input), cLabel, input, null, null, false); - } - - /** {@inheritDoc} */ - @Override public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { // XXX: missing } Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInt.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInt.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInt.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,21 +19,11 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import java.text.NumberFormat; -import javax.swing.JFormattedTextField; -import javax.swing.JLabel; -import javax.swing.text.DefaultFormatterFactory; -import javax.swing.text.NumberFormatter; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribInt; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.map.validation.checks.InvalidCheckException; -import net.sf.gridarta.treasurelist.CFTreasureListTree; -import net.sf.gridarta.utils.CommonConstants; import org.jetbrains.annotations.NotNull; /** @@ -83,24 +73,6 @@ this.maxCheckValue = maxCheckValue; } - /** {@inheritDoc} */ - @NotNull - @Override - public GuiInfo<G, A, R, ArchetypeAttributeInt<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final JLabel cLabel = new JLabel(getAttributeName() + ": "); - cLabel.setForeground(CommonConstants.INT_COLOR); - final int fieldLength = getInputLength() == 0 ? TEXTFIELD_COLUMNS : getInputLength(); - final NumberFormat format = NumberFormat.getIntegerInstance(); - format.setGroupingUsed(false); - final NumberFormatter formatter = new NumberFormatter(format); - final DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter); - // parse value from gameObject - final Number value = gameObject.getAttributeInt(getArchetypeAttributeName()); - final JFormattedTextField input = new JFormattedTextField(factory, value); - input.setColumns(fieldLength); - return new GuiInfo<G, A, R, ArchetypeAttributeInt<G, A, R>>(new DialogAttribInt<G, A, R>(this, input), cLabel, input, null, null, false); - } - /** * Returns the minimum allowed value. * @return the minimum allowed value Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInvSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInvSpell.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeInvSpell.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,21 +19,11 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import javax.swing.JComboBox; -import javax.swing.JLabel; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribInvSpell; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.spells.GameObjectSpell; -import net.sf.gridarta.spells.Spells; -import net.sf.gridarta.treasurelist.CFTreasureListTree; -import net.sf.gridarta.utils.CommonConstants; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * An {@link ArchetypeAttribute} for selecting a spell encoded as an inventory @@ -49,12 +39,6 @@ private final boolean isOptionalSpell; /** - * The game object spells to use. - */ - @NotNull - private final Spells<GameObjectSpell<G, A, R>> gameObjectSpells; - - /** * Creates a new instance. * @param isOptionalSpell whether the spell game object is optional * @param archetypeAttributeName the archetype attribute name @@ -62,27 +46,14 @@ * @param description the attribute's description * @param inputLength the input length in characters for text input fields * @param sectionName the section name for the new attribute - * @param gameObjectSpells the game object spells to use */ - public ArchetypeAttributeInvSpell(final boolean isOptionalSpell, @NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final Spells<GameObjectSpell<G, A, R>> gameObjectSpells) { + public ArchetypeAttributeInvSpell(final boolean isOptionalSpell, @NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { super(archetypeAttributeName, attributeName, description, inputLength, sectionName); this.isOptionalSpell = isOptionalSpell; - this.gameObjectSpells = gameObjectSpells; } /** {@inheritDoc} */ - @NotNull @Override - public GuiInfo<G, A, R, ArchetypeAttributeInvSpell<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final JLabel cLabel = new JLabel(getAttributeName() + ": "); - cLabel.setForeground(CommonConstants.INT_COLOR); - // create ComboBox with parsed selection - @Nullable final JComboBox input = buildInvSpellBox(gameObjectSpells, gameObject, isOptionalSpell); - return new GuiInfo<G, A, R, ArchetypeAttributeInvSpell<G, A, R>>(new DialogAttribInvSpell<G, A, R>(isOptionalSpell, this, input, gameObjectSpells), cLabel, input, null, null, false); - } - - /** {@inheritDoc} */ - @Override public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { // XXX: missing } @@ -93,4 +64,12 @@ visitor.visit(this); } + /** + * Returns whether the spell game object is optional. + * @return whether the spell game object is optional + */ + public boolean isOptionalSpell() { + return isOptionalSpell; + } + } // class ArchetypeAttributeInvSpell Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeList.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeList.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeList.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,20 +19,11 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JLabel; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribList; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.treasurelist.CFTreasureListTree; -import net.sf.gridarta.utils.CommonConstants; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * An {@link ArchetypeAttribute} for selecting a value from a list. @@ -48,12 +39,6 @@ private final String listName; /** - * The {@link ArchetypeTypeSet} for looking up lists. - */ - @NotNull - private final ArchetypeTypeSet<G, A, R> archetypeTypeSet; - - /** * Creates a new instance. * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name @@ -61,36 +46,12 @@ * @param inputLength the input length in characters for text input fields * @param sectionName the section name for the new attribute * @param listName the list name - * @param archetypeTypeSet the archetype type set for looking up lists */ - public ArchetypeAttributeList(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String listName, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { + public ArchetypeAttributeList(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String listName) { super(archetypeAttributeName, attributeName, description, inputLength, sectionName); this.listName = listName; - this.archetypeTypeSet = archetypeTypeSet; } - /** {@inheritDoc} */ - @NotNull - @Override - public GuiInfo<G, A, R, ArchetypeAttributeList<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final JLabel cLabel = new JLabel(getAttributeName() + ": "); - cLabel.setForeground(CommonConstants.INT_COLOR); - // create ComboBox with parsed selection - final JComponent cComp; - @Nullable final JComboBox input; - final ArchetypeTypeList list = archetypeTypeSet.getList(listName); - if (list != null) { - // build the list from vector data - input = buildArrayBox(list, gameObject); - cComp = input; - } else { - // error: list data is missing or corrupt - input = null; - cComp = new JLabel("Error: Undefined List"); - } - return new GuiInfo<G, A, R, ArchetypeAttributeList<G, A, R>>(new DialogAttribList<G, A, R>(this, input, archetypeTypeSet), cLabel, cComp, null, null, false); - } - /** * Returns the list name. * @return the list name Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeLong.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeLong.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeLong.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,20 +19,10 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import java.text.NumberFormat; -import javax.swing.JFormattedTextField; -import javax.swing.JLabel; -import javax.swing.text.DefaultFormatterFactory; -import javax.swing.text.NumberFormatter; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribLong; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.treasurelist.CFTreasureListTree; -import net.sf.gridarta.utils.CommonConstants; import org.jetbrains.annotations.NotNull; /** @@ -55,25 +45,7 @@ } /** {@inheritDoc} */ - @NotNull @Override - public GuiInfo<G, A, R, ArchetypeAttributeLong<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final JLabel cLabel = new JLabel(getAttributeName() + ": "); - cLabel.setForeground(CommonConstants.INT_COLOR); - final int fieldLength = getInputLength() == 0 ? TEXTFIELD_COLUMNS : getInputLength(); - final NumberFormat format = NumberFormat.getIntegerInstance(); - format.setGroupingUsed(false); - final NumberFormatter formatter = new NumberFormatter(format); - final DefaultFormatterFactory factory = new DefaultFormatterFactory(formatter); - // parse value from gameObject - final Number value = gameObject.getAttributeLong(getArchetypeAttributeName()); - final JFormattedTextField input = new JFormattedTextField(factory, value); - input.setColumns(fieldLength); - return new GuiInfo<G, A, R, ArchetypeAttributeLong<G, A, R>>(new DialogAttribLong<G, A, R>(this, input), cLabel, input, null, null, false); - } - - /** {@inheritDoc} */ - @Override public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { // XXX: missing } Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeMapPath.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeMapPath.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeMapPath.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,21 +19,10 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import java.io.File; -import javax.swing.JLabel; -import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribMapPath; -import net.sf.gridarta.gui.map.maptilepane.TilePanel; -import net.sf.gridarta.gui.utils.DirectionLayout; import net.sf.gridarta.map.maparchobject.MapArchObject; -import net.sf.gridarta.map.mapmodel.MapSquare; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.settings.GlobalSettings; -import net.sf.gridarta.treasurelist.CFTreasureListTree; import org.jetbrains.annotations.NotNull; /** @@ -44,52 +33,19 @@ public class ArchetypeAttributeMapPath<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends ArchetypeAttribute<G, A, R> { /** - * The {@link GlobalSettings} instance. - */ - @NotNull - private final GlobalSettings globalSettings; - - /** - * The {@link FileFilter} to use. - */ - @NotNull - private final FileFilter mapFileFilter; - - /** * Creates a new instance. * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields * @param sectionName the section name for the new attribute - * @param globalSettings the global settings instance - * @param mapFileFilter the file filter to use */ - public ArchetypeAttributeMapPath(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final GlobalSettings globalSettings, @NotNull final FileFilter mapFileFilter) { + public ArchetypeAttributeMapPath(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { super(archetypeAttributeName, attributeName, description, inputLength, sectionName); - this.globalSettings = globalSettings; - this.mapFileFilter = mapFileFilter; } /** {@inheritDoc} */ - @NotNull @Override - public GuiInfo<G, A, R, ArchetypeAttributeMapPath<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final MapSquare<G, A, R> mapSquare = gameObject.getMapSquare(); - File relativeReference = mapSquare == null ? null : mapSquare.getMapModel().getMapFile(); - if (relativeReference == null) { - relativeReference = new File(globalSettings.getMapDir(), "dummy"); - } - final JLabel cLabel = new JLabel(getAttributeName() + ": "); - final TilePanel tilePanel = new TilePanel(mapFileFilter, DirectionLayout.Direction.N); - tilePanel.setAbsoluteReference(globalSettings.getMapDir()); - tilePanel.setOriginal(gameObject.getAttributeString(getArchetypeAttributeName())); - tilePanel.setRelativeReference(relativeReference); - return new GuiInfo<G, A, R, ArchetypeAttributeMapPath<G, A, R>>(new DialogAttribMapPath<G, A, R>(this, tilePanel), cLabel, tilePanel, null, null, false); - } - - /** {@inheritDoc} */ - @Override public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { // XXX: missing } Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeScriptFile.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeScriptFile.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeScriptFile.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,20 +19,10 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import java.io.File; -import javax.swing.JLabel; -import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribScriptFile; -import net.sf.gridarta.gui.map.maptilepane.TilePanel; -import net.sf.gridarta.gui.utils.DirectionLayout; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.settings.GlobalSettings; -import net.sf.gridarta.treasurelist.CFTreasureListTree; import org.jetbrains.annotations.NotNull; /** @@ -43,47 +33,19 @@ public class ArchetypeAttributeScriptFile<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends ArchetypeAttribute<G, A, R> { /** - * The {@link FileFilter} to use. - */ - @NotNull - private final FileFilter scriptFileFilter; - - /** - * The {@link GlobalSettings} instance. - */ - @NotNull - private final GlobalSettings globalSettings; - - /** * Creates a new instance. * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields * @param sectionName the section name for the new attribute - * @param scriptFileFilter the file filter to use - * @param globalSettings the global settings instance */ - public ArchetypeAttributeScriptFile(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final FileFilter scriptFileFilter, @NotNull final GlobalSettings globalSettings) { + public ArchetypeAttributeScriptFile(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { super(archetypeAttributeName, attributeName, description, inputLength, sectionName); - this.scriptFileFilter = scriptFileFilter; - this.globalSettings = globalSettings; } /** {@inheritDoc} */ - @NotNull @Override - public GuiInfo<G, A, R, ArchetypeAttributeScriptFile<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final JLabel cLabel = new JLabel(getAttributeName() + ": "); - final TilePanel tilePanel = new TilePanel(scriptFileFilter, DirectionLayout.Direction.N); - tilePanel.setAbsoluteReference(globalSettings.getMapDir()); - tilePanel.setOriginal(gameObject.getAttributeString(getArchetypeAttributeName())); - tilePanel.setRelativeReference(new File(globalSettings.getMapDir(), "dummy")); - return new GuiInfo<G, A, R, ArchetypeAttributeScriptFile<G, A, R>>(new DialogAttribScriptFile<G, A, R>(this, tilePanel), cLabel, tilePanel, null, null, false); - } - - /** {@inheritDoc} */ - @Override public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { // XXX: missing } Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeSpell.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeSpell.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,21 +19,11 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import javax.swing.JComboBox; -import javax.swing.JLabel; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttribSpell; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.spells.NumberSpell; -import net.sf.gridarta.spells.Spells; -import net.sf.gridarta.treasurelist.CFTreasureListTree; -import net.sf.gridarta.utils.CommonConstants; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; /** * An {@link ArchetypeAttribute} for selecting spells encoded as in integer @@ -44,45 +34,19 @@ public class ArchetypeAttributeSpell<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractArchetypeAttributeSpell<G, A, R> { /** - * The numbered spells. - */ - @NotNull - private final Spells<NumberSpell> numberSpells; - - /** - * The index for "no spell". - */ - private final int undefinedSpellIndex; - - /** * Creates a new instance. * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name * @param description the attribute's description * @param inputLength the input length in characters for text input fields * @param sectionName the section name for the new attribute - * @param numberSpells the numbered spells - * @param undefinedSpellIndex the index for "no spell" */ - public ArchetypeAttributeSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final Spells<NumberSpell> numberSpells, final int undefinedSpellIndex) { + public ArchetypeAttributeSpell(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName) { super(archetypeAttributeName, attributeName, description, inputLength, sectionName); - this.numberSpells = numberSpells; - this.undefinedSpellIndex = undefinedSpellIndex; } /** {@inheritDoc} */ - @NotNull @Override - public GuiInfo<G, A, R, ArchetypeAttributeSpell<G, A, R>> createGui(@NotNull final GameObject<G, A, R> gameObject, @NotNull final Archetype<G, A, R> archetype, @NotNull final ArchetypeType<G, A, R> type, @NotNull final Color background, @NotNull final Component parent, @NotNull final CFTreasureListTree<G, A, R> treasureListTree) { - final JLabel cLabel = new JLabel(getAttributeName() + ": "); - cLabel.setForeground(CommonConstants.INT_COLOR); - // create ComboBox with parsed selection - @Nullable final JComboBox input = buildSpellBox(gameObject, numberSpells, undefinedSpellIndex, false); - return new GuiInfo<G, A, R, ArchetypeAttributeSpell<G, A, R>>(new DialogAttribSpell<G, A, R>(this, input, numberSpells), cLabel, input, null, null, false); - } - - /** {@inheritDoc} */ - @Override public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { // XXX: missing } Modified: trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeString.java =================================================================== --- trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeString.java 2009-11-29 11:37:38 UTC (rev 7244) +++ trunk/src/app/net/sf/gridarta/archetypetype/ArchetypeAttributeString.java 2009-11-29 13:09:19 UTC (rev 7245) @@ -19,16 +19,10 @@ package net.sf.gridarta.archetypetype; -import java.awt.Color; -import java.awt.Component; -import javax.swing.JLabel; -import javax.swing.JTextField; import net.sf.gridarta.g... [truncated message content] |
From: <aki...@us...> - 2009-11-29 16:35:03
|
Revision: 7251 http://gridarta.svn.sourceforge.net/gridarta/?rev=7251&view=rev Author: akirschbaum Date: 2009-11-29 16:34:52 +0000 (Sun, 29 Nov 2009) Log Message: ----------- Remove dependency ExitConnectorActions -> gui package. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorController.java trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java Modified: trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java 2009-11-29 15:37:46 UTC (rev 7250) +++ trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorActions.java 2009-11-29 16:34:52 UTC (rev 7251) @@ -25,8 +25,6 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.map.cursor.MapCursor; -import net.sf.gridarta.gui.map.mapview.MapView; import net.sf.gridarta.io.PathManager; import net.sf.gridarta.map.maparchobject.MapArchObject; import net.sf.gridarta.map.mapcontrol.MapControl; @@ -101,28 +99,12 @@ /** * Executes the "exit copy" action. * @param performAction whether the action should be performed - * @param mapView the map view to copy from + * @param mapControl the map control to copy from + * @param location the cursor location * @return whether the action was or can be performed */ - public boolean doExitCopy(final boolean performAction, @Nullable final MapView<G, A, R> mapView) { - if (mapView == null) { - // no active map view ==> no location to remember - return false; - } - - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); - if (!mapCursor.isActive()) { - // no active cursor ==> no location to remember - return false; - } - - final Point location = mapCursor.getLocation(); - if (location == null) { - // no active cursor ==> no location to remember - return false; - } - - final MapModel<G, A, R> mapModel = mapView.getMapControl().getMapModel(); + public boolean doExitCopy(final boolean performAction, @NotNull final MapControl<G, A, R> mapControl, @NotNull final Point location) { + final MapModel<G, A, R> mapModel = mapControl.getMapModel(); final File mapFile = mapModel.getMapFile(); if (mapFile == null) { // unsaved maps do not have a map path ==> no location to remember @@ -140,30 +122,17 @@ /** * Executes the "exit paste" action. * @param performAction whether the action should be performed - * @param mapView the map view to paste into + * @param mapControl the map control to paste into + * @param targetLocation the target location to paste to * @return whether the action was or can be performed */ - public boolean doExitPaste(final boolean performAction, @Nullable final MapView<G, A, R> mapView) { - if (mapView == null) { - return false; - } - + public boolean doExitPaste(final boolean performAction, @NotNull final MapControl<G, A, R> mapControl, @NotNull final Point targetLocation) { final ExitLocation sourceExitLocation = exitConnectorModel.getExitLocation(); if (sourceExitLocation == null) { return false; } - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); - if (!mapCursor.isActive()) { - return false; - } - - final Point targetLocation = mapCursor.getLocation(); - if (targetLocation == null) { - return false; - } - - final MapModel<G, A, R> targetMapModel = mapView.getMapControl().getMapModel(); + final MapModel<G, A, R> targetMapModel = mapControl.getMapModel(); @Nullable final GameObject<G, A, R> targetExit; //XXX final G selectedExit = exitMatcher.getValidExit(selectedSquareModel.getSelectedGameObject()); //XXX if (selectedExit != null) { @@ -205,30 +174,17 @@ /** * Executes the "exit connect" action. * @param performAction whether the action should be performed - * @param mapView the map view to connect with + * @param mapControl the map control to connect with + * @param targetLocation the target location to connect * @return whether the action was or can be performed */ - public boolean doExitConnect(final boolean performAction, @Nullable final MapView<G, A, R> mapView) { - if (mapView == null) { - return false; - } - + public boolean doExitConnect(final boolean performAction, @NotNull final MapControl<G, A, R> mapControl, @NotNull final Point targetLocation) { final ExitLocation sourceExitLocation = exitConnectorModel.getExitLocation(); if (sourceExitLocation == null) { return false; } - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); - if (!mapCursor.isActive()) { - return false; - } - - final Point targetLocation = mapCursor.getLocation(); - if (targetLocation == null) { - return false; - } - - final MapModel<G, A, R> targetMapModel = mapView.getMapControl().getMapModel(); + final MapModel<G, A, R> targetMapModel = mapControl.getMapModel(); final File targetMapFile = targetMapModel.getMapFile(); if (targetMapFile == null) { // target map file is unsaved ==> no location to connect Modified: trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorController.java =================================================================== --- trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorController.java 2009-11-29 15:37:46 UTC (rev 7250) +++ trunk/src/app/net/sf/gridarta/exitconnector/ExitConnectorController.java 2009-11-29 16:34:52 UTC (rev 7251) @@ -19,9 +19,12 @@ package net.sf.gridarta.exitconnector; +import java.awt.Point; import javax.swing.Action; 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.cursor.MapCursor; import net.sf.gridarta.gui.map.cursor.MapCursorEvent; import net.sf.gridarta.gui.map.cursor.MapCursorListener; import net.sf.gridarta.gui.map.mapview.MapView; @@ -215,7 +218,26 @@ * @return whether the action was or can be performed */ private boolean doExitCopy(final boolean performAction) { - return exitConnectorActions.doExitCopy(performAction, currentMapView); + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + // no active map view ==> no location to remember + return false; + } + + final MapViewBasic<G, A, R> mapViewBasic = mapView.getMapViewBasic(); + final MapCursor mapCursor = mapViewBasic.getMapCursor(); + if (!mapCursor.isActive()) { + // no active cursor ==> no location to remember + return false; + } + + final Point location = mapCursor.getLocation(); + if (location == null) { + // no active cursor ==> no location to remember + return false; + } + + return exitConnectorActions.doExitCopy(performAction, mapView.getMapControl(), location); } /** @@ -224,7 +246,22 @@ * @return whether the action was or can be performed */ private boolean doExitPaste(final boolean performAction) { - return exitConnectorActions.doExitPaste(performAction, currentMapView); + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + if (!mapCursor.isActive()) { + return false; + } + + final Point targetLocation = mapCursor.getLocation(); + if (targetLocation == null) { + return false; + } + + return exitConnectorActions.doExitPaste(performAction, mapView.getMapControl(), targetLocation); } /** @@ -233,7 +270,22 @@ * @return whether the action was or can be performed */ private boolean doExitConnect(final boolean performAction) { - return exitConnectorActions.doExitConnect(performAction, currentMapView); + final MapView<G, A, R> mapView = currentMapView; + if (mapView == null) { + return false; + } + + final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); + if (!mapCursor.isActive()) { + return false; + } + + final Point targetLocation = mapCursor.getLocation(); + if (targetLocation == null) { + return false; + } + + return exitConnectorActions.doExitConnect(performAction, mapView.getMapControl(), targetLocation); } } // class ExitConnectorController Modified: trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2009-11-29 15:37:46 UTC (rev 7250) +++ trunk/src/test/net/sf/gridarta/exitconnector/ExitConnectorActionsTest.java 2009-11-29 16:34:52 UTC (rev 7251) @@ -44,12 +44,6 @@ import net.sf.gridarta.gameobject.scripts.ScriptArchData; import net.sf.gridarta.gameobject.scripts.TestScriptArchData; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.gui.map.cursor.MapCursor; -import net.sf.gridarta.gui.map.mapview.MapView; -import net.sf.gridarta.gui.map.mapview.MapViewFactory; -import net.sf.gridarta.gui.map.mapview.TestMapViewFactory; -import net.sf.gridarta.gui.map.renderer.RendererFactory; -import net.sf.gridarta.gui.map.renderer.TestRendererFactory; import net.sf.gridarta.io.MapReaderFactory; import net.sf.gridarta.io.MapWriter; import net.sf.gridarta.io.PathManager; @@ -149,82 +143,68 @@ private GlobalSettings globalSettings; /** - * The {@link MapViewFactory} instance. + * Checks that {@link ExitConnectorActions#doExitCopy(boolean, MapControl, + * Point)} does work. */ - private MapViewFactory<TestGameObject, TestMapArchObject, TestArchetype> mapViewFactory; - - /** - * Checks that {@link ExitConnectorActions#doExitCopy(boolean, MapView)} - * does work. - */ @Test public void testExitCopy1() { final ExitConnectorModel model = new ExitConnectorModel(); final ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype> actions = createActions(model); final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl = newMapControl(MAP_FILE1, MAP_NAME1, new Size2D(5, 5)); - final MapView<TestGameObject, TestMapArchObject, TestArchetype> mapView = mapControl.createView(null, mapViewFactory); - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); - // inactive map cursor ==> disabled - Assert.assertFalse(actions.doExitCopy(false, mapView)); - // active ==> enabled final Point point1 = new Point(3, 4); - mapCursor.setLocation(point1); - Assert.assertTrue(actions.doExitCopy(false, mapView)); + Assert.assertTrue(actions.doExitCopy(false, mapControl, point1)); Assert.assertNull(model.getExitLocation()); // perform copy - Assert.assertTrue(actions.doExitCopy(true, mapView)); + Assert.assertTrue(actions.doExitCopy(true, mapControl, point1)); Assert.assertEquals(new ExitLocation(MAP_FILE1, point1, MAP_NAME1, pathManager), model.getExitLocation()); // unsaved map ==> disabled mapControl.getMapModel().setMapFile(null, MAP_NAME2); - Assert.assertFalse(actions.doExitCopy(false, mapView)); + Assert.assertFalse(actions.doExitCopy(false, mapControl, point1)); Assert.assertEquals(new ExitLocation(MAP_FILE1, point1, MAP_NAME1, pathManager), model.getExitLocation()); // disabled -> unchanged model } /** - * Checks that {@link ExitConnectorActions#doExitPaste(boolean, MapView)} - * does work. + * Checks that {@link ExitConnectorActions#doExitPaste(boolean, MapControl, + * Point)} does work. */ @Test public void testExitPaste1() { final ExitConnectorModel model = new ExitConnectorModel(); final ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype> actions = createActions(model); final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl = newMapControl(MAP_FILE1, MAP_NAME1, new Size2D(5, 5)); - final MapView<TestGameObject, TestMapArchObject, TestArchetype> mapView = mapControl.createView(null, mapViewFactory); - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapControl.getMapModel(); final Point point1 = new Point(3, 4); final Point point2 = new Point(1, 2); - mapCursor.setLocation(point1); model.setExitLocation(new ExitLocation(MAP_FILE2, point2, MAP_NAME2, pathManager)); // no exit at cursor and no auto-create ==> disabled - Assert.assertFalse(actions.doExitPaste(false, mapView)); + Assert.assertFalse(actions.doExitPaste(false, mapControl, point1)); insertFloor(mapModel, point1); // no exit at cursor and no auto-create ==> disabled - Assert.assertFalse(actions.doExitPaste(false, mapView)); + Assert.assertFalse(actions.doExitPaste(false, mapControl, point1)); insertExit(mapModel, point1); // exit at cursor ==> enabled - Assert.assertTrue(actions.doExitPaste(false, mapView)); + Assert.assertTrue(actions.doExitPaste(false, mapControl, point1)); checkExit(mapModel, point1, 1, "", new Point(0, 0)); // "check only" ==> exit is unchanged // perform paste - Assert.assertTrue(actions.doExitPaste(true, mapView)); + Assert.assertTrue(actions.doExitPaste(true, mapControl, point1)); checkExit(mapModel, point1, 1, "b", point2); } /** - * Checks that {@link ExitConnectorActions#doExitConnect(boolean, MapView)} - * does work. + * Checks that {@link ExitConnectorActions#doExitConnect(boolean, + * MapControl, Point)} does work. */ @Test public void testExitConnect1() { @@ -232,8 +212,6 @@ final ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype> actions = createActions(model); final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl1 = newMapControl(MAP_FILE1, MAP_NAME1, new Size2D(5, 5)); - final MapView<TestGameObject, TestMapArchObject, TestArchetype> mapView1 = mapControl1.createView(null, mapViewFactory); - final MapCursor mapCursor1 = mapView1.getMapViewBasic().getMapCursor(); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel1 = mapControl1.getMapModel(); final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl2 = newMapControl(MAP_FILE2, MAP_NAME2, new Size2D(5, 5)); @@ -242,38 +220,37 @@ final Point point1 = new Point(3, 4); final Point point2 = new Point(1, 2); - mapCursor1.setLocation(point1); model.setExitLocation(new ExitLocation(MAP_FILE2, point2, MAP_NAME2, pathManager)); // no exit at cursor and no auto-create ==> disabled - Assert.assertFalse(actions.doExitConnect(false, mapView1)); + Assert.assertFalse(actions.doExitConnect(false, mapControl1, point1)); insertFloor(mapModel1, point1); // no exit at cursor and no auto-create ==> disabled - Assert.assertFalse(actions.doExitConnect(false, mapView1)); + Assert.assertFalse(actions.doExitConnect(false, mapControl1, point1)); insertExit(mapModel1, point1); // no exit at source and no auto-create ==> disabled - Assert.assertFalse(actions.doExitConnect(false, mapView1)); + Assert.assertFalse(actions.doExitConnect(false, mapControl1, point1)); insertExit(mapModel2, point2); // exit at source and cursor ==> enabled - Assert.assertTrue(actions.doExitConnect(false, mapView1)); + Assert.assertTrue(actions.doExitConnect(false, mapControl1, point1)); checkExit(mapModel1, point1, 1, "", new Point(0, 0)); // "check only" ==> exit is unchanged checkExit(mapModel2, point2, 0, "", new Point(0, 0)); // perform connect - Assert.assertTrue(actions.doExitConnect(true, mapView1)); + Assert.assertTrue(actions.doExitConnect(true, mapControl1, point1)); checkExit(mapModel1, point1, 1, "b", point2); checkExit(mapModel2, point2, 0, "a", point1); } /** - * Checks that {@link ExitConnectorActions#doExitConnect(boolean, MapView)} - * does work when auto-creating exit objects. + * Checks that {@link ExitConnectorActions#doExitConnect(boolean, + * MapControl, Point)} does work when auto-creating exit objects. */ @Test public void testExitConnectAuto1() { @@ -281,8 +258,6 @@ final ExitConnectorActions<TestGameObject, TestMapArchObject, TestArchetype> actions = createActions(model); final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl1 = newMapControl(MAP_FILE1, MAP_NAME1, new Size2D(5, 5)); - final MapView<TestGameObject, TestMapArchObject, TestArchetype> mapView1 = mapControl1.createView(null, mapViewFactory); - final MapCursor mapCursor1 = mapView1.getMapViewBasic().getMapCursor(); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel1 = mapControl1.getMapModel(); final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl2 = newMapControl(MAP_FILE2, MAP_NAME2, new Size2D(5, 5)); @@ -291,24 +266,23 @@ final Point point1 = new Point(3, 4); final Point point2 = new Point(1, 2); - mapCursor1.setLocation(point1); model.setExitLocation(new ExitLocation(MAP_FILE2, point2, MAP_NAME2, pathManager)); model.setAutoCreateExit(true); // fails due to undefined archetype - Assert.assertFalse(actions.doExitConnect(true, mapView1)); + Assert.assertFalse(actions.doExitConnect(true, mapControl1, point1)); checkExit(mapModel1, point1, 0, null, null); checkExit(mapModel2, point2, 0, null, null); model.setExitArchetypeName("exit"); // perform connect - Assert.assertTrue(actions.doExitConnect(true, mapView1)); + Assert.assertTrue(actions.doExitConnect(true, mapControl1, point1)); checkExit(mapModel1, point1, 0, "b", point2); checkExit(mapModel2, point2, 0, "a", point1); // perform connect; auto-create will re-use existing objects - Assert.assertTrue(actions.doExitConnect(true, mapView1)); + Assert.assertTrue(actions.doExitConnect(true, mapControl1, point1)); checkExit(mapModel1, point1, 0, "b", point2); checkExit(mapModel1, point1, 1, null, null); checkExit(mapModel2, point2, 0, "a", point1); @@ -355,19 +329,16 @@ final File mapFileTo = new File(mapDir, mapPathTo); final MapControl<TestGameObject, TestMapArchObject, TestArchetype> mapControl = newMapControl(mapFileFrom, MAP_NAME1, new Size2D(5, 5)); - final MapView<TestGameObject, TestMapArchObject, TestArchetype> mapView = mapControl.createView(null, mapViewFactory); - final MapCursor mapCursor = mapView.getMapViewBasic().getMapCursor(); final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel = mapControl.getMapModel(); final Point pointFrom = new Point(3, 4); final Point pointTo = new Point(1, 2); - mapCursor.setLocation(pointFrom); model.setExitLocation(new ExitLocation(mapFileTo, pointTo, MAP_NAME2, pathManager)); insertExit(mapModel, pointFrom); // perform connect - Assert.assertTrue(actions.doExitPaste(true, mapView)); + Assert.assertTrue(actions.doExitPaste(true, mapControl, pointFrom)); checkExit(mapModel, pointFrom, 0, expectedExitPath, pointTo); } @@ -397,9 +368,7 @@ final FaceObjectProviders faceObjectProviders = newFaceObjectProviders(); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(mapViewSettings); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype>(); - final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory = new TestRendererFactory(); pathManager = new PathManager(globalSettings); - mapViewFactory = new TestMapViewFactory(rendererFactory, pathManager); final ScriptArchData<TestGameObject, TestMapArchObject, TestArchetype> scriptArchData = new TestScriptArchData(); final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory = new TestGameObjectFactory(scriptArchData, faceObjectProviders); final MapControlFactory<TestGameObject, TestMapArchObject, TestArchetype> mapControlFactory = new TestMapControlFactory(mapWriter, autojoinLists, archetypeChooserModel, gameObjectFactory); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-11-30 21:27:53
|
Revision: 7282 http://gridarta.svn.sourceforge.net/gridarta/?rev=7282&view=rev Author: akirschbaum Date: 2009-11-30 21:27:35 +0000 (Mon, 30 Nov 2009) Log Message: ----------- Move Filter and related classes into model package. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java trunk/src/app/net/sf/gridarta/gui/filter/FilterComponent.java trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java trunk/src/app/net/sf/gridarta/gui/filter/package-info.java trunk/src/app/net/sf/gridarta/gui/script/ScriptController.java trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java trunk/src/app/net/sf/gridarta/model/script/parameter/FilterParameter.java trunk/src/app/net/sf/gridarta/model/script/parameter/PluginParameterFactory.java trunk/src/test/net/sf/gridarta/gui/filter/TestFilterControl.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/filter/ trunk/src/app/net/sf/gridarta/model/filter/BasicFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/ConfigEvent.java trunk/src/app/net/sf/gridarta/model/filter/ConfigEventType.java trunk/src/app/net/sf/gridarta/model/filter/ConfigListener.java trunk/src/app/net/sf/gridarta/model/filter/Filter.java trunk/src/app/net/sf/gridarta/model/filter/FilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterConfig.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEvent.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterEventType.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterList.java trunk/src/app/net/sf/gridarta/model/filter/NamedFilterListener.java trunk/src/app/net/sf/gridarta/model/filter/NamedGameObjectMatcherFilter.java trunk/src/app/net/sf/gridarta/model/filter/SimpleFilterConfig.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/filter/BasicFilterConfig.java trunk/src/app/net/sf/gridarta/gui/filter/ConfigEvent.java trunk/src/app/net/sf/gridarta/gui/filter/ConfigEventType.java trunk/src/app/net/sf/gridarta/gui/filter/ConfigListener.java trunk/src/app/net/sf/gridarta/gui/filter/Filter.java trunk/src/app/net/sf/gridarta/gui/filter/FilterConfig.java trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterConfig.java trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterEvent.java trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterEventType.java trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterList.java trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterListener.java trunk/src/app/net/sf/gridarta/gui/filter/NamedGameObjectMatcherFilter.java trunk/src/app/net/sf/gridarta/gui/filter/SimpleFilterConfig.java Deleted: trunk/src/app/net/sf/gridarta/gui/filter/BasicFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/BasicFilterConfig.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/BasicFilterConfig.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,84 +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.filter; - -import net.sf.gridarta.utils.EventListenerList2; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; - -/** - * Abstract base class for filter configurations. - * @author tchize - */ -@SuppressWarnings({ "AbstractClassWithoutAbstractMethods" }) -public abstract class BasicFilterConfig implements FilterConfig { - - /** The Logger for printing log messages. */ - private static final Category log = Logger.getLogger(BasicFilterConfig.class); - - /** Whether the filter is enabled. */ - private boolean enabled = false; - - /** The registered listeners. */ - private final EventListenerList2<ConfigListener> listenerList = new EventListenerList2<ConfigListener>(ConfigListener.class); - - /** {@inheritDoc} */ - @Override - public void setEnabled(final boolean enabled) { - if (this.enabled == enabled) { - return; - } - this.enabled = enabled; - - if (log.isDebugEnabled()) { - log.debug((enabled ? "enabling" : "disabling") + " filter " + this); - } - fireEvent(new ConfigEvent(enabled ? ConfigEventType.ENABLE : ConfigEventType.DISABLE, this)); - } - - /** {@inheritDoc} */ - @Override - public boolean isEnabled() { - return enabled; - } - - /** - * Notify all listeners that a {@link ConfigEvent} has happened. - * @param event The config event. - */ - protected void fireEvent(final ConfigEvent event) { - for (final ConfigListener listener : listenerList.getListeners()) { - listener.configChanged(event); - } - } - - /** {@inheritDoc} */ - @Override - public void addConfigChangeListener(final ConfigListener listener) { - listenerList.add(listener); - } - - /** {@inheritDoc} */ - @Override - public void removeConfigChangeListener(final ConfigListener listener) { - listenerList.remove(listener); - } - -} // class BasicFilterConfig Deleted: trunk/src/app/net/sf/gridarta/gui/filter/ConfigEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/ConfigEvent.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/ConfigEvent.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,54 +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.filter; - -import java.util.EventObject; - -/** - * Event that's fired in case of changes to the configuration. - * @author tchize - */ -public class ConfigEvent extends EventObject { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1L; - - private final ConfigEventType type; - - private final FilterConfig config; - - public ConfigEvent(final ConfigEventType type, final FilterConfig config) { - // XXX: Is config really the appropriate source? - super(config); - this.type = type; - this.config = config; - } - - public FilterConfig getConfig() { - return config; - } - - public ConfigEventType getType() { - return type; - } - -} // class ConfigEvent Deleted: trunk/src/app/net/sf/gridarta/gui/filter/ConfigEventType.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/ConfigEventType.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/ConfigEventType.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,34 +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.filter; - -/** - * Enumeration of Configuration event types. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public enum ConfigEventType { - - ENABLE, - - DISABLE, - - CHANGE - -} // enum ConfigEventType Deleted: trunk/src/app/net/sf/gridarta/gui/filter/ConfigListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/ConfigListener.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/ConfigListener.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,32 +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.filter; - -import java.util.EventListener; - -/** - * Listener for ConfigEvents. - * @author tchize - */ -public interface ConfigListener extends EventListener { - - void configChanged(ConfigEvent event); - -} // interface ConfigListener Modified: trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/DefaultFilterControl.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -22,6 +22,12 @@ import javax.swing.JMenu; import javax.swing.JMenuItem; import net.sf.gridarta.mapmanager.MapManager; +import net.sf.gridarta.model.filter.ConfigEvent; +import net.sf.gridarta.model.filter.ConfigListener; +import net.sf.gridarta.model.filter.Filter; +import net.sf.gridarta.model.filter.FilterConfig; +import net.sf.gridarta.model.filter.NamedFilterConfig; +import net.sf.gridarta.model.filter.NamedFilterList; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; Deleted: trunk/src/app/net/sf/gridarta/gui/filter/Filter.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/Filter.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/Filter.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,107 +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.filter; - -import javax.swing.JMenuItem; -import net.sf.gridarta.model.gameobject.GameObject; -import org.jdom.Element; -import org.jetbrains.annotations.NotNull; - -/** - * Interface for Filters. - * <p/> - * <p> Interface used to filter and analyze maps. Basically a filter gets an - * {@link GameObject} and tells if it got a match. It also gets reset when the - * map square is changed, So more complex behavior can be achieved. - * @author tchize - */ -public interface Filter { - - /** - * Tells whether we got a match on specific {@link GameObject}. The analysis - * tool will call this function with every game object on a given map - * square. The match function is responsible for analyzing inventories if it - * needs to. Unless {@link #hasGlobalMatch(FilterConfig)} returns - * <code>true</code>, when a match occurred, this function is not called - * with the remaining game objects on the map square and a reset is issued. - * @param config The filter configuration to use. - * @param gameObject The game object being analyzed on the map. - * @return <code>true</code> if it match the criteria, <code>false</code> - * otherwise. This value is ignored if <code>hasGlobalMatch()</code> - * returns <code>true</code>. - */ - boolean match(@NotNull FilterConfig config, @NotNull GameObject<?, ?, ?> gameObject); - - /** - * This tells the filter we have finished with current map square and, - * perhaps, we are jumping on next one. If {@link #hasGlobalMatch(FilterConfig)} - * returns <code>true</code>, the returning value is used to know if we had - * a match. - * @param config The filter configuration to use. - * @return <code>true</code> if we had a global match on map square. - * <code>false</code> if we had a global mismatch or the filter does - * not use global match. - */ - boolean reset(@NotNull FilterConfig config); - - /** - * Tells if all the game objects on a square are to be analyzed before a - * match result. If all game objects must be analyzed to decide the result - * of a match, the return value of {@link #match(FilterConfig,GameObject)} - * is ignored and the returning value of {@link #reset(FilterConfig)} is - * used as replacement. This should mainly used by complex analyze filters. - * @param config The filter configuration to use. - * @return <code>true</code> if match can be decided only when all game - * objects on a map square are analyzed. <code>false</code> - * otherwise. - */ - boolean hasGlobalMatch(@NotNull FilterConfig config); - - /** - * Create a new {@link FilterConfig} instance for this filter. - * @return The new filter config instance. - */ - @NotNull - FilterConfig createConfig(); - - /** - * Create a menu item for this filter. - * @param config The filter config to use. - * @return The menu item. - */ - @NotNull - JMenuItem createMenuEntry(@NotNull FilterConfig config); - - /** - * Export the filter configuration settings. - * @param config The filter configuration to export. - * @return The exported settings. - */ - @NotNull - Element toXML(@NotNull FilterConfig config); - - /** - * Import the filter configuration settings. - * @param e The settings to import. - * @param config The filter configuration to modify. - */ - void fromXML(@NotNull Element e, @NotNull FilterConfig config); - -} // interface Filter Modified: trunk/src/app/net/sf/gridarta/gui/filter/FilterComponent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/FilterComponent.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/FilterComponent.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -29,6 +29,9 @@ import javax.swing.JSeparator; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; +import net.sf.gridarta.model.filter.Filter; +import net.sf.gridarta.model.filter.FilterConfig; +import net.sf.gridarta.model.filter.NamedFilterConfig; public class FilterComponent { Deleted: trunk/src/app/net/sf/gridarta/gui/filter/FilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/FilterConfig.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/FilterConfig.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,52 +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.filter; - -/** - * Interface for filter configurations. - * @author tchize - */ -public interface FilterConfig { - - /** - * Enable or disable the filter. - * @param enabled Whether the filter should be enabled. - */ - void setEnabled(boolean enabled); - - /** - * Return whether the filter is enabled. - * @return Whether the filter is enabled. - */ - boolean isEnabled(); - - /** - * Add a {@link ConfigListener} to be notified about changes. - * @param listener The config listener to add. - */ - void addConfigChangeListener(ConfigListener listener); - - /** - * Remove a {@link ConfigListener} to be notified about changes. - * @param listener The config listener to remove. - */ - void removeConfigChangeListener(ConfigListener listener); - -} // interface FilterConfig Modified: trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/FilterControl.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -20,6 +20,7 @@ package net.sf.gridarta.gui.filter; import javax.swing.JMenu; +import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; Deleted: trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterConfig.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterConfig.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,139 +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.filter; - -import java.util.HashMap; -import java.util.Map; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; - -/** - * Filter configuration that has a name. - * @author tchize - */ -public class NamedFilterConfig extends BasicFilterConfig { - - // TODO fix potential concurrency issues - private boolean inverted = false; - - private final Map<String, FilterConfig> map = new HashMap<String, FilterConfig>(); - - /** The Logger for printing log messages. */ - private static final Category log = Logger.getLogger(NamedFilterConfig.class); - - private final ConfigListener configListener = new ConfigListener() { - - /** {@inheritDoc} */ - @Override - public void configChanged(final ConfigEvent event) { - // XXX What's with newe? - // Not used, so why is it created? - // This also has no side effect, so is this code wrong and fireEvent(newe) should be invoked instead of fireEvent(event)? - // If so, why is the argument ignored in the new event construction? - final ConfigEvent newe = new ConfigEvent(ConfigEventType.CHANGE, NamedFilterConfig.this); - fireEvent(event); - } - - }; - - private final NamedFilterListener namedFilterListener = new NamedFilterListener() { - - /** {@inheritDoc} */ - @Override - public void nameFilterChanged(final NamedFilterEvent event) { - if (event.getType() == NamedFilterEventType.REMOVE) { - final FilterConfig myCfg = map.get(event.getFilterName()); - if (myCfg != null) { - myCfg.removeConfigChangeListener(configListener); - } - if (log.isDebugEnabled()) { - log.debug(this + " removing config for " + event.getFilterName(), new Exception()); - } - map.remove(event.getFilterName()); - } - - if (event.getType() == NamedFilterEventType.ADD) { - final FilterConfig myCfg = event.getFilter().createConfig(); - myCfg.addConfigChangeListener(configListener); - if (log.isDebugEnabled()) { - log.debug(this + " adding config for " + event.getFilterName(), new Exception()); - } - map.put(event.getFilterName(), myCfg); - } - final ConfigEvent e = new ConfigEvent(ConfigEventType.CHANGE, NamedFilterConfig.this); - fireEvent(e); - } - - }; - - public NamedFilterConfig(final NamedFilterList owner) { - owner.resetConfig(this); - owner.addFilterListener(namedFilterListener); - } - - public boolean isInverted() { - return inverted; - } - - public void setInverted(final boolean inverted) { - if (this.inverted == inverted) { - return; - } - this.inverted = inverted; - fireEvent(new ConfigEvent(ConfigEventType.CHANGE, this)); - } - - public FilterConfig getConfig(final String name) { - return map.get(name); - } - - public boolean isSubFilterEnabled(final String name) { - final FilterConfig f = getConfig(name); - if (log.isDebugEnabled()) { - log.debug(this + " isSubFilterEnabled(" + name + ") config is " + f); - } - return f != null && f.isEnabled(); - } - - public void setSubFilterEnabled(final String name, final Filter filter, final boolean enabled) { - if (log.isDebugEnabled()) { - log.debug("setSubFilterEnabled(" + name + ", " + filter + ", " + enabled); - } - - FilterConfig config = getConfig(name); - if (config == null) { - if (log.isDebugEnabled()) { - log.debug(this + "Creating a new config for " + name); - } - - config = filter.createConfig(); - if (log.isDebugEnabled()) { - log.debug(this + "config id " + config); - } - - map.put(name, config); - config.addConfigChangeListener(configListener); - } - config.setEnabled(enabled); - final ConfigEvent e = new ConfigEvent(ConfigEventType.CHANGE, this); - fireEvent(e); - } - -} // class NamedFilterConfig Deleted: trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterEvent.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterEvent.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterEvent.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,67 +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.filter; - -import java.util.EventObject; - -/** - * Event object that's fired on named filters. - * @author tchize - */ -public class NamedFilterEvent extends EventObject { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1; - - private final NamedFilterEventType type; - - private final NamedFilterList owner; - - private final String filterName; - - private final Filter filter; - - public NamedFilterEvent(final NamedFilterEventType type, final NamedFilterList owner, final String filterName, final Filter filter) { - super(owner); // XXX verify that event source is correct - this.type = type; - this.owner = owner; - this.filterName = filterName; - this.filter = filter; - } - - public Filter getFilter() { - return filter; - } - - public String getFilterName() { - return filterName; - } - - public NamedFilterList getOwner() { - return owner; - } - - public NamedFilterEventType getType() { - return type; - } - -} // class NamedFilterEvent Deleted: trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterEventType.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterEventType.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterEventType.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,32 +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.filter; - -/** - * Enumeration of event types of {@link NamedFilterEvent}s. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public enum NamedFilterEventType { - - ADD, - - REMOVE - -} // enum NamedFilterEventType Deleted: trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterList.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterList.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterList.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,323 +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.filter; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Map; -import javax.swing.JComponent; -import javax.swing.JMenu; -import javax.swing.JMenuItem; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.match.NamedGameObjectMatcher; -import net.sf.gridarta.utils.EventListenerList2; -import org.apache.log4j.Category; -import org.apache.log4j.Logger; -import org.jdom.Content; -import org.jdom.Element; -import org.jetbrains.annotations.NotNull; - -/** - * Filter that aggregates named filters. - * <p/> - * This filter aggregates a list of named filters. Each sub-filter can be - * (dis)enabled. The names of filters are hard-coded for now. They may need to - * be loaded from, e.g., an XML file later. - * @author tchize - */ -public class NamedFilterList implements Filter { - - /** The Logger for printing log messages. */ - @NotNull - private static final Category log = Logger.getLogger(NamedFilterList.class); - - @NotNull - private final Map<String, Filter> subFilters; - - @NotNull - private final EventListenerList2<NamedFilterListener> listenerList = new EventListenerList2<NamedFilterListener>(NamedFilterListener.class); - - /** - * Create a new NameFilterList. - * @param matchers the matchers to use - */ - public NamedFilterList(@NotNull final Iterable<NamedGameObjectMatcher> matchers) { - subFilters = new LinkedHashMap<String, Filter>(); - for (final NamedGameObjectMatcher matcher : matchers) { // FIXME: use localized name; FIXME: sort by name - subFilters.put(matcher.getName(), new NamedGameObjectMatcherFilter(matcher)); - } - } - - public void resetConfig(@NotNull final NamedFilterConfig config) { - for (final Map.Entry<String, Filter> entry : subFilters.entrySet()) { - config.setSubFilterEnabled(entry.getKey(), entry.getValue(), false); - } - } - - /** {@inheritDoc} */ - @Override - public boolean match(@NotNull final FilterConfig config, @NotNull final GameObject<?, ?, ?> gameObject) { - try { - if (log.isDebugEnabled()) { - log.debug("match called on " + gameObject.getArchetypeName()); - } - final NamedFilterConfig namedFilterConfig = (NamedFilterConfig) config; - for (final String name : subFilters.keySet()) { - if (log.isDebugEnabled()) { - log.debug("checking if filter " + name + " is enabled()"); - } - if (namedFilterConfig.isSubFilterEnabled(name)) { - log.debug("enabled!"); - final Filter filter = subFilters.get(name); - if (filter.match(namedFilterConfig.getConfig(name), gameObject)) { - log.debug("and matched!"); - return !namedFilterConfig.isInverted(); - } - } - } - log.debug("finished scanning sub filters"); - return namedFilterConfig.isInverted(); - } catch (final Exception e) { - return false; - } - } - - /** {@inheritDoc} */ - @Override - public boolean reset(@NotNull final FilterConfig config) { - try { - boolean didMatch = false; - for (final Map.Entry<String, Filter> entry : subFilters.entrySet()) { - final String name = entry.getKey(); - final Filter filter = entry.getValue(); - final FilterConfig filterConfig = ((NamedFilterConfig) config).getConfig(name); - if (filterConfig != null && filter.reset(filterConfig)) { - didMatch = true; - } - } - return didMatch ^ ((NamedFilterConfig) config).isInverted(); - } catch (final Exception e) { - return false; - } - } - - /** {@inheritDoc} */ - @Override - public boolean hasGlobalMatch(@NotNull final FilterConfig config) { - return false; - } - - @NotNull - public String[] getFilters() { - return subFilters.keySet().toArray(new String[subFilters.keySet().size()]); - } - - public static boolean isFilterEnabled(@NotNull final NamedFilterConfig config, @NotNull final String name) { - return config.isSubFilterEnabled(name); - } - - public void setFilterEnabled(@NotNull final NamedFilterConfig config, @NotNull final String name, final boolean enabled) { - final Filter filter = subFilters.get(name); - if (filter != null) { - config.setSubFilterEnabled(name, filter, enabled); - } - } - - /** {@inheritDoc} */ - @NotNull - @Override - public FilterConfig createConfig() { - return new NamedFilterConfig(this); - } - - public void addFilter(@NotNull final String name, @NotNull final Filter filter) { - if (subFilters.containsKey(name)) { - return; - } - - subFilters.put(name, filter); - fireEvent(new NamedFilterEvent(NamedFilterEventType.ADD, this, name, filter)); - } - - public void removeFilter(@NotNull final String name) { - if (!subFilters.containsKey(name)) { - return; - } - - final Filter filter = subFilters.get(name); - subFilters.remove(name); - fireEvent(new NamedFilterEvent(NamedFilterEventType.REMOVE, this, name, filter)); - } - - public Filter getFilter(@NotNull final String name) { - return subFilters.get(name); - } - - private void fireEvent(@NotNull final NamedFilterEvent event) { - for (final NamedFilterListener listener : listenerList.getListeners()) { - listener.nameFilterChanged(event); - } - } - - public void addFilterListener(@NotNull final NamedFilterListener listener) { - listenerList.add(listener); - } - - public void removeFilterListener(@NotNull final NamedFilterListener listener) { - listenerList.remove(listener); - } - - /** {@inheritDoc} */ - @NotNull - @Override - public JMenuItem createMenuEntry(@NotNull final FilterConfig config) { - return new FilterMenuEntry((NamedFilterConfig) config); - } - - /** {@inheritDoc} */ - @Override - public void fromXML(@NotNull final Element e, @NotNull final FilterConfig config) { - resetConfig((NamedFilterConfig) config); - if (e == null) { - return; - } - - final Element value = e.getChild("value"); - if (value == null) { - return; - } - - final NamedFilterConfig fConfig = (NamedFilterConfig) config; - final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); - fConfig.setEnabled(enabled); - fConfig.setInverted(Boolean.valueOf(value.getChildTextTrim("inverted"))); - final Iterable<Element> l = value.getChildren("subfilter"); - for (final Element fElement : l) { - final String name = fElement.getChildTextTrim("name"); - final FilterConfig cfg = ((NamedFilterConfig) config).getConfig(name); - final Filter f = subFilters.get(name); - if (f != null && cfg != null) { - f.fromXML(fElement, cfg); - } - } - - } - - /** {@inheritDoc} */ - @NotNull - @Override - public Element toXML(@NotNull final FilterConfig config) { - final Element result = new Element("value"); - final NamedFilterConfig namedFilterConfig = (NamedFilterConfig) config; - final Element enabled = new Element("enabled"); - enabled.addContent(Boolean.toString(namedFilterConfig.isEnabled())); - result.addContent(enabled); - final Element inverted = new Element("inverted"); - inverted.addContent(Boolean.toString(namedFilterConfig.isInverted())); - result.addContent(inverted); - for (final Map.Entry<String, Filter> entry : subFilters.entrySet()) { - final Content filterValue = entry.getValue().toXML(namedFilterConfig.getConfig(entry.getKey())); - final Element subfilter = new Element("subfilter"); - final Element fName = new Element("name"); - fName.addContent(entry.getKey()); - subfilter.addContent(fName); - subfilter.addContent(filterValue); - result.addContent(subfilter); - } - return result; - } - - public boolean canShow(@NotNull final GameObject<?, ?, ?> gameObject, @NotNull final FilterConfig filterOutConfig) { - reset(filterOutConfig); - if (hasGlobalMatch(filterOutConfig)) { - match(filterOutConfig, gameObject); - return !reset(filterOutConfig); - } - - return !match(filterOutConfig, gameObject); - } - - private class FilterMenuEntry extends JMenu implements NamedFilterListener { - - /** The serial version UID. */ - private static final long serialVersionUID = 1; - - @NotNull - private final NamedFilterConfig config; - - @NotNull - private final Collection<FilterComponent> components = new ArrayList<FilterComponent>(); - - FilterMenuEntry(@NotNull final NamedFilterConfig config) { - super(""); - this.config = config; - addFilterListener(this); - populateComponent(this); - } - - private void populateComponent(@NotNull final JComponent component) { - final FilterComponent filterComponent = new FilterComponent(component, config); - for (final Map.Entry<String, Filter> entry : subFilters.entrySet()) { - final String name = entry.getKey(); - final Filter filter = entry.getValue(); - filterComponent.addFilter(name, filter, config.getConfig(name)); - } - components.add(filterComponent); - } - - @NotNull - public JComponent getMenuBarComponent() { - final JComponent menu = new JMenu(getName()); - populateComponent(menu); - return menu; - } - - @NotNull - public JComponent getMenuItemComponent() { - final JComponent menu = new JMenu(getName()); - populateComponent(menu); - return menu; - } - - @NotNull - public JComponent getToolbarComponent() { - return new BtnPopup((JMenu) getMenuItemComponent(), getName()).getButton(); - } - - /** {@inheritDoc} */ - @Override - public void nameFilterChanged(@NotNull final NamedFilterEvent event) { - if (event.getType() == NamedFilterEventType.ADD) { - for (final FilterComponent filterComponent : components) { - log.debug("set sub filter enabled(), calling on " + event.getFilterName()); - config.setSubFilterEnabled(event.getFilterName(), event.getFilter(), false); - filterComponent.addFilter(event.getFilterName(), event.getFilter(), config.getConfig(event.getFilterName())); - } - } else if (event.getType() == NamedFilterEventType.REMOVE) { - for (final FilterComponent filterComponent : components) { - filterComponent.removeFilter(event.getFilterName()); - } - } - } - - } // class FilterMenuEntry - -} // class NamedFilterList Deleted: trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterListener.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterListener.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/NamedFilterListener.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,32 +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.filter; - -import java.util.EventListener; - -/** - * Listener for events on named filters. - * @author tchize - */ -public interface NamedFilterListener extends EventListener { - - void nameFilterChanged(NamedFilterEvent event); - -} // class NamedFilterListener Deleted: trunk/src/app/net/sf/gridarta/gui/filter/NamedGameObjectMatcherFilter.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/NamedGameObjectMatcherFilter.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/NamedGameObjectMatcherFilter.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,126 +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.filter; - -import javax.swing.JCheckBoxMenuItem; -import javax.swing.JMenuItem; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.match.GameObjectMatcher; -import net.sf.japi.swing.action.ActionBuilder; -import net.sf.japi.swing.action.ActionBuilderFactory; -import org.jdom.Element; -import org.jetbrains.annotations.NotNull; - -/** - * Implements a {@link Filter} which filters according to a {@link - * net.sf.gridarta.model.match.NamedGameObjectMatcher}. - * @author Andreas Kirschbaum - */ -public class NamedGameObjectMatcherFilter implements Filter { - - /** Action Builder to create Actions. */ - @NotNull - private static final ActionBuilder ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder("net.sf.gridarta"); - - /** The game object matcher to use. */ - @NotNull - private final GameObjectMatcher matcher; - - /** - * Create a new instance. - * @param matcher the game object matcher to use - */ - public NamedGameObjectMatcherFilter(@NotNull final GameObjectMatcher matcher) { - this.matcher = matcher; - } - - /** {@inheritDoc} */ - @Override - public boolean match(@NotNull final FilterConfig config, @NotNull final GameObject<?, ?, ?> gameObject) { - return matcher.isMatching(gameObject); - } - - /** {@inheritDoc} */ - @Override - public boolean reset(@NotNull final FilterConfig config) { - return false; - } - - /** {@inheritDoc} */ - @Override - public boolean hasGlobalMatch(@NotNull final FilterConfig config) { - return false; - } - - /** {@inheritDoc} */ - @NotNull - @Override - public FilterConfig createConfig() { - return new SimpleFilterConfig(); - } - - /** {@inheritDoc} */ - @NotNull - @Override - public JMenuItem createMenuEntry(@NotNull final FilterConfig config) { - return new JCheckBoxMenuItem(ACTION_BUILDER.createToggle(true, "enabled", config)); - } - - /** {@inheritDoc} */ - @NotNull - @Override - public Element toXML(@NotNull final FilterConfig config) { - final Element value = new Element("value"); - final SimpleFilterConfig sConfig = (SimpleFilterConfig) config; - final Element enabled = new Element("enabled"); - enabled.addContent(Boolean.toString(sConfig.isEnabled())); - value.addContent(enabled); - for (final String key : sConfig.getProperties()) { - final Element property = new Element("property"); - property.addContent(sConfig.getProperty(key)); - value.addContent(property); - } - return value; - } - - /** {@inheritDoc} */ - @Override - public void fromXML(@NotNull final Element e, @NotNull final FilterConfig config) { - if (e == null) { - return; - } - - final Element value = e.getChild("value"); - if (value == null) { - return; - } - - final SimpleFilterConfig sConfig = (SimpleFilterConfig) config; - final boolean enabled = Boolean.valueOf(value.getChildTextTrim("enabled")); - sConfig.setEnabled(enabled); - final Iterable<Element> properties = value.getChildren("property"); - for (final Element property : properties) { - final String pName = property.getChildTextTrim("name"); - final String pValue = property.getChildTextTrim("value"); - sConfig.setProperty(pName, pValue); - } - } - -} // class NamedGameObjectMatcherFilter Deleted: trunk/src/app/net/sf/gridarta/gui/filter/SimpleFilterConfig.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/SimpleFilterConfig.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/SimpleFilterConfig.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -1,52 +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.filter; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - -/** - * Simple filter configuration. - * @author tchize - */ -public class SimpleFilterConfig extends BasicFilterConfig { - - private final Map<String, String> properties = new HashMap<String, String>(); - - public void setProperty(final String name, final String value) { - final String oldValue = properties.get(name); - if (oldValue == null ? value == null : oldValue.equals(value)) { - return; - } - - properties.put(name, value); - fireEvent(new ConfigEvent(ConfigEventType.CHANGE, this)); - } - - public String getProperty(final String name) { - return properties.get(name); - } - - public Iterable<String> getProperties() { - return Collections.unmodifiableSet(properties.keySet()); - } - -} // class SimpleFilterConfig Modified: trunk/src/app/net/sf/gridarta/gui/filter/package-info.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/filter/package-info.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/filter/package-info.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -19,7 +19,9 @@ /** * The filter package contains the classes for {@link - * net.sf.gridarta.gui.filter.Filter}s. + * Filter}s. */ package net.sf.gridarta.gui.filter; + +import net.sf.gridarta.model.filter.Filter; Modified: trunk/src/app/net/sf/gridarta/gui/script/ScriptController.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/ScriptController.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/script/ScriptController.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -29,9 +29,9 @@ import javax.swing.Action; import javax.swing.JFileChooser; import javax.swing.JOptionPane; -import net.sf.gridarta.gui.filter.Filter; import net.sf.gridarta.gui.filter.FilterControl; import net.sf.gridarta.gui.script.parameter.PluginParameterViewFactory; +import net.sf.gridarta.model.filter.Filter; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -317,7 +317,7 @@ } catch (final EvalError e) { log.warn("Evaluation error on (filter)" + script.getName(), e); } catch (final ClassCastException e) { - log.warn("Script did not return a net.sf.gridarta.gui.filter.Filter object" + script.getName(), e); + log.warn("Script did not return a net.sf.gridarta.model.filter.Filter object" + script.getName(), e); } return null; } Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -21,8 +21,8 @@ import javax.swing.JComponent; import javax.swing.JPanel; -import net.sf.gridarta.gui.filter.Filter; -import net.sf.gridarta.gui.filter.FilterConfig; +import net.sf.gridarta.model.filter.Filter; +import net.sf.gridarta.model.filter.FilterConfig; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; Modified: trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/PluginParameterViewFactory.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -19,11 +19,11 @@ package net.sf.gridarta.gui.script.parameter; -import net.sf.gridarta.gui.filter.NamedFilterList; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.face.FaceObjectProviders; +import net.sf.gridarta.model.filter.NamedFilterList; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.ArchetypeSet; import net.sf.gridarta.model.gameobject.GameObject; Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -31,7 +31,6 @@ import net.sf.gridarta.gui.anim.DefaultAnimationObjects; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; -import net.sf.gridarta.gui.filter.NamedFilterList; import net.sf.gridarta.gui.io.FileFilters; import net.sf.gridarta.gui.scripts.ScriptArchData; import net.sf.gridarta.gui.scripts.ScriptArchEditor; @@ -56,6 +55,7 @@ import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.filter.NamedFilterList; import net.sf.gridarta.model.gameobject.AbstractArchetypeParser; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.ArchetypeFactory; Modified: trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/maincontrol/GUIMainControl.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -49,7 +49,6 @@ import net.sf.gridarta.gui.exitconnector.ExitConnectorController; import net.sf.gridarta.gui.filter.DefaultFilterControl; import net.sf.gridarta.gui.filter.FilterControl; -import net.sf.gridarta.gui.filter.NamedFilterList; import net.sf.gridarta.gui.findarchetypes.FindArchetypesDialogManager; import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesControl; @@ -114,6 +113,7 @@ import net.sf.gridarta.model.exitconnector.ExitMatcher; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.filter.NamedFilterList; import net.sf.gridarta.model.gameobject.AnimationValidator; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.ArchetypeSet; Modified: trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2009-11-30 21:05:42 UTC (rev 7281) +++ trunk/src/app/net/sf/gridarta/maincontrol/ImageCreatorFactory.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -5,7 +5,6 @@ import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.filter.DefaultFilterControl; import net.sf.gridarta.gui.filter.FilterControl; -import net.sf.gridarta.gui.filter.NamedFilterList; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.gui.misc.ImageCreator; import net.sf.gridarta.mapmanager.DefaultMapManager; @@ -14,6 +13,7 @@ import net.sf.gridarta.model.face.ArchFaceProvider; import net.sf.gridarta.model.face.FaceObjectProviders; import net.sf.gridarta.model.face.FaceObjects; +import net.sf.gridarta.model.filter.NamedFilterList; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.ArchetypeFactory; import net.sf.gridarta.model.gameobject.ArchetypeSet; Copied: trunk/src/app/net/sf/gridarta/model/filter/BasicFilterConfig.java (from rev 7278, trunk/src/app/net/sf/gridarta/gui/filter/BasicFilterConfig.java) =================================================================== --- trunk/src/app/net/sf/gridarta/model/filter/BasicFilterConfig.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/filter/BasicFilterConfig.java 2009-11-30 21:27:35 UTC (rev 7282) @@ -0,0 +1,84 @@ +/* + * 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.model.filter; + +import net.sf.gridarta.utils.EventListenerList2; +import org.apache.log4j.Category; +import org.apache.log4j.Logger; + +/** + * Abstract base class for filter configurations. + * @author tchize + */ +@SuppressWarnings({ "AbstractClassWithoutAbstractMethods" }) +public abstract class BasicFilterConfig implements FilterConfig { + + /** The Logger for printing log messages. */ + private static final Category log = Logger.getLogger(BasicFilterConfig.class); + + /** Whether the filter is enabled. */ + private boolean enabled = false; + + /** The registered listeners. */ + private final EventListenerList2<ConfigListener> listenerList = new EventListenerList2<ConfigListener>(ConfigListener.class); + + /** {@inheritDoc} */ + @Override + public void setEnabled(final boolean enabled) { + if (this.enabled == enabled) { + ... [truncated message content] |
From: <aki...@us...> - 2009-12-01 21:55:30
|
Revision: 7292 http://gridarta.svn.sourceforge.net/gridarta/?rev=7292&view=rev Author: akirschbaum Date: 2009-12-01 21:55:19 +0000 (Tue, 01 Dec 2009) Log Message: ----------- Remove ArchetypeAttribute.addChecks(). Modified Paths: -------------- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeAnimName.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBitmask.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBool.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBoolSpec.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFaceName.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFixed.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFloat.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInt.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInvSpell.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeLong.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeMapPath.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeScriptFile.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeSpell.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeString.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeText.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeTreasure.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeZSpell.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java trunk/src/app/net/sf/gridarta/model/archetypetype/DefaultArchetypeAttributeFactory.java trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -363,7 +363,7 @@ treasureTree = TreasureLoader.parseTreasures(errorView, specialTreasureLists, editorFactory.getTreasureLocations(globalSettings)); gameObjectSpells = new Spells<GameObjectSpell<G, A, R>>(); numberSpells = new Spells<NumberSpell>(); - final ArchetypeAttributeFactory<G, A, R> archetypeAttributeFactory = new DefaultArchetypeAttributeFactory<G, A, R>(archetypeTypeSet); + final ArchetypeAttributeFactory<G, A, R> archetypeAttributeFactory = new DefaultArchetypeAttributeFactory<G, A, R>(); final ArchetypeAttributeParser<G, A, R> archetypeAttributeParser = new ArchetypeAttributeParser<G, A, R>(archetypeAttributeFactory); final ArchetypeTypeParser<G, A, R> archetypeTypeParser = new ArchetypeTypeParser<G, A, R>(archetypeAttributeParser); final ArchetypeTypeSetParser<G, A, R> archetypeTypeSetParser = new ArchetypeTypeSetParser<G, A, R>(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath(), archetypeTypeSet, archetypeTypeParser); Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttribute.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,8 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.gui.map.validation.checks.InvalidCheckException; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -164,14 +162,6 @@ return inputLength; } - /** - * Adds attribute range checks for all defined attributes. - * @param typeNo the game object type to match - * @param attributeRangeChecker the attribute range checker to add to - * @throws InvalidCheckException if the check cannot be added - */ - public abstract void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) throws InvalidCheckException; - /** {@inheritDoc} */ @NotNull @Override Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeAnimName.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeAnimName.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeAnimName.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -47,12 +46,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBitmask.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBitmask.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,8 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.gui.map.validation.checks.InvalidCheckException; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -40,12 +38,6 @@ private final String bitmaskName; /** - * The {@link ArchetypeTypeSet} for looking up bitmasks. - */ - @NotNull - private final ArchetypeTypeSet<G, A, R> archetypeTypeSet; - - /** * Creates a new instance. * @param archetypeAttributeName the archetype attribute name * @param attributeName the user interface attribute name @@ -53,25 +45,14 @@ * @param inputLength the input length in characters for text input fields * @param sectionName the section name for the new attribute * @param bitmaskName the bitmask name - * @param archetypeTypeSet the archetype type set for looking up bitmasks */ - public ArchetypeAttributeBitmask(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String bitmaskName, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { + public ArchetypeAttributeBitmask(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String bitmaskName) { super(archetypeAttributeName, attributeName, description, inputLength, sectionName); this.bitmaskName = bitmaskName; - this.archetypeTypeSet = archetypeTypeSet; } /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) throws InvalidCheckException { - final CAttribBitmask<G, A, R> bitmask = archetypeTypeSet.getBitmask(bitmaskName); - if (bitmask != null) { - attributeRangeChecker.add(typeNo, getArchetypeAttributeName(), getAttributeName(), 0, bitmask.getMaxValue()); - } - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBool.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBool.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBool.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,8 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.gui.map.validation.checks.InvalidCheckException; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -47,12 +45,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) throws InvalidCheckException { - attributeRangeChecker.add(typeNo, getArchetypeAttributeName(), getAttributeName(), 0, 1); - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBoolSpec.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBoolSpec.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeBoolSpec.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -81,12 +80,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFaceName.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFaceName.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFaceName.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -46,12 +45,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFixed.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFixed.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFixed.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -46,12 +45,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFloat.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFloat.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeFloat.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -46,12 +45,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInt.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInt.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInt.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,8 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.gui.map.validation.checks.InvalidCheckException; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -91,14 +89,24 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) throws InvalidCheckException { - attributeRangeChecker.add(typeNo, getArchetypeAttributeName(), getAttributeName(), minCheckValue, maxCheckValue); - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } + /** + * Returns the logical minimum allowed value. + * @return the logical minimum allowed value + */ + public int getMinCheckValue() { + return minCheckValue; + } + + /** + * Returns the logical maximum allowed value. + * @return the logical maximum allowed value + */ + public int getMaxCheckValue() { + return maxCheckValue; + } + } // class ArchetypeAttributeInt Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInvSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInvSpell.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeInvSpell.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -54,12 +53,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeList.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -63,12 +62,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeLong.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeLong.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeLong.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -46,12 +45,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeMapPath.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeMapPath.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeMapPath.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -46,12 +45,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeScriptFile.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeScriptFile.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeScriptFile.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -46,12 +45,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeSpell.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeSpell.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -47,12 +46,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeString.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeString.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeString.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -46,12 +45,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeText.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeText.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeText.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -62,12 +61,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeTreasure.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeTreasure.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeTreasure.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -46,12 +45,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeZSpell.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeZSpell.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeZSpell.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.archetypetype; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; import net.sf.gridarta.model.gameobject.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; @@ -47,12 +46,6 @@ /** {@inheritDoc} */ @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { - // XXX: missing - } - - /** {@inheritDoc} */ - @Override public void visit(@NotNull final ArchetypeAttributeVisitor<G, A, R> visitor) { visitor.visit(this); } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeType.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -203,18 +203,142 @@ /** * Adds attribute range checks for all defined attributes. * @param attributeRangeChecker the attribute range checker to add to + * @param archetypeTypeSet the archetype type set to use */ - public void addChecks(@NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { + public void addChecks(@NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { if (!typeAttributes.isEmpty()) { return; // XXX: make such attributes work } + final ArchetypeAttributeVisitor<G, A, R> archetypeAttributeVisitor = new ArchetypeAttributeVisitor<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeAnimName<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeBitmask<G, A, R> archetypeAttribute) { + final CAttribBitmask<G, A, R> bitmask = archetypeTypeSet.getBitmask(archetypeAttribute.getBitmaskName()); + if (bitmask != null) { + try { + attributeRangeChecker.add(typeNo, archetypeAttribute.getArchetypeAttributeName(), archetypeAttribute.getAttributeName(), 0, bitmask.getMaxValue()); + } catch (final InvalidCheckException ex) { + log.warn(ex.getMessage() + " in type " + typeNo + "."); + } + } + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeBool<G, A, R> archetypeAttribute) { + try { + attributeRangeChecker.add(typeNo, archetypeAttribute.getArchetypeAttributeName(), archetypeAttribute.getAttributeName(), 0, 1); + } catch (final InvalidCheckException ex) { + log.warn(ex.getMessage() + " in type " + typeNo + "."); + } + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeBoolSpec<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeFaceName<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeFixed<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeFloat<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeInt<G, A, R> archetypeAttribute) { + try { + attributeRangeChecker.add(typeNo, archetypeAttribute.getArchetypeAttributeName(), archetypeAttribute.getAttributeName(), archetypeAttribute.getMinCheckValue(), archetypeAttribute.getMaxCheckValue()); + } catch (final InvalidCheckException ex) { + log.warn(ex.getMessage() + " in type " + typeNo + "."); + } + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeInvSpell<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeList<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeLong<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeMapPath<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeScriptFile<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeSpell<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeString<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeText<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeTreasure<G, A, R> archetypeAttribute) { + // XXX: missing + } + + /** {@inheritDoc} */ + @Override + public void visit(@NotNull final ArchetypeAttributeZSpell<G, A, R> archetypeAttribute) { + // XXX: missing + } + + }; + for (final ArchetypeAttribute<G, A, R> archetypeAttribute : attr) { - try { - archetypeAttribute.addChecks(typeNo, attributeRangeChecker); - } catch (final InvalidCheckException ex) { - log.warn(ex.getMessage() + " in type " + typeNo + "."); - } + archetypeAttribute.visit(archetypeAttributeVisitor); } } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSet.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -316,7 +316,7 @@ */ public void addChecks(@NotNull final AttributeRangeChecker<G, A, R> attributeRangeChecker) { for (final ArchetypeType<G, A, R> archetypeType : archetypeTypeList) { - archetypeType.addChecks(attributeRangeChecker); + archetypeType.addChecks(attributeRangeChecker, this); } } Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/DefaultArchetypeAttributeFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/DefaultArchetypeAttributeFactory.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/DefaultArchetypeAttributeFactory.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -13,20 +13,6 @@ */ public class DefaultArchetypeAttributeFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements ArchetypeAttributeFactory<G, A, R> { - /** - * The archetype type set for looking up bitmasks. - */ - @NotNull - private final ArchetypeTypeSet<G, A, R> archetypeTypeSet; - - /** - * Creates a new instance. - * @param archetypeTypeSet the archetype type set for looking up bitmasks - */ - public DefaultArchetypeAttributeFactory(@NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet) { - this.archetypeTypeSet = archetypeTypeSet; - } - /** {@inheritDoc} */ @NotNull @Override @@ -38,7 +24,7 @@ @NotNull @Override public ArchetypeAttribute<G, A, R> newArchetypeAttributeBitmask(@NotNull final String archetypeAttributeName, @NotNull final String attributeName, @NotNull final String description, final int inputLength, @NotNull final String sectionName, @NotNull final String bitmaskName) { - return new ArchetypeAttributeBitmask<G, A, R>(archetypeAttributeName, attributeName, description, inputLength, sectionName, bitmaskName, archetypeTypeSet); + return new ArchetypeAttributeBitmask<G, A, R>(archetypeAttributeName, attributeName, description, inputLength, sectionName, bitmaskName); } /** {@inheritDoc} */ Modified: trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2009-12-01 21:36:40 UTC (rev 7291) +++ trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2009-12-01 21:55:19 UTC (rev 7292) @@ -24,8 +24,6 @@ import java.io.InputStream; import java.io.UnsupportedEncodingException; import javax.xml.parsers.ParserConfigurationException; -import net.sf.gridarta.gui.map.validation.checks.AttributeRangeChecker; -import net.sf.gridarta.gui.map.validation.checks.InvalidCheckException; import net.sf.gridarta.model.errorview.ErrorView; import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; @@ -600,12 +598,6 @@ throw new AssertionError(); } - /** {@inheritDoc} */ - @Override - public void addChecks(final int typeNo, @NotNull final AttributeRangeChecker<TestGameObject, TestMapArchObject, TestArchetype> attributeRangeChecker) throws InvalidCheckException { - throw new AssertionError(); - } - } // class TestArchetypeAttribute } // class TestArchetypeAttributeFactory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-12-03 20:59:34
|
Revision: 7304 http://gridarta.svn.sourceforge.net/gridarta/?rev=7304&view=rev Author: akirschbaum Date: 2009-12-03 20:59:23 +0000 (Thu, 03 Dec 2009) Log Message: ----------- Move AttributeListUtils to archetype package. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java trunk/src/test/net/sf/gridarta/model/archetype/AttributeListUtilsTest.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/model/gameobject/AttributeListUtils.java trunk/src/test/net/sf/gridarta/model/gameobject/AttributeListUtilsTest.java Modified: trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java 2009-12-03 20:49:33 UTC (rev 7303) +++ trunk/src/app/net/sf/gridarta/gui/gameobjecttexteditor/GameObjectTextEditor.java 2009-12-03 20:59:23 UTC (rev 7304) @@ -29,7 +29,7 @@ import javax.swing.text.MutableAttributeSet; import javax.swing.text.StyleConstants; import javax.swing.text.StyleContext; -import net.sf.gridarta.model.gameobject.AttributeListUtils; +import net.sf.gridarta.model.archetype.AttributeListUtils; import net.sf.gridarta.model.gameobject.GameObject; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; Modified: trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java 2009-12-03 20:49:33 UTC (rev 7303) +++ trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeParser.java 2009-12-03 20:59:23 UTC (rev 7304) @@ -32,7 +32,6 @@ import net.sf.gridarta.model.errorview.ErrorViewCategory; import net.sf.gridarta.model.errorview.ErrorViewCollector; import net.sf.gridarta.model.gameobject.ArchetypeCollector; -import net.sf.gridarta.model.gameobject.AttributeListUtils; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.io.PathManager; import net.sf.gridarta.model.map.maparchobject.MapArchObject; Copied: trunk/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java (from rev 7302, trunk/src/app/net/sf/gridarta/model/gameobject/AttributeListUtils.java) =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java (rev 0) +++ trunk/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java 2009-12-03 20:59:23 UTC (rev 7304) @@ -0,0 +1,112 @@ +/* + * 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.model.archetype; + +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.utils.StringUtils; +import org.jetbrains.annotations.NotNull; + +/** + * Utility class for archetype attribute related functions. + * @author Andreas Kirschbaum + */ +public class AttributeListUtils { + + /** + * Private constructor to prevent instantiation. + */ + private AttributeListUtils() { + } + + /** + * Removes an attribute from an attribute list. + * @param attributeList the attribute list to modify + * @param key the attribute key to remove + * @return the attribute list with the given key removed + */ + public static String removeAttribute(@NotNull final String attributeList, @NotNull final String key) { + if (attributeList.length() <= 0) { + return attributeList; + } + + final String prefix = key + " "; + + final String[] lines = StringUtils.PATTERN_END_OF_LINE.split(attributeList, -1); + + final StringBuilder sb = new StringBuilder(); + for (final String line : lines) { + if (line.length() > 0 && !line.startsWith(prefix)) { + sb.append(line); + sb.append('\n'); + } + } + return sb.toString(); + } + + /** + * Returns all attributes from the given game object that don't exist in an + * archetype. Ignores the values; compares only keys. + * @param gameObject the game object + * @param archetype the archetype + * @return all attributes from the archetype that don't occur in the game + * object + */ + @NotNull + public static String diffArchTextKeys(@NotNull final GameObject<?, ?, ?> gameObject, @NotNull final Archetype<?, ?, ?> archetype) { + final CharSequence oldObjectText = gameObject.getObjectText(); + final StringBuilder result = new StringBuilder(); + for (final String line : StringUtils.PATTERN_END_OF_LINE.split(archetype.getObjectText(), 0)) { + final int spaceIndex = line.indexOf(' '); + if (line.length() > 0 && spaceIndex > 0 && StringUtils.diffTextString(oldObjectText, line.substring(0, spaceIndex + 1), true) == null) { + result.append(line).append('\n'); + } + } + return result.toString(); + } + + /** + * Get all entries from the given attributes that don't exist in an + * archetype. + * @param attributes the attributes + * @param archetype the game object + * @return All lines from 'atxt' that don't occur in this GameObject. + */ + @NotNull + public static String diffArchTextValues(@NotNull final Archetype<?, ?, ?> archetype, @NotNull final CharSequence attributes) { + final CharSequence oldObjectText = archetype.getObjectText(); + final StringBuilder result = new StringBuilder(); + for (final String line : StringUtils.PATTERN_END_OF_LINE.split(attributes, 0)) { + try { + final CharSequence test = StringUtils.diffTextString(oldObjectText, line, false); + char c = '\n'; + if (test != null) { + c = test.charAt(0); + } + if (line.length() > 0 && (test == null || c == '\n')) { + result.append(line).append('\n'); + } + } catch (final StringIndexOutOfBoundsException e) { + // ignore + } + } + return result.toString(); + } + +} // class AttributeListUtils Property changes on: trunk/src/app/net/sf/gridarta/model/archetype/AttributeListUtils.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Deleted: trunk/src/app/net/sf/gridarta/model/gameobject/AttributeListUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/AttributeListUtils.java 2009-12-03 20:49:33 UTC (rev 7303) +++ trunk/src/app/net/sf/gridarta/model/gameobject/AttributeListUtils.java 2009-12-03 20:59:23 UTC (rev 7304) @@ -1,112 +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.model.gameobject; - -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.utils.StringUtils; -import org.jetbrains.annotations.NotNull; - -/** - * Utility class for archetype attribute related functions. - * @author Andreas Kirschbaum - */ -public class AttributeListUtils { - - /** - * Private constructor to prevent instantiation. - */ - private AttributeListUtils() { - } - - /** - * Removes an attribute from an attribute list. - * @param attributeList the attribute list to modify - * @param key the attribute key to remove - * @return the attribute list with the given key removed - */ - public static String removeAttribute(@NotNull final String attributeList, @NotNull final String key) { - if (attributeList.length() <= 0) { - return attributeList; - } - - final String prefix = key + " "; - - final String[] lines = StringUtils.PATTERN_END_OF_LINE.split(attributeList, -1); - - final StringBuilder sb = new StringBuilder(); - for (final String line : lines) { - if (line.length() > 0 && !line.startsWith(prefix)) { - sb.append(line); - sb.append('\n'); - } - } - return sb.toString(); - } - - /** - * Returns all attributes from the given game object that don't exist in an - * archetype. Ignores the values; compares only keys. - * @param gameObject the game object - * @param archetype the archetype - * @return all attributes from the archetype that don't occur in the game - * object - */ - @NotNull - public static String diffArchTextKeys(@NotNull final GameObject<?, ?, ?> gameObject, @NotNull final Archetype<?, ?, ?> archetype) { - final CharSequence oldObjectText = gameObject.getObjectText(); - final StringBuilder result = new StringBuilder(); - for (final String line : StringUtils.PATTERN_END_OF_LINE.split(archetype.getObjectText(), 0)) { - final int spaceIndex = line.indexOf(' '); - if (line.length() > 0 && spaceIndex > 0 && StringUtils.diffTextString(oldObjectText, line.substring(0, spaceIndex + 1), true) == null) { - result.append(line).append('\n'); - } - } - return result.toString(); - } - - /** - * Get all entries from the given attributes that don't exist in an - * archetype. - * @param attributes the attributes - * @param archetype the game object - * @return All lines from 'atxt' that don't occur in this GameObject. - */ - @NotNull - public static String diffArchTextValues(@NotNull final Archetype<?, ?, ?> archetype, @NotNull final CharSequence attributes) { - final CharSequence oldObjectText = archetype.getObjectText(); - final StringBuilder result = new StringBuilder(); - for (final String line : StringUtils.PATTERN_END_OF_LINE.split(attributes, 0)) { - try { - final CharSequence test = StringUtils.diffTextString(oldObjectText, line, false); - char c = '\n'; - if (test != null) { - c = test.charAt(0); - } - if (line.length() > 0 && (test == null || c == '\n')) { - result.append(line).append('\n'); - } - } catch (final StringIndexOutOfBoundsException e) { - // ignore - } - } - return result.toString(); - } - -} // class AttributeListUtils Copied: trunk/src/test/net/sf/gridarta/model/archetype/AttributeListUtilsTest.java (from rev 7296, trunk/src/test/net/sf/gridarta/model/gameobject/AttributeListUtilsTest.java) =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetype/AttributeListUtilsTest.java (rev 0) +++ trunk/src/test/net/sf/gridarta/model/archetype/AttributeListUtilsTest.java 2009-12-03 20:59:23 UTC (rev 7304) @@ -0,0 +1,58 @@ +/* + * 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.model.archetype; + +import org.junit.Assert; +import org.junit.Test; + +/** + * Test for {@link AttributeListUtils}. + * @author Andreas Kirschbaum + */ +@SuppressWarnings({ "FeatureEnvy" }) +// This is a test. It has feature envy by definition. +public class AttributeListUtilsTest { + + /** Test case for {@link AttributeListUtils#removeAttribute(String, String)}. */ + @Test + public void testRemoveAttribute() { + checkRemoveAttribute("", "abc", ""); + + checkRemoveAttribute("abc def\n", "abc", ""); + checkRemoveAttribute("abc def\n", "ab", "abc def\n"); + checkRemoveAttribute("abc def\n", "abcd", "abc def\n"); + + checkRemoveAttribute("abc def\nghi jkl\nmno pqr\n", "abc", "ghi jkl\nmno pqr\n"); + checkRemoveAttribute("abc def\nghi jkl\nmno pqr\n", "def", "abc def\nghi jkl\nmno pqr\n"); + checkRemoveAttribute("abc def\nghi jkl\nmno pqr\n", "ghi", "abc def\nmno pqr\n"); + checkRemoveAttribute("abc def\nghi jkl\nmno pqr\n", "mno", "abc def\nghi jkl\n"); + + checkRemoveAttribute("abc def\nghi jkl\nmno pqr\n", "Abc", "abc def\nghi jkl\nmno pqr\n"); + + checkRemoveAttribute("abc def\n\nghi jkl\n\n", "xyz", "abc def\nghi jkl\n"); + checkRemoveAttribute("\n\nabc def\n\n", "ghi", "abc def\n"); + checkRemoveAttribute("\n\nabc def\n\n", "abc", ""); + } + + private static void checkRemoveAttribute(final String attributeList, final String key, final String expectedResult) { + Assert.assertEquals(expectedResult, AttributeListUtils.removeAttribute(attributeList, key)); + } + +} // class AttributeListUtilsTest Property changes on: trunk/src/test/net/sf/gridarta/model/archetype/AttributeListUtilsTest.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Deleted: trunk/src/test/net/sf/gridarta/model/gameobject/AttributeListUtilsTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/gameobject/AttributeListUtilsTest.java 2009-12-03 20:49:33 UTC (rev 7303) +++ trunk/src/test/net/sf/gridarta/model/gameobject/AttributeListUtilsTest.java 2009-12-03 20:59:23 UTC (rev 7304) @@ -1,58 +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.model.gameobject; - -import org.junit.Assert; -import org.junit.Test; - -/** - * Test for {@link AttributeListUtils}. - * @author Andreas Kirschbaum - */ -@SuppressWarnings({ "FeatureEnvy" }) -// This is a test. It has feature envy by definition. -public class AttributeListUtilsTest { - - /** Test case for {@link AttributeListUtils#removeAttribute(String, String)}. */ - @Test - public void testRemoveAttribute() { - checkRemoveAttribute("", "abc", ""); - - checkRemoveAttribute("abc def\n", "abc", ""); - checkRemoveAttribute("abc def\n", "ab", "abc def\n"); - checkRemoveAttribute("abc def\n", "abcd", "abc def\n"); - - checkRemoveAttribute("abc def\nghi jkl\nmno pqr\n", "abc", "ghi jkl\nmno pqr\n"); - checkRemoveAttribute("abc def\nghi jkl\nmno pqr\n", "def", "abc def\nghi jkl\nmno pqr\n"); - checkRemoveAttribute("abc def\nghi jkl\nmno pqr\n", "ghi", "abc def\nmno pqr\n"); - checkRemoveAttribute("abc def\nghi jkl\nmno pqr\n", "mno", "abc def\nghi jkl\n"); - - checkRemoveAttribute("abc def\nghi jkl\nmno pqr\n", "Abc", "abc def\nghi jkl\nmno pqr\n"); - - checkRemoveAttribute("abc def\n\nghi jkl\n\n", "xyz", "abc def\nghi jkl\n"); - checkRemoveAttribute("\n\nabc def\n\n", "ghi", "abc def\n"); - checkRemoveAttribute("\n\nabc def\n\n", "abc", ""); - } - - private static void checkRemoveAttribute(final String attributeList, final String key, final String expectedResult) { - Assert.assertEquals(expectedResult, AttributeListUtils.removeAttribute(attributeList, key)); - } - -} // class AttributeListUtilsTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2009-12-09 20:59:43
|
Revision: 7371 http://gridarta.svn.sourceforge.net/gridarta/?rev=7371&view=rev Author: akirschbaum Date: 2009-12-09 20:59:35 +0000 (Wed, 09 Dec 2009) Log Message: ----------- Fix initialization errors introduced in r7369. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java trunk/src/app/net/sf/gridarta/model/match/GameObjectMatchersParser.java trunk/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java Modified: trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2009-12-09 19:54:29 UTC (rev 7370) +++ trunk/src/app/net/sf/gridarta/maincontrol/DefaultMainControl.java 2009-12-09 20:59:35 UTC (rev 7371) @@ -387,16 +387,7 @@ try { final URL url = IOUtils.getResource(globalSettings.getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); final ErrorViewCollector typesErrorViewCollector = new ErrorViewCollector(errorView, url); - try { - final InputStream inputStream = url.openStream(); - try { - archetypeTypeSetParser.loadTypesFromXML(typesErrorViewCollector, inputStream); - } finally { - inputStream.close(); - } - } catch (final IOException ex) { - typesErrorViewCollector.addWarning(ErrorViewCategory.TYPES_FILE_INVALID, ex.getMessage()); - } + archetypeTypeSetParser.loadTypesFromXML(typesErrorViewCollector, new InputSource(url.toString())); final ArchetypeTypeList eventTypeSetTmp = archetypeTypeSet.getList("event"); if (eventTypeSetTmp == null) { typesErrorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "list 'list_event' does not exist"); Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2009-12-09 19:54:29 UTC (rev 7370) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParser.java 2009-12-09 20:59:35 UTC (rev 7371) @@ -20,7 +20,6 @@ package net.sf.gridarta.model.archetypetype; import java.io.IOException; -import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.Iterator; @@ -43,6 +42,7 @@ import org.w3c.dom.Attr; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** @@ -94,12 +94,13 @@ this.archetypeTypeParser = archetypeTypeParser; } - public void loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final InputStream inputStream) { + public void loadTypesFromXML(@NotNull final ErrorViewCollector errorViewCollector, @NotNull final InputSource inputSource) { // parse xml document final Document doc; try { - doc = documentBuilder.parse(inputStream); + doc = documentBuilder.parse(inputSource); } catch (final SAXException e) { + e.printStackTrace(); errorViewCollector.addWarning(ErrorViewCategory.TYPES_ENTRY_INVALID, "parsing error: " + e.getMessage()); return; } catch (final IOException e) { Modified: trunk/src/app/net/sf/gridarta/model/match/GameObjectMatchersParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/match/GameObjectMatchersParser.java 2009-12-09 19:54:29 UTC (rev 7370) +++ trunk/src/app/net/sf/gridarta/model/match/GameObjectMatchersParser.java 2009-12-09 20:59:35 UTC (rev 7371) @@ -20,7 +20,6 @@ package net.sf.gridarta.model.match; import java.io.IOException; -import java.io.InputStream; import java.net.URL; import java.util.Collection; import java.util.Iterator; @@ -35,6 +34,7 @@ import org.jetbrains.annotations.NotNull; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** @@ -77,40 +77,35 @@ */ public void readGameObjectMatchers(@NotNull final URL url, @NotNull final Collection<NamedGameObjectMatcher> gameObjectMatchers, @NotNull final Map<String, NamedGameObjectMatcher> gameObjectMatchersByIds, @NotNull final ErrorViewCollector errorViewCollector) throws IOException { final GameObjectMatcherParser aom = new GameObjectMatcherParser(xpath); - final InputStream inputStream = url.openStream(); + final Document doc; try { - final Document doc; + doc = documentBuilder.parse(new InputSource(url.toString())); + } catch (final SAXException ex) { + throw new IOException("sax exception: " + ex.getMessage(), ex); + } + int editType = 1; + final Iterator<Element> it = new NodeListIterator<Element>(doc.getElementsByTagName("GameObjectMatcher")); + while (it.hasNext()) { + final Element node = it.next(); + final NamedGameObjectMatcher archObjectMatcher; try { - doc = documentBuilder.parse(inputStream); - } catch (final SAXException ex) { - throw new IOException("sax exception: " + ex.getMessage(), ex); + archObjectMatcher = aom.parseMatcher(node, editType); + } catch (final ParsingException ex) { + errorViewCollector.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_ENTRY_INVALID, node.getAttribute("id") + ": " + ex.getMessage()); + continue; } - int editType = 1; - final Iterator<Element> it = new NodeListIterator<Element>(doc.getElementsByTagName("GameObjectMatcher")); - while (it.hasNext()) { - final Element node = it.next(); - final NamedGameObjectMatcher archObjectMatcher; - try { - archObjectMatcher = aom.parseMatcher(node, editType); - } catch (final ParsingException ex) { - errorViewCollector.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_ENTRY_INVALID, node.getAttribute("id") + ": " + ex.getMessage()); - continue; + gameObjectMatchers.add(archObjectMatcher); + gameObjectMatchersByIds.put(archObjectMatcher.getID(), archObjectMatcher); + if (editType != 0 && !archObjectMatcher.isSystemMatcher()) { + editType <<= 1; + if (editType == 0) { + errorViewCollector.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_ENTRY_INVALID, "too many GameObjectMatchers, ignoring rest"); } - gameObjectMatchers.add(archObjectMatcher); - gameObjectMatchersByIds.put(archObjectMatcher.getID(), archObjectMatcher); - if (editType != 0 && !archObjectMatcher.isSystemMatcher()) { - editType <<= 1; - if (editType == 0) { - errorViewCollector.addWarning(ErrorViewCategory.GAMEOBJECTMATCHERS_ENTRY_INVALID, "too many GameObjectMatchers, ignoring rest"); - } - } } - if (log.isInfoEnabled()) { - log.info("Loaded " + gameObjectMatchers.size() + " GameObjectMatchers from '" + url + "'."); - } - } finally { - inputStream.close(); } + if (log.isInfoEnabled()) { + log.info("Loaded " + gameObjectMatchers.size() + " GameObjectMatchers from '" + url + "'."); + } } } // class GameObjectMatchersParser Modified: trunk/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java 2009-12-09 19:54:29 UTC (rev 7370) +++ trunk/src/app/net/sf/gridarta/model/spells/XMLSpellLoader.java 2009-12-09 20:59:35 UTC (rev 7371) @@ -22,7 +22,6 @@ import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import java.io.InputStream; import java.net.URL; import java.util.Iterator; import javax.xml.parsers.DocumentBuilder; @@ -36,6 +35,7 @@ import org.jetbrains.annotations.NotNull; import org.w3c.dom.Document; import org.w3c.dom.Element; +import org.xml.sax.InputSource; import org.xml.sax.SAXException; /** @@ -66,44 +66,38 @@ final URL url = IOUtils.getResource(baseDir, filename); final ErrorViewCollector errorViewCollector = new ErrorViewCollector(errorView, url); try { - // parse xml document - final InputStream inputStream = url.openStream(); - try { - final Document doc = documentBuilder.parse(inputStream); + final Document doc = documentBuilder.parse(new InputSource(url.toString())); - // retrieve the spell data from the xml - final Element root = doc.getDocumentElement(); - if (root == null || !"spells".equalsIgnoreCase(root.getNodeName())) { - errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "root element 'spells' is missing"); - } else { - // initialize array with appropriate size - int numSpells = 0; - final Iterator<Element> it = new NodeListIterator<Element>(root, "spell"); - while (it.hasNext()) { - final Element spellElem = it.next(); - if (spellElem.getAttribute("id") == null) { - errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "found 'spell' element without 'id'"); - } else if (spellElem.getAttribute("name") == null) { - errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "found 'spell' element without 'name'"); - } else { - try { - // parse spell number and -name - spells.add(new NumberSpell(spellElem.getAttribute("name").trim(), Integer.parseInt(spellElem.getAttribute("id")))); - numSpells++; - } catch (final NumberFormatException de) { - errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "parsing error: spell id '" + spellElem.getAttribute("id") + "' is not an integer."); - } + // retrieve the spell data from the xml + final Element root = doc.getDocumentElement(); + if (root == null || !"spells".equalsIgnoreCase(root.getNodeName())) { + errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "root element 'spells' is missing"); + } else { + // initialize array with appropriate size + int numSpells = 0; + final Iterator<Element> it = new NodeListIterator<Element>(root, "spell"); + while (it.hasNext()) { + final Element spellElem = it.next(); + if (spellElem.getAttribute("id") == null) { + errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "found 'spell' element without 'id'"); + } else if (spellElem.getAttribute("name") == null) { + errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "found 'spell' element without 'name'"); + } else { + try { + // parse spell number and -name + spells.add(new NumberSpell(spellElem.getAttribute("name").trim(), Integer.parseInt(spellElem.getAttribute("id")))); + numSpells++; + } catch (final NumberFormatException de) { + errorViewCollector.addWarning(ErrorViewCategory.SPELLS_ENTRY_INVALID, "parsing error: spell id '" + spellElem.getAttribute("id") + "' is not an integer."); } } + } - // loading successful - log.info("Loaded " + numSpells + " defined spells from '" + url + "'"); - if (numSpells == 0) { - errorViewCollector.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, "no content"); - } + // loading successful + log.info("Loaded " + numSpells + " defined spells from '" + url + "'"); + if (numSpells == 0) { + errorViewCollector.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, "no content"); } - } finally { - inputStream.close(); } } catch (final SAXException ex) { errorViewCollector.addWarning(ErrorViewCategory.SPELLS_FILE_INVALID, "parsing error:" + ex.getMessage()); Modified: trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2009-12-09 19:54:29 UTC (rev 7370) +++ trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2009-12-09 20:59:35 UTC (rev 7371) @@ -35,6 +35,7 @@ import org.jetbrains.annotations.Nullable; import org.junit.Assert; import org.junit.Test; +import org.xml.sax.InputSource; /** * Regression tests for {@link ArchetypeTypeSetParser}. @@ -376,7 +377,7 @@ private void check(final String typesXml, final boolean expectedHasErrors, final String expectedResult) throws ParserConfigurationException, UnsupportedEncodingException { final ArchetypeTypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeTypeSet = new ArchetypeTypeSet<TestGameObject, TestMapArchObject, TestArchetype>(); final ArchetypeTypeSetParser<TestGameObject, TestMapArchObject, TestArchetype> parser = createArchetypeTypeSetParser(archetypeTypeSet); - parser.loadTypesFromXML(errorViewCollector, createInputStream(typesXml)); + parser.loadTypesFromXML(errorViewCollector, createInputSource(typesXml)); Assert.assertEquals(expectedHasErrors, errorView.hasErrors()); Assert.assertEquals(expectedResult, archetypeTypeSet.toString()); } @@ -403,14 +404,14 @@ * created */ @NotNull - private static InputStream createInputStream(@NotNull final String string) throws UnsupportedEncodingException { + private static InputSource createInputSource(@NotNull final String string) throws UnsupportedEncodingException { final String typesString = "<?xml version=\"1.0\" standalone=\"no\" ?>\n" + "<!DOCTYPE types SYSTEM \"types.dtd\">\n" + "<types>\n" + string + "</types>\n"; - return new ByteArrayInputStream(typesString.getBytes("UTF-8")); + return new InputSource(new ByteArrayInputStream(typesString.getBytes("UTF-8"))); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-02-10 09:20:47
|
Revision: 7449 http://gridarta.svn.sourceforge.net/gridarta/?rev=7449&view=rev Author: akirschbaum Date: 2010-02-10 09:20:40 +0000 (Wed, 10 Feb 2010) Log Message: ----------- Fix checkstyle issues. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/commands/Collector.java trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java trunk/src/app/net/sf/gridarta/gui/prefs/PrefsHelper.java trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchDataUtils.java trunk/src/app/net/sf/gridarta/model/anim/AnimationObjects.java trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java trunk/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java trunk/src/app/net/sf/gridarta/model/errorview/ErrorEntry.java trunk/src/app/net/sf/gridarta/model/gameobject/ArchetypeCollector.java trunk/src/app/net/sf/gridarta/model/gameobject/IsArchetypeException.java trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java trunk/src/app/net/sf/gridarta/textedit/textarea/actions/InputActions.java trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java Modified: trunk/src/app/net/sf/gridarta/commands/Collector.java =================================================================== --- trunk/src/app/net/sf/gridarta/commands/Collector.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/commands/Collector.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -21,7 +21,6 @@ import java.io.File; import java.io.IOException; -import net.sf.gridarta.model.collectable.Collectable; import net.sf.gridarta.resource.AbstractResources; import net.sf.japi.swing.action.ActionBuilder; import net.sf.japi.swing.action.ActionBuilderFactory; @@ -29,8 +28,9 @@ import org.jetbrains.annotations.Nullable; /** - * A Collector is capable of iterating over a collection of {@link Collectable}s - * and collecting them in a separate Thread with a nice GUI. + * A Collector is capable of iterating over a collection of {@link + * net.sf.gridarta.model.collectable.Collectable}s and collecting them in a + * separate <code>Thread</code> with a nice GUI. * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ public class Collector implements Runnable { Modified: trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/gui/misc/StatusBar.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -45,7 +45,6 @@ import net.sf.gridarta.model.archetype.ArchetypeSet; import net.sf.gridarta.model.data.NamedObjects; import net.sf.gridarta.model.face.FaceObject; -import net.sf.gridarta.model.face.FaceObjects; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import net.sf.gridarta.model.map.mapcontrol.DefaultMapControl; @@ -84,7 +83,7 @@ private final ArchetypeSet<G, A, R> archetypeSet; /** - * The {@link FaceObjects} instance to use. + * The {@link NamedObjects} instance to use. * @serial */ @NotNull @@ -264,7 +263,7 @@ * @param mapManager the map manager * @param mapViewManager the map view manager * @param archetypeSet the archetype set - * @param faceObjects the FaceObjects instance to use + * @param faceObjects the named objects instance to use */ public StatusBar(@NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final NamedObjects<FaceObject> faceObjects) { this.archetypeSet = archetypeSet; Modified: trunk/src/app/net/sf/gridarta/gui/prefs/PrefsHelper.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/PrefsHelper.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/gui/prefs/PrefsHelper.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -73,7 +73,7 @@ */ @NotNull public JFileField createFileField(@NotNull final String key, @NotNull final String initial, final int fileSelectionMode) { - addComponent(new JLabel(ACTION_BUILDER.getString(key)+":")); + addComponent(new JLabel(ACTION_BUILDER.getString(key) + ":")); final JFileField fileField = new JFileField(initial, fileSelectionMode); final String tooltip = ACTION_BUILDER.getString(key + ".shortdescription"); Modified: trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchDataUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchDataUtils.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/gui/scripts/ScriptArchDataUtils.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -28,7 +28,6 @@ import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.model.scripts.ScriptArchData; import net.sf.gridarta.model.scripts.ScriptedEvent; import net.sf.gridarta.model.scripts.ScriptedEventFactory; import org.apache.log4j.Category; @@ -36,7 +35,7 @@ import org.jetbrains.annotations.NotNull; /** - * {@link ScriptArchData} related functions. + * {@link net.sf.gridarta.model.scripts.ScriptArchData} related functions. * @author <a href="mailto:and...@gm...">Andreas Vogl</a> * @author Andreas Kirschbaum */ Modified: trunk/src/app/net/sf/gridarta/model/anim/AnimationObjects.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/anim/AnimationObjects.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/model/anim/AnimationObjects.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -20,7 +20,6 @@ package net.sf.gridarta.model.anim; import java.io.File; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.Reader; import java.net.URL; @@ -62,7 +61,8 @@ * @param ignoreOtherText if set, ignore all text outside animation * definitions * @throws IOException in case of I/O errors - * @throws FileNotFoundException in case the file couldn't be opened + * @throws java.io.FileNotFoundException in case the file couldn't be + * opened * @throws AnimationParseException in case parsing the animation reveals * errors */ @@ -91,7 +91,8 @@ * Loads animations from a file. * @param url the URL to load animations tree from * @throws IOException in case of I/O errors - * @throws FileNotFoundException in case the file couldn't be opened + * @throws java.io.FileNotFoundException in case the file couldn't be + * opened */ void loadAnimTree(@NotNull URL url) throws IOException; Modified: trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/model/archetype/AbstractArchetypeBuilder.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -110,13 +110,13 @@ final String[] tmp = line.split(" +", 2); final String key = tmp[0]; if (tmp.length < 2) { - errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, archetype.getArchetypeName()+": invalid attribute definition: "+line); + errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, archetype.getArchetypeName() + ": invalid attribute definition: " + line); return; } final String value = tmp[1]; final String previousValue = attributes.put(key, value); if (previousValue != null) { - errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, archetype.getArchetypeName()+": duplicate attribute definition: "+line+", previous value was "+previousValue); + errorViewCollector.addWarning(ErrorViewCategory.ARCHETYPE_INVALID, archetype.getArchetypeName() + ": duplicate attribute definition: " + line + ", previous value was " + previousValue); } } Modified: trunk/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/model/archetype/ArchetypeSet.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -22,7 +22,6 @@ import java.util.Collection; import net.sf.gridarta.model.collectable.Collectable; import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -53,8 +52,8 @@ * @param archetypeName name of the Archetype to get * @return Archetype for <var>archetypeName</var> or <code>null</code> if no * such Archetype - * @see GameObjectFactory#newGameObject(String) for a similar method that - * instantiates. + * @see net.sf.gridarta.model.gameobject.GameObjectFactory#newGameObject(String) + * for a similar method that instantiates. * @see #getOrCreateArchetype(String) for a similar method that creates * undefined archetypes */ Modified: trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/model/archetypetype/ArchetypeAttributeVisitor.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -34,108 +34,108 @@ * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeAnimName<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeAnimName<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeBitmask<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeBitmask<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeBool<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeBool<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeBoolSpec<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeBoolSpec<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeFaceName<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeFaceName<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeFixed<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeFixed<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeFloat<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeFloat<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeInt<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeInt<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeInvSpell<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeInvSpell<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeList<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeList<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeLong<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeLong<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeMapPath<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeMapPath<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeScriptFile<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeScriptFile<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeSpell<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeSpell<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeString<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeString<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeText<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeText<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeTreasure<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeTreasure<G, A, R> archetypeAttribute); /** * Visitor callback function. * @param archetypeAttribute the visited node */ - void visit(@NotNull ArchetypeAttributeZSpell<G,A,R> archetypeAttribute); + void visit(@NotNull ArchetypeAttributeZSpell<G, A, R> archetypeAttribute); } // interface ArchetypeAttributeVisitor Modified: trunk/src/app/net/sf/gridarta/model/errorview/ErrorEntry.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/errorview/ErrorEntry.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/model/errorview/ErrorEntry.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -22,11 +22,10 @@ import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import javax.swing.tree.MutableTreeNode; -import net.sf.gridarta.gui.errorview.DefaultErrorView; import org.jetbrains.annotations.NotNull; /** - * An entry in a {@link DefaultErrorView}. + * An entry in a {@link net.sf.gridarta.gui.errorview.DefaultErrorView}. * @author Andreas Kirschbaum */ public class ErrorEntry extends DefaultMutableTreeNode { Modified: trunk/src/app/net/sf/gridarta/model/gameobject/ArchetypeCollector.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/ArchetypeCollector.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/model/gameobject/ArchetypeCollector.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -20,13 +20,12 @@ package net.sf.gridarta.model.gameobject; import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.archetype.ArchetypeParser; import net.sf.gridarta.model.map.maparchobject.MapArchObject; import org.jetbrains.annotations.NotNull; /** * Interface for classes receiving archetypes parsed by an {@link - * ArchetypeParser}. + * net.sf.gridarta.model.archetype.ArchetypeParser}. * @author Andreas Kirschbaum */ public interface ArchetypeCollector<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { Modified: trunk/src/app/net/sf/gridarta/model/gameobject/IsArchetypeException.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/gameobject/IsArchetypeException.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/model/gameobject/IsArchetypeException.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -19,7 +19,6 @@ package net.sf.gridarta.model.gameobject; -import net.sf.gridarta.model.archetype.Archetype; import org.jetbrains.annotations.NotNull; /** @@ -37,7 +36,8 @@ private static final long serialVersionUID = 1; /** - * The {@link GameObject} that is an {@link Archetype}. + * The {@link GameObject} that is an {@link + * net.sf.gridarta.model.archetype.Archetype}. * @serial */ @NotNull Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/DefaultInputHandler.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -52,47 +52,47 @@ /** Sets up the default key bindings. */ @Override public void addDefaultKeyBindings() { - addKeyBinding("BACK_SPACE", inputActions.BACKSPACE); - addKeyBinding("C+BACK_SPACE", inputActions.BACKSPACE_WORD); - addKeyBinding("DELETE", inputActions.DELETE); - addKeyBinding("C+DELETE", inputActions.DELETE_WORD); + addKeyBinding("BACK_SPACE", inputActions.backspace); + addKeyBinding("C+BACK_SPACE", inputActions.backspaceWord); + addKeyBinding("DELETE", inputActions.delete); + addKeyBinding("C+DELETE", inputActions.deleteWord); - addKeyBinding("ENTER", inputActions.INSERT_BREAK); - addKeyBinding("TAB", inputActions.INSERT_TAB); + addKeyBinding("ENTER", inputActions.insertBreak); + addKeyBinding("TAB", inputActions.insertTab); - addKeyBinding("INSERT", inputActions.OVERWRITE); - addKeyBinding("C+\\", inputActions.TOGGLE_RECT); + addKeyBinding("INSERT", inputActions.overwrite); + addKeyBinding("C+\\", inputActions.toggleRect); - addKeyBinding("HOME", inputActions.HOME); - addKeyBinding("END", inputActions.END); - addKeyBinding("S+HOME", inputActions.SELECT_HOME); - addKeyBinding("S+END", inputActions.SELECT_END); - addKeyBinding("C+HOME", inputActions.DOCUMENT_HOME); - addKeyBinding("C+END", inputActions.DOCUMENT_END); - addKeyBinding("CS+HOME", inputActions.SELECT_DOC_HOME); - addKeyBinding("CS+END", inputActions.SELECT_DOC_END); + addKeyBinding("HOME", inputActions.home); + addKeyBinding("END", inputActions.end); + addKeyBinding("S+HOME", inputActions.selectHome); + addKeyBinding("S+END", inputActions.selectEnd); + addKeyBinding("C+HOME", inputActions.documentHome); + addKeyBinding("C+END", inputActions.documentEnd); + addKeyBinding("CS+HOME", inputActions.selectDocHome); + addKeyBinding("CS+END", inputActions.selectDocEnd); - addKeyBinding("PAGE_UP", inputActions.PREV_PAGE); - addKeyBinding("PAGE_DOWN", inputActions.NEXT_PAGE); - addKeyBinding("S+PAGE_UP", inputActions.SELECT_PREV_PAGE); - addKeyBinding("S+PAGE_DOWN", inputActions.SELECT_NEXT_PAGE); + addKeyBinding("PAGE_UP", inputActions.prevPage); + addKeyBinding("PAGE_DOWN", inputActions.nextPage); + addKeyBinding("S+PAGE_UP", inputActions.selectPrevPage); + addKeyBinding("S+PAGE_DOWN", inputActions.selectNextPage); - addKeyBinding("LEFT", inputActions.PREV_CHAR); - addKeyBinding("S+LEFT", inputActions.SELECT_PREV_CHAR); - addKeyBinding("C+LEFT", inputActions.PREV_WORD); - addKeyBinding("CS+LEFT", inputActions.SELECT_PREV_WORD); - addKeyBinding("RIGHT", inputActions.NEXT_CHAR); - addKeyBinding("S+RIGHT", inputActions.SELECT_NEXT_CHAR); - addKeyBinding("C+RIGHT", inputActions.NEXT_WORD); - addKeyBinding("CS+RIGHT", inputActions.SELECT_NEXT_WORD); - addKeyBinding("UP", inputActions.PREV_LINE); - addKeyBinding("S+UP", inputActions.SELECT_PREV_LINE); - addKeyBinding("DOWN", inputActions.NEXT_LINE); - addKeyBinding("S+DOWN", inputActions.SELECT_NEXT_LINE); + addKeyBinding("LEFT", inputActions.prevChar); + addKeyBinding("S+LEFT", inputActions.selectPrevChar); + addKeyBinding("C+LEFT", inputActions.prevWord); + addKeyBinding("CS+LEFT", inputActions.selectPrevWord); + addKeyBinding("RIGHT", inputActions.nextChar); + addKeyBinding("S+RIGHT", inputActions.selectNextChar); + addKeyBinding("C+RIGHT", inputActions.nextWord); + addKeyBinding("CS+RIGHT", inputActions.selectNextWord); + addKeyBinding("UP", inputActions.prevLine); + addKeyBinding("S+UP", inputActions.selectPrevLine); + addKeyBinding("DOWN", inputActions.nextLine); + addKeyBinding("S+DOWN", inputActions.selectNextLine); - addKeyBinding("C+ENTER", inputActions.REPEAT); + addKeyBinding("C+ENTER", inputActions.repeat); - addKeyBinding(".", inputActions.FUNCTION_MENU); + addKeyBinding(".", inputActions.functionMenu); } /** @@ -201,7 +201,7 @@ return; } - executeAction(inputActions.INSERT_CHAR, e.getSource(), String.valueOf(e.getKeyChar())); + executeAction(inputActions.insertChar, e.getSource(), String.valueOf(e.getKeyChar())); repeatCount = 0; setRepeatEnabled(false); Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/actions/InputActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/actions/InputActions.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/actions/InputActions.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -31,124 +31,124 @@ */ public static final String SMART_HOME_END_PROPERTY = "InputHandler.homeEnd"; - public final ActionListener BACKSPACE = new Backspace(); + public final ActionListener backspace = new Backspace(); - public final ActionListener BACKSPACE_WORD = new BackspaceWord(); + public final ActionListener backspaceWord = new BackspaceWord(); - public final ActionListener DELETE = new Delete(); + public final ActionListener delete = new Delete(); - public final ActionListener DELETE_WORD = new DeleteWord(); + public final ActionListener deleteWord = new DeleteWord(); - public final ActionListener END = new End(false); + public final ActionListener end = new End(false); - public final ActionListener DOCUMENT_END = new DocumentEnd(false); + public final ActionListener documentEnd = new DocumentEnd(false); - public final ActionListener SELECT_END = new End(true); + public final ActionListener selectEnd = new End(true); - public final ActionListener SELECT_DOC_END = new DocumentEnd(true); + public final ActionListener selectDocEnd = new DocumentEnd(true); - public final ActionListener INSERT_BREAK = new InsertBreak(); + public final ActionListener insertBreak = new InsertBreak(); - public final ActionListener INSERT_TAB = new InsertTab(); + public final ActionListener insertTab = new InsertTab(); - public final ActionListener HOME = new Home(false); + public final ActionListener home = new Home(false); - public final ActionListener DOCUMENT_HOME = new DocumentHome(false); + public final ActionListener documentHome = new DocumentHome(false); - public final ActionListener SELECT_HOME = new Home(true); + public final ActionListener selectHome = new Home(true); - public final ActionListener SELECT_DOC_HOME = new DocumentHome(true); + public final ActionListener selectDocHome = new DocumentHome(true); - public final ActionListener NEXT_CHAR = new NextChar(false); + public final ActionListener nextChar = new NextChar(false); - public final ActionListener NEXT_LINE = new NextLine(false); + public final ActionListener nextLine = new NextLine(false); - public final ActionListener NEXT_PAGE = new NextPage(false); + public final ActionListener nextPage = new NextPage(false); - public final ActionListener NEXT_WORD = new NextWord(false); + public final ActionListener nextWord = new NextWord(false); - public final ActionListener SELECT_NEXT_CHAR = new NextChar(true); + public final ActionListener selectNextChar = new NextChar(true); - public final ActionListener SELECT_NEXT_LINE = new NextLine(true); + public final ActionListener selectNextLine = new NextLine(true); - public final ActionListener SELECT_NEXT_PAGE = new NextPage(true); + public final ActionListener selectNextPage = new NextPage(true); - public final ActionListener SELECT_NEXT_WORD = new NextWord(true); + public final ActionListener selectNextWord = new NextWord(true); - public final ActionListener OVERWRITE = new Overwrite(); + public final ActionListener overwrite = new Overwrite(); - public final ActionListener PREV_CHAR = new PrevChar(false); + public final ActionListener prevChar = new PrevChar(false); - public final ActionListener PREV_LINE = new PrevLine(false); + public final ActionListener prevLine = new PrevLine(false); - public final ActionListener PREV_PAGE = new PrevPage(false); + public final ActionListener prevPage = new PrevPage(false); - public final ActionListener PREV_WORD = new PrevWord(false); + public final ActionListener prevWord = new PrevWord(false); - public final ActionListener SELECT_PREV_CHAR = new PrevChar(true); + public final ActionListener selectPrevChar = new PrevChar(true); - public final ActionListener SELECT_PREV_LINE = new PrevLine(true); + public final ActionListener selectPrevLine = new PrevLine(true); - public final ActionListener SELECT_PREV_PAGE = new PrevPage(true); + public final ActionListener selectPrevPage = new PrevPage(true); - public final ActionListener SELECT_PREV_WORD = new PrevWord(true); + public final ActionListener selectPrevWord = new PrevWord(true); - public final ActionListener REPEAT = new Repeat(); + public final ActionListener repeat = new Repeat(); - public final ActionListener TOGGLE_RECT = new ToggleRect(); + public final ActionListener toggleRect = new ToggleRect(); - private final ActionListener SAVE; + private final ActionListener save; - public final ActionListener FUNCTION_MENU; + public final ActionListener functionMenu; // Default action - public final ActionListener INSERT_CHAR = new InsertChar(); + public final ActionListener insertChar = new InsertChar(); private final Map<String, ActionListener> actions = new HashMap<String, ActionListener>(); public InputActions(@NotNull final ScriptEditControl scriptEditControl) { - SAVE = new Save(scriptEditControl); - FUNCTION_MENU = new FunctionMenu(scriptEditControl); - actions.put("backspace", BACKSPACE); - actions.put("backspace-word", BACKSPACE_WORD); - actions.put("delete", DELETE); - actions.put("delete-word", DELETE_WORD); - actions.put("end", END); - actions.put("select-end", SELECT_END); - actions.put("document-end", DOCUMENT_END); - actions.put("select-doc-end", SELECT_DOC_END); - actions.put("insert-break", INSERT_BREAK); - actions.put("insert-tab", INSERT_TAB); - actions.put("home", HOME); - actions.put("select-home", SELECT_HOME); - actions.put("document-home", DOCUMENT_HOME); - actions.put("select-doc-home", SELECT_DOC_HOME); - actions.put("next-char", NEXT_CHAR); - actions.put("next-line", NEXT_LINE); - actions.put("next-page", NEXT_PAGE); - actions.put("next-word", NEXT_WORD); - actions.put("select-next-char", SELECT_NEXT_CHAR); - actions.put("select-next-line", SELECT_NEXT_LINE); - actions.put("select-next-page", SELECT_NEXT_PAGE); - actions.put("select-next-word", SELECT_NEXT_WORD); - actions.put("overwrite", OVERWRITE); - actions.put("prev-char", PREV_CHAR); - actions.put("prev-line", PREV_LINE); - actions.put("prev-page", PREV_PAGE); - actions.put("prev-word", PREV_WORD); - actions.put("select-prev-char", SELECT_PREV_CHAR); - actions.put("select-prev-line", SELECT_PREV_LINE); - actions.put("select-prev-page", SELECT_PREV_PAGE); - actions.put("select-prev-word", SELECT_PREV_WORD); - actions.put("repeat", REPEAT); - actions.put("toggle-rect", TOGGLE_RECT); - actions.put("insert-char", INSERT_CHAR); + save = new Save(scriptEditControl); + functionMenu = new FunctionMenu(scriptEditControl); + actions.put("backspace", backspace); + actions.put("backspace-word", backspaceWord); + actions.put("delete", delete); + actions.put("delete-word", deleteWord); + actions.put("end", end); + actions.put("select-end", selectEnd); + actions.put("document-end", documentEnd); + actions.put("select-doc-end", selectDocEnd); + actions.put("insert-break", insertBreak); + actions.put("insert-tab", insertTab); + actions.put("home", home); + actions.put("select-home", selectHome); + actions.put("document-home", documentHome); + actions.put("select-doc-home", selectDocHome); + actions.put("next-char", nextChar); + actions.put("next-line", nextLine); + actions.put("next-page", nextPage); + actions.put("next-word", nextWord); + actions.put("select-next-char", selectNextChar); + actions.put("select-next-line", selectNextLine); + actions.put("select-next-page", selectNextPage); + actions.put("select-next-word", selectNextWord); + actions.put("overwrite", overwrite); + actions.put("prev-char", prevChar); + actions.put("prev-line", prevLine); + actions.put("prev-page", prevPage); + actions.put("prev-word", prevWord); + actions.put("select-prev-char", selectPrevChar); + actions.put("select-prev-line", selectPrevLine); + actions.put("select-prev-page", selectPrevPage); + actions.put("select-prev-word", selectPrevWord); + actions.put("repeat", repeat); + actions.put("toggle-rect", toggleRect); + actions.put("insert-char", insertChar); actions.put("copy", Actions.COPY); actions.put("cut", Actions.CUT); actions.put("paste", Actions.PASTE); - actions.put("save", SAVE); + actions.put("save", save); actions.put("find", Actions.FIND); actions.put("find-again", Actions.FIND_AGAIN); actions.put("replace", Actions.REPLACE); Modified: trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-02-09 21:57:03 UTC (rev 7448) +++ trunk/src/test/net/sf/gridarta/model/archetypetype/ArchetypeTypeSetParserTest.java 2010-02-10 09:20:40 UTC (rev 7449) @@ -21,7 +21,6 @@ import java.io.ByteArrayInputStream; import java.io.File; -import java.io.InputStream; import java.io.UnsupportedEncodingException; import javax.xml.parsers.ParserConfigurationException; import net.sf.gridarta.model.archetype.TestArchetype; @@ -397,7 +396,7 @@ } /** - * Creates an {@link InputStream} from a <code>String</code>. + * Creates an {@link InputSource} from a <code>String</code>. * @param string the string to wrap * @return the input stream * @throws UnsupportedEncodingException if the input stream cannot be This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-18 13:20:54
|
Revision: 7539 http://gridarta.svn.sourceforge.net/gridarta/?rev=7539&view=rev Author: akirschbaum Date: 2010-04-18 13:20:48 +0000 (Sun, 18 Apr 2010) Log Message: ----------- Weaken types. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java trunk/src/app/net/sf/gridarta/model/map/mapmodel/InsertionModeSet.java trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java trunk/src/app/net/sf/gridarta/utils/StringUtils.java trunk/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java trunk/src/test/net/sf/gridarta/model/archetype/TestArchetypeBuilder.java trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2010-04-18 08:49:01 UTC (rev 7538) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/ToolSelector.java 2010-04-18 13:20:48 UTC (rev 7539) @@ -34,6 +34,7 @@ import javax.swing.ButtonGroup; import javax.swing.JPanel; import javax.swing.JToggleButton; +import net.sf.gridarta.gui.map.event.MouseOpListener; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareModel; @@ -202,7 +203,7 @@ * @return the currently selected tool. */ @NotNull - public Tool<G, A, R> getSelectedTool() { + public MouseOpListener<G, A, R> getSelectedTool() { return selectedTool; } Modified: trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java 2010-04-18 08:49:01 UTC (rev 7538) +++ trunk/src/app/net/sf/gridarta/gui/prefs/NetPrefs.java 2010-04-18 13:20:48 UTC (rev 7539) @@ -120,7 +120,7 @@ /** {@inheritDoc} */ @Override public void revert() { - final Proxy.Type keyType = Proxy.Type.valueOf(PREFS.get(NET_PREFS_KEY_TYPE, "DIRECT")); + final Enum<?> keyType = Proxy.Type.valueOf(PREFS.get(NET_PREFS_KEY_TYPE, "DIRECT")); proxyType.setSelectedIndex(keyType.ordinal()); final boolean enableProxy = keyType != Proxy.Type.DIRECT; proxyHost.setEnabled(enableProxy); Modified: trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java 2010-04-18 08:49:01 UTC (rev 7538) +++ trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserFolder.java 2010-04-18 13:20:48 UTC (rev 7539) @@ -19,6 +19,7 @@ package net.sf.gridarta.model.archetypechooser; +import java.util.Collection; import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -100,7 +101,7 @@ * @return the archetypes in no particular order */ @NotNull - public Set<Archetype<G, A, R>> getArchetypes() { + public Collection<Archetype<G, A, R>> getArchetypes() { return Collections.unmodifiableSet(archetypes); } Modified: trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2010-04-18 08:49:01 UTC (rev 7538) +++ trunk/src/app/net/sf/gridarta/model/archetypechooser/ArchetypeChooserModel.java 2010-04-18 13:20:48 UTC (rev 7539) @@ -110,7 +110,7 @@ * @return the panels ordered by panel name */ @NotNull - public List<ArchetypeChooserPanel<G, A, R>> getPanels() { + public Iterable<ArchetypeChooserPanel<G, A, R>> getPanels() { return Collections.unmodifiableList(panels); } Modified: trunk/src/app/net/sf/gridarta/model/map/mapmodel/InsertionModeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/model/map/mapmodel/InsertionModeSet.java 2010-04-18 08:49:01 UTC (rev 7538) +++ trunk/src/app/net/sf/gridarta/model/map/mapmodel/InsertionModeSet.java 2010-04-18 13:20:48 UTC (rev 7539) @@ -83,7 +83,7 @@ * @return the insertion mode */ @NotNull - public AutoInsertionMode<G, A, R> getAutoInsertionMode() { + public InsertionMode<G, A, R> getAutoInsertionMode() { return autoInsertionMode; } @@ -92,7 +92,7 @@ * @return the insertion mode */ @NotNull - public TopmostInsertionMode<G, A, R> getTopmostInsertionMode() { + public InsertionMode<G, A, R> getTopmostInsertionMode() { return topmostInsertionMode; } @@ -101,7 +101,7 @@ * @return the insertion mode */ @NotNull - public AboveFloorInsertionMode<G, A, R> getAboveFloorInsertionMode() { + public InsertionMode<G, A, R> getAboveFloorInsertionMode() { return aboveFloorInsertionMode; } @@ -110,7 +110,7 @@ * @return the insertion mode */ @NotNull - public BelowFloorInsertionMode<G, A, R> getBelowFloorInsertionMode() { + public InsertionMode<G, A, R> getBelowFloorInsertionMode() { return belowFloorInsertionMode; } @@ -119,7 +119,7 @@ * @return the insertion mode */ @NotNull - public BottommostInsertionMode<G, A, R> getBottommostInsertionMode() { + public InsertionMode<G, A, R> getBottommostInsertionMode() { return bottommostInsertionMode; } Modified: trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java 2010-04-18 08:49:01 UTC (rev 7538) +++ trunk/src/app/net/sf/gridarta/script/ScriptExecutor.java 2010-04-18 13:20:48 UTC (rev 7539) @@ -155,7 +155,7 @@ * @throws ScriptExecException if an error occurs */ @NotNull - public BshThread<G, A, R> doRunScript(@NotNull final Script<G, A, R> script, @NotNull final ConsoleInterface console) throws ScriptExecException { + public Thread doRunScript(@NotNull final Script<G, A, R> script, @NotNull final ConsoleInterface console) throws ScriptExecException { final Interpreter runner = new Interpreter(); runner.setConsole(console); try { Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2010-04-18 08:49:01 UTC (rev 7538) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2010-04-18 13:20:48 UTC (rev 7539) @@ -927,7 +927,7 @@ * @return the text, or null if the line is invalid */ @NotNull - public String getLineText(final int lineIndex) { + public CharSequence getLineText(final int lineIndex) { final int start = getLineStartOffset(lineIndex); return getText(start, getLineEndOffset(lineIndex) - start - 1); } Modified: trunk/src/app/net/sf/gridarta/utils/StringUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/utils/StringUtils.java 2010-04-18 08:49:01 UTC (rev 7538) +++ trunk/src/app/net/sf/gridarta/utils/StringUtils.java 2010-04-18 13:20:48 UTC (rev 7539) @@ -73,7 +73,7 @@ * @param str the input string * @return the string with a trailing newline character */ - public static String ensureTrailingNewline(final String str) { + public static CharSequence ensureTrailingNewline(final String str) { return str.length() <= 0 ? "" : str.endsWith("\n") ? str : str + "\n"; } Modified: trunk/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2010-04-18 08:49:01 UTC (rev 7538) +++ trunk/src/test/net/sf/gridarta/model/archetype/ArchetypeParserTest.java 2010-04-18 13:20:48 UTC (rev 7539) @@ -166,7 +166,7 @@ * Creates a new {@link TestArchetypeParser} instance. * @return the new instance */ - public TestArchetypeParser newArchetypeParser() { + public AbstractArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype, TestArchetypeBuilder> newArchetypeParser() { final TestScriptArchData scriptArchData = new TestScriptArchData(); final ArchFaceProvider archFaceProvider = new ArchFaceProvider(); final FaceObjects faceObjects = new DefaultFaceObjects("png", "facetree", Pattern.compile(".*"), "facetree.output", archFaceProvider); Modified: trunk/src/test/net/sf/gridarta/model/archetype/TestArchetypeBuilder.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/archetype/TestArchetypeBuilder.java 2010-04-18 08:49:01 UTC (rev 7538) +++ trunk/src/test/net/sf/gridarta/model/archetype/TestArchetypeBuilder.java 2010-04-18 13:20:48 UTC (rev 7539) @@ -19,8 +19,8 @@ package net.sf.gridarta.model.archetype; +import net.sf.gridarta.model.gameobject.GameObjectFactory; import net.sf.gridarta.model.gameobject.TestGameObject; -import net.sf.gridarta.model.gameobject.TestGameObjectFactory; import net.sf.gridarta.model.map.maparchobject.TestMapArchObject; import org.jetbrains.annotations.NotNull; @@ -35,7 +35,7 @@ * @param gameObjectFactory the game object factory for creating the new * archetype */ - public TestArchetypeBuilder(@NotNull final TestGameObjectFactory gameObjectFactory) { + public TestArchetypeBuilder(@NotNull final GameObjectFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectFactory) { super(gameObjectFactory); } Modified: trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-04-18 08:49:01 UTC (rev 7538) +++ trunk/src/test/net/sf/gridarta/model/map/mapmodel/DefaultMapModelTest.java 2010-04-18 13:20:48 UTC (rev 7539) @@ -319,7 +319,7 @@ final TestArchetype archetype = new TestArchetype("arch", faceObjectProviders, animationObjects); archetype.setIsArchetype(); assert animationObjects != null; - final TestArchetype archetype2 = new TestArchetype("arch2", faceObjectProviders, animationObjects); + final TestGameObject archetype2 = new TestArchetype("arch2", faceObjectProviders, animationObjects); archetype2.setIsArchetype(); archetype2.setMultiY(1); archetype.addTailPart(archetype2); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2010-04-23 18:13:02
|
Revision: 7582 http://gridarta.svn.sourceforge.net/gridarta/?rev=7582&view=rev Author: akirschbaum Date: 2010-04-23 18:12:55 +0000 (Fri, 23 Apr 2010) Log Message: ----------- Move MapViewBasic to different package. Modified Paths: -------------- trunk/src/app/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java trunk/src/app/net/sf/gridarta/mapfiles/MapFile.java trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java Modified: trunk/src/app/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java 2010-04-23 18:04:21 UTC (rev 7581) +++ trunk/src/app/net/sf/gridarta/gui/exitconnector/ExitConnectorController.java 2010-04-23 18:12:55 UTC (rev 7582) @@ -22,11 +22,11 @@ import java.awt.Point; import javax.swing.Action; import net.sf.gridarta.exitconnector.ExitConnectorActions; -import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.cursor.MapCursor; import net.sf.gridarta.gui.map.cursor.MapCursorEvent; import net.sf.gridarta.gui.map.cursor.MapCursorListener; import net.sf.gridarta.gui.map.mapview.MapView; +import net.sf.gridarta.gui.map.mapview.MapViewBasic; import net.sf.gridarta.gui.map.mapview.MapViewManager; import net.sf.gridarta.gui.map.mapview.MapViewManagerListener; import net.sf.gridarta.model.archetype.Archetype; Deleted: trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2010-04-23 18:04:21 UTC (rev 7581) +++ trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2010-04-23 18:12:55 UTC (rev 7582) @@ -1,327 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2010 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.map; - -import java.awt.Point; -import java.awt.Rectangle; -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import javax.swing.JScrollPane; -import javax.swing.JViewport; -import net.sf.gridarta.gui.map.cursor.MapCursor; -import net.sf.gridarta.gui.map.cursor.MapCursorEvent; -import net.sf.gridarta.gui.map.cursor.MapCursorListener; -import net.sf.gridarta.gui.map.renderer.AbstractLevelRenderer; -import net.sf.gridarta.gui.map.renderer.LevelRenderer; -import net.sf.gridarta.gui.map.renderer.RendererFactory; -import net.sf.gridarta.model.archetype.Archetype; -import net.sf.gridarta.model.baseobject.BaseObject; -import net.sf.gridarta.model.gameobject.GameObject; -import net.sf.gridarta.model.map.grid.MapGrid; -import net.sf.gridarta.model.map.maparchobject.MapArchObject; -import net.sf.gridarta.model.map.mapmodel.MapModel; -import net.sf.gridarta.model.map.mapmodel.MapModelListener; -import net.sf.gridarta.model.map.mapmodel.MapSquare; -import net.sf.gridarta.model.map.validation.ErrorCollector; -import net.sf.gridarta.model.map.validation.errors.ValidationError; -import net.sf.gridarta.utils.CommonConstants; -import net.sf.gridarta.utils.Size2D; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -/** - * MapViewBasic is a view for maps. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @author Andreas Kirschbaum - * @todo extending JScrollPane is not a good idea. - */ -public class MapViewBasic<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JScrollPane { - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1; - - /** - * The {@link MapModel} to display. - */ - @NotNull - private final MapModel<G, A, R> mapModel; - - /** - * The {@link MapGrid} of this view. - */ - @NotNull - private final MapGrid mapGrid; - - /** - * The {@link MapCursor} of this view. - */ - @NotNull - private final MapCursor mapCursor; - - /** - * The erroneous {@link MapSquare}s. - */ - @NotNull - private final Map<MapSquare<G, A, R>, ValidationError<G, A, R>> erroneousMapSquares = new HashMap<MapSquare<G, A, R>, ValidationError<G, A, R>>(); - - /** - * The erroneous {@link GameObject}s. - */ - @NotNull - private final Map<G, ValidationError<G, A, R>> erroneousArchObjects = new HashMap<G, ValidationError<G, A, R>>(); - - /** - * The {@link AbstractLevelRenderer} for rendering {@link #mapModel}. - */ - @NotNull - private final AbstractLevelRenderer<G, A, R> renderer; - - /** - * The {@link MapCursorListener} attached to {@link #mapCursor}. - */ - @NotNull - private final MapCursorListener mapCursorListener = new MapCursorListener() { - - /** {@inheritDoc} */ - @Override - public void mapCursorChangedPos(@NotNull final MapCursorEvent e) { - final MapCursor mapCursor = e.getSource(); - if (mapCursor.isActive()) { - final Rectangle rec = renderer.getSquareBounds(mapCursor.getLocation()); - renderer.scrollRectToVisible(rec); - } - } - - /** {@inheritDoc} */ - @Override - public void mapCursorChangedMode(@NotNull final MapCursorEvent e) { - // Ignore mode change events - } - - }; - - /** - * The {@link MapModelListener} attached to {@link #mapModel}. - */ - @NotNull - private final MapModelListener<G, A, R> mapModelListener = new MapModelListener<G, A, R>() { - - /** {@inheritDoc} */ - @Override - public void mapSizeChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Size2D newSize) { - getMapGrid().resize(newSize); - } - - /** {@inheritDoc} */ - @Override - public void mapSquaresChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Set<MapSquare<G, A, R>> mapSquares) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void mapObjectsChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Set<G> gameObjects, @NotNull final Set<G> transientGameObjects) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void errorsChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final ErrorCollector<G, A, R> errors) { - MapViewBasic.this.errorsChanged(errors); - } - - /** {@inheritDoc} */ - @Override - public void mapFileChanged(@Nullable final File oldMapFile) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void modifiedChanged(@NotNull final MapModel<G, A, R> mapModel) { - // ignore - } - - /** {@inheritDoc} */ - @Override - public void mapMetaChanged(@NotNull final MapArchObject<A> mapArchObject) { - // ignore - } - - }; - - /** - * Creates a new instance. - * @param mapModel the map model to use - * @param isPickmap whether the map model belongs to a pickmap - * @param initial the initial view position to show; null=show top left - * corner - * @param xScrollDistance the x distance when scrolling - * @param yScrollDistance the y distance when scrolling - * @param rendererFactory the renderer factory to use - */ - public MapViewBasic(@NotNull final MapModel<G, A, R> mapModel, final boolean isPickmap, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final RendererFactory<G, A, R> rendererFactory) { - super(VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); - this.mapModel = mapModel; - mapGrid = new MapGrid(this.mapModel.getMapSize()); - mapCursor = new MapCursor(mapGrid); - if (isPickmap) { - setBackground(CommonConstants.BG_COLOR); - } - - // set the pixel increment scrolling for clicking once on a scrollbar arrow - getVerticalScrollBar().setUnitIncrement(yScrollDistance); - getHorizontalScrollBar().setUnitIncrement(xScrollDistance); - - getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); - mapCursor.addMapCursorListener(mapCursorListener); - - renderer = isPickmap ? rendererFactory.newPickmapRenderer(mapModel, mapGrid) : rendererFactory.newMapRenderer(mapModel, mapGrid); - setViewportView(renderer); - if (initial != null) { - getViewport().setViewPosition(initial); - } - - mapModel.addMapModelListener(mapModelListener); - - renderer.setErroneousMapSquares(erroneousMapSquares); - renderer.setErroneousArchObjects(erroneousArchObjects); - renderer.setFocusable(true); - setFocusable(true); - } - - /** - * Returns the {@link MapGrid} of this view. - * @return the map grid of this view - */ - @NotNull - public MapGrid getMapGrid() { - return mapGrid; - } - - /** - * Returns the {@link MapCursor} of this view. - * @return the map cursor of this view - */ - @NotNull - public MapCursor getMapCursor() { - return mapCursor; - } - - /** - * Returns the selection. - * @return the selection - */ - @NotNull - public Point[] getSelection() { - final List<Point> selection = new ArrayList<Point>(); - final Size2D mapSize = mapModel.getMapSize(); - final Point pos = new Point(); - for (pos.x = 0; pos.x < mapSize.getWidth(); pos.x++) { - for (pos.y = 0; pos.y < mapSize.getHeight(); pos.y++) { - if ((mapGrid.getFlags(pos) & MapGrid.GRID_FLAG_SELECTION) > 0) { - selection.add((Point) pos.clone()); - } - } - } - return selection.toArray(new Point[selection.size()]); - } - - /** - * Returns the selected squares. - * @return the selected squares - */ - @NotNull - public List<MapSquare<G, A, R>> getSelectedSquares() { - final List<MapSquare<G, A, R>> selection = new ArrayList<MapSquare<G, A, R>>(); - final Size2D mapSize = mapModel.getMapSize(); - final Point pos = new Point(); - for (pos.x = 0; pos.x < mapSize.getWidth(); pos.x++) { - for (pos.y = 0; pos.y < mapSize.getHeight(); pos.y++) { - if ((mapGrid.getFlags(pos) & MapGrid.GRID_FLAG_SELECTION) > 0) { - selection.add(mapModel.getMapSquare(pos)); - } - } - } - return selection; - } - - /** - * Returns the cursor square. - * @return the cursor square or <code>null</code> if no current cursor - */ - @Nullable - public MapSquare<G, A, R> getCursorSquare() { - try { - return mapModel.getMapSquare(mapCursor.getLocation()); - } catch (final ArrayIndexOutOfBoundsException e) { - return null; - } - } - - /** - * Must be called when this renderer is not used anymore. It unregisters all - * listeners. - */ - public void closeNotify() { - renderer.closeNotify(); - mapCursor.removeMapCursorListener(mapCursorListener); - setViewportView(null); - mapModel.removeMapModelListener(mapModelListener); - } - - /** - * Returns the {@link LevelRenderer} for this view. - * @return the level renderer. - */ - @NotNull - public LevelRenderer getRenderer() { - return renderer; - } - - /** - * Updates the erroneous map squares. - * @param errors the errors to display - */ - private void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { - erroneousMapSquares.clear(); - erroneousArchObjects.clear(); - mapGrid.clearErrors(); - for (final ValidationError<G, A, R> validationError : errors.getErrors()) { - for (final MapSquare<G, A, R> mapSquare : validationError.getMapSquares()) { - erroneousMapSquares.put(mapSquare, validationError); - mapGrid.setError(mapSquare.getMapX(), mapSquare.getMapY()); - } - for (final G archObject : validationError.getGameObjects()) { - erroneousArchObjects.put(archObject, validationError); - final BaseObject<G, A, R, ?> topContainer = archObject.getTopContainer(); - mapGrid.setError(topContainer.getMapX(), topContainer.getMapY()); - } - } - renderer.repaint(); - } - -} // class MapViewBasic Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2010-04-23 18:04:21 UTC (rev 7581) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/DefaultMapViewFactory.java 2010-04-23 18:12:55 UTC (rev 7582) @@ -20,7 +20,6 @@ package net.sf.gridarta.gui.map.mapview; import java.awt.Point; -import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; Modified: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java 2010-04-23 18:04:21 UTC (rev 7581) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapView.java 2010-04-23 18:12:55 UTC (rev 7582) @@ -28,7 +28,6 @@ import java.util.List; import java.util.Set; import javax.swing.JInternalFrame; -import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.utils.MenuUtils; import net.sf.gridarta.model.archetype.Archetype; import net.sf.gridarta.model.gameobject.GameObject; Copied: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java (from rev 7578, trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java 2010-04-23 18:12:55 UTC (rev 7582) @@ -0,0 +1,327 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2010 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.map.mapview; + +import java.awt.Point; +import java.awt.Rectangle; +import java.io.File; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import javax.swing.JScrollPane; +import javax.swing.JViewport; +import net.sf.gridarta.gui.map.cursor.MapCursor; +import net.sf.gridarta.gui.map.cursor.MapCursorEvent; +import net.sf.gridarta.gui.map.cursor.MapCursorListener; +import net.sf.gridarta.gui.map.renderer.AbstractLevelRenderer; +import net.sf.gridarta.gui.map.renderer.LevelRenderer; +import net.sf.gridarta.gui.map.renderer.RendererFactory; +import net.sf.gridarta.model.archetype.Archetype; +import net.sf.gridarta.model.baseobject.BaseObject; +import net.sf.gridarta.model.gameobject.GameObject; +import net.sf.gridarta.model.map.grid.MapGrid; +import net.sf.gridarta.model.map.maparchobject.MapArchObject; +import net.sf.gridarta.model.map.mapmodel.MapModel; +import net.sf.gridarta.model.map.mapmodel.MapModelListener; +import net.sf.gridarta.model.map.mapmodel.MapSquare; +import net.sf.gridarta.model.map.validation.ErrorCollector; +import net.sf.gridarta.model.map.validation.errors.ValidationError; +import net.sf.gridarta.utils.CommonConstants; +import net.sf.gridarta.utils.Size2D; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +/** + * MapViewBasic is a view for maps. + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @author Andreas Kirschbaum + * @todo extending JScrollPane is not a good idea. + */ +public class MapViewBasic<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends JScrollPane { + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1; + + /** + * The {@link MapModel} to display. + */ + @NotNull + private final MapModel<G, A, R> mapModel; + + /** + * The {@link MapGrid} of this view. + */ + @NotNull + private final MapGrid mapGrid; + + /** + * The {@link MapCursor} of this view. + */ + @NotNull + private final MapCursor mapCursor; + + /** + * The erroneous {@link MapSquare}s. + */ + @NotNull + private final Map<MapSquare<G, A, R>, ValidationError<G, A, R>> erroneousMapSquares = new HashMap<MapSquare<G, A, R>, ValidationError<G, A, R>>(); + + /** + * The erroneous {@link GameObject}s. + */ + @NotNull + private final Map<G, ValidationError<G, A, R>> erroneousArchObjects = new HashMap<G, ValidationError<G, A, R>>(); + + /** + * The {@link AbstractLevelRenderer} for rendering {@link #mapModel}. + */ + @NotNull + private final AbstractLevelRenderer<G, A, R> renderer; + + /** + * The {@link MapCursorListener} attached to {@link #mapCursor}. + */ + @NotNull + private final MapCursorListener mapCursorListener = new MapCursorListener() { + + /** {@inheritDoc} */ + @Override + public void mapCursorChangedPos(@NotNull final MapCursorEvent e) { + final MapCursor mapCursor = e.getSource(); + if (mapCursor.isActive()) { + final Rectangle rec = renderer.getSquareBounds(mapCursor.getLocation()); + renderer.scrollRectToVisible(rec); + } + } + + /** {@inheritDoc} */ + @Override + public void mapCursorChangedMode(@NotNull final MapCursorEvent e) { + // Ignore mode change events + } + + }; + + /** + * The {@link MapModelListener} attached to {@link #mapModel}. + */ + @NotNull + private final MapModelListener<G, A, R> mapModelListener = new MapModelListener<G, A, R>() { + + /** {@inheritDoc} */ + @Override + public void mapSizeChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Size2D newSize) { + getMapGrid().resize(newSize); + } + + /** {@inheritDoc} */ + @Override + public void mapSquaresChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Set<MapSquare<G, A, R>> mapSquares) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void mapObjectsChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final Set<G> gameObjects, @NotNull final Set<G> transientGameObjects) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void errorsChanged(@NotNull final MapModel<G, A, R> mapModel, @NotNull final ErrorCollector<G, A, R> errors) { + MapViewBasic.this.errorsChanged(errors); + } + + /** {@inheritDoc} */ + @Override + public void mapFileChanged(@Nullable final File oldMapFile) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void modifiedChanged(@NotNull final MapModel<G, A, R> mapModel) { + // ignore + } + + /** {@inheritDoc} */ + @Override + public void mapMetaChanged(@NotNull final MapArchObject<A> mapArchObject) { + // ignore + } + + }; + + /** + * Creates a new instance. + * @param mapModel the map model to use + * @param isPickmap whether the map model belongs to a pickmap + * @param initial the initial view position to show; null=show top left + * corner + * @param xScrollDistance the x distance when scrolling + * @param yScrollDistance the y distance when scrolling + * @param rendererFactory the renderer factory to use + */ + public MapViewBasic(@NotNull final MapModel<G, A, R> mapModel, final boolean isPickmap, @Nullable final Point initial, final int xScrollDistance, final int yScrollDistance, @NotNull final RendererFactory<G, A, R> rendererFactory) { + super(VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); + this.mapModel = mapModel; + mapGrid = new MapGrid(this.mapModel.getMapSize()); + mapCursor = new MapCursor(mapGrid); + if (isPickmap) { + setBackground(CommonConstants.BG_COLOR); + } + + // set the pixel increment scrolling for clicking once on a scrollbar arrow + getVerticalScrollBar().setUnitIncrement(yScrollDistance); + getHorizontalScrollBar().setUnitIncrement(xScrollDistance); + + getViewport().setScrollMode(JViewport.SIMPLE_SCROLL_MODE); + mapCursor.addMapCursorListener(mapCursorListener); + + renderer = isPickmap ? rendererFactory.newPickmapRenderer(mapModel, mapGrid) : rendererFactory.newMapRenderer(mapModel, mapGrid); + setViewportView(renderer); + if (initial != null) { + getViewport().setViewPosition(initial); + } + + mapModel.addMapModelListener(mapModelListener); + + renderer.setErroneousMapSquares(erroneousMapSquares); + renderer.setErroneousArchObjects(erroneousArchObjects); + renderer.setFocusable(true); + setFocusable(true); + } + + /** + * Returns the {@link MapGrid} of this view. + * @return the map grid of this view + */ + @NotNull + public MapGrid getMapGrid() { + return mapGrid; + } + + /** + * Returns the {@link MapCursor} of this view. + * @return the map cursor of this view + */ + @NotNull + public MapCursor getMapCursor() { + return mapCursor; + } + + /** + * Returns the selection. + * @return the selection + */ + @NotNull + public Point[] getSelection() { + final List<Point> selection = new ArrayList<Point>(); + final Size2D mapSize = mapModel.getMapSize(); + final Point pos = new Point(); + for (pos.x = 0; pos.x < mapSize.getWidth(); pos.x++) { + for (pos.y = 0; pos.y < mapSize.getHeight(); pos.y++) { + if ((mapGrid.getFlags(pos) & MapGrid.GRID_FLAG_SELECTION) > 0) { + selection.add((Point) pos.clone()); + } + } + } + return selection.toArray(new Point[selection.size()]); + } + + /** + * Returns the selected squares. + * @return the selected squares + */ + @NotNull + public List<MapSquare<G, A, R>> getSelectedSquares() { + final List<MapSquare<G, A, R>> selection = new ArrayList<MapSquare<G, A, R>>(); + final Size2D mapSize = mapModel.getMapSize(); + final Point pos = new Point(); + for (pos.x = 0; pos.x < mapSize.getWidth(); pos.x++) { + for (pos.y = 0; pos.y < mapSize.getHeight(); pos.y++) { + if ((mapGrid.getFlags(pos) & MapGrid.GRID_FLAG_SELECTION) > 0) { + selection.add(mapModel.getMapSquare(pos)); + } + } + } + return selection; + } + + /** + * Returns the cursor square. + * @return the cursor square or <code>null</code> if no current cursor + */ + @Nullable + public MapSquare<G, A, R> getCursorSquare() { + try { + return mapModel.getMapSquare(mapCursor.getLocation()); + } catch (final ArrayIndexOutOfBoundsException e) { + return null; + } + } + + /** + * Must be called when this renderer is not used anymore. It unregisters all + * listeners. + */ + public void closeNotify() { + renderer.closeNotify(); + mapCursor.removeMapCursorListener(mapCursorListener); + setViewportView(null); + mapModel.removeMapModelListener(mapModelListener); + } + + /** + * Returns the {@link LevelRenderer} for this view. + * @return the level renderer. + */ + @NotNull + public LevelRenderer getRenderer() { + return renderer; + } + + /** + * Updates the erroneous map squares. + * @param errors the errors to display + */ + private void errorsChanged(@NotNull final ErrorCollector<G, A, R> errors) { + erroneousMapSquares.clear(); + erroneousArchObjects.clear(); + mapGrid.clearErrors(); + for (final ValidationError<G, A, R> validationError : errors.getErrors()) { + for (final MapSquare<G, A, R> mapSquare : validationError.getMapSquares()) { + erroneousMapSquares.put(mapSquare, validationError); + mapGrid.setError(mapSquare.getMapX(), mapSquare.getMapY()); + } + for (final G archObject : validationError.getGameObjects()) { + erroneousArchObjects.put(archObject, validationError); + final BaseObject<G, A, R, ?> topContainer = archObject.getTopContainer(); + mapGrid.setError(topContainer.getMapX(), topContainer.getMapY()); + } + } + renderer.repaint(); + } + +} // class MapViewBasic Property changes on: trunk/src/app/net/sf/gridarta/gui/map/mapview/MapViewBasic.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-04-23 18:04:21 UTC (rev 7581) +++ trunk/src/app/net/sf/gridarta/gui/objectchooser/DefaultObjectChooser.java 2010-04-23 18:12:55 UTC (rev 7582) @@ -30,10 +30,10 @@ import javax.swing.SwingConstants; import javax.swing.event.ChangeEvent; import javax.swing.event.ChangeListener; -import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.cursor.MapCursor; import net.sf.gridarta.gui.map.cursor.MapCursorEvent; import net.sf.gridarta.gui.map.cursor.MapCursorListener; +import net.sf.gridarta.gui.map.mapview.MapViewBasic; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserModel; import net.sf.gridarta.gui.pickmapchooser.PickmapChooserModelListener; import net.sf.gridarta.mapfiles.MapFile; Modified: trunk/src/app/net/sf/gridarta/mapfiles/MapFile.java =================================================================== --- trunk/src/app/net/sf/gridarta/mapfiles/MapFile.java 2010-04-23 18:04:21 UTC (rev 7581) +++ trunk/src/app/net/sf/gridarta/mapfiles/MapFile.java 2010-04-23 18:12:55 UTC (rev 7582) @@ -22,8 +22,8 @@ import java.io.File; import java.io.IOException; import java.util.Collection; -import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.mapview.MapView; +import net.sf.gridarta.gui.map.mapview.MapViewBasic; import net.sf.gridarta.gui.map.mapview.MapViewsManager; import net.sf.gridarta.mapmanager.MapManager; import net.sf.gridarta.model.archetype.Archetype; Modified: trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java =================================================================== --- trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2010-04-23 18:04:21 UTC (rev 7581) +++ trunk/src/test/net/sf/gridarta/gui/map/mapview/TestMapViewFactory.java 2010-04-23 18:12:55 UTC (rev 7582) @@ -20,7 +20,6 @@ package net.sf.gridarta.gui.map.mapview; import java.awt.Point; -import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.renderer.RendererFactory; import net.sf.gridarta.model.archetype.TestArchetype; import net.sf.gridarta.model.gameobject.TestGameObject; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |