20 package net.sf.gridarta.gui.dialog.gameobjectattributes;
22 import java.awt.Frame;
23 import java.awt.Window;
24 import java.util.HashMap;
26 import javax.swing.ImageIcon;
27 import javax.swing.JDialog;
28 import javax.swing.filechooser.FileFilter;
44 import net.
sf.japi.swing.action.ActionBuilder;
45 import net.
sf.japi.swing.action.ActionBuilderFactory;
46 import org.jetbrains.annotations.NotNull;
60 private static final ActionBuilder
ACTION_BUILDER = ActionBuilderFactory.getInstance().getActionBuilder(
"net.sf.gridarta");
67 private final Map<G, JDialog>
dialogs =
new HashMap<>();
192 public GameObjectAttributesDialogFactory(@NotNull
final ArchetypeTypeSet archetypeTypeSet, @NotNull
final Frame parent, @NotNull
final CFTreasureListTree treasureListTree, @NotNull
final FaceObjectProviders faceObjectProviders, @NotNull
final AnimationObjects animationObjects, @NotNull
final ProjectSettings projectSettings, @NotNull
final FileFilter mapFileFilter, @NotNull
final FileFilter scriptFileFilter, @NotNull
final FaceObjects faceObjects, @NotNull
final Spells<
GameObjectSpell<G, A, R>> gameObjectSpells, @NotNull
final Spells<NumberSpell> numberSpells,
final int undefinedSpellIndex, @NotNull
final TreasureTree treasureTree, @NotNull
final ImageIcon noFaceSquareIcon, @NotNull
final ImageIcon unknownSquareIcon, @NotNull
final TextAreaDefaults textAreaDefaults, @NotNull
final MapManager<G, A, R> mapManager) {
218 final G head = gameObject.getHead();
220 if (head.hasUndefinedArchetype()) {
221 ACTION_BUILDER.showMessageDialog(parent,
"openAttrDialogUndefinedArchetype");
226 if (dialogs.containsKey(head)) {
227 dialogs.get(head).toFront();
229 final GameObjectAttributesDialog<G, A, R> pane =
new GameObjectAttributesDialog<>(
this,
archetypeTypeSet, head,
parent,
treasureListTree,
faceObjectProviders,
animationObjects,
projectSettings,
mapFileFilter,
scriptFileFilter,
faceObjects,
gameObjectSpells,
numberSpells,
undefinedSpellIndex,
treasureTree,
noFaceSquareIcon,
unknownSquareIcon,
textAreaDefaults,
mapManager);
231 dialogs.put(head, dialog);
242 final Window dialog = dialogs.remove(gameObject);
243 if (dialog != null) {
GameObjectAttributesDialogFactory(@NotNull final ArchetypeTypeSet archetypeTypeSet, @NotNull final Frame parent, @NotNull final CFTreasureListTree treasureListTree, @NotNull final FaceObjectProviders faceObjectProviders, @NotNull final AnimationObjects animationObjects, @NotNull final ProjectSettings projectSettings, @NotNull final FileFilter mapFileFilter, @NotNull final FileFilter scriptFileFilter, @NotNull final FaceObjects faceObjects, @NotNull final Spells< GameObjectSpell< G, A, R >> gameObjectSpells, @NotNull final Spells< NumberSpell > numberSpells, final int undefinedSpellIndex, @NotNull final TreasureTree treasureTree, @NotNull final ImageIcon noFaceSquareIcon, @NotNull final ImageIcon unknownSquareIcon, @NotNull final TextAreaDefaults textAreaDefaults, @NotNull final MapManager< G, A, R > mapManager)
Creates a new instance.
A MapManager manages all opened maps.
Graphical User Interface of Gridarta.
Settings that apply to a project.
JDialog createDialog()
Creates a new JDialog instance for this dialog.
final ArchetypeTypeSet archetypeTypeSet
The list of CF type-data.
final int undefinedSpellIndex
The index for "no spell".
Manages ArchetypeType instances, list, and bitmask definitions.
final FileFilter scriptFileFilter
The FileFilter to use for script files.
Gridarta can handle frame information of animations and allow the selection of an animation using a t...
final FileFilter mapFileFilter
The FileFilter to use for map files.
final ProjectSettings projectSettings
The ProjectSettings instance.
A factory that creates dialogs for editing game object attributes.
final ImageIcon noFaceSquareIcon
The ImageIcon for no animations.
final Frame parent
The parent frame for showing dialog boxes.
Describes a numbered in-game spell.
Base package of all Gridarta classes.
Common base class for spells and spell lists.
final TextAreaDefaults textAreaDefaults
The TextAreaDefaults for text fields.
Reflects a game object (object on a map).
void hideAttributeDialog(@NotNull final G gameObject)
Hides the game object attributes dialog for a given GameObject instance.
final ImageIcon unknownSquareIcon
The ImageIcon for undefined animations.
AnimationObjects is a container for AnimationObjects.
GameObjects are the objects based on Archetypes found on maps.
final FaceObjectProviders faceObjectProviders
The FaceObjectProviders for looking up faces.
final Map< G, JDialog > dialogs
The gameObject objects that already are shown, to avoid opening a dialog twice.
The CFTreasureListTree class fully manages treasurelists.
Describes a numbered in-game spell.
This package contains the other part of the script editor.
Common base class for game object attributes dialogs.
FaceObjects is a container for FaceObjects.
final Spells< NumberSpell > numberSpells
The numbered spells.
final TreasureTree treasureTree
The TreasureTree to use.
Stores all defined treasure lists.
Provider for faces of GameObjects and Archetypes.
The face is the appearance of an object.
final Spells< GameObjectSpell< G, A, R > > gameObjectSpells
The game object spells to use.
final FaceObjects faceObjects
The FaceObjects instance for choosing face names.
final AnimationObjects animationObjects
The AnimationObjects instance for choosing animation names.
final MapManager< G, A, R > mapManager
The MapManager instance.
static final ActionBuilder ACTION_BUILDER
Action Builder.
void showAttributeDialog(@NotNull final G gameObject)
Shows the game object attributes dialog for a given GameObject instance.
Defines types of GameObjects with corresponding attributes.
final CFTreasureListTree treasureListTree
The CFTreasureListTree to display.
Interface for MapArchObjects.
Encapsulates default settings for a text area.