21 package com.realtime.crossfire.jxclient.gui.item;
35 import java.awt.Dimension;
36 import java.awt.Image;
37 import org.jetbrains.annotations.NotNull;
38 import org.jetbrains.annotations.Nullable;
55 private final Object
sync =
new Object();
102 if (index >= index1) {
120 public void faceUpdated(@NotNull
final Face face) {
121 if (quest != null && quest.
getFace() == face.getFaceNum()) {
141 super(tooltipManager, elementListener, name, itemPainter, facesManager);
146 this.questsManager.addCrossfireQuestChangedListener(questsManagerListener);
147 this.facesManager.addFacesManagerListener(facesManagerListener);
173 return index >= -distance;
177 return index+distance < questsManager.
getQuests();
223 return new Dimension(32, 32);
232 if (quest == newQuest) {
257 if (this.index == index) {
279 if (this.selected == selected) {
300 synchronized (
sync) {
310 synchronized (
sync) {
Listener for GUIElement related events.
void button1Clicked(final int modifiers)
ImageIcon getOriginalImageIcon(int faceNum, @Nullable boolean[] isUnknownImage)
Returns the "original" face for a face ID.
void resetScroll()
Resets the scroll index to the default value.
void button2Clicked(final int modifiers)
final TooltipManager tooltipManager
The TooltipManager to update.
void setIndex(final int index)
Sets the index of the currently selected quest.
int index
The currently selected quest or.
Dimension getPreferredSize()
Describes an in-game quest.
final GUIElementListener elementListener
The GUIElementListener to notify.
Image getFace(@NotNull final CfItem item)
Dimension getMinimumSize()
void scroll(final int distance)
Scrolls the element.the distance to scroll
void setChanged()
Records that the contents have changed and must be repainted.
A GUIItemItem that represents an entry in a GUIQuestList.
final FacesManager facesManager
The FacesManager for looking up faces.
final QuestListener questListener
The QuestListener attached to quest.
final int defaultIndex
The default scroll index.
Quest quest
The currently selected Quest, null if none.
void removeCrossfireQuestChangedListener(@NotNull final QuestsManagerListener listener)
Removes a QuestsManagerListener to notify about changes.
Interface for listeners interested in Quest related events.
void setItemNoListeners(@Nullable final CfItem item)
Sets the current item instance without registering listeners for updates.
boolean selected
Whether this element is selected in its GUIQuestList.
final QuestsManagerListener questsManagerListener
The QuestsManagerListener used to detect spell changes.
Manages image information ("faces") needed to display the map view, items, and spell icons...
static Dimension getMinimumSizeInt()
Returns the minimal size to display this component.
A GUIElement instance representing an in-game item.
int getQuests()
Returns the number of current quests.
void dispose()
Releases all allocated resources.
final String name
The name of this element.
void setIndexNoListeners(final int index)
Manages all quests for a player.
final FacesManagerListener facesManagerListener
The FacesManagerListener registered to detect updated faces.
final ItemView questsView
The spells view to use.
final QuestsManager questsManager
The QuestsManager instance to watch.
Interface for listeners interested in FacesManager events.
void setTooltipText(@Nullable final String tooltipText)
Sets the tooltip text to show when the mouse is inside this element.the text to show ornull to disab...
boolean canScroll(final int distance)
Returns whether scrolling is possible.the distance to scroll whether scrolling is possible ...
int getFace()
Get the quest's face.
String getTooltipText()
Returns a description for this spell to be used in tooltips.
A GUIList to display quests.
CfItem item
The current item instance.
final ItemPainter itemPainter
The ItemPainter for painting the icon.
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, final int size)
Creates a new instance.
final Object sync
The object used for synchronization on index.
CfItem getItem(int index)
Returns the CfItem in a given slot.
Interface for listeners interested in QuestsManager events.
static final long serialVersionUID
The serial version UID.
void removeQuestListener(@NotNull final QuestListener listener)
Removes a QuestListener to be notified of changes.
void removeFacesManagerListener(@NotNull FacesManagerListener facesManagerListener)
Removes a FacesManagerListener to be notified about updated faces.
The representation of a Crossfire Item, client-side.
Paints Crossfire item images.
void addQuestListener(@NotNull final QuestListener listener)
Adds a QuestListener to be notified of changes.
void button3Clicked(final int modifiers)
Quest getQuest(final int index)
Returns a Quest instance by index.
void setQuest()
Sets the currently selected quest.
boolean isActive()
Returns whether a GUI element is active.
void setSelected(final boolean selected)
Maintains a mapping of face numbers to face data.