22 package com.realtime.crossfire.jxclient.gui.item;
35 import java.awt.Image;
36 import javax.swing.SwingUtilities;
37 import org.jetbrains.annotations.NotNull;
111 public void locationChanged() {
139 public GUIItemFloor(@NotNull
final TooltipManager tooltipManager, @NotNull
final GUIElementListener elementListener, @NotNull
final CommandQueue commandQueue, @NotNull
final String
name, @NotNull
final ItemPainter itemPainter,
final int index, @NotNull
final CrossfireServerConnection crossfireServerConnection, @NotNull
final ItemView floorView, @NotNull
final ItemSet itemSet, @NotNull
final FacesManager facesManager, @NotNull
final Image nextGroupFace, @NotNull
final Image prevGroupFace,
final int size) {
140 super(tooltipManager, elementListener, name, itemPainter, facesManager);
148 defaultIndex =
index;
170 return index >= -distance;
174 return index+distance < floorView.
getSize();
248 if (player == null) {
277 private void setIndex(
final int index,
final boolean forced) {
278 if (this.index != index) {
279 if (this.index >= 0) {
283 if (this.index >= 0) {
286 }
else if (!forced) {
309 if (!item.isItemGroupButton()) {
Listener for GUIElement related events.
final int defaultIndex
The default scroll index.
ImageIcon getOriginalImageIcon(int faceNum, @Nullable boolean[] isUnknownImage)
Returns the "original" face for a face ID.
boolean canScroll(final int distance)
Returns whether scrolling is possible.the distance to scroll whether scrolling is possible ...
void setIndex(final int index, final boolean forced)
Set the floor tile to display.
void sendMove(final int to, final int tag)
Sends a "move" command to the server.
final TooltipManager tooltipManager
The TooltipManager to update.
void resetScroll()
Resets the scroll index to the default value.
Interface for listeners interested in changed items.
final GUIElementListener elementListener
The GUIElementListener to notify.
A GUIElement representing an in-game object in the ground view.
static final int SHIFT
The mask for "shift".
void button2Clicked(final int modifiers)
void setSelected(final boolean selected)
final FacesManager facesManager
The FacesManager instance to use.
final LocationListener locationListener
The LocationListener used to detect items added to or removed from this floor tile.
void setItemNoListeners(@Nullable final CfItem item)
Sets the current item instance without registering listeners for updates.
Manages image information ("faces") needed to display the map view, items, and spell icons...
A GUIElement instance representing an in-game item.
Image getFace(@NotNull final CfItem item)
final String name
The name of this element.
Interface defining an abstract GUI element.
final ItemView floorView
The floor view to watch.
int getOpenContainer()
Returns the currently opened container.
Helper functions for keyboard modifiers.
void setIndexNoListeners(final int index)
final Runnable locationListenerEdt
Called from locationListener but runs on the EDT.
CfItem getItem()
Returns the current item instance.
boolean isItemGroupButton()
Returns whether this object is a fake object for selecting object groups in the ground view...
void scroll(final int distance)
Scrolls the element.the distance to scroll
final Image prevGroupFace
The face to substitute into "Click here for previous group of items".
final Image nextGroupFace
The face to substitute into "Click here for next group of items".
final CommandQueue commandQueue
The command queue for sending commands.
void button3Clicked(final int modifiers)
int getSize()
Returns the number of items.
int getTag()
Returns the tag.
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 int CTRL
The mask for "ctrl".
void button1Clicked(final int modifiers)
void removeLocationListener(int index, @NotNull LocationListener locationListener)
Removes a LocationListener to be notified when the item displayed in a floor slot has changed...
static final long serialVersionUID
The serial version UID.
final CrossfireServerConnection crossfireServerConnection
The connection instance.
int index
The currently shown index.
CfItem getPlayer()
Returns the player object this client controls.
static final int NONE
The mask for "no modifier".
GUIItemFloor(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final CommandQueue commandQueue, @NotNull final String name, @NotNull final ItemPainter itemPainter, final int index, @NotNull final CrossfireServerConnection crossfireServerConnection, @NotNull final ItemView floorView, @NotNull final ItemSet itemSet, @NotNull final FacesManager facesManager, @NotNull final Image nextGroupFace, @NotNull final Image prevGroupFace, final int size)
Creates a new instance.
void setItem(@Nullable final CfItem item)
Sets the current item instance.
static final int MASK
The mask for all used modifiers.
CfItem item
The current item instance.
final ItemPainter itemPainter
The ItemPainter for painting the icon.
void dispose()
Releases all allocated resources.
Adds encoding/decoding of crossfire protocol packets to a ServerConnection.
CfItem getItem(int index)
Returns the CfItem in a given slot.
Model class maintaining the CfItems known to the player.
Maintains the pending (ncom) commands sent to the server.
final ItemSet itemSet
The ItemSet to use.
void sendApply(int tag)
Sends an "apply" command to the server.
void sendExamine(int tag)
Sends an "examine" command to the server.
The representation of a Crossfire Item, client-side.
Paints Crossfire item images.
Maintains a mapping of face numbers to face data.