 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.gui.item;
38 import java.awt.Image;
39 import javax.swing.SwingUtilities;
40 import org.jetbrains.annotations.NotNull;
92 private final Object
sync =
new Object();
112 public void locationChanged() {
142 public GUIItemInventory(@NotNull
final TooltipManager tooltipManager, @NotNull
final GUIElementListener elementListener, @NotNull
final CommandQueue commandQueue,
final String
name, @NotNull
final ItemPainter itemPainter,
final int index, @NotNull
final CrossfireServerConnection crossfireServerConnection, @NotNull
final FacesManager facesManager, @NotNull
final FloorView floorView, @NotNull
final ItemView inventoryView,
final int size, @NotNull
final GuiFactory guiFactory) {
165 synchronized (
sync) {
166 return index >= -distance;
170 synchronized (
sync) {
180 synchronized (
sync) {
277 synchronized (
sync) {
287 synchronized (
sync) {
288 if (this.index ==
index) {
292 if (this.index >= 0) {
296 if (this.index >= 0) {
306 synchronized (
sync) {
323 synchronized (
sync) {
Face getFace()
Returns the face.
Maintains a mapping of face numbers to face data.
Paints Crossfire item images.
void tooltipChanged()
Must be called whenever the tooltip may have changed.
Interface for listeners interested in drawinfo messages received from the Crossfire server.
void sendApply(int tag)
Sends an "apply" command to the server.
boolean isLocked()
Returns whether this item is locked.
void setIndexNoListeners(final int index)
Sets the slot index to display without registering listeners for updates.
void addLocationListener(int index, @NotNull LocationListener locationListener)
Adds a LocationListener to be notified when the item displayed in a floor slot has changed.
static final long serialVersionUID
The serial version UID.
int getCurrentFloorTag()
Returns the current floor location.
void removeLocationListener(int index, @NotNull LocationListener locationListener)
Removes a LocationListener to be notified when the item displayed in a floor slot has changed.
CfItem getItem()
Returns the current item instance.
ImageIcon getOriginalImageIcon(int faceNum, @Nullable AtomicBoolean returnIsUnknownImage)
Returns the "original" face for a face ID.
int getFaceNum()
Returns the unique face id.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
A GUIItem for displaying inventory objects.
void button1Clicked(final int modifiers)
Called when the left mouse button was pressed.
static final int MASK
The mask for all used modifiers.
Interface for listeners for changes of item locations.
final Runnable locationListenerEdt
Called from locationListener but runs on the EDT.
void button3Clicked(final int modifiers)
Called when the right mouse button was pressed.
final CommandQueue commandQueue
The command queue for sending commands.
void setItem(@Nullable final CfItem item)
Sets the current item instance.
CfItem item
The current item instance.
Manages image information ("faces") needed to display the map view, items, and spell icons.
final Object sync
The object used for synchronization on index.
final ItemPainter itemPainter
The ItemPainter for painting the icon.
void sendExamine(int tag)
Sends an "examine" command to the server.
GUIItemInventory(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final CommandQueue commandQueue, final String name, @NotNull final ItemPainter itemPainter, final int index, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final FacesManager facesManager, @NotNull final FloorView floorView, @NotNull final ItemView inventoryView, final int size, @NotNull final GuiFactory guiFactory)
Creates a new instance.
void sendMove(final int to, final int tag)
Sends a "move" command to the server.
void sendMark(int tag)
Sends a "mark" command to the server.
boolean isActive()
Returns whether a GUI element is active.
final ItemView inventoryView
The inventory view to watch.
final int defaultIndex
The default scroll index.
final LocationListener locationListener
The ItemListener used to detect items added to or removed from this inventory slot.
final FacesManager facesManager
The FacesManager instance to use.
int NDI_RED
A message color.
A GUIElement instance representing an in-game item.
The representation of a Crossfire Item, client-side.
Helper functions for keyboard modifiers.
int getTag()
Returns the tag.
void setIndex(final int index)
Set the inventory slot to display.
CfItem getItem(int index)
Returns the CfItem in a given slot.
boolean selected
If set, paint the element in "selected" state.
final GuiFactory guiFactory
The global GuiFactory instance.
void scroll(final int distance)
Scrolls the element.
void sendLock(boolean val, int tag)
Sends a "lock" command to the server.
final GUIElementListener elementListener
The GUIElementListener to notify.
static final int CTRL
The mask for "ctrl".
void setItemNoListeners(@Nullable final CfItem item)
Sets the current item instance without registering listeners for updates.
final FloorView floorView
The FloorView to use.
void dispose()
Releases all allocated resources.
Interface for listeners interested in changed items.
void drawInfo(@NotNull String message, int color)
Pretends that a drawinfo message has been received.
Factory for creating Gui instances.
final String name
The name of this element.
static final int NONE
The mask for "no modifier".
boolean isSelected()
Returns whether this element should be drawn as "selected".
final CrossfireServerConnection crossfireServerConnection
The server instance.
int index
The inventory slot index.
void setSelected(final boolean selected)
Sets the selected state.
void button2Clicked(final int modifiers)
Called when the middle mouse button was pressed.
boolean canScroll(final int distance)
Returns whether scrolling is possible.
void notifyOpen()
Called each time the enclosing dialog is opened (or raised).
final TooltipManager tooltipManager
The TooltipManager to update.
Provides a view to all items comprising the current floor view.
void setChanged()
Records that the contents have changed and must be repainted.
static final int SHIFT
The mask for "shift".
int getSize()
Returns the number of items.
int getIndex()
Returns the slot index.
Image getFace(@NotNull final CfItem item)
Returns the face for a CfItem instance.
Maintains the pending (ncom) commands sent to the server.
void resetScroll()
Resets the scroll index to the default value.
Listener for GUIElement related events.