 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.gui.item;
40 import java.awt.Dimension;
41 import java.awt.Image;
42 import org.jetbrains.annotations.NotNull;
43 import org.jetbrains.annotations.Nullable;
60 private final Object
sync =
new Object();
116 public void spellAdded(
final int index) {
117 synchronized (
sync) {
127 public void spellRemoved(
final int index) {
128 synchronized (
sync) {
152 public void faceUpdated(@NotNull
final Face face) {
174 public GUIItemSpell(@NotNull
final TooltipManager tooltipManager, @NotNull
final GUIElementListener elementListener, @NotNull
final CommandQueue commandQueue, @NotNull
final String
name, @NotNull
final ItemPainter itemPainter,
final int defaultIndex, @NotNull
final FacesManager facesManager, @NotNull
final SpellsManager spellsManager, @NotNull
final ItemView spellsView,
final int size, @NotNull
final GuiFactory guiFactory) {
206 synchronized (
sync) {
207 return index >= -distance;
211 synchronized (
sync) {
221 synchronized (
sync) {
280 @SuppressWarnings(
"MethodDoesntCallSuperMethod")
287 @SuppressWarnings(
"MethodDoesntCallSuperMethod")
298 return new Dimension(32, 32);
307 synchronized (
sync) {
311 if (
spell == newSpell) {
335 synchronized (
sync) {
336 if (this.index ==
index) {
368 synchronized (
sync) {
375 synchronized (
sync) {
Face getFace()
Returns the face.
void dispose()
Releases all allocated resources.
void removeSpellListener(@NotNull final SpellListener listener)
Removes a SpellListener to be notified of changes.
Maintains a mapping of face numbers to face data.
static final long serialVersionUID
The serial version UID.
final CommandQueue commandQueue
The command queue for sending commands.
Paints Crossfire item images.
void tooltipChanged()
Must be called whenever the tooltip may have changed.
GUIItemSpell(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final CommandQueue commandQueue, @NotNull final String name, @NotNull final ItemPainter itemPainter, final int defaultIndex, @NotNull final FacesManager facesManager, @NotNull final SpellsManager spellsManager, @NotNull final ItemView spellsView, final int size, @NotNull final GuiFactory guiFactory)
Creates a new instance.
boolean isSelected()
Returns whether this element should be drawn as "selected".
void removeFacesManagerListener(@NotNull FacesManagerListener facesManagerListener)
Removes a FacesManagerListener to be notified about updated faces.
Interface for listeners interested in Spell related events.
void button2Clicked(final int modifiers)
Called when the middle mouse button was pressed.
int getFaceNum()
Returns the face number.
ImageIcon getOriginalImageIcon(int faceNum, @Nullable AtomicBoolean returnIsUnknownImage)
Returns the "original" face for a face ID.
int getFaceNum()
Returns the unique face id.
static final int MASK
The mask for all used modifiers.
void setChanged()
Records that the contents have changed and must be repainted.
void resetScroll()
Resets the scroll index to the default value.
Image getFace(@NotNull final CfItem item)
Returns the face for a CfItem instance.
Interface for listeners interested in FacesManager events.
void setIndexNoListeners(final int index)
Sets the slot index to display without registering listeners for updates.
CfItem item
The current item instance.
void addSpellListener(@NotNull final SpellListener listener)
Adds a SpellListener to be notified of changes.
void notifyOpen()
Called each time the enclosing dialog is opened (or raised).
Manages image information ("faces") needed to display the map view, items, and spell icons.
final ItemPainter itemPainter
The ItemPainter for painting the icon.
boolean selected
Whether this element is selected in its GUISpellList.
Manages all known spells.
boolean isActive()
Returns whether a GUI element is active.
boolean canScroll(final int distance)
Returns whether scrolling is possible.
static Dimension getMinimumSizeInt()
Returns the minimal size to display this component.
int getFilteredSpellsCount()
Returns the number of currently shown spells.
Describes a Crossfire spell.
A GUIItemItem that represents an entry in a GUISpellList.
A GUIElement instance representing an in-game item.
The representation of a Crossfire Item, client-side.
Helper functions for keyboard modifiers.
Interface for listeners interested in SpellsManager events.
CfItem getItem(int index)
Returns the CfItem in a given slot.
void sendNcom(final boolean mustSend, @NotNull final String command)
Sends a "ncom" command to the server.
int getIndex()
Returns the slot index.
void button1Clicked(final int modifiers)
Called when the left mouse button was pressed.
final ItemView spellsView
The spells view to use.
void button3Clicked(final int modifiers)
Called when the right mouse button was pressed.
final GuiFactory guiFactory
The global GuiFactory instance.
final SpellsManager spellsManager
The SpellsManager instance to watch.
Dimension getMinimumSize()
void removeCrossfireSpellChangedListener(@NotNull final SpellsManagerListener listener)
Removes a SpellsManagerListener to notify about changes.
final GUIElementListener elementListener
The GUIElementListener to notify.
int index
The currently selected spell or.
static final int CTRL
The mask for "ctrl".
void setItemNoListeners(@Nullable final CfItem item)
Sets the current item instance without registering listeners for updates.
Factory for creating Gui instances.
final String name
The name of this element.
Spell spell
The currently selected spell or.
static final int NONE
The mask for "no modifier".
final FacesManager facesManager
The FacesManager for looking up faces.
void setSelected(final boolean selected)
Sets the selected state.
final SpellsManagerListener spellsManagerListener
The SpellsManagerListener used to detect spell changes.
void setSpell()
Sets the currently selected spell.
String getName()
Returns the spell name.
final TooltipManager tooltipManager
The TooltipManager to update.
Spell getFilteredSpell(final int index)
Returns a Spell instance by index.
void scroll(final int distance)
Scrolls the element.
final int defaultIndex
The default scroll index.
A GUIList to display spells.
final Object sync
The object used for synchronization on index.
void setIndex(final int index)
Sets the index of the currently selected spell.
final FacesManagerListener facesManagerListener
The FacesManagerListener registered to detect updated faces.
static final int SHIFT
The mask for "shift".
Maintains the pending (ncom) commands sent to the server.
Dimension getPreferredSize()
final SpellListener spellListener
The SpellListener attached to spell.
Listener for GUIElement related events.