Gridarta Editor
BrowseArchetypesDialogManager.java
Go to the documentation of this file.
1 /*
2  * Gridarta MMORPG map editor for Crossfire, Daimonin and similar games.
3  * Copyright (C) 2000-2015 The Gridarta Developers.
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 package net.sf.gridarta.gui.dialog.browsearchetypes;
21 
22 import java.awt.Component;
23 import javax.swing.ImageIcon;
31 import org.jetbrains.annotations.NotNull;
32 import org.jetbrains.annotations.Nullable;
33 
38 public class BrowseArchetypesDialogManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends AbstractDialogManager {
39 
43  @NotNull
44  private final Object sync = new Object();
45 
50  @Nullable
52 
56  @NotNull
57  private final Component parent;
58 
62  @NotNull
64 
68  @NotNull
70 
74  @NotNull
76 
80  @NotNull
81  private final ImageIcon closingIcon;
82 
93  public BrowseArchetypesDialogManager(@NotNull final Component parent, @NotNull final ArchetypeChooserControl<G, A, R> archetypeChooserControl, @NotNull final ObjectChooser<G, A, R> objectChooser, @NotNull final ArchetypeSet<G, A, R> archetypeSet, @NotNull final ImageIcon closingIcon) {
94  this.parent = parent;
95  this.archetypeChooserControl = archetypeChooserControl;
96  this.objectChooser = objectChooser;
97  this.archetypeSet = archetypeSet;
98  this.closingIcon = closingIcon;
99  }
100 
101  @Override
102  public void showDialog() {
104  synchronized (sync) {
105  dialog = browseArchetypesDialog;
106  if (dialog == null) {
108  browseArchetypesDialog = dialog;
109  }
110  }
111  dialog.showDialog();
112  }
113 
114 }
BrowseArchetypesDialog< G, A, R > browseArchetypesDialog
The BrowseArchetypesDialog instance or.
Graphical User Interface of Gridarta.
Reading and writing of Atrinik maps.
final ObjectChooser< G, A, R > objectChooser
The ObjectChooser to use when selecting search results.
BrowseArchetypesDialogManager(@NotNull final Component parent, @NotNull final ArchetypeChooserControl< G, A, R > archetypeChooserControl, @NotNull final ObjectChooser< G, A, R > objectChooser, @NotNull final ArchetypeSet< G, A, R > archetypeSet, @NotNull final ImageIcon closingIcon)
Creates a new instance.
final ArchetypeSet< G, A, R > archetypeSet
The ArchetypeSet for looking up archetypes.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
Definition: GameObject.java:36
Abstract base class for classes managing a single dialog instance.
GameObjects are the objects based on Archetypes found on maps.
final ImageIcon closingIcon
The icon to display in the closing buttons of the archetype browser.
final ArchetypeChooserControl< G, A, R > archetypeChooserControl
The ArchetypeChooserControl to search.
final Object sync
The synchronization object for accessing browseArchetypesDialog.
Interface that captures similarities between different ArchetypeSet implementations.
Common base interface for ObjectChoosers.