Gridarta Editor
GoExitDialogManager.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.goexit;
21 
22 import java.awt.Window;
23 import javax.swing.Action;
35 import net.sf.japi.swing.action.ActionMethod;
36 import org.jetbrains.annotations.NotNull;
37 
42 public class GoExitDialogManager<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> implements EditorAction {
43 
47  @NotNull
48  private final Window parent;
49 
53  @NotNull
55 
59  @NotNull
61 
65  @NotNull
67 
71  @NotNull
72  private final EnterMap<G, A, R> enterMap;
73 
77  @NotNull
79 
90  public GoExitDialogManager(@NotNull final Window parent, @NotNull final MapManager<G, A, R> mapManager, @NotNull final MapViewManager<G, A, R> mapViewManager, @NotNull final GameObjectMatcher exitGameObjectMatcher, @NotNull final EnterMap<G, A, R> enterMap, @NotNull final FaceObjectProviders faceObjectProviders) {
91  this.parent = parent;
92  this.mapManager = mapManager;
93  this.mapViewManager = mapViewManager;
94  this.exitGameObjectMatcher = exitGameObjectMatcher;
95  this.enterMap = enterMap;
96  this.faceObjectProviders = faceObjectProviders;
97  }
98 
102  @ActionMethod
103  public void goExit() {
104  final MapControl<G, A, R> mapControl = mapManager.getCurrentMap();
105  if (mapControl == null) {
106  return;
107  }
108 
109  final MapView<G, A, R> mapView = mapViewManager.getActiveMapView();
110  if (mapView == null) {
111  return;
112  }
114  }
115 
116  @Override
117  public void setAction(@NotNull final Action action, @NotNull final String name) {
118  }
119 
120 }
final MapManager< G, A, R > mapManager
The map manager to use.
final EnterMap< G, A, R > enterMap
The EnterMap instance to use.
A MapManager manages all opened maps.
Definition: MapManager.java:37
Graphical User Interface of Gridarta.
Interface for classes that match GameObjects.
This package contains classes related to matching GameObjects, so called GameObjectMatchers.
final Window parent
The parent Window for go map dialogs.
final GameObjectMatcher exitGameObjectMatcher
The GameObjectMatcher for selecting exits.
void setAction(@NotNull final Action action, @NotNull final String name)
Sets the Action instance for this editor action.
Base package of all Gridarta classes.
Reflects a game object (object on a map).
Definition: GameObject.java:36
final MapViewManager< G, A, R > mapViewManager
The MapViewManager instance.
A global editor action.
GameObjects are the objects based on Archetypes found on maps.
final FaceObjectProviders faceObjectProviders
The FaceObjectProviders for looking up faces.
MapView< G, A, R > getActiveMapView()
Returns the active top map view we are working with.
Base classes for rendering maps.
MapControl< G, A, R > getCurrentMap()
Returns the current map.
Provider for faces of GameObjects and Archetypes.
The face is the appearance of an object.
Currently nothing more than a marker interface for unification.
Definition: MapControl.java:35
A map view consists of a map grid and a map cursor, and is attached to a map control.
Definition: MapView.java:43
Helper class for entering maps.
Definition: EnterMap.java:52
void goExit()
Action method to open the "go exit" dialog.
A dialog to ask the user for a map to open.
GoExitDialogManager(@NotNull final Window parent, @NotNull final MapManager< G, A, R > mapManager, @NotNull final MapViewManager< G, A, R > mapViewManager, @NotNull final GameObjectMatcher exitGameObjectMatcher, @NotNull final EnterMap< G, A, R > enterMap, @NotNull final FaceObjectProviders faceObjectProviders)
Creates a new instance.