From: <aki...@us...> - 2008-07-25 20:13:39
|
Revision: 4435 http://gridarta.svn.sourceforge.net/gridarta/?rev=4435&view=rev Author: akirschbaum Date: 2008-07-25 20:13:47 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Convert fields into local variables. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-25 20:09:14 UTC (rev 4434) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-25 20:13:47 UTC (rev 4435) @@ -151,9 +151,6 @@ /** Preferences default value for using System.exit(). */ public static final boolean PREFS_SYSTEM_EXIT_DEFAULT = true; - /** The map manager actions. */ - private final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions; - private final MapActions mapActions; /** The object chooser. */ @@ -165,10 +162,6 @@ /** The main view. */ private final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView; - /** The undo control. */ - @NotNull - private final UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic> undoControl; - private final ArchetypeParser archetypeParser; /** The Animation Objects. */ @@ -186,8 +179,6 @@ /** The ArchetypeSet, which is a registry of all Archetypes. */ private final ArchetypeSet archetypeSet; - private final NamedFilterList defaultNamedFilterList; - /** The current script controller. */ private final ScriptController scriptControl; @@ -213,9 +204,6 @@ /** The treasure lists. */ private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; - /** The auto-validator. */ - private final AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic> autoValidator; - /** The filter control. */ private final CFilterControl filterControl; @@ -237,7 +225,7 @@ final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = selectedSquareControl.getSelectedSquareView(); mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, getMapManager(), selectedSquareControl, selectedSquareView); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); - mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); + final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); globalSettings.readGlobalSettings(); PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, false); @@ -249,7 +237,7 @@ getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("cfeditor", mainView); - undoControl = new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); + new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("cfeditor", this, mainView, "CrossfireEditor.jar"); updaterManager.startup(); @@ -336,7 +324,7 @@ // browse arch archive // load object from a arch file you found - defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); + final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); filterControl = new CFilterControl(null, this, defaultNamedFilterList); final JMenu menuAnalyze = (JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "analyze"); if (menuAnalyze != null) { @@ -377,7 +365,7 @@ ); recentManager.initRecent(); validators = createMapValidators(); - autoValidator = new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); + new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); } /** Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-25 20:09:14 UTC (rev 4434) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-25 20:13:47 UTC (rev 4435) @@ -189,9 +189,6 @@ /** Preferences default value for editor application. */ public static final String PREFS_APP_EDITOR_DEFAULT = "vim"; - /** The map manager actions. */ - private final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions; - private final MapActions mapActions; /** The object chooser. */ @@ -203,10 +200,6 @@ /** The main view. */ private final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView; - /** The undo control. */ - @NotNull - private final UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic> undoControl; - /** Bit field of edit types to show transparent. */ private int alphaType; @@ -270,9 +263,6 @@ /** The treasure lists. */ private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; - /** The auto-validator. */ - private final AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic> autoValidator; - /** The factory for creating new maps or pickmaps. */ private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; @@ -292,7 +282,7 @@ ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "controlServer", "controlClient", "cleanCompletelyBlockedSquares", "zoom", "gc", "onlineHelp", "tod", "about"); ACTION_FACTORY.createToggles(true, this, "drawDouble"); ACTION_FACTORY.createAction(true, "collectSpells", this); - mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); + final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); globalSettings.readGlobalSettings(); PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, true); @@ -304,7 +294,7 @@ getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("daieditor", mainView); - undoControl = new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); + new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); updaterManager = new UpdaterManager("daieditor", this, mainView, "DaimoninEditor.jar"); updaterManager.startup(); @@ -450,7 +440,7 @@ ); recentManager.initRecent(); validators = createMapValidators(); - autoValidator = new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); + new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-25 20:21:58
|
Revision: 4437 http://gridarta.svn.sourceforge.net/gridarta/?rev=4437&view=rev Author: akirschbaum Date: 2008-07-25 20:22:05 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-25 20:18:41 UTC (rev 4436) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-25 20:22:05 UTC (rev 4437) @@ -117,13 +117,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, selectedSquareView); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, selectedSquareView); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-25 20:18:41 UTC (rev 4436) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-25 20:22:05 UTC (rev 4437) @@ -120,13 +120,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, selectedSquareView); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl, selectedSquareView); + final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); mapArchObject.setDifficulty(1); return mapControl; } Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-25 20:18:41 UTC (rev 4436) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-07-25 20:22:05 UTC (rev 4437) @@ -39,7 +39,6 @@ import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapWriter; import net.sf.gridarta.io.MapWriter; import net.sf.japi.swing.ActionFactory; @@ -80,9 +79,6 @@ /** Flag that indicates whether this is a pickmap or not. */ private final boolean isPickmap; - /** The selected square view. */ - private final SelectedSquareView<G, A, R, V> selectedSquareView; - /** The map data of this level. */ private final MapModel<G, A, R> mapModel; @@ -153,13 +149,11 @@ * @param isPickmap true if this is a pickmap * @param exitTypeGameObjectMatcher the matcher to select exit objects * @param archetypeChooserControl the archeype chooser control to use - * @param selectedSquareView the selected square view */ - public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MainControl<G, A, R, V> mainControl, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { + public DefaultMapControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MainControl<G, A, R, V> mainControl, @Nullable final List<G> objects, @NotNull final A mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl) { this.gridartaObjectsFactory = gridartaObjectsFactory; this.mainControl = mainControl; this.isPickmap = isPickmap; - this.selectedSquareView = selectedSquareView; // we create model (= data) mapModel = new DefaultMapModel<G, A, R>(mainControl, this, objects, mapArchObject, exitTypeGameObjectMatcher, archetypeChooserControl); mapModel.addMapModelListener(mapModelListener); Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-25 20:18:41 UTC (rev 4436) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-25 20:22:05 UTC (rev 4437) @@ -22,11 +22,9 @@ import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; -import java.io.IOException; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; -import javax.swing.ImageIcon; import javax.swing.JList; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.AbstractMainControl; @@ -35,8 +33,6 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.Size2D; -import net.sf.gridarta.gameobject.AbstractArchetypeParser; -import net.sf.gridarta.gameobject.AbstractArchetypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.ArchetypeSet; @@ -52,7 +48,6 @@ import net.sf.gridarta.gui.map.LevelRenderer; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.gui.selectedsquare.SelectedSquareControl; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.io.MapArchObjectParser; @@ -70,8 +65,6 @@ import net.sf.gridarta.spells.GameObjectSpell; import net.sf.gridarta.spells.NumberSpell; import net.sf.gridarta.spells.Spells; -import net.sf.japi.swing.ActionFactory; -import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.Assert; @@ -378,14 +371,11 @@ */ @Before public void setUp() { - final ActionFactory actionFactory = ActionFactory.getFactory("test"); gridartaObjectsFactory = new TestGridartaObjectsFactory(); final TestMainControl mainControl = new TestMainControl(gridartaObjectsFactory, "test"); - final ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); - final SelectedSquareControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareControl = new SelectedSquareControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(actionFactory, mainControl, true, null, archetypeSet); final TestMapArchObject mapArchObject = new TestMapArchObject(); final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, false); - final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, mainControl, null, mapArchObject, false, null, archetypeChooserControl, selectedSquareControl.getSelectedSquareView()); + final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, mainControl, null, mapArchObject, false, null, archetypeChooserControl); mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(mainControl, mapControl, null, mapArchObject, null, archetypeChooserControl); result.setLength(0); @@ -540,10 +530,9 @@ * @param isPickmap whether this map control is a pickmap * @param exitTypeGameObjectMatcher the exit matcher to use * @param archetypeChooserControl the archetype chooser control to use - * @param selectedSquareView the selected square view to use */ - public TestMapControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView) { - super(gridartaObjectsFactory, mainControl, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl, selectedSquareView); + public TestMapControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @Nullable final List<TestGameObject> objects, @NotNull final TestMapArchObject mapArchObject, final boolean isPickmap, @Nullable final GameObjectMatcher exitTypeGameObjectMatcher, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl) { + super(gridartaObjectsFactory, mainControl, objects, mapArchObject, isPickmap, exitTypeGameObjectMatcher, archetypeChooserControl); } } @@ -937,41 +926,4 @@ } } - /** - * An {@link ArchetypeSet} implementation for testing purposes. - */ - private static class TestArchetypeSet extends AbstractArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> { - - /** - * Creates a new instance. - * @param gridartaObjectsFactory the gridarta objects factory to use - */ - private TestArchetypeSet(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, ?> gridartaObjectsFactory) { - super(gridartaObjectsFactory); - } - - /** {@inheritDoc} */ - public void loadArchetypes(@NotNull final AbstractArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeAbstractArchetypeParser) { - throw new AssertionError(); - } - - /** {@inheritDoc} */ - @NotNull - public ImageIcon getFace(@NotNull final TestArchetype archetype) { - throw new AssertionError(); - } - - /** {@inheritDoc} */ - @NotNull - public ImageIcon getFace(@NotNull final TestGameObject gameObject) { - throw new AssertionError(); - } - - /** {@inheritDoc} */ - public void collect(@NotNull final Progress progress, @NotNull final File dir) throws IOException { - throw new AssertionError(); - } - - } - } // class DefaultMapModelTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-25 20:38:53
|
Revision: 4441 http://gridarta.svn.sourceforge.net/gridarta/?rev=4441&view=rev Author: akirschbaum Date: 2008-07-25 20:39:01 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Add private constructors to utility classes. Modified Paths: -------------- trunk/crossfire/src/cfeditor/ResourceFileManager.java trunk/daimonin/src/daieditor/ResourceFileManager.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java trunk/src/app/net/sf/gridarta/spells/XMLSpellLoader.java Modified: trunk/crossfire/src/cfeditor/ResourceFileManager.java =================================================================== --- trunk/crossfire/src/cfeditor/ResourceFileManager.java 2008-07-25 20:37:10 UTC (rev 4440) +++ trunk/crossfire/src/cfeditor/ResourceFileManager.java 2008-07-25 20:39:01 UTC (rev 4441) @@ -37,4 +37,10 @@ public static final String DEFAULT_SCRIPT_DIR = "script"; + /** + * Private constructor to prevent instantiation. + */ + private ResourceFileManager() { + } + } // class ResourceFileManager Modified: trunk/daimonin/src/daieditor/ResourceFileManager.java =================================================================== --- trunk/daimonin/src/daieditor/ResourceFileManager.java 2008-07-25 20:37:10 UTC (rev 4440) +++ trunk/daimonin/src/daieditor/ResourceFileManager.java 2008-07-25 20:39:01 UTC (rev 4441) @@ -41,4 +41,10 @@ public static final String DEFAULT_MEDIA_DIR = "../client/media"; + /** + * Private constructor to prevent instantiation. + */ + private ResourceFileManager() { + } + } // class ResourceFileManager Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-07-25 20:37:10 UTC (rev 4440) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptedEventEditor.java 2008-07-25 20:39:01 UTC (rev 4441) @@ -57,6 +57,12 @@ private static JDialog pathFrame; /** + * Private constructor to prevent instantiation. + */ + private ScriptedEventEditor() { + } + + /** * Opens the script pad to display a script. * @param scriptPath the script path */ Modified: trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java 2008-07-25 20:37:10 UTC (rev 4440) +++ trunk/src/app/net/sf/gridarta/gui/ReplaceDialogManager.java 2008-07-25 20:39:01 UTC (rev 4441) @@ -13,6 +13,12 @@ private static ReplaceDialog<?, ?, ?, ?> instance = null; /** + * Private constructor to prevent instantiation. + */ + private ReplaceDialogManager() { + } + + /** * Returns whether this frame has been fully built. * @return <code>true</code> if this frame has been fully built, otherwise * <code>false</code> Modified: trunk/src/app/net/sf/gridarta/spells/XMLSpellLoader.java =================================================================== --- trunk/src/app/net/sf/gridarta/spells/XMLSpellLoader.java 2008-07-25 20:37:10 UTC (rev 4440) +++ trunk/src/app/net/sf/gridarta/spells/XMLSpellLoader.java 2008-07-25 20:39:01 UTC (rev 4441) @@ -39,6 +39,12 @@ private static final Logger log = Logger.getLogger(XMLSpellLoader.class); /** + * Private constructor to prevent instantiation. + */ + private XMLSpellLoader() { + } + + /** * Load an XML spell definitions file. * @param baseDir The base directory of <code>filename</code>. * @param filename The file name of the spell definitions file. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-25 20:40:21
|
Revision: 4442 http://gridarta.svn.sourceforge.net/gridarta/?rev=4442&view=rev Author: akirschbaum Date: 2008-07-25 20:40:28 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Remove redundant implements clauses. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-07-25 20:39:01 UTC (rev 4441) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-07-25 20:40:28 UTC (rev 4442) @@ -21,7 +21,6 @@ import cfeditor.gameobject.scripts.ScriptArchData; import cfeditor.map.MapArchObject; -import java.io.Serializable; import javax.swing.JList; import net.sf.gridarta.gameobject.scripts.AbstractScriptArchEditor; import net.sf.gridarta.gui.GameObjectAttributesPanel; @@ -45,7 +44,7 @@ * see also {@link net.sf.gridarta.gameobject.GameObjectContainer} for issues * about this */ -public class GameObject extends net.sf.gridarta.gameobject.GameObject<GameObject, MapArchObject, Archetype> implements Archetype, Cloneable, Serializable { +public class GameObject extends net.sf.gridarta.gameobject.GameObject<GameObject, MapArchObject, Archetype> implements Archetype, Cloneable { /** The serial version UID. */ private static final long serialVersionUID = 1; Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java 2008-07-25 20:39:01 UTC (rev 4441) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java 2008-07-25 20:40:28 UTC (rev 4442) @@ -19,7 +19,6 @@ package cfeditor.gameobject.anim; -import java.io.Serializable; import javax.swing.ImageIcon; import net.sf.gridarta.gameobject.anim.AbstractAnimationObject; import org.jetbrains.annotations.Nullable; @@ -31,7 +30,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public final class AnimationObject extends AbstractAnimationObject implements Serializable { +public final class AnimationObject extends AbstractAnimationObject { /** Serial Version. */ private static final long serialVersionUID = 1L; Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-07-25 20:39:01 UTC (rev 4441) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-07-25 20:40:28 UTC (rev 4442) @@ -23,7 +23,6 @@ import daieditor.gameobject.anim.AnimationObject; import daieditor.gameobject.scripts.ScriptArchData; import daieditor.map.MapArchObject; -import java.io.Serializable; import javax.swing.ImageIcon; import javax.swing.JList; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -48,7 +47,7 @@ * see also {@link net.sf.gridarta.gameobject.GameObjectContainer} for issues * about this */ -public class GameObject extends net.sf.gridarta.gameobject.GameObject<GameObject, MapArchObject, Archetype> implements Archetype, Cloneable, Serializable { +public class GameObject extends net.sf.gridarta.gameobject.GameObject<GameObject, MapArchObject, Archetype> implements Archetype, Cloneable { /** The serial version UID. */ private static final long serialVersionUID = 1; Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java 2008-07-25 20:39:01 UTC (rev 4441) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java 2008-07-25 20:40:28 UTC (rev 4442) @@ -19,7 +19,6 @@ package daieditor.gameobject.anim; -import java.io.Serializable; import java.util.ArrayList; import java.util.List; import javax.swing.ImageIcon; @@ -34,7 +33,7 @@ * @author <a href="mailto:mic...@no...">Michael Toennies</a> * @author <a href="mailto:ch...@ri...">Christian Hujer</a> */ -public final class AnimationObject extends AbstractAnimationObject implements Serializable { +public final class AnimationObject extends AbstractAnimationObject { /** Serial Version. */ private static final long serialVersionUID = 1L; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-25 20:46:18
|
Revision: 4443 http://gridarta.svn.sourceforge.net/gridarta/?rev=4443&view=rev Author: akirschbaum Date: 2008-07-25 20:46:25 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Declare variables more local. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java trunk/src/app/net/sf/gridarta/MapImageCache.java trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java trunk/src/app/net/sf/gridarta/spells/XMLSpellLoader.java trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-07-25 20:40:28 UTC (rev 4442) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeParser.java 2008-07-25 20:46:25 UTC (rev 4443) @@ -90,7 +90,6 @@ public void parseArchetypeFromStream(final BufferedReader in, @Nullable final GameObject prototype, @Nullable final String line, @Nullable final String archName, @NotNull final String panelName, @NotNull final String folderName, final String fname, @NotNull final List<GameObject> invObjects) throws IOException { // start with new clean GameObject instance @Nullable GameObject archetype; - GameObject archlast = null; if (prototype == null) { archetype = new GameObject(); } else { @@ -130,6 +129,7 @@ @Nullable String editorFolder = null; @Nullable StringBuilder animText = null; @Nullable StringBuilder loreText = null; + GameObject archlast = null; while (thisLine2 != null) { final String thisLine = thisLine2.trim(); Modified: trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-07-25 20:40:28 UTC (rev 4442) +++ trunk/crossfire/src/cfeditor/gameobject/face/FaceObjects.java 2008-07-25 20:46:25 UTC (rev 4443) @@ -66,7 +66,6 @@ final File tmpFaceFile = makeTmpFaceFile(faceFile); FaceObjectProviders.setNormal(new CollectedFaceProvider(tmpFaceFile)); final String actualFilename = tmpFaceFile.toString(); - final byte[] data; final InputStream inputStream = new FileInputStream(tmpFaceFile); final ByteArrayOutputStream bufOut = new ByteArrayOutputStream((int) tmpFaceFile.length()); try { @@ -81,7 +80,7 @@ } finally { inputStream.close(); } - data = bufOut.toByteArray(); + final byte[] data = bufOut.toByteArray(); // Note: treeIn might stay null, this is optional data. BufferedReader treeIn = null; Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-07-25 20:40:28 UTC (rev 4442) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeParser.java 2008-07-25 20:46:25 UTC (rev 4443) @@ -92,7 +92,6 @@ public void parseArchetypeFromStream(final BufferedReader in, @Nullable final GameObject prototype, @Nullable final String line, @Nullable final String archName, @NotNull final String panelName, @NotNull final String folderName, final String fname, @NotNull final List<GameObject> invObjects) throws IOException { // start with new clean GameObject instance @Nullable GameObject archetype; - GameObject archlast = null; if (prototype == null) { archetype = new GameObject(); } else { @@ -132,6 +131,7 @@ @Nullable StringBuilder animText = null; int multiShapeID = 0; + GameObject archlast = null; while (thisLine2 != null) { final String thisLine = thisLine2.trim(); Modified: trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-07-25 20:40:28 UTC (rev 4442) +++ trunk/daimonin/src/daieditor/gameobject/face/FaceObjects.java 2008-07-25 20:46:25 UTC (rev 4443) @@ -63,7 +63,6 @@ public void loadFacesCollection(final File faceFile, final File treeFile) throws IOException, FileNotFoundException, DuplicateFaceException { FaceObjectProviders.setNormal(new CollectedFaceProvider(faceFile)); final String actualFilename = faceFile.toString(); - final byte[] data; final InputStream inputStream = new FileInputStream(faceFile); final ByteArrayOutputStream bufOut = new ByteArrayOutputStream((int) faceFile.length()); try { @@ -78,7 +77,7 @@ } finally { inputStream.close(); } - data = bufOut.toByteArray(); + final byte[] data = bufOut.toByteArray(); // Note: treeIn might stay null, this is optional data. BufferedReader treeIn = null; Modified: trunk/src/app/net/sf/gridarta/MapImageCache.java =================================================================== --- trunk/src/app/net/sf/gridarta/MapImageCache.java 2008-07-25 20:40:28 UTC (rev 4442) +++ trunk/src/app/net/sf/gridarta/MapImageCache.java 2008-07-25 20:46:25 UTC (rev 4443) @@ -269,11 +269,9 @@ */ @NotNull public ImageIcon updateCaches(@Nullable final File mapFile, @NotNull final MapControl<G, A, R, V> mapControl, final Type type) { - final BufferedImage fullImage; final ImageIcon[] images = new ImageIcon[2]; try { - fullImage = mapControl.getRenderer().getFullImage(); - createImages(fullImage, images); + createImages(mapControl.getRenderer().getFullImage(), images); } catch (final OutOfMemoryError ex) { return defaultImages.get(type); } Modified: trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2008-07-25 20:40:28 UTC (rev 4442) +++ trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2008-07-25 20:46:25 UTC (rev 4443) @@ -244,9 +244,9 @@ final List<G> gameObjectsToDelete = new LinkedList<G>(); final Point prevPos = new Point(pos.x + dx, pos.y + dy); final Point startPos = new Point(); - boolean isStart = true; final boolean startSelection = (mapGrid.getFlags(prevPos) & MapGrid.GRID_FLAG_SELECTION) > 0; assert !startSelection; + boolean isStart = true; for (int i = 0; i < len; i++) { final boolean thisSelection = (mapGrid.getFlags(pos) & MapGrid.GRID_FLAG_SELECTION) > 0; mapGrid.select(prevPos, prevPos, thisSelection ? MapGrid.SelectionMode.ADD : MapGrid.SelectionMode.SUB); Modified: trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java 2008-07-25 20:40:28 UTC (rev 4442) +++ trunk/src/app/net/sf/gridarta/gui/pickmapchooser/Loader.java 2008-07-25 20:46:25 UTC (rev 4443) @@ -99,9 +99,8 @@ return null; } - Folder<G, A, R, V> result = null; - Arrays.sort(files); + Folder<G, A, R, V> result = null; for (final File file : files) { if (file.isFile()) { try { Modified: trunk/src/app/net/sf/gridarta/spells/XMLSpellLoader.java =================================================================== --- trunk/src/app/net/sf/gridarta/spells/XMLSpellLoader.java 2008-07-25 20:40:28 UTC (rev 4442) +++ trunk/src/app/net/sf/gridarta/spells/XMLSpellLoader.java 2008-07-25 20:46:25 UTC (rev 4443) @@ -56,14 +56,13 @@ // parse xml document final Document doc = documentBuilder.parse(IOUtils.getResourceURLAsString(baseDir, filename)); - int numSpells = 0; - // retrieve the spell data from the xml final Element root = doc.getDocumentElement(); if (root == null || !"spells".equalsIgnoreCase(root.getNodeName())) { log.warn("File '" + filename + "' lacks root element 'spells'."); } else { // initialize array with appropriate size + int numSpells = 0; for (final Element spellElem : new NodeListIterator<Element>(root, "spell")) { if (spellElem.getAttribute("id") == null) { Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2008-07-25 20:40:28 UTC (rev 4442) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2008-07-25 20:46:25 UTC (rev 4443) @@ -1605,14 +1605,13 @@ final int length = e.getLength(); final int newStart; - final int newEnd; - if (selectionStart > offset || (selectionStart == selectionEnd && selectionStart == offset)) { newStart = selectionStart + length; } else { newStart = selectionStart; } + final int newEnd; if (selectionEnd >= offset) { newEnd = selectionEnd + length; } else { @@ -1630,8 +1629,6 @@ final int length = e.getLength(); final int newStart; - final int newEnd; - if (selectionStart > offset) { if (selectionStart > offset + length) { newStart = selectionStart - length; @@ -1642,6 +1639,7 @@ newStart = selectionStart; } + final int newEnd; if (selectionEnd > offset) { if (selectionEnd > offset + length) { newEnd = selectionEnd - length; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-25 21:01:02
|
Revision: 4446 http://gridarta.svn.sourceforge.net/gridarta/?rev=4446&view=rev Author: akirschbaum Date: 2008-07-25 21:01:08 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Extract singleton instance handling into CMainControlInstance. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptedEvent.java trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBox.java trunk/crossfire/src/cfeditor/gui/script/parameter/MapParameterView.java trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java trunk/crossfire/src/cfeditor/script/parameter/MapParameter.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/scripts/ScriptedEvent.java Added Paths: ----------- trunk/crossfire/src/cfeditor/CMainControlInstance.java trunk/daimonin/src/daieditor/CMainControlInstance.java Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-07-25 20:58:59 UTC (rev 4445) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -135,7 +135,7 @@ // Create the application and give it the parameters final CMainControl mainControl; try { - mainControl = new CMainControl(); + mainControl = CMainControlInstance.getInstance(); } catch (final RuntimeException ex) { log.fatal(ex.getMessage(), ex); System.exit(1); Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-25 20:58:59 UTC (rev 4445) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -142,9 +142,6 @@ /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - /** Singleton instance reference. */ - private static CMainControl instance; - /** Preferences key for using System.exit(). */ public static final String PREFS_SYSTEM_EXIT = "systemExit"; @@ -216,7 +213,6 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor"); - instance = this; animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects); scriptControl = new ScriptController(this); @@ -436,14 +432,6 @@ } /** - * Get the static instance of CMainControl. - * @return static instance of this class - */ - public static CMainControl getInstance() { - return instance; - } - - /** * Get the Animation Objects. * @return animationObjects */ Added: trunk/crossfire/src/cfeditor/CMainControlInstance.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControlInstance.java (rev 0) +++ trunk/crossfire/src/cfeditor/CMainControlInstance.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -0,0 +1,46 @@ +/* + * 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 cfeditor; + +/** + * Utility class managing the {@link CMainControl} singleton. + * @author Andreas Kirschbaum + */ +public class CMainControlInstance { + + /** + * The singleton instance. + */ + private static CMainControl instance = null; + + /** + * Private constructor to prevent instantiation. + */ + private CMainControlInstance() { + } + + public static synchronized CMainControl getInstance() { + if (instance == null) { + instance = new CMainControl(); + } + return instance; + } + +} // class CMainControlInstance Property changes on: trunk/crossfire/src/cfeditor/CMainControlInstance.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-25 20:58:59 UTC (rev 4445) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -95,7 +95,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(CMainControl.getInstance(), file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(CMainControlInstance.getInstance(), file); } /** {@inheritDoc} */ @@ -117,13 +117,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControlInstance.getInstance(), objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControlInstance.getInstance(), objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); } /** {@inheritDoc} */ @@ -135,7 +135,7 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>((MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic>) (MainControl) AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), 32, 32, selectedSquareView), ACTION_FACTORY); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>((MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic>) (MainControl) AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControlInstance.getInstance(), mapControl, viewPosition, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), 32, 32, selectedSquareView), ACTION_FACTORY); } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptedEvent.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptedEvent.java 2008-07-25 20:58:59 UTC (rev 4445) +++ trunk/crossfire/src/cfeditor/gameobject/scripts/ScriptedEvent.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -19,7 +19,7 @@ package cfeditor.gameobject.scripts; -import cfeditor.CMainControl; +import cfeditor.CMainControlInstance; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; @@ -172,7 +172,7 @@ if (eventArchetypeName == null) { throw new UndefinedEventArchetypeTypeException(eventType); } - final Archetype eventArchetype = CMainControl.getInstance().getArchetypeSet().getArchetype(eventArchetypeName); + final Archetype eventArchetype = CMainControlInstance.getInstance().getArchetypeSet().getArchetype(eventArchetypeName); if (eventArchetype == null) { throw new UndefinedEventArchetypeNameException(eventArchetypeName); } Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBox.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBox.java 2008-07-25 20:58:59 UTC (rev 4445) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ArchComboBox.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -20,6 +20,7 @@ package cfeditor.gui.script.parameter; import cfeditor.CMainControl; +import cfeditor.CMainControlInstance; import cfeditor.gameobject.Archetype; import java.awt.Color; import java.awt.Component; @@ -67,7 +68,7 @@ public ArchComboBox() { setMaximumRowCount(4); - mainControl = CMainControl.getInstance(); + mainControl = CMainControlInstance.getInstance(); final MyCellRenderer renderer = new MyCellRenderer(); archComboBoxEditor = new ArchComboBoxEditor(); //setPrototypeDisplayValue(renderer.sizeTester); Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/MapParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/MapParameterView.java 2008-07-25 20:58:59 UTC (rev 4445) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/MapParameterView.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -20,6 +20,7 @@ package cfeditor.gui.script.parameter; import cfeditor.CMainControl; +import cfeditor.CMainControlInstance; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; @@ -127,7 +128,7 @@ @Override public int getIndexOf(final Object anObject) { - final List<MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>> maps = CMainControl.getInstance().getMapManager().getOpenedMaps(); + final List<MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>> maps = CMainControlInstance.getInstance().getMapManager().getOpenedMaps(); if (anObject == currentMap) { return 0; } Modified: trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java 2008-07-25 20:58:59 UTC (rev 4445) +++ trunk/crossfire/src/cfeditor/script/parameter/ArchParameter.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -19,7 +19,7 @@ package cfeditor.script.parameter; -import cfeditor.CMainControl; +import cfeditor.CMainControlInstance; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.ArchetypeSet; import cfeditor.gui.script.parameter.ArchParameterView; @@ -30,7 +30,7 @@ public class ArchParameter extends PluginParameter { @NotNull - private final ArchetypeSet archetypeSet = CMainControl.getInstance().getArchetypeSet(); + private final ArchetypeSet archetypeSet = CMainControlInstance.getInstance().getArchetypeSet(); private String valueString; Modified: trunk/crossfire/src/cfeditor/script/parameter/MapParameter.java =================================================================== --- trunk/crossfire/src/cfeditor/script/parameter/MapParameter.java 2008-07-25 20:58:59 UTC (rev 4445) +++ trunk/crossfire/src/cfeditor/script/parameter/MapParameter.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -20,6 +20,7 @@ package cfeditor.script.parameter; import cfeditor.CMainControl; +import cfeditor.CMainControlInstance; import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; @@ -69,7 +70,7 @@ return CMainControl.getInstance().getMapManager().getCurrentMap(); } - for (final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl : CMainControl.getInstance().getMapManager().getOpenedMaps()) { + for (final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl : CMainControlInstance.getInstance().getMapManager().getOpenedMaps()) { if (mapControl.getMapFileName().equalsIgnoreCase(s)) { return mapControl; } Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-25 20:58:59 UTC (rev 4445) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -162,9 +162,6 @@ /** Preferences. */ private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - /** Singleton instance reference. */ - private static CMainControl instance; - /** Preferences key for using System.exit(). */ public static final String PREFS_SYSTEM_EXIT = "systemExit"; @@ -272,7 +269,6 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor"); - instance = this; animationObjects = new daieditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); @@ -528,14 +524,6 @@ } /** - * Get the static instance of CMainControl. - * @return static instance of this class - */ - public static CMainControl getInstance() { - return instance; - } - - /** * Whether to use double display like the client with walls. * @return <code>true</code> if double display should be used, otherwise * <code>false</code> Added: trunk/daimonin/src/daieditor/CMainControlInstance.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControlInstance.java (rev 0) +++ trunk/daimonin/src/daieditor/CMainControlInstance.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -0,0 +1,46 @@ +/* + * 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 daieditor; + +/** + * Utility class managing the {@link CMainControl} singleton. + * @author Andreas Kirschbaum + */ +public class CMainControlInstance { + + /** + * The singleton instance. + */ + private static CMainControl instance = null; + + /** + * Private constructor to prevent instantiation. + */ + private CMainControlInstance() { + } + + public static synchronized CMainControl getInstance() { + if (instance == null) { + instance = new CMainControl(); + } + return instance; + } + +} // class CMainControlInstance Property changes on: trunk/daimonin/src/daieditor/CMainControlInstance.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-25 20:58:59 UTC (rev 4445) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -98,7 +98,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(CMainControl.getInstance(), file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(CMainControlInstance.getInstance(), file); } /** {@inheritDoc} */ @@ -120,13 +120,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControlInstance.getInstance(), objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControl.getInstance(), objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControlInstance.getInstance(), objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); mapArchObject.setDifficulty(1); return mapControl; } @@ -140,7 +140,7 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>((MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic>) (MainControl) AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControl.getInstance(), mapControl, viewPosition, faceObjects, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>((MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic>) (MainControl) AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControlInstance.getInstance(), mapControl, viewPosition, faceObjects, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-07-25 20:58:59 UTC (rev 4445) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -19,7 +19,7 @@ package daieditor.gameobject; -import daieditor.CMainControl; +import daieditor.CMainControlInstance; import daieditor.gameobject.anim.AnimationObject; import daieditor.gameobject.scripts.ScriptArchData; import daieditor.map.MapArchObject; @@ -204,7 +204,7 @@ @Nullable String effectiveFaceObjName; if (effectiveAnimName != null) { // we have a animation - get the frame picture - final AnimationObjects<AnimationObject> animationObjects = CMainControl.getInstance().getAnimationObjects(); + final AnimationObjects<AnimationObject> animationObjects = CMainControlInstance.getInstance().getAnimationObjects(); final AnimationObject animationObject = animationObjects.get(effectiveAnimName); if (animationObject != null) { noface = false; @@ -252,8 +252,8 @@ * rendering. */ private void setFace() { - normalFace = CMainControl.getInstance().getArchetypeSet().getFace(this); - transFace = CMainControl.getInstance().getArchetypeSet().getTrans(this); + normalFace = CMainControlInstance.getInstance().getArchetypeSet().getFace(this); + transFace = CMainControlInstance.getInstance().getArchetypeSet().getTrans(this); } /** Modified: trunk/daimonin/src/daieditor/gameobject/scripts/ScriptedEvent.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/scripts/ScriptedEvent.java 2008-07-25 20:58:59 UTC (rev 4445) +++ trunk/daimonin/src/daieditor/gameobject/scripts/ScriptedEvent.java 2008-07-25 21:01:08 UTC (rev 4446) @@ -19,7 +19,7 @@ package daieditor.gameobject.scripts; -import daieditor.CMainControl; +import daieditor.CMainControlInstance; import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; import net.sf.gridarta.gameobject.scripts.ScriptedEventEditor; @@ -168,7 +168,7 @@ if (eventArchetypeName == null) { throw new UndefinedEventArchetypeTypeException(eventType); } - final Archetype eventArchetype = CMainControl.getInstance().getArchetypeSet().getArchetype(eventArchetypeName); + final Archetype eventArchetype = CMainControlInstance.getInstance().getArchetypeSet().getArchetype(eventArchetypeName); if (eventArchetype == null) { throw new UndefinedEventArchetypeNameException(eventArchetypeName); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-25 21:11:15
|
Revision: 4449 http://gridarta.svn.sourceforge.net/gridarta/?rev=4449&view=rev Author: akirschbaum Date: 2008-07-25 21:11:24 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Remove unused code. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/src/app/net/sf/gridarta/map/ShrinkMapSizeUtils.java Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-07-25 21:10:24 UTC (rev 4448) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-07-25 21:11:24 UTC (rev 4449) @@ -288,7 +288,6 @@ assert slashPos != -1; final String facename = generateFaceName(name); ((ArchFaceProvider) FaceObjectProviders.normal).addInfo(facename, filename); - final int stripPath = new File(mainControl.getGlobalSettings().getArchDefaultFolder()).getAbsolutePath().length(); try { faceObjects.addFaceObject(facename, originalPathname.substring(0, slashPos + 1) + facename, filename, 0, (int) new File(filename).length()); } catch (final DuplicateFaceException e) { Modified: trunk/src/app/net/sf/gridarta/map/ShrinkMapSizeUtils.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/ShrinkMapSizeUtils.java 2008-07-25 21:10:24 UTC (rev 4448) +++ trunk/src/app/net/sf/gridarta/map/ShrinkMapSizeUtils.java 2008-07-25 21:11:24 UTC (rev 4449) @@ -19,7 +19,6 @@ package net.sf.gridarta.map; -import java.awt.Point; import net.sf.gridarta.Size2D; /** @@ -45,7 +44,6 @@ */ public static void shrinkMap(final MapModel<?, ?, ?> mapModel, final int shrinkFlags) { final Size2D mapSize = mapModel.getMapSize(); - final Point point = new Point(); int filledWidth = mapSize.getWidth(); int filledHeight = mapSize.getHeight(); if ((shrinkFlags & SHRINK_EAST) != 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-25 21:41:43
|
Revision: 4455 http://gridarta.svn.sourceforge.net/gridarta/?rev=4455&view=rev Author: akirschbaum Date: 2008-07-25 21:41:50 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Fix crash in application startup. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-25 21:27:13 UTC (rev 4454) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-25 21:41:50 UTC (rev 4455) @@ -230,7 +230,7 @@ newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("cfeditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-25 21:27:13 UTC (rev 4454) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-25 21:41:50 UTC (rev 4455) @@ -76,6 +76,10 @@ @NotNull private SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = null; + /** The {@link MainControl} instance to use. */ + @NotNull + private MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -95,7 +99,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(CMainControlInstance.getInstance(), file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(mainControl, file); } /** {@inheritDoc} */ @@ -117,13 +121,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControlInstance.getInstance(), objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControlInstance.getInstance(), objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); } /** {@inheritDoc} */ @@ -135,14 +139,15 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>((MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic>) (MainControl) AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControlInstance.getInstance(), mapControl, viewPosition, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), 32, 32, selectedSquareView), ACTION_FACTORY); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, mapControl, viewPosition, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), 32, 32, selectedSquareView), ACTION_FACTORY); } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl) { this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; + this.mainControl = mainControl; } } // class CrossfireObjectsFactory Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-25 21:27:13 UTC (rev 4454) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-25 21:41:50 UTC (rev 4455) @@ -287,7 +287,7 @@ newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("daieditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-25 21:27:13 UTC (rev 4454) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-25 21:41:50 UTC (rev 4455) @@ -79,6 +79,10 @@ @NotNull private SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = null; + /** The {@link MainControl} instance to use. */ + @NotNull + private MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -98,7 +102,7 @@ /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(CMainControlInstance.getInstance(), file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(mainControl, file); } /** {@inheritDoc} */ @@ -120,13 +124,13 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControlInstance.getInstance(), objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + return new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, objects, mapArchObject, false, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); } /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@Nullable final List<GameObject> objects, @NotNull final MapArchObject mapArchObject) { - final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, CMainControlInstance.getInstance(), objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); + final DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, mainControl, objects, mapArchObject, true, GameObjectMatchersInstance.getInstance().getMatcher("exit"), archetypeChooserControl); mapArchObject.setDifficulty(1); return mapControl; } @@ -140,15 +144,16 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>((MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic>) (MainControl) AbstractMainControl.getInstance(), mapControl, viewCounter, new CMapViewBasic(CMainControlInstance.getInstance(), mapControl, viewPosition, faceObjects, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, mapControl, viewPosition, faceObjects, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), IGUIConstants.TILE_ISO_XLEN, IGUIConstants.TILE_ISO_YLEN, selectedSquareView), ACTION_FACTORY); } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl) { this.faceObjects = faceObjects; this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; + this.mainControl = mainControl; } } // class DaimoninObjectsFactory Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-25 21:27:13 UTC (rev 4454) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-25 21:41:50 UTC (rev 4455) @@ -137,7 +137,8 @@ * @param objectChooser the ObjectChooser instance * @param archetypeChooserControl the ArchetypeChooserControl instance * @param selectedSquareView the selected square view instance + * @param mainControl the main control instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView); + void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl); } // interface GridartaObjectsFactory Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-25 21:27:13 UTC (rev 4454) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-25 21:41:50 UTC (rev 4455) @@ -921,7 +921,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicSelectedSquareView) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl) { throw new AssertionError(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-25 21:51:10
|
Revision: 4456 http://gridarta.svn.sourceforge.net/gridarta/?rev=4456&view=rev Author: akirschbaum Date: 2008-07-25 21:51:19 +0000 (Fri, 25 Jul 2008) Log Message: ----------- Preaparations for supporting image sets. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/messages.properties trunk/daimonin/src/daieditor/CMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-25 21:41:50 UTC (rev 4455) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-25 21:51:19 UTC (rev 4456) @@ -213,6 +213,7 @@ */ public CMainControl() { super(new CrossfireObjectsFactory(), "cfeditor"); + globalSettings.readGlobalSettings(); animationObjects = new cfeditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects, globalSettings.getImageSet()); scriptControl = new ScriptController(this); @@ -222,7 +223,6 @@ mapCursorControl = new MapCursorControl<GameObject, MapArchObject, Archetype, CMapViewBasic>("cfeditor", this, getMapManager(), selectedSquareControl, selectedSquareView); ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); - globalSettings.readGlobalSettings(); PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, false); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-07-25 21:41:50 UTC (rev 4455) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-07-25 21:51:19 UTC (rev 4456) @@ -26,6 +26,7 @@ # Supported image set. The values must match the image file names: # <name>.<image set name>.111 availableImageSets=base +#availableImageSets=base clsc ########## # Dialogs Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-25 21:41:50 UTC (rev 4455) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-25 21:51:19 UTC (rev 4456) @@ -269,6 +269,7 @@ */ public CMainControl() { super(new DaimoninObjectsFactory(), "daieditor"); + globalSettings.readGlobalSettings(); animationObjects = new daieditor.gameobject.anim.AnimationObjects(); archetypeSet = new ArchetypeSet(this, animationObjects, faceObjects); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); @@ -279,7 +280,6 @@ ACTION_FACTORY.createToggles(true, this, "drawDouble"); ACTION_FACTORY.createAction(true, "collectSpells", this); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); - globalSettings.readGlobalSettings(); PathManager.setGlobalSettings(globalSettings); final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, true); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-26 05:48:26
|
Revision: 4459 http://gridarta.svn.sourceforge.net/gridarta/?rev=4459&view=rev Author: akirschbaum Date: 2008-07-26 05:48:33 +0000 (Sat, 26 Jul 2008) Log Message: ----------- Remove calls to MainControl.getArchetypeSet(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-26 05:35:52 UTC (rev 4458) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-26 05:48:33 UTC (rev 4459) @@ -224,7 +224,7 @@ ACTION_FACTORY.createActions(true, this, "createNew", "open", "options", "exit", "newScript", "editScript", "zoom", "gc", "onlineHelp", "tod", "about"); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); PathManager.setGlobalSettings(globalSettings); - final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, false); + final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, false); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-26 05:35:52 UTC (rev 4458) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-26 05:48:33 UTC (rev 4459) @@ -281,7 +281,7 @@ ACTION_FACTORY.createAction(true, "collectSpells", this); final MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManagerActions = new MapManagerActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); PathManager.setGlobalSettings(globalSettings); - final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, true); + final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, true); newMapDialogFactory = new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-07-26 05:35:52 UTC (rev 4458) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypeChooserControl.java 2008-07-26 05:48:33 UTC (rev 4459) @@ -39,6 +39,7 @@ import net.sf.gridarta.CommonConstants; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.InsertionMode; @@ -66,6 +67,12 @@ private final MainControl<G, A, R, V> mainControl; /** + * The archetype set to display. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + /** * Name of the selected archetype. * @serial include */ @@ -98,10 +105,12 @@ /** * Create a new instance. * @param mainControl The main control. + * @param archetypeSet the archetype set to display * @param createDirectionPane Whether to create a "direction" panel. */ - public ArchetypeChooserControl(@NotNull final MainControl<G, A, R, V> mainControl, final boolean createDirectionPane) { + public ArchetypeChooserControl(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, final boolean createDirectionPane) { this.mainControl = mainControl; + this.archetypeSet = archetypeSet; tabDesktop.setBorder(BorderFactory.createEmptyBorder(CommonConstants.SPACE_PICKARCH_TOP, 0, 0, 0)); archPane.add(tabDesktop); if (createDirectionPane) { @@ -257,7 +266,7 @@ */ @NotNull private ArchetypePanel<G, A, R, V> createArchetypePanel() { - return new ArchetypePanel<G, A, R, V>(this, mainControl); + return new ArchetypePanel<G, A, R, V>(this, mainControl, archetypeSet); } /** Modified: trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2008-07-26 05:35:52 UTC (rev 4458) +++ trunk/src/app/net/sf/gridarta/gui/archetypechooser/ArchetypePanel.java 2008-07-26 05:48:33 UTC (rev 4459) @@ -41,6 +41,7 @@ import net.sf.gridarta.CommonConstants; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; @@ -90,6 +91,12 @@ private final MainControl<G, A, R, V> mainControl; /** + * The archetype set to display. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + /** * Comparator used to sort entries shown in {@link #archList} according to * archetype name. */ @@ -135,11 +142,13 @@ * Creates an ArchetypePanel. * @param archetypeChooserControl The Archetype Chooser. * @param mainControl The main control. + * @param archetypeSet the archetype set to display */ - protected ArchetypePanel(@NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final MainControl<G, A, R, V> mainControl) { + protected ArchetypePanel(@NotNull final ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet) { super(new BorderLayout()); this.archetypeChooserControl = archetypeChooserControl; this.mainControl = mainControl; + this.archetypeSet = archetypeSet; comboBox = new JComboBox(); @@ -168,7 +177,7 @@ * archetype names. */ private void updateCellRenderer(final boolean displayObjectNames) { - archList.setCellRenderer(displayObjectNames ? new DisplayNameCellRenderer<R>(mainControl.getArchetypeSet()) : new ArchetypeNameCellRenderer<R>(mainControl.getArchetypeSet())); + archList.setCellRenderer(displayObjectNames ? new DisplayNameCellRenderer<R>(archetypeSet) : new ArchetypeNameCellRenderer<R>(archetypeSet)); final Object selectedValue = archList.getSelectedValue(); showArchList(); if (selectedValue != null) { Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-26 05:35:52 UTC (rev 4458) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-26 05:48:33 UTC (rev 4459) @@ -22,10 +22,12 @@ import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; +import java.io.IOException; import java.util.List; import java.util.SortedSet; import java.util.TreeSet; import javax.swing.JList; +import javax.swing.ImageIcon; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.AbstractMainControl; import net.sf.gridarta.CFArchTypeList; @@ -33,10 +35,12 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.Size2D; +import net.sf.gridarta.gameobject.AbstractArchetypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatcher; @@ -65,6 +69,7 @@ import net.sf.gridarta.spells.GameObjectSpell; import net.sf.gridarta.spells.NumberSpell; import net.sf.gridarta.spells.Spells; +import net.sf.japi.swing.misc.Progress; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.junit.Assert; @@ -374,7 +379,8 @@ gridartaObjectsFactory = new TestGridartaObjectsFactory(); final TestMainControl mainControl = new TestMainControl(gridartaObjectsFactory, "test"); final TestMapArchObject mapArchObject = new TestMapArchObject(); - final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, false); + final TestArchetypeSet archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); + final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserControl = new ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, archetypeSet, false); final TestMapControl mapControl = new TestMapControl(gridartaObjectsFactory, mainControl, null, mapArchObject, false, null, archetypeChooserControl); mapModel = new DefaultMapModel<TestGameObject, TestMapArchObject, TestArchetype>(mainControl, mapControl, null, mapArchObject, null, archetypeChooserControl); @@ -926,4 +932,41 @@ } } + /** + * An {@link ArchetypeSet} implementation for testing purposes. + */ + private static class TestArchetypeSet extends AbstractArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> { + + /** + * Create a new instance. + * @param gridartaObjectsFactory the gridarta objects factory to use + */ + protected TestArchetypeSet(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, ?> gridartaObjectsFactory) { + super(gridartaObjectsFactory); + } + + /** {@inheritDoc} */ + public void loadArchetypes(@NotNull final AbstractArchetypeParser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeAbstractArchetypeParser) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public ImageIcon getFace(@NotNull final TestArchetype archetype) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + public ImageIcon getFace(@NotNull final TestGameObject gameObject) { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + public void collect(@NotNull final Progress progress, @NotNull final File dir) throws IOException { + throw new AssertionError(); + } + + } + } // class DefaultMapModelTest This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-26 06:34:04
|
Revision: 4461 http://gridarta.svn.sourceforge.net/gridarta/?rev=4461&view=rev Author: akirschbaum Date: 2008-07-26 06:34:11 +0000 (Sat, 26 Jul 2008) Log Message: ----------- Convert utility class GameObjectAttributesDialogFactory into normal class. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-26 06:24:39 UTC (rev 4460) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-26 06:34:11 UTC (rev 4461) @@ -207,6 +207,12 @@ /** The factory for creating new maps or pickmaps. */ private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; + /** + * The {@link GameObjectAttributesDialogFactory} to use. + */ + @NotNull + private final GameObjectAttributesDialogFactory gameObjectAttributesDialogFactory; + /** * Constructs the main controller and its model and view. * @throws RuntimeException If the controller cannot be initialized. @@ -362,6 +368,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory(typeList, this, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter); } /** @@ -613,7 +620,7 @@ // types.xml is missing! ACTION_FACTORY.showMessageDialog(mainView, "openAttrDialogNoTypes"); } else if (gameObject != null && !gameObject.hasUndefinedArchetype()) { - GameObjectAttributesDialogFactory.showAttribDialog(typeList, gameObject, this, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter); + gameObjectAttributesDialogFactory.showAttribDialog(gameObject); } else { ACTION_FACTORY.showMessageDialog(mainView, "openAttrDialogNoDefaultArch"); } Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 06:24:39 UTC (rev 4460) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 06:34:11 UTC (rev 4461) @@ -40,6 +40,7 @@ import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialog; +import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributesdialog.BitmaskAttrib; import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttrib; import net.sf.gridarta.gui.gameobjectattributesdialog.StringKeyManager; @@ -68,6 +69,7 @@ /** * Constructor, creates the GUI layout. + * @param gameObjectAttributesDialogFactory the associated factory * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control @@ -77,8 +79,8 @@ * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialog(final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, final FileFilter mapFileFilter) { - super(archTypeList, gameObject, mainControl, animationObjects, treasureListTree, faceObjects, mapFileFilter); + public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, final FileFilter mapFileFilter) { + super(gameObjectAttributesDialogFactory, archTypeList, gameObject, mainControl, animationObjects, treasureListTree, faceObjects, mapFileFilter); this.mapManager = mapManager; } Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 06:24:39 UTC (rev 4460) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 06:34:11 UTC (rev 4461) @@ -16,30 +16,80 @@ import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; -public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory { +public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype> { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); /** - * Wrapper method for the constructor. This method only creates a - * GameObjectAttributesDialog if there's no dialog for the same gameObject - * already. * @param archTypeList the list of CF type-data - * @param gameObject the GameObject to be displayed by this dialog + */ + @NotNull + private final CFArchTypeList archTypeList; + + /** * @param mainControl main control + */ + @NotNull + private final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl; + + /** * @param animationObjects the animation objects instance to use + */ + @NotNull + private final AnimationObjects<?> animationObjects; + + /** * @param mapManager the map manager + */ + @NotNull + private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; + + /** * @param treasureListTree the treasure list tree instance to use + */ + @NotNull + private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; + + /** * @param faceObjects the FaceObjects instance to use + */ + @NotNull + private final FaceObjects faceObjects; + + /** * @param mapFileFilter the Swing file filter to use */ - public static void showAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, final FileFilter mapFileFilter) { + @NotNull + private final FileFilter mapFileFilter; + + /** + * Creates a new instance. + * @param archTypeList the list of CF type-data + * @param mainControl main control + * @param animationObjects the animation objects instance to use + * @param mapManager the map manager + * @param treasureListTree the treasure list tree instance to use + * @param faceObjects the FaceObjects instance to use + * @param mapFileFilter the Swing file filter to use + */ + public GameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + this.archTypeList = archTypeList; + this.mainControl = mainControl; + this.animationObjects = animationObjects; + this.mapManager = mapManager; + this.treasureListTree = treasureListTree; + this.faceObjects = faceObjects; + this.mapFileFilter = mapFileFilter; + } + + /** {@inheritDoc} */ + public void showAttribDialog(final GameObject gameObject) { synchronized (dialogs) { - if (AbstractGameObjectAttributesDialogFactory.dialogs.containsKey(gameObject)) { - AbstractGameObjectAttributesDialogFactory.dialogs.get(gameObject).toFront(); + if (dialogs.containsKey(gameObject)) { + dialogs.get(gameObject).toFront(); } else { - final GameObjectAttributesDialog pane = new GameObjectAttributesDialog(archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + final GameObjectAttributesDialog pane = new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-26 06:24:39 UTC (rev 4460) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-26 06:34:11 UTC (rev 4461) @@ -264,6 +264,12 @@ private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; /** + * The {@link GameObjectAttributesDialogFactory} to use. + */ + @NotNull + private final GameObjectAttributesDialogFactory gameObjectAttributesDialogFactory; + + /** * Constructs the main controller and its model and view. * @throws RuntimeException If the controller cannot be initialized. */ @@ -437,6 +443,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory(typeList, this, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter); } /** @@ -795,7 +802,7 @@ // types.xml is missing! ACTION_FACTORY.showMessageDialog(mainView, "openAttrDialogNoTypes"); } else if (gameObject != null && !gameObject.hasUndefinedArchetype()) { - GameObjectAttributesDialogFactory.showAttribDialog(typeList, gameObject, this, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter); + gameObjectAttributesDialogFactory.showAttribDialog(gameObject); } else { ACTION_FACTORY.showMessageDialog(mainView, "openAttrDialogNoDefaultArch"); } Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 06:24:39 UTC (rev 4460) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 06:34:11 UTC (rev 4461) @@ -40,6 +40,7 @@ import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialog; +import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributesdialog.BitmaskAttrib; import net.sf.gridarta.gui.gameobjectattributesdialog.DialogAttrib; import net.sf.gridarta.gui.gameobjectattributesdialog.StringKeyManager; @@ -67,6 +68,7 @@ /** * Constructor, creates the GUI layout. + * @param gameObjectAttributesDialogFactory the associated factory * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control @@ -76,8 +78,8 @@ * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialog(final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, final FileFilter mapFileFilter) { - super(archTypeList, gameObject, mainControl, animationObjects, treasureListTree, faceObjects, mapFileFilter); + public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, final FileFilter mapFileFilter) { + super(gameObjectAttributesDialogFactory, archTypeList, gameObject, mainControl, animationObjects, treasureListTree, faceObjects, mapFileFilter); this.mapManager = mapManager; } Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 06:24:39 UTC (rev 4460) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 06:34:11 UTC (rev 4461) @@ -1,7 +1,9 @@ package daieditor.gui.gameobjectattributesdialog; +import daieditor.CMainControl; import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; +import daieditor.gameobject.anim.AnimationObject; import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; import javax.swing.JDialog; @@ -16,30 +18,80 @@ import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; -public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory { +public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype> { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); /** - * Wrapper method for the constructor. This method only creates a - * GameObjectAttributesDialog if there's no dialog for the same gameObject - * already. * @param archTypeList the list of CF type-data - * @param gameObject the GameObject to be displayed by this dialog + */ + @NotNull + private final CFArchTypeList archTypeList; + + /** * @param mainControl main control + */ + @NotNull + private final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl; + + /** * @param animationObjects the animation objects instance to use + */ + @NotNull + private final AnimationObjects<?> animationObjects; + + /** * @param mapManager the map manager + */ + @NotNull + private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; + + /** * @param treasureListTree the treasure list tree instance to use + */ + @NotNull + private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; + + /** * @param faceObjects the FaceObjects instance to use + */ + @NotNull + private final FaceObjects faceObjects; + + /** * @param mapFileFilter the Swing file filter to use */ - public static void showAttribDialog(final CFArchTypeList archTypeList, final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, final FileFilter mapFileFilter) { + @NotNull + private final FileFilter mapFileFilter; + + /** + * Creates a new instance. + * @param archTypeList the list of CF type-data + * @param mainControl main control + * @param animationObjects the animation objects instance to use + * @param mapManager the map manager + * @param treasureListTree the treasure list tree instance to use + * @param faceObjects the FaceObjects instance to use + * @param mapFileFilter the Swing file filter to use + */ + public GameObjectAttributesDialogFactory(final CFArchTypeList archTypeList, final CMainControl mainControl, final AnimationObjects<AnimationObject> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, final daieditor.gameobject.face.FaceObjects faceObjects, final FileFilter mapFileFilter) { + this.archTypeList = archTypeList; + this.mainControl = mainControl; + this.animationObjects = animationObjects; + this.mapManager = mapManager; + this.treasureListTree = treasureListTree; + this.faceObjects = faceObjects; + this.mapFileFilter = mapFileFilter; + } + + /** {@inheritDoc} */ + public void showAttribDialog(final GameObject gameObject) { synchronized (dialogs) { if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); } else { - final GameObjectAttributesDialog pane = new GameObjectAttributesDialog(archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + final GameObjectAttributesDialog pane = new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java 2008-07-26 06:24:39 UTC (rev 4460) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java 2008-07-26 06:34:11 UTC (rev 4461) @@ -113,6 +113,12 @@ /** The width (columns) for input fields like textfields or JChooseBoxes. */ public static final int TEXTFIELD_COLUMNS = 18; + /** + * The associated factory. + */ + @NotNull + private final AbstractGameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory; + /** Reference to the list of CFArchTypes. */ protected final CFArchTypeList archTypeList; @@ -181,6 +187,7 @@ /** * Create an AbstractGameObjectAttributesDialog. + * @param gameObjectAttributesDialogFactory the associated factory * @param archTypeList Reference to the list of CFArchTypes. * @param gameObject GameObject to show dialog for. * @param mainControl MainControl, for retrieving AnimationObjects etc. @@ -189,7 +196,8 @@ * @param faceObjects the face objects instance to use * @param mapFileFilter the Swing FileFilter for map files */ - protected AbstractGameObjectAttributesDialog(final CFArchTypeList archTypeList, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + protected AbstractGameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.archTypeList = archTypeList; this.gameObject = gameObject.getHead(); this.mainControl = mainControl; @@ -242,7 +250,7 @@ public void setValue(final Object newValue) { super.setValue(newValue); if (newValue != UNINITIALIZED_VALUE) { - AbstractGameObjectAttributesDialogFactory.dialogs.remove(gameObject).dispose(); + gameObjectAttributesDialogFactory.hideAttribDialog(gameObject); } } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-26 06:24:39 UTC (rev 4460) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-26 06:34:11 UTC (rev 4461) @@ -3,13 +3,36 @@ import java.util.HashMap; import java.util.Map; import javax.swing.JDialog; +import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.MapArchObject; +import org.jetbrains.annotations.NotNull; -public class AbstractGameObjectAttributesDialogFactory { +public abstract class AbstractGameObjectAttributesDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { /** * The gameObject objects that already are shown, to avoid opening a dialog * twice. */ - protected static final Map<GameObject<?, ?, ?>, JDialog> dialogs = new HashMap<GameObject<?, ?, ?>, JDialog>(); -} + protected final Map<G, JDialog> dialogs = new HashMap<G, JDialog>(); + + /** + * Shows the game object attributes dialog for a given {@link GameObject} + * instance. + * @param gameObject the GameObject to be displayed by this dialog + */ + public abstract void showAttribDialog(@NotNull final G gameObject); + + /** + * Hides the game object attributes dialog for a given {@link GameObject} + * instance. + * @param gameObject the GameObject to be displayed by this dialog + */ + public void hideAttribDialog(@NotNull final G gameObject) { + final JDialog dialog = dialogs.remove(gameObject); + if (dialog != null) { + dialog.dispose(); + } + } + +} // class AbstractGameObjectAttributesDialogFactory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-26 06:53:48
|
Revision: 4462 http://gridarta.svn.sourceforge.net/gridarta/?rev=4462&view=rev Author: akirschbaum Date: 2008-07-26 06:53:55 +0000 (Sat, 26 Jul 2008) Log Message: ----------- Preparations for unification. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 06:34:11 UTC (rev 4461) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 06:53:55 UTC (rev 4462) @@ -79,7 +79,7 @@ * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, final FileFilter mapFileFilter) { + public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, final FileFilter mapFileFilter) { super(gameObjectAttributesDialogFactory, archTypeList, gameObject, mainControl, animationObjects, treasureListTree, faceObjects, mapFileFilter); this.mapManager = mapManager; } Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 06:34:11 UTC (rev 4461) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 06:53:55 UTC (rev 4462) @@ -16,7 +16,7 @@ import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; -public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype> { +public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); @@ -89,7 +89,7 @@ if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); } else { - final GameObjectAttributesDialog pane = new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + final GameObjectAttributesDialog pane = newGameObjectAttributesDialog(archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); @@ -99,4 +99,11 @@ } } } + + /** {@inheritDoc} */ + @Override + protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + } + } Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 06:34:11 UTC (rev 4461) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 06:53:55 UTC (rev 4462) @@ -78,7 +78,7 @@ * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, final FileFilter mapFileFilter) { + public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, final FileFilter mapFileFilter) { super(gameObjectAttributesDialogFactory, archTypeList, gameObject, mainControl, animationObjects, treasureListTree, faceObjects, mapFileFilter); this.mapManager = mapManager; } Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 06:34:11 UTC (rev 4461) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 06:53:55 UTC (rev 4462) @@ -18,7 +18,7 @@ import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; -public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype> { +public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); @@ -91,7 +91,7 @@ if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); } else { - final GameObjectAttributesDialog pane = new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + final GameObjectAttributesDialog pane = newGameObjectAttributesDialog(archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); @@ -101,4 +101,10 @@ } } } + + /** {@inheritDoc} */ + @Override + protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + } } Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java 2008-07-26 06:34:11 UTC (rev 4461) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java 2008-07-26 06:53:55 UTC (rev 4462) @@ -117,7 +117,7 @@ * The associated factory. */ @NotNull - private final AbstractGameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory; + private final AbstractGameObjectAttributesDialogFactory<G, A, R, ?> gameObjectAttributesDialogFactory; /** Reference to the list of CFArchTypes. */ protected final CFArchTypeList archTypeList; @@ -196,7 +196,7 @@ * @param faceObjects the face objects instance to use * @param mapFileFilter the Swing FileFilter for map files */ - protected AbstractGameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<G, A, R> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + protected AbstractGameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<G, A, R, ?> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.archTypeList = archTypeList; this.gameObject = gameObject.getHead(); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-26 06:34:11 UTC (rev 4461) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-26 06:53:55 UTC (rev 4462) @@ -3,12 +3,20 @@ import java.util.HashMap; import java.util.Map; import javax.swing.JDialog; +import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.CFArchTypeList; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.anim.AnimationObjects; +import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.treasurelist.CFTreasureListTree; import org.jetbrains.annotations.NotNull; -public abstract class AbstractGameObjectAttributesDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { +public abstract class AbstractGameObjectAttributesDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { /** * The gameObject objects that already are shown, to avoid opening a dialog @@ -35,4 +43,17 @@ } } + /** + * Creates a new game object attributes dialog instance. + * @param archTypeList the list of CF type-data + * @param gameObject the GameObject to be displayed by this dialog + * @param mainControl main control + * @param animationObjects the animation objects instance to use + * @param mapManager the map manager + * @param treasureListTree the treasure list tree + * @param faceObjects the FaceObjects instance to use + * @param mapFileFilter the Swing file filter to use + */ + protected abstract AbstractGameObjectAttributesDialog<G, A, R> newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter); + } // class AbstractGameObjectAttributesDialogFactory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-26 07:00:30
|
Revision: 4463 http://gridarta.svn.sourceforge.net/gridarta/?rev=4463&view=rev Author: akirschbaum Date: 2008-07-26 07:00:38 +0000 (Sat, 26 Jul 2008) Log Message: ----------- Add nullable annotations. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 06:53:55 UTC (rev 4462) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 07:00:38 UTC (rev 4463) @@ -65,6 +65,7 @@ private static final long serialVersionUID = 1L; /** The map manager. */ + @NotNull private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; /** @@ -79,7 +80,7 @@ * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, final FileFilter mapFileFilter) { + public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { super(gameObjectAttributesDialogFactory, archTypeList, gameObject, mainControl, animationObjects, treasureListTree, faceObjects, mapFileFilter); this.mapManager = mapManager; } Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 06:53:55 UTC (rev 4462) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:00:38 UTC (rev 4463) @@ -84,7 +84,7 @@ } /** {@inheritDoc} */ - public void showAttribDialog(final GameObject gameObject) { + public void showAttribDialog(@NotNull final GameObject gameObject) { synchronized (dialogs) { if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 06:53:55 UTC (rev 4462) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 07:00:38 UTC (rev 4463) @@ -64,6 +64,7 @@ private static final long serialVersionUID = 1L; /** The map manager. */ + @NotNull private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; /** @@ -78,7 +79,7 @@ * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, final FileFilter mapFileFilter) { + public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { super(gameObjectAttributesDialogFactory, archTypeList, gameObject, mainControl, animationObjects, treasureListTree, faceObjects, mapFileFilter); this.mapManager = mapManager; } Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 06:53:55 UTC (rev 4462) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:00:38 UTC (rev 4463) @@ -75,7 +75,7 @@ * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialogFactory(final CFArchTypeList archTypeList, final CMainControl mainControl, final AnimationObjects<AnimationObject> animationObjects, final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, final daieditor.gameobject.face.FaceObjects faceObjects, final FileFilter mapFileFilter) { + public GameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final CMainControl mainControl, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final daieditor.gameobject.face.FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { this.archTypeList = archTypeList; this.mainControl = mainControl; this.animationObjects = animationObjects; @@ -86,7 +86,7 @@ } /** {@inheritDoc} */ - public void showAttribDialog(final GameObject gameObject) { + public void showAttribDialog(@NotNull final GameObject gameObject) { synchronized (dialogs) { if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-26 07:05:12
|
Revision: 4465 http://gridarta.svn.sourceforge.net/gridarta/?rev=4465&view=rev Author: akirschbaum Date: 2008-07-26 07:05:19 +0000 (Sat, 26 Jul 2008) Log Message: ----------- Comment updates. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:03:49 UTC (rev 4464) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:05:19 UTC (rev 4465) @@ -1,3 +1,22 @@ +/* + * 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 cfeditor.gui.gameobjectattributesdialog; import cfeditor.gameobject.Archetype; @@ -106,4 +125,4 @@ return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } -} +} // class GameObjectAttributesDialogFactory Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:03:49 UTC (rev 4464) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:05:19 UTC (rev 4465) @@ -1,3 +1,22 @@ +/* + * 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 daieditor.gui.gameobjectattributesdialog; import daieditor.gameobject.Archetype; @@ -106,4 +125,4 @@ return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } -} +} // class GameObjectAttributesDialogFactory Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-26 07:03:49 UTC (rev 4464) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-26 07:05:19 UTC (rev 4465) @@ -1,3 +1,22 @@ +/* + * 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.gameobjectattributesdialog; import java.util.HashMap; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-26 07:14:05
|
Revision: 4466 http://gridarta.svn.sourceforge.net/gridarta/?rev=4466&view=rev Author: akirschbaum Date: 2008-07-26 07:14:11 +0000 (Sat, 26 Jul 2008) Log Message: ----------- Move GameObjectAttributesDialogFactory.showAttribDialog() to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:05:19 UTC (rev 4465) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:14:11 UTC (rev 4466) @@ -23,7 +23,6 @@ import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; -import javax.swing.JDialog; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.MainControl; @@ -37,52 +36,7 @@ public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); - /** - * @param archTypeList the list of CF type-data - */ - @NotNull - private final CFArchTypeList archTypeList; - - /** - * @param mainControl main control - */ - @NotNull - private final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl; - - /** - * @param animationObjects the animation objects instance to use - */ - @NotNull - private final AnimationObjects<?> animationObjects; - - /** - * @param mapManager the map manager - */ - @NotNull - private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; - - /** - * @param treasureListTree the treasure list tree instance to use - */ - @NotNull - private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; - - /** - * @param faceObjects the FaceObjects instance to use - */ - @NotNull - private final FaceObjects faceObjects; - - /** - * @param mapFileFilter the Swing file filter to use - */ - @NotNull - private final FileFilter mapFileFilter; - - /** * Creates a new instance. * @param archTypeList the list of CF type-data * @param mainControl main control @@ -93,33 +47,10 @@ * @param mapFileFilter the Swing file filter to use */ public GameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - this.archTypeList = archTypeList; - this.mainControl = mainControl; - this.animationObjects = animationObjects; - this.mapManager = mapManager; - this.treasureListTree = treasureListTree; - this.faceObjects = faceObjects; - this.mapFileFilter = mapFileFilter; + super(archTypeList, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } /** {@inheritDoc} */ - public void showAttribDialog(@NotNull final GameObject gameObject) { - synchronized (dialogs) { - if (dialogs.containsKey(gameObject)) { - dialogs.get(gameObject).toFront(); - } else { - final GameObjectAttributesDialog pane = newGameObjectAttributesDialog(archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); - final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); - dialog.getRootPane().setDefaultButton(pane.okButton); - dialog.setResizable(true); - dialog.setModal(false); - dialog.setVisible(true); - dialogs.put(pane.gameObject, dialog); - } - } - } - - /** {@inheritDoc} */ @Override protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:05:19 UTC (rev 4465) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:14:11 UTC (rev 4466) @@ -23,7 +23,6 @@ import daieditor.gameobject.GameObject; import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; -import javax.swing.JDialog; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.MainControl; @@ -37,52 +36,7 @@ public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); - /** - * @param archTypeList the list of CF type-data - */ - @NotNull - private final CFArchTypeList archTypeList; - - /** - * @param mainControl main control - */ - @NotNull - private final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl; - - /** - * @param animationObjects the animation objects instance to use - */ - @NotNull - private final AnimationObjects<?> animationObjects; - - /** - * @param mapManager the map manager - */ - @NotNull - private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; - - /** - * @param treasureListTree the treasure list tree instance to use - */ - @NotNull - private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; - - /** - * @param faceObjects the FaceObjects instance to use - */ - @NotNull - private final FaceObjects faceObjects; - - /** - * @param mapFileFilter the Swing file filter to use - */ - @NotNull - private final FileFilter mapFileFilter; - - /** * Creates a new instance. * @param archTypeList the list of CF type-data * @param mainControl main control @@ -93,33 +47,10 @@ * @param mapFileFilter the Swing file filter to use */ public GameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - this.archTypeList = archTypeList; - this.mainControl = mainControl; - this.animationObjects = animationObjects; - this.mapManager = mapManager; - this.treasureListTree = treasureListTree; - this.faceObjects = faceObjects; - this.mapFileFilter = mapFileFilter; + super(archTypeList, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } /** {@inheritDoc} */ - public void showAttribDialog(@NotNull final GameObject gameObject) { - synchronized (dialogs) { - if (dialogs.containsKey(gameObject)) { - dialogs.get(gameObject).toFront(); - } else { - final GameObjectAttributesDialog pane = newGameObjectAttributesDialog(archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); - final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); - dialog.getRootPane().setDefaultButton(pane.okButton); - dialog.setResizable(true); - dialog.setModal(false); - dialog.setVisible(true); - dialogs.put(pane.gameObject, dialog); - } - } - } - - /** {@inheritDoc} */ @Override protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-26 07:05:19 UTC (rev 4465) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-26 07:14:11 UTC (rev 4466) @@ -33,23 +33,104 @@ import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.treasurelist.CFTreasureListTree; +import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; public abstract class AbstractGameObjectAttributesDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); + /** * The gameObject objects that already are shown, to avoid opening a dialog * twice. */ - protected final Map<G, JDialog> dialogs = new HashMap<G, JDialog>(); + private final Map<G, JDialog> dialogs = new HashMap<G, JDialog>(); /** + * @param archTypeList the list of CF type-data + */ + @NotNull + private final CFArchTypeList archTypeList; + + /** + * @param mainControl main control + */ + @NotNull + private final MainControl<G, A, R, V> mainControl; + + /** + * @param animationObjects the animation objects instance to use + */ + @NotNull + private final AnimationObjects<?> animationObjects; + + /** + * @param mapManager the map manager + */ + @NotNull + private final MapManager<G, A, R, V> mapManager; + + /** + * @param treasureListTree the treasure list tree instance to use + */ + @NotNull + private final CFTreasureListTree<G, A, R> treasureListTree; + + /** + * @param faceObjects the FaceObjects instance to use + */ + @NotNull + private final FaceObjects faceObjects; + + /** + * @param mapFileFilter the Swing file filter to use + */ + @NotNull + private final FileFilter mapFileFilter; + + /** + * Creates a new instance. + * @param archTypeList the list of CF type-data + * @param mainControl main control + * @param animationObjects the animation objects instance to use + * @param mapManager the map manager + * @param treasureListTree the treasure list tree instance to use + * @param faceObjects the FaceObjects instance to use + * @param mapFileFilter the Swing file filter to use + */ + protected AbstractGameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + this.archTypeList = archTypeList; + this.mainControl = mainControl; + this.animationObjects = animationObjects; + this.mapManager = mapManager; + this.treasureListTree = treasureListTree; + this.faceObjects = faceObjects; + this.mapFileFilter = mapFileFilter; + } + + /** * Shows the game object attributes dialog for a given {@link GameObject} * instance. * @param gameObject the GameObject to be displayed by this dialog */ - public abstract void showAttribDialog(@NotNull final G gameObject); + public void showAttribDialog(@NotNull final G gameObject) { + synchronized (dialogs) { + if (dialogs.containsKey(gameObject)) { + dialogs.get(gameObject).toFront(); + } else { + final AbstractGameObjectAttributesDialog<G, A, R> pane = newGameObjectAttributesDialog(archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); + dialog.getRootPane().setDefaultButton(pane.okButton); + dialog.setResizable(true); + dialog.setModal(false); + dialog.setVisible(true); + dialogs.put(pane.gameObject, dialog); + } + } + } + /** * Hides the game object attributes dialog for a given {@link GameObject} * instance. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-26 07:29:39
|
Revision: 4467 http://gridarta.svn.sourceforge.net/gridarta/?rev=4467&view=rev Author: akirschbaum Date: 2008-07-26 07:29:46 +0000 (Sat, 26 Jul 2008) Log Message: ----------- Remove calls to MainControl.getArchetypeSet(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-26 07:14:11 UTC (rev 4466) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-26 07:29:46 UTC (rev 4467) @@ -368,7 +368,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory(typeList, this, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory(typeList, this, archetypeSet, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter); } /** Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 07:14:11 UTC (rev 4466) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 07:29:46 UTC (rev 4467) @@ -37,6 +37,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.ArchAttribType; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialog; @@ -74,14 +75,15 @@ * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control + * @param archetypeSet the archetype set to use * @param animationObjects the animation objects instance to use * @param mapManager the map manager * @param treasureListTree the treasure list tree * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - super(gameObjectAttributesDialogFactory, archTypeList, gameObject, mainControl, animationObjects, treasureListTree, faceObjects, mapFileFilter); + public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + super(gameObjectAttributesDialogFactory, archTypeList, gameObject, mainControl, archetypeSet, animationObjects, treasureListTree, faceObjects, mapFileFilter); this.mapManager = mapManager; } @@ -469,7 +471,7 @@ // now lets assign the visible face - perhaps we have still a anim gameObject.setObjectFace(); - imagePanel.setIcon(mainControl.getArchetypeSet().getFace(gameObject)); + imagePanel.setIcon(getFace(gameObject)); if (newMsg != null) { // set new msg text only when it is not equal to Archetype Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:14:11 UTC (rev 4466) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:29:46 UTC (rev 4467) @@ -27,11 +27,11 @@ import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialogFactory; import net.sf.gridarta.treasurelist.CFTreasureListTree; -import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { @@ -40,20 +40,21 @@ * Creates a new instance. * @param archTypeList the list of CF type-data * @param mainControl main control + * @param archetypeSet the archetype set to use * @param animationObjects the animation objects instance to use * @param mapManager the map manager * @param treasureListTree the treasure list tree instance to use * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - super(archTypeList, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + public GameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + super(archTypeList, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } /** {@inheritDoc} */ @Override - protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } } // class GameObjectAttributesDialogFactory Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-26 07:14:11 UTC (rev 4466) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-26 07:29:46 UTC (rev 4467) @@ -443,7 +443,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory(typeList, this, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory(typeList, this, archetypeSet, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter); } /** Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 07:14:11 UTC (rev 4466) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 07:29:46 UTC (rev 4467) @@ -37,6 +37,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.ArchAttribType; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialog; @@ -73,14 +74,15 @@ * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control + * @param archetypeSet the archetype set to use * @param animationObjects the animation objects instance to use * @param mapManager the map manager * @param treasureListTree the treasure list tree * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - super(gameObjectAttributesDialogFactory, archTypeList, gameObject, mainControl, animationObjects, treasureListTree, faceObjects, mapFileFilter); + public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + super(gameObjectAttributesDialogFactory, archTypeList, gameObject, mainControl, archetypeSet, animationObjects, treasureListTree, faceObjects, mapFileFilter); this.mapManager = mapManager; } Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:14:11 UTC (rev 4466) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:29:46 UTC (rev 4467) @@ -27,11 +27,11 @@ import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialogFactory; import net.sf.gridarta.treasurelist.CFTreasureListTree; -import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { @@ -40,20 +40,21 @@ * Creates a new instance. * @param archTypeList the list of CF type-data * @param mainControl main control + * @param archetypeSet the archetype set to use * @param animationObjects the animation objects instance to use * @param mapManager the map manager * @param treasureListTree the treasure list tree instance to use * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - super(archTypeList, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + public GameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + super(archTypeList, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } /** {@inheritDoc} */ @Override - protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } } // class GameObjectAttributesDialogFactory Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java 2008-07-26 07:14:11 UTC (rev 4466) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java 2008-07-26 07:29:46 UTC (rev 4467) @@ -79,6 +79,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; @@ -125,6 +126,12 @@ /** Reference to MainControl. */ protected final MainControl<G, A, R, ?> mainControl; + /** + * The archetype set to use. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + /** The animation objects to use. */ @NotNull private final AnimationObjects<?> animationObjects; @@ -191,16 +198,18 @@ * @param archTypeList Reference to the list of CFArchTypes. * @param gameObject GameObject to show dialog for. * @param mainControl MainControl, for retrieving AnimationObjects etc. + * @param archetypeSet the archetype set to use * @param animationObjects the animation objects instance to use * @param treasureListTree the treasure list tree * @param faceObjects the face objects instance to use * @param mapFileFilter the Swing FileFilter for map files */ - protected AbstractGameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<G, A, R, ?> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + protected AbstractGameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<G, A, R, ?> gameObjectAttributesDialogFactory, final CFArchTypeList archTypeList, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.archTypeList = archTypeList; this.gameObject = gameObject.getHead(); this.mainControl = mainControl; + this.archetypeSet = archetypeSet; this.animationObjects = animationObjects; this.treasureListTree = treasureListTree; this.faceObjects = faceObjects; @@ -390,8 +399,8 @@ * @param gameObject GameObject to return face for. * @return Face for the supplied GameObject. */ - private ImageIcon getFace(@NotNull final G gameObject) { - return mainControl.getArchetypeSet().getFace(gameObject); + protected ImageIcon getFace(@NotNull final G gameObject) { + return archetypeSet.getFace(gameObject); } /** Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-26 07:14:11 UTC (rev 4466) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-26 07:29:46 UTC (rev 4467) @@ -27,6 +27,7 @@ import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; @@ -60,6 +61,12 @@ private final MainControl<G, A, R, V> mainControl; /** + * The archetype set to use. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + /** * @param animationObjects the animation objects instance to use */ @NotNull @@ -93,15 +100,17 @@ * Creates a new instance. * @param archTypeList the list of CF type-data * @param mainControl main control + * @param archetypeSet the archetype set to use * @param animationObjects the animation objects instance to use * @param mapManager the map manager * @param treasureListTree the treasure list tree instance to use * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - protected AbstractGameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + protected AbstractGameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { this.archTypeList = archTypeList; this.mainControl = mainControl; + this.archetypeSet = archetypeSet; this.animationObjects = animationObjects; this.mapManager = mapManager; this.treasureListTree = treasureListTree; @@ -119,7 +128,7 @@ if (dialogs.containsKey(gameObject)) { dialogs.get(gameObject).toFront(); } else { - final AbstractGameObjectAttributesDialog<G, A, R> pane = newGameObjectAttributesDialog(archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + final AbstractGameObjectAttributesDialog<G, A, R> pane = newGameObjectAttributesDialog(archTypeList, gameObject, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); dialog.getRootPane().setDefaultButton(pane.okButton); dialog.setResizable(true); @@ -148,12 +157,13 @@ * @param archTypeList the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control + * @param archetypeSet the archetype set to use * @param animationObjects the animation objects instance to use * @param mapManager the map manager * @param treasureListTree the treasure list tree * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - protected abstract AbstractGameObjectAttributesDialog<G, A, R> newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter); + protected abstract AbstractGameObjectAttributesDialog<G, A, R> newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter); } // class AbstractGameObjectAttributesDialogFactory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-26 08:13:51
|
Revision: 4469 http://gridarta.svn.sourceforge.net/gridarta/?rev=4469&view=rev Author: akirschbaum Date: 2008-07-26 08:13:56 +0000 (Sat, 26 Jul 2008) Log Message: ----------- Move CFArchType and related classes to separate package. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/BitmaskAttrib.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttrib.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/HelpActionListener.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/archtype/ trunk/src/app/net/sf/gridarta/archtype/ArchTypeParseException.java trunk/src/app/net/sf/gridarta/archtype/CAttribBitmask.java trunk/src/app/net/sf/gridarta/archtype/CFArchAttrib.java trunk/src/app/net/sf/gridarta/archtype/CFArchType.java trunk/src/app/net/sf/gridarta/archtype/CFArchTypeList.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/ArchTypeParseException.java trunk/src/app/net/sf/gridarta/CAttribBitmask.java trunk/src/app/net/sf/gridarta/CFArchAttrib.java trunk/src/app/net/sf/gridarta/CFArchType.java trunk/src/app/net/sf/gridarta/CFArchTypeList.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-26 07:30:42 UTC (rev 4468) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-26 08:13:56 UTC (rev 4469) @@ -50,10 +50,10 @@ import javax.swing.filechooser.FileFilter; import javax.xml.parsers.ParserConfigurationException; import net.sf.gridarta.AbstractMainControl; -import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.MainControl; import net.sf.gridarta.XmlHelper; +import net.sf.gridarta.archtype.CFArchTypeList; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gameobject.match.GameObjectMatchers; Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 07:30:42 UTC (rev 4468) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 08:13:56 UTC (rev 4469) @@ -31,11 +31,11 @@ import javax.swing.JTextField; import javax.swing.filechooser.FileFilter; import javax.swing.text.JTextComponent; -import net.sf.gridarta.CFArchAttrib; -import net.sf.gridarta.CFArchType; -import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; +import net.sf.gridarta.archtype.CFArchAttrib; +import net.sf.gridarta.archtype.CFArchType; +import net.sf.gridarta.archtype.CFArchTypeList; import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:30:42 UTC (rev 4468) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 08:13:56 UTC (rev 4469) @@ -24,9 +24,9 @@ import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; +import net.sf.gridarta.archtype.CFArchTypeList; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-26 07:30:42 UTC (rev 4468) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-26 08:13:56 UTC (rev 4469) @@ -55,10 +55,10 @@ import javax.swing.filechooser.FileFilter; import javax.xml.parsers.ParserConfigurationException; import net.sf.gridarta.AbstractMainControl; -import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.MainControl; import net.sf.gridarta.XmlHelper; +import net.sf.gridarta.archtype.CFArchTypeList; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.gameobject.match.GameObjectMatcher; Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 07:30:42 UTC (rev 4468) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 08:13:56 UTC (rev 4469) @@ -31,11 +31,11 @@ import javax.swing.JTextField; import javax.swing.filechooser.FileFilter; import javax.swing.text.JTextComponent; -import net.sf.gridarta.CFArchAttrib; -import net.sf.gridarta.CFArchType; -import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; +import net.sf.gridarta.archtype.CFArchAttrib; +import net.sf.gridarta.archtype.CFArchType; +import net.sf.gridarta.archtype.CFArchTypeList; import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:30:42 UTC (rev 4468) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 08:13:56 UTC (rev 4469) @@ -24,9 +24,9 @@ import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; +import net.sf.gridarta.archtype.CFArchTypeList; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; Deleted: trunk/src/app/net/sf/gridarta/ArchTypeParseException.java =================================================================== --- trunk/src/app/net/sf/gridarta/ArchTypeParseException.java 2008-07-26 07:30:42 UTC (rev 4468) +++ trunk/src/app/net/sf/gridarta/ArchTypeParseException.java 2008-07-26 08:13:56 UTC (rev 4469) @@ -1,45 +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; - -import java.io.IOException; - -/** - * Thrown when parsing a CFArchType failed. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class ArchTypeParseException extends IOException { - - /** The serial version UID. */ - private static final long serialVersionUID = 1; - - /** Create an ArchTypeParseException. */ - public ArchTypeParseException() { - } - - /** - * Create an ArchTypeParseException. - * @param s The detail message. - */ - public ArchTypeParseException(final String s) { - super(s); - } - -} // class ArchTypeParseException Deleted: trunk/src/app/net/sf/gridarta/CAttribBitmask.java =================================================================== --- trunk/src/app/net/sf/gridarta/CAttribBitmask.java 2008-07-26 07:30:42 UTC (rev 4468) +++ trunk/src/app/net/sf/gridarta/CAttribBitmask.java 2008-07-26 08:13:56 UTC (rev 4469) @@ -1,342 +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; - -import java.awt.Component; -import java.awt.GridLayout; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Pattern; -import javax.swing.JCheckBox; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathExpressionException; -import net.sf.gridarta.gui.gameobjectattributesdialog.BitmaskAttrib; -import net.sf.japi.xml.NodeListIterator; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.Nullable; -import org.w3c.dom.Element; - -/** - * This class manages bitmask values which appear in Gridarta arch attributes. - * Attacktype, spellpath and material are such bitmasks. They are disguised for - * the user, with the help of the attribute dialog. - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public final class CAttribBitmask { - - /** The Logger for printing log messages. */ - private static final Logger log = Logger.getLogger(CAttribBitmask.class); - - /** - * Maximum number of characters in a line before linebreak (see {@link - * #getText(int)}). - */ - private static final int MAX_CHARS_PER_LINE = 35; // 50 - - /** Names of the bitmask-entries. */ - private final String[] bitName; - - /** - * Set if the bitmask value may be encoded as strings in external - * representation; unset if the value is encoded as an integer. - */ - private final boolean isNamed; - - /** Maps names for value encoding in external representation. */ - private final Map<String, Integer> namedValues = new HashMap<String, Integer>(); - - /** Maps bit value to external representation. */ - private final Map<Integer, String> encodings = new HashMap<Integer, String>(); - - /** Maps bit value to readable name. */ - private final Map<Integer, String> names = new HashMap<Integer, String>(); - - /** Number of bitmask entries (not counting zero). */ - private final int number; - - /** A pattern that matches one or more spaces. */ - private static final Pattern patternSpaces = Pattern.compile(" +"); - - /** - * Constructor of a bitmask from XML element. - * @param xpath XPath for XPath evaluation - * @param bitmasksElement xml bitmask element - * @throws XPathExpressionException in case of XPath evaluation errors - */ - public CAttribBitmask(final XPath xpath, final Element bitmasksElement) throws XPathExpressionException { - final NodeListIterator<Element> entries = new NodeListIterator<Element>(xpath, bitmasksElement, "bmentry"); - isNamed = bitmasksElement.getAttribute("is_named").equals("yes"); - final String[] tmp = new String[32]; - int bitValues = 0; - for (final Element elem : entries) { - final String bitAttr = elem.getAttribute("bit"); - final String valueAttr = elem.getAttribute("value"); - if (bitAttr.length() != 0 && valueAttr.length() != 0) { - throw new IllegalArgumentException("element contains both 'bit' and 'value' attributes"); - } - - final int value; - if (bitAttr.length() != 0) { - final int bitValue; - try { - bitValue = Integer.parseInt(bitAttr); - } catch (final NumberFormatException ex) { - throw new IllegalArgumentException("invalid 'bit' value: " + bitAttr); - } - if (bitValue < 0 || bitValue >= tmp.length) { - throw new IllegalArgumentException("invalid 'bit' value: " + bitValue); - } - if (tmp[bitValue] != null) { - throw new IllegalArgumentException("duplicate 'bit' value: " + bitValue); - } - tmp[bitValue] = elem.getAttribute("name"); - value = 1 << bitValue; - bitValues = Math.max(bitValues, bitValue + 1); - } else { - if (!isNamed) { - throw new IllegalArgumentException("'value' attribute allowed only in named bitmasks"); - } - try { - value = Integer.parseInt(valueAttr); - } catch (final NumberFormatException ex) { - throw new IllegalArgumentException("invalid 'value' value: " + valueAttr); - } - } - - final String encodingAttr = elem.getAttribute("encoding"); - if (isNamed) { - if (encodingAttr.length() == 0) { - throw new IllegalArgumentException("missing 'encoding' attribute"); - } - namedValues.put(encodingAttr, value); - encodings.put(value, encodingAttr); - } else { - if (encodingAttr.length() != 0) { - throw new IllegalArgumentException("unused 'encoding' attribute"); - } - } - names.put(value, elem.getAttribute("name")); - } - if (bitValues <= 0) { - throw new IllegalArgumentException("no 'bit' entries"); - } - number = bitValues; - bitName = new String[bitValues]; - System.arraycopy(tmp, 0, bitName, 0, bitValues); - - if (isNamed && !encodings.containsKey(0)) { - throw new IllegalArgumentException("missing name for value 0"); - } - if (isNamed && !encodings.containsKey((1 << bitName.length) - 1)) { - throw new IllegalArgumentException("missing name for value " + ((1 << bitName.length) - 1)); - } - } - - /** - * Check whether the given bit-index is an active bit in the bitmask. - * @param index index of the bit to check (range from 1-'number') - * @param mask bitmask to check against - * @return <code>true</code> if the bit is active in mask, otherwise - * <code>false</code> - */ - private static boolean isActive(final int index, final int mask) { - final int bit = 1 << (index - 1); - return (mask & bit) == bit; - } - - /** - * Generate the text to be displayed for a given bitmask value. - * @param value bitmask value - * @return <code>String</code> with all entries belonging to the bitmask - */ - @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); - for (final String word : encodeValueAsList(value, names)) { - sb.append(word); - } - return sb.toString(); - } - - /** - * Convert a value to external representation. - * <p/> - * <p>Note that this function does not always return the shortest or - * simplest possible external represenatation. This is intentional to create - * the exact same result as the Crossfire server. - * @param value the value to convert - * @return the external representation of the value - */ - public String encodeValue(final int value) { - if (!isNamed) { - return Integer.toString(value); - } - - final StringBuilder sb = new StringBuilder(); - for (final String word : encodeValueAsList(value, encodings)) { - if (sb.length() > 0) { - sb.append(' '); - } - sb.append(word); - } - return sb.toString(); - } - - /** - * Convert a value to string representation. - * <p/> - * <p>Note that this function does not always return the shortest or - * simplest possible external represenatation. This is intentional to create - * the exact same result as the Crossfire server. - * @param value the value to convert - * @param strings maps bitvalues to strings - * @return the string representation of the value - */ - public List<String> encodeValueAsList(final int value, final Map<Integer, String> strings) { - final List<String> result = new ArrayList<String>(); - - final int moveAll = (1 << bitName.length) - 1; - - final List<String> negResult = new ArrayList<String>(); - negResult.add("all"); - - /* Quick check, and probably fairly common */ - if (value == moveAll) { - return negResult; - } - if (value == 0) { - final String str = strings.get(0); - result.add(str == null ? "0" : str); - return result; - } - - /* We basically slide the bits down. Why look at moveAll? because we - * may want to return a string like 'all -swim', and if we just looked - * at mt, we couldn't get that. - */ - int allCount = 0; - for (int i = moveAll, count = 0; i != 0; i >>= 1, count++) { - final String strNull = strings.get(1 << count); - final String str = strNull == null ? Integer.toString(1 << count) : strNull; - if ((value & (1 << count)) != 0) { - result.add(str); - } else { - negResult.add("-" + str); - allCount++; - } - } - if ((value & ~moveAll) != 0) { - result.add(Integer.toString(value & ~moveAll)); - return result; - } - /* Basically, if there is a single negation, return it, eg 'all -swim'. - * But more than that, just return the enumerated values. It doesn't - * make sense to return 'all -walk -fly_low' - it is shorter to return - * 'fly_high swim' - */ - return allCount <= 1 ? negResult : result; - } - - /** - * Convert a value from external representation. - * @param encodedValue the value in external representation - * @return the decoded value - */ - public int decodeValue(final String encodedValue) { - if (!isNamed) { - try { - return Integer.parseInt(encodedValue); - } catch (final NumberFormatException ex) { - return 0; - } - } - - if (encodedValue.length() == 0) { - return 0; - } - - int result = 0; - for (final String word : patternSpaces.split(encodedValue, 0)) { - final boolean negated; - final String name; - if (word.startsWith("-")) { - negated = true; - name = word.substring(1); - } else { - negated = false; - name = word; - } - final Integer integerValue = namedValues.get(name); - int value; - if (integerValue != null) { - value = integerValue; - } else { - try { - value = Integer.parseInt(name); - } catch (final NumberFormatException ex) { - log.warn("Ignoring unknown bitmask value: " + name); - value = 0; - } - } - if (negated) { - result &= ~value; - } else { - result |= value; - } - } - return result; - } - - /** - * Open a popup frame to select bitmask-entries via chooseboxes. - * @param parentComponent the parent component of this dialog - * @param guiAttr Bitmask attribute to update - * @return Integer with new value or <code>null</code> if the user cancelled - * the dialog - */ - @Nullable - public Integer showBitmaskDialog(final Component parentComponent, final BitmaskAttrib guiAttr) { - final String title = "Choose " + guiAttr.ref.getNameNew().substring(0, 1).toUpperCase() + guiAttr.ref.getNameNew().substring(1); - final JPanel gridPanel = new JPanel(new GridLayout(0, 2, 3, 3)); - final JCheckBox[] checkbox = new JCheckBox[number]; - for (int i = 0; i < number; i++) { - checkbox[i] = new JCheckBox(bitName[i]); - checkbox[i].setSelected(isActive(i + 1, guiAttr.getValue())); - gridPanel.add(checkbox[i]); - } - if (JOptionPane.showConfirmDialog(parentComponent, gridPanel, title, JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE) == JOptionPane.OK_OPTION) { - int newValue = 0; - for (int i = 0; i < number; i++) { - if (checkbox[i].isSelected()) { - newValue |= 1 << i; - } - } - return newValue; - } - return null; - } - -} // class CAttribBitmask Deleted: trunk/src/app/net/sf/gridarta/CFArchAttrib.java =================================================================== --- trunk/src/app/net/sf/gridarta/CFArchAttrib.java 2008-07-26 07:30:42 UTC (rev 4468) +++ trunk/src/app/net/sf/gridarta/CFArchAttrib.java 2008-07-26 08:13:56 UTC (rev 4469) @@ -1,364 +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; - -import net.sf.gridarta.gameobject.ArchAttribType; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; - -/** - * This Class contains the data of one arch attribute. - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @todo don't use a manually linked list. - */ -public final class CFArchAttrib { - - /** The Logger for printing log messages. */ - private static final Logger log = Logger.getLogger(CFArchAttrib.class); - - /** XML attribute name for arch. */ - public static final String XML_KEY_ARCH = "arch"; - - /** XML attribute name for begin of arch. */ - public static final String XML_KEY_ARCH_BEGIN = "arch_begin"; - - /** XML attribute name for end of arch. */ - public static final String XML_KEY_ARCH_END = "arch_end"; - - /** XML attribute name for editor specific information. */ - public static final String XML_KEY_EDITOR = "editor"; - - /** XML attribute name for type definitions. */ - public static final String XML_ATTR_TYPE = "type"; - - /** XML attribute name for length information. */ - public static final String XML_INPUT_LENGTH = "length"; - - /** Next CFArchAttrib in linked list. */ - private CFArchAttrib next; - - /** Original attribute name (from the CF arches). */ - @NotNull - private String nameOld = ""; - - @Nullable - private String endingOld = null; // for dataType = ArchAttribType.TEXT this is the terminating string - - // (example: 'endmsg' for arch message) - @NotNull - private String nameNew = ""; // new attr. name (for the user-friendly GUI) - - /** Datatype of this attribute. */ - private ArchAttribType dataType; - - /** Description of this attribute. */ - private String text; - - /** Optional attribute: set length for input JTextFields. */ - private int inputLength = 0; - - @Nullable - private String[] misc = null; // string array for misc. use - // ArchAttribType.BOOL_SPEC uses misc[0] = true value, misc[1] = false value - // ArchAttribType.BITMASK uses misc[0] = bitmask name - // ArchAttribType.LIST uses misc[0] = list name - // ArchAttribType.TEXT uses misc[0] = file extension; may be null - - /** Identifier of the section this CFArchAttrib is in. */ - private int secId; - - /** Name of the section this attribute is in. */ - private String section; - - /** Create a CFArchAttrib. */ - public CFArchAttrib() { - } - - /** - * Loading the data from an xml element into this object. - * @param root the xml 'attribute' element - * @param tlist the archtype list - * @param typeName (descriptive) name of the type this attribute belongs to - * (e.g. "Weapon") - * @return true if the parsing was successful - */ - @SuppressWarnings({"FeatureEnvy"}) - public boolean load(final Element root, final CFArchTypeList tlist, final String typeName) { - - // parse the info text from the element's "body" - parseText(root); - - // arch syntax key - Attr a1; - if ((a1 = root.getAttributeNode(XML_KEY_ARCH)) != null) { - nameOld = a1.getValue().trim(); - } - - // editor syntax key - if ((a1 = root.getAttributeNode(XML_KEY_EDITOR)) != null) { - nameNew = a1.getValue().trim(); - } - - // type name - final String atype; - if ((a1 = root.getAttributeNode(XML_ATTR_TYPE)) != null) { - atype = a1.getValue().trim(); - } else { - // error: no type - log.error("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has attribute missing '" + XML_ATTR_TYPE + "'."); - return false; - } - - // input length (optional) - if ((a1 = root.getAttributeNode(XML_INPUT_LENGTH)) != null) { - try { - inputLength = Integer.parseInt(a1.getValue()); - } catch (final NumberFormatException de) { - log.error("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has attribute with invalid length '" + a1.getValue() + "' (must be a number)."); - } - } - - // which type of attribute is it? - if (atype.equalsIgnoreCase("bool")) { - dataType = ArchAttribType.BOOL; // normal bool - } else if (atype.equalsIgnoreCase("bool_special")) { - // customized boolean type: - dataType = ArchAttribType.BOOL_SPEC; - - // parse true and false values: - a1 = root.getAttributeNode("true"); - final Attr a2 = root.getAttributeNode("false"); - if (a1 == null || a2 == null) { - log.error("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has bool_special attribute missing 'true' or 'false' value."); - return false; - } - - misc = new String[2]; // 'misc' string contains the values - misc[0] = a1.getValue().trim(); // string for true - misc[1] = a2.getValue().trim(); // string for false - } else if (atype.equalsIgnoreCase("int")) { - dataType = ArchAttribType.INT; - } else if (atype.equalsIgnoreCase("long")) { - dataType = ArchAttribType.LONG; - } else if (atype.equalsIgnoreCase("float")) { - dataType = ArchAttribType.FLOAT; - } else if (atype.equalsIgnoreCase("string")) { - dataType = ArchAttribType.STRING; - } else if (atype.equalsIgnoreCase("map_path")) { - dataType = ArchAttribType.MAP_PATH; - } else if (atype.equalsIgnoreCase("script_file")) { - dataType = ArchAttribType.SCRIPT_FILE; - } else if (atype.equalsIgnoreCase("facename")) { - dataType = ArchAttribType.FACENAME; - } else if (atype.equalsIgnoreCase("animname")) { - dataType = ArchAttribType.ANIMNAME; - } else if (atype.equalsIgnoreCase("text")) { - dataType = ArchAttribType.TEXT; - // for text data, the terminating string has to be read too - if ((a1 = root.getAttributeNode(XML_KEY_ARCH_BEGIN)) != null) { - nameOld = a1.getValue().trim(); - } - - if ((a1 = root.getAttributeNode(XML_KEY_ARCH_END)) != null) { - endingOld = a1.getValue().trim(); - } - - if (nameOld == null || nameOld.length() == 0 || endingOld == null || endingOld.length() == 0) { - log.warn("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has text attribute missing '" + XML_KEY_ARCH_BEGIN + "' or '" + XML_KEY_ARCH_END + "'."); - return false; - } - - misc = new String[1]; - if ((a1 = root.getAttributeNode("marker")) != null) { - misc[0] = a1.getValue().trim(); // file extension - } - } else if ("fixed".equalsIgnoreCase(atype)) { - // fixed attribute - dataType = ArchAttribType.FIXED; - if ((a1 = root.getAttributeNode("value")) != null) { - nameNew = a1.getValue().trim(); - } else { - log.warn("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has fixed attribute missing 'value'."); - return false; - } - } else if ("spell".equalsIgnoreCase(atype)) { - // spell attribute - dataType = ArchAttribType.SPELL; - } else if ("nz_spell".equalsIgnoreCase(atype)) { - // spell attribute - dataType = ArchAttribType.ZSPELL; - } else if ("inv_spell".equalsIgnoreCase(atype)) { - // spell attribute - dataType = ArchAttribType.INV_SPELL; - } else if ("inv_spell_optional".equalsIgnoreCase(atype)) { - // spell attribute - dataType = ArchAttribType.INV_SPELL_OPTIONAL; - } else if (atype.startsWith("bitmask")) { - // got a bitmask attribute - final String bitmaskName = atype.substring(8).trim(); - - if (tlist.getBitmaskTable().containsKey(bitmaskName)) { - // the bitmask is well defined - dataType = ArchAttribType.BITMASK; - misc = new String[1]; - misc[0] = bitmaskName; // store bitmask name in misc[0] - } else { - log.warn("In '" + CommonConstants.TYPEDEF_FILE + "', type " + typeName + ": Bitmask \"" + bitmaskName + "\" is undefined."); - return false; - } - } else if (atype.startsWith("list_")) { - // got a bitmask attribute - final String listName = atype.substring(5).trim(); - if (tlist.getListTable().containsKey(listName)) { - // the list is well defined - dataType = ArchAttribType.LIST; - misc = new String[1]; - misc[0] = listName; // store list name in misc[0] - } else { - log.warn("In '" + CommonConstants.TYPEDEF_FILE + "', type " + typeName + ": List \"" + listName + "\" is undefined."); - return false; - } - } else if ("doublelist".startsWith(atype)) { - // got a doublelist attribute - final String listNames = atype.substring(11).trim(); - final int seppos = listNames.indexOf(','); - - if (seppos == -1 || seppos == listNames.length() - 1) { - log.error("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + ", double list: '" + atype + "' does not contain two comma-separated lists."); - return false; - } - - final String listName1 = listNames.substring(0, seppos); - final String listName2 = listNames.substring(seppos + 1); - - if (tlist.getListTable().containsKey(listName1) && tlist.getListTable().containsKey(listName2)) { - // the lists are well defined - dataType = ArchAttribType.DBLLIST; - misc = new String[2]; - misc[0] = listName1; // store list name in misc[0] - misc[1] = listName2; // store list name in misc[1] - } else { - log.error("In '" + CommonConstants.TYPEDEF_FILE + "', type " + typeName + ": List \"" + listName1 + "\" or \"" + listName2 + "\" is undefined."); - } - } else if ("treasurelist".equalsIgnoreCase(atype)) { - dataType = ArchAttribType.TREASURE; - } else { - // unknown type - log.warn("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has an attribute with unknown type: '" + atype + "'."); - return false; - } - - return true; - } - - /** - * This method reads the text out of the element's "body" and cuts off - * whitespaces at front/end of lines. This is a bit hacky but simple. - * Probably a more correct approach would be to display the info text in an - * html context. - * @param root xml attribute element - */ - private void parseText(final Element root) { - text = root.getTextContent().trim().replaceAll("\\s*\n\\s*", "\n"); - } - - /** - * Assign this attribute to a section. - * @param id section ID - * @param sname section name - */ - public void setSection(final int id, final String sname) { - secId = id; - section = sname; - } - - /** - * Get a new instance of this object with identical content. - * @return clone instance of this <code>CFArchAttrib</code> - */ - public CFArchAttrib getClone() { - final CFArchAttrib newattr = new CFArchAttrib(); - - newattr.next = next; - - newattr.nameOld = nameOld; - newattr.endingOld = endingOld; - newattr.nameNew = nameNew; - newattr.dataType = dataType; - newattr.inputLength = inputLength; - - newattr.text = text; - - // important: we don't create a new instance of 'misc', only a reference - newattr.misc = misc; - - newattr.secId = secId; - newattr.section = section; - - return newattr; - } - - public int getSecId() { - return secId; - } - - public void setSecId(final int newId) { - secId = newId; - } - - public String getSecName() { - return section; - } - - @NotNull - public String getNameOld() { - return nameOld; - } - - @NotNull - public String getNameNew() { - return nameNew; - } - - public ArchAttribType getDataType() { - return dataType; - } - - public String getText() { - return text; - } - - @Nullable - public String[] getMisc() { - return misc; - } - - public int getInputLength() { - return inputLength; - } - - public void setNext(final CFArchAttrib cfAttr) { - next = cfAttr; - } - -} // class CFArchAttrib Deleted: trunk/src/app/net/sf/gridarta/CFArchType.java =================================================================== --- trunk/src/app/net/sf/gridarta/CFArchType.java 2008-07-26 07:30:42 UTC (rev 4468) +++ trunk/src/app/net/sf/gridarta/CFArchType.java 2008-07-26 08:13:56 UTC (rev 4469) @@ -1,499 +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; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import net.sf.gridarta.gameobject.ArchAttribType; -import net.sf.gridarta.gameobject.Archetype; -import net.sf.japi.swing.ActionFactory; -import net.sf.japi.xml.NodeListIterator; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; -import org.w3c.dom.Attr; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -/** - * Contains the data of one Gridarta Object-Type. The data is read from a - * definitions file called 'types.xml'. It is mainly used as info-base for the - * arch-attribute GUI. - * @author <a href="mailto:and...@gm...">Andreas Vogl</a> - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - * @todo find a better name, eventually ObjectType or ArchetypeType. - */ -public class CFArchType { - - /** The Logger for printing log messages. */ - private static final Logger log = Logger.getLogger(CFArchType.class); - - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - - /** Attribute Element Name. */ - public static final String XML_ATTRIBUTE = "attribute"; - - /** Required Element Name. */ - public static final String XML_REQUIRED = "required"; - - /** Ignore Element Name. */ - public static final String XML_IGNORE = "ignore"; - - /** Import Type Element Name. */ - public static final String XML_IMPORT_TYPE = "import_type"; - - /** Value Element Name. */ - public static final String XML_VALUE = "value"; - - /** Description Element Name. */ - public static final String XML_DESC = "description"; - - /** Use Element Name. */ - public static final String XML_USE = "use"; - - /** Section Element Name. */ - public static final String XML_SECTION = "section"; - - /** Default / parent CFArchType. */ - private final CFArchType defaultArchType; - - /** Type name (artificial). */ - private String typeName; - - /** Type number. */ - private int typenr = 0; - - /** Description. */ - private String desc; - - /** Usage Notes. */ - private String use; - - /** - * Number of attribute sections. The number of attribute sections determine - * the number of tabs to be used. - */ - private int sectionNum; - - /** List of Arch Attributes (array). */ - private CFArchAttrib[] attr; - - /** - * List of additional attributes that an object must have in order to be of - * this type. The values are paired, even index = attribute name, odd index - * = attribute value. typeAttributes[0] = attribute name of first type - * attribute. typeAttributes[1] = attribute value of first type attribute. - * typeAttributes[2] = attribute name of second type attribute. ... - */ - private String[] typeAttributes = null; - - /** - * Create a CFArchType. - * @param defaultArchType default archetype - */ - public CFArchType(final CFArchType defaultArchType) { - typeName = ""; - sectionNum = 2; // there's always the "general" and "special" sections (even if empty) - this.defaultArchType = defaultArchType; // set head of list - } - - /** - * Loading the data from an xml type element into this CFArchType. Since - * users are expected to edit the type definitions, I have tried to design - * the parser to be somewhat robust and provide error feedback. - * @param root the xml 'type' element which is going to be parsed - * @param tlist archetype type list - * @param ignoreListTable the ignore_lists contents - * @return true if the object was parsed correctly and can be used - * @throws ArchTypeParseException In case <var>root</var> is malformed or - * contains bogus data. - * @todo I'm sucking slow, improve me - */ - public boolean load(final Element root, final CFArchTypeList tlist, @NotNull final Map<String, List<String>> ignoreListTable) throws ArchTypeParseException { - // this vector is used to store a temporary linked list of attributes - final List<CFArchAttrib> attrList = new ArrayList<CFArchAttrib>(); - - // for internal section handling: - final List<String> secNames = new ArrayList<String>(); // list of section names - final Map<String, String> ignoreTable = new HashMap<String, String>(); // ignore list - final Set<String> autoIgnoreTable = new HashSet<String>(); - - if (root.getNodeName().equalsIgnoreCase("default_type")) { - // special case: default type (this one contains the default attributes) - typenr = -1; - typeName = "default"; - - if (log.isDebugEnabled()) { - log.debug("type: default"); - } - } else { - try { - // parse the type name - typeName = root.getAttribute("name").trim(); - - // parse the type number - typenr = Integer.parseInt(root.getAttribute("number").trim()); - - if (log.isDebugEnabled()) { - log.debug("reading type: " + typeName + ", " + typenr); - } - - // parse 'required' attributes - final Element required = NodeListIterator.getFirstChild(root, XML_REQUIRED); - if (required != null) { - final List<String> tmp = new ArrayList<String>(); - for (final Element elem : new NodeListIterator<Element>(required, XML_ATTRIBUTE)) { - final Attr a1 = elem.getAttributeNode(CFArchAttrib.XML_KEY_ARCH); - final Attr a2 = elem.getAttributeNode(XML_VALUE); - if (a1 == null || a2 == null) { - throw new ArchTypeParseException("In '" + XML_REQUIRED + "' element of type " + typeName + ": " + XML_ATTRIBUTE + " missing '" + CFArchAttrib.XML_KEY_ARCH + "' or '" + XML_VALUE + "'."); - } else { - tmp.add(a1.getValue().trim()); - tmp.add(a2.getValue().trim()); - } - } - - // create array and copy vector content into the array: (key1, value1, key2, value2, ...) - if (!tmp.isEmpty()) { - typeAttributes = tmp.toArray(new String[tmp.size()]); - } - } - } catch (final NumberFormatException e) { - // parsing type number failed: - throw new ArchTypeParseException("In " + CommonConstants.TYPEDEF_FILE + ": Type " + typeName + " has invalid type number '" + root.getAttribute("number") + "'."); - } - - // parse 'ignore' elements - final Element signore = NodeListIterator.getFirstChild(root, XML_IGNORE); - if (signore != null) { - // load all attributes in the ignore section - for (final Element elem : new NodeListIterator<Element>(signore, XML_ATTRIBUTE)) { - final Attr a1 = elem.getAttributeNode(CFArchAttrib.XML_KEY_ARCH); - if (a1 == null) { - throw new ArchTypeParseException("In '" + XML_IGNORE + "' section of type " + typeName + ": " + XML_ATTRIBUTE + " missing '" + CFArchAttrib.XML_KEY_ARCH + "'."); - } else { - ignoreTable.put(a1.getValue().trim(), ""); - } - } - - // load attributes from ignore lists - for (final Element elem : new NodeListIterator<Element>(signore, "ignore_list")) { - final Attr a1 = elem.getAttributeNode("name"); - if (a1 == null) { - throw new ArchTypeParseException("In '" + XML_IGNORE + "' section of type " + typeName + ": ignore_list missing 'name'."); - } else - if (ignoreListTable.containsKey(a1.getValue().trim())) { - // just copy everything from ignorelist to this ignore section - final List<String> ignlist = ignoreListTable.get(a1.getValue().trim()); - for (final String ignItem : ignlist) { - ignoreTable.put(ignItem, ""); - } - } else { - throw new RuntimeException("In '" + XML_IGNORE + "' section of type " + typeName + ": ignore_list with name \"" + a1.getValue() + "\" is undefined."); - } - } - } - } - - String importName = null; - { - // load description - Element elem; - if ((elem = NodeListIterator.getFirstChild(root, XML_DESC)) != null) { - desc = elem.getTextContent().trim(); - } - - // load use - if ((elem = NodeListIterator.getFirstChild(root, XML_USE)) != null) { - use = elem.getTextContent().trim(); - } - - // load import_type - if ((elem = NodeListIterator.getFirstChild(root, XML_IMPORT_TYPE)) != null) { - final Attr a1 = elem.getAttributeNode("name"); - if (a1 == null) { - throw new RuntimeException("In file '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has " + XML_IMPORT_TYPE + " element without 'name'."); - } else { - importName = a1.getValue().trim(); - } - } - } - - // now get all children and process them in order: - for (final Element elem : new NodeListIterator<Element>(root, Node.ELEMENT_NODE)) { - // attribute directly in type element - if (elem.getNodeName().equalsIgnoreCase(XML_ATTRIBUTE)) { - parseAttribute(elem, secNames, false, null, attrList, tlist); - final Attr a1 = elem.getAttributeNode(CFArchAttrib.XML_KEY_ARCH); - if (a1 != null) { - autoIgnoreTable.add(a1.getValue().trim()); - } - } - - // attributes in a section - if (elem.getNodeName().equalsIgnoreCase(XML_SECTION) && elem.hasChildNodes()) { - final Attr a1 = elem.getAttributeNode("name"); - if (a1 == null) { - throw new ArchTypeParseException("In " + CommonConstants.TYPEDEF_FILE + ": Type " + typeName + " contains a " + XML_SECTION + " missing 'name'."); - } - // get section name - final String section = a1.getValue().trim(); - sectionNum++; // increment number of valid sections - secNames.add(section); // tmp. store name - - // parse all attributes in the section - for (final Element elem2 : new NodeListIterator<Element>(elem, XML_ATTRIBUTE)) { - // got an attribute element possibly in a section - parseAttribute(elem2, secNames, true, section, attrList, tlist); - final Attr a2 = elem2.getAttributeNode(CFArchAttrib.XML_KEY_ARCH); - if (a2 != null) { - autoIgnoreTable.add(a2.getValue().trim()); - } - } - } - } - - // ------ now generate the array of attributes: ------ - // calculate how many attributes we've got - - int j = attrList.size(); - - // don't forget about the default attributes - int numDef = 0; - if (defaultArchType != null && defaultArchType.attr != null && defaultArchType.attr.length > 0) { - // create an array to store the references to the default attributes: - final CFArchAttrib[] defList = new CFArchAttrib[defaultArchType.attr.length]; - - for (final CFArchAttrib attrib : defaultArchType.attr) { - // add all attributes from the default_type which are not in the ignoreTable - if (!ignoreTable.containsKey(attrib.getNameOld()) && !autoIgnoreTable.contains(attrib.getNameOld())) { - defList[numDef] = attrib; - j++; - numDef++; - } - } - - // now also count the imported attributes - CFArchAttrib[] importList = null; // imported attributes array - - int importNum = 0; - if (importName != null) { - // search through all known types, looking for import type - CFArchType impType = null; - for (final CFArchType archType : tlist) { - if (archType == this) { - continue; - } - if (archType.typeName.equalsIgnoreCase(importName)) { - impType = archType; - break; - } - } - - if (impType != null) { - // initialize array to store imported attributes - importList = new CFArchAttrib[impType.attr.length]; - - for (final CFArchAttrib attrib : impType.attr) { - if (autoIgnoreTable.contains(attrib.getNameOld())) { - continue; - } - - if (!attrib.getSecName().equalsIgnoreCase("general")) { - // import this attribute: - if (!attrib.getSecName().equalsIgnoreCase("general") && !attrib.getSecName().equalsIgnoreCase("special") && !secNames.contains(attrib.getSecName())) { - sectionNum++; // increment number of valid sections - secNames.add(attrib.getSecName()); - } - - importList[importNum] = attrib.getClone(); - - // get section id - final int newId = secNames.indexOf(attrib.getSecName()); - if (newId >= 0) { - importList[importNum].setSecId(newId + 2); - } - - importNum++; - j++; - } - } - } else { - throw new ArchTypeParseException("Syntax Error in file '" + CommonConstants.TYPEDEF_FILE + "' (" + typeName + "):\n import type \"" + importName + "\" not found!"); - } - } - - attr = new CFArchAttrib[j]; // create array of appropriate size - - // first put in the references to the default attributes: - for (int k = numDef; k > 0; k--) { - attr[numDef - k] = defList[numDef - k]; - if (log.isDebugEnabled()) { - log.debug("*** (" + (numDef - k) + ") " + attr[numDef - k].getNameNew()); - } - } - - // next put in the references of imported arches (at end of array) - for (int k = 0; k < importNum; k++) { - attr[j - importNum + k] = importList[k]; - if (log.isDebugEnabled()) { - log.debug("*** (" + (j - importNum + k) + ") " + attr[j - importNum + k].getNameNew()); - } - } - } else { - attr = new CFArchAttrib[j]; // create array of appropriate size - } - - // put the list of the (non-default) CFArchAttribs into an array: - for (int i = 0; numDef < j && i < attrList.size(); numDef++, i++) { - attr[numDef] = attrList.get(i); - } - - return true; // archetype was parsed correctly - } - - /** - * Parse an xml attribute element. If parsing succeeds, the new CFArchAttrib - * is added to the temporare linked list provided by the parameters (see - * below). Assignment of sections to attributes also happens in this - * method. - * @param elem the xml attribute element - * @param secNames vector storing all section names - * @param inSection true if this attribute belongs to a (custom-defined) - * section - * @param section name of the section (only relevant if 'inSection'==true) - * @param attrList linked list of attributes - * @param tlist arch type list - */ - private void parseAttribute(final Element elem, final List<String> secNames, final boolean inSection, final String section, final List<CFArchAttrib> attrList, final CFArchTypeList tlist) { - // create new instance - final CFArchAttrib attrib = new CFArchAttrib(); - - // parse attribute - if (attrib.load(elem, tlist, typeName)) { - // add this attribute to the list: - if (!attrList.isEmpty()) { - attrList.get(attrList.size() - 1).setNext(attrib); - } - attrList.add(attrib); - - // parsing succeeded, now assign this attribute to a section - if (attrib.getDataType() == ArchAttribType.TEXT) { - // text attributes all have their own section - attrib.setSection(sectionNum, attrib.getNameNew()); - sectionNum++; - secNames.add(attrib.getNameNew()); // tmp. store name - } else if (inSection) { - // if the attribute is in a section, so be it: - attrib.setSection(sectionNum - 1, section); - } else if (typenr == -1) { - // default attributes go into the "General" section - attrib.setSection(0, "General"); - } else { - // sectionless stuff goes into the "Special" section - attrib.setSection(1, "Special"); - } - - if (log.isDebugEnabled()) { - final Attr a = elem.getAttributeNode("arch"); - log.debug("attribute " + (a == null ? "null" : a.getValue()) + ", section " + attrib.getSecId() + " = '" + attrib.getSecName() + "'"); - } - } - } - - /** - * Create the documentation to this GameObject-type. - * @return the full html-text to be (parsed and) displayed - */ - public String createHtmlDocu() { - return ACTION_FACTORY.format("arcDoc.htmlText", typeName, desc != null ? desc.trim() : "", use != null ? use.trim() : ""); - } - - public CFArchAttrib[] getAttr() { - return attr; - } - - /** - * Returns number of attribute sections. The number of attribute sections - * determine the number of tabs to be used. - * @return number of attribute sections. - */ - public int getSectionNum() { - return sectionNum; - } - - public int getTypeNr() { - return typenr; - } - - public String getTypeName() { - return typeName; - } - - public String[] getTypeAttr() { - return typeAttributes; - } - - public boolean matches(@NotNull final Archetype<?, ?, ?> archetype) { - if (typenr != archetype.getArchTypNr()) { - return false; - } - - if (typeAttributes == null) { - // no type-attributes, so we only compared type-numbers - return true; - } - - // check if all the type-attributes match - final int numArgs = typeAttributes.length / 2; - - if (log.isDebugEnabled()) { - log.debug("# type: " + typeName); - } - - for (int t = 0, l = numArgs * 2; t < l; t += 2) { - final String attrValue = archetype.getAttributeString(typeAttributes[t]); - - if (log.isDebugEnabled()) { - log.debug(" arch: '" + attrValue + "', type: '" + typeAttributes[t + 1] + "'"); - } - - if (!attrValue.equals(typeAttributes[t + 1]) && !(typeAttributes[t + 1].equals("0") && attrValue.length() == 0)) { - if (log.isDebugEnabled()) { - log.debug("-> attr: " + typeAttributes[t] + " NO match"); - } - - return false; - } - - if (log.isDebugEnabled()) { - log.debug("-> attr: " + typeAttributes[t] + " YES match"); - } - } - - // we've got a match after all - return true; - } - -} // class CFArchType Deleted: trunk/src/app/net/sf/gridarta/CFArchTypeList.java =================================================================== --- trunk/src/app/net/sf/gridarta/CFArchTypeList.java 2008-07-26 07:30:42 UTC (rev 4468) +++ trunk/src/app/net/sf/gridarta/CFArchTypeList.java 2008-07-26 08:13:56 UTC (rev 4469) @@ -1,363 +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 publis... [truncated message content] |
From: <aki...@us...> - 2008-07-26 08:49:56
|
Revision: 4473 http://gridarta.svn.sourceforge.net/gridarta/?rev=4473&view=rev Author: akirschbaum Date: 2008-07-26 08:50:01 +0000 (Sat, 26 Jul 2008) Log Message: ----------- Rename CFArchType into ArchetypeType. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gui/ArchetypesActions.java trunk/src/app/net/sf/gridarta/gui/GameObjectAttributesPanel.java trunk/src/app/net/sf/gridarta/gui/MainView.java trunk/src/app/net/sf/gridarta/gui/ObjectChoiceDisplay.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/TableModel.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialog.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/BitmaskAttrib.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/DialogAttrib.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/HelpActionListener.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttribute.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeType.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeTypeParseException.java trunk/src/app/net/sf/gridarta/archtype/ArchetypeTypeSet.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/archtype/ArchTypeParseException.java trunk/src/app/net/sf/gridarta/archtype/CFArchAttrib.java trunk/src/app/net/sf/gridarta/archtype/CFArchType.java trunk/src/app/net/sf/gridarta/archtype/CFArchTypeList.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-26 08:18:39 UTC (rev 4472) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-26 08:50:01 UTC (rev 4473) @@ -53,7 +53,7 @@ import net.sf.gridarta.CommonConstants; import net.sf.gridarta.MainControl; import net.sf.gridarta.XmlHelper; -import net.sf.gridarta.archtype.CFArchTypeList; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gameobject.match.GameObjectMatchers; @@ -182,7 +182,7 @@ private final GlobalSettingsImpl globalSettings = new GlobalSettingsImpl(); /** The list of archtype-data (loaded from "types.xml"). */ - private CFArchTypeList typeList = null; + private ArchetypeTypeSet archetypeTypeSet = null; /** The map validators. */ private final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators; @@ -257,7 +257,7 @@ log.error("Cannot create XML parser: " + ex.getMessage()); throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); } - typeList = new CFArchTypeList(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath()); + archetypeTypeSet = new ArchetypeTypeSet(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath()); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath()); new ArchetypeSetSpellLoader<GameObject, MapArchObject, Archetype>().load(archetypeSet, Archetype.TYPE_SPELL, gameObjectSpells); gameObjectSpells.sort(); @@ -288,10 +288,10 @@ throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } mapActions = new MapActions(this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); - typeList.getListTable().put("event", ScriptArchUtils.getEventTypes()); + archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); try { final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); - typeList.loadTypesFromXML(filename); + archetypeTypeSet.loadTypesFromXML(filename); } catch (final FileNotFoundException ex) { log.error("Cannot read " + CommonConstants.TYPEDEF_FILE + ": " + ex.getMessage()); } @@ -301,7 +301,7 @@ // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_TRIGGER_ALTAR, Archetype.TYPE_DETECTOR, Archetype.TYPE_TRIGGER_MARKER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_CONTAINER); final GameObjectAttributesPanel gameObjectAttributesPanel = new GameObjectAttributesPanel(this, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); - mainView.init(gameObjectAttributesPanel, selectedSquareView, typeList, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); + mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); mapActions.updateMenuState(); scriptControl.getView().setMenu((JMenu) ACTION_FACTORY.find(mainView.getJMenuBar(), "plugins")); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); @@ -315,7 +315,7 @@ globalSettings.setAutoPopupDocu(false); } - net.sf.gridarta.gameobject.GameObject.initialize(typeList, gameObjectMatchers); + net.sf.gridarta.gameobject.GameObject.initialize(archetypeTypeSet, gameObjectMatchers); getCopyBuffer().init(getGridartaObjectsFactory().newMapArchObject(false)); mainActions.init(); @@ -368,7 +368,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory(typeList, this, archetypeSet, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory(archetypeTypeSet, this, archetypeSet, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter); } /** @@ -616,7 +616,7 @@ /** {@inheritDoc} */ public void openAttrDialog(final GameObject gameObject) { - if (typeList.isEmpty()) { + if (archetypeTypeSet.isEmpty()) { // types.xml is missing! ACTION_FACTORY.showMessageDialog(mainView, "openAttrDialogNoTypes"); } else if (gameObject != null && !gameObject.hasUndefinedArchetype()) { @@ -782,8 +782,8 @@ } /** {@inheritDoc} */ - public CFArchTypeList getTypeList() { - return typeList; + public ArchetypeTypeSet getArchetypeTypeSet() { + return archetypeTypeSet; } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 08:18:39 UTC (rev 4472) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 08:50:01 UTC (rev 4473) @@ -33,9 +33,9 @@ import javax.swing.text.JTextComponent; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; -import net.sf.gridarta.archtype.CFArchAttrib; -import net.sf.gridarta.archtype.CFArchType; -import net.sf.gridarta.archtype.CFArchTypeList; +import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeType; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -72,7 +72,7 @@ /** * Constructor, creates the GUI layout. * @param gameObjectAttributesDialogFactory the associated factory - * @param archTypeList the list of CF type-data + * @param archetypeTypeSet the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control * @param archetypeSet the archetype set to use @@ -82,14 +82,14 @@ * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - super(gameObjectAttributesDialogFactory, archTypeList, gameObject, mainControl, archetypeSet, animationObjects, treasureListTree, faceObjects, mapFileFilter); + public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + super(gameObjectAttributesDialogFactory, archetypeTypeSet, gameObject, mainControl, archetypeSet, animationObjects, treasureListTree, faceObjects, mapFileFilter); this.mapManager = mapManager; } /** {@inheritDoc} */ @Override - protected JComboBox buildSpellBox(final CFArchAttrib attr) { + protected JComboBox buildSpellBox(final ArchetypeAttribute attr) { // first parse the spell-number value from gameObject int spnum = gameObject.getAttributeInt(attr.getNameOld()); // spell number @@ -141,7 +141,7 @@ */ @Override protected boolean applySettings2() { - final CFArchType typeStruct = archTypeList.getTypeOfArch(gameObject); // the type structure for this gameObject + final ArchetypeType typeStruct = archetypeTypeSet.getTypeOfArch(gameObject); // the type structure for this gameObject final StringBuilder newArchText = new StringBuilder(); String newName = null; @@ -237,7 +237,7 @@ if (inline != null) { if (attr.ref.getNameOld().equalsIgnoreCase("name")) { // special case #1: "name"-textfield - if (typeStruct.getTypeNr() == Archetype.TYPE_EVENT_CONNECTOR) { + if (typeStruct.getTypeNo() == Archetype.TYPE_EVENT_CONNECTOR) { // events are special: they do not inherit the // archetype name for empty names newName = inline; @@ -308,7 +308,7 @@ // get selected index of ComboBox final int attrValTmp = ((JComboBox) attr.getInput()).getSelectedIndex(); // fetch value according to this list entry: - attrVal = ((List<Integer>) archTypeList.getListTable().get(attr.ref.getMisc()[0])).get(2 * attrValTmp); + attrVal = ((List<Integer>) archetypeTypeSet.getListTable().get(attr.ref.getMisc()[0])).get(2 * attrValTmp); break; default: assert false; @@ -378,8 +378,8 @@ } break; case DBLLIST: { - final int val1 = ((List<Integer>) archTypeList.getListTable().get(attr.ref.getMisc()[0])).get(2 * ((JComboBox[]) attr.getInput())[0].getSelectedIndex()); - final int val2 = ((List<Integer>) archTypeList.getListTable().get(attr.ref.getMisc()[1])).get(2 * ((JComboBox[]) attr.getInput())[1].getSelectedIndex()); + final int val1 = ((List<Integer>) archetypeTypeSet.getListTable().get(attr.ref.getMisc()[0])).get(2 * ((JComboBox[]) attr.getInput())[0].getSelectedIndex()); + final int val2 = ((List<Integer>) archetypeTypeSet.getListTable().get(attr.ref.getMisc()[1])).get(2 * ((JComboBox[]) attr.getInput())[1].getSelectedIndex()); final int combinedVal = val1 + val2; if (archetype.getAttributeInt(attr.ref.getNameOld()) != combinedVal) { @@ -492,7 +492,7 @@ // deal with syntax errors now if (errors != null) { - if (typeStruct == archTypeList.getArchType(1)) { + if (typeStruct == archetypeTypeSet.getArchetypeType(1)) { // for generic (misc) type, all errors are automatically kept. // "misc" is no real type - it is more a default mask for unknown types gameObject.addObjectText(errors.trim()); @@ -510,7 +510,7 @@ /** {@inheritDoc} */ @Override protected boolean isSpecialNameHandling() { - return type.getTypeNr() != Archetype.TYPE_EVENT_CONNECTOR; + return type.getTypeNo() != Archetype.TYPE_EVENT_CONNECTOR; } } // class GameObjectAttributesDialog Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 08:18:39 UTC (rev 4472) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 08:50:01 UTC (rev 4473) @@ -26,7 +26,7 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; -import net.sf.gridarta.archtype.CFArchTypeList; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; @@ -38,7 +38,7 @@ /** * Creates a new instance. - * @param archTypeList the list of CF type-data + * @param archetypeTypeSet the list of CF type-data * @param mainControl main control * @param archetypeSet the archetype set to use * @param animationObjects the animation objects instance to use @@ -47,14 +47,14 @@ * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - super(archTypeList, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + super(archetypeTypeSet, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } /** {@inheritDoc} */ @Override - protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + return new GameObjectAttributesDialog(this, archetypeTypeSet, gameObject, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } } // class GameObjectAttributesDialogFactory Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-26 08:18:39 UTC (rev 4472) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-26 08:50:01 UTC (rev 4473) @@ -58,7 +58,7 @@ import net.sf.gridarta.CommonConstants; import net.sf.gridarta.MainControl; import net.sf.gridarta.XmlHelper; -import net.sf.gridarta.archtype.CFArchTypeList; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.gameobject.match.GameObjectMatcher; @@ -223,7 +223,7 @@ private final GlobalSettingsImpl globalSettings = new GlobalSettingsImpl(); /** The list of archtype-data (loaded from "types.xml"). */ - private CFArchTypeList typeList = null; + private ArchetypeTypeSet archetypeTypeSet = null; /** Client Control Component. */ private ProcessRunner controlClient; @@ -317,7 +317,7 @@ log.error("Cannot create XML parser: " + ex.getMessage()); throw new MissingResourceException("Cannot create XML parser: " + ex.getMessage(), null, null); } - typeList = new CFArchTypeList(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath()); + archetypeTypeSet = new ArchetypeTypeSet(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath()); final GameObjectMatchers gameObjectMatchers = new GameObjectMatchers(xmlHelper.getDocumentBuilder(), xmlHelper.getXPath()); gameObjectSpells.sort(); XMLSpellLoader.load(getConfigurationDirectory(), CommonConstants.SPELL_FILE, xmlHelper.getDocumentBuilder(), numberSpells); @@ -350,7 +350,7 @@ mapActions = new MapActions(this, getMapManager(), exitMatcher, mapFileFilter, selectedSquareView); try { final String filename = IOUtils.getResourceURLAsString(getConfigurationDirectory(), CommonConstants.TYPEDEF_FILE); - typeList.loadTypesFromXML(filename); + archetypeTypeSet.loadTypesFromXML(filename); } catch (final FileNotFoundException ex) { log.error("Cannot read " + CommonConstants.TYPEDEF_FILE + ": " + ex.getMessage()); } @@ -360,7 +360,7 @@ // Initialize the main view final LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic> lockedItemsControl = new LockedItemsControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager(), Archetype.TYPE_LOCKED_DOOR, Archetype.TYPE_SPECIAL_KEY, Archetype.TYPE_ALTAR_TRIGGER, Archetype.TYPE_MARKER, Archetype.TYPE_INVENTORY_CHECKER, Archetype.TYPE_SPAWN_POINT, Archetype.TYPE_CONTAINER); final GameObjectAttributesPanel gameObjectAttributesPanel = new GameObjectAttributesPanel(this, getMapManager(), animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView); - mainView.init(gameObjectAttributesPanel, selectedSquareView, typeList, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); + mainView.init(gameObjectAttributesPanel, selectedSquareView, archetypeTypeSet, mapTileListBottom, gameObjectMatchers, archetypeChooserControl); mapActions.updateMenuState(); archetypeParser = new ArchetypeParser(this, archetypeChooserControl, animationObjects, archetypeSet); mainView.getStatusBar().setStatusText("Loading Archetypes..."); @@ -373,7 +373,7 @@ globalSettings.setAutoPopupDocu(false); } - net.sf.gridarta.gameobject.GameObject.initialize(typeList, gameObjectMatchers); + net.sf.gridarta.gameobject.GameObject.initialize(archetypeTypeSet, gameObjectMatchers); getCopyBuffer().init(getGridartaObjectsFactory().newMapArchObject(false)); mainActions.init(); @@ -443,7 +443,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory(typeList, this, archetypeSet, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory(archetypeTypeSet, this, archetypeSet, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter); } /** @@ -798,7 +798,7 @@ /** {@inheritDoc} */ public void openAttrDialog(final GameObject gameObject) { - if (typeList.isEmpty()) { + if (archetypeTypeSet.isEmpty()) { // types.xml is missing! ACTION_FACTORY.showMessageDialog(mainView, "openAttrDialogNoTypes"); } else if (gameObject != null && !gameObject.hasUndefinedArchetype()) { @@ -963,8 +963,8 @@ } /** {@inheritDoc} */ - public CFArchTypeList getTypeList() { - return typeList; + public ArchetypeTypeSet getArchetypeTypeSet() { + return archetypeTypeSet; } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-07-26 08:18:39 UTC (rev 4472) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-07-26 08:50:01 UTC (rev 4473) @@ -127,7 +127,7 @@ public void addLast(@NotNull final GameObject gameObject) { super.addLast(gameObject); // force type change when a MONSTER is put in a spawn point - if (typeList.getTypeOfArch(this) != null && typeList.getTypeOfArch(this).getTypeNr() == TYPE_SPAWN_POINT && typeList.getTypeOfArch(gameObject).getTypeNr() == TYPE_MOB) { + if (archetypeTypeSet.getTypeOfArch(this) != null && archetypeTypeSet.getTypeOfArch(this).getTypeNo() == TYPE_SPAWN_POINT && archetypeTypeSet.getTypeOfArch(gameObject).getTypeNo() == TYPE_MOB) { gameObject.archType = TYPE_SPAWN_POINT_MOB; // change to SPAWN_POINT_MOB } } @@ -137,7 +137,7 @@ public void addFirst(@NotNull final GameObject gameObject) { super.addFirst(gameObject); // force type change when a MONSTER is put in a spawn point - if (typeList.getTypeOfArch(this).getTypeNr() == TYPE_SPAWN_POINT && typeList.getTypeOfArch(gameObject).getTypeNr() == TYPE_MOB) { + if (archetypeTypeSet.getTypeOfArch(this).getTypeNo() == TYPE_SPAWN_POINT && archetypeTypeSet.getTypeOfArch(gameObject).getTypeNo() == TYPE_MOB) { gameObject.archType = TYPE_SPAWN_POINT_MOB; // change to SPAWN_POINT_MOB } } Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 08:18:39 UTC (rev 4472) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-26 08:50:01 UTC (rev 4473) @@ -33,9 +33,9 @@ import javax.swing.text.JTextComponent; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; -import net.sf.gridarta.archtype.CFArchAttrib; -import net.sf.gridarta.archtype.CFArchType; -import net.sf.gridarta.archtype.CFArchTypeList; +import net.sf.gridarta.archtype.ArchetypeAttribute; +import net.sf.gridarta.archtype.ArchetypeType; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.ArchAttribType; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; @@ -71,7 +71,7 @@ /** * Constructor, creates the GUI layout. * @param gameObjectAttributesDialogFactory the associated factory - * @param archTypeList the list of CF type-data + * @param archetypeTypeSet the list of CF type-data * @param gameObject the GameObject to be displayed by this dialog * @param mainControl main control * @param archetypeSet the archetype set to use @@ -81,14 +81,14 @@ * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - super(gameObjectAttributesDialogFactory, archTypeList, gameObject, mainControl, archetypeSet, animationObjects, treasureListTree, faceObjects, mapFileFilter); + public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory, @NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + super(gameObjectAttributesDialogFactory, archetypeTypeSet, gameObject, mainControl, archetypeSet, animationObjects, treasureListTree, faceObjects, mapFileFilter); this.mapManager = mapManager; } /** {@inheritDoc} */ @Override - protected JComboBox buildSpellBox(final CFArchAttrib attr) { + protected JComboBox buildSpellBox(final ArchetypeAttribute attr) { // first parse the spell-number value from gameObject int spnum = gameObject.getAttributeInt(attr.getNameOld()); // spell number @@ -140,7 +140,7 @@ */ @Override protected boolean applySettings2() { - final CFArchType typeStruct = archTypeList.getTypeOfArch(gameObject); // the type structure for this gameObject + final ArchetypeType typeStruct = archetypeTypeSet.getTypeOfArch(gameObject); // the type structure for this gameObject final StringBuilder newArchText = new StringBuilder(); String newName = null; @@ -293,7 +293,7 @@ // get selected index of ComboBox final int attrValTmp = ((JComboBox) attr.getInput()).getSelectedIndex(); // fetch value according to this list entry: - attrVal = ((List<Integer>) archTypeList.getListTable().get(attr.ref.getMisc()[0])).get(2 * attrValTmp); + attrVal = ((List<Integer>) archetypeTypeSet.getListTable().get(attr.ref.getMisc()[0])).get(2 * attrValTmp); break; default: assert false; @@ -307,8 +307,8 @@ } break; case DBLLIST: { - final int val1 = ((List<Integer>) archTypeList.getListTable().get(attr.ref.getMisc()[0])).get(2 * ((JComboBox[]) attr.getInput())[0].getSelectedIndex()); - final int val2 = ((List<Integer>) archTypeList.getListTable().get(attr.ref.getMisc()[1])).get(2 * ((JComboBox[]) attr.getInput())[1].getSelectedIndex()); + final int val1 = ((List<Integer>) archetypeTypeSet.getListTable().get(attr.ref.getMisc()[0])).get(2 * ((JComboBox[]) attr.getInput())[0].getSelectedIndex()); + final int val2 = ((List<Integer>) archetypeTypeSet.getListTable().get(attr.ref.getMisc()[1])).get(2 * ((JComboBox[]) attr.getInput())[1].getSelectedIndex()); final int combinedVal = val1 + val2; if (archetype.getAttributeInt(attr.ref.getNameOld()) != combinedVal) { @@ -421,7 +421,7 @@ // deal with syntax errors now if (errors != null) { - if (typeStruct == archTypeList.getArchType(0)) { + if (typeStruct == archetypeTypeSet.getArchetypeType(0)) { // for generic (misc) type, all errors are automatically kept. // "misc" is no real type - it is more a default mask for unknown types gameObject.addObjectText(errors.trim()); Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 08:18:39 UTC (rev 4472) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 08:50:01 UTC (rev 4473) @@ -26,7 +26,7 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManager; -import net.sf.gridarta.archtype.CFArchTypeList; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.anim.AnimationObjects; import net.sf.gridarta.gameobject.face.FaceObjects; @@ -38,7 +38,7 @@ /** * Creates a new instance. - * @param archTypeList the list of CF type-data + * @param archetypeTypeSet the list of CF type-data * @param mainControl main control * @param archetypeSet the archetype set to use * @param animationObjects the animation objects instance to use @@ -47,14 +47,14 @@ * @param faceObjects the FaceObjects instance to use * @param mapFileFilter the Swing file filter to use */ - public GameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - super(archTypeList, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + super(archetypeTypeSet, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } /** {@inheritDoc} */ @Override - protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + return new GameObjectAttributesDialog(this, archetypeTypeSet, gameObject, mainControl, archetypeSet, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } } // class GameObjectAttributesDialogFactory Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-07-26 08:18:39 UTC (rev 4472) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-07-26 08:50:01 UTC (rev 4473) @@ -22,7 +22,7 @@ import java.io.File; import java.util.Random; import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.archtype.CFArchTypeList; +import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeParser; import net.sf.gridarta.gameobject.ArchetypeSet; @@ -222,7 +222,7 @@ * Returns the list with the types for the Archetypes and GameObjects. * @return The list with the types for the Archetypes and GameObjects. */ - CFArchTypeList getTypeList(); + ArchetypeTypeSet getArchetypeTypeSet(); /** * Return the numbered spell objects. Deleted: trunk/src/app/net/sf/gridarta/archtype/ArchTypeParseException.java =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchTypeParseException.java 2008-07-26 08:18:39 UTC (rev 4472) +++ trunk/src/app/net/sf/gridarta/archtype/ArchTypeParseException.java 2008-07-26 08:50:01 UTC (rev 4473) @@ -1,45 +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.archtype; - -import java.io.IOException; - -/** - * Thrown when parsing a CFArchType failed. - * @author <a href="mailto:ch...@ri...">Christian Hujer</a> - */ -public class ArchTypeParseException extends IOException { - - /** The serial version UID. */ - private static final long serialVersionUID = 1; - - /** Create an ArchTypeParseException. */ - public ArchTypeParseException() { - } - - /** - * Create an ArchTypeParseException. - * @param s The detail message. - */ - public ArchTypeParseException(final String s) { - super(s); - } - -} // class ArchTypeParseException Copied: trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttribute.java (from rev 4472, trunk/src/app/net/sf/gridarta/archtype/CFArchAttrib.java) =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttribute.java (rev 0) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeAttribute.java 2008-07-26 08:50:01 UTC (rev 4473) @@ -0,0 +1,365 @@ +/* + * 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.archtype; + +import net.sf.gridarta.CommonConstants; +import net.sf.gridarta.gameobject.ArchAttribType; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; + +/** + * This Class contains the data of one arch attribute. + * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @todo don't use a manually linked list. + */ +public final class ArchetypeAttribute { + + /** The Logger for printing log messages. */ + private static final Logger log = Logger.getLogger(ArchetypeAttribute.class); + + /** XML attribute name for arch. */ + public static final String XML_KEY_ARCH = "arch"; + + /** XML attribute name for begin of arch. */ + public static final String XML_KEY_ARCH_BEGIN = "arch_begin"; + + /** XML attribute name for end of arch. */ + public static final String XML_KEY_ARCH_END = "arch_end"; + + /** XML attribute name for editor specific information. */ + public static final String XML_KEY_EDITOR = "editor"; + + /** XML attribute name for type definitions. */ + public static final String XML_ATTR_TYPE = "type"; + + /** XML attribute name for length information. */ + public static final String XML_INPUT_LENGTH = "length"; + + /** Next CFArchAttrib in linked list. */ + private ArchetypeAttribute next; + + /** Original attribute name (from the CF arches). */ + @NotNull + private String nameOld = ""; + + @Nullable + private String endingOld = null; // for dataType = ArchAttribType.TEXT this is the terminating string + + // (example: 'endmsg' for arch message) + @NotNull + private String nameNew = ""; // new attr. name (for the user-friendly GUI) + + /** Datatype of this attribute. */ + private ArchAttribType dataType; + + /** Description of this attribute. */ + private String text; + + /** Optional attribute: set length for input JTextFields. */ + private int inputLength = 0; + + @Nullable + private String[] misc = null; // string array for misc. use + // ArchAttribType.BOOL_SPEC uses misc[0] = true value, misc[1] = false value + // ArchAttribType.BITMASK uses misc[0] = bitmask name + // ArchAttribType.LIST uses misc[0] = list name + // ArchAttribType.TEXT uses misc[0] = file extension; may be null + + /** Identifier of the section this CFArchAttrib is in. */ + private int secId; + + /** Name of the section this attribute is in. */ + private String section; + + /** Create a CFArchAttrib. */ + public ArchetypeAttribute() { + } + + /** + * Loading the data from an xml element into this object. + * @param root the xml 'attribute' element + * @param tlist the archtype list + * @param typeName (descriptive) name of the type this attribute belongs to + * (e.g. "Weapon") + * @return true if the parsing was successful + */ + @SuppressWarnings({"FeatureEnvy"}) + public boolean load(final Element root, final ArchetypeTypeSet tlist, final String typeName) { + + // parse the info text from the element's "body" + parseText(root); + + // arch syntax key + Attr a1; + if ((a1 = root.getAttributeNode(XML_KEY_ARCH)) != null) { + nameOld = a1.getValue().trim(); + } + + // editor syntax key + if ((a1 = root.getAttributeNode(XML_KEY_EDITOR)) != null) { + nameNew = a1.getValue().trim(); + } + + // type name + final String atype; + if ((a1 = root.getAttributeNode(XML_ATTR_TYPE)) != null) { + atype = a1.getValue().trim(); + } else { + // error: no type + log.error("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has attribute missing '" + XML_ATTR_TYPE + "'."); + return false; + } + + // input length (optional) + if ((a1 = root.getAttributeNode(XML_INPUT_LENGTH)) != null) { + try { + inputLength = Integer.parseInt(a1.getValue()); + } catch (final NumberFormatException de) { + log.error("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has attribute with invalid length '" + a1.getValue() + "' (must be a number)."); + } + } + + // which type of attribute is it? + if (atype.equalsIgnoreCase("bool")) { + dataType = ArchAttribType.BOOL; // normal bool + } else if (atype.equalsIgnoreCase("bool_special")) { + // customized boolean type: + dataType = ArchAttribType.BOOL_SPEC; + + // parse true and false values: + a1 = root.getAttributeNode("true"); + final Attr a2 = root.getAttributeNode("false"); + if (a1 == null || a2 == null) { + log.error("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has bool_special attribute missing 'true' or 'false' value."); + return false; + } + + misc = new String[2]; // 'misc' string contains the values + misc[0] = a1.getValue().trim(); // string for true + misc[1] = a2.getValue().trim(); // string for false + } else if (atype.equalsIgnoreCase("int")) { + dataType = ArchAttribType.INT; + } else if (atype.equalsIgnoreCase("long")) { + dataType = ArchAttribType.LONG; + } else if (atype.equalsIgnoreCase("float")) { + dataType = ArchAttribType.FLOAT; + } else if (atype.equalsIgnoreCase("string")) { + dataType = ArchAttribType.STRING; + } else if (atype.equalsIgnoreCase("map_path")) { + dataType = ArchAttribType.MAP_PATH; + } else if (atype.equalsIgnoreCase("script_file")) { + dataType = ArchAttribType.SCRIPT_FILE; + } else if (atype.equalsIgnoreCase("facename")) { + dataType = ArchAttribType.FACENAME; + } else if (atype.equalsIgnoreCase("animname")) { + dataType = ArchAttribType.ANIMNAME; + } else if (atype.equalsIgnoreCase("text")) { + dataType = ArchAttribType.TEXT; + // for text data, the terminating string has to be read too + if ((a1 = root.getAttributeNode(XML_KEY_ARCH_BEGIN)) != null) { + nameOld = a1.getValue().trim(); + } + + if ((a1 = root.getAttributeNode(XML_KEY_ARCH_END)) != null) { + endingOld = a1.getValue().trim(); + } + + if (nameOld == null || nameOld.length() == 0 || endingOld == null || endingOld.length() == 0) { + log.warn("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has text attribute missing '" + XML_KEY_ARCH_BEGIN + "' or '" + XML_KEY_ARCH_END + "'."); + return false; + } + + misc = new String[1]; + if ((a1 = root.getAttributeNode("marker")) != null) { + misc[0] = a1.getValue().trim(); // file extension + } + } else if ("fixed".equalsIgnoreCase(atype)) { + // fixed attribute + dataType = ArchAttribType.FIXED; + if ((a1 = root.getAttributeNode("value")) != null) { + nameNew = a1.getValue().trim(); + } else { + log.warn("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has fixed attribute missing 'value'."); + return false; + } + } else if ("spell".equalsIgnoreCase(atype)) { + // spell attribute + dataType = ArchAttribType.SPELL; + } else if ("nz_spell".equalsIgnoreCase(atype)) { + // spell attribute + dataType = ArchAttribType.ZSPELL; + } else if ("inv_spell".equalsIgnoreCase(atype)) { + // spell attribute + dataType = ArchAttribType.INV_SPELL; + } else if ("inv_spell_optional".equalsIgnoreCase(atype)) { + // spell attribute + dataType = ArchAttribType.INV_SPELL_OPTIONAL; + } else if (atype.startsWith("bitmask")) { + // got a bitmask attribute + final String bitmaskName = atype.substring(8).trim(); + + if (tlist.getBitmaskTable().containsKey(bitmaskName)) { + // the bitmask is well defined + dataType = ArchAttribType.BITMASK; + misc = new String[1]; + misc[0] = bitmaskName; // store bitmask name in misc[0] + } else { + log.warn("In '" + CommonConstants.TYPEDEF_FILE + "', type " + typeName + ": Bitmask \"" + bitmaskName + "\" is undefined."); + return false; + } + } else if (atype.startsWith("list_")) { + // got a bitmask attribute + final String listName = atype.substring(5).trim(); + if (tlist.getListTable().containsKey(listName)) { + // the list is well defined + dataType = ArchAttribType.LIST; + misc = new String[1]; + misc[0] = listName; // store list name in misc[0] + } else { + log.warn("In '" + CommonConstants.TYPEDEF_FILE + "', type " + typeName + ": List \"" + listName + "\" is undefined."); + return false; + } + } else if ("doublelist".startsWith(atype)) { + // got a doublelist attribute + final String listNames = atype.substring(11).trim(); + final int seppos = listNames.indexOf(','); + + if (seppos == -1 || seppos == listNames.length() - 1) { + log.error("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + ", double list: '" + atype + "' does not contain two comma-separated lists."); + return false; + } + + final String listName1 = listNames.substring(0, seppos); + final String listName2 = listNames.substring(seppos + 1); + + if (tlist.getListTable().containsKey(listName1) && tlist.getListTable().containsKey(listName2)) { + // the lists are well defined + dataType = ArchAttribType.DBLLIST; + misc = new String[2]; + misc[0] = listName1; // store list name in misc[0] + misc[1] = listName2; // store list name in misc[1] + } else { + log.error("In '" + CommonConstants.TYPEDEF_FILE + "', type " + typeName + ": List \"" + listName1 + "\" or \"" + listName2 + "\" is undefined."); + } + } else if ("treasurelist".equalsIgnoreCase(atype)) { + dataType = ArchAttribType.TREASURE; + } else { + // unknown type + log.warn("In '" + CommonConstants.TYPEDEF_FILE + "': Type " + typeName + " has an attribute with unknown type: '" + atype + "'."); + return false; + } + + return true; + } + + /** + * This method reads the text out of the element's "body" and cuts off + * whitespaces at front/end of lines. This is a bit hacky but simple. + * Probably a more correct approach would be to display the info text in an + * html context. + * @param root xml attribute element + */ + private void parseText(final Element root) { + text = root.getTextContent().trim().replaceAll("\\s*\n\\s*", "\n"); + } + + /** + * Assign this attribute to a section. + * @param id section ID + * @param sname section name + */ + public void setSection(final int id, final String sname) { + secId = id; + section = sname; + } + + /** + * Get a new instance of this object with identical content. + * @return clone instance of this <code>CFArchAttrib</code> + */ + public ArchetypeAttribute getClone() { + final ArchetypeAttribute newattr = new ArchetypeAttribute(); + + newattr.next = next; + + newattr.nameOld = nameOld; + newattr.endingOld = endingOld; + newattr.nameNew = nameNew; + newattr.dataType = dataType; + newattr.inputLength = inputLength; + + newattr.text = text; + + // important: we don't create a new instance of 'misc', only a reference + newattr.misc = misc; + + newattr.secId = secId; + newattr.section = section; + + return newattr; + } + + public int getSecId() { + return secId; + } + + public void setSecId(final int newId) { + secId = newId; + } + + public String getSecName() { + return section; + } + + @NotNull + public String getNameOld() { + return nameOld; + } + + @NotNull + public String getNameNew() { + return nameNew; + } + + public ArchAttribType getDataType() { + return dataType; + } + + public String getText() { + return text; + } + + @Nullable + public String[] getMisc() { + return misc; + } + + public int getInputLength() { + return inputLength; + } + + public void setNext(final ArchetypeAttribute cfAttr) { + next = cfAttr; + } + +} // class ArchetypeAttribute Copied: trunk/src/app/net/sf/gridarta/archtype/ArchetypeType.java (from rev 4472, trunk/src/app/net/sf/gridarta/archtype/CFArchType.java) =================================================================== --- trunk/src/app/net/sf/gridarta/archtype/ArchetypeType.java (rev 0) +++ trunk/src/app/net/sf/gridarta/archtype/ArchetypeType.java 2008-07-26 08:50:01 UTC (rev 4473) @@ -0,0 +1,500 @@ +/* + * 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.archtype; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import net.sf.gridarta.CommonConstants; +import net.sf.gridarta.gameobject.ArchAttribType; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.japi.swing.ActionFactory; +import net.sf.japi.xml.NodeListIterator; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; +import org.w3c.dom.Attr; +import org.w3c.dom.Element; +import org.w3c.dom.Node; + +/** + * Contains the data of one Gridarta Object-Type. The data is read from a + * definitions file called 'types.xml'. It is mainly used as info-base for the + * arch-attribute GUI. + * @author <a href="mailto:and...@gm...">Andreas Vogl</a> + * @author <a href="mailto:ch...@ri...">Christian Hujer</a> + * @todo find a better name, eventually ObjectType or ArchetypeType. + */ +public class ArchetypeType { + + /** The Logger for printing log messages. */ + private static final Logger log = Logger.getLogger(ArchetypeType.class); + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); + + /** Attribute Element Name. */ + public static final String XML_ATTRIBUTE = "attribute"; + + /** Required Element Name. */ + public static final String XML_REQUIRED = "required"; + + /** Ignore Element Name. */ + public static final String XML_IGNORE = "ignore"; + + /** Import Type Element Name. */ + public static final String XML_IMPORT_TYPE = "import_type"; + + /** Value Element Name. */ + public static final String XML_VALUE = "value"; + + /** Description Element Name. */ + public static final String XML_DESC = "description"; + + /** Use Element Name. */ + public static final String XML_USE = "use"; + + /** Section Element Name. */ + public static final String XML_SECTION = "section"; + + /** Default / parent {@link ArchetypeType}. */ + private final ArchetypeType defaultArchetypeType; + + /** Type name (artificial). */ + private String typeName; + + /** Type number. */ + private int typeNo = 0; + + /** Description. */ + private String desc; + + /** Usage Notes. */ + private String use; + + /** + * Number of attribute sections. The number of attribute sections determine + * the number of tabs to be used. + */ + private int sectionNum; + + /** List of Arch Attributes (array). */ + private ArchetypeAttribute[] attr; + + /** + * List of additional attributes that an object must have in order to be of + * this type. The values are paired, even index = attribute name, odd index + * = attribute value. typeAttributes[0] = attribute name of first type + * attribute. typeAttributes[1] = attribute value of first type attribute. + * typeAttributes[2] = attribute name of second type attribute. ... + */ + private String[] typeAttributes = null; + + /** + * Create a new instance. + * @param defaultArchetypeType default archetype + */ + public ArchetypeType(final ArchetypeType defaultArchetypeType) { + typeName = ""; + sectionNum = 2; // there's always the "general" and "special" sections (even if empty) + this.defaultArchetypeType = defaultArchetypeType; // set head of list + } + + /** + * Loading the data from an xml type element into this instance. Since + * users are expected to edit the type definitions, I have tried to design + * the parser to be somewhat robust and provide error feedback. + * @param root the xml 'type' element which is going to be parsed + * @param archetypeTypeSet archetype type list + * @param ignoreListTable the ignore_lists contents + * @return true if the object was parsed correctly and can be used + * @throws ArchetypeTypeParseException In case <var>root</var> is malformed or + * contains bogus data. + * @todo I'm sucking slow, improve me + */ + public boolean load(final Element root, final ArchetypeTypeSet archetypeTypeSet, @NotNull final Map<String, List<String>> ignoreListTable) throws ArchetypeTypeParseException { + // this vector is used to store a temporary linked list of attributes + final List<ArchetypeAttribute> attrList = new ArrayList<ArchetypeAttribute>(); + + // for internal section handling: + final List<String> secNames = new ArrayList<String>(); // list of section names + final Map<String, String> ignoreTable = new HashMap<String, String>(); // ignore list + final Set<String> autoIgnoreTable = new HashSet<String>(); + + if (root.getNodeName().equalsIgnoreCase("default_type")) { + // special case: default type (this one contains the default attributes) + typeNo = -1; + typeName = "default"; + + ... [truncated message content] |
From: <aki...@us...> - 2008-07-27 21:32:32
|
Revision: 4500 http://gridarta.svn.sourceforge.net/gridarta/?rev=4500&view=rev Author: akirschbaum Date: 2008-07-27 21:32:39 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Fix serialVersionUID field issues. Modified Paths: -------------- trunk/crossfire/src/cfeditor/filter/NamedFilterList.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObject.java trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptArchData.java trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java Modified: trunk/crossfire/src/cfeditor/filter/NamedFilterList.java =================================================================== --- trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2008-07-27 21:29:19 UTC (rev 4499) +++ trunk/crossfire/src/cfeditor/filter/NamedFilterList.java 2008-07-27 21:32:39 UTC (rev 4500) @@ -44,9 +44,6 @@ */ public class NamedFilterList implements Filter { - /** The serial version UID. */ - private static final long serialVersionUID = 1; - /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(NamedFilterList.class); Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-07-27 21:29:19 UTC (rev 4499) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-07-27 21:32:39 UTC (rev 4500) @@ -43,6 +43,9 @@ */ public abstract class GameObject<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends GameObjectContainer<G, A, R> implements Archetype<G, A, R> { + /** The serial version UID. */ + private static final long serialVersionUID = 1; + /** Special constant that's used if a GameObject has no GameObject type set. */ public static final int TYPE_UNSET = -666; Modified: trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObject.java 2008-07-27 21:29:19 UTC (rev 4499) +++ trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObject.java 2008-07-27 21:32:39 UTC (rev 4500) @@ -29,6 +29,9 @@ */ public abstract class AbstractAnimationObject extends AbstractNamedObject implements AnimationObject { + /** The serial version UID. */ + private static final long serialVersionUID = 1; + /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(AbstractAnimationObject.class); Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptArchData.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptArchData.java 2008-07-27 21:29:19 UTC (rev 4499) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/ScriptArchData.java 2008-07-27 21:32:39 UTC (rev 4500) @@ -34,6 +34,9 @@ */ public abstract class ScriptArchData<G extends GameObject<G, ?, ?>> implements Serializable { + /** The serial version UID. */ + private static final long serialVersionUID = 1; + /** * The user has chosen to create a new event, now it is to be done. * @param frame the parent window of the create-new-event dialog Modified: trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2008-07-27 21:29:19 UTC (rev 4499) +++ trunk/src/app/net/sf/gridarta/gui/findarchetypes/FindArchetypesDialog.java 2008-07-27 21:32:39 UTC (rev 4500) @@ -63,9 +63,6 @@ /** Do not perform an auto-search until the input name reaches this length. */ private static final int MINIMUM_AUTOSEARCH_LENGTH = 3; - /** Serial Version UID. */ - private static final long serialVersionUID = 1L; - /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-27 21:47:47
|
Revision: 4509 http://gridarta.svn.sourceforge.net/gridarta/?rev=4509&view=rev Author: akirschbaum Date: 2008-07-27 21:47:56 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Remove unused method parameter. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-07-27 21:43:14 UTC (rev 4508) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-07-27 21:47:56 UTC (rev 4509) @@ -223,7 +223,7 @@ /** {@inheritDoc} */ @Override public void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel) { - AbstractScriptArchEditor.addEventScript(eventList, this, scriptArchData); + AbstractScriptArchEditor.addEventScript(this, scriptArchData); if (!scriptArchData.isEmpty()) { mapanel.setScriptPanelButtonState(true, true, true, true); Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-07-27 21:43:14 UTC (rev 4508) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-07-27 21:47:56 UTC (rev 4509) @@ -394,7 +394,7 @@ /** {@inheritDoc} */ @Override public void addEventScript(@NotNull final JList eventList, @NotNull final GameObjectAttributesPanel<GameObject, MapArchObject, Archetype, ?> mapanel) { - AbstractScriptArchEditor.addEventScript(eventList, this, scriptArchData); + AbstractScriptArchEditor.addEventScript(this, scriptArchData); if (!scriptArchData.isEmpty()) { mapanel.setScriptPanelButtonState(true, true, true, true); Modified: trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java 2008-07-27 21:43:14 UTC (rev 4508) +++ trunk/src/app/net/sf/gridarta/gameobject/scripts/AbstractScriptArchEditor.java 2008-07-27 21:47:56 UTC (rev 4509) @@ -33,7 +33,6 @@ import javax.swing.JDialog; import javax.swing.JFileChooser; import javax.swing.JLabel; -import javax.swing.JList; import javax.swing.JPanel; import javax.swing.JTextField; import javax.swing.WindowConstants; @@ -87,13 +86,11 @@ /** * A popup is opened and the user can create a new scripting event which * gets attached to this gameObject. - * @param panelList JList from the MapArchPanel (script tab) which displays - * the events * @param gameObject GameObject to add event to * @param scriptArchData the <code>ScriptArchData</code> instance to * display */ - public static <G extends GameObject<G, ?, ?>> void addEventScript(final JList panelList, final G gameObject, final ScriptArchData<G> scriptArchData) { + public static <G extends GameObject<G, ?, ?>> void addEventScript(final G gameObject, final ScriptArchData<G> scriptArchData) { final String archName = gameObject.getBestName(); // create a reasonable default script name for lazy users :-) final String defScriptName = ScriptUtils.chooseDefaultScriptName(archName, scriptEnding); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-27 21:55:09
|
Revision: 4511 http://gridarta.svn.sourceforge.net/gridarta/?rev=4511&view=rev Author: akirschbaum Date: 2008-07-27 21:55:17 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Remove calls to MainControl.getArchetypeSet(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/MainActions.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 21:50:37 UTC (rev 4510) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 21:55:17 UTC (rev 4511) @@ -235,7 +235,7 @@ pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("cfeditor", mainView); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 21:50:37 UTC (rev 4510) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 21:55:17 UTC (rev 4511) @@ -293,7 +293,7 @@ pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("daieditor", mainView); Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-27 21:50:37 UTC (rev 4510) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-27 21:55:17 UTC (rev 4511) @@ -65,6 +65,9 @@ /** The MainControl. */ private final MainControl<G, A, R, V> mainControl; + /** The archetype set instance. */ + private final ArchetypeSet<G, A, R> archetypeSet; + /** The pickmap chooser control instance. */ @NotNull private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; @@ -281,14 +284,16 @@ /** * Create a new instance. * @param mainControl the MainControl + * @param archetypeSet the archetype set * @param pickmapChooserControl the pickmap chooser control instance to use * @param animationObjects the animation object instance to use * @param actionFactory The action factory to create actions. * @param faceObjects the FaceObjects instance to use * @param objectChooser the animation objects instance to use */ - public MainActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R> objectChooser) { + public MainActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R> objectChooser) { this.mainControl = mainControl; + this.archetypeSet = archetypeSet; this.pickmapChooserControl = pickmapChooserControl; this.animationObjects = animationObjects; this.actionFactory = actionFactory; @@ -324,7 +329,7 @@ /** Must be called after object creation. */ public void init() { mainControl.getCopyBuffer().addMapModelListener(mapModelListener); - mainControl.getArchetypeSet().addArchetypeSetListener(archetypeSetListener); + archetypeSet.addArchetypeSetListener(archetypeSetListener); refreshMenus(); } @@ -350,7 +355,7 @@ aFloodfill.setEnabled(getFloodfillEnabled() != null); aSelectAll.setEnabled(getSelectAllEnabled() != null); aCollectArches.setEnabled(isCollectArchesEnabled()); - aReloadFaces.setEnabled(!mainControl.getArchetypeSet().isLoadedFromArchive()); + aReloadFaces.setEnabled(!archetypeSet.isLoadedFromArchive()); aValidateMap.setEnabled(getValidateMapEnabled() != null); } @@ -596,7 +601,7 @@ final List<Collectable> collectables = new ArrayList<Collectable>(); collector = new Collector(collectArches); - collectables.add(mainControl.getArchetypeSet()); + collectables.add(archetypeSet); collectables.add(animationObjects); collectables.add(faceObjects); collector.setCollectables(collectables); @@ -758,7 +763,7 @@ * @return whether "collect archetypes" is enabled */ private boolean isCollectArchesEnabled() { - return collector == null && !mainControl.getArchetypeSet().isLoadedFromArchive(); + return collector == null && !archetypeSet.isLoadedFromArchive(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-27 22:00:45
|
Revision: 4512 http://gridarta.svn.sourceforge.net/gridarta/?rev=4512&view=rev Author: akirschbaum Date: 2008-07-27 22:00:53 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Remove calls to MainControl.getCopyBuffer(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/MainActions.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 21:55:17 UTC (rev 4511) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 22:00:53 UTC (rev 4512) @@ -235,7 +235,7 @@ pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("cfeditor", mainView); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 21:55:17 UTC (rev 4511) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 22:00:53 UTC (rev 4512) @@ -293,7 +293,7 @@ pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("daieditor", mainView); Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-27 21:55:17 UTC (rev 4511) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-27 22:00:53 UTC (rev 4512) @@ -25,6 +25,7 @@ import java.util.List; import javax.swing.Action; import javax.swing.JOptionPane; +import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapManagerListener; import net.sf.gridarta.gameobject.Archetype; @@ -68,6 +69,10 @@ /** The archetype set instance. */ private final ArchetypeSet<G, A, R> archetypeSet; + /** The copy buffer instance. */ + @NotNull + private final CopyBuffer<G, A, R, V> copyBuffer; + /** The pickmap chooser control instance. */ @NotNull private final PickmapChooserControl<G, A, R, V> pickmapChooserControl; @@ -285,15 +290,17 @@ * Create a new instance. * @param mainControl the MainControl * @param archetypeSet the archetype set + * @param copyBuffer the copy buffer instance * @param pickmapChooserControl the pickmap chooser control instance to use * @param animationObjects the animation object instance to use * @param actionFactory The action factory to create actions. * @param faceObjects the FaceObjects instance to use * @param objectChooser the animation objects instance to use */ - public MainActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R> objectChooser) { + public MainActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R> objectChooser) { this.mainControl = mainControl; this.archetypeSet = archetypeSet; + this.copyBuffer = copyBuffer; this.pickmapChooserControl = pickmapChooserControl; this.animationObjects = animationObjects; this.actionFactory = actionFactory; @@ -328,7 +335,7 @@ /** Must be called after object creation. */ public void init() { - mainControl.getCopyBuffer().addMapModelListener(mapModelListener); + copyBuffer.addMapModelListener(mapModelListener); archetypeSet.addArchetypeSetListener(archetypeSetListener); refreshMenus(); } @@ -363,7 +370,7 @@ public void clear() { final MapView<G, A, R, V> mapView = getClearEnabled(); if (mapView != null) { - mainControl.getCopyBuffer().clear(mapView); + copyBuffer.clear(mapView); } } @@ -371,7 +378,7 @@ public void cut() { final MapView<G, A, R, V> mapView = getCutEnabled(); if (mapView != null) { - mainControl.getCopyBuffer().cut(mapView); + copyBuffer.cut(mapView); } } @@ -379,7 +386,7 @@ public void copy() { final MapView<G, A, R, V> mapView = getCopyEnabled(); if (mapView != null) { - mainControl.getCopyBuffer().copy(mapView); + copyBuffer.copy(mapView); } } @@ -387,7 +394,7 @@ public void paste() { final MapView<G, A, R, V> mapView = getPasteEnabled(); if (mapView != null) { - mainControl.getCopyBuffer().paste(mapView); + copyBuffer.paste(mapView); } } @@ -472,7 +479,7 @@ * @param insertionMode the insertion mode to use */ private void fillWanted(@NotNull final MapView<G, A, R, V> mapView, final InsertionMode insertionMode) { - mainControl.getCopyBuffer().fill(mapView, insertionMode, null, -1); + copyBuffer.fill(mapView, insertionMode, null, -1); } /** "Random fill above" was selected from the Edit menu. */ @@ -537,7 +544,7 @@ if (rand < 1 || rand > 100) { JOptionPane.showMessageDialog(mainControl.getMainView(), "The fill density must be between 1-100.", "Illegal Value.", JOptionPane.ERROR_MESSAGE); } else { - mainControl.getCopyBuffer().fill(mapView, insertionMode, pickmap == null ? null : pickmap.getMapViewFrame(), rand); + copyBuffer.fill(mapView, insertionMode, pickmap == null ? null : pickmap.getMapViewFrame(), rand); break; } } @@ -547,7 +554,7 @@ public void floodfill() { final MapView<G, A, R, V> mapView = getFloodfillEnabled(); if (mapView != null) { - mainControl.getCopyBuffer().floodfill(mapView); + copyBuffer.floodfill(mapView); } } @@ -669,7 +676,7 @@ */ @Nullable private MapView<G, A, R, V> getPasteEnabled() { - return mainControl.getCopyBuffer().isEmpty() ? null : getCursor(); + return copyBuffer.isEmpty() ? null : getCursor(); } /** This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-27 22:03:50
|
Revision: 4513 http://gridarta.svn.sourceforge.net/gridarta/?rev=4513&view=rev Author: akirschbaum Date: 2008-07-27 22:03:58 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Remove calls to MainControl.getMapManager(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/MainActions.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 22:00:53 UTC (rev 4512) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 22:03:58 UTC (rev 4513) @@ -235,7 +235,7 @@ pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getMapDir(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("cfeditor", mainView); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 22:00:53 UTC (rev 4512) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 22:03:58 UTC (rev 4513) @@ -293,7 +293,7 @@ pickmapChooserControl = new PickmapChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(newMapDialogFactory, this, new File(globalSettings.getArchDefaultFolder(), IGUIConstants.PICKMAP_DIR), getMapManager()); newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); - mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser); + mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("daieditor", mainView); Modified: trunk/src/app/net/sf/gridarta/gui/MainActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-27 22:00:53 UTC (rev 4512) +++ trunk/src/app/net/sf/gridarta/gui/MainActions.java 2008-07-27 22:03:58 UTC (rev 4513) @@ -27,6 +27,7 @@ import javax.swing.JOptionPane; import net.sf.gridarta.CopyBuffer; import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; import net.sf.gridarta.MapManagerListener; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.ArchetypeSet; @@ -296,8 +297,9 @@ * @param actionFactory The action factory to create actions. * @param faceObjects the FaceObjects instance to use * @param objectChooser the animation objects instance to use + * @param mapManager the map manager instance */ - public MainActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R> objectChooser) { + public MainActions(@NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final CopyBuffer<G, A, R, V> copyBuffer, @NotNull final PickmapChooserControl<G, A, R, V> pickmapChooserControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final ActionFactory actionFactory, @NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final MapManager<G, A, R, V> mapManager) { this.mainControl = mainControl; this.archetypeSet = archetypeSet; this.copyBuffer = copyBuffer; @@ -328,8 +330,8 @@ aCollectArches = actionFactory.createAction(true, "collectArches", this); aReloadFaces = actionFactory.createAction(true, "reloadFaces", this); aValidateMap = actionFactory.createAction(true, "validateMap", this); - mainControl.getMapManager().addMapManagerListener(mapManagerListener); - currentMap = mainControl.getMapManager().getCurrentMap(); + mapManager.addMapManagerListener(mapManagerListener); + currentMap = mapManager.getCurrentMap(); currentMapView = mainControl.getCurrentMapView(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-27 22:19:46
|
Revision: 4515 http://gridarta.svn.sourceforge.net/gridarta/?rev=4515&view=rev Author: akirschbaum Date: 2008-07-27 22:19:52 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Remove forwarding functions. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java trunk/daimonin/src/daieditor/gui/map/MapRenderer.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/CopyBuffer.java trunk/src/app/net/sf/gridarta/DefaultMapManager.java trunk/src/app/net/sf/gridarta/MainControl.java trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java Modified: trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java 2008-07-27 22:14:28 UTC (rev 4514) +++ trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java 2008-07-27 22:19:52 UTC (rev 4515) @@ -200,7 +200,7 @@ if (!filter.canShow(node)) { continue; } - if (!mainControl.isEditType(node)) { + if (!mainControl.getEditTypes().isEditType(node)) { continue; } final ImageIcon img = archetypeSet.getFace(node); Modified: trunk/daimonin/src/daieditor/gui/map/MapRenderer.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapRenderer.java 2008-07-27 22:14:28 UTC (rev 4514) +++ trunk/daimonin/src/daieditor/gui/map/MapRenderer.java 2008-07-27 22:19:52 UTC (rev 4515) @@ -74,7 +74,7 @@ /** {@inheritDoc} */ protected boolean isGameObjectVisible(@NotNull final GameObject gameObject) { - return mainControl.isEditType(gameObject); + return mainControl.getEditTypes().isEditType(gameObject); } /** {@inheritDoc} */ Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-27 22:14:28 UTC (rev 4514) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-07-27 22:19:52 UTC (rev 4515) @@ -29,7 +29,6 @@ import javax.swing.filechooser.FileFilter; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.gui.HideFileFilterProxy; import net.sf.gridarta.gui.map.MapPreviewAccessory; import net.sf.gridarta.gui.map.MapView; @@ -129,36 +128,11 @@ } /** {@inheritDoc} */ - public int getEditType() { - return editTypes.getEditType(); + public EditTypes getEditTypes() { + return editTypes; } /** {@inheritDoc} */ - public void setEditType(final int editType) { - editTypes.setEditType(editType); - } - - /** {@inheritDoc} */ - public void unsetEditType(final int editType) { - editTypes.unsetEditType(editType); - } - - /** {@inheritDoc} */ - public boolean isEditType(final int editType) { - return editTypes.isEditType(editType); - } - - /** {@inheritDoc} */ - public boolean isEditType(final G gameObject) { - return editTypes.isEditType(gameObject); - } - - /** {@inheritDoc} */ - public boolean isEditTypeSet() { - return editTypes.isEditTypeSet(); - } - - /** {@inheritDoc} */ public CopyBuffer<G, A, R, V> getCopyBuffer() { return copybuffer; } Modified: trunk/src/app/net/sf/gridarta/CopyBuffer.java =================================================================== --- trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-07-27 22:14:28 UTC (rev 4514) +++ trunk/src/app/net/sf/gridarta/CopyBuffer.java 2008-07-27 22:19:52 UTC (rev 4515) @@ -157,14 +157,14 @@ // store a clone of the gameObject in the CopyBuffer // (for multiparts, only the heads get copied into the buffer) // arches that don't match the view settings are ignored! - if ((copyMode == CopyMode.DO_CUT || copyMode == CopyMode.DO_COPY) && gameObject.isHead() && !gameObject.isInContainer() && mainControl.isEditType(gameObject)) { + if ((copyMode == CopyMode.DO_CUT || copyMode == CopyMode.DO_COPY) && gameObject.isHead() && !gameObject.isInContainer() && mainControl.getEditTypes().isEditType(gameObject)) { // copy this gameObject final G clone = gameObject.createClone(posx - selRec.x, posy - selRec.y); mapModel.addGameObjectToMap(clone, InsertionMode.TOPMOST); } // delete the gameObject if we have a "cut" or "clear" command // again, arches that don't match the view settings are ignored - if ((copyMode == CopyMode.DO_CLEAR || copyMode == CopyMode.DO_CUT) && mainControl.isEditType(gameObject)) { + if ((copyMode == CopyMode.DO_CLEAR || copyMode == CopyMode.DO_CUT) && mainControl.getEditTypes().isEditType(gameObject)) { // delete gameObject (without redrawing the map) // For CUT we don't delete multi tails of multis which are left or // above the head (we would miss to copy them otherwise). Modified: trunk/src/app/net/sf/gridarta/DefaultMapManager.java =================================================================== --- trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-07-27 22:14:28 UTC (rev 4514) +++ trunk/src/app/net/sf/gridarta/DefaultMapManager.java 2008-07-27 22:19:52 UTC (rev 4515) @@ -199,7 +199,7 @@ } final MapView<G, A, R, V> mapView = newMapWithView(decoder.getGameObjects(), decoder.getMapArchObject(), viewPosition, file, file.getPath()); - mapView.getMapControl().setActiveEditType(mainControl.getEditType()); + mapView.getMapControl().setActiveEditType(mainControl.getEditTypes().getEditType()); mapView.getMapControl().resetModified(); recentManager.addRecent(currentMap.getMapModel().getMapArchObject().getMapDisplayName(), file.toString()); Modified: trunk/src/app/net/sf/gridarta/MainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/MainControl.java 2008-07-27 22:14:28 UTC (rev 4514) +++ trunk/src/app/net/sf/gridarta/MainControl.java 2008-07-27 22:19:52 UTC (rev 4515) @@ -147,50 +147,12 @@ void exit(); /** - * Returns the currently set edit type. - * @return the currently set edit type. + * Returns the edit types instance. + * @return the edit types instance. */ - int getEditType(); + EditTypes getEditTypes(); /** - * Set the map view to show tiles of the given type. (If no edit type is - * set, everything is displayed) - * @param editType edit type bitmask of types to show - */ - void setEditType(int editType); - - /** - * Set the map view to hide tiles of the given type. (If no edit type is - * set, everything is displayed) - * @param editType edit type bitmask of types to hide - */ - void unsetEditType(int editType); - - /** - * Get information whether the gameObject is edited. Are tiles of type 'v' - * displayed? - * @param gameObject are tiles of this type displayed? - * @return true if these tiles are currently displayed - */ - boolean isEditType(G gameObject); - - /** - * Get information on the current state of edit type. Are tiles of type - * 'editType' displayed? - * @param editType are tiles of this type displayed? - * @return <code>true</code> if these tiles are currently displayed - */ - boolean isEditType(int editType); - - /** - * Returns whether a editType value is set so that not all tiles are - * displayed. - * @return <code>true</code> if a editType value is set, otherwise - * <code>false</code>. - */ - boolean isEditTypeSet(); - - /** * Returns the configuration directory which is used to load configuration * information like types.xml. * @return The configuration directory. Modified: trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2008-07-27 22:14:28 UTC (rev 4514) +++ trunk/src/app/net/sf/gridarta/gui/ShiftProcessor.java 2008-07-27 22:19:52 UTC (rev 4515) @@ -257,7 +257,7 @@ // [startGameObjects] = [prevPos] assert startGameObjects.isEmpty(); for (final G gameObject : mapModel.getMapSquare(prevPos)) { - if (gameObject.isHead() && !gameObject.isInContainer() && mainControl.isEditType(gameObject)) { + if (gameObject.isHead() && !gameObject.isInContainer() && mainControl.getEditTypes().isEditType(gameObject)) { startGameObjects.add(gameObject); gameObjectsToDelete.add(gameObject); } @@ -265,7 +265,7 @@ } // [prevPos] = [pos] for (final G gameObject : mapModel.getMapSquare(pos)) { - if (gameObject.isHead() && !gameObject.isInContainer() && mainControl.isEditType(gameObject)) { + if (gameObject.isHead() && !gameObject.isInContainer() && mainControl.getEditTypes().isEditType(gameObject)) { mapModel.addGameObjectToMap(gameObject.createClone(prevPos.x, prevPos.y), InsertionMode.TOPMOST); gameObjectsToDelete.add(gameObject); } @@ -275,7 +275,7 @@ isStart = true; // [prevPos] = [startGameObjects] for (final G gameObject : startGameObjects) { - assert gameObject.isHead() && !gameObject.isInContainer() && mainControl.isEditType(gameObject); + assert gameObject.isHead() && !gameObject.isInContainer() && mainControl.getEditTypes().isEditType(gameObject); mapModel.addGameObjectToMap(gameObject.createClone(prevPos.x, prevPos.y), InsertionMode.TOPMOST); } startGameObjects.clear(); @@ -295,7 +295,7 @@ if (!isStart) { // [prevPos] = [startGameObjects] for (final G gameObject : startGameObjects) { - assert gameObject.isHead() && !gameObject.isInContainer() && mainControl.isEditType(gameObject); + assert gameObject.isHead() && !gameObject.isInContainer() && mainControl.getEditTypes().isEditType(gameObject); mapModel.addGameObjectToMap(gameObject.createClone(prevPos.x, prevPos.y), InsertionMode.TOPMOST); } startGameObjects.clear(); Modified: trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java 2008-07-27 22:14:28 UTC (rev 4514) +++ trunk/src/app/net/sf/gridarta/gui/map/ViewActions.java 2008-07-27 22:19:52 UTC (rev 4515) @@ -145,7 +145,7 @@ /** Action method for "reset view". */ public void resetView() { // set edit type to zero (-> show all) - mainControl.unsetEditType(~0); + mainControl.getEditTypes().unsetEditType(~0); updateActions(); } @@ -200,7 +200,7 @@ /** Update the action's state to match the current edit type settings. */ public void updateAction() { - checkBoxMenuItem.setSelected(mainControl.isEditType(editType)); + checkBoxMenuItem.setSelected(mainControl.getEditTypes().isEditType(editType)); } /** {@inheritDoc} */ @@ -209,10 +209,10 @@ return; } - if (mainControl.isEditType(editType)) { - mainControl.unsetEditType(editType); + if (mainControl.getEditTypes().isEditType(editType)) { + mainControl.getEditTypes().unsetEditType(editType); } else { - mainControl.setEditType(editType); + mainControl.getEditTypes().setEditType(editType); } updateAction(); } Modified: trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-07-27 22:14:28 UTC (rev 4514) +++ trunk/src/app/net/sf/gridarta/gui/map/tools/DeletionTool.java 2008-07-27 22:19:52 UTC (rev 4515) @@ -286,7 +286,7 @@ } if (foundFirst) { final G head = gameObject.getHead(); - if (mainControl.isEditType(head)) { + if (mainControl.getEditTypes().isEditType(head)) { boolean insert = false; switch (scopeType) { case SCOPE_TILE: Modified: trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2008-07-27 22:14:28 UTC (rev 4514) +++ trunk/src/app/net/sf/gridarta/gui/selectedsquare/SelectedSquareView.java 2008-07-27 22:19:52 UTC (rev 4515) @@ -360,7 +360,7 @@ model.addElement(node); // if view-settings are applied, mark topmost "visible" tile for selection - if (mainControl.isEditTypeSet() && !foundSIndex && mainControl.isEditType(node.getEditType())) { + if (mainControl.getEditTypes().isEditTypeSet() && !foundSIndex && mainControl.getEditTypes().isEditType(node.getEditType())) { sIndex = listCounter - 1; // select this tile foundSIndex = true; // this is it - don't select any other tile } Modified: trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java =================================================================== --- trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java 2008-07-27 22:14:28 UTC (rev 4514) +++ trunk/src/app/net/sf/gridarta/io/AbstractGameObjectParser.java 2008-07-27 22:19:52 UTC (rev 4515) @@ -187,7 +187,7 @@ // Ok, now is attached to default arch and loaded png // NOW we post parse the object... // (We calculate only edit types that are active, to save time) - gameObject.postParseGameObject(mainControl.getEditType()); + gameObject.postParseGameObject(mainControl.getEditTypes().getEditType()); gameObject.setObjectFace(); if (!gameObject.isInContainer()) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-07-27 22:27:59
|
Revision: 4516 http://gridarta.svn.sourceforge.net/gridarta/?rev=4516&view=rev Author: akirschbaum Date: 2008-07-27 22:28:06 +0000 (Sun, 27 Jul 2008) Log Message: ----------- Remove calls to MainControl.getEditTypes(). Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java trunk/src/app/net/sf/gridarta/EditTypes.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 22:19:52 UTC (rev 4515) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-27 22:28:06 UTC (rev 4516) @@ -236,7 +236,7 @@ newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes()); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("cfeditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); Modified: trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-27 22:19:52 UTC (rev 4515) +++ trunk/crossfire/src/cfeditor/CrossfireObjectsFactory.java 2008-07-27 22:28:06 UTC (rev 4516) @@ -33,6 +33,7 @@ import java.util.List; import java.util.prefs.Preferences; import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.ArchetypeSet; @@ -80,6 +81,10 @@ @NotNull private MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl = null; + /** The {@link EditTypes} instance to use. */ + @NotNull + private EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes = null; + /** {@inheritDoc} */ @NotNull public GameObject newGameObject() { @@ -139,15 +144,16 @@ /** {@inheritDoc} */ @NotNull public MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapView(@NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point viewPosition, final int viewCounter) { - return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, mapControl, viewPosition, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), 32, 32, selectedSquareView), ACTION_FACTORY); + return new MapView<GameObject, MapArchObject, Archetype, CMapViewBasic>(mainControl, mapControl, viewCounter, new CMapViewBasic((CMainControl) mainControl, editTypes, mapControl, viewPosition, ((DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>) objectChooser).getToolSelectorPane(), 32, 32, selectedSquareView), ACTION_FACTORY); } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes) { this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; + this.editTypes = editTypes; } } // class CrossfireObjectsFactory Modified: trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-07-27 22:19:52 UTC (rev 4515) +++ trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-07-27 22:28:06 UTC (rev 4516) @@ -25,6 +25,7 @@ import cfeditor.map.MapArchObject; import java.awt.Point; import java.awt.Rectangle; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.gui.map.MapCursor; import net.sf.gridarta.gui.map.MapCursorEvent; import net.sf.gridarta.gui.map.MapCursorListener; @@ -115,6 +116,7 @@ /** * Constructs a level view. * @param mainControl the main controller + * @param editTypes the edit types instance * @param mapControl the controller of this view * @param initial the initial view position to show; null=show top left * corner @@ -123,11 +125,11 @@ * @param yScrollDistance the y distance when scrolling * @param selectedSquareView the selected square view */ - public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { + public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { super(mapControl, initial, xScrollDistance, yScrollDistance, selectedSquareView); getMapCursor().addMapCursorListener(mapCursorListener); - renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, getMapGrid()) : new MapRenderer(mainControl, mapControl, getMapGrid()); + renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, getMapGrid()) : new MapRenderer(mainControl, editTypes, mapControl, getMapGrid()); setViewportView(renderer); mapModel.addMapModelListener(mapModelListener); Modified: trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java 2008-07-27 22:19:52 UTC (rev 4515) +++ trunk/crossfire/src/cfeditor/gui/map/MapRenderer.java 2008-07-27 22:28:06 UTC (rev 4516) @@ -33,10 +33,12 @@ import java.awt.image.BufferedImage; import java.lang.ref.SoftReference; import javax.swing.ImageIcon; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.map.MapGrid; import net.sf.gridarta.map.MapControl; import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** @@ -71,18 +73,23 @@ private final CMainControl mainControl; + @NotNull + private final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes; + private final ArchetypeSet archetypeSet; /** * Create a new instance. * @param mainControl MainControl, used for getting icons and similar + * @param editTypes the edit types instance * @param mapControl MapControl of the map to render * @param mapGrid Grid to render */ - public MapRenderer(final CMainControl mainControl, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid) { + public MapRenderer(final CMainControl mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final MapGrid mapGrid) { super(mapControl, mapGrid, 32); filter = mainControl.getFilterControl(); this.mainControl = mainControl; + this.editTypes = editTypes; archetypeSet = mainControl.getArchetypeSet(); addMouseMotionListener(mainControl.getMainView().getStatusBar()); init(); @@ -200,7 +207,7 @@ if (!filter.canShow(node)) { continue; } - if (!mainControl.getEditTypes().isEditType(node)) { + if (!editTypes.isEditType(node)) { continue; } final ImageIcon img = archetypeSet.getFace(node); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 22:19:52 UTC (rev 4515) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-27 22:28:06 UTC (rev 4516) @@ -294,7 +294,7 @@ newMapDialogFactory.setPickmapChooserControl(pickmapChooserControl); objectChooser = new DefaultObjectChooser<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, selectedSquareView, archetypeChooserControl, pickmapChooserControl, getCopyBuffer()); mainActions = new MainActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, archetypeSet, getCopyBuffer(), pickmapChooserControl, animationObjects, ACTION_FACTORY, faceObjects, objectChooser, getMapManager()); - getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this); + getGridartaObjectsFactory().init(faceObjects, objectChooser, archetypeChooserControl, selectedSquareView, this, getEditTypes()); mainView = new MainView<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, objectChooser, getMapManager(), ACTION_FACTORY, mapManagerActions.getCloseAllAction(), faceObjects); new About("daieditor", mainView); new UndoControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(getMapManager()); Modified: trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-27 22:19:52 UTC (rev 4515) +++ trunk/daimonin/src/daieditor/DaimoninObjectsFactory.java 2008-07-27 22:28:06 UTC (rev 4516) @@ -33,6 +33,7 @@ import java.util.List; import java.util.prefs.Preferences; import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.gameobject.ArchetypeSet; @@ -148,7 +149,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser, @NotNull final ArchetypeChooserControl<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserControl, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes) { this.faceObjects = faceObjects; this.objectChooser = objectChooser; this.archetypeChooserControl = archetypeChooserControl; Modified: trunk/src/app/net/sf/gridarta/EditTypes.java =================================================================== --- trunk/src/app/net/sf/gridarta/EditTypes.java 2008-07-27 22:19:52 UTC (rev 4515) +++ trunk/src/app/net/sf/gridarta/EditTypes.java 2008-07-27 22:28:06 UTC (rev 4516) @@ -21,8 +21,8 @@ import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.map.MapArchObject; import org.jetbrains.annotations.NotNull; Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-27 22:19:52 UTC (rev 4515) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-07-27 22:28:06 UTC (rev 4516) @@ -138,7 +138,8 @@ * @param archetypeChooserControl the ArchetypeChooserControl instance * @param selectedSquareView the selected square view instance * @param mainControl the main control instance + * @param editTypes the edit types instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl); + void init(@NotNull FaceObjects faceObjects, @NotNull ObjectChooser<G, A, R> objectChooser, @NotNull ArchetypeChooserControl<G, A, R, V> archetypeChooserControl, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull final EditTypes<G, A, R, V> editTypes); } // interface GridartaObjectsFactory Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-27 22:19:52 UTC (rev 4515) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-07-27 22:28:06 UTC (rev 4516) @@ -30,6 +30,7 @@ import javax.swing.JList; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; @@ -927,7 +928,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final ObjectChooser<TestGameObject, TestMapArchObject, TestArchetype> testGameObjectTestMapArchObjectTestArchetypeObjectChooser, @NotNull final ArchetypeChooserControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> testGameObjectTestMapArchObjectTestArchetypeTestMapViewBasicArchetypeChooserControl, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final MainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes) { throw new AssertionError(); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |