From: <aki...@us...> - 2008-07-30 20:44:12
|
Revision: 4596 http://gridarta.svn.sourceforge.net/gridarta/?rev=4596&view=rev Author: akirschbaum Date: 2008-07-30 20:44:10 +0000 (Wed, 30 Jul 2008) Log Message: ----------- Rename AbstractGameObjectAttributesDialogFactory to GameObjectAttributesDialogFactory since it is not abstract anymore. Modified Paths: -------------- trunk/crossfire/src/cfeditor/CMainControl.java trunk/daimonin/src/daieditor/CMainControl.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java Added Paths: ----------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java Removed Paths: ------------- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java Modified: trunk/crossfire/src/cfeditor/CMainControl.java =================================================================== --- trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-30 20:40:26 UTC (rev 4595) +++ trunk/crossfire/src/cfeditor/CMainControl.java 2008-07-30 20:44:10 UTC (rev 4596) @@ -73,7 +73,7 @@ import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.connectionview.LockedItemsControl; -import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialogFactory; +import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.tools.DeletionTool; @@ -206,10 +206,10 @@ private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; /** - * The {@link AbstractGameObjectAttributesDialogFactory} to use. + * The {@link GameObjectAttributesDialogFactory} to use. */ @NotNull - private final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory; + private final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory; @NotNull private final GameObjectAttributesPanel gameObjectAttributesPanel; @@ -366,7 +366,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, archetypeSet, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter, Archetype.TYPE_EVENT_CONNECTOR, 0, false); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, archetypeSet, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter, Archetype.TYPE_EVENT_CONNECTOR, 0, false); } /** Modified: trunk/daimonin/src/daieditor/CMainControl.java =================================================================== --- trunk/daimonin/src/daieditor/CMainControl.java 2008-07-30 20:40:26 UTC (rev 4595) +++ trunk/daimonin/src/daieditor/CMainControl.java 2008-07-30 20:44:10 UTC (rev 4596) @@ -81,7 +81,7 @@ import net.sf.gridarta.gui.SystemIcons; import net.sf.gridarta.gui.archetypechooser.ArchetypeChooserControl; import net.sf.gridarta.gui.connectionview.LockedItemsControl; -import net.sf.gridarta.gui.gameobjectattributesdialog.AbstractGameObjectAttributesDialogFactory; +import net.sf.gridarta.gui.gameobjectattributesdialog.GameObjectAttributesDialogFactory; import net.sf.gridarta.gui.map.MapCursorControl; import net.sf.gridarta.gui.map.MapView; import net.sf.gridarta.gui.map.tools.DeletionTool; @@ -261,10 +261,10 @@ private final NewMapDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> newMapDialogFactory; /** - * The {@link AbstractGameObjectAttributesDialogFactory} to use. + * The {@link GameObjectAttributesDialogFactory} to use. */ @NotNull - private final AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory; + private final GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> gameObjectAttributesDialogFactory; @NotNull private final GameObjectAttributesPanel gameObjectAttributesPanel; @@ -439,7 +439,7 @@ recentManager.initRecent(); validators = createMapValidators(); new AutoValidator<GameObject, MapArchObject, Archetype, CMapViewBasic>(this, PREFS_VALIDATOR_AUTO_DEFAULT); - gameObjectAttributesDialogFactory = new AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, archetypeSet, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter, 0, -1, true); + gameObjectAttributesDialogFactory = new GameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic>(archetypeTypeSet, this, archetypeSet, animationObjects, getMapManager(), treasureListTree, faceObjects, mapFileFilter, 0, -1, true); } /** Deleted: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-30 20:40:26 UTC (rev 4595) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-30 20:44:10 UTC (rev 4596) @@ -1,177 +0,0 @@ -/* - * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. - * Copyright (C) 2000-2007 The Gridarta Developers. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - */ - -package net.sf.gridarta.gui.gameobjectattributesdialog; - -import java.util.HashMap; -import java.util.Map; -import javax.swing.JDialog; -import javax.swing.filechooser.FileFilter; -import net.sf.gridarta.MainControl; -import net.sf.gridarta.MapManager; -import net.sf.gridarta.archtype.ArchetypeTypeSet; -import net.sf.gridarta.gameobject.Archetype; -import net.sf.gridarta.gameobject.ArchetypeSet; -import net.sf.gridarta.gameobject.GameObject; -import net.sf.gridarta.gameobject.anim.AnimationObjects; -import net.sf.gridarta.gameobject.face.FaceObjects; -import net.sf.gridarta.gui.map.MapViewBasic; -import net.sf.gridarta.map.MapArchObject; -import net.sf.gridarta.treasurelist.CFTreasureListTree; -import net.sf.japi.swing.ActionFactory; -import org.jetbrains.annotations.NotNull; - -public class AbstractGameObjectAttributesDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { - - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); - - /** - * The gameObject objects that already are shown, to avoid opening a dialog - * twice. - */ - private final Map<G, JDialog> dialogs = new HashMap<G, JDialog>(); - - /** - * The list of CF type-data. - */ - @NotNull - private final ArchetypeTypeSet archetypeTypeSet; - - /** - * The main control. - */ - @NotNull - private final MainControl<G, A, R, V> mainControl; - - /** - * The archetype set to use. - */ - @NotNull - private final ArchetypeSet<G, A, R> archetypeSet; - - /** - * The animation objects instance to use. - */ - @NotNull - private final AnimationObjects<?> animationObjects; - - /** - * The map manager. - */ - @NotNull - private final MapManager<G, A, R, V> mapManager; - - /** - * The treasure list tree instance to use. - */ - @NotNull - private final CFTreasureListTree<G, A, R> treasureListTree; - - /** - * The FaceObjects instance to use. - */ - @NotNull - private final FaceObjects faceObjects; - - /** - * The Swing file filter to use. - */ - @NotNull - private final FileFilter mapFileFilter; - - /** - * The object type for event objects. - */ - private final int typeNoEventConnector; - - /** - * The index used for "no" spell. - */ - private final int undefinedSpellIndex; - - /** - * Whether face names are included in the object text. - */ - private final boolean includeFaceText; - - /** - * Creates a new instance. - * @param archetypeTypeSet the list of CF type-data - * @param mainControl the main control - * @param archetypeSet the archetype set to use - * @param animationObjects the animation objects instance to use - * @param mapManager the map manager - * @param treasureListTree the treasure list tree instance to use - * @param faceObjects the FaceObjects instance to use - * @param mapFileFilter the Swing file filter to use - * @param typeNoEventConnector the object type for event objects - * @param undefinedSpellIndex the index used for "no" spell - * @param includeFaceText whether face names are included in the object - * text - */ - public AbstractGameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter, final int typeNoEventConnector, final int undefinedSpellIndex, final boolean includeFaceText) { - this.archetypeTypeSet = archetypeTypeSet; - this.mainControl = mainControl; - this.archetypeSet = archetypeSet; - this.animationObjects = animationObjects; - this.mapManager = mapManager; - this.treasureListTree = treasureListTree; - this.faceObjects = faceObjects; - this.mapFileFilter = mapFileFilter; - this.typeNoEventConnector = typeNoEventConnector; - this.undefinedSpellIndex = undefinedSpellIndex; - this.includeFaceText = includeFaceText; - } - - /** - * Shows the game object attributes dialog for a given {@link GameObject} - * instance. - * @param gameObject the GameObject to be displayed by this dialog - */ - public void showAttribDialog(@NotNull final G gameObject) { - synchronized (dialogs) { - if (dialogs.containsKey(gameObject)) { - dialogs.get(gameObject).toFront(); - } else { - final GameObjectAttributesDialog<G, A, R> pane = new GameObjectAttributesDialog(this, archetypeTypeSet, gameObject, mainControl, archetypeSet, mapManager, animationObjects, treasureListTree, faceObjects, mapFileFilter, typeNoEventConnector, undefinedSpellIndex, includeFaceText); - final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); - dialog.getRootPane().setDefaultButton(pane.okButton); - dialog.setResizable(true); - dialog.setModal(false); - dialog.setVisible(true); - dialogs.put(pane.gameObject, dialog); - } - } - } - - - /** - * Hides the game object attributes dialog for a given {@link GameObject} - * instance. - * @param gameObject the GameObject to be displayed by this dialog - */ - public void hideAttribDialog(@NotNull final G gameObject) { - final JDialog dialog = dialogs.remove(gameObject); - if (dialog != null) { - dialog.dispose(); - } - } - -} // class AbstractGameObjectAttributesDialogFactory Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-30 20:40:26 UTC (rev 4595) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialog.java 2008-07-30 20:44:10 UTC (rev 4596) @@ -142,7 +142,7 @@ * The associated factory. */ @NotNull - private final AbstractGameObjectAttributesDialogFactory<G, A, R, ?> gameObjectAttributesDialogFactory; + private final GameObjectAttributesDialogFactory<G, A, R, ?> gameObjectAttributesDialogFactory; /** Reference to the {@link ArchetypeTypeSet}. */ private final ArchetypeTypeSet archetypeTypeSet; @@ -252,7 +252,7 @@ * @param includeFaceText whether face names are included in the object * text */ - public GameObjectAttributesDialog(@NotNull final AbstractGameObjectAttributesDialogFactory<G, A, R, ?> gameObjectAttributesDialogFactory, final ArchetypeTypeSet archetypeTypeSet, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R, ?> mapManager, @NotNull final AnimationObjects<?> animationObjects, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter, final int typeNoEventConnector, final int undefinedSpellIndex, final boolean includeFaceText) { + public GameObjectAttributesDialog(@NotNull final GameObjectAttributesDialogFactory<G, A, R, ?> gameObjectAttributesDialogFactory, final ArchetypeTypeSet archetypeTypeSet, @NotNull final G gameObject, @NotNull final MainControl<G, A, R, ?> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final MapManager<G, A, R, ?> mapManager, @NotNull final AnimationObjects<?> animationObjects, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter, final int typeNoEventConnector, final int undefinedSpellIndex, final boolean includeFaceText) { this.gameObjectAttributesDialogFactory = gameObjectAttributesDialogFactory; this.archetypeTypeSet = archetypeTypeSet; this.typeNoEventConnector = typeNoEventConnector; Copied: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java (from rev 4595, trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java) =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java (rev 0) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-30 20:44:10 UTC (rev 4596) @@ -0,0 +1,177 @@ +/* + * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games. + * Copyright (C) 2000-2007 The Gridarta Developers. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + +package net.sf.gridarta.gui.gameobjectattributesdialog; + +import java.util.HashMap; +import java.util.Map; +import javax.swing.JDialog; +import javax.swing.filechooser.FileFilter; +import net.sf.gridarta.MainControl; +import net.sf.gridarta.MapManager; +import net.sf.gridarta.archtype.ArchetypeTypeSet; +import net.sf.gridarta.gameobject.Archetype; +import net.sf.gridarta.gameobject.ArchetypeSet; +import net.sf.gridarta.gameobject.GameObject; +import net.sf.gridarta.gameobject.anim.AnimationObjects; +import net.sf.gridarta.gameobject.face.FaceObjects; +import net.sf.gridarta.gui.map.MapViewBasic; +import net.sf.gridarta.map.MapArchObject; +import net.sf.gridarta.treasurelist.CFTreasureListTree; +import net.sf.japi.swing.ActionFactory; +import org.jetbrains.annotations.NotNull; + +public class GameObjectAttributesDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { + + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); + + /** + * The gameObject objects that already are shown, to avoid opening a dialog + * twice. + */ + private final Map<G, JDialog> dialogs = new HashMap<G, JDialog>(); + + /** + * The list of CF type-data. + */ + @NotNull + private final ArchetypeTypeSet archetypeTypeSet; + + /** + * The main control. + */ + @NotNull + private final MainControl<G, A, R, V> mainControl; + + /** + * The archetype set to use. + */ + @NotNull + private final ArchetypeSet<G, A, R> archetypeSet; + + /** + * The animation objects instance to use. + */ + @NotNull + private final AnimationObjects<?> animationObjects; + + /** + * The map manager. + */ + @NotNull + private final MapManager<G, A, R, V> mapManager; + + /** + * The treasure list tree instance to use. + */ + @NotNull + private final CFTreasureListTree<G, A, R> treasureListTree; + + /** + * The FaceObjects instance to use. + */ + @NotNull + private final FaceObjects faceObjects; + + /** + * The Swing file filter to use. + */ + @NotNull + private final FileFilter mapFileFilter; + + /** + * The object type for event objects. + */ + private final int typeNoEventConnector; + + /** + * The index used for "no" spell. + */ + private final int undefinedSpellIndex; + + /** + * Whether face names are included in the object text. + */ + private final boolean includeFaceText; + + /** + * Creates a new instance. + * @param archetypeTypeSet the list of CF type-data + * @param mainControl the main control + * @param archetypeSet the archetype set to use + * @param animationObjects the animation objects instance to use + * @param mapManager the map manager + * @param treasureListTree the treasure list tree instance to use + * @param faceObjects the FaceObjects instance to use + * @param mapFileFilter the Swing file filter to use + * @param typeNoEventConnector the object type for event objects + * @param undefinedSpellIndex the index used for "no" spell + * @param includeFaceText whether face names are included in the object + * text + */ + public GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter, final int typeNoEventConnector, final int undefinedSpellIndex, final boolean includeFaceText) { + this.archetypeTypeSet = archetypeTypeSet; + this.mainControl = mainControl; + this.archetypeSet = archetypeSet; + this.animationObjects = animationObjects; + this.mapManager = mapManager; + this.treasureListTree = treasureListTree; + this.faceObjects = faceObjects; + this.mapFileFilter = mapFileFilter; + this.typeNoEventConnector = typeNoEventConnector; + this.undefinedSpellIndex = undefinedSpellIndex; + this.includeFaceText = includeFaceText; + } + + /** + * Shows the game object attributes dialog for a given {@link GameObject} + * instance. + * @param gameObject the GameObject to be displayed by this dialog + */ + public void showAttribDialog(@NotNull final G gameObject) { + synchronized (dialogs) { + if (dialogs.containsKey(gameObject)) { + dialogs.get(gameObject).toFront(); + } else { + final GameObjectAttributesDialog<G, A, R> pane = new GameObjectAttributesDialog(this, archetypeTypeSet, gameObject, mainControl, archetypeSet, mapManager, animationObjects, treasureListTree, faceObjects, mapFileFilter, typeNoEventConnector, undefinedSpellIndex, includeFaceText); + final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); + dialog.getRootPane().setDefaultButton(pane.okButton); + dialog.setResizable(true); + dialog.setModal(false); + dialog.setVisible(true); + dialogs.put(pane.gameObject, dialog); + } + } + } + + + /** + * Hides the game object attributes dialog for a given {@link GameObject} + * instance. + * @param gameObject the GameObject to be displayed by this dialog + */ + public void hideAttribDialog(@NotNull final G gameObject) { + final JDialog dialog = dialogs.remove(gameObject); + if (dialog != null) { + dialog.dispose(); + } + } + +} // class GameObjectAttributesDialogFactory Property changes on: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.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. |