From: <aki...@us...> - 2008-07-26 07:14:05
|
Revision: 4466 http://gridarta.svn.sourceforge.net/gridarta/?rev=4466&view=rev Author: akirschbaum Date: 2008-07-26 07:14:11 +0000 (Sat, 26 Jul 2008) Log Message: ----------- Move GameObjectAttributesDialogFactory.showAttribDialog() to common code base. Modified Paths: -------------- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java Modified: trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:05:19 UTC (rev 4465) +++ trunk/crossfire/src/cfeditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:14:11 UTC (rev 4466) @@ -23,7 +23,6 @@ import cfeditor.gameobject.GameObject; import cfeditor.gui.map.CMapViewBasic; import cfeditor.map.MapArchObject; -import javax.swing.JDialog; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.MainControl; @@ -37,52 +36,7 @@ public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("cfeditor"); - /** - * @param archTypeList the list of CF type-data - */ - @NotNull - private final CFArchTypeList archTypeList; - - /** - * @param mainControl main control - */ - @NotNull - private final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl; - - /** - * @param animationObjects the animation objects instance to use - */ - @NotNull - private final AnimationObjects<?> animationObjects; - - /** - * @param mapManager the map manager - */ - @NotNull - private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; - - /** - * @param treasureListTree the treasure list tree instance to use - */ - @NotNull - private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; - - /** - * @param faceObjects the FaceObjects instance to use - */ - @NotNull - private final FaceObjects faceObjects; - - /** - * @param mapFileFilter the Swing file filter to use - */ - @NotNull - private final FileFilter mapFileFilter; - - /** * Creates a new instance. * @param archTypeList the list of CF type-data * @param mainControl main control @@ -93,33 +47,10 @@ * @param mapFileFilter the Swing file filter to use */ public GameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - this.archTypeList = archTypeList; - this.mainControl = mainControl; - this.animationObjects = animationObjects; - this.mapManager = mapManager; - this.treasureListTree = treasureListTree; - this.faceObjects = faceObjects; - this.mapFileFilter = mapFileFilter; + super(archTypeList, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } /** {@inheritDoc} */ - public void showAttribDialog(@NotNull final GameObject gameObject) { - synchronized (dialogs) { - if (dialogs.containsKey(gameObject)) { - dialogs.get(gameObject).toFront(); - } else { - final GameObjectAttributesDialog pane = newGameObjectAttributesDialog(archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); - final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); - dialog.getRootPane().setDefaultButton(pane.okButton); - dialog.setResizable(true); - dialog.setModal(false); - dialog.setVisible(true); - dialogs.put(pane.gameObject, dialog); - } - } - } - - /** {@inheritDoc} */ @Override protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); Modified: trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java =================================================================== --- trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:05:19 UTC (rev 4465) +++ trunk/daimonin/src/daieditor/gui/gameobjectattributesdialog/GameObjectAttributesDialogFactory.java 2008-07-26 07:14:11 UTC (rev 4466) @@ -23,7 +23,6 @@ import daieditor.gameobject.GameObject; import daieditor.gui.map.CMapViewBasic; import daieditor.map.MapArchObject; -import javax.swing.JDialog; import javax.swing.filechooser.FileFilter; import net.sf.gridarta.CFArchTypeList; import net.sf.gridarta.MainControl; @@ -37,52 +36,7 @@ public class GameObjectAttributesDialogFactory extends AbstractGameObjectAttributesDialogFactory<GameObject, MapArchObject, Archetype, CMapViewBasic> { - /** Action Factory. */ - private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("daieditor"); - /** - * @param archTypeList the list of CF type-data - */ - @NotNull - private final CFArchTypeList archTypeList; - - /** - * @param mainControl main control - */ - @NotNull - private final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl; - - /** - * @param animationObjects the animation objects instance to use - */ - @NotNull - private final AnimationObjects<?> animationObjects; - - /** - * @param mapManager the map manager - */ - @NotNull - private final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager; - - /** - * @param treasureListTree the treasure list tree instance to use - */ - @NotNull - private final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree; - - /** - * @param faceObjects the FaceObjects instance to use - */ - @NotNull - private final FaceObjects faceObjects; - - /** - * @param mapFileFilter the Swing file filter to use - */ - @NotNull - private final FileFilter mapFileFilter; - - /** * Creates a new instance. * @param archTypeList the list of CF type-data * @param mainControl main control @@ -93,33 +47,10 @@ * @param mapFileFilter the Swing file filter to use */ public GameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { - this.archTypeList = archTypeList; - this.mainControl = mainControl; - this.animationObjects = animationObjects; - this.mapManager = mapManager; - this.treasureListTree = treasureListTree; - this.faceObjects = faceObjects; - this.mapFileFilter = mapFileFilter; + super(archTypeList, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); } /** {@inheritDoc} */ - public void showAttribDialog(@NotNull final GameObject gameObject) { - synchronized (dialogs) { - if (dialogs.containsKey(gameObject)) { - dialogs.get(gameObject).toFront(); - } else { - final GameObjectAttributesDialog pane = newGameObjectAttributesDialog(archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); - final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); - dialog.getRootPane().setDefaultButton(pane.okButton); - dialog.setResizable(true); - dialog.setModal(false); - dialog.setVisible(true); - dialogs.put(pane.gameObject, dialog); - } - } - } - - /** {@inheritDoc} */ @Override protected GameObjectAttributesDialog newGameObjectAttributesDialog(@NotNull final CFArchTypeList archTypeList, @NotNull final GameObject gameObject, @NotNull final MainControl<GameObject, MapArchObject, Archetype, CMapViewBasic> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<GameObject, MapArchObject, Archetype, CMapViewBasic> mapManager, @NotNull final CFTreasureListTree<GameObject, MapArchObject, Archetype> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { return new GameObjectAttributesDialog(this, archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); Modified: trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java =================================================================== --- trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-26 07:05:19 UTC (rev 4465) +++ trunk/src/app/net/sf/gridarta/gui/gameobjectattributesdialog/AbstractGameObjectAttributesDialogFactory.java 2008-07-26 07:14:11 UTC (rev 4466) @@ -33,23 +33,104 @@ import net.sf.gridarta.gui.map.MapViewBasic; import net.sf.gridarta.map.MapArchObject; import net.sf.gridarta.treasurelist.CFTreasureListTree; +import net.sf.japi.swing.ActionFactory; import org.jetbrains.annotations.NotNull; public abstract class AbstractGameObjectAttributesDialogFactory<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>, V extends MapViewBasic<G, A, R, V>> { + /** Action Factory. */ + private static final ActionFactory ACTION_FACTORY = ActionFactory.getFactory("net.sf.gridarta"); + /** * The gameObject objects that already are shown, to avoid opening a dialog * twice. */ - protected final Map<G, JDialog> dialogs = new HashMap<G, JDialog>(); + private final Map<G, JDialog> dialogs = new HashMap<G, JDialog>(); /** + * @param archTypeList the list of CF type-data + */ + @NotNull + private final CFArchTypeList archTypeList; + + /** + * @param mainControl main control + */ + @NotNull + private final MainControl<G, A, R, V> mainControl; + + /** + * @param animationObjects the animation objects instance to use + */ + @NotNull + private final AnimationObjects<?> animationObjects; + + /** + * @param mapManager the map manager + */ + @NotNull + private final MapManager<G, A, R, V> mapManager; + + /** + * @param treasureListTree the treasure list tree instance to use + */ + @NotNull + private final CFTreasureListTree<G, A, R> treasureListTree; + + /** + * @param faceObjects the FaceObjects instance to use + */ + @NotNull + private final FaceObjects faceObjects; + + /** + * @param mapFileFilter the Swing file filter to use + */ + @NotNull + private final FileFilter mapFileFilter; + + /** + * Creates a new instance. + * @param archTypeList the list of CF type-data + * @param mainControl main control + * @param animationObjects the animation objects instance to use + * @param mapManager the map manager + * @param treasureListTree the treasure list tree instance to use + * @param faceObjects the FaceObjects instance to use + * @param mapFileFilter the Swing file filter to use + */ + protected AbstractGameObjectAttributesDialogFactory(@NotNull final CFArchTypeList archTypeList, @NotNull final MainControl<G, A, R, V> mainControl, @NotNull final AnimationObjects<?> animationObjects, @NotNull final MapManager<G, A, R, V> mapManager, @NotNull final CFTreasureListTree<G, A, R> treasureListTree, @NotNull final FaceObjects faceObjects, @NotNull final FileFilter mapFileFilter) { + this.archTypeList = archTypeList; + this.mainControl = mainControl; + this.animationObjects = animationObjects; + this.mapManager = mapManager; + this.treasureListTree = treasureListTree; + this.faceObjects = faceObjects; + this.mapFileFilter = mapFileFilter; + } + + /** * Shows the game object attributes dialog for a given {@link GameObject} * instance. * @param gameObject the GameObject to be displayed by this dialog */ - public abstract void showAttribDialog(@NotNull final G gameObject); + public void showAttribDialog(@NotNull final G gameObject) { + synchronized (dialogs) { + if (dialogs.containsKey(gameObject)) { + dialogs.get(gameObject).toFront(); + } else { + final AbstractGameObjectAttributesDialog<G, A, R> pane = newGameObjectAttributesDialog(archTypeList, gameObject, mainControl, animationObjects, mapManager, treasureListTree, faceObjects, mapFileFilter); + final JDialog dialog = pane.createDialog(mainControl.getMainView(), ACTION_FACTORY.getString("attribTitle")); + dialog.getRootPane().setDefaultButton(pane.okButton); + dialog.setResizable(true); + dialog.setModal(false); + dialog.setVisible(true); + dialogs.put(pane.gameObject, dialog); + } + } + } + /** * Hides the game object attributes dialog for a given {@link GameObject} * instance. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |