Gridarta Editor
MouseOpEvent.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.map.event;
21 
22 import java.awt.Point;
23 import java.util.EventObject;
30 import org.jetbrains.annotations.NotNull;
31 
37 public class MouseOpEvent<G extends GameObject<G, A, R>, A extends MapArchObject<A>, R extends Archetype<G, A, R>> extends EventObject {
38 
42  private static final long serialVersionUID = 1L;
43 
47  @NotNull
48  private final MapView<G, A, R> mapView;
49 
53  @NotNull
55 
59  @NotNull
61 
65  private Point mapLocation;
66 
71  private int button;
72 
77  private int id;
78 
83  private int modifiers;
84 
88  private int clickCount;
89 
93  public MouseOpEvent(@NotNull final MapView<G, A, R> mapView) {
94  super("");
95  this.mapView = mapView;
96  mapCursor = mapView.getMapCursor();
97  mapControl = mapView.getMapControl();
98  }
99 
104  @NotNull
106  return mapView;
107  }
108 
109  public Point getMapLocation() {
110  return mapLocation;
111  }
112 
113  public int getModifiers() {
114  return modifiers;
115  }
116 
117  @NotNull
119  return mapCursor;
120  }
121 
122  public int getClickCount() {
123  return clickCount;
124  }
125 
130  public int getButton() {
131  return button;
132  }
133 
138  public void setButton(final int button) {
139  this.button = button;
140  }
141 
142  public void setMapLocation(final Point mapLocation) {
143  this.mapLocation = mapLocation;
144  }
145 
146  public void setModifiers(final int modifiers) {
147  this.modifiers = modifiers;
148  }
149 
150  public void setClickCount(final int clickCount) {
151  this.clickCount = clickCount;
152  }
153 
154  @NotNull
156  return mapControl;
157  }
158 
164  public int getId() {
165  return id;
166  }
167 
172  public void setId(final int id) {
173  this.id = id;
174  }
175 
176 }
void setButton(final int button)
Sets the mouse button that changed.
Graphical User Interface of Gridarta.
void setClickCount(final int clickCount)
MapCursor provides methods to move and drag on map.
Definition: MapCursor.java:57
int modifiers
The modifiers during this event.
final MapControl< G, A, R > mapControl
The map control for this event.
Base package of all Gridarta classes.
final MapCursor< G, A, R > mapCursor
The cursor to use for this event.
Reflects a game object (object on a map).
Definition: GameObject.java:36
int getButton()
Return the mouse button that changed.
MouseOpEvent(@NotNull final MapView< G, A, R > mapView)
Create an empty MouseOpEvent.
void setMapLocation(final Point mapLocation)
GameObjects are the objects based on Archetypes found on maps.
Point mapLocation
The location of the point on the map model.
void setId(final int id)
Sets the event type.
Base classes for rendering maps.
Currently nothing more than a marker interface for unification.
Definition: MapControl.java:35
A MouseOpEvent is an event triggered for a MouseOpListener.
A map view consists of a map grid and a map cursor, and is attached to a map control.
Definition: MapView.java:43
MapView< G, A, R > getMapView()
Returns the map view on which this event occurred.
final MapView< G, A, R > mapView
The map view on which this event occurred.
int clickCount
The number of consecutive mouse clicks (only valid for click events).
static final long serialVersionUID
The serial version UID.
int button
The pressed mouse button.
int getId()
Returns the event type.