 |
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 javax.swing.SwingUtilities;
43 import org.jetbrains.annotations.NotNull;
44 import org.jetbrains.annotations.Nullable;
61 private final Object
sync =
new Object();
114 synchronized (
sync) {
115 if (
index < index1) {
136 public void faceUpdated(@NotNull
final Face face) {
152 public void locationChanged() {
181 public GUIItemQuest(@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 QuestsManager questsManager, @NotNull
final ItemView questsView, @NotNull
final CommandQueue commandQueue,
final int size, @NotNull
final GuiFactory guiFactory) {
213 synchronized (
sync) {
214 return index >= -distance;
218 synchronized (
sync) {
228 synchronized (
sync) {
242 @SuppressWarnings(
"MethodDoesntCallSuperMethod")
249 @SuppressWarnings(
"MethodDoesntCallSuperMethod")
260 return new Dimension(32, 32);
269 synchronized (
sync) {
277 if (
quest == newQuest) {
301 synchronized (
sync) {
302 if (this.index ==
index) {
308 if (this.index >= 0) {
312 if (this.index >= 0) {
342 synchronized (
sync) {
349 synchronized (
sync) {
Face getFace()
Returns the face.
Maintains a mapping of face numbers to face data.
Paints Crossfire item images.
void setSelected(final boolean selected)
Sets the selected state.
void tooltipChanged()
Must be called whenever the tooltip may have changed.
Manages all quests for a player.
final QuestsManager questsManager
The QuestsManager instance to watch.
int getCode()
Get the quest's code.
void removeFacesManagerListener(@NotNull FacesManagerListener facesManagerListener)
Removes a FacesManagerListener to be notified about updated faces.
void addLocationListener(int index, @NotNull LocationListener locationListener)
Adds a LocationListener to be notified when the item displayed in a floor slot has changed.
void removeLocationListener(int index, @NotNull LocationListener locationListener)
Removes a LocationListener to be notified when the item displayed in a floor slot has changed.
Interface for listeners interested in Quest related events.
ImageIcon getOriginalImageIcon(int faceNum, @Nullable AtomicBoolean returnIsUnknownImage)
Returns the "original" face for a face ID.
boolean isSelected()
Returns whether this element should be drawn as "selected".
int getFaceNum()
Returns the unique face id.
Dimension getMinimumSize()
void resetScroll()
Resets the scroll index to the default value.
final ItemView questsView
The spells view to use.
void setChanged()
Records that the contents have changed and must be repainted.
Interface for listeners interested in FacesManager events.
final FacesManager facesManager
The FacesManager for looking up faces.
A GUIList to display quests.
CfItem item
The current item instance.
void removeQuestListener(@NotNull final QuestListener listener)
Removes a QuestListener to be notified of changes.
Manages image information ("faces") needed to display the map view, items, and spell icons.
final ItemPainter itemPainter
The ItemPainter for painting the icon.
final FacesManagerListener facesManagerListener
The FacesManagerListener registered to detect updated faces.
void setIndex(final int index)
Sets the index of the currently selected quest.
void setIndexNoListeners(final int index)
Sets the slot index to display without registering listeners for updates.
final Object sync
The object used for synchronization on index.
boolean isActive()
Returns whether a GUI element is active.
void notifyOpen()
Called each time the enclosing dialog is opened (or raised).
int index
The currently selected quest or.
final LocationListener locationListener
The LocationListener used to detect items added to or removed from this quest slot.
Quest quest
The currently selected Quest, null if none.
A GUIElement instance representing an in-game item.
Quest getQuestByCode(final int code)
final CommandQueue commandQueue
The command queue for sending commands.
The representation of a Crossfire Item, client-side.
static Dimension getMinimumSizeInt()
Returns the minimal size to display this component.
int getTag()
Returns the tag.
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.
final Runnable locationListenerEdt
Called from locationListener but runs on the EDT.
int getIndex()
Returns the slot index.
void button2Clicked(final int modifiers)
Called when the middle mouse button was pressed.
boolean canScroll(final int distance)
Returns whether scrolling is possible.
void addQuestListener(@NotNull final QuestListener listener)
Adds a QuestListener to be notified of changes.
final QuestListener questListener
The QuestListener attached to quest.
final QuestsManagerListener questsManagerListener
The QuestsManagerListener used to detect spell changes.
final GuiFactory guiFactory
The global GuiFactory instance.
GUIItemQuest(@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 QuestsManager questsManager, @NotNull final ItemView questsView, @NotNull final CommandQueue commandQueue, final int size, @NotNull final GuiFactory guiFactory)
Creates a new instance.
final GUIElementListener elementListener
The GUIElementListener to notify.
final int defaultIndex
The default scroll index.
A GUIItemItem that represents an entry in a GUIQuestList.
Image getFace(@NotNull final CfItem item)
Returns the face for a CfItem instance.
void setItemNoListeners(@Nullable final CfItem item)
Sets the current item instance without registering listeners for updates.
Interface for listeners interested in changed items.
Dimension getPreferredSize()
Interface for listeners interested in QuestsManager events.
Factory for creating Gui instances.
final String name
The name of this element.
void removeCrossfireQuestChangedListener(@NotNull final QuestsManagerListener listener)
Removes a QuestsManagerListener to notify about changes.
Describes an in-game quest.
void button3Clicked(final int modifiers)
Called when the right mouse button was pressed.
static final long serialVersionUID
The serial version UID.
boolean selected
Whether this element is selected in its GUIQuestList.
void dispose()
Releases all allocated resources.
void button1Clicked(final int modifiers)
Called when the left mouse button was pressed.
void setQuest()
Sets the currently selected quest.
final TooltipManager tooltipManager
The TooltipManager to update.
int getFace()
Get the quest's face.
int getSize()
Returns the number of items.
Maintains the pending (ncom) commands sent to the server.
void scroll(final int distance)
Scrolls the element.
Listener for GUIElement related events.