From: <aki...@us...> - 2008-10-03 21:09:58
|
Revision: 5430 http://gridarta.svn.sourceforge.net/gridarta/?rev=5430&view=rev Author: akirschbaum Date: 2008-10-03 21:09:52 +0000 (Fri, 03 Oct 2008) Log Message: ----------- Extract ArchetypeFactory from GridartaObjectsFactory. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DaimoninEditor.java trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Added Paths: ----------- trunk/crossfire/src/cfeditor/gameobject/DefaultArchetypeFactory.java trunk/daimonin/src/daieditor/gameobject/DefaultArchetypeFactory.java trunk/src/app/net/sf/gridarta/gameobject/ArchetypeFactory.java Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-10-03 20:36:54 UTC (rev 5429) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -143,7 +143,7 @@ // Create the application and give it the parameters final CMainControl mainControl; try { - mainControl = new CMainControl(new DefaultGridartaObjectsFactory()); + mainControl = new CMainControl(); } 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-10-03 20:36:54 UTC (rev 5429) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -23,6 +23,7 @@ import cfeditor.gameobject.ArchetypeParser; import cfeditor.gameobject.ArchetypeSet; import cfeditor.gameobject.ArchetypeSetLoader; +import cfeditor.gameobject.DefaultArchetypeFactory; import cfeditor.gameobject.DefaultGameObjectFactory; import cfeditor.gameobject.GameObject; import cfeditor.gameobject.anim.AnimationObjects; @@ -46,12 +47,12 @@ import net.sf.gridarta.CommonConstants; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.filter.FilterControl; import net.sf.gridarta.gameobject.AbstractArchetypeParser; +import net.sf.gridarta.gameobject.ArchetypeFactory; import net.sf.gridarta.gameobject.GameObjectFactory; import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.match.GameObjectMatcher; @@ -114,16 +115,22 @@ /** * Constructs the main controller and its model and view. - * @param gridartaObjectsFactory the gridarta objects factory to use * @throws RuntimeException If the controller cannot be initialized. */ - public CMainControl(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { - super(gridartaObjectsFactory, new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), false, ConfigFileUtils.getHomeFile("thumbnails"), null, "CrossfireEditor.jar", pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, Archetype.TYPE_EVENT_CONNECTOR, false, 0, new int[] { 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, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SCRIPTS_DIR); + public CMainControl() { + super(new DefaultRendererFactory(), "cfeditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), false, ConfigFileUtils.getHomeFile("thumbnails"), null, "CrossfireEditor.jar", pythonFileFilter, ".py", "Python", Archetype.TYPE_SPELL, null, Archetype.TYPE_EVENT_CONNECTOR, false, 0, new int[] { 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, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SCRIPTS_DIR); } /** {@inheritDoc} */ @NotNull @Override + protected ArchetypeFactory<GameObject, MapArchObject, Archetype> newArchetypeFactory() { + return new DefaultArchetypeFactory(); + } + + /** {@inheritDoc} */ + @NotNull + @Override protected MapViewFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapViewFactory(@NotNull final net.sf.gridarta.gameobject.face.FaceObjects faceObjects, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final AbstractMainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, @NotNull final FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl) { return new DefaultMapViewFactory((FaceObjects) faceObjects, selectedSquareView, mainControl, mainView, editTypes, mapImageCache, toolPalette, filterControl); } @@ -338,8 +345,8 @@ /** {@inheritDoc} */ @NotNull @Override - protected net.sf.gridarta.gameobject.ArchetypeSet<GameObject, MapArchObject, Archetype> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final net.sf.gridarta.gameobject.anim.AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final net.sf.gridarta.gameobject.face.FaceObjects faceObjects, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { - return new ArchetypeSet(((GlobalSettingsImpl) globalSettings).getImageSet(), gridartaObjectsFactory); + protected net.sf.gridarta.gameobject.ArchetypeSet<GameObject, MapArchObject, Archetype> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final net.sf.gridarta.gameobject.anim.AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final net.sf.gridarta.gameobject.face.FaceObjects faceObjects, @NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory) { + return new ArchetypeSet(((GlobalSettingsImpl) globalSettings).getImageSet(), archetypeFactory); } } // class CMainControl Modified: trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java 2008-10-03 20:36:54 UTC (rev 5429) +++ trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -21,11 +21,9 @@ import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; -import cfeditor.gameobject.UndefinedArchetype; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import net.sf.gridarta.GridartaObjectsFactory; -import org.jetbrains.annotations.NotNull; /** * The {@link GridartaObjectsFactory} to create Crossfire related objects. @@ -33,10 +31,4 @@ */ public class DefaultGridartaObjectsFactory implements GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - /** {@inheritDoc} */ - @NotNull - public Archetype newUndefinedArchetype(@NotNull final String archetypeName) { - return new UndefinedArchetype(archetypeName); - } - } // class DefaultGridartaObjectsFactory Modified: trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-10-03 20:36:54 UTC (rev 5429) +++ trunk/crossfire/src/cfeditor/gameobject/ArchetypeSet.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -20,15 +20,14 @@ package cfeditor.gameobject; import cfeditor.IGUIConstants; -import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; import java.io.BufferedWriter; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStreamWriter; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.AbstractArchetypeSet; +import net.sf.gridarta.gameobject.ArchetypeFactory; import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.utils.IOUtils; import net.sf.japi.swing.ActionFactory; @@ -62,11 +61,10 @@ /** * Create the ArchetypeSet. * @param imageSet the image set to use - * @param gridartaObjectsFactory the gridarta objects factory instance to - * use + * @param archetypeFactory the archetype factory instance to use */ - public ArchetypeSet(@Nullable final String imageSet, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { - super(gridartaObjectsFactory); + public ArchetypeSet(@Nullable final String imageSet, @NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory) { + super(archetypeFactory); this.imageSet = imageSet; } Added: trunk/crossfire/src/cfeditor/gameobject/DefaultArchetypeFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/DefaultArchetypeFactory.java (rev 0) +++ trunk/crossfire/src/cfeditor/gameobject/DefaultArchetypeFactory.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -0,0 +1,44 @@ +/* + * 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.gameobject; + +import cfeditor.map.MapArchObject; +import net.sf.gridarta.gameobject.ArchetypeFactory; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link ArchetypeFactory} creating Crossfire objects. + * @author Andreas Kirschbaum + */ +public class DefaultArchetypeFactory implements ArchetypeFactory<GameObject, MapArchObject, Archetype> { + + /** + * Creates a new instance. + */ + public DefaultArchetypeFactory() { + } + + /** {@inheritDoc} */ + @NotNull + public Archetype newUndefinedArchetype(@NotNull final String archetypeName) { + return new UndefinedArchetype(archetypeName); + } + +} // class DefaultArchetypeFactory Property changes on: trunk/crossfire/src/cfeditor/gameobject/DefaultArchetypeFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-10-03 20:36:54 UTC (rev 5429) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -23,6 +23,7 @@ import daieditor.gameobject.ArchetypeParser; import daieditor.gameobject.ArchetypeSet; import daieditor.gameobject.ArchetypeSetLoader; +import daieditor.gameobject.DefaultArchetypeFactory; import daieditor.gameobject.DefaultGameObjectFactory; import daieditor.gameobject.GameObject; import daieditor.gameobject.anim.AnimationObjects; @@ -51,12 +52,12 @@ import net.sf.gridarta.CommonConstants; import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.filter.FilterControl; import net.sf.gridarta.gameobject.AbstractArchetypeParser; +import net.sf.gridarta.gameobject.ArchetypeFactory; import net.sf.gridarta.gameobject.GameObjectFactory; import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.face.FaceObjectProviders; @@ -161,16 +162,22 @@ /** * Constructs the main controller and its model and view. - * @param gridartaObjectsFactory the gridarta objects factory to use * @throws RuntimeException If the controller cannot be initialized. */ - public CMainControl(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { - super(gridartaObjectsFactory, new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), true, null, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, 0, true, -1, new int[] { 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, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SCRIPTS_DIR); + public CMainControl() { + super(new DefaultRendererFactory(), "daieditor", new GlobalSettingsImpl(), new AnimationObjects(), new FaceObjects(), true, null, GUIUtils.getSysIcon(IGUIConstants.TILE_NORTH), "DaimoninEditor.jar", luaFileFilter, ".lua", "Lua", 0, IGUIConstants.SPELL_FILE, 0, true, -1, new int[] { 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, }, PREFS_VALIDATOR_AUTO_DEFAULT, IGUIConstants.SCRIPTS_DIR); } /** {@inheritDoc} */ @NotNull @Override + protected ArchetypeFactory<GameObject, MapArchObject, Archetype> newArchetypeFactory() { + return new DefaultArchetypeFactory(); + } + + /** {@inheritDoc} */ + @NotNull + @Override protected MapViewFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapViewFactory(@NotNull final net.sf.gridarta.gameobject.face.FaceObjects faceObjects, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final AbstractMainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, @NotNull final FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl) { return new DefaultMapViewFactory((FaceObjects) faceObjects, selectedSquareView, mainControl, mainView, editTypes, mapImageCache, toolPalette, filterControl); } @@ -549,8 +556,8 @@ /** {@inheritDoc} */ @NotNull @Override - protected ArchetypeSet newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final net.sf.gridarta.gameobject.anim.AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final net.sf.gridarta.gameobject.face.FaceObjects faceObjects, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { - return new ArchetypeSet(gridartaObjectsFactory); + protected ArchetypeSet newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final net.sf.gridarta.gameobject.anim.AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final net.sf.gridarta.gameobject.face.FaceObjects faceObjects, @NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory) { + return new ArchetypeSet(archetypeFactory); } } // class CMainControl Modified: trunk/daimonin/src/daieditor/DaimoninEditor.java =================================================================== --- trunk/daimonin/src/daieditor/DaimoninEditor.java 2008-10-03 20:36:54 UTC (rev 5429) +++ trunk/daimonin/src/daieditor/DaimoninEditor.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -122,7 +122,7 @@ // Create the application and give it the parameters try { - mainControl = new CMainControl(new DefaultGridartaObjectsFactory()); + mainControl = new CMainControl(); } catch (final RuntimeException ex) { log.fatal(ex.getMessage()); System.exit(1); Modified: trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java 2008-10-03 20:36:54 UTC (rev 5429) +++ trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -21,11 +21,9 @@ import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; -import daieditor.gameobject.UndefinedArchetype; import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; import net.sf.gridarta.GridartaObjectsFactory; -import org.jetbrains.annotations.NotNull; /** * The {@link GridartaObjectsFactory} to create Daimonin related objects. @@ -33,10 +31,4 @@ */ public class DefaultGridartaObjectsFactory implements GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - /** {@inheritDoc} */ - @NotNull - public Archetype newUndefinedArchetype(@NotNull final String archetypeName) { - return new UndefinedArchetype(archetypeName); - } - } // class DefaultGridartaObjectsFactory Modified: trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-10-03 20:36:54 UTC (rev 5429) +++ trunk/daimonin/src/daieditor/gameobject/ArchetypeSet.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -20,7 +20,6 @@ package daieditor.gameobject; import daieditor.IGUIConstants; -import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; import java.io.BufferedWriter; import java.io.File; @@ -28,8 +27,8 @@ import java.io.IOException; import java.io.OutputStreamWriter; import javax.swing.ImageIcon; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.AbstractArchetypeSet; +import net.sf.gridarta.gameobject.ArchetypeFactory; import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.io.GameObjectParser; @@ -52,11 +51,10 @@ /** * Create the ArchetypeSet. - * @param gridartaObjectsFactory the gridarta objects factory instance to - * use + * @param archetypeFactory the archetype factory instance to use */ - public ArchetypeSet(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { - super(gridartaObjectsFactory); + public ArchetypeSet(@NotNull final ArchetypeFactory<GameObject, MapArchObject, Archetype> archetypeFactory) { + super(archetypeFactory); } /** {@inheritDoc} */ Added: trunk/daimonin/src/daieditor/gameobject/DefaultArchetypeFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/DefaultArchetypeFactory.java (rev 0) +++ trunk/daimonin/src/daieditor/gameobject/DefaultArchetypeFactory.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -0,0 +1,44 @@ +/* + * 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.gameobject; + +import daieditor.map.MapArchObject; +import net.sf.gridarta.gameobject.ArchetypeFactory; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link ArchetypeFactory} creating Daimonin objects. + * @author Andreas Kirschbaum + */ +public class DefaultArchetypeFactory implements ArchetypeFactory<GameObject, MapArchObject, Archetype> { + + /** + * Creates a new instance. + */ + public DefaultArchetypeFactory() { + } + + /** {@inheritDoc} */ + @NotNull + public Archetype newUndefinedArchetype(@NotNull final String archetypeName) { + return new UndefinedArchetype(archetypeName); + } + +} // class DefaultArchetypeFactory Property changes on: trunk/daimonin/src/daieditor/gameobject/DefaultArchetypeFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-10-03 20:36:54 UTC (rev 5429) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -48,6 +48,7 @@ import net.sf.gridarta.filter.NamedFilterList; import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeFactory; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.GameObjectFactory; @@ -295,7 +296,6 @@ /** * Creates a new instance. - * @param gridartaObjectsFactory the gridarta objects factory * @param rendererFactory the renderer factory * @param key The action factory key * @param globalSettings the global settings instance @@ -323,7 +323,7 @@ * default * @param scriptsDir the plugin scripts directory */ - protected AbstractMainControl(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, final boolean createDirectionPane, @Nullable final File mapImageCacheDir, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, final int typeNoEventConnector, final boolean includeFaceText, final int undefinedSpellIndex, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault, @NotNull final String scriptsDir) { + protected AbstractMainControl(@NotNull final RendererFactory<G, A, R> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, final boolean createDirectionPane, @Nullable final File mapImageCacheDir, @Nullable final ImageIcon compassIcon, @NotNull final String gridartaJarFilename, @NotNull final FileFilter scriptFileFilter, @NotNull final String scriptExtension, @NotNull final String scriptName, final int spellType, @Nullable final String spellFile, final int typeNoEventConnector, final boolean includeFaceText, final int undefinedSpellIndex, @NotNull final int[] lockedItemsTypeNumbers, final boolean autoValidatorDefault, @NotNull final String scriptsDir) { this.scriptExtension = scriptExtension; this.globalSettings = globalSettings; appPrefsModel = createAppPrefsModel(); @@ -342,7 +342,8 @@ this.rendererFactory = rendererFactory; globalSettings.readGlobalSettings(); ScriptedEventEditor.setGlobalSettings(globalSettings); - final ArchetypeSet<G, A, R> archetypeSet = newArchetypeSet(globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); + final ArchetypeFactory<G, A, R> archetypeFactory = newArchetypeFactory(); + final ArchetypeSet<G, A, R> archetypeSet = newArchetypeSet(globalSettings, editTypes, animationObjects, faceObjects, archetypeFactory); mapReaderFactory.setArchetypeSet(archetypeSet); AbstractScriptedEvent.init(archetypeSet); PathManager.setGlobalSettings(globalSettings); @@ -502,6 +503,9 @@ } @NotNull + protected abstract ArchetypeFactory<G, A, R> newArchetypeFactory(); + + @NotNull protected abstract MapViewFactory<G, A, R, V> newMapViewFactory(@NotNull final FaceObjects faceObjects, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final AbstractMainControl<G, A, R, V> mainControl, @NotNull final MainView<G, A, R, V> mainView, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final MapImageCache<G, A, R, V> mapImageCache, @NotNull final ToolPalette<G, A, R, V> toolPalette, @NotNull final FilterControl<G, A, R, V> filterControl); @NotNull @@ -565,12 +569,11 @@ * @param editTypes the edit types instance * @param animationObjects the animations to use * @param faceObjects the FaceObjects instance to use - * @param gridartaObjectsFactory the gridarta objects factory instance to - * use + * @param archetypeFactory the archetype factory instance to use * @return the archetype set instance */ @NotNull - protected abstract ArchetypeSet<G, A, R> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory); + protected abstract ArchetypeSet<G, A, R> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final ArchetypeFactory<G, A, R> archetypeFactory); /** * Create the cache instance for map images. Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-10-03 20:36:54 UTC (rev 5429) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -23,7 +23,6 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; -import org.jetbrains.annotations.NotNull; /** * Encapsulates the differences between the different editor types. @@ -31,12 +30,4 @@ */ public interface GridartaObjectsFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { - /** - * Create a new undefined archetype instance. - * @param archetypeName The archetype name. - * @return The new undefined archetype instance. - */ - @NotNull - R newUndefinedArchetype(@NotNull String archetypeName); - } // interface GridartaObjectsFactory Modified: trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java 2008-10-03 20:36:54 UTC (rev 5429) +++ trunk/src/app/net/sf/gridarta/gameobject/AbstractArchetypeSet.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -38,7 +38,6 @@ import javax.swing.JScrollPane; import javax.swing.JTable; import javax.swing.event.EventListenerList; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.gameobject.face.FaceObjectProviders; import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.map.MapArchObject; @@ -55,9 +54,9 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - /** The objects factory to use. */ + /** The archetype factory to use. */ @NotNull - protected final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory; + private final ArchetypeFactory<G, A, R> archetypeFactory; /** The load status of this ArchetypeSet. */ @NotNull @@ -104,10 +103,10 @@ /** * Create an AbstractArchetypeSet. - * @param gridartaObjectsFactory the gridarta objects factory to use + * @param archetypeFactory the archetype factory to use */ - protected AbstractArchetypeSet(@NotNull final GridartaObjectsFactory<G, A, R, ?> gridartaObjectsFactory) { - this.gridartaObjectsFactory = gridartaObjectsFactory; + protected AbstractArchetypeSet(@NotNull final ArchetypeFactory<G, A, R> archetypeFactory) { + this.archetypeFactory = archetypeFactory; } /** {@inheritDoc} */ @@ -149,7 +148,7 @@ } } - final R newArchetype = gridartaObjectsFactory.newUndefinedArchetype(archetypeName); + final R newArchetype = archetypeFactory.newUndefinedArchetype(archetypeName); undefinedArchetypes.put(archetypeName, new WeakReference<R>(newArchetype)); return newArchetype; } Added: trunk/src/app/net/sf/gridarta/gameobject/ArchetypeFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/ArchetypeFactory.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gameobject/ArchetypeFactory.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -0,0 +1,39 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gameobject; + +import net.sf.gridarta.map.MapArchObject; +import org.jetbrains.annotations.NotNull; + +/** + * A factory for creating {@link Archetype} instances. + * @author Andreas Kirschbaum + */ +public interface ArchetypeFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> { + + /** + * Create a new undefined archetype instance. + * @param archetypeName The archetype name. + * @return The new undefined archetype instance. + */ + @NotNull + R newUndefinedArchetype(@NotNull String archetypeName); + +} // interface ArchetypeFactory Property changes on: trunk/src/app/net/sf/gridarta/gameobject/ArchetypeFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-10-03 20:36:54 UTC (rev 5429) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-10-03 21:09:52 UTC (rev 5430) @@ -41,7 +41,6 @@ import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GlobalSettingsImpl; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.MapManager; @@ -53,6 +52,7 @@ import net.sf.gridarta.gameobject.AbstractArchetypeParser; import net.sf.gridarta.gameobject.AbstractArchetypeSet; import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeFactory; import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gameobject.FaceSource; import net.sf.gridarta.gameobject.GameObject; @@ -406,7 +406,6 @@ */ @Before public void setUp() { - final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory = new TestGridartaObjectsFactory(); final MapArchObjectFactory<TestMapArchObject> mapArchObjectFactory = new TestMapArchObjectFactory(); final MapArchObjectParserFactory<TestMapArchObject> mapArchObjectParserFactory = new TestMapArchObjectParserFactory(); final GameObjectParserFactory<TestGameObject, TestMapArchObject, TestArchetype> gameObjectParserFactory = new TestGameObjectParserFactory(); @@ -416,9 +415,10 @@ final GlobalSettings globalSettings = new TestGlobalSettings(); final AnimationObjects<AnimationObject> animationObjects = new TestAnimationObjects(); final FaceObjects faceObjects = new TestFaceObjects(); - final TestMainControl mainControl = new TestMainControl(gridartaObjectsFactory, rendererFactory, "test", globalSettings, animationObjects, faceObjects); + final TestArchetypeFactory archetypeFactory = new TestArchetypeFactory(); + final TestMainControl mainControl = new TestMainControl(rendererFactory, "test", globalSettings, animationObjects, faceObjects); final TestMapArchObject mapArchObject = new TestMapArchObject(); - final TestArchetypeSet archetypeSet = new TestArchetypeSet(gridartaObjectsFactory); + final TestArchetypeSet archetypeSet = new TestArchetypeSet(archetypeFactory); final ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> archetypeChooserModel = new ArchetypeChooserModel<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(archetypeSet); final AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype> autojoinLists = new AutojoinLists<TestGameObject, TestMapArchObject, TestArchetype>(); final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager = new DefaultMapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic>(mainControl, "test", mapReaderFactory, mapControlFactory, globalSettings); @@ -442,15 +442,14 @@ /** * Creates a new instance. - * @param gridartaObjectsFactory the gridaarta objects factory to use * @param rendererFactory the renderer factory to use * @param key the action factory key to use * @param globalSettings the global settings instance to use * @param animationObjects the animation objects instance to use * @param faceObjects the face objects instance to use */ - protected TestMainControl(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory, @NotNull final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { - super(gridartaObjectsFactory, rendererFactory, key, globalSettings, animationObjects, faceObjects, true, null, null, "test.jar", new TestFileFilter(), ".script", "Script", 0, null, -1, false, 0, new int[] { 13, }, false, "scripts"); + protected TestMainControl(@NotNull final RendererFactory<TestGameObject, TestMapArchObject, TestArchetype> rendererFactory, @NotNull final String key, @NotNull final GlobalSettings globalSettings, @NotNull final AnimationObjects<AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects) { + super(rendererFactory, key, globalSettings, animationObjects, faceObjects, true, null, null, "test.jar", new TestFileFilter(), ".script", "Script", 0, null, -1, false, 0, new int[] { 13, }, false, "scripts"); } /** {@inheritDoc} */ @@ -468,8 +467,8 @@ /** {@inheritDoc} */ @NotNull @Override - protected ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> gridartaObjectsFactory) { - return new TestArchetypeSet(gridartaObjectsFactory); + protected ArchetypeSet<TestGameObject, TestMapArchObject, TestArchetype> newArchetypeSet(@NotNull final GlobalSettings globalSettings, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, @NotNull final FaceObjects faceObjects, @NotNull final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory) { + return new TestArchetypeSet(archetypeFactory); } /** {@inheritDoc} */ @@ -507,6 +506,13 @@ /** {@inheritDoc} */ @NotNull @Override + protected ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> newArchetypeFactory() { + throw new AssertionError(); + } + + /** {@inheritDoc} */ + @NotNull + @Override protected MapViewFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> newMapViewFactory(@NotNull final FaceObjects faceObjects, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final AbstractMainControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainControl, @NotNull final MainView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mainView, @NotNull final EditTypes<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> editTypes, @NotNull final MapImageCache<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapImageCache, @NotNull final ToolPalette<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> toolPalette, @NotNull final FilterControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> filterControl) { throw new AssertionError(); } @@ -941,29 +947,16 @@ } /** - * An {@link GridartaObjectsFactory} implementation for testing purposes. - */ - private static class TestGridartaObjectsFactory implements GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> { - - /** {@inheritDoc} */ - @NotNull - public TestArchetype newUndefinedArchetype(@NotNull final String archetypeName) { - throw new AssertionError(); - } - - } - - /** * 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 + * @param archetypeFactory the archetype factory to use */ - protected TestArchetypeSet(@NotNull final GridartaObjectsFactory<TestGameObject, TestMapArchObject, TestArchetype, ?> gridartaObjectsFactory) { - super(gridartaObjectsFactory); + protected TestArchetypeSet(@NotNull final ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> archetypeFactory) { + super(archetypeFactory); } /** {@inheritDoc} */ @@ -1286,4 +1279,16 @@ } + /** + * An {@link ArchetypeFactory} implementation for testing purposes. + */ + private static class TestArchetypeFactory implements ArchetypeFactory<TestGameObject, TestMapArchObject, TestArchetype> { + + /** {@inheritDoc} */ + @NotNull + public TestArchetype newUndefinedArchetype(@NotNull final String archetypeName) { + 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-10-03 21:12:16
|
Revision: 5431 http://gridarta.svn.sourceforge.net/gridarta/?rev=5431&view=rev Author: akirschbaum Date: 2008-10-03 21:12:11 +0000 (Fri, 03 Oct 2008) Log Message: ----------- Remove GridartaObjectsFactory. Modified Paths: -------------- trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java Deleted: trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java 2008-10-03 21:09:52 UTC (rev 5430) +++ trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java 2008-10-03 21:12:11 UTC (rev 5431) @@ -1,34 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package cfeditor; - -import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.GameObject; -import cfeditor.gui.map.CMapViewBasic; -import cfeditor.map.MapArchObject; -import net.sf.gridarta.GridartaObjectsFactory; - -/** - * The {@link GridartaObjectsFactory} to create Crossfire related objects. - * @author Andreas Kirschbaum - */ -public class DefaultGridartaObjectsFactory implements GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - -} // class DefaultGridartaObjectsFactory Deleted: trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java 2008-10-03 21:09:52 UTC (rev 5430) +++ trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java 2008-10-03 21:12:11 UTC (rev 5431) @@ -1,34 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package daieditor; - -import daieditor.gameobject.Archetype; -import daieditor.gameobject.GameObject; -import daieditor.gui.map.CMapViewBasic; -import daieditor.map.MapArchObject; -import net.sf.gridarta.GridartaObjectsFactory; - -/** - * The {@link GridartaObjectsFactory} to create Daimonin related objects. - * @author Andreas Kirschbaum - */ -public class DefaultGridartaObjectsFactory implements GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - -} // class DefaultGridartaObjectsFactory Modified: trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-10-03 21:09:52 UTC (rev 5430) +++ trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-10-03 21:12:11 UTC (rev 5431) @@ -25,7 +25,6 @@ import java.awt.Component; import java.io.File; import java.util.List; -import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.Size2D; import net.sf.gridarta.autojoin.AutojoinLists; @@ -51,7 +50,7 @@ public class DefaultMapControlFactory extends AbstractMapControlFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { /** - * The {@link GridartaObjectsFactory} instance to use. + * The {@link MapViewFactory} instance to use. */ @NotNull private MapViewFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewFactory; Deleted: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-10-03 21:09:52 UTC (rev 5430) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-10-03 21:12:11 UTC (rev 5431) @@ -1,33 +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.Archetype; -import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.map.MapArchObject; - -/** - * Encapsulates the differences between the different editor types. - * @author Andreas Kirschbaum - */ -public interface GridartaObjectsFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { - -} // interface GridartaObjectsFactory This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-03 21:19:29
|
Revision: 5432 http://gridarta.svn.sourceforge.net/gridarta/?rev=5432&view=rev Author: akirschbaum Date: 2008-10-03 21:19:22 +0000 (Fri, 03 Oct 2008) Log Message: ----------- Remove accesses to AbstractMainControl.mapViewManager. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-10-03 21:12:11 UTC (rev 5431) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-10-03 21:19:22 UTC (rev 5432) @@ -57,6 +57,7 @@ import net.sf.gridarta.gameobject.anim.AnimationObject; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.DefaultMapActions; import net.sf.gridarta.gui.map.MapActions; @@ -223,7 +224,7 @@ /** {@inheritDoc} */ @NotNull @Override - protected MapActions init1(@NotNull final MapArchObjectParserFactory<MapArchObject> mapArchObjectParserFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher) { + protected MapActions init1(@NotNull final MapArchObjectParserFactory<MapArchObject> mapArchObjectParserFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher) { archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); final int[] directionMap = new int[] { CommonConstants.NORTH, Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-10-03 21:12:11 UTC (rev 5431) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-10-03 21:19:22 UTC (rev 5432) @@ -65,6 +65,7 @@ import net.sf.gridarta.gameobject.match.MutableOrGameObjectMatcher; import net.sf.gridarta.gameobject.match.ViewGameObjectMatcherManager; import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.map.DefaultMapActions; import net.sf.gridarta.gui.map.MapActions; @@ -273,7 +274,7 @@ /** {@inheritDoc} */ @NotNull @Override - protected MapActions init1(@NotNull final MapArchObjectParserFactory<MapArchObject> mapArchObjectParserFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher) { + protected MapActions init1(@NotNull final MapArchObjectParserFactory<MapArchObject> mapArchObjectParserFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher) { final int[] directionMap = new int[] { CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-10-03 21:12:11 UTC (rev 5431) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-10-03 21:19:22 UTC (rev 5432) @@ -421,7 +421,7 @@ log.fatal("GameObjectMatcher 'exit' does not exist"); throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } - final MapActions mapActions = init1(mapArchObjectParserFactory, mapArchObjectFactory, globalSettings, mapManager, archetypeTypeSet, selectedSquareView, exitMatcher); + final MapActions mapActions = init1(mapArchObjectParserFactory, mapArchObjectFactory, globalSettings, mapManager, mapViewManager, archetypeTypeSet, selectedSquareView, exitMatcher); Map<String, TreasureTreeNode> specialTreasureLists; try { final Document specialTreasureListsDocument = xmlHelper.getDocumentBuilder().parse(IOUtils.getResourceURLAsString(globalSettings.getConfigurationDirectory(), "TreasureLists.xml")); @@ -540,7 +540,7 @@ protected abstract CFTreasureListTree<G, A, R> createTreasureListTree(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull Map<String, TreasureTreeNode> specialTreasureLists); @NotNull - protected abstract MapActions init1(@NotNull final MapArchObjectParserFactory<A> mapArchObjectParserFactory, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher); + protected abstract MapActions init1(@NotNull final MapArchObjectParserFactory<A> mapArchObjectParserFactory, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final MapViewManager<G, A, R, V> mapViewManager, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher); protected abstract void init4(@NotNull final GameObjectParser<G, A, R> gameObjectParser, @NotNull final AbstractArchetypeParser<G, A, R> archetypeParser, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, final MainView<G, A, R, V> mainView, @NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeSet<G, A, R> archetypeSet); Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-10-03 21:12:11 UTC (rev 5431) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-10-03 21:19:22 UTC (rev 5432) @@ -66,6 +66,7 @@ import net.sf.gridarta.gameobject.face.FaceObjects; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MainView; +import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.gameobjectattributespanel.ScriptTab; @@ -581,7 +582,7 @@ /** {@inheritDoc} */ @NotNull @Override - protected MapActions init1(@NotNull final MapArchObjectParserFactory<TestMapArchObject> mapArchObjectParserFactory, @NotNull final MapArchObjectFactory<TestMapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager, @NotNull final ArchetypeTypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeTypeSet, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher) { + protected MapActions init1(@NotNull final MapArchObjectParserFactory<TestMapArchObject> mapArchObjectParserFactory, @NotNull final MapArchObjectFactory<TestMapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapManager, @NotNull final MapViewManager<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapViewManager, @NotNull final ArchetypeTypeSet<TestGameObject, TestMapArchObject, TestArchetype> archetypeTypeSet, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher) { 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-09-25 19:20:13
|
Revision: 5221 http://gridarta.svn.sourceforge.net/gridarta/?rev=5221&view=rev Author: akirschbaum Date: 2008-09-25 19:19:58 +0000 (Thu, 25 Sep 2008) Log Message: ----------- Support scrolling with mouse wheel in script editor. Modified Paths: -------------- trunk/crossfire/ChangeLog trunk/daimonin/ChangeLog trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java Modified: trunk/crossfire/ChangeLog =================================================================== --- trunk/crossfire/ChangeLog 2008-09-25 18:37:24 UTC (rev 5220) +++ trunk/crossfire/ChangeLog 2008-09-25 19:19:58 UTC (rev 5221) @@ -1,5 +1,7 @@ 2008-09-25 Andreas Kirschbaum + * Support scrolling with mouse wheel in script editor. + * Add undo/redo buttons to toolbar. * Make the tool selector more compact. Modified: trunk/daimonin/ChangeLog =================================================================== --- trunk/daimonin/ChangeLog 2008-09-25 18:37:24 UTC (rev 5220) +++ trunk/daimonin/ChangeLog 2008-09-25 19:19:58 UTC (rev 5221) @@ -1,5 +1,7 @@ 2008-09-25 Andreas Kirschbaum + * Support scrolling with mouse wheel in script editor. + * Add undo/redo buttons to toolbar. * Make the tool selector more compact. Modified: trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java =================================================================== --- trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2008-09-25 18:37:24 UTC (rev 5220) +++ trunk/src/app/net/sf/gridarta/textedit/textarea/JEditTextArea.java 2008-09-25 19:19:58 UTC (rev 5221) @@ -30,6 +30,7 @@ import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.awt.event.MouseMotionListener; +import java.awt.event.MouseWheelEvent; import java.io.IOException; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -195,7 +196,9 @@ vertical.addAdjustmentListener(new AdjustHandler()); horizontal.addAdjustmentListener(new AdjustHandler()); painter.addComponentListener(new ComponentHandler()); - painter.addMouseListener(new MouseHandler()); + final MouseHandler mouseHandler = new MouseHandler(); + painter.addMouseListener(mouseHandler); + painter.addMouseWheelListener(mouseHandler); painter.addMouseMotionListener(new DragHandler()); addFocusListener(new FocusHandler()); @@ -1738,6 +1741,17 @@ } } + /** {@inheritDoc} */ + public void mouseWheelMoved(final MouseWheelEvent e) { + final int diff; + if (e.getScrollType() == MouseWheelEvent.WHEEL_UNIT_SCROLL) { + diff = e.getUnitsToScroll() * vertical.getUnitIncrement(1); + } else { + diff = e.getWheelRotation() * vertical.getBlockIncrement(); + } + vertical.setValue(vertical.getValue() + diff); + } + private void doSingleClick(final MouseEvent evt, final int line, final int offset, final int dot) { if ((evt.getModifiers() & InputEvent.SHIFT_MASK) != 0) { rectSelect = (evt.getModifiers() & InputEvent.CTRL_MASK) != 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-28 17:13:50
|
Revision: 5265 http://gridarta.svn.sourceforge.net/gridarta/?rev=5265&view=rev Author: akirschbaum Date: 2008-09-28 17:13:39 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Change conflicting menu shortcuts. Modified Paths: -------------- trunk/crossfire/src/cfeditor/messages_fr.properties trunk/crossfire/src/cfeditor/messages_sv.properties trunk/daimonin/src/daieditor/messages_de.properties trunk/daimonin/src/daieditor/messages_fr.properties trunk/daimonin/src/daieditor/messages_sv.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Modified: trunk/crossfire/src/cfeditor/messages_fr.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_fr.properties 2008-09-28 07:43:01 UTC (rev 5264) +++ trunk/crossfire/src/cfeditor/messages_fr.properties 2008-09-28 17:13:39 UTC (rev 5265) @@ -182,7 +182,7 @@ # Window window.text=Fen\xEAtres -window.mnemonic=F +window.mnemonic=N nextWindow.text=Fen\xEAtre suivante nextWindow.shortdescription=Affiche la fen\xEAtre suivante @@ -219,7 +219,7 @@ mapwindowMap.mnemonic=C #mapwindowCursor.text= -#mapwindowCursor.mnemonic= +mapwindowCursor.mnemonic=U ########## Modified: trunk/crossfire/src/cfeditor/messages_sv.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_sv.properties 2008-09-28 07:43:01 UTC (rev 5264) +++ trunk/crossfire/src/cfeditor/messages_sv.properties 2008-09-28 17:13:39 UTC (rev 5265) @@ -116,7 +116,7 @@ #autoJoin.mnemonic= gridVisible.text=Visa rutn\xE4t -gridVisible.mnemonic=V +gridVisible.mnemonic=R gridVisible.shortdescription=Rita ut rutn\xE4t f\xF6r att visa enstaka kartrutor enterExit.text=F\xF6lj utg\xE5ng @@ -154,7 +154,7 @@ # Archetypes #archetypes.text= -#archetypes.mnemonic= +archetypes.mnemonic=C ######### Modified: trunk/daimonin/src/daieditor/messages_de.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_de.properties 2008-09-28 07:43:01 UTC (rev 5264) +++ trunk/daimonin/src/daieditor/messages_de.properties 2008-09-28 17:13:39 UTC (rev 5265) @@ -140,7 +140,7 @@ # Archetypes archetypes.text=Archetypen -archetypes.mnemonic=A +archetypes.mnemonic=T ############ Modified: trunk/daimonin/src/daieditor/messages_fr.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_fr.properties 2008-09-28 07:43:01 UTC (rev 5264) +++ trunk/daimonin/src/daieditor/messages_fr.properties 2008-09-28 17:13:39 UTC (rev 5265) @@ -163,7 +163,7 @@ # View view.text=Affichage -view.mnemonic=A +view.mnemonic=I #viewShow.text= #viewShow.shortdescription= @@ -209,7 +209,7 @@ # Window window.text=Fen\xEAtres -window.mnemonic=F +window.mnemonic=N nextWindow.text=Fen\xEAtre suivante nextWindow.shortdescription=Affiche la fen\xEAtre suivante @@ -247,7 +247,7 @@ mapwindowMap.mnemonic=C #mapwindowCursor.text= -#mapwindowCursor.mnemonic= +mapwindowCursor.mnemonic=U ################# Modified: trunk/daimonin/src/daieditor/messages_sv.properties =================================================================== --- trunk/daimonin/src/daieditor/messages_sv.properties 2008-09-28 07:43:01 UTC (rev 5264) +++ trunk/daimonin/src/daieditor/messages_sv.properties 2008-09-28 17:13:39 UTC (rev 5265) @@ -142,7 +142,7 @@ # Archetypes #archetypes.text= -#archetypes.mnemonic= +archetypes.mnemonic=C ############ @@ -198,7 +198,7 @@ #resetAlpha.mnemonic=R gridVisible.text=Visa rutn\xE4t -gridVisible.mnemonic=V +gridVisible.mnemonic=R gridVisible.shortdescription=Rita ut rutn\xE4t f\xF6r att visa enstaka kartrutor drawDouble.text=Visa dubbla bilder Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-09-28 07:43:01 UTC (rev 5264) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-09-28 17:13:39 UTC (rev 5265) @@ -556,7 +556,7 @@ floodfill.text=Freien Bereich f\xFCllen selectAll.text=Alles ausw\xE4hlen -selectAll.mnemonic=W +selectAll.mnemonic=S ############ @@ -590,7 +590,7 @@ newScript.mnemonic=P editScript.text=Script \xE4ndern -#editScript.mnemonic= +editScript.mnemonic=N validateMap.text=Karte pr\xFCfen validateMap.mnemonic=K @@ -773,14 +773,14 @@ scriptEditClose.text=Schie\xDFen scriptEditClose.mnemonic=C scriptEditCloseAll.text=Alle schlie\xDFen -scriptEditCloseAll.mnemonic=A +scriptEditCloseAll.mnemonic=L scriptEditCut.text=Ausschneiden scriptEditCut.mnemonic=A scriptEditCopy.text=Kopieren scriptEditCopy.mnemonic=K scriptEditPaste.text=Einf\xFCgen -scriptEditPaste.mnemonic=E +scriptEditPaste.mnemonic=I scriptEditFind.text=Suchen scriptEditFind.mnemonic=S Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-09-28 07:43:01 UTC (rev 5264) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-09-28 17:13:39 UTC (rev 5265) @@ -490,7 +490,7 @@ options.text=Options... options.shortdescription=Affiche les options options.longdescription=Affiche une fen\xEAtre d'options pour modifier les r\xE9glages de l'\xE9diteur -options.mnemonic=O +options.mnemonic=P exit.text=Quitter exit.shortdescription=Quitter le programme @@ -519,7 +519,7 @@ paste.mnemonic=L #shift.text= -#shift.mnemonic= +shift.mnemonic=S #shiftNorth.text= #shiftNorth.mnemonic= @@ -535,7 +535,7 @@ #shiftNorthWest.text= replace.text=Remplacer -replace.mnemonic=R +replace.mnemonic=M #fillAuto.text= #fillAuto.mnemonic= @@ -606,7 +606,7 @@ # Help help.text=Aide -help.mnemonic=A +help.mnemonic=D onlineHelp.text=Aide onlineHelp.mnemonic=A @@ -694,7 +694,7 @@ # View view.text=Affichage -view.mnemonic=A +view.mnemonic=I showMonster.text=Afficher {0} @@ -790,10 +790,10 @@ scriptEditUndo.text=Annuler scriptEditUndo.name={0} -scriptEditUndo.mnemonic=A +scriptEditUndo.mnemonic=N scriptEditRedo.text=R\xE9p\xE9ter scriptEditRedo.name={0} -scriptEditRedo.mnemonic=R +scriptEditRedo.mnemonic=P ############################ # Script Editor Find Dialog Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-09-28 07:43:01 UTC (rev 5264) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-09-28 17:13:39 UTC (rev 5265) @@ -474,17 +474,17 @@ close.text=St\xE4ng close.shortdescription=St\xE4ng karta close.longdescription=St\xE4nger den aktuella kartan -close.mnemonic=S +close.mnemonic=G recent.text=Nyligen recent.shortdescription=Ladda nyligen \xF6ppnad karta -recent.mnemonic=Y +recent.mnemonic=L recentItem.shortdescriptionformat=\xD6ppnar karta {0} ({1}) createNew.text=Ny createNew.shortdescription=Ny karta createNew.longdescription=Skapar en ny karta -createNew.mnemonic=N +createNew.mnemonic=Y open.text=\xD6ppna... open.shortdescription=\xD6ppna karta @@ -500,7 +500,7 @@ exit.text=Avsluta exit.shortdescription=Avsluta programmet exit.longdescription=Avslutar programmet -exit.mnemonic=A +exit.mnemonic=V ####### @@ -515,7 +515,7 @@ clear.longdescription=Rensar alla markerade rutor cut.text=Klipp ut -cut.mnemonic=U +cut.mnemonic=T copy.text=Kopiera copy.mnemonic=K @@ -567,7 +567,7 @@ # Resources resources.text=Resurser -resources.mnemonic=R +resources.mnemonic=E collectArches.text=Skapa archetypsamling collectArches.mnemonic=A @@ -775,7 +775,7 @@ scriptEditSave.text=Spara scriptEditSave.mnemonic=S scriptEditClose.text=St\xE4ng -scriptEditClose.mnemonic=S +scriptEditClose.mnemonic=G scriptEditCloseAll.text=St\xE4ng alla scriptEditCloseAll.mnemonic=T This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-28 19:32:40
|
Revision: 5276 http://gridarta.svn.sourceforge.net/gridarta/?rev=5276&view=rev Author: akirschbaum Date: 2008-09-28 19:32:27 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Split off MapPropertiesDialogFactory from MapPropertiesDialog. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/MapActions.java trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/MapActions.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java Added Paths: ----------- trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/map/MapPropertiesDialogFactory.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 19:06:44 UTC (rev 5275) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 19:32:27 UTC (rev 5276) @@ -29,6 +29,7 @@ import cfeditor.gameobject.face.FaceObjects; import cfeditor.gameobject.scripts.ScriptArchUtils; import cfeditor.gui.map.CMapViewBasic; +import cfeditor.gui.map.DefaultMapPropertiesDialogFactory; import cfeditor.gui.map.DefaultRendererFactory; import cfeditor.gui.prefs.ResPrefs; import cfeditor.map.DefaultMapControlFactory; @@ -59,6 +60,7 @@ import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; +import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.prefs.AppPrefs; @@ -197,7 +199,8 @@ CommonConstants.SOUTH_WEST, CommonConstants.NORTH_WEST, }; - return new MapActions(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, true); + final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory = new DefaultMapPropertiesDialogFactory(); + return new MapActions(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, true, mapPropertiesDialogFactory); } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/MapActions.java =================================================================== --- trunk/crossfire/src/cfeditor/MapActions.java 2008-09-28 19:06:44 UTC (rev 5275) +++ trunk/crossfire/src/cfeditor/MapActions.java 2008-09-28 19:32:27 UTC (rev 5276) @@ -22,7 +22,6 @@ import cfeditor.gameobject.Archetype; import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; -import cfeditor.gui.map.MapPropertiesDialog; import cfeditor.map.MapArchObject; import java.awt.Component; import java.awt.Dimension; @@ -44,6 +43,7 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.map.MapCursorEvent; +import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.ShrinkMapSizeDialogManager; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; @@ -151,6 +151,12 @@ private final boolean allowRandomMapParameters; /** + * The {@link MapPropertiesDialogFactory} to use. + */ + @NotNull + private final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory; + + /** * Create a new instance. * @param parent the component for showing dialog boxes * @param helpParent the parent frame for help windows @@ -164,8 +170,10 @@ * @param directionMap maps relative direction to map window direction * @param allowRandomMapParameters whether exit paths may point to random * maps + * @param mapPropertiesDialogFactory the map properties dialog factory to + * use */ - public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final int[] directionMap, final boolean allowRandomMapParameters) { + public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final int[] directionMap, final boolean allowRandomMapParameters, @NotNull final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory) { this.parent = parent; this.helpParent = helpParent; this.gridartaObjectsFactory = gridartaObjectsFactory; @@ -176,6 +184,7 @@ this.selectedSquareView = selectedSquareView; this.directionMap = directionMap; this.allowRandomMapParameters = allowRandomMapParameters; + this.mapPropertiesDialogFactory = mapPropertiesDialogFactory; shrinkMapSizeDialogManager = new ShrinkMapSizeDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewManager); autoJoin = prefs.getBoolean(AUTOJOIN_KEY, false); @@ -267,7 +276,7 @@ public void mapProperties() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); if (mapView != null) { - MapPropertiesDialog.showDialog(mapView.getComponent(), helpParent, mapManager, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); + mapPropertiesDialogFactory.showDialog(mapView.getComponent(), helpParent, mapManager, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); } } Added: trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java (rev 0) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java 2008-09-28 19:32:27 UTC (rev 5276) @@ -0,0 +1,71 @@ +/* + * 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.map; + +import cfeditor.gameobject.Archetype; +import cfeditor.gameobject.GameObject; +import cfeditor.map.MapArchObject; +import java.awt.Component; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MapManager; +import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; +import net.sf.gridarta.map.MapControl; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link MapPropertiesDialogFactory} creating Crossfire map properties + * dialogs. + * @author Andreas Kirschbaum + */ +public class DefaultMapPropertiesDialogFactory implements MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + + /** + * Show a dialog querying the user for map properties. + * @param parent the parent component to show dialog on + * @param helpParent the parent frame for help windows + * @param mapManager the map manager to use + * @param gridartaObjectsFactory the gridarta objects factory instance + * @param globalSettings the global settings instance + * @param level map to show dialog about + * @param mapFileFilter the Swing file filter to use + */ + public void showDialog(final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { + final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, gridartaObjectsFactory, globalSettings, level, mapFileFilter); + final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); + pane.dialog = dialog; + dialog.getRootPane().setDefaultButton(pane.okButton); + dialog.setResizable(true); + dialog.setModal(false); + dialog.setVisible(true); + if (!pane.mapTilePaneEnabled) { + ACTION_FACTORY.showOnetimeMessageDialog(dialog, JOptionPane.WARNING_MESSAGE, "mapTilesNoMapFileNoMapTilePane"); + } + } + +} // class DefaultMapPropertiesDialogFactory Property changes on: trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2008-09-28 19:06:44 UTC (rev 5275) +++ trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2008-09-28 19:32:27 UTC (rev 5276) @@ -23,7 +23,6 @@ import cfeditor.gameobject.GameObject; import cfeditor.map.MapArchObject; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; import java.awt.Insets; @@ -72,7 +71,7 @@ private final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl; - private JDialog dialog = null; + public JDialog dialog = null; /** * The {@link GridBagConstraints} for label fields before text input @@ -157,7 +156,7 @@ private final JButton helpButton = new JButton(ACTION_FACTORY.createAction(false, "mapHelp", this)); /** JButton for ok. */ - private final JButton okButton = new JButton(ACTION_FACTORY.createAction(false, "mapOkay", this)); + public final JButton okButton = new JButton(ACTION_FACTORY.createAction(false, "mapOkay", this)); /** JButton for restore. */ private final JButton restoreButton = new JButton(ACTION_FACTORY.createAction(false, "mapRestore", this)); @@ -169,7 +168,7 @@ private final MapTilePane mapTilePane; /** Whether the map tile pane was enabled. */ - private final boolean mapTilePaneEnabled; + public final boolean mapTilePaneEnabled; /** * Creates a map-options dialog. @@ -180,7 +179,7 @@ * @param mapControl The level whose properties are shown/edited. * @param mapFileFilter the Swing file filter to use */ - private MapPropertiesDialog(final JFrame helpParent, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + public MapPropertiesDialog(final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { okButton.setDefaultCapable(true); setOptions(new Object[] {helpButton, okButton, restoreButton, cancelButton}); @@ -630,27 +629,4 @@ mapTilePane.restoreMapProperties(); } - /** - * Show a dialog querying the user for map properties. - * @param parent the parent component to show dialog on - * @param helpParent the parent frame for help windows - * @param mapManager the map manager to use - * @param gridartaObjectsFactory the gridarta objects factory instance - * @param globalSettings the global settings instance - * @param level map to show dialog about - * @param mapFileFilter the Swing file filter to use - */ - public static void showDialog(final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, gridartaObjectsFactory, globalSettings, level, mapFileFilter); - final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); - pane.dialog = dialog; - dialog.getRootPane().setDefaultButton(pane.okButton); - dialog.setResizable(true); - dialog.setModal(false); - dialog.setVisible(true); - if (!pane.mapTilePaneEnabled) { - ACTION_FACTORY.showOnetimeMessageDialog(dialog, WARNING_MESSAGE, "mapTilesNoMapFileNoMapTilePane"); - } - } - } // class MapPropertiesDialog Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 19:06:44 UTC (rev 5275) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 19:32:27 UTC (rev 5276) @@ -29,6 +29,7 @@ import daieditor.gameobject.face.FaceObjects; import daieditor.gameobject.scripts.ScriptArchUtils; import daieditor.gui.map.CMapViewBasic; +import daieditor.gui.map.DefaultMapPropertiesDialogFactory; import daieditor.gui.map.DefaultRendererFactory; import daieditor.gui.prefs.NetPrefs; import daieditor.gui.prefs.ResPrefs; @@ -64,6 +65,7 @@ import net.sf.gridarta.gui.MainView; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; +import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.prefs.AppPrefs; @@ -240,7 +242,8 @@ CommonConstants.WEST, CommonConstants.NORTH, }; - return new MapActions(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, false); + final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory = new DefaultMapPropertiesDialogFactory(); + return new MapActions(getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, false, mapPropertiesDialogFactory); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/MapActions.java =================================================================== --- trunk/daimonin/src/daieditor/MapActions.java 2008-09-28 19:06:44 UTC (rev 5275) +++ trunk/daimonin/src/daieditor/MapActions.java 2008-09-28 19:32:27 UTC (rev 5276) @@ -22,7 +22,6 @@ import daieditor.gameobject.Archetype; import daieditor.gameobject.GameObject; import daieditor.gui.map.CMapViewBasic; -import daieditor.gui.map.MapPropertiesDialog; import daieditor.map.MapArchObject; import java.awt.Component; import java.awt.Dimension; @@ -44,6 +43,7 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.MapViewManager; import net.sf.gridarta.gui.map.MapCursorEvent; +import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.ShrinkMapSizeDialogManager; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; @@ -151,6 +151,12 @@ private final boolean allowRandomMapParameters; /** + * The {@link MapPropertiesDialogFactory} to use. + */ + @NotNull + private final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory; + + /** * Create a new instance. * @param parent the component for showing dialog boxes * @param helpParent the parent frame for help windows @@ -164,8 +170,10 @@ * @param directionMap maps relative direction to map window direction * @param allowRandomMapParameters whether exit paths may point to random * maps + * @param mapPropertiesDialogFactory the map properties dialog factory to + * use */ - public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final int[] directionMap, final boolean allowRandomMapParameters) { + public MapActions(@NotNull final Component parent, @NotNull final JFrame helpParent, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapViewManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapViewManager, final GameObjectMatcher exitMatcher, final FileFilter mapFileFilter, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final int[] directionMap, final boolean allowRandomMapParameters, @NotNull final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory) { this.parent = parent; this.helpParent = helpParent; this.gridartaObjectsFactory = gridartaObjectsFactory; @@ -176,6 +184,7 @@ this.selectedSquareView = selectedSquareView; this.directionMap = directionMap; this.allowRandomMapParameters = allowRandomMapParameters; + this.mapPropertiesDialogFactory = mapPropertiesDialogFactory; shrinkMapSizeDialogManager = new ShrinkMapSizeDialogManager<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapViewManager); autoJoin = prefs.getBoolean(AUTOJOIN_KEY, false); @@ -267,7 +276,7 @@ public void mapProperties() { final MapView<GameObject, MapArchObject, Archetype, CMapViewBasic> mapView = getMapPropertiesEnabled(); if (mapView != null) { - MapPropertiesDialog.showDialog(mapView.getComponent(), helpParent, mapManager, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); + mapPropertiesDialogFactory.showDialog(mapView.getComponent(), helpParent, mapManager, gridartaObjectsFactory, globalSettings, mapView.getMapControl(), mapFileFilter); } } Added: trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java (rev 0) +++ trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java 2008-09-28 19:32:27 UTC (rev 5276) @@ -0,0 +1,71 @@ +/* + * 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.map; + +import daieditor.gameobject.Archetype; +import daieditor.gameobject.GameObject; +import daieditor.map.MapArchObject; +import java.awt.Component; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JOptionPane; +import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MapManager; +import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; +import net.sf.gridarta.map.MapControl; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; + +/** + * A {@link MapPropertiesDialogFactory} creating Crossfire map properties + * dialogs. + * @author Andreas Kirschbaum + */ +public class DefaultMapPropertiesDialogFactory implements MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); + + /** + * Show a dialog querying the user for map properties. + * @param parent the parent component to show dialog on + * @param helpParent the parent frame for help windows + * @param mapManager the map manager to use + * @param gridartaObjectsFactory the gridarta objects factory instance + * @param globalSettings the global settings instance + * @param level map to show dialog about + * @param mapFileFilter the Swing file filter to use + */ + public void showDialog(final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { + final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, gridartaObjectsFactory, globalSettings, level, mapFileFilter); + final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); + pane.dialog = dialog; + dialog.getRootPane().setDefaultButton(pane.okButton); + dialog.setResizable(true); + dialog.setModal(false); + dialog.setVisible(true); + if (!pane.mapTilePaneEnabled) { + ACTION_FACTORY.showOnetimeMessageDialog(dialog, JOptionPane.WARNING_MESSAGE, "mapTilesNoMapFileNoMapTilePane"); + } + } + +} // class DefaultMapPropertiesDialogFactory Property changes on: trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-09-28 19:06:44 UTC (rev 5275) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-09-28 19:32:27 UTC (rev 5276) @@ -23,7 +23,6 @@ import daieditor.gameobject.GameObject; import daieditor.map.MapArchObject; import java.awt.BorderLayout; -import java.awt.Component; import java.awt.FlowLayout; import java.awt.GridBagConstraints; import java.awt.GridBagLayout; @@ -90,7 +89,7 @@ private final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl; - private JDialog dialog = null; + public JDialog dialog = null; // input components, see MapArchObject for expl. of purpose private final JTextArea mapDescription = new JTextArea(4, 4); // the msg text/arch text @@ -143,7 +142,7 @@ private final JButton helpButton = new JButton(ACTION_FACTORY.createAction(false, "mapHelp", this)); /** JButton for ok. */ - private final JButton okButton = new JButton(ACTION_FACTORY.createAction(false, "mapOkay", this)); + public final JButton okButton = new JButton(ACTION_FACTORY.createAction(false, "mapOkay", this)); /** JButton for restore. */ private final JButton restoreButton = new JButton(ACTION_FACTORY.createAction(false, "mapRestore", this)); @@ -155,7 +154,7 @@ private final MapTilePane mapTilePane; /** Whether the map tile pane was enabled. */ - private final boolean mapTilePaneEnabled; + public final boolean mapTilePaneEnabled; /** * Creates a map-options dialog. @@ -166,7 +165,7 @@ * @param mapControl The level whose properties are shown/edited. * @param mapFileFilter the Swing file filter to use */ - private MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { okButton.setDefaultCapable(true); setOptions(new Object[] {helpButton, okButton, restoreButton, cancelButton}); @@ -561,27 +560,4 @@ mapTilePane.restoreMapProperties(); } - /** - * Show a dialog querying the user for map properties. - * @param parent the parent component to show dialog on - * @param helpParent the parent frame for help windows - * @param mapManager the map manager to use - * @param gridartaObjectsFactory the gridarta objects factory instance - * @param globalSettings the global settings instance - * @param level map to show dialog about - * @param mapFileFilter the Swing file filter to use - */ - public static void showDialog(final Component parent, final JFrame helpParent, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, gridartaObjectsFactory, globalSettings, level, mapFileFilter); - final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); - pane.dialog = dialog; - dialog.getRootPane().setDefaultButton(pane.okButton); - dialog.setResizable(true); - dialog.setModal(false); - dialog.setVisible(true); - if (!pane.mapTilePaneEnabled) { - ACTION_FACTORY.showOnetimeMessageDialog(dialog, WARNING_MESSAGE, "mapTilesNoMapFileNoMapTilePane"); - } - } - } // class MapPropertiesDialog Added: trunk/src/app/net/sf/gridarta/gui/map/MapPropertiesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapPropertiesDialogFactory.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/MapPropertiesDialogFactory.java 2008-09-28 19:32:27 UTC (rev 5276) @@ -0,0 +1,52 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.map; + +import java.awt.Component; +import javax.swing.JFrame; +import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.GridartaObjectsFactory; +import net.sf.gridarta.MapManager; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.MapControl; +import org.jetbrains.annotations.NotNull; + +/** + * Factory for creating map property dialog instances. + * @author Andreas Kirschbaum + */ +public interface MapPropertiesDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { + + /** + * Show a dialog querying the user for map properties. + * @param parent the parent component to show dialog on + * @param helpParent the parent frame for help windows + * @param mapManager the map manager to use + * @param gridartaObjectsFactory the gridarta objects factory instance + * @param globalSettings the global settings instance + * @param level map to show dialog about + * @param mapFileFilter the Swing file filter to use + */ + void showDialog(Component parent, @NotNull JFrame helpParent, @NotNull MapManager<G, A, R, V> mapManager, @NotNull GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<G, A, R, V> level, FileFilter mapFileFilter); + +} // interface MapPropertiesDialogFactory Property changes on: trunk/src/app/net/sf/gridarta/gui/map/MapPropertiesDialogFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-09-28 20:08:51
|
Revision: 5278 http://gridarta.svn.sourceforge.net/gridarta/?rev=5278&view=rev Author: akirschbaum Date: 2008-09-28 20:08:33 +0000 (Sun, 28 Sep 2008) Log Message: ----------- Move MapActions to proper package. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/gui/map/DefaultMapActions.java trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java trunk/src/app/net/sf/gridarta/map/MapControlFactory.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/map/MapActions.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/MapActions.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 20:02:43 UTC (rev 5277) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-09-28 20:08:33 UTC (rev 5278) @@ -48,7 +48,6 @@ import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MapActions; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.filter.FilterControl; @@ -62,6 +61,7 @@ import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.map.DefaultMapActions; +import net.sf.gridarta.gui.map.MapActions; import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchooser.ObjectChooser; Modified: trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-09-28 20:02:43 UTC (rev 5277) +++ trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-09-28 20:08:33 UTC (rev 5278) @@ -27,11 +27,11 @@ import java.util.List; import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.gui.map.MapActions; import net.sf.gridarta.gui.map.RendererFactory; import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.map.AbstractMapControlFactory; Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 20:02:43 UTC (rev 5277) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-09-28 20:08:33 UTC (rev 5278) @@ -50,7 +50,6 @@ import net.sf.gridarta.EditTypes; import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MapActions; import net.sf.gridarta.MapManager; import net.sf.gridarta.archtype.ArchetypeTypeSet; import net.sf.gridarta.filter.FilterControl; @@ -67,6 +66,7 @@ import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.map.DefaultMapActions; +import net.sf.gridarta.gui.map.MapActions; import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchooser.ObjectChooser; Modified: trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-09-28 20:02:43 UTC (rev 5277) +++ trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-09-28 20:08:33 UTC (rev 5278) @@ -27,11 +27,11 @@ import java.util.List; import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.gui.map.MapActions; import net.sf.gridarta.gui.map.RendererFactory; import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.map.AbstractMapControlFactory; Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-09-28 20:02:43 UTC (rev 5277) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-09-28 20:08:33 UTC (rev 5278) @@ -74,6 +74,7 @@ import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesControl; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; +import net.sf.gridarta.gui.map.MapActions; import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapFileActions; import net.sf.gridarta.gui.map.MapPreviewAccessory; Deleted: trunk/src/app/net/sf/gridarta/MapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/MapActions.java 2008-09-28 20:02:43 UTC (rev 5277) +++ trunk/src/app/net/sf/gridarta/MapActions.java 2008-09-28 20:08:33 UTC (rev 5278) @@ -1,40 +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; - -/** - * Manages actions in the "map" menu. - * @author Andreas Kirschbaum - */ -public interface MapActions { - - /** - * Action method for "autojoin". - * @return <code>true</code> if autojoining is enabled, or - * <code>false</code> if autojoining is disabled - */ - boolean isAutoJoin(); - - /** - * Sets the state of all actions. - */ - void updateMenuState(); - -} // interface MapActions Modified: trunk/src/app/net/sf/gridarta/gui/map/DefaultMapActions.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/DefaultMapActions.java 2008-09-28 20:02:43 UTC (rev 5277) +++ trunk/src/app/net/sf/gridarta/gui/map/DefaultMapActions.java 2008-09-28 20:08:33 UTC (rev 5278) @@ -35,7 +35,6 @@ import net.sf.gridarta.GlobalSettings; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapActions; import net.sf.gridarta.MapManager; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; Copied: trunk/src/app/net/sf/gridarta/gui/map/MapActions.java (from rev 5268, trunk/src/app/net/sf/gridarta/MapActions.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapActions.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/map/MapActions.java 2008-09-28 20:08:33 UTC (rev 5278) @@ -0,0 +1,40 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.map; + +/** + * Manages actions in the "map" menu. + * @author Andreas Kirschbaum + */ +public interface MapActions { + + /** + * Action method for "autojoin". + * @return <code>true</code> if autojoining is enabled, or + * <code>false</code> if autojoining is disabled + */ + boolean isAutoJoin(); + + /** + * Sets the state of all actions. + */ + void updateMenuState(); + +} // interface MapActions Property changes on: trunk/src/app/net/sf/gridarta/gui/map/MapActions.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-09-28 20:02:43 UTC (rev 5277) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapControl.java 2008-09-28 20:08:33 UTC (rev 5278) @@ -31,7 +31,6 @@ import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.CommonConstants; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; @@ -39,6 +38,7 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.MapActions; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.RendererFactory; Modified: trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-09-28 20:02:43 UTC (rev 5277) +++ trunk/src/app/net/sf/gridarta/map/DefaultMapModel.java 2008-09-28 20:08:33 UTC (rev 5278) @@ -29,12 +29,12 @@ import javax.swing.event.EventListenerList; import net.sf.gridarta.AutojoinList; import net.sf.gridarta.AutojoinLists; -import net.sf.gridarta.MapActions; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.gui.map.MapActions; import net.sf.gridarta.map.validation.DefaultErrorCollector; import net.sf.gridarta.map.validation.ErrorCollector; import net.sf.japi.swing.ActionFactory; Modified: trunk/src/app/net/sf/gridarta/map/MapControlFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-09-28 20:02:43 UTC (rev 5277) +++ trunk/src/app/net/sf/gridarta/map/MapControlFactory.java 2008-09-28 20:08:33 UTC (rev 5278) @@ -25,13 +25,13 @@ import java.util.List; import net.sf.gridarta.AutojoinLists; import net.sf.gridarta.GridartaObjectsFactory; -import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.Size2D; import net.sf.gridarta.gameobject.Archetype; import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; +import net.sf.gridarta.gui.map.MapActions; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.RendererFactory; import net.sf.gridarta.io.GameObjectParser; Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-09-28 20:02:43 UTC (rev 5277) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-09-28 20:08:33 UTC (rev 5278) @@ -44,7 +44,6 @@ import net.sf.gridarta.GlobalSettingsImpl; import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapActions; import net.sf.gridarta.MapImageCache; import net.sf.gridarta.MapManager; import net.sf.gridarta.Size2D; @@ -68,18 +67,19 @@ import net.sf.gridarta.gameobject.match.GameObjectMatcher; import net.sf.gridarta.gameobject.match.GameObjectMatchers; import net.sf.gridarta.gui.MainView; -import net.sf.gridarta.gui.prefs.AppPrefsModel; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserModel; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.gameobjectattributespanel.ScriptTab; import net.sf.gridarta.gui.map.LevelRenderer; +import net.sf.gridarta.gui.map.MapActions; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.gui.map.RendererFactory; import net.sf.gridarta.gui.map.tools.ToolPalette; import net.sf.gridarta.gui.newmap.NewMapDialogFactory; import net.sf.gridarta.gui.objectchooser.ObjectChooser; +import net.sf.gridarta.gui.prefs.AppPrefsModel; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.AbstractGameObjectParser; import net.sf.gridarta.io.GameObjectParser; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 15:34:46
|
Revision: 5306 http://gridarta.svn.sourceforge.net/gridarta/?rev=5306&view=rev Author: akirschbaum Date: 2008-10-01 15:34:11 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Simplify access to PluginParameters in ScriptModel. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java trunk/crossfire/src/cfeditor/gui/script/ScriptView.java trunk/crossfire/src/cfeditor/script/ScriptController.java trunk/src/app/net/sf/gridarta/script/ScriptModel.java trunk/src/app/net/sf/gridarta/script/parameter/NoSuchParameterException.java Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-10-01 15:13:56 UTC (rev 5305) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-10-01 15:34:11 UTC (rev 5306) @@ -57,6 +57,7 @@ import net.sf.gridarta.gui.utils.GUIUtils; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.parameter.PluginParameter; +import net.sf.gridarta.script.parameter.NoSuchParameterException; import org.apache.log4j.Logger; import org.jetbrains.annotations.NotNull; @@ -232,7 +233,13 @@ return; } - final String name = getScript().getParamName(selectedRow); + final PluginParameter parameter; + try { + parameter = getScript().getParameter(selectedRow); + } catch (final NoSuchParameterException ex) { + return; + } + final String name = parameter.getName(); if (JOptionPane.showConfirmDialog(removeParameter, "Delete " + name + "?", "Delete?", JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) { getScript().removeParameter(selectedRow); } @@ -293,13 +300,11 @@ paramTable.add(new JLabel("Config"), gbc); gbc.gridx = 4; paramTable.add(new JLabel("Default"), gbc); - for (int i = 0; i < script.getParametersCount(); i++) { - if (log.isDebugEnabled()) { - log.debug("Doing " + i + " on " + script.getParametersCount()); - } - + int i = 0; + for (final PluginParameter parameter : script) { gbc.gridy = i + 1; - putRow(gbc, script.getParameter(i)); + putRow(gbc, parameter); + i++; } repaint(); } Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-10-01 15:13:56 UTC (rev 5305) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-10-01 15:34:11 UTC (rev 5306) @@ -42,6 +42,7 @@ import javax.swing.JPanel; import net.sf.gridarta.gui.utils.MenuUtils; import net.sf.gridarta.script.ScriptModel; +import net.sf.gridarta.script.parameter.PluginParameter; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.ReflectionAction; import org.apache.log4j.Logger; @@ -201,7 +202,7 @@ public boolean getRunValues(final ScriptModel model) { //JDialog d = new JDialog(control.getMainControl().getMainView(), true); - if (model.getParametersCount() < 1) { + if (!model.hasParameters()) { return true; } @@ -216,17 +217,18 @@ dialog.setModal(true); dialog.setTitle(model.getName()); dialog.getContentPane().removeAll(); - //JTextField[] fields = new JTextField[model.getParametersCount()]; - for (int i = 0; i < model.getParametersCount(); i++) { + int i = 0; + for (final PluginParameter parameter : model) { log.debug("adding parameter"); - final JLabel name = new JLabel(model.getParamName(i)); - final PluginParameterView view = pluginParameterViewFactory.getView(model.getParameter(i)); - final JComponent val = view.getValueComponent(model.getParamValue(i), model.getParameter(i)); - val.setToolTipText(model.getParamDescription(i)); + final JLabel name = new JLabel(parameter.getName()); + final PluginParameterView view = pluginParameterViewFactory.getView(parameter); + final JComponent val = view.getValueComponent(parameter.getValue(), parameter); + val.setToolTipText(parameter.getDescription()); final GridBagConstraints gn = new GridBagConstraints(0, i, 1, 1, 0.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 5, 5); final GridBagConstraints gf = new GridBagConstraints(1, i, 1, 1, 1.0, 0.0, GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 5, 5); panel.add(name, gn); panel.add(val, gf); + i++; } dialog.getContentPane().setLayout(new BorderLayout()); Modified: trunk/crossfire/src/cfeditor/script/ScriptController.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 15:13:56 UTC (rev 5305) +++ trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 15:34:11 UTC (rev 5306) @@ -50,6 +50,8 @@ import net.sf.gridarta.filter.Filter; import net.sf.gridarta.filter.FilterControl; import net.sf.gridarta.script.ScriptModel; +import net.sf.gridarta.script.parameter.PluginParameter; +import net.sf.gridarta.script.parameter.NoSuchParameterException; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; import org.jdom.Document; @@ -385,8 +387,8 @@ try { runner.setConsole(console); scriptParameters.setInterpreterValues(runner, ScriptRunMode.BATCH); - for (int i = 0; i < model.getParametersCount(); i++) { - runner.set(model.getParamName(i), model.getParamValue(i)); + for (final PluginParameter parameter : model) { + runner.set(parameter.getName(), parameter.getValue()); } scriptThread = new BshThread(model.getName()); scriptThread.setScript(model); @@ -537,14 +539,22 @@ final int index = model.getParameter(tmp[0]); if (index == -1) { final StringBuilder sb = new StringBuilder(); - for (int i = 0; i < model.getParametersCount(); i++) { - sb.append(i > 0 ? ", " : " "); - sb.append(model.getParameter(i).getName()); + boolean firstParameter = true; + for (final PluginParameter parameter : model) { + sb.append(firstParameter ? " " : ", "); + sb.append(parameter.getName()); + firstParameter = false; } throw new ScriptExecException("script " + script + " has no parameter " + tmp[0] + "; available parameters:" + sb); } - if (!pluginParameterViewFactory.getView(model.getParameter(index)).setValue(tmp[1])) { + final PluginParameter parameter; + try { + parameter = model.getParameter(index); + } catch (final NoSuchParameterException ex) { + throw new AssertionError(); + } + if (!pluginParameterViewFactory.getView(parameter).setValue(tmp[1])) { throw new ScriptExecException("invalid value " + tmp[1] + " for parameter " + tmp[0]); } } Modified: trunk/src/app/net/sf/gridarta/script/ScriptModel.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptModel.java 2008-10-01 15:13:56 UTC (rev 5305) +++ trunk/src/app/net/sf/gridarta/script/ScriptModel.java 2008-10-01 15:34:11 UTC (rev 5306) @@ -21,7 +21,9 @@ import java.io.File; import java.util.ArrayList; +import java.util.Collections; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Set; import javax.swing.event.ChangeEvent; @@ -41,7 +43,7 @@ * @author tchize * @todo documentation */ -public final class ScriptModel implements Cloneable { +public final class ScriptModel implements Cloneable, Iterable<PluginParameter> { /** The Logger for printing log messages. */ private static final Logger log = Logger.getLogger(ScriptModel.class); @@ -127,55 +129,14 @@ } /** - * Get the name of a script parameter. - * @param index The index number of parameter - * @return the name of parameter + * Returns whether this script has at least one parameter. + * @return whether this script has at least one parameter */ - @Nullable - public String getParamName(final int index) { - try { - return parameters.get(index).getName(); - } catch (final Exception e) { - return null; - } - + public boolean hasParameters() { + return !parameters.isEmpty(); } /** - * Returns the parameter description for the parameter with the specified - * index. - * @param index the parameter index to get - * @return The description of the specified parameter. - */ - @Nullable - public String getParamDescription(final int index) { - try { - return parameters.get(index).getDescription(); - } catch (final Exception e) { - return null; - } - } - - /** - * Returns the parameter value for the parameter with the specified index. - * @param index the parameter index to get - * @return Returns the parameter default value. - */ - @Nullable - public Object getParamValue(final int index) { - try { - return parameters.get(index).getValue(); - } catch (final Exception e) { - e.printStackTrace(); - return null; - } - } - - public int getParametersCount() { - return parameters.size(); - } - - /** * Returns the index for a parameter name. * @param paramName the parameter name * @return the index or <code>-1</code> if the parameter name does not @@ -266,8 +227,12 @@ * getParametersCount(). If index is out of range, result is undefined. * @return the requested parameter */ - public PluginParameter getParameter(final int index) { - return parameters.get(index); + public PluginParameter getParameter(final int index) throws NoSuchParameterException { + try { + return parameters.get(index); + } catch (final IndexOutOfBoundsException ex) { + throw new NoSuchParameterException(index); + } } /** @@ -447,4 +412,9 @@ this.file = file; } + /** {@inheritDoc} */ + public Iterator<PluginParameter> iterator() { + return Collections.unmodifiableList(parameters).iterator(); + } + } // class ScriptModel Modified: trunk/src/app/net/sf/gridarta/script/parameter/NoSuchParameterException.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/NoSuchParameterException.java 2008-10-01 15:13:56 UTC (rev 5305) +++ trunk/src/app/net/sf/gridarta/script/parameter/NoSuchParameterException.java 2008-10-01 15:34:11 UTC (rev 5306) @@ -38,4 +38,12 @@ super(type); } + /** + * Creates a new instance. + * @param index the missing parameter index + */ + public NoSuchParameterException(final int index) { + super("#" + index); + } + } // class NoSuchParameterException This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 16:49:19
|
Revision: 5317 http://gridarta.svn.sourceforge.net/gridarta/?rev=5317&view=rev Author: akirschbaum Date: 2008-10-01 16:48:45 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Move BshThread to common code base. Modified Paths: -------------- trunk/crossfire/build.xml trunk/crossfire/src/cfeditor/script/ScriptController.java trunk/daimonin/build.xml trunk/daimonin/src/daieditor/messages.properties Added Paths: ----------- trunk/lib/bsh-LICENSE trunk/lib/bsh-classgen-2.0b4.jar trunk/lib/bsh-commands-2.0b4.jar trunk/lib/bsh-core-2.0b4.jar trunk/lib/bsh-util-2.0b4.jar trunk/src/app/net/sf/gridarta/script/BshThread.java Removed Paths: ------------- trunk/crossfire/lib/bsh-LICENSE trunk/crossfire/lib/bsh-classgen-2.0b4.jar trunk/crossfire/lib/bsh-commands-2.0b4.jar trunk/crossfire/lib/bsh-core-2.0b4.jar trunk/crossfire/lib/bsh-util-2.0b4.jar trunk/crossfire/src/cfeditor/script/BshThread.java Modified: trunk/crossfire/build.xml =================================================================== --- trunk/crossfire/build.xml 2008-10-01 16:31:03 UTC (rev 5316) +++ trunk/crossfire/build.xml 2008-10-01 16:48:45 UTC (rev 5317) @@ -120,6 +120,7 @@ <include name="*-LICENSE" /> </fileset> <fileset dir="../lib"> + <include name="bsh-LICENSE" /> <include name="japi.jar-LICENSE" /> <include name="log4j-1.2.13.jar-LICENSE" /> <include name="jdom.jar-LICENSE" /> @@ -140,10 +141,10 @@ </fileset> <zipfileset src="../lib/log4j-1.2.13.jar" /> <zipfileset src="../lib/jdom.jar" excludes="META-INF/**" /> - <zipfileset src="${lib.dir}/bsh-core-2.0b4.jar" excludes="META-INF/**" /> - <zipfileset src="${lib.dir}/bsh-commands-2.0b4.jar" excludes="META-INF/**" /> - <zipfileset src="${lib.dir}/bsh-classgen-2.0b4.jar" excludes="META-INF/**" /> - <zipfileset src="${lib.dir}/bsh-util-2.0b4.jar" excludes="META-INF/**" /> + <zipfileset src="../lib/bsh-core-2.0b4.jar" excludes="META-INF/**" /> + <zipfileset src="../lib/bsh-commands-2.0b4.jar" excludes="META-INF/**" /> + <zipfileset src="../lib/bsh-classgen-2.0b4.jar" excludes="META-INF/**" /> + <zipfileset src="../lib/bsh-util-2.0b4.jar" excludes="META-INF/**" /> <zipgroupfileset dir="../lib/" includes="japi-*.jar" /> <!-- creating the manifest --> <manifest> Deleted: trunk/crossfire/lib/bsh-LICENSE =================================================================== --- trunk/crossfire/lib/bsh-LICENSE 2008-10-01 16:31:03 UTC (rev 5316) +++ trunk/crossfire/lib/bsh-LICENSE 2008-10-01 16:48:45 UTC (rev 5317) @@ -1,502 +0,0 @@ - GNU LESSER GENERAL PUBLIC LICENSE - Version 2.1, February 1999 - - Copyright (C) 1991, 1999 Free Software Foundation, Inc. - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - -[This is the first released version of the Lesser GPL. It also counts - as the successor of the GNU Library Public License, version 2, hence - the version number 2.1.] - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -Licenses are intended to guarantee your freedom to share and change -free software--to make sure the software is free for all its users. - - This license, the Lesser General Public License, applies to some -specially designated software packages--typically libraries--of the -Free Software Foundation and other authors who decide to use it. You -can use it too, but we suggest you first think carefully about whether -this license or the ordinary General Public License is the better -strategy to use in any particular case, based on the explanations below. - - When we speak of free software, we are referring to freedom of use, -not price. Our General Public Licenses are designed to make sure that -you have the freedom to distribute copies of free software (and charge -for this service if you wish); that you receive source code or can get -it if you want it; that you can change the software and use pieces of -it in new free programs; and that you are informed that you can do -these things. - - To protect your rights, we need to make restrictions that forbid -distributors to deny you these rights or to ask you to surrender these -rights. These restrictions translate to certain responsibilities for -you if you distribute copies of the library or if you modify it. - - For example, if you distribute copies of the library, whether gratis -or for a fee, you must give the recipients all the rights that we gave -you. You must make sure that they, too, receive or can get the source -code. If you link other code with the library, you must provide -complete object files to the recipients, so that they can relink them -with the library after making changes to the library and recompiling -it. And you must show them these terms so they know their rights. - - We protect your rights with a two-step method: (1) we copyright the -library, and (2) we offer you this license, which gives you legal -permission to copy, distribute and/or modify the library. - - To protect each distributor, we want to make it very clear that -there is no warranty for the free library. Also, if the library is -modified by someone else and passed on, the recipients should know -that what they have is not the original version, so that the original -author's reputation will not be affected by problems that might be -introduced by others. - - Finally, software patents pose a constant threat to the existence of -any free program. We wish to make sure that a company cannot -effectively restrict the users of a free program by obtaining a -restrictive license from a patent holder. Therefore, we insist that -any patent license obtained for a version of the library must be -consistent with the full freedom of use specified in this license. - - Most GNU software, including some libraries, is covered by the -ordinary GNU General Public License. This license, the GNU Lesser -General Public License, applies to certain designated libraries, and -is quite different from the ordinary General Public License. We use -this license for certain libraries in order to permit linking those -libraries into non-free programs. - - When a program is linked with a library, whether statically or using -a shared library, the combination of the two is legally speaking a -combined work, a derivative of the original library. The ordinary -General Public License therefore permits such linking only if the -entire combination fits its criteria of freedom. The Lesser General -Public License permits more lax criteria for linking other code with -the library. - - We call this license the "Lesser" General Public License because it -does Less to protect the user's freedom than the ordinary General -Public License. It also provides other free software developers Less -of an advantage over competing non-free programs. These disadvantages -are the reason we use the ordinary General Public License for many -libraries. However, the Lesser license provides advantages in certain -special circumstances. - - For example, on rare occasions, there may be a special need to -encourage the widest possible use of a certain library, so that it becomes -a de-facto standard. To achieve this, non-free programs must be -allowed to use the library. A more frequent case is that a free -library does the same job as widely used non-free libraries. In this -case, there is little to gain by limiting the free library to free -software only, so we use the Lesser General Public License. - - In other cases, permission to use a particular library in non-free -programs enables a greater number of people to use a large body of -free software. For example, permission to use the GNU C Library in -non-free programs enables many more people to use the whole GNU -operating system, as well as its variant, the GNU/Linux operating -system. - - Although the Lesser General Public License is Less protective of the -users' freedom, it does ensure that the user of a program that is -linked with the Library has the freedom and the wherewithal to run -that program using a modified version of the Library. - - The precise terms and conditions for copying, distribution and -modification follow. Pay close attention to the difference between a -"work based on the library" and a "work that uses the library". The -former contains code derived from the library, whereas the latter must -be combined with the library in order to run. - - GNU LESSER GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License Agreement applies to any software library or other -program which contains a notice placed by the copyright holder or -other authorized party saying it may be distributed under the terms of -this Lesser General Public License (also called "this License"). -Each licensee is addressed as "you". - - A "library" means a collection of software functions and/or data -prepared so as to be conveniently linked with application programs -(which use some of those functions and data) to form executables. - - The "Library", below, refers to any such software library or work -which has been distributed under these terms. A "work based on the -Library" means either the Library or any derivative work under -copyright law: that is to say, a work containing the Library or a -portion of it, either verbatim or with modifications and/or translated -straightforwardly into another language. (Hereinafter, translation is -included without limitation in the term "modification".) - - "Source code" for a work means the preferred form of the work for -making modifications to it. For a library, complete source code means -all the source code for all modules it contains, plus any associated -interface definition files, plus the scripts used to control compilation -and installation of the library. - - Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running a program using the Library is not restricted, and output from -such a program is covered only if its contents constitute a work based -on the Library (independent of the use of the Library in a tool for -writing it). Whether that is true depends on what the Library does -and what the program that uses the Library does. - - 1. You may copy and distribute verbatim copies of the Library's -complete source code as you receive it, in any medium, provided that -you conspicuously and appropriately publish on each copy an -appropriate copyright notice and disclaimer of warranty; keep intact -all the notices that refer to this License and to the absence of any -warranty; and distribute a copy of this License along with the -Library. - - You may charge a fee for the physical act of transferring a copy, -and you may at your option offer warranty protection in exchange for a -fee. - - 2. You may modify your copy or copies of the Library or any portion -of it, thus forming a work based on the Library, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) The modified work must itself be a software library. - - b) You must cause the files modified to carry prominent notices - stating that you changed the files and the date of any change. - - c) You must cause the whole of the work to be licensed at no - charge to all third parties under the terms of this License. - - d) If a facility in the modified Library refers to a function or a - table of data to be supplied by an application program that uses - the facility, other than as an argument passed when the facility - is invoked, then you must make a good faith effort to ensure that, - in the event an application does not supply such function or - table, the facility still operates, and performs whatever part of - its purpose remains meaningful. - - (For example, a function in a library to compute square roots has - a purpose that is entirely well-defined independent of the - application. Therefore, Subsection 2d requires that any - application-supplied function or table used by this function must - be optional: if the application does not supply it, the square - root function must still compute square roots.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Library, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Library, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote -it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Library. - -In addition, mere aggregation of another work not based on the Library -with the Library (or with a work based on the Library) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may opt to apply the terms of the ordinary GNU General Public -License instead of this License to a given copy of the Library. To do -this, you must alter all the notices that refer to this License, so -that they refer to the ordinary GNU General Public License, version 2, -instead of to this License. (If a newer version than version 2 of the -ordinary GNU General Public License has appeared, then you can specify -that version instead if you wish.) Do not make any other change in -these notices. - - Once this change is made in a given copy, it is irreversible for -that copy, so the ordinary GNU General Public License applies to all -subsequent copies and derivative works made from that copy. - - This option is useful when you wish to copy part of the code of -the Library into a program that is not a library. - - 4. You may copy and distribute the Library (or a portion or -derivative of it, under Section 2) in object code or executable form -under the terms of Sections 1 and 2 above provided that you accompany -it with the complete corresponding machine-readable source code, which -must be distributed under the terms of Sections 1 and 2 above on a -medium customarily used for software interchange. - - If distribution of object code is made by offering access to copy -from a designated place, then offering equivalent access to copy the -source code from the same place satisfies the requirement to -distribute the source code, even though third parties are not -compelled to copy the source along with the object code. - - 5. A program that contains no derivative of any portion of the -Library, but is designed to work with the Library by being compiled or -linked with it, is called a "work that uses the Library". Such a -work, in isolation, is not a derivative work of the Library, and -therefore falls outside the scope of this License. - - However, linking a "work that uses the Library" with the Library -creates an executable that is a derivative of the Library (because it -contains portions of the Library), rather than a "work that uses the -library". The executable is therefore covered by this License. -Section 6 states terms for distribution of such executables. - - When a "work that uses the Library" uses material from a header file -that is part of the Library, the object code for the work may be a -derivative work of the Library even though the source code is not. -Whether this is true is especially significant if the work can be -linked without the Library, or if the work is itself a library. The -threshold for this to be true is not precisely defined by law. - - If such an object file uses only numerical parameters, data -structure layouts and accessors, and small macros and small inline -functions (ten lines or less in length), then the use of the object -file is unrestricted, regardless of whether it is legally a derivative -work. (Executables containing this object code plus portions of the -Library will still fall under Section 6.) - - Otherwise, if the work is a derivative of the Library, you may -distribute the object code for the work under the terms of Section 6. -Any executables containing that work also fall under Section 6, -whether or not they are linked directly with the Library itself. - - 6. As an exception to the Sections above, you may also combine or -link a "work that uses the Library" with the Library to produce a -work containing portions of the Library, and distribute that work -under terms of your choice, provided that the terms permit -modification of the work for the customer's own use and reverse -engineering for debugging such modifications. - - You must give prominent notice with each copy of the work that the -Library is used in it and that the Library and its use are covered by -this License. You must supply a copy of this License. If the work -during execution displays copyright notices, you must include the -copyright notice for the Library among them, as well as a reference -directing the user to the copy of this License. Also, you must do one -of these things: - - a) Accompany the work with the complete corresponding - machine-readable source code for the Library including whatever - changes were used in the work (which must be distributed under - Sections 1 and 2 above); and, if the work is an executable linked - with the Library, with the complete machine-readable "work that - uses the Library", as object code and/or source code, so that the - user can modify the Library and then relink to produce a modified - executable containing the modified Library. (It is understood - that the user who changes the contents of definitions files in the - Library will not necessarily be able to recompile the application - to use the modified definitions.) - - b) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (1) uses at run time a - copy of the library already present on the user's computer system, - rather than copying library functions into the executable, and (2) - will operate properly with a modified version of the library, if - the user installs one, as long as the modified version is - interface-compatible with the version that the work was made with. - - c) Accompany the work with a written offer, valid for at - least three years, to give the same user the materials - specified in Subsection 6a, above, for a charge no more - than the cost of performing this distribution. - - d) If distribution of the work is made by offering access to copy - from a designated place, offer equivalent access to copy the above - specified materials from the same place. - - e) Verify that the user has already received a copy of these - materials or that you have already sent this user a copy. - - For an executable, the required form of the "work that uses the -Library" must include any data and utility programs needed for -reproducing the executable from it. However, as a special exception, -the materials to be distributed need not include anything that is -normally distributed (in either source or binary form) with the major -components (compiler, kernel, and so on) of the operating system on -which the executable runs, unless that component itself accompanies -the executable. - - It may happen that this requirement contradicts the license -restrictions of other proprietary libraries that do not normally -accompany the operating system. Such a contradiction means you cannot -use both them and the Library together in an executable that you -distribute. - - 7. You may place library facilities that are a work based on the -Library side-by-side in a single library together with other library -facilities not covered by this License, and distribute such a combined -library, provided that the separate distribution of the work based on -the Library and of the other library facilities is otherwise -permitted, and provided that you do these two things: - - a) Accompany the combined library with a copy of the same work - based on the Library, uncombined with any other library - facilities. This must be distributed under the terms of the - Sections above. - - b) Give prominent notice with the combined library of the fact - that part of it is a work based on the Library, and explaining - where to find the accompanying uncombined form of the same work. - - 8. You may not copy, modify, sublicense, link with, or distribute -the Library except as expressly provided under this License. Any -attempt otherwise to copy, modify, sublicense, link with, or -distribute the Library is void, and will automatically terminate your -rights under this License. However, parties who have received copies, -or rights, from you under this License will not have their licenses -terminated so long as such parties remain in full compliance. - - 9. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Library or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Library (or any work based on the -Library), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Library or works based on it. - - 10. Each time you redistribute the Library (or any work based on the -Library), the recipient automatically receives a license from the -original licensor to copy, distribute, link with or modify the Library -subject to these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties with -this License. - - 11. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Library at all. For example, if a patent -license would not permit royalty-free redistribution of the Library by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Library. - -If any portion of this section is held invalid or unenforceable under any -particular circumstance, the balance of the section is intended to apply, -and the section as a whole is intended to apply in other circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 12. If the distribution and/or use of the Library is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Library under this License may add -an explicit geographical distribution limitation excluding those countries, -so that distribution is permitted only in or among countries not thus -excluded. In such case, this License incorporates the limitation as if -written in the body of this License. - - 13. The Free Software Foundation may publish revised and/or new -versions of the Lesser General Public License from time to time. -Such new versions will be similar in spirit to the present version, -but may differ in detail to address new problems or concerns. - -Each version is given a distinguishing version number. If the Library -specifies a version number of this License which applies to it and -"any later version", you have the option of following the terms and -conditions either of that version or of any later version published by -the Free Software Foundation. If the Library does not specify a -license version number, you may choose any version ever published by -the Free Software Foundation. - - 14. If you wish to incorporate parts of the Library into other free -programs whose distribution conditions are incompatible with these, -write to the author to ask for permission. For software which is -copyrighted by the Free Software Foundation, write to the Free -Software Foundation; we sometimes make exceptions for this. Our -decision will be guided by the two goals of preserving the free status -of all derivatives of our free software and of promoting the sharing -and reuse of software generally. - - NO WARRANTY - - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH -DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Libraries - - If you develop a new library, and you want it to be of the greatest -possible use to the public, we recommend making it free software that -everyone can redistribute and change. You can do so by permitting -redistribution under these terms (or, alternatively, under the terms of the -ordinary General Public License). - - To apply these terms, attach the following notices to the library. It is -safest to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least the -"copyright" line and a pointer to where the full notice is found. - - <one line to give the library's name and a brief idea of what it does.> - Copyright (C) <year> <name of author> - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - This library 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 - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - -Also add information on how to contact you by electronic and paper mail. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the library, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the - library `Frob' (a library for tweaking knobs) written by James Random Hacker. - - <signature of Ty Coon>, 1 April 1990 - Ty Coon, President of Vice - -That's all there is to it! Deleted: trunk/crossfire/src/cfeditor/script/BshThread.java =================================================================== --- trunk/crossfire/src/cfeditor/script/BshThread.java 2008-10-01 16:31:03 UTC (rev 5316) +++ trunk/crossfire/src/cfeditor/script/BshThread.java 2008-10-01 16:48:45 UTC (rev 5317) @@ -1,92 +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 cfeditor.script; - -import bsh.EvalError; -import bsh.Interpreter; -import net.sf.gridarta.script.ScriptModel; - -/** - * A BshThread. - * @author tchize - * @todo Document this class. - */ -public final class BshThread extends Thread { - - /** The ScriptModel of this BshThread. */ - private ScriptModel script; - - /** The Interpreter of this BshThread. */ - private Interpreter interpreter; - - /** Create a BshThread. */ - public BshThread() { - } - - /** - * Create a BshThread with name. - * @param name Name to assign to the BshThread. - */ - public BshThread(final String name) { - super(name); - } - - /** - * Create a BshThread with a name in a certain thread group. - * @param group ThreadGroup to put BshThread in. - * @param name Name to assign to the BshThread. - */ - public BshThread(final ThreadGroup group, final String name) { - super(group, name); - } - - /** - * Sets the interpreter for this BshThread. - * @param interpreter Interpreter for this BshThread. - */ - public void setInterpreter(final Interpreter interpreter) { - this.interpreter = interpreter; - } - - /** - * Sets the ScriptModel for this BshThread. - * @param script ScriptModel for this BshThread. - */ - public void setScript(final ScriptModel script) { - this.script = script; - } - - /** {@inheritDoc} */ - @Override - public void run() { - try { - interpreter.set("scriptThread", this); - interpreter.eval(script.getCode()); - } catch (final EvalError e) { - //do something? - interpreter.getErr().print(e.getMessage()); - if (e.getCause() != null) { - interpreter.getErr().print(e.getCause().getMessage()); - } - e.printStackTrace(); - } - } - -} // class BshThread Modified: trunk/crossfire/src/cfeditor/script/ScriptController.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 16:31:03 UTC (rev 5316) +++ trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 16:48:45 UTC (rev 5317) @@ -49,10 +49,11 @@ import javax.swing.event.EventListenerList; import net.sf.gridarta.filter.Filter; import net.sf.gridarta.filter.FilterControl; +import net.sf.gridarta.script.BshThread; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptModelParser; +import net.sf.gridarta.script.parameter.NoSuchParameterException; import net.sf.gridarta.script.parameter.PluginParameter; -import net.sf.gridarta.script.parameter.NoSuchParameterException; import net.sf.japi.swing.ActionFactory; import org.apache.log4j.Logger; import org.jdom.Document; Modified: trunk/daimonin/build.xml =================================================================== --- trunk/daimonin/build.xml 2008-10-01 16:31:03 UTC (rev 5316) +++ trunk/daimonin/build.xml 2008-10-01 16:48:45 UTC (rev 5317) @@ -148,6 +148,7 @@ <include name="*-LICENSE" /> </fileset> <fileset dir="../lib"> + <include name="bsh-LICENSE" /> <include name="japi.jar-LICENSE" /> <include name="log4j-1.2.13.jar-LICENSE" /> <include name="jdom.jar-LICENSE" /> Modified: trunk/daimonin/src/daieditor/messages.properties =================================================================== --- trunk/daimonin/src/daieditor/messages.properties 2008-10-01 16:31:03 UTC (rev 5316) +++ trunk/daimonin/src/daieditor/messages.properties 2008-10-01 16:48:45 UTC (rev 5317) @@ -220,6 +220,8 @@ license.3.file=jlfgr-1_0.jar-LICENSE license.4.title=Log4J license.4.file=log4j-1.2.13.jar-LICENSE +license.5.title=BeanShell +license.5.file=bsh-LICENSE aboutRuntimeProperties.title=Runtime properties aboutBuildProperties.title=Build properties Copied: trunk/lib/bsh-LICENSE (from rev 5300, trunk/crossfire/lib/bsh-LICENSE) =================================================================== --- trunk/lib/bsh-LICENSE (rev 0) +++ trunk/lib/bsh-LICENSE 2008-10-01 16:48:45 UTC (rev 5317) @@ -0,0 +1,502 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright... [truncated message content] |
From: <aki...@us...> - 2008-10-01 16:59:51
|
Revision: 5319 http://gridarta.svn.sourceforge.net/gridarta/?rev=5319&view=rev Author: akirschbaum Date: 2008-10-01 16:59:23 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Move ScriptParameters to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/script/ScriptController.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/script/ScriptParameters.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/script/ScriptParameters.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-10-01 16:55:44 UTC (rev 5318) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-10-01 16:59:23 UTC (rev 5319) @@ -37,7 +37,6 @@ import cfeditor.map.MapArchObject; import cfeditor.script.ScriptController; import cfeditor.script.ScriptExecException; -import cfeditor.script.ScriptParameters; import java.io.File; import java.util.Collections; import java.util.List; @@ -87,6 +86,7 @@ import net.sf.gridarta.map.validation.checks.MapDifficultyChecker; import net.sf.gridarta.map.validation.checks.UndefinedArchetypeChecker; import net.sf.gridarta.map.validation.checks.UnsetSlayingChecker; +import net.sf.gridarta.script.ScriptParameters; import net.sf.gridarta.script.parameter.PluginParameterFactory; import net.sf.gridarta.treasurelist.CFTreasureListTree; import net.sf.gridarta.treasurelist.TreasureLocation; Modified: trunk/crossfire/src/cfeditor/script/ScriptController.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 16:55:44 UTC (rev 5318) +++ trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 16:59:23 UTC (rev 5319) @@ -52,6 +52,7 @@ import net.sf.gridarta.script.BshThread; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptModelParser; +import net.sf.gridarta.script.ScriptParameters; import net.sf.gridarta.script.ScriptRunMode; import net.sf.gridarta.script.parameter.NoSuchParameterException; import net.sf.gridarta.script.parameter.PluginParameter; Deleted: trunk/crossfire/src/cfeditor/script/ScriptParameters.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptParameters.java 2008-10-01 16:55:44 UTC (rev 5318) +++ trunk/crossfire/src/cfeditor/script/ScriptParameters.java 2008-10-01 16:59:23 UTC (rev 5319) @@ -1,89 +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 cfeditor.script; - -import bsh.EvalError; -import bsh.Interpreter; -import net.sf.gridarta.GlobalSettings; -import net.sf.gridarta.MapManager; -import net.sf.gridarta.gameobject.ArchetypeSet; -import net.sf.gridarta.map.validation.DelegatingMapValidator; -import net.sf.gridarta.script.ScriptRunMode; -import org.jetbrains.annotations.NotNull; - -/** - * Makes basic Gridarta classes available to scripts. - * @author Andreas Kirschbaum - */ -public class ScriptParameters { - - /** - * The archetype set. - */ - @NotNull - private final ArchetypeSet<?, ?, ?> archetypeSet; - - /** - * The global settings instance. - */ - @NotNull - private final GlobalSettings globalSettings; - - /** - * The map manager. - */ - @NotNull - private final MapManager<?, ?, ?, ?> mapManager; - - /** - * The map validators. - */ - @NotNull - private final DelegatingMapValidator<?, ?, ?> validators; - - /** - * Creates a new instance. - * @param archetypeSet the archetype set - * @param globalSettings the global settings instance - * @param mapManager the map manager - * @param validators the map validators - */ - public ScriptParameters(@NotNull final ArchetypeSet<?, ?, ?> archetypeSet, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<?, ?, ?, ?> mapManager, @NotNull final DelegatingMapValidator<?, ?, ?> validators) { - this.archetypeSet = archetypeSet; - this.globalSettings = globalSettings; - this.mapManager = mapManager; - this.validators = validators; - } - - /** - * Adds variables to a {@link Interpreter} instance. - * @param interpreter the interpreter to modify - * @param scriptRunMode the script run mode to use - * @throws EvalError if a variable cannot be set - */ - public void setInterpreterValues(@NotNull final Interpreter interpreter, @NotNull final ScriptRunMode scriptRunMode) throws EvalError { - interpreter.set("archetypeSet", archetypeSet); - interpreter.set("globalSettings", globalSettings); - interpreter.set("mapManager", mapManager); - interpreter.set("scriptRunMode", scriptRunMode); - interpreter.set("validators", validators); - } - -} // class ScriptParameters Copied: trunk/src/app/net/sf/gridarta/script/ScriptParameters.java (from rev 5318, trunk/crossfire/src/cfeditor/script/ScriptParameters.java) =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptParameters.java (rev 0) +++ trunk/src/app/net/sf/gridarta/script/ScriptParameters.java 2008-10-01 16:59:23 UTC (rev 5319) @@ -0,0 +1,89 @@ +/* + * 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.script; + +import bsh.EvalError; +import bsh.Interpreter; +import net.sf.gridarta.GlobalSettings; +import net.sf.gridarta.MapManager; +import net.sf.gridarta.gameobject.ArchetypeSet; +import net.sf.gridarta.map.validation.DelegatingMapValidator; +import net.sf.gridarta.script.ScriptRunMode; +import org.jetbrains.annotations.NotNull; + +/** + * Makes basic Gridarta classes available to scripts. + * @author Andreas Kirschbaum + */ +public class ScriptParameters { + + /** + * The archetype set. + */ + @NotNull + private final ArchetypeSet<?, ?, ?> archetypeSet; + + /** + * The global settings instance. + */ + @NotNull + private final GlobalSettings globalSettings; + + /** + * The map manager. + */ + @NotNull + private final MapManager<?, ?, ?, ?> mapManager; + + /** + * The map validators. + */ + @NotNull + private final DelegatingMapValidator<?, ?, ?> validators; + + /** + * Creates a new instance. + * @param archetypeSet the archetype set + * @param globalSettings the global settings instance + * @param mapManager the map manager + * @param validators the map validators + */ + public ScriptParameters(@NotNull final ArchetypeSet<?, ?, ?> archetypeSet, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<?, ?, ?, ?> mapManager, @NotNull final DelegatingMapValidator<?, ?, ?> validators) { + this.archetypeSet = archetypeSet; + this.globalSettings = globalSettings; + this.mapManager = mapManager; + this.validators = validators; + } + + /** + * Adds variables to a {@link Interpreter} instance. + * @param interpreter the interpreter to modify + * @param scriptRunMode the script run mode to use + * @throws EvalError if a variable cannot be set + */ + public void setInterpreterValues(@NotNull final Interpreter interpreter, @NotNull final ScriptRunMode scriptRunMode) throws EvalError { + interpreter.set("archetypeSet", archetypeSet); + interpreter.set("globalSettings", globalSettings); + interpreter.set("mapManager", mapManager); + interpreter.set("scriptRunMode", scriptRunMode); + interpreter.set("validators", validators); + } + +} // class ScriptParameters Property changes on: trunk/src/app/net/sf/gridarta/script/ScriptParameters.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 17:03:28
|
Revision: 5320 http://gridarta.svn.sourceforge.net/gridarta/?rev=5320&view=rev Author: akirschbaum Date: 2008-10-01 17:03:02 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Move ScriptExecException to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CFJavaEditor.java trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/script/ScriptController.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/script/ScriptExecException.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/script/ScriptExecException.java Modified: trunk/crossfire/src/cfeditor/CFJavaEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-10-01 16:59:23 UTC (rev 5319) +++ trunk/crossfire/src/cfeditor/CFJavaEditor.java 2008-10-01 17:03:02 UTC (rev 5320) @@ -19,7 +19,6 @@ package cfeditor; -import cfeditor.script.ScriptExecException; import java.awt.Component; import java.io.IOException; import java.util.ArrayList; @@ -30,6 +29,7 @@ import net.sf.gridarta.gui.SplashScreen; import net.sf.gridarta.io.ConfigFileUtils; import net.sf.gridarta.preferences.FilePreferencesFactory; +import net.sf.gridarta.script.ScriptExecException; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.tod.TipOfTheDayManager; import org.apache.log4j.Logger; Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-10-01 16:59:23 UTC (rev 5319) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-10-01 17:03:02 UTC (rev 5320) @@ -36,7 +36,6 @@ import cfeditor.map.DefaultMapControlFactory; import cfeditor.map.MapArchObject; import cfeditor.script.ScriptController; -import cfeditor.script.ScriptExecException; import java.io.File; import java.util.Collections; import java.util.List; @@ -86,6 +85,7 @@ import net.sf.gridarta.map.validation.checks.MapDifficultyChecker; import net.sf.gridarta.map.validation.checks.UndefinedArchetypeChecker; import net.sf.gridarta.map.validation.checks.UnsetSlayingChecker; +import net.sf.gridarta.script.ScriptExecException; import net.sf.gridarta.script.ScriptParameters; import net.sf.gridarta.script.parameter.PluginParameterFactory; import net.sf.gridarta.treasurelist.CFTreasureListTree; Modified: trunk/crossfire/src/cfeditor/script/ScriptController.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 16:59:23 UTC (rev 5319) +++ trunk/crossfire/src/cfeditor/script/ScriptController.java 2008-10-01 17:03:02 UTC (rev 5320) @@ -50,6 +50,7 @@ import net.sf.gridarta.filter.Filter; import net.sf.gridarta.filter.FilterControl; import net.sf.gridarta.script.BshThread; +import net.sf.gridarta.script.ScriptExecException; import net.sf.gridarta.script.ScriptModel; import net.sf.gridarta.script.ScriptModelParser; import net.sf.gridarta.script.ScriptParameters; Deleted: trunk/crossfire/src/cfeditor/script/ScriptExecException.java =================================================================== --- trunk/crossfire/src/cfeditor/script/ScriptExecException.java 2008-10-01 16:59:23 UTC (rev 5319) +++ trunk/crossfire/src/cfeditor/script/ScriptExecException.java 2008-10-01 17:03:02 UTC (rev 5320) @@ -1,43 +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 cfeditor.script; - -import org.jetbrains.annotations.NotNull; - -/** - * Thrown to indicate a problem while executing a script. - * @author Andreas Kirschbaum - */ -public class ScriptExecException extends Exception{ - - /** - * The serial version UID. - */ - private static final long serialVersionUID = 1; - - /** - * Creates a new instance. - * @param reason the failure reason - */ - public ScriptExecException(@NotNull final String reason) { - super(reason); - } - -} // class ScriptExecException Copied: trunk/src/app/net/sf/gridarta/script/ScriptExecException.java (from rev 5318, trunk/crossfire/src/cfeditor/script/ScriptExecException.java) =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptExecException.java (rev 0) +++ trunk/src/app/net/sf/gridarta/script/ScriptExecException.java 2008-10-01 17:03:02 UTC (rev 5320) @@ -0,0 +1,43 @@ +/* + * 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.script; + +import org.jetbrains.annotations.NotNull; + +/** + * Thrown to indicate a problem while executing a script. + * @author Andreas Kirschbaum + */ +public class ScriptExecException extends Exception{ + + /** + * The serial version UID. + */ + private static final long serialVersionUID = 1; + + /** + * Creates a new instance. + * @param reason the failure reason + */ + public ScriptExecException(@NotNull final String reason) { + super(reason); + } + +} // class ScriptExecException Property changes on: trunk/src/app/net/sf/gridarta/script/ScriptExecException.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 18:01:56
|
Revision: 5324 http://gridarta.svn.sourceforge.net/gridarta/?rev=5324&view=rev Author: akirschbaum Date: 2008-10-01 18:01:20 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Move FilterParameterView to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/gui/script/parameter/FilterParameterView.java Deleted: trunk/crossfire/src/cfeditor/gui/script/parameter/FilterParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/FilterParameterView.java 2008-10-01 17:31:30 UTC (rev 5323) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/FilterParameterView.java 2008-10-01 18:01:20 UTC (rev 5324) @@ -1,60 +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 cfeditor.gui.script.parameter; - -import javax.swing.JComponent; -import javax.swing.JMenuItem; -import javax.swing.JPanel; -import net.sf.gridarta.filter.FilterConfig; -import net.sf.gridarta.filter.NamedFilterList; -import net.sf.gridarta.gui.script.parameter.PluginParameterView; -import net.sf.gridarta.script.parameter.FilterParameter; -import org.jetbrains.annotations.NotNull; - -public class FilterParameterView implements PluginParameterView<FilterConfig, Void, FilterParameter> { - - private final NamedFilterList defaultFilterList; - - public FilterParameterView(final NamedFilterList defaultFilterList) { - this.defaultFilterList = defaultFilterList; - } - - /* (non-Javadoc) - * @see cfeditor.PluginParameterView#getValueComponent(java.lang.Object, cfeditor.PluginParameter) - */ - public JComponent getValueComponent(final FilterConfig value, final FilterParameter parameter) { - final JMenuItem mu = defaultFilterList.createMenuEntry(parameter.getValue()); - mu.setName("Choose filters"); - return mu; // XXX: was mu.getToolbarComponent() with cfeditor.menu.BasicMenuEntry mu - } - - /* (non-Javadoc) - * @see cfeditor.PluginParameterView#getConfigComponent(java.lang.Object, cfeditor.PluginParameter) - */ - public JComponent getConfigComponent(final Void config, final FilterParameter parameter) { - return new JPanel(); - } - - /** {@inheritDoc} */ - public boolean setValue(@NotNull final String value) { - return false; // XXX: ??? - } - -} // class FilterParameterView Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java 2008-10-01 17:31:30 UTC (rev 5323) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java 2008-10-01 18:01:20 UTC (rev 5324) @@ -30,6 +30,7 @@ import net.sf.gridarta.gui.objectchooser.ObjectChooser; import net.sf.gridarta.gui.script.parameter.BooleanParameterView; import net.sf.gridarta.gui.script.parameter.DoubleParameterView; +import net.sf.gridarta.gui.script.parameter.FilterParameterView; import net.sf.gridarta.gui.script.parameter.PluginParameterView; import net.sf.gridarta.script.parameter.ArchParameter; import net.sf.gridarta.script.parameter.BooleanParameter; Copied: trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java (from rev 5321, trunk/crossfire/src/cfeditor/gui/script/parameter/FilterParameterView.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java 2008-10-01 18:01:20 UTC (rev 5324) @@ -0,0 +1,60 @@ +/* + * 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.script.parameter; + +import javax.swing.JComponent; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import net.sf.gridarta.filter.FilterConfig; +import net.sf.gridarta.filter.NamedFilterList; +import net.sf.gridarta.gui.script.parameter.PluginParameterView; +import net.sf.gridarta.script.parameter.FilterParameter; +import org.jetbrains.annotations.NotNull; + +public class FilterParameterView implements PluginParameterView<FilterConfig, Void, FilterParameter> { + + private final NamedFilterList defaultFilterList; + + public FilterParameterView(final NamedFilterList defaultFilterList) { + this.defaultFilterList = defaultFilterList; + } + + /* (non-Javadoc) + * @see cfeditor.PluginParameterView#getValueComponent(java.lang.Object, cfeditor.PluginParameter) + */ + public JComponent getValueComponent(final FilterConfig value, final FilterParameter parameter) { + final JMenuItem mu = defaultFilterList.createMenuEntry(parameter.getValue()); + mu.setName("Choose filters"); + return mu; // XXX: was mu.getToolbarComponent() with cfeditor.menu.BasicMenuEntry mu + } + + /* (non-Javadoc) + * @see cfeditor.PluginParameterView#getConfigComponent(java.lang.Object, cfeditor.PluginParameter) + */ + public JComponent getConfigComponent(final Void config, final FilterParameter parameter) { + return new JPanel(); + } + + /** {@inheritDoc} */ + public boolean setValue(@NotNull final String value) { + return false; // XXX: ??? + } + +} // class FilterParameterView Property changes on: trunk/src/app/net/sf/gridarta/gui/script/parameter/FilterParameterView.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 18:09:53
|
Revision: 5326 http://gridarta.svn.sourceforge.net/gridarta/?rev=5326&view=rev Author: akirschbaum Date: 2008-10-01 18:09:26 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Move StringParameterView to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/gui/script/parameter/StringParameterView.java Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java 2008-10-01 18:04:31 UTC (rev 5325) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java 2008-10-01 18:09:26 UTC (rev 5326) @@ -33,6 +33,7 @@ import net.sf.gridarta.gui.script.parameter.FilterParameterView; import net.sf.gridarta.gui.script.parameter.IntegerParameterView; import net.sf.gridarta.gui.script.parameter.PluginParameterView; +import net.sf.gridarta.gui.script.parameter.StringParameterView; import net.sf.gridarta.script.parameter.ArchParameter; import net.sf.gridarta.script.parameter.BooleanParameter; import net.sf.gridarta.script.parameter.DoubleParameter; Deleted: trunk/crossfire/src/cfeditor/gui/script/parameter/StringParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/StringParameterView.java 2008-10-01 18:04:31 UTC (rev 5325) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/StringParameterView.java 2008-10-01 18:09:26 UTC (rev 5326) @@ -1,92 +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 cfeditor.gui.script.parameter; - -import javax.swing.JComponent; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import javax.swing.text.Document; -import net.sf.gridarta.gui.script.parameter.PluginParameterView; -import net.sf.gridarta.script.parameter.StringParameter; -import org.apache.log4j.Logger; -import org.jetbrains.annotations.NotNull; - -public class StringParameterView implements PluginParameterView<String, Void, StringParameter> { - - /** The Logger for printing log messages. */ - private static final Logger log = Logger.getLogger(StringParameterView.class); - - private final JTextField value = new JTextField(); - - private final JPanel config = new JPanel(); - - private final StringParameter linkedParameter; - - public StringParameterView(final StringParameter parameter) { - linkedParameter = parameter; - final Document d = value.getDocument(); - d.addDocumentListener(new DocumentListener() { - private void doit() { - if (log.isDebugEnabled()) { - log.debug("value for " + linkedParameter + " changed to " + value.getText()); - } - - linkedParameter.setValue(value.getText()); - } - - public void changedUpdate(final DocumentEvent e) { - doit(); - } - - public void insertUpdate(final DocumentEvent e) { - doit(); - } - - public void removeUpdate(final DocumentEvent e) { - doit(); - } - }); - } - - public JComponent getConfigComponent(final Void config, final StringParameter parameter) { - return this.config; - } - - public JComponent getValueComponent(final String value, final StringParameter parameter) { - if (log.isDebugEnabled()) { - log.debug("getValueComponent(" + value + ", " + parameter + ")"); - } - if (value == null) { - this.value.setText(null); - } else { - this.value.setText(value); - } - return this.value; - } - - /** {@inheritDoc} */ - public boolean setValue(@NotNull final String value) { - linkedParameter.setValue(value); - return true; - } - -} // class StringParameterView Copied: trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java (from rev 5321, trunk/crossfire/src/cfeditor/gui/script/parameter/StringParameterView.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java 2008-10-01 18:09:26 UTC (rev 5326) @@ -0,0 +1,92 @@ +/* + * 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.script.parameter; + +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import javax.swing.text.Document; +import net.sf.gridarta.gui.script.parameter.PluginParameterView; +import net.sf.gridarta.script.parameter.StringParameter; +import org.apache.log4j.Logger; +import org.jetbrains.annotations.NotNull; + +public class StringParameterView implements PluginParameterView<String, Void, StringParameter> { + + /** The Logger for printing log messages. */ + private static final Logger log = Logger.getLogger(StringParameterView.class); + + private final JTextField value = new JTextField(); + + private final JPanel config = new JPanel(); + + private final StringParameter linkedParameter; + + public StringParameterView(final StringParameter parameter) { + linkedParameter = parameter; + final Document d = value.getDocument(); + d.addDocumentListener(new DocumentListener() { + private void doit() { + if (log.isDebugEnabled()) { + log.debug("value for " + linkedParameter + " changed to " + value.getText()); + } + + linkedParameter.setValue(value.getText()); + } + + public void changedUpdate(final DocumentEvent e) { + doit(); + } + + public void insertUpdate(final DocumentEvent e) { + doit(); + } + + public void removeUpdate(final DocumentEvent e) { + doit(); + } + }); + } + + public JComponent getConfigComponent(final Void config, final StringParameter parameter) { + return this.config; + } + + public JComponent getValueComponent(final String value, final StringParameter parameter) { + if (log.isDebugEnabled()) { + log.debug("getValueComponent(" + value + ", " + parameter + ")"); + } + if (value == null) { + this.value.setText(null); + } else { + this.value.setText(value); + } + return this.value; + } + + /** {@inheritDoc} */ + public boolean setValue(@NotNull final String value) { + linkedParameter.setValue(value); + return true; + } + +} // class StringParameterView Property changes on: trunk/src/app/net/sf/gridarta/gui/script/parameter/StringParameterView.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 18:13:17
|
Revision: 5327 http://gridarta.svn.sourceforge.net/gridarta/?rev=5327&view=rev Author: akirschbaum Date: 2008-10-01 18:12:55 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Move ParameterNameEditor to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterNameEditor.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-10-01 18:09:26 UTC (rev 5326) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptEditor.java 2008-10-01 18:12:55 UTC (rev 5327) @@ -21,7 +21,6 @@ import cfeditor.IGUIConstants; import cfeditor.gui.script.parameter.ParameterDescriptionEditor; -import cfeditor.gui.script.parameter.ParameterNameEditor; import cfeditor.gui.script.parameter.ParameterTypeEditor; import cfeditor.gui.script.parameter.PluginParameterViewFactory; import cfeditor.script.ScriptController; @@ -53,6 +52,7 @@ import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import net.sf.gridarta.gui.script.parameter.ParameterNameEditor; import net.sf.gridarta.gui.script.parameter.PluginParameterView; import net.sf.gridarta.gui.utils.GUIUtils; import net.sf.gridarta.script.ScriptModel; Deleted: trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java 2008-10-01 18:09:26 UTC (rev 5326) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java 2008-10-01 18:12:55 UTC (rev 5327) @@ -1,62 +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 cfeditor.gui.script.parameter; - -import javax.swing.JTextField; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import net.sf.gridarta.script.parameter.PluginParameter; - -public class ParameterNameEditor extends JTextField { - - private static final long serialVersionUID = 1L; - - private final PluginParameter<?, ?> parameter; - - private final DocumentListener documentListener = new DocumentListener() { - - /** {@inheritDoc} */ - public void insertUpdate(final DocumentEvent e) { - change(); - } - - /** {@inheritDoc} */ - public void removeUpdate(final DocumentEvent e) { - change(); - } - - /** {@inheritDoc} */ - public void changedUpdate(final DocumentEvent e) { - change(); - } - - }; - - public ParameterNameEditor(final PluginParameter<?, ?> parameter) { - this.parameter = parameter; - setText(parameter.getName()); - getDocument().addDocumentListener(documentListener); - } - - private void change() { - parameter.setName(getText()); - } - -} // class ParameterNameEditor Copied: trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterNameEditor.java (from rev 5318, trunk/crossfire/src/cfeditor/gui/script/parameter/ParameterNameEditor.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterNameEditor.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterNameEditor.java 2008-10-01 18:12:55 UTC (rev 5327) @@ -0,0 +1,62 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.script.parameter; + +import javax.swing.JTextField; +import javax.swing.event.DocumentEvent; +import javax.swing.event.DocumentListener; +import net.sf.gridarta.script.parameter.PluginParameter; + +public class ParameterNameEditor extends JTextField { + + private static final long serialVersionUID = 1L; + + private final PluginParameter<?, ?> parameter; + + private final DocumentListener documentListener = new DocumentListener() { + + /** {@inheritDoc} */ + public void insertUpdate(final DocumentEvent e) { + change(); + } + + /** {@inheritDoc} */ + public void removeUpdate(final DocumentEvent e) { + change(); + } + + /** {@inheritDoc} */ + public void changedUpdate(final DocumentEvent e) { + change(); + } + + }; + + public ParameterNameEditor(final PluginParameter<?, ?> parameter) { + this.parameter = parameter; + setText(parameter.getName()); + getDocument().addDocumentListener(documentListener); + } + + private void change() { + parameter.setName(getText()); + } + +} // class ParameterNameEditor Property changes on: trunk/src/app/net/sf/gridarta/gui/script/parameter/ParameterNameEditor.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 19:45:31
|
Revision: 5337 http://gridarta.svn.sourceforge.net/gridarta/?rev=5337&view=rev Author: akirschbaum Date: 2008-10-01 19:45:22 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Move ArchParameterView to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java Deleted: trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java 2008-10-01 19:36:46 UTC (rev 5336) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java 2008-10-01 19:45:22 UTC (rev 5337) @@ -1,83 +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 cfeditor.gui.script.parameter; - -import cfeditor.gameobject.Archetype; -import cfeditor.gameobject.GameObject; -import cfeditor.map.MapArchObject; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import javax.swing.JComponent; -import javax.swing.JPanel; -import net.sf.gridarta.gameobject.ArchetypeSet; -import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; -import net.sf.gridarta.gui.objectchooser.ObjectChooser; -import net.sf.gridarta.gui.script.parameter.ArchComboBox; -import net.sf.gridarta.gui.script.parameter.PluginParameterView; -import net.sf.gridarta.script.parameter.ArchParameter; -import org.jetbrains.annotations.NotNull; - -public class ArchParameterView implements PluginParameterView<Archetype, Void, ArchParameter<GameObject, MapArchObject, Archetype>> { - - /** - * The archetype set. - */ - @NotNull - private final ArchetypeSet<?, ?, Archetype> archetypeSet; - - private final JPanel config = new JPanel(); - - private final ArchComboBox<GameObject, MapArchObject, Archetype> value; - - private final ArchParameter<GameObject, MapArchObject, Archetype> parameter; - - public ArchParameterView(final ArchParameter<GameObject, MapArchObject, Archetype> param, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser) { - this.archetypeSet = archetypeSet; - value = new ArchComboBox(gameObjectAttributesModel, archetypeSet, objectChooser); - parameter = param; - value.setSelectedItem(param.getValue()); - value.addItemListener(new ItemListener() { - public void itemStateChanged(final ItemEvent e) { - if (e.getStateChange() == ItemEvent.SELECTED) { - parameter.setValue((Archetype) value.getSelectedItem()); - } - } - }); - } - - public JComponent getConfigComponent(final Void config, final ArchParameter<GameObject, MapArchObject, Archetype> parameter) { - return this.config; - } - - public JComponent getValueComponent(final Archetype value, final ArchParameter<GameObject, MapArchObject, Archetype> parameter) { - return this.value; - } - - /** {@inheritDoc} */ - public boolean setValue(@NotNull final String value) { - final Archetype archetype = archetypeSet.getArchetype(value); - if (archetype == null) { - return false; - } - parameter.setValue(archetype); - return true; - } - -} // class ArchParameterView Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java 2008-10-01 19:36:46 UTC (rev 5336) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java 2008-10-01 19:45:22 UTC (rev 5337) @@ -28,6 +28,7 @@ import net.sf.gridarta.gameobject.ArchetypeSet; import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; import net.sf.gridarta.gui.objectchooser.ObjectChooser; +import net.sf.gridarta.gui.script.parameter.ArchParameterView; import net.sf.gridarta.gui.script.parameter.BooleanParameterView; import net.sf.gridarta.gui.script.parameter.DoubleParameterView; import net.sf.gridarta.gui.script.parameter.FilterParameterView; @@ -75,7 +76,7 @@ /** {@inheritDoc} */ public void visit(final ArchParameter parameter) { - view = new ArchParameterView(parameter, gameObjectAttributesModel, archetypeSet, objectChooser); + view = new ArchParameterView<GameObject, MapArchObject, Archetype>(parameter, gameObjectAttributesModel, archetypeSet, objectChooser); } /** {@inheritDoc} */ Copied: trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java (from rev 5336, trunk/crossfire/src/cfeditor/gui/script/parameter/ArchParameterView.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java 2008-10-01 19:45:22 UTC (rev 5337) @@ -0,0 +1,81 @@ +/* + * 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.script.parameter; + +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import javax.swing.JComponent; +import javax.swing.JPanel; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.gameobjectattributespanel.GameObjectAttributesModel; +import net.sf.gridarta.gui.objectchooser.ObjectChooser; +import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.script.parameter.ArchParameter; +import org.jetbrains.annotations.NotNull; + +public class ArchParameterView<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements PluginParameterView<R, Void, ArchParameter<G, A, R>> { + + /** + * The archetype set. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + private final JPanel config = new JPanel(); + + private final ArchComboBox<G, A, R> value; + + private final ArchParameter<G, A, R> parameter; + + public ArchParameterView(final ArchParameter<G, A, R> param, @NotNull final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ObjectChooser<G, A, R> objectChooser) { + this.archetypeSet = archetypeSet; + value = new ArchComboBox(gameObjectAttributesModel, archetypeSet, objectChooser); + parameter = param; + value.setSelectedItem(param.getValue()); + value.addItemListener(new ItemListener() { + public void itemStateChanged(final ItemEvent e) { + if (e.getStateChange() == ItemEvent.SELECTED) { + parameter.setValue((R) value.getSelectedItem()); + } + } + }); + } + + public JComponent getConfigComponent(final Void config, final ArchParameter<G, A, R> parameter) { + return this.config; + } + + public JComponent getValueComponent(final R value, final ArchParameter<G, A, R> parameter) { + return this.value; + } + + /** {@inheritDoc} */ + public boolean setValue(@NotNull final String value) { + final R archetype = archetypeSet.getArchetype(value); + if (archetype == null) { + return false; + } + parameter.setValue(archetype); + return true; + } + +} // class ArchParameterView Property changes on: trunk/src/app/net/sf/gridarta/gui/script/parameter/ArchParameterView.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 19:50:56
|
Revision: 5338 http://gridarta.svn.sourceforge.net/gridarta/?rev=5338&view=rev Author: akirschbaum Date: 2008-10-01 19:50:48 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Add type parameters to PluginParameterVisitor. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterVisitor.java Modified: trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java 2008-10-01 19:45:22 UTC (rev 5337) +++ trunk/crossfire/src/cfeditor/gui/script/parameter/PluginParameterViewFactory.java 2008-10-01 19:50:48 UTC (rev 5338) @@ -72,10 +72,10 @@ @Nullable private PluginParameterView view = null; - private final PluginParameterVisitor visitor = new PluginParameterVisitor() { + private final PluginParameterVisitor<GameObject, MapArchObject, Archetype, CMapViewBasic> visitor = new PluginParameterVisitor<GameObject, MapArchObject, Archetype, CMapViewBasic>() { /** {@inheritDoc} */ - public void visit(final ArchParameter parameter) { + public void visit(final ArchParameter<GameObject, MapArchObject, Archetype> parameter) { view = new ArchParameterView<GameObject, MapArchObject, Archetype>(parameter, gameObjectAttributesModel, archetypeSet, objectChooser); } @@ -100,7 +100,7 @@ } /** {@inheritDoc} */ - public void visit(final MapParameter parameter) { + public void visit(final MapParameter<GameObject, MapArchObject, Archetype, CMapViewBasic> parameter) { view = new MapParameterView<GameObject, MapArchObject, Archetype, CMapViewBasic>(parameter, mapManager); } Modified: trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterVisitor.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterVisitor.java 2008-10-01 19:45:22 UTC (rev 5337) +++ trunk/src/app/net/sf/gridarta/script/parameter/PluginParameterVisitor.java 2008-10-01 19:50:48 UTC (rev 5338) @@ -19,13 +19,18 @@ package net.sf.gridarta.script.parameter; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.map.MapArchObject; + /** * Interface for visitors of {@link PluginParameter} instances. * @author Andreas Kirschbaum */ -public interface PluginParameterVisitor { +public interface PluginParameterVisitor<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { - void visit(ArchParameter parameter); + void visit(ArchParameter<G, A, R> parameter); void visit(BooleanParameter parameter); @@ -35,7 +40,7 @@ void visit(IntegerParameter parameter); - void visit(MapParameter parameter); + void visit(MapParameter<G, A, R, V> parameter); void visit(StringParameter parameter); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-01 20:23:29
|
Revision: 5348 http://gridarta.svn.sourceforge.net/gridarta/?rev=5348&view=rev Author: akirschbaum Date: 2008-10-01 20:23:17 +0000 (Wed, 01 Oct 2008) Log Message: ----------- Move CloseableTabbedPane to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/script/ScriptView.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/script/CloseableTabbedPane.java Removed Paths: ------------- trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java Deleted: trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java 2008-10-01 20:20:32 UTC (rev 5347) +++ trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java 2008-10-01 20:23:17 UTC (rev 5348) @@ -1,110 +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. - */ - -/* -* Section two. Copy of licensing declaration xnap source code. -* -* Java Napster version x.yz (for current version number as well as for -* additional information see version.txt) -* -* Previous versions of this program were written by Florian Student -* and Michael Ransburg available at www.weblicity.de/jnapster and -* http://www.tux.org/~daneel/content/projects/10.shtml respectively. -* -* -* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -* -*/ - -package cfeditor.gui.script; - -import java.awt.Component; -import java.awt.event.MouseAdapter; -import java.awt.event.MouseEvent; -import javax.swing.ImageIcon; -import javax.swing.JTabbedPane; -import net.sf.gridarta.gui.script.ClosingIcon; -import net.sf.gridarta.gui.utils.GUIUtils; - -public class CloseableTabbedPane extends JTabbedPane { - - public static final String CLOSE_TAB_SMALLICON = "CloseTabSmallIcon.gif"; - - private final ImageIcon closingIcon; - - private static final long serialVersionUID = 1L; - - public CloseableTabbedPane(final ImageIcon closingIcon) { - this.closingIcon = closingIcon; - - addMouseListener(new ClosingListener()); - } - - public CloseableTabbedPane() { - this(GUIUtils.getIcon(CLOSE_TAB_SMALLICON)); - } - - public void addCloseableTab(final String title, final Component component, final boolean closeable) { - if (closeable) { - super.addTab(title, new ClosingIcon(closingIcon), component); - } else { - super.addTab(title, component); - } - setSelectedComponent(component); - } - - @Override - public void addTab(final String title, final Component component) { - addCloseableTab(title, component, true); - } - - private class ClosingListener extends MouseAdapter { - - @Override - public void mouseReleased(final MouseEvent e) { - final int i = getSelectedIndex(); - - // nothing selected - if (i == -1) { - return; - } - - final ClosingIcon icon = (ClosingIcon) getIconAt(i); - - // close tab, if icon was clicked - if (icon != null && icon.contains(e.getX(), e.getY())) { - removeTabAt(i); - } - } - - } // class ClosingListener - -} // class CloseableTabbedPane Modified: trunk/crossfire/src/cfeditor/gui/script/ScriptView.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-10-01 20:20:32 UTC (rev 5347) +++ trunk/crossfire/src/cfeditor/gui/script/ScriptView.java 2008-10-01 20:23:17 UTC (rev 5348) @@ -41,6 +41,7 @@ import javax.swing.JMenuItem; import javax.swing.JOptionPane; import javax.swing.JPanel; +import net.sf.gridarta.gui.script.CloseableTabbedPane; import net.sf.gridarta.gui.script.ScriptViewPane; import net.sf.gridarta.gui.script.parameter.PluginParameterView; import net.sf.gridarta.gui.script.parameter.PluginParameterViewFactory; Copied: trunk/src/app/net/sf/gridarta/gui/script/CloseableTabbedPane.java (from rev 5347, trunk/crossfire/src/cfeditor/gui/script/CloseableTabbedPane.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/script/CloseableTabbedPane.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/script/CloseableTabbedPane.java 2008-10-01 20:23:17 UTC (rev 5348) @@ -0,0 +1,110 @@ +/* + * 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. + */ + +/* +* Section two. Copy of licensing declaration xnap source code. +* +* Java Napster version x.yz (for current version number as well as for +* additional information see version.txt) +* +* Previous versions of this program were written by Florian Student +* and Michael Ransburg available at www.weblicity.de/jnapster and +* http://www.tux.org/~daneel/content/projects/10.shtml respectively. +* +* +* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +* +*/ + +package net.sf.gridarta.gui.script; + +import java.awt.Component; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.ImageIcon; +import javax.swing.JTabbedPane; +import net.sf.gridarta.gui.script.ClosingIcon; +import net.sf.gridarta.gui.utils.GUIUtils; + +public class CloseableTabbedPane extends JTabbedPane { + + public static final String CLOSE_TAB_SMALLICON = "CloseTabSmallIcon.gif"; + + private final ImageIcon closingIcon; + + private static final long serialVersionUID = 1L; + + public CloseableTabbedPane(final ImageIcon closingIcon) { + this.closingIcon = closingIcon; + + addMouseListener(new ClosingListener()); + } + + public CloseableTabbedPane() { + this(GUIUtils.getIcon(CLOSE_TAB_SMALLICON)); + } + + public void addCloseableTab(final String title, final Component component, final boolean closeable) { + if (closeable) { + super.addTab(title, new ClosingIcon(closingIcon), component); + } else { + super.addTab(title, component); + } + setSelectedComponent(component); + } + + @Override + public void addTab(final String title, final Component component) { + addCloseableTab(title, component, true); + } + + private class ClosingListener extends MouseAdapter { + + @Override + public void mouseReleased(final MouseEvent e) { + final int i = getSelectedIndex(); + + // nothing selected + if (i == -1) { + return; + } + + final ClosingIcon icon = (ClosingIcon) getIconAt(i); + + // close tab, if icon was clicked + if (icon != null && icon.contains(e.getX(), e.getY())) { + removeTabAt(i); + } + } + + } // class ClosingListener + +} // class CloseableTabbedPane Property changes on: trunk/src/app/net/sf/gridarta/gui/script/CloseableTabbedPane.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:mergeinfo + Added: svn:eol-style + LF This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-02 06:20:11
|
Revision: 5371 http://gridarta.svn.sourceforge.net/gridarta/?rev=5371&view=rev Author: akirschbaum Date: 2008-10-02 06:20:06 +0000 (Thu, 02 Oct 2008) Log Message: ----------- Fix plugin related actions. Modified Paths: -------------- trunk/crossfire/src/cfeditor/action.properties trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/crossfire/src/cfeditor/messages_fr.properties trunk/crossfire/src/cfeditor/messages_sv.properties trunk/src/app/net/sf/gridarta/action.properties trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties Modified: trunk/crossfire/src/cfeditor/action.properties =================================================================== --- trunk/crossfire/src/cfeditor/action.properties 2008-10-01 22:08:59 UTC (rev 5370) +++ trunk/crossfire/src/cfeditor/action.properties 2008-10-02 06:20:06 UTC (rev 5371) @@ -56,13 +56,7 @@ moveCursor.menu=goNorth goEast goSouth goWest goNorthEast goSouthEast goSouthWest goNorthWest - goLocation -runPlugin.icon=RunPluginSmallIcon -savePlugins.icon=SaveLevelAsSmallIcon - -importPlugin.icon=ImportPluginSmallIcon - - nextWindow.icon=navigation/Forward16 prevWindow.icon=navigation/Back16 Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-10-01 22:08:59 UTC (rev 5370) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-10-02 06:20:06 UTC (rev 5371) @@ -138,22 +138,6 @@ ######### -# Plugins - -plugins.text=Plugins -plugins.shortdescription=Manage and use beanshell plugins -plugins.mnemonic=L - -runPlugin.text=Run {0} - -savePlugins.text=Save plugins -savePlugins.mnemonic=S - -importPlugin.text=Import a plugin... -importPlugin.mnemonic=I - - -######### # Window window.text=Window Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2008-10-01 22:08:59 UTC (rev 5370) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2008-10-02 06:20:06 UTC (rev 5371) @@ -120,22 +120,6 @@ ######### -# Plugins - -plugins.text=Plugins -plugins.shortdescription=Beanshell Plugins verwalten -plugins.mnemonic=L - -runPlugin.text={0} starten - -savePlugins.text=Plugins speichern -savePlugins.mnemonic=S - -importPlugin.text=Plugin importieren... -importPlugin.mnemonic=I - - -######### # Window window.text=Fenster Modified: trunk/crossfire/src/cfeditor/messages_fr.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_fr.properties 2008-10-01 22:08:59 UTC (rev 5370) +++ trunk/crossfire/src/cfeditor/messages_fr.properties 2008-10-02 06:20:06 UTC (rev 5371) @@ -121,22 +121,6 @@ ######### -# Plugins - -#plugins.text= -#plugins.shortdescription= -#plugins.mnemonic= - -#runPlugin.text= - -#savePlugins.text= -#savePlugins.mnemonic= - -#importPlugin.text= -#importPlugin.mnemonic= - - -######### # Window window.text=Fen\xEAtres Modified: trunk/crossfire/src/cfeditor/messages_sv.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_sv.properties 2008-10-01 22:08:59 UTC (rev 5370) +++ trunk/crossfire/src/cfeditor/messages_sv.properties 2008-10-02 06:20:06 UTC (rev 5371) @@ -119,22 +119,6 @@ ######### -# Plugins - -#plugins.text= -#plugins.shortdescription= -#plugins.mnemonic= - -#runPlugin.text= - -#savePlugins.text= -#savePlugins.mnemonic= - -#importPlugin.text= -#importPlugin.mnemonic= - - -######### # Window window.text=F\xF6nster Modified: trunk/src/app/net/sf/gridarta/action.properties =================================================================== --- trunk/src/app/net/sf/gridarta/action.properties 2008-10-01 22:08:59 UTC (rev 5370) +++ trunk/src/app/net/sf/gridarta/action.properties 2008-10-02 06:20:06 UTC (rev 5371) @@ -91,6 +91,9 @@ pickmapFolders.menu= editPlugins.icon=EditPluginSmallIcon +runPlugin.icon=RunPluginSmallIcon +savePlugins.icon=SaveLevelAsSmallIcon +importPlugin.icon=ImportPluginSmallIcon # Zoom zoom.icon=general/Zoom16 Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-10-01 22:08:59 UTC (rev 5370) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-10-02 06:20:06 UTC (rev 5371) @@ -153,10 +153,22 @@ # Plugins +plugins.text=Plugins +plugins.shortdescription=Manage and use beanshell plugins +plugins.mnemonic=L + editPlugins.text=Edit plugins... editPlugins.mnemonic=E +runPlugin.text=Run {0} +savePlugins.text=Save plugins +savePlugins.mnemonic=S + +importPlugin.text=Import a plugin... +importPlugin.mnemonic=I + + # Resources viewTreasurelists.text=View Treasurelists viewTreasurelists.mnemonic=T Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-10-01 22:08:59 UTC (rev 5370) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-10-02 06:20:06 UTC (rev 5371) @@ -139,9 +139,22 @@ # Plugins +plugins.text=Plugins +plugins.shortdescription=Beanshell Plugins verwalten +plugins.mnemonic=L + editPlugins.text=Plugins bearbeiten... editPlugins.mnemonic=B +runPlugin.text={0} starten + +savePlugins.text=Plugins speichern +savePlugins.mnemonic=S + +importPlugin.text=Plugin importieren... +importPlugin.mnemonic=I + + # Resources viewTreasurelists.text=Schatzlisten anschauen viewTreasurelists.mnemonic=S Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-10-01 22:08:59 UTC (rev 5370) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-10-02 06:20:06 UTC (rev 5371) @@ -138,10 +138,22 @@ # Plugins +#plugins.text= +#plugins.shortdescription= +#plugins.mnemonic= + #editPlugins.text= #editPlugins.mnemonic= +#runPlugin.text= +#savePlugins.text= +#savePlugins.mnemonic= + +#importPlugin.text= +#importPlugin.mnemonic= + + # Resources viewTreasurelists.text=Afficher listes de tr\xE9sors viewTreasurelists.mnemonic=T Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-10-01 22:08:59 UTC (rev 5370) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-10-02 06:20:06 UTC (rev 5371) @@ -138,10 +138,22 @@ # Plugins +#plugins.text= +#plugins.shortdescription= +#plugins.mnemonic= + #editPlugins.text= #editPlugins.mnemonic= +#runPlugin.text= +#savePlugins.text= +#savePlugins.mnemonic= + +#importPlugin.text= +#importPlugin.mnemonic= + + # Resources viewTreasurelists.text=Visa skattlistor viewTreasurelists.mnemonic=V This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-02 06:26:02
|
Revision: 5372 http://gridarta.svn.sourceforge.net/gridarta/?rev=5372&view=rev Author: akirschbaum Date: 2008-10-02 06:25:52 +0000 (Thu, 02 Oct 2008) Log Message: ----------- Fix ScriptController related actions. Modified Paths: -------------- trunk/crossfire/src/cfeditor/messages.properties trunk/crossfire/src/cfeditor/messages_de.properties trunk/crossfire/src/cfeditor/messages_fr.properties trunk/crossfire/src/cfeditor/messages_sv.properties trunk/src/app/net/sf/gridarta/messages.properties trunk/src/app/net/sf/gridarta/messages_de.properties trunk/src/app/net/sf/gridarta/messages_fr.properties trunk/src/app/net/sf/gridarta/messages_sv.properties trunk/src/app/net/sf/gridarta/script/ScriptController.java Modified: trunk/crossfire/src/cfeditor/messages.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages.properties 2008-10-02 06:20:06 UTC (rev 5371) +++ trunk/crossfire/src/cfeditor/messages.properties 2008-10-02 06:25:52 UTC (rev 5372) @@ -195,13 +195,6 @@ mapwindowCursor.mnemonic=C -########## -# Plugins - -pluginConfirmSaveChanges.title=Save changes? -pluginConfirmSaveChanges.message=Do you want to save changes to plugin {0}? - - ####################### # Various Log Messages logFaceObjectWithoutOriginalName=No originalName for {0}! Modified: trunk/crossfire/src/cfeditor/messages_de.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_de.properties 2008-10-02 06:20:06 UTC (rev 5371) +++ trunk/crossfire/src/cfeditor/messages_de.properties 2008-10-02 06:25:52 UTC (rev 5372) @@ -161,10 +161,3 @@ mapwindowCursor.text=Cursor mapwindowCursor.mnemonic=C - - -########## -# Plugins - -pluginConfirmSaveChanges.title=\xC4nderungen sichern? -pluginConfirmSaveChanges.message=Wollen Sie die \xC4nderungen des Plugins {0} sichern? Modified: trunk/crossfire/src/cfeditor/messages_fr.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_fr.properties 2008-10-02 06:20:06 UTC (rev 5371) +++ trunk/crossfire/src/cfeditor/messages_fr.properties 2008-10-02 06:25:52 UTC (rev 5372) @@ -162,10 +162,3 @@ #mapwindowCursor.text= mapwindowCursor.mnemonic=U - - -########## -# Plugins - -#pluginConfirmSaveChanges.title=\xC4nderungen sichern? -#pluginConfirmSaveChanges.message= Modified: trunk/crossfire/src/cfeditor/messages_sv.properties =================================================================== --- trunk/crossfire/src/cfeditor/messages_sv.properties 2008-10-02 06:20:06 UTC (rev 5371) +++ trunk/crossfire/src/cfeditor/messages_sv.properties 2008-10-02 06:25:52 UTC (rev 5372) @@ -160,10 +160,3 @@ mapwindowCursor.text=Mark\xF6r mapwindowCursor.mnemonic=M - - -########## -# Plugins - -pluginConfirmSaveChanges.title=Spara \xE4ndringar? -#pluginConfirmSaveChanges.message= Modified: trunk/src/app/net/sf/gridarta/messages.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages.properties 2008-10-02 06:20:06 UTC (rev 5371) +++ trunk/src/app/net/sf/gridarta/messages.properties 2008-10-02 06:25:52 UTC (rev 5372) @@ -1237,3 +1237,10 @@ controlCloseOkay=You may safely close this window. controlServerWarning.title=Warning controlServerWarning.message=<html><h3>Warning!</h3><p>Java cannot cope with processes that use signal handlers doing lots of work.<br>The server is such a process.<br>Terminating the server using the Stop button will extremely likely<br>result in a Zombie process only killable via operating system tools.</p><p><strong>You have been warned!</strong></p></html> + + +########## +# Plugins + +pluginConfirmSaveChanges.title=Save changes? +pluginConfirmSaveChanges.message=Do you want to save changes to plugin {0}? Modified: trunk/src/app/net/sf/gridarta/messages_de.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_de.properties 2008-10-02 06:20:06 UTC (rev 5371) +++ trunk/src/app/net/sf/gridarta/messages_de.properties 2008-10-02 06:25:52 UTC (rev 5372) @@ -1087,3 +1087,10 @@ controlCloseOkay=Sie k\xF6nnen dieses Fenster schlie\xDFen. controlServerWarning.title=Warnung controlServerWarning.message=<html><h3>Warnung!</h3><p>Java kann mit Prozessen nicht richtig umgehen, die im Signal-Handler viel Code ausf\xFChren.<br>Der Server ist so ein Prozess.<br>Die Beendigung durch "Stopp" wird wahrscheinlich einen Zombie-Prozess<br>erzeugen, der durch das Betriebssystem beendet werden muss.</p><p><strong>Sie sind gewarnt worden!</strong></p></html> + + +########## +# Plugins + +pluginConfirmSaveChanges.title=\xC4nderungen sichern? +pluginConfirmSaveChanges.message=Wollen Sie die \xC4nderungen des Plugins {0} sichern? Modified: trunk/src/app/net/sf/gridarta/messages_fr.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-10-02 06:20:06 UTC (rev 5371) +++ trunk/src/app/net/sf/gridarta/messages_fr.properties 2008-10-02 06:25:52 UTC (rev 5372) @@ -1083,3 +1083,10 @@ #controlCloseOkay= #controlServerWarning.title= #controlServerWarning.message= + + +########## +# Plugins + +#pluginConfirmSaveChanges.title=\xC4nderungen sichern? +#pluginConfirmSaveChanges.message= Modified: trunk/src/app/net/sf/gridarta/messages_sv.properties =================================================================== --- trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-10-02 06:20:06 UTC (rev 5371) +++ trunk/src/app/net/sf/gridarta/messages_sv.properties 2008-10-02 06:25:52 UTC (rev 5372) @@ -1087,3 +1087,10 @@ controlCloseOkay=Du kan st\xE4nga f\xF6nstret nu. controlServerWarning.title=Varning controlServerWarning.message=<html><h3>Varning!</h3><p>Java kan inte hantera processer som anv\xE4nder signalhanterare f\xF6r mycket arbete.<br>Servern \xE4r en s\xE5dan process.<br>Stopp av servern med "stoppa"-knappen kommer med stor sannolikhet<br>att resultera i en zombie-process som bara g\xE5r att ta bort med operativsystemets verktyg.</p><p><strong>Du har blivit varnad!</strong></p></html> + + +########## +# Plugins + +pluginConfirmSaveChanges.title=Spara \xE4ndringar? +#pluginConfirmSaveChanges.message= Modified: trunk/src/app/net/sf/gridarta/script/ScriptController.java =================================================================== --- trunk/src/app/net/sf/gridarta/script/ScriptController.java 2008-10-02 06:20:06 UTC (rev 5371) +++ trunk/src/app/net/sf/gridarta/script/ScriptController.java 2008-10-02 06:25:52 UTC (rev 5372) @@ -68,7 +68,7 @@ private static final Logger log = Logger.getLogger(ScriptController.class); /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); @NotNull private final ScriptModel scriptModel = new ScriptModel(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-02 18:23:38
|
Revision: 5375 http://gridarta.svn.sourceforge.net/gridarta/?rev=5375&view=rev Author: akirschbaum Date: 2008-10-02 18:23:13 +0000 (Thu, 02 Oct 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-10-02 18:19:36 UTC (rev 5374) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-10-02 18:23:13 UTC (rev 5375) @@ -87,7 +87,6 @@ import net.sf.gridarta.script.ScriptController; import net.sf.gridarta.script.ScriptExecException; import net.sf.gridarta.script.ScriptParameters; -import net.sf.gridarta.script.parameter.PluginParameterFactory; import net.sf.gridarta.treasurelist.CFTreasureListTree; import net.sf.gridarta.treasurelist.TreasureLocation; import net.sf.gridarta.treasurelist.TreasureTreeNode; @@ -211,7 +210,6 @@ /** {@inheritDoc} */ @Override protected void init2(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final net.sf.gridarta.gameobject.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser) { - PluginParameterFactory.init(archetypeSet, mapManager); final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); filterControl = new FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, defaultNamedFilterList); ((DefaultGridartaObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-10-02 18:19:36 UTC (rev 5374) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-10-02 18:23:13 UTC (rev 5375) @@ -107,7 +107,6 @@ import net.sf.gridarta.script.ScriptController; import net.sf.gridarta.script.ScriptExecException; import net.sf.gridarta.script.ScriptParameters; -import net.sf.gridarta.script.parameter.PluginParameterFactory; import net.sf.gridarta.spells.SpellsUtils; import net.sf.gridarta.treasurelist.CFTreasureListTree; import net.sf.gridarta.treasurelist.TreasureLocation; @@ -261,7 +260,6 @@ /** {@inheritDoc} */ @Override protected void init2(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final net.sf.gridarta.gameobject.ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final DelegatingMapValidator<GameObject, MapArchObject, Archetype> validators, @NotNull final GameObjectMatchers gameObjectMatchers, @NotNull final GameObjectAttributesModel<GameObject, MapArchObject, Archetype> gameObjectAttributesModel, @NotNull final ObjectChooser<GameObject, MapArchObject, Archetype> objectChooser) { - PluginParameterFactory.init(archetypeSet, mapManager); final NamedFilterList defaultNamedFilterList = new NamedFilterList(gameObjectMatchers.getFilters()); filterControl = new FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, defaultNamedFilterList); ((DefaultGridartaObjectsFactory) gridartaObjectsFactory).setFilterControl(filterControl); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-10-02 18:19:36 UTC (rev 5374) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-10-02 18:23:13 UTC (rev 5375) @@ -103,6 +103,7 @@ import net.sf.gridarta.map.MapControlFactory; import net.sf.gridarta.map.validation.DelegatingMapValidator; import net.sf.gridarta.mapfiles.MapFolderTree; +import net.sf.gridarta.script.parameter.PluginParameterFactory; import net.sf.gridarta.spells.ArchetypeSetSpellLoader; import net.sf.gridarta.spells.GameObjectSpell; import net.sf.gridarta.spells.NumberSpell; @@ -413,6 +414,7 @@ final LockedItemsControl<G, A, R, V> lockedItemsControl = new LockedItemsControl<G, A, R, V>(mapManager, mapViewManager, lockedItemsTypeNumbers); final GameObjectAttributesModel<G, A, R> gameObjectAttributesModel = new GameObjectAttributesModel<G, A, R>(); gameObjectAttributesControl = new GameObjectAttributesControl<G, A, R, V>(gameObjectAttributesModel, gameObjectAttributesDialogFactory, objectChooser, archetypeTypeSet, mapManager, mapViewManager, animationObjects, lockedItemsControl, monsterMatcher, selectedSquareControl, selectedSquareView, mainView); + PluginParameterFactory.init(archetypeSet, mapManager); init2(gridartaObjectsFactory, globalSettings, mapManager, archetypeSet, validators, gameObjectMatchers, gameObjectAttributesModel, objectChooser); final ObjectChoiceDisplay<G, A, R, V> objectChoiceDisplay = new ObjectChoiceDisplay<G, A, R, V>(replaceDialogManager, archetypeTypeSet, objectChooser, archetypeChooserModel, pickmapChooserControl); final ToolPalette<G, A, R, V> toolPalette = new ToolPalette<G, A, R, V>(editTypes, selectedSquareView, objectChooser, pickmapChooserControl); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-02 20:05:14
|
Revision: 5382 http://gridarta.svn.sourceforge.net/gridarta/?rev=5382&view=rev Author: akirschbaum Date: 2008-10-02 20:05:04 +0000 (Thu, 02 Oct 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/GameObject.java trunk/daimonin/src/daieditor/gameobject/GameObject.java trunk/src/app/net/sf/gridarta/gameobject/GameObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/GameObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-10-02 20:01:18 UTC (rev 5381) +++ trunk/crossfire/src/cfeditor/gameobject/GameObject.java 2008-10-02 20:05:04 UTC (rev 5382) @@ -66,9 +66,6 @@ @NotNull private FaceSource faceObjSource = FaceSource.FACE_NOT_FOUND; - /** Object animation <code>animation <var>animName</var></code>. */ - private String animName; - @NotNull private String loreText = ""; // lore text buffer @@ -139,7 +136,7 @@ /** {@inheritDoc} */ public void setObjectFace() { - String effectiveAnimName = animName; + String effectiveAnimName = getAnimName(); faceObjSource = FaceSource.ANIM; // lets check we have in this object or the default arch of it an animation if (effectiveAnimName == null) { @@ -225,25 +222,6 @@ } /** {@inheritDoc} */ - public void setAnimName(@Nullable final String animName) { - final String newAnimName = animName != null ? animName.intern() : null; - // Using == on these Strings is okay, they are both interned. - //noinspection StringEquality - if (this.animName == newAnimName) { - return; - } - - this.animName = newAnimName; - gameObjectChanged(); - } - - /** {@inheritDoc} */ - @Nullable - public String getAnimName() { - return animName; - } - - /** {@inheritDoc} */ @NotNull @Override protected GameObject clone() { @@ -390,7 +368,6 @@ public boolean isEqual(@NotNull final GameObject gameObject) { return super.isEqual(gameObject) && (gameObject.faceObjName == null ? faceObjName == null : gameObject.faceObjName.equals(faceObjName)) - && (gameObject.animName == null ? animName == null : gameObject.animName.equals(animName)) && gameObject.loreText.equals(loreText) // ignore "scriptArchData" && gameObject.noface == noface Modified: trunk/daimonin/src/daieditor/gameobject/GameObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-10-02 20:01:18 UTC (rev 5381) +++ trunk/daimonin/src/daieditor/gameobject/GameObject.java 2008-10-02 20:05:04 UTC (rev 5382) @@ -67,9 +67,6 @@ @NotNull private FaceSource faceObjSource = FaceSource.FACE_NOT_FOUND; - /** Object animation <code>animation <var>animName</var></code>. */ - private String animName; - private int multiPartNr = 0; /** @@ -197,7 +194,7 @@ /** {@inheritDoc} */ public void setObjectFace() { - String effectiveAnimName = animName; + String effectiveAnimName = getAnimName(); faceObjSource = FaceSource.ANIM; // lets check we have in this object or the default arch of it an animation if (effectiveAnimName == null) { @@ -277,25 +274,6 @@ } /** {@inheritDoc} */ - public void setAnimName(@Nullable final String animName) { - final String newAnimName = animName != null ? animName.intern() : null; - // Using == on these Strings is okay, they are both interned. - //noinspection StringEquality - if (this.animName == newAnimName) { - return; - } - - this.animName = newAnimName; - gameObjectChanged(); - } - - /** {@inheritDoc} */ - @Nullable - public String getAnimName() { - return animName; - } - - /** {@inheritDoc} */ @NotNull @Override protected GameObject clone() { @@ -430,7 +408,6 @@ public boolean isEqual(@NotNull final GameObject gameObject) { return super.isEqual(gameObject) && (gameObject.faceObjName == null ? faceObjName == null : gameObject.faceObjName.equals(faceObjName)) - && (gameObject.animName == null ? animName == null : gameObject.animName.equals(animName)) && gameObject.multiPartNr == multiPartNr && gameObject.isLowestPart == isLowestPart // ignore "scriptArchData" Modified: trunk/src/app/net/sf/gridarta/gameobject/GameObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-10-02 20:01:18 UTC (rev 5381) +++ trunk/src/app/net/sf/gridarta/gameobject/GameObject.java 2008-10-02 20:05:04 UTC (rev 5382) @@ -174,6 +174,9 @@ /** The object type. */ protected int archType = TYPE_UNSET; + /** Object animation <code>animation <var>animName</var></code>. */ + private String animName; + /** * The direction determines to which direction the GameObject's face is * facing. E.g. some walls have two faces, some mobs 4 and very good @@ -1256,6 +1259,7 @@ // ignore "editType" && (gameObject.editorFolder == null ? editorFolder == null : gameObject.editorFolder.equals(editorFolder)) && (gameObject.faceName == null ? faceName == null : gameObject.faceName.equals(faceName)) + && (gameObject.animName == null ? animName == null : gameObject.animName.equals(animName)) && gameObject.direction == direction; } @@ -1545,4 +1549,23 @@ @NotNull public abstract FaceSource getFaceObjSource(); + /** {@inheritDoc} */ + public void setAnimName(@Nullable final String animName) { + final String newAnimName = animName != null ? animName.intern() : null; + // Using == on these Strings is okay, they are both interned. + //noinspection StringEquality + if (this.animName == newAnimName) { + return; + } + + this.animName = newAnimName; + gameObjectChanged(); + } + + /** {@inheritDoc} */ + @Nullable + public String getAnimName() { + return animName; + } + } // interface GameObject This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-02 20:21:03
|
Revision: 5385 http://gridarta.svn.sourceforge.net/gridarta/?rev=5385&view=rev Author: akirschbaum Date: 2008-10-02 20:20:58 +0000 (Thu, 02 Oct 2008) Log Message: ----------- Move code to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObject.java Modified: trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java =================================================================== --- trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java 2008-10-02 20:18:35 UTC (rev 5384) +++ trunk/crossfire/src/cfeditor/gameobject/anim/AnimationObject.java 2008-10-02 20:20:58 UTC (rev 5385) @@ -21,9 +21,7 @@ import java.util.ArrayList; import java.util.List; -import javax.swing.ImageIcon; import net.sf.gridarta.gameobject.anim.AbstractAnimationObject; -import net.sf.gridarta.gameobject.face.FaceObjectProviders; import org.apache.log4j.Logger; /** @@ -82,17 +80,6 @@ frameCount = frames.size() / getFacings(); } - /** {@inheritDoc} */ - public ImageIcon getDisplayIcon() { - for (int facing = 1; facing < getFacings(); facing++) { - final String frame = getFirstFrame(facing); - if (!frame.startsWith("dummy.")) { - return FaceObjectProviders.normal.getImageIconForFacename(frame); - } - } - return FaceObjectProviders.normal.getImageIconForFacename(getFirstFrame(0)); - } - /** * Get the number of frames per facing. * @return number of frames per facing Modified: trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java =================================================================== --- trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java 2008-10-02 20:18:35 UTC (rev 5384) +++ trunk/daimonin/src/daieditor/gameobject/anim/AnimationObject.java 2008-10-02 20:20:58 UTC (rev 5385) @@ -21,9 +21,7 @@ import java.util.ArrayList; import java.util.List; -import javax.swing.ImageIcon; import net.sf.gridarta.gameobject.anim.AbstractAnimationObject; -import net.sf.gridarta.gameobject.face.FaceObjectProviders; import org.apache.log4j.Logger; /** @@ -82,17 +80,6 @@ frameCount = frames.size() / getFacings(); } - /** {@inheritDoc} */ - public ImageIcon getDisplayIcon() { - for (int facing = 1; facing < getFacings(); facing++) { - final String frame = getFirstFrame(facing); - if (!frame.startsWith("dummy.")) { - return FaceObjectProviders.normal.getImageIconForFacename(frame); - } - } - return FaceObjectProviders.normal.getImageIconForFacename(getFirstFrame(0)); - } - /** * Get the number of frames per facing. * @return number of frames per facing Modified: trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObject.java =================================================================== --- trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObject.java 2008-10-02 20:18:35 UTC (rev 5384) +++ trunk/src/app/net/sf/gridarta/gameobject/anim/AbstractAnimationObject.java 2008-10-02 20:20:58 UTC (rev 5385) @@ -20,7 +20,9 @@ package net.sf.gridarta.gameobject.anim; import java.util.regex.Pattern; +import javax.swing.ImageIcon; import net.sf.gridarta.data.AbstractNamedObject; +import net.sf.gridarta.gameobject.face.FaceObjectProviders; import org.apache.log4j.Logger; /** @@ -123,4 +125,15 @@ return sb.toString(); } + /** {@inheritDoc} */ + public ImageIcon getDisplayIcon() { + for (int facing = 1; facing < facings; facing++) { + final String frame = getFirstFrame(facing); + if (!frame.startsWith("dummy.")) { + return FaceObjectProviders.normal.getImageIconForFacename(frame); + } + } + return FaceObjectProviders.normal.getImageIconForFacename(getFirstFrame(0)); + } + } // class AbstractAnimationObject This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-03 09:00:58
|
Revision: 5393 http://gridarta.svn.sourceforge.net/gridarta/?rev=5393&view=rev Author: akirschbaum Date: 2008-10-03 09:00:55 +0000 (Fri, 03 Oct 2008) Log Message: ----------- Remove dependency MapViewBasic -> MapControl. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Modified: trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-10-02 21:01:18 UTC (rev 5392) +++ trunk/crossfire/src/cfeditor/gui/map/CMapViewBasic.java 2008-10-03 09:00:55 UTC (rev 5393) @@ -126,7 +126,7 @@ * @param selectedSquareView the selected square view */ public CMapViewBasic(@NotNull final FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl, @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, xScrollDistance, yScrollDistance, selectedSquareView); + super(mapControl.getMapModel(), mapControl.isPickmap(), xScrollDistance, yScrollDistance, selectedSquareView); getMapCursor().addMapCursorListener(mapCursorListener); renderer = mapControl.isPickmap() ? new PickmapRenderer(mapControl, getMapGrid()) : new MapRenderer(filterControl, editTypes, mapControl, getMapGrid()); Modified: trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-10-02 21:01:18 UTC (rev 5392) +++ trunk/daimonin/src/daieditor/gui/map/CMapViewBasic.java 2008-10-03 09:00:55 UTC (rev 5393) @@ -132,7 +132,7 @@ * @param selectedSquareView the selected square view */ public CMapViewBasic(@NotNull final CMainControl mainControl, @NotNull final FilterControl<GameObject, MapArchObject, Archetype, CMapViewBasic> filterControl, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, @Nullable final Point initial, @NotNull final FaceObjects faceObjects, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView) { - super(mapControl, xScrollDistance, yScrollDistance, selectedSquareView); + super(mapControl.getMapModel(), mapControl.isPickmap(), xScrollDistance, yScrollDistance, selectedSquareView); getMapCursor().addMapCursorListener(mapCursorListener); renderer = mapControl.isPickmap() ? new PickmapRenderer(mainControl, mapControl, getMapGrid(), faceObjects) : new MapRenderer(mainControl, filterControl, editTypes, mapControl, getMapGrid(), faceObjects); Modified: trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2008-10-02 21:01:18 UTC (rev 5392) +++ trunk/src/app/net/sf/gridarta/gui/map/MapViewBasic.java 2008-10-03 09:00:55 UTC (rev 5393) @@ -34,7 +34,6 @@ import net.sf.gridarta.gameobject.GameObject; import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.map.MapArchObject; -import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapModel; import net.sf.gridarta.map.MapSquare; import net.sf.gridarta.map.validation.ErrorCollector; @@ -58,6 +57,11 @@ @NotNull protected final MapModel<G, A, R> mapModel; + /** + * Whether {@link #mapModel} belongs to a pickmap. + */ + private final boolean isPickmap; + /** The grid to use. */ @NotNull private final MapGrid mapGrid; @@ -72,9 +76,6 @@ /** The ArchObjects that are known to contain errors. */ protected final Map<G, ValidationError<G, A, R>> erroneousArchObjects = new HashMap<G, ValidationError<G, A, R>>(); - /** The controller of this view. */ - private final MapControl<G, A, R, V> mapControl; - /** The tile palette renderer. */ protected AbstractLevelRenderer<G, A, R> renderer; @@ -83,23 +84,24 @@ /** * Creates a MapViewBasic. - * @param mapControl MapControl to use. + * @param mapModel the map model to use + * @param isPickmap whether the map model belongs to a pickmap * @param xScrollDistance the x distance when scrolling * @param yScrollDistance the y distance when scrolling * @param selectedSquareView the selected square view */ - protected MapViewBasic(@NotNull final MapControl<G, A, R, V> mapControl, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { + protected MapViewBasic(@NotNull final MapModel<G, A, R> mapModel, final boolean isPickmap, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView) { super(VERTICAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_AS_NEEDED); + this.isPickmap = isPickmap; this.selectedSquareView = selectedSquareView; - mapModel = mapControl.getMapModel(); - mapGrid = new MapGrid(mapModel.getMapSize()); + this.mapModel = mapModel; + mapGrid = new MapGrid(this.mapModel.getMapSize()); mapCursor = new MapCursor(mapGrid); - if (mapControl.isPickmap()) { + if (isPickmap) { setBackground(CommonConstants.BG_COLOR); } else { mapCursor.addMapCursorListener(selectedSquareView); } - this.mapControl = mapControl; // set the pixel increment scrolling for clicking once on a scrollbar arrow getVerticalScrollBar().setUnitIncrement(yScrollDistance); @@ -258,7 +260,7 @@ */ public void closeNotify() { renderer.closeNotify(); - if (!mapControl.isPickmap()) { + if (!isPickmap) { mapCursor.removeMapCursorListener(selectedSquareView); } } Modified: trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java =================================================================== --- trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-10-02 21:01:18 UTC (rev 5392) +++ trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java 2008-10-03 09:00:55 UTC (rev 5393) @@ -801,13 +801,14 @@ /** * Creates a new instance. - * @param mapControl the map control + * @param mapModel the map model + * @param isPickmap whether the map model represents a pickmap * @param xScrollDistance the x scroll distance * @param yScrollDistance the y scroll distance * @param selectedSquareView the selected square view to use */ - protected TestMapViewBasic(@NotNull final MapControl<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> mapControl, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView) { - super(mapControl, xScrollDistance, yScrollDistance, selectedSquareView); + protected TestMapViewBasic(@NotNull final MapModel<TestGameObject, TestMapArchObject, TestArchetype> mapModel, final boolean isPickmap, final int xScrollDistance, final int yScrollDistance, @NotNull final SelectedSquareView<TestGameObject, TestMapArchObject, TestArchetype, TestMapViewBasic> selectedSquareView) { + super(mapModel, isPickmap, xScrollDistance, yScrollDistance, selectedSquareView); } /** {@inheritDoc} */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <aki...@us...> - 2008-10-03 10:56:04
|
Revision: 5401 http://gridarta.svn.sourceforge.net/gridarta/?rev=5401&view=rev Author: akirschbaum Date: 2008-10-03 10:55:59 +0000 (Fri, 03 Oct 2008) Log Message: ----------- Extract MapArchObjectFactory from GridartaObjectsFactory. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java trunk/daimonin/src/daieditor/CMainControl.java trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java trunk/daimonin/src/daieditor/gui/map/MapTilePane.java trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java trunk/src/app/net/sf/gridarta/AbstractMainControl.java trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java trunk/src/app/net/sf/gridarta/gui/map/DefaultMapActions.java trunk/src/app/net/sf/gridarta/gui/map/MapPropertiesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialog.java trunk/src/app/net/sf/gridarta/gui/newmap/NewMapDialogFactory.java trunk/src/app/net/sf/gridarta/io/DefaultMapReader.java trunk/src/app/net/sf/gridarta/map/MapControlFactory.java trunk/src/test/net/sf/gridarta/map/DefaultMapModelTest.java Added Paths: ----------- trunk/crossfire/src/cfeditor/map/DefaultMapArchObjectFactory.java trunk/daimonin/src/daieditor/map/DefaultMapArchObjectFactory.java trunk/src/app/net/sf/gridarta/map/MapArchObjectFactory.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -32,6 +32,7 @@ import cfeditor.gui.map.DefaultMapPropertiesDialogFactory; import cfeditor.gui.map.DefaultRendererFactory; import cfeditor.gui.prefs.ResPrefs; +import cfeditor.map.DefaultMapArchObjectFactory; import cfeditor.map.DefaultMapControlFactory; import cfeditor.map.MapArchObject; import java.io.File; @@ -65,6 +66,7 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.ConfigFileUtils; import net.sf.gridarta.io.GameObjectParser; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControlFactory; import net.sf.gridarta.map.validation.DelegatingMapValidator; import net.sf.gridarta.map.validation.checks.AttributeRangeChecker; @@ -110,6 +112,13 @@ /** {@inheritDoc} */ @NotNull @Override + protected MapArchObjectFactory<MapArchObject> newMapArchObjectFactory() { + return new DefaultMapArchObjectFactory(); + } + + /** {@inheritDoc} */ + @NotNull + @Override protected AppPrefsModel createAppPrefsModel() { return new AppPrefsModel( "crossfire-server", @@ -151,8 +160,8 @@ /** {@inheritDoc} */ @NotNull @Override - protected NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newNewMapDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { - return new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); + protected NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newNewMapDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory) { + return new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapArchObjectFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, 0, false, false, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); } /** {@inheritDoc} */ @@ -174,7 +183,7 @@ /** {@inheritDoc} */ @NotNull @Override - protected MapActions init1(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher) { + protected MapActions init1(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher) { archetypeTypeSet.getListTable().put("event", ScriptArchUtils.getEventTypes()); final int[] directionMap = new int[] { CommonConstants.NORTH, @@ -187,7 +196,7 @@ CommonConstants.NORTH_WEST, }; final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory = new DefaultMapPropertiesDialogFactory(); - return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, true, mapPropertiesDialogFactory); + return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, getMainView(), getMainView(), gridartaObjectsFactory, mapArchObjectFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, true, mapPropertiesDialogFactory); } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/crossfire/src/cfeditor/DefaultGridartaObjectsFactory.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -30,8 +30,6 @@ import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; -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; @@ -45,6 +43,7 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -59,9 +58,6 @@ /** The action factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); - /** Preferences. */ - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - /** The {@link SelectedSquareView} instance to use. */ @NotNull private SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView = null; @@ -90,20 +86,14 @@ @NotNull private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; - /** {@inheritDoc} */ + /** The {@link MapArchObjectFactory} instance. */ @NotNull - public MapArchObject newMapArchObject(final boolean addDefaultAttributes) { - final MapArchObject mapArchObject = new MapArchObject(); - if (addDefaultAttributes) { - mapArchObject.addText("Created: " + String.format("%tF", System.currentTimeMillis()) + " " + prefs.get(AbstractMainControl.PREFS_USERNAME, AbstractMainControl.PREFS_USERNAME_DEFAULT)); - } - return mapArchObject; - } + private MapArchObjectFactory<MapArchObject> mapArchObjectFactory; /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, new GameObjectParser(new DefaultGameObjectFactory()), mainView, archetypeSet, editTypes, file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, mapArchObjectFactory, new GameObjectParser(new DefaultGameObjectFactory()), mainView, archetypeSet, editTypes, file); } /** {@inheritDoc} */ @@ -124,13 +114,14 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory) { this.selectedSquareView = selectedSquareView; this.mainView = mainView; this.editTypes = editTypes; this.mapImageCache = mapImageCache; this.archetypeSet = archetypeSet; this.toolPalette = toolPalette; + this.mapArchObjectFactory = mapArchObjectFactory; } /** {@inheritDoc} */ Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -31,6 +31,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -51,12 +52,13 @@ * @param helpParent the parent frame for help windows * @param mapManager the map manager to use * @param gridartaObjectsFactory the gridarta objects factory instance + * @param mapArchObjectFactory the map arch object factory instance * @param globalSettings the global settings instance * @param level map to show dialog about * @param mapFileFilter the Swing file filter to use */ - public void showDialog(final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, gridartaObjectsFactory, globalSettings, level, mapFileFilter); + public void showDialog(final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { + final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, gridartaObjectsFactory, mapArchObjectFactory, globalSettings, level, mapFileFilter); final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); pane.dialog = dialog; dialog.getRootPane().setDefaultButton(pane.okButton); Modified: trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/crossfire/src/cfeditor/gui/map/MapPropertiesDialog.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -44,6 +44,7 @@ import net.sf.gridarta.MapManager; import net.sf.gridarta.Size2D; import net.sf.gridarta.help.Help; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -175,11 +176,12 @@ * @param helpParent the parent frame for help windows * @param mapManager the map manager to use * @param gridartaObjectsFactory the gridarta objects factory instance + * @param mapArchObjectFactory the map arch object factory instance * @param globalSettings the global settings instance * @param mapControl The level whose properties are shown/edited. * @param mapFileFilter the Swing file filter to use */ - public MapPropertiesDialog(final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + public MapPropertiesDialog(final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { okButton.setDefaultCapable(true); setOptions(new Object[] {helpButton, okButton, restoreButton, cancelButton}); @@ -223,7 +225,7 @@ final JPanel weatherPanel = createWeatherPanel(map); tabs.add(ACTION_FACTORY.getString("mapWeatherTabTitle"), weatherPanel); - mapTilePane = new MapTilePane(mapManager, gridartaObjectsFactory, globalSettings, mapControl, mapFileFilter); + mapTilePane = new MapTilePane(mapManager, gridartaObjectsFactory, mapArchObjectFactory, globalSettings, mapControl, mapFileFilter); final JPanel tilePanel = createTilePathPanel(mapTilePane); tabs.add(ACTION_FACTORY.getString("mapTilesTabTitle"), tilePanel); Modified: trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/crossfire/src/cfeditor/gui/map/MapTilePane.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -28,6 +28,7 @@ import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.DirectionLayout; import net.sf.gridarta.gui.map.AbstractMapTilePane; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import org.jetbrains.annotations.NotNull; @@ -59,13 +60,14 @@ * Create a MapTilePane. * @param mapManager the map manager to use * @param gridartaObjectsFactory the gridarta objects factory instance + * @param mapArchObjectFactory the map arch object factory instance * @param globalSettings the global settings instance * @param mapControl MapControl of the map that's tiles are to be viewed / * controlled * @param mapFileFilter the Swing file filter to use */ - public MapTilePane(final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?>gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { - super(mapManager, gridartaObjectsFactory, globalSettings, mapControl, tileLink, directionMapping, nextFocus, mapFileFilter); + public MapTilePane(final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?>gridartaObjectsFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + super(mapManager, gridartaObjectsFactory, mapArchObjectFactory, globalSettings, mapControl, tileLink, directionMapping, nextFocus, mapFileFilter); } } // class MapTilePane Added: trunk/crossfire/src/cfeditor/map/DefaultMapArchObjectFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapArchObjectFactory.java (rev 0) +++ trunk/crossfire/src/cfeditor/map/DefaultMapArchObjectFactory.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -0,0 +1,51 @@ +/* + * 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.map; + +import java.util.prefs.Preferences; +import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.map.MapArchObjectFactory; + +/** + * Factory to create {@link MapArchObject} instances. + * @author Andreas Kirschbaum + */ +public class DefaultMapArchObjectFactory implements MapArchObjectFactory<MapArchObject> { + + /** Preferences. */ + private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + + /** + * Creates a new instance. + */ + public DefaultMapArchObjectFactory() { + } + + /** {@inheritDoc} */ + public MapArchObject newMapArchObject(final boolean addDefaultAttributes) { + final MapArchObject mapArchObject = new MapArchObject(); + if (addDefaultAttributes) { + mapArchObject.addText("Created: " + String.format("%tF", System.currentTimeMillis()) + " " + prefs.get(AbstractMainControl.PREFS_USERNAME, AbstractMainControl.PREFS_USERNAME_DEFAULT)); + } + return mapArchObject; + } + +} // class DefaultMapArchObjectFactory Property changes on: trunk/crossfire/src/cfeditor/map/DefaultMapArchObjectFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/crossfire/src/cfeditor/map/DefaultMapControlFactory.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -36,6 +36,7 @@ import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.map.AbstractMapControlFactory; import net.sf.gridarta.map.DefaultMapControl; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapControlFactory; import org.jetbrains.annotations.NotNull; @@ -54,6 +55,12 @@ private GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory; /** + * The {@link MapArchObjectFactory} instance to use. + */ + @NotNull + private MapArchObjectFactory<MapArchObject> mapArchObjectFactory; + + /** * The {@link GameObjectParser} instance to use. */ @NotNull @@ -104,8 +111,9 @@ } /** {@inheritDoc} */ - public void init(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final MapActions mapActions, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { + public void init(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final MapActions mapActions, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { this.gridartaObjectsFactory = gridartaObjectsFactory; + this.mapArchObjectFactory = mapArchObjectFactory; this.gameObjectParser = gameObjectParser; this.rendererFactory = rendererFactory; this.mapActions = mapActions; @@ -127,7 +135,7 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Component parent, @NotNull final Size2D mapSize, @NotNull final String pickmapName, @NotNull final File file) { - final MapArchObject mapArchObject = gridartaObjectsFactory.newMapArchObject(true); + final MapArchObject mapArchObject = mapArchObjectFactory.newMapArchObject(true); mapArchObject.setMapSize(mapSize); mapArchObject.setMapName(pickmapName); final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl = new DefaultMapControl<GameObject, MapArchObject, Archetype, CMapViewBasic>(gridartaObjectsFactory, gameObjectParser, rendererFactory, parent, autojoinLists, mapImageCache, null, mapArchObject, true, exitTypeGameObjectMatcher, archetypeChooserModel, mapActions); Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -33,6 +33,7 @@ import daieditor.gui.map.DefaultRendererFactory; import daieditor.gui.prefs.NetPrefs; import daieditor.gui.prefs.ResPrefs; +import daieditor.map.DefaultMapArchObjectFactory; import daieditor.map.DefaultMapControlFactory; import daieditor.map.MapArchObject; import daieditor.map.validation.checks.ExitChecker; @@ -74,6 +75,7 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.gui.utils.GUIUtils; import net.sf.gridarta.io.GameObjectParser; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapControlFactory; import net.sf.gridarta.map.MapModel; @@ -158,6 +160,13 @@ /** {@inheritDoc} */ @NotNull @Override + protected MapArchObjectFactory<MapArchObject> newMapArchObjectFactory() { + return new DefaultMapArchObjectFactory(); + } + + /** {@inheritDoc} */ + @NotNull + @Override protected AppPrefsModel createAppPrefsModel() { return new AppPrefsModel( "../server/daimonin_server", @@ -201,8 +210,8 @@ /** {@inheritDoc} */ @NotNull @Override - protected NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newNewMapDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory) { - return new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, gridartaObjectsFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); + protected NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newNewMapDialogFactory(@NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory) { + return new NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(mapManager, mapArchObjectFactory, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPSIZE, IGUIConstants.DEF_MAPDIFFICULTY, true, true, IGUIConstants.DEF_PICKMAP_WIDTH, IGUIConstants.DEF_PICKMAP_HEIGHT); } /** {@inheritDoc} */ @@ -225,7 +234,7 @@ /** {@inheritDoc} */ @NotNull @Override - protected MapActions init1(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher) { + protected MapActions init1(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final ArchetypeTypeSet<GameObject, MapArchObject, Archetype> archetypeTypeSet, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher) { final int[] directionMap = new int[] { CommonConstants.NORTH_EAST, CommonConstants.SOUTH_EAST, @@ -237,7 +246,7 @@ CommonConstants.NORTH, }; final MapPropertiesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> mapPropertiesDialogFactory = new DefaultMapPropertiesDialogFactory(); - return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, getMainView(), getMainView(), gridartaObjectsFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, false, mapPropertiesDialogFactory); + return new DefaultMapActions<GameObject, MapArchObject, Archetype, CMapViewBasic>(ACTION_FACTORY, getMainView(), getMainView(), gridartaObjectsFactory, mapArchObjectFactory, globalSettings, mapManager, mapViewManager, exitMatcher, mapFileFilter, selectedSquareView, directionMap, false, mapPropertiesDialogFactory); } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java =================================================================== --- trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/daimonin/src/daieditor/DefaultGridartaObjectsFactory.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -30,8 +30,6 @@ import java.awt.Point; import java.io.File; import java.io.FileNotFoundException; -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; @@ -45,6 +43,7 @@ import net.sf.gridarta.gui.selectedsquare.SelectedSquareView; import net.sf.gridarta.io.DefaultMapReader; import net.sf.gridarta.io.MapReader; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -59,9 +58,6 @@ /** The action factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); - /** Preferences. */ - private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); - /** The {@link FaceObjects} instance to use. */ private FaceObjects faceObjects = null; @@ -97,20 +93,14 @@ @NotNull private ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette = null; - /** {@inheritDoc} */ + /** The {@link MapArchObjectFactory} instance. */ @NotNull - public MapArchObject newMapArchObject(final boolean addDefaultAttributes) { - final MapArchObject mapArchObject = new MapArchObject(); - if (addDefaultAttributes) { - mapArchObject.addText("Created: " + String.format("%tF", System.currentTimeMillis()) + " " + prefs.get(AbstractMainControl.PREFS_USERNAME, AbstractMainControl.PREFS_USERNAME_DEFAULT)); - } - return mapArchObject; - } + private MapArchObjectFactory<MapArchObject> mapArchObjectFactory; /** {@inheritDoc} */ @NotNull public MapReader<GameObject, MapArchObject> newMapReader(@NotNull final File file) throws FileNotFoundException { - return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, new GameObjectParser(new DefaultGameObjectFactory()), mainView, archetypeSet, editTypes, file); + return new DefaultMapReader<GameObject, MapArchObject, Archetype>(this, mapArchObjectFactory, new GameObjectParser(new DefaultGameObjectFactory()), mainView, archetypeSet, editTypes, file); } /** {@inheritDoc} */ @@ -131,7 +121,7 @@ } /** {@inheritDoc} */ - public void init(@NotNull final FaceObjects faceObjects, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette) { + public void init(@NotNull final FaceObjects faceObjects, @NotNull final SelectedSquareView<GameObject, MapArchObject, Archetype, CMapViewBasic> selectedSquareView, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final MainView<GameObject, MapArchObject, Archetype, CMapViewBasic> mainView, @NotNull final EditTypes<GameObject, MapArchObject, Archetype, CMapViewBasic> editTypes, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final ArchetypeSet<GameObject, MapArchObject, Archetype> archetypeSet, @NotNull final ToolPalette<GameObject, MapArchObject, Archetype, CMapViewBasic> toolPalette, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory) { this.faceObjects = faceObjects; this.selectedSquareView = selectedSquareView; this.mainControl = mainControl; @@ -140,6 +130,7 @@ this.mapImageCache = mapImageCache; this.archetypeSet = archetypeSet; this.toolPalette = toolPalette; + this.mapArchObjectFactory = mapArchObjectFactory; } /** {@inheritDoc} */ Modified: trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -31,6 +31,7 @@ import net.sf.gridarta.GridartaObjectsFactory; import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.map.MapPropertiesDialogFactory; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -55,8 +56,8 @@ * @param level map to show dialog about * @param mapFileFilter the Swing file filter to use */ - public void showDialog(final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { - final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, gridartaObjectsFactory, globalSettings, level, mapFileFilter); + public void showDialog(final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { + final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, gridartaObjectsFactory, mapArchObjectFactory, globalSettings, level, mapFileFilter); final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); pane.dialog = dialog; dialog.getRootPane().setDefaultButton(pane.okButton); Modified: trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/daimonin/src/daieditor/gui/map/MapPropertiesDialog.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -55,6 +55,7 @@ import net.sf.gridarta.Size2D; import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.help.Help; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; import net.sf.japi.swing.misc.JFileChooserButton; @@ -161,11 +162,12 @@ * @param helpParent the parent frame for help windows * @param mapManager the map manager to use * @param gridartaObjectsFactory the gridarta objects factory instance + * @param mapArchObjectFactory the map arch object factory instance * @param globalSettings the global settings instance * @param mapControl The level whose properties are shown/edited. * @param mapFileFilter the Swing file filter to use */ - public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + public MapPropertiesDialog(@NotNull final JFrame helpParent, @NotNull final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { okButton.setDefaultCapable(true); setOptions(new Object[] {helpButton, okButton, restoreButton, cancelButton}); @@ -180,7 +182,7 @@ final JPanel mainPanel = createMainPanel(map); tabs.add(ACTION_FACTORY.getString("mapMapTabTitle"), mainPanel); - mapTilePane = new MapTilePane(mapManager, gridartaObjectsFactory, globalSettings, mapControl, mapFileFilter); + mapTilePane = new MapTilePane(mapManager, gridartaObjectsFactory, mapArchObjectFactory, globalSettings, mapControl, mapFileFilter); final JPanel tilePanel = createTilePathPanel(mapTilePane); tabs.add(ACTION_FACTORY.getString("mapTilesTabTitle"), tilePanel); Modified: trunk/daimonin/src/daieditor/gui/map/MapTilePane.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/MapTilePane.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/daimonin/src/daieditor/gui/map/MapTilePane.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -29,6 +29,7 @@ import net.sf.gridarta.MapManager; import net.sf.gridarta.gui.DirectionLayout; import net.sf.gridarta.gui.map.AbstractMapTilePane; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import org.jetbrains.annotations.NotNull; @@ -107,13 +108,14 @@ * Create a MapTilePane. * @param mapManager the map manager to use * @param gridartaObjectsFactory the gridarta objects factory instance + * @param mapArchObjectFactory the map arch object factory instance * @param globalSettings the global settings instance * @param mapControl MapControl of the map that's tiles are to be viewed / * controlled * @param mapFileFilter the Swing file filter to use */ - public MapTilePane(final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { - super(mapManager, gridartaObjectsFactory, globalSettings, mapControl, tileLink, directionMapping, nextFocus, mapFileFilter); + public MapTilePane(final MapManager<?, MapArchObject, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, MapArchObject, ?, ?> gridartaObjectsFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mapControl, final FileFilter mapFileFilter) { + super(mapManager, gridartaObjectsFactory, mapArchObjectFactory, globalSettings, mapControl, tileLink, directionMapping, nextFocus, mapFileFilter); } } // class MapTilePane Added: trunk/daimonin/src/daieditor/map/DefaultMapArchObjectFactory.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapArchObjectFactory.java (rev 0) +++ trunk/daimonin/src/daieditor/map/DefaultMapArchObjectFactory.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -0,0 +1,51 @@ +/* + * 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.map; + +import java.util.prefs.Preferences; +import net.sf.gridarta.AbstractMainControl; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.map.MapArchObjectFactory; + +/** + * Factory to create {@link MapArchObject} instances. + * @author Andreas Kirschbaum + */ +public class DefaultMapArchObjectFactory implements MapArchObjectFactory<MapArchObject> { + + /** Preferences. */ + private static final Preferences prefs = Preferences.userNodeForPackage(MainControl.class); + + /** + * Creates a new instance. + */ + public DefaultMapArchObjectFactory() { + } + + /** {@inheritDoc} */ + public MapArchObject newMapArchObject(final boolean addDefaultAttributes) { + final MapArchObject mapArchObject = new MapArchObject(); + if (addDefaultAttributes) { + mapArchObject.addText("Created: " + String.format("%tF", System.currentTimeMillis()) + " " + prefs.get(AbstractMainControl.PREFS_USERNAME, AbstractMainControl.PREFS_USERNAME_DEFAULT)); + } + return mapArchObject; + } + +} // class DefaultMapArchObjectFactory Property changes on: trunk/daimonin/src/daieditor/map/DefaultMapArchObjectFactory.java ___________________________________________________________________ Added: svn:mime-type + text/plain Added: svn:eol-style + LF Modified: trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java =================================================================== --- trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/daimonin/src/daieditor/map/DefaultMapControlFactory.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -36,6 +36,7 @@ import net.sf.gridarta.io.GameObjectParser; import net.sf.gridarta.map.AbstractMapControlFactory; import net.sf.gridarta.map.DefaultMapControl; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapControlFactory; import org.jetbrains.annotations.NotNull; @@ -54,6 +55,12 @@ private GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory; /** + * The {@link MapArchObjectFactory} instance to use. + */ + @NotNull + private MapArchObjectFactory<MapArchObject> mapArchObjectFactory; + + /** * The {@link GameObjectParser} instance to use. */ @NotNull @@ -104,8 +111,9 @@ } /** {@inheritDoc} */ - public void init(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final MapActions mapActions, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { + public void init(@NotNull final GridartaObjectsFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gridartaObjectsFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GameObjectParser<GameObject, MapArchObject, Archetype> gameObjectParser, @NotNull final RendererFactory<GameObject, MapArchObject, Archetype> rendererFactory, @NotNull final MapActions mapActions, @NotNull final ArchetypeChooserModel<GameObject, MapArchObject, Archetype, CMapViewBasic> archetypeChooserModel, @NotNull final MapImageCache<GameObject, MapArchObject, Archetype, CMapViewBasic> mapImageCache, @NotNull final AutojoinLists<GameObject, MapArchObject, Archetype> autojoinLists, @NotNull final GameObjectMatcher exitTypeGameObjectMatcher) { this.gridartaObjectsFactory = gridartaObjectsFactory; + this.mapArchObjectFactory = mapArchObjectFactory; this.gameObjectParser = gameObjectParser; this.rendererFactory = rendererFactory; this.mapActions = mapActions; @@ -127,7 +135,7 @@ /** {@inheritDoc} */ @NotNull public MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> newPickmapControl(@NotNull final Component parent, @NotNull final Size2D mapSize, @NotNull final String pickmapName, @NotNull final File file) { - final MapArchObject mapArchObject = gridartaObjectsFactory.newMapArchObject(true); + final MapArchObject mapArchObject = mapArchObjectFactory.newMapArchObject(true); mapArchObject.setMapSize(mapSize); mapArchObject.setMapName(pickmapName); mapArchObject.setDifficulty(1); Modified: trunk/src/app/net/sf/gridarta/AbstractMainControl.java =================================================================== --- trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/src/app/net/sf/gridarta/AbstractMainControl.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -103,6 +103,7 @@ import net.sf.gridarta.map.AutoValidator; import net.sf.gridarta.map.InsertionMode; import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.gridarta.map.MapControlFactory; import net.sf.gridarta.map.validation.DelegatingMapValidator; @@ -330,7 +331,8 @@ final ArchetypeSet<G, A, R> archetypeSet = newArchetypeSet(globalSettings, editTypes, animationObjects, faceObjects, gridartaObjectsFactory); ScriptedEvent.init(archetypeSet); PathManager.setGlobalSettings(globalSettings); - newMapDialogFactory = newNewMapDialogFactory(mapManager, gridartaObjectsFactory); + final MapArchObjectFactory<A> mapArchObjectFactory = newMapArchObjectFactory(); + newMapDialogFactory = newNewMapDialogFactory(mapManager, mapArchObjectFactory); final boolean mapTileListBottom = prefs.getBoolean(MainView.MAP_TILE_LIST_BOTTOM_KEY, MainView.MAP_TILE_LIST_BOTTOM_DEFAULT); final MapManagerActions<G, A, R, V> mapManagerActions = new MapManagerActions<G, A, R, V>(mapManager); final ArchetypeChooserModel<G, A, R, V> archetypeChooserModel = new ArchetypeChooserModel<G, A, R, V>(archetypeSet); @@ -403,7 +405,7 @@ log.fatal("GameObjectMatcher 'exit' does not exist"); throw new MissingResourceException("GameObjectMatcher 'exit' does not exist", null, null); } - final MapActions mapActions = init1(gridartaObjectsFactory, globalSettings, mapManager, archetypeTypeSet, selectedSquareView, exitMatcher); + final MapActions mapActions = init1(gridartaObjectsFactory, mapArchObjectFactory, globalSettings, mapManager, archetypeTypeSet, selectedSquareView, exitMatcher); Map<String, TreasureTreeNode> specialTreasureLists; try { final Document specialTreasureListsDocument = xmlHelper.getDocumentBuilder().parse(IOUtils.getResourceURLAsString(globalSettings.getConfigurationDirectory(), "TreasureLists.xml")); @@ -451,9 +453,9 @@ final GameObjectParser<G, A, R> gameObjectParser = newGameObjectParser(gameObjectFactory); archetypeSet.init(gameObjectParser); final AbstractArchetypeParser<G, A, R> archetypeParser = newArchetypeParser(gameObjectParser, archetypeChooserControl, animationObjects, archetypeSet, gameObjectFactory); - gridartaObjectsFactory.init(faceObjects, selectedSquareView, this, mainView, editTypes, mapImageCache, archetypeSet, toolPalette); - mapControlFactory.init(gridartaObjectsFactory, gameObjectParser, rendererFactory, mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitMatcher); - copyBuffer.init(gridartaObjectsFactory.newMapArchObject(false), mainView); + gridartaObjectsFactory.init(faceObjects, selectedSquareView, this, mainView, editTypes, mapImageCache, archetypeSet, toolPalette, mapArchObjectFactory); + mapControlFactory.init(gridartaObjectsFactory, mapArchObjectFactory, gameObjectParser, rendererFactory, mapActions, archetypeChooserModel, mapImageCache, autojoinLists, exitMatcher); + copyBuffer.init(mapArchObjectFactory.newMapArchObject(false), mainView); GameObject.initialize(archetypeSet, archetypeTypeSet, gameObjectMatchers, animationObjects, SystemIcons.getNofaceTileIcon()); init4(gameObjectParser, archetypeParser, editTypes, faceObjects, animationObjects, mainView, globalSettings, archetypeSet); @@ -489,6 +491,9 @@ } @NotNull + protected abstract MapArchObjectFactory<A> newMapArchObjectFactory(); + + @NotNull protected abstract AppPrefsModel createAppPrefsModel(); @NotNull @@ -511,7 +516,7 @@ protected abstract CFTreasureListTree<G, A, R> createTreasureListTree(@NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull Map<String, TreasureTreeNode> specialTreasureLists); @NotNull - protected abstract MapActions init1(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher); + protected abstract MapActions init1(@NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final ArchetypeTypeSet<G, A, R> archetypeTypeSet, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull final GameObjectMatcher exitMatcher); protected abstract void init4(@NotNull final GameObjectParser<G, A, R> gameObjectParser, @NotNull final AbstractArchetypeParser<G, A, R> archetypeParser, @NotNull final EditTypes<G, A, R, V> editTypes, @NotNull final FaceObjects faceObjects, @NotNull final AnimationObjects<? extends AnimationObject> animationObjects, final MainView<G, A, R, V> mainView, @NotNull final GlobalSettings globalSettings, @NotNull final ArchetypeSet<G, A, R> archetypeSet); @@ -528,11 +533,11 @@ /** * Creates a new {@link NewMapDialogFactory} instance. * @param mapManager the map manager instance - * @param gridartaObjectsFactory the gridarta objects factory instance + * @param mapArchObjectFactory the map arch object factory instance * @return the new new map dialog factory instance */ @NotNull - protected abstract NewMapDialogFactory<G, A, R, V> newNewMapDialogFactory(@NotNull final MapManager<G, A, R, V> mapManager, @NotNull final GridartaObjectsFactory<G, A, R, V> gridartaObjectsFactory); + protected abstract NewMapDialogFactory<G, A, R, V> newNewMapDialogFactory(@NotNull final MapManager<G, A, R, V> mapManager, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory); /** * Creates an {@link ArchetypeSet} instance. Modified: trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/src/app/net/sf/gridarta/GridartaObjectsFactory.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -35,6 +35,7 @@ import net.sf.gridarta.io.MapArchObjectParser; import net.sf.gridarta.io.MapReader; import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -46,15 +47,6 @@ public interface GridartaObjectsFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { /** - * Create a new {@link MapArchObject} instance. - * @param addDefaultAttributes if set, add default attributes such as - * "Created:" - * @return The new map arch object. - */ - @NotNull - A newMapArchObject(boolean addDefaultAttributes); - - /** * Open a file for reading it as a map. * @param file File to open. * @return The new map reader. @@ -98,8 +90,9 @@ * @param mapImageCache the map image cache instance * @param archetypeSet the archetype set instance * @param toolPalette the tool palette instance + * @param mapArchObjectFactory the map arch object factory instance */ - void init(@NotNull FaceObjects faceObjects, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull MainView<G, A, R, V> mainView, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ToolPalette<G, A, R, V> toolPalette); + void init(@NotNull FaceObjects faceObjects, @NotNull final SelectedSquareView<G, A, R, V> selectedSquareView, @NotNull MainControl<G, A, R, V> mainControl, @NotNull MainView<G, A, R, V> mainView, @NotNull EditTypes<G, A, R, V> editTypes, @NotNull MapImageCache<G, A, R, V> mapImageCache, @NotNull ArchetypeSet<G, A, R> archetypeSet, @NotNull ToolPalette<G, A, R, V> toolPalette, @NotNull MapArchObjectFactory<A> mapArchObjectFactory); void setFilterControl(@NotNull FilterControl<G, A, R, V> filterControl); Modified: trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java 2008-10-03 10:09:43 UTC (rev 5400) +++ trunk/src/app/net/sf/gridarta/gui/map/AbstractMapTilePane.java 2008-10-03 10:55:59 UTC (rev 5401) @@ -46,6 +46,7 @@ import net.sf.gridarta.gui.GUIConstants; import net.sf.gridarta.io.IOUtils; import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.map.MapArchObjectFactory; import net.sf.gridarta.map.MapControl; import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; @@ -77,6 +78,12 @@ private final GridartaObjectsFactory<?, A, ?, ?> gridartaObjectsFactory; /** + * The map arch object factory instance. + */ + @NotNull + private final MapArchObjectFactory<A> mapArchObjectFactory; + + /** * The global settings instance. */ @NotNull @@ -131,11 +138,13 @@ * Create an AbstractMapTilePane. * @param mapManager the map manager to use * @param gridartaObjectsFactory the gridarta objects factory instance + * @param mapArchObjectFactory the map arch object facotry instance * @param globalSettings the global settings instance */ - private AbstractMapTilePane(final MapManager<?, A, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, A, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final int[][][] tileLink, final DirectionLayout.Direction[] directionMapping, final int[] nextFocus, final FileFilter mapFileFilter) { + private AbstractMapTilePane(final MapManager<?, A, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, A, ?, ?> gridartaObjectsFactory, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, final int[][][] tileLink, final DirectionLayout.Direction[] directionMapping, final int[] nextFocus, final FileFilter mapFileFilter) { this.mapManager = mapManager; this.gridartaObjectsFactory = gridartaObjectsFactory; + this.mapArchObjectFactory = mapArchObjectFactory; this.globalSettings = globalSettings; this.tileLink = tileLink; this.directionMapping = directionMapping; @@ -149,12 +158,13 @@ * Create an AbstractMapTilePane. * @param mapManager the map manager to use * @param gridartaObjectsFactory the gridarta objects factory instance + * @param mapArchObjectFactory the map arch object facotry instance * @param globalSettings the global settings instance * @param mapControl MapControl of the map that's tiles are to be viewed / * controlled */ - protected AbstractMapTilePane(final MapManager<?, A, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, A, ?, ?> gridartaObjectsFactory, @NotNull final GlobalSettings globalSettings, final MapControl<?, A, ?, ?> mapControl, final int[][][] tileLink, final DirectionLayout.Direction[] directionMapping, final int[] nextFocus, final FileFilter mapFileFilter) { - this(mapManager, gridartaObjectsFactory, globalSettings, tileLink, directionMapping, nextFocus, mapFileFilter); + protected AbstractMapTilePane(final MapManager<?, A, ?, ?> mapManager, @NotNull final GridartaObjectsFactory<?, A, ?, ?> gridartaObjectsFactory, @NotNull final MapArchObjectFactory<A> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, final MapControl<?, A, ?, ?> mapControl, final int[][][] tileLink, final DirectionLayout.Direction[] directionMapping, final int[] nex... [truncated message content] |
From: <aki...@us...> - 2008-10-03 11:49:42
|
Revision: 5404 http://gridarta.svn.sourceforge.net/gridarta/?rev=5404&view=rev Author: akirschbaum Date: 2008-10-03 11:49:34 +0000 (Fri, 03 Oct 2008) Log Message: ----------- Merge redundant comments. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java Modified: trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java 2008-10-03 11:47:38 UTC (rev 5403) +++ trunk/crossfire/src/cfeditor/gui/map/DefaultMapPropertiesDialogFactory.java 2008-10-03 11:49:34 UTC (rev 5404) @@ -46,18 +46,7 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); - /** - * Show a dialog querying the user for map properties. - * @param parent the parent component to show dialog on - * @param helpParent the parent frame for help windows - * @param mapManager the map manager to use - * @param mapArchObjectParserFactory the map arch object parser factory - * instance - * @param mapArchObjectFactory the map arch object factory instance - * @param globalSettings the global settings instance - * @param level map to show dialog about - * @param mapFileFilter the Swing file filter to use - */ + /** {@inheritDoc} */ public void showDialog(final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapArchObjectParserFactory<MapArchObject> mapArchObjectParserFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, mapArchObjectParserFactory, mapArchObjectFactory, globalSettings, level, mapFileFilter); final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); Modified: trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java 2008-10-03 11:47:38 UTC (rev 5403) +++ trunk/daimonin/src/daieditor/gui/map/DefaultMapPropertiesDialogFactory.java 2008-10-03 11:49:34 UTC (rev 5404) @@ -46,17 +46,7 @@ /** Action Factory. */ private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); - /** - * Show a dialog querying the user for map properties. - * @param parent the parent component to show dialog on - * @param helpParent the parent frame for help windows - * @param mapManager the map manager to use - * @param mapArchObjectParserFactory the map arch object parser factory - * instance - * @param globalSettings the global settings instance - * @param level map to show dialog about - * @param mapFileFilter the Swing file filter to use - */ + /** {@inheritDoc} */ public void showDialog(final Component parent, @NotNull final JFrame helpParent, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final MapArchObjectParserFactory<MapArchObject> mapArchObjectParserFactory, @NotNull final MapArchObjectFactory<MapArchObject> mapArchObjectFactory, @NotNull final GlobalSettings globalSettings, final MapControl<GameObject, MapArchObject, Archetype, CMapViewBasic> level, final FileFilter mapFileFilter) { final MapPropertiesDialog pane = new MapPropertiesDialog(helpParent, mapManager, mapArchObjectParserFactory, mapArchObjectFactory, globalSettings, level, mapFileFilter); final JDialog dialog = pane.createDialog(parent, ACTION_FACTORY.format("mapTitle", level.getMapModel().getMapArchObject().getMapDisplayName(), level.getMapFileName())); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |