Crossfire JXClient, Trunk
R20561
|
Abstract base class for ItemView implementing classes. More...
Public Member Functions | |||||
void | addLocationListener (final int index, @NotNull final LocationListener locationListener) | ||||
Adds a LocationListener to be notified when the item displayed in a floor slot has changed.
| |||||
void | addLocationsListener (@NotNull final LocationsListener locationsListener) | ||||
Adds a LocationsListener to be notified when any displayed item has changed.
| |||||
void | removeLocationListener (final int index, @NotNull final LocationListener locationListener) | ||||
Removes a LocationListener to be notified when the item displayed in a floor slot has changed.
| |||||
void | removeLocationsListener (@NotNull final LocationsListener locationsListener) | ||||
Removes a LocationsListener to be notified when any displayed item has changed.
| |||||
![]() | |||||
CfItem | getItem (int index) | ||||
Returns the CfItem in a given slot. More... | |||||
int | getSize () | ||||
Returns the number of items. More... | |||||
Protected Member Functions | |
AbstractItemView () | |
Creates a new instance. More... | |
void | addModified (final int index) |
Marks a slot as modified. More... | |
void | addModifiedRange (final int firstIndex, final int lastIndex) |
Marks a range of slots as modified. More... | |
Private Member Functions | |
void | deliverEvents () |
Delivers all pending events. More... | |
void | fireEvents () |
Delivers outstanding change events. More... | |
Private Attributes | |
final Runnable | fireEventCallback = this::deliverEvents |
The event scheduler callback for delaying event generation. More... | |
final EventScheduler | fireEventScheduler = new EventScheduler(100, 1, fireEventCallback) |
The EventScheduler for delaying event generation. More... | |
final IndexedEventListenerList< LocationListener > | locationListeners = new IndexedEventListenerList<>() |
The registered ItemListeners to be notified about changes. More... | |
final EventListenerList2< LocationsListener > | locationsListeners = new EventListenerList2<>() |
The registered LocationsListeners to be notified about changes. More... | |
final Collection< Integer > | modifiedSlots = new HashSet<>() |
The pending modified floor slots to be reported to listeners. More... | |
final Object | sync = new Object() |
The synchronization object for accesses to modifiedSlots. More... | |
Abstract base class for ItemView implementing classes.
Definition at line 34 of file AbstractItemView.java.
|
protected |
Creates a new instance.
Definition at line 73 of file AbstractItemView.java.
References com.realtime.crossfire.jxclient.items.AbstractItemView.fireEventScheduler, and com.realtime.crossfire.jxclient.items.EventScheduler.start().
void com.realtime.crossfire.jxclient.items.AbstractItemView.addLocationListener | ( | final int | index, |
@NotNull final LocationListener | locationListener | ||
) |
Adds a LocationListener to be notified when the item displayed in a floor slot has changed.
index | the floor slot |
locationListener | the location listener to add |
Implements com.realtime.crossfire.jxclient.items.ItemView.
Definition at line 103 of file AbstractItemView.java.
References com.realtime.crossfire.jxclient.util.IndexedEventListenerList< T extends EventListener >.add().
void com.realtime.crossfire.jxclient.items.AbstractItemView.addLocationsListener | ( | @NotNull final LocationsListener | locationsListener | ) |
Adds a LocationsListener to be notified when any displayed item has changed.
locationsListener | the locations listener to add |
Implements com.realtime.crossfire.jxclient.items.ItemView.
Definition at line 87 of file AbstractItemView.java.
References com.realtime.crossfire.jxclient.util.EventListenerList2< T extends EventListener >.add().
|
protected |
Marks a slot as modified.
index | the modified slot index |
Definition at line 133 of file AbstractItemView.java.
References com.realtime.crossfire.jxclient.items.AbstractItemView.fireEvents(), and com.realtime.crossfire.jxclient.items.AbstractItemView.sync.
|
protected |
Marks a range of slots as modified.
firstIndex | the first modified slot index |
lastIndex | the last modified slot index |
Definition at line 120 of file AbstractItemView.java.
References com.realtime.crossfire.jxclient.items.AbstractItemView.fireEvents(), and com.realtime.crossfire.jxclient.items.AbstractItemView.sync.
Referenced by com.realtime.crossfire.jxclient.items.KnowledgeTypeView.KnowledgeTypeView(), com.realtime.crossfire.jxclient.items.KnowledgeView.KnowledgeView(), com.realtime.crossfire.jxclient.items.QuestsView.QuestsView(), com.realtime.crossfire.jxclient.items.FloorView.setCurrentFloor(), com.realtime.crossfire.jxclient.items.InventoryView.setCurrentPlayerTag(), com.realtime.crossfire.jxclient.items.SpellSkillView.SpellSkillView(), and com.realtime.crossfire.jxclient.items.SpellsView.SpellsView().
|
private |
Delivers all pending events.
Definition at line 143 of file AbstractItemView.java.
References com.realtime.crossfire.jxclient.util.IndexedEventListenerList< T extends EventListener >.getListeners(), and com.realtime.crossfire.jxclient.items.AbstractItemView.sync.
|
private |
Delivers outstanding change events.
Definition at line 164 of file AbstractItemView.java.
References com.realtime.crossfire.jxclient.items.EventScheduler.trigger().
Referenced by com.realtime.crossfire.jxclient.items.AbstractItemView.addModified(), and com.realtime.crossfire.jxclient.items.AbstractItemView.addModifiedRange().
void com.realtime.crossfire.jxclient.items.AbstractItemView.removeLocationListener | ( | final int | index, |
@NotNull final LocationListener | locationListener | ||
) |
Removes a LocationListener to be notified when the item displayed in a floor slot has changed.
index | the floor slot |
locationListener | the location listener to remove |
Implements com.realtime.crossfire.jxclient.items.ItemView.
Definition at line 111 of file AbstractItemView.java.
References com.realtime.crossfire.jxclient.util.IndexedEventListenerList< T extends EventListener >.remove().
void com.realtime.crossfire.jxclient.items.AbstractItemView.removeLocationsListener | ( | @NotNull final LocationsListener | locationsListener | ) |
Removes a LocationsListener to be notified when any displayed item has changed.
locationsListener | the locations listener to remove |
Implements com.realtime.crossfire.jxclient.items.ItemView.
Definition at line 95 of file AbstractItemView.java.
References com.realtime.crossfire.jxclient.util.EventListenerList2< T extends EventListener >.remove().
|
private |
The event scheduler callback for delaying event generation.
This is needed because the Crossfire server sends multiple item2 commands for one "get all" command.
Definition at line 68 of file AbstractItemView.java.
|
private |
The EventScheduler for delaying event generation.
Definition at line 81 of file AbstractItemView.java.
Referenced by com.realtime.crossfire.jxclient.items.AbstractItemView.AbstractItemView().
|
private |
The registered ItemListeners to be notified about changes.
Definition at line 48 of file AbstractItemView.java.
|
private |
The registered LocationsListeners to be notified about changes.
Definition at line 41 of file AbstractItemView.java.
|
private |
The pending modified floor slots to be reported to listeners.
Definition at line 54 of file AbstractItemView.java.
|
private |
The synchronization object for accesses to modifiedSlots.
Definition at line 60 of file AbstractItemView.java.
Referenced by com.realtime.crossfire.jxclient.items.AbstractItemView.addModified(), com.realtime.crossfire.jxclient.items.AbstractItemView.addModifiedRange(), and com.realtime.crossfire.jxclient.items.AbstractItemView.deliverEvents().