 |
Crossfire JXClient, Trunk
|
Go to the documentation of this file.
23 package com.realtime.crossfire.jxclient.gui.item;
37 import java.awt.Dimension;
38 import java.awt.Image;
39 import org.jetbrains.annotations.NotNull;
40 import org.jetbrains.annotations.Nullable;
56 private final Object
sync =
new Object();
99 @SuppressWarnings(
"FieldCanBeLocal")
120 public GUIItemKnowledge(@NotNull
final TooltipManager tooltipManager, @NotNull
final GUIElementListener elementListener, @NotNull
final String
name, @NotNull
final ItemPainter itemPainter,
final int defaultIndex, @NotNull
final FacesManager facesManager, @NotNull
final KnowledgeManager knowledgeManager, @NotNull
final ItemView view, @NotNull
final CommandQueue commandQueue,
final int size, @NotNull
final GuiFactory guiFactory) {
132 public void typeAdded(
final int index) {
136 public void knowledgeAdded(
final int index) {
137 synchronized (
sync) {
155 synchronized (
sync) {
156 return index >= -distance;
160 synchronized (
sync) {
170 synchronized (
sync) {
184 @SuppressWarnings(
"MethodDoesntCallSuperMethod")
191 @SuppressWarnings(
"MethodDoesntCallSuperMethod")
202 return new Dimension(32, 32);
210 synchronized (
sync) {
215 if (newItem ==
item) {
229 synchronized (
sync) {
230 if (this.index ==
index) {
262 synchronized (
sync) {
269 synchronized (
sync) {
boolean selected
Whether this element is selected in its GUIKnowledgeList.
Maintains a mapping of face numbers to face data.
static Dimension getMinimumSizeInt()
Returns the minimal size to display this component.
Paints Crossfire item images.
void addKnowledgeListener(@NotNull final KnowledgeListener listener)
Adds a KnowledgeListener to notify about changes.
Dimension getPreferredSize()
int getFaceNum()
Returns the face number.
Manages all knowledge the player knows.
GUIItemKnowledge(@NotNull final TooltipManager tooltipManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, @NotNull final ItemPainter itemPainter, final int defaultIndex, @NotNull final FacesManager facesManager, @NotNull final KnowledgeManager knowledgeManager, @NotNull final ItemView view, @NotNull final CommandQueue commandQueue, final int size, @NotNull final GuiFactory guiFactory)
Creates a new instance.
static final long serialVersionUID
The serial version UID.
int getIndex()
Returns the slot index.
final CommandQueue commandQueue
The command queue for sending commands.
void notifyOpen()
Called each time the enclosing dialog is opened (or raised).
ImageIcon getOriginalImageIcon(int faceNum, @Nullable AtomicBoolean returnIsUnknownImage)
Returns the "original" face for a face ID.
void setChanged()
Records that the contents have changed and must be repainted.
boolean isSelected()
Returns whether this element should be drawn as "selected".
Interface for listeners interested in FacesManager events.
final Object sync
The object used for synchronization on index.
void button2Clicked(final int modifiers)
Called when the middle mouse button was pressed.
void setSelected(final boolean selected)
Sets the selected state.
Manages image information ("faces") needed to display the map view, items, and spell icons.
final ItemPainter itemPainter
The ItemPainter for painting the icon.
Image getFace(@NotNull final CfItem item)
Returns the face for a CfItem instance.
void button1Clicked(final int modifiers)
Called when the left mouse button was pressed.
final int defaultIndex
The default scroll index.
boolean isActive()
Returns whether a GUI element is active.
void addFacesManagerListener(@NotNull FacesManagerListener facesManagerListener)
Adds a FacesManagerListener to be notified about updated faces.
KnowledgeItem getKnowledge(final int index)
Returns a KnowledgeItem instance by index.
A GUIElement instance representing an in-game item.
The representation of a Crossfire Item, client-side.
boolean canScroll(final int distance)
Returns whether scrolling is possible.
void setIndex(final int index)
Sets the index of the currently selected item.
CfItem getItem(int index)
Returns the CfItem in a given slot.
String getType()
Returns the knowledge's type.
void sendNcom(final boolean mustSend, @NotNull final String command)
Sends a "ncom" command to the server.
void resetScroll()
Resets the scroll index to the default value.
final FacesManagerListener facesManagerListener
The FacesManagerListener registered to detect updated faces.
final GuiFactory guiFactory
The global GuiFactory instance.
void button3Clicked(final int modifiers)
Called when the right mouse button was pressed.
final GUIElementListener elementListener
The GUIElementListener to notify.
Describes a Crossfire spell.
void setKnowledgeItem()
Sets the currently selected KnowledgeItem.
int index
The currently selected spell or.
void setItemNoListeners(@Nullable final CfItem item)
Sets the current item instance without registering listeners for updates.
final FacesManager facesManager
The FacesManager for looking up faces.
Factory for creating Gui instances.
final String name
The name of this element.
Dimension getMinimumSize()
void setIndexNoListeners(final int index)
Sets the slot index to display without registering listeners for updates.
int getKnowledgeIndex()
Returns the tag ID.
boolean canAttemptType(@NotNull final String type)
final KnowledgeManager knowledgeManager
final TooltipManager tooltipManager
The TooltipManager to update.
Maintains the pending (ncom) commands sent to the server.
void scroll(final int distance)
Scrolls the element.
Listener for GUIElement related events.