Crossfire JXClient, Trunk  R20561
Shortcut.java
Go to the documentation of this file.
1 /*
2  * This file is part of JXClient, the Fullscreen Java Crossfire Client.
3  *
4  * JXClient is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * JXClient is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with JXClient; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  *
18  * Copyright (C) 2005-2008 Yann Chachkoff.
19  * Copyright (C) 2006-2011 Andreas Kirschbaum.
20  */
21 
22 package com.realtime.crossfire.jxclient.shortcuts;
23 
26 import org.jetbrains.annotations.NotNull;
27 
32 public abstract class Shortcut {
33 
37  @NotNull
39 
43  public abstract void dispose();
44 
48  public abstract void execute();
49 
54  public void addShortcutListener(@NotNull final ShortcutListener listener) {
55  listeners.add(listener);
56  }
57 
62  public void removeShortcutListener(@NotNull final ShortcutListener listener) {
63  listeners.add(listener);
64  }
65 
69  protected void fireModifiedEvent() {
70  for (final ShortcutListener listener : listeners) {
71  listener.shortcutModified();
72  }
73  }
74 
79  @NotNull
80  public abstract String getTooltipText();
81 
87  public abstract void visit(@NotNull final ShortcutVisitor visitor);
88 
94  public abstract boolean displaysFace(final Face face);
95 
96 }
abstract void visit(@NotNull final ShortcutVisitor visitor)
Calls a ShortcutVisitor's.
abstract void execute()
Executes the shortcut.
Manages image information ("faces") needed to display the map view, items, and spell icons...
abstract boolean displaysFace(final Face face)
Returns whether this shortcut displays the given face.
abstract String getTooltipText()
Returns the current tooltip text.
void removeShortcutListener(@NotNull final ShortcutListener listener)
Unregisters a shortcut listener.
Definition: Shortcut.java:62
void fireModifiedEvent()
Notifies all listeners about a modification.
Definition: Shortcut.java:69
void add(@NotNull final T listener)
Adds a listener.
Interface for visitors of Shortcut instances.
Interface for listeners for Shortcut changes.
Abstract base class for shortcut commands.
Definition: Shortcut.java:32
final EventListenerList2< ShortcutListener > listeners
The listeners to be notified.
Definition: Shortcut.java:38
void addShortcutListener(@NotNull final ShortcutListener listener)
Registers a shortcut listener.
Definition: Shortcut.java:54
abstract void dispose()
Releases all allocated resources.