Crossfire JXClient, Trunk
Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
com.realtime.crossfire.jxclient.items.AbstractItemView Class Referenceabstract
Inheritance diagram for com.realtime.crossfire.jxclient.items.AbstractItemView:
Inheritance graph
Collaboration diagram for com.realtime.crossfire.jxclient.items.AbstractItemView:
Collaboration graph

Public Member Functions

void addLocationListener (final int index, @NotNull final LocationListener locationListener)
 
void addLocationsListener (@NotNull final LocationsListener locationsListener)
 
void removeLocationListener (final int index, @NotNull final LocationListener locationListener)
 
void removeLocationsListener (@NotNull final LocationsListener locationsListener)
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.items.ItemView
CfItem getItem (int index)
 
int getSize ()
 

Protected Member Functions

 AbstractItemView ()
 
void addModified (final int index)
 
void addModifiedRange (final int firstIndex, final int lastIndex)
 

Private Member Functions

void deliverEvents ()
 
void fireEvents ()
 

Private Attributes

final EventScheduler fireEventScheduler = new EventScheduler(100, 1, this::deliverEvents)
 
final IndexedEventListenerList< LocationListenerlocationListeners = new IndexedEventListenerList<>()
 
final EventListenerList2< LocationsListenerlocationsListeners = new EventListenerList2<>()
 
final Collection< Integer > modifiedSlots = new HashSet<>()
 
final Object sync = new Object()
 

Detailed Description

Abstract base class for ItemView implementing classes.

Author
Andreas Kirschbaum

Definition at line 35 of file AbstractItemView.java.

Constructor & Destructor Documentation

◆ AbstractItemView()

com.realtime.crossfire.jxclient.items.AbstractItemView.AbstractItemView ( )
protected

Creates a new instance.

Definition at line 74 of file AbstractItemView.java.

References com.realtime.crossfire.jxclient.items.AbstractItemView.fireEventScheduler, and com.realtime.crossfire.jxclient.items.EventScheduler.start().

Here is the call graph for this function:

Member Function Documentation

◆ addLocationListener()

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.

Parameters
indexthe floor slot
locationListenerthe location listener to add

Implements com.realtime.crossfire.jxclient.items.ItemView.

Definition at line 89 of file AbstractItemView.java.

References com.realtime.crossfire.jxclient.items.AbstractItemView.locationListeners.

◆ addLocationsListener()

void com.realtime.crossfire.jxclient.items.AbstractItemView.addLocationsListener ( @NotNull final LocationsListener  locationsListener)

Adds a LocationsListener to be notified when any displayed item has changed.

Parameters
locationsListenerthe locations listener to add

Implements com.realtime.crossfire.jxclient.items.ItemView.

Definition at line 79 of file AbstractItemView.java.

References com.realtime.crossfire.jxclient.items.AbstractItemView.locationsListeners.

◆ addModified()

void com.realtime.crossfire.jxclient.items.AbstractItemView.addModified ( final int  index)
protected

Marks a slot as modified.

Parameters
indexthe modified slot index

Definition at line 116 of file AbstractItemView.java.

References com.realtime.crossfire.jxclient.items.AbstractItemView.fireEvents(), com.realtime.crossfire.jxclient.items.AbstractItemView.modifiedSlots, and com.realtime.crossfire.jxclient.items.AbstractItemView.sync.

Here is the call graph for this function:

◆ addModifiedRange()

void com.realtime.crossfire.jxclient.items.AbstractItemView.addModifiedRange ( final int  firstIndex,
final int  lastIndex 
)
protected

◆ deliverEvents()

void com.realtime.crossfire.jxclient.items.AbstractItemView.deliverEvents ( )
private

◆ fireEvents()

void com.realtime.crossfire.jxclient.items.AbstractItemView.fireEvents ( )
private

◆ removeLocationListener()

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.

Parameters
indexthe floor slot
locationListenerthe location listener to remove

Implements com.realtime.crossfire.jxclient.items.ItemView.

Definition at line 94 of file AbstractItemView.java.

References com.realtime.crossfire.jxclient.items.AbstractItemView.locationListeners.

◆ removeLocationsListener()

void com.realtime.crossfire.jxclient.items.AbstractItemView.removeLocationsListener ( @NotNull final LocationsListener  locationsListener)

Removes a LocationsListener to be notified when any displayed item has changed.

Parameters
locationsListenerthe locations listener to remove

Implements com.realtime.crossfire.jxclient.items.ItemView.

Definition at line 84 of file AbstractItemView.java.

References com.realtime.crossfire.jxclient.items.AbstractItemView.locationsListeners.

Member Data Documentation

◆ fireEventScheduler

final EventScheduler com.realtime.crossfire.jxclient.items.AbstractItemView.fireEventScheduler = new EventScheduler(100, 1, this::deliverEvents)
private

The event scheduler for delaying event generation. This is needed because the Crossfire server sends multiple item2 commands for one "get all" command.

Definition at line 69 of file AbstractItemView.java.

Referenced by com.realtime.crossfire.jxclient.items.AbstractItemView.AbstractItemView(), and com.realtime.crossfire.jxclient.items.AbstractItemView.fireEvents().

◆ locationListeners

final IndexedEventListenerList<LocationListener> com.realtime.crossfire.jxclient.items.AbstractItemView.locationListeners = new IndexedEventListenerList<>()
private

◆ locationsListeners

final EventListenerList2<LocationsListener> com.realtime.crossfire.jxclient.items.AbstractItemView.locationsListeners = new EventListenerList2<>()
private

◆ modifiedSlots

final Collection<Integer> com.realtime.crossfire.jxclient.items.AbstractItemView.modifiedSlots = new HashSet<>()
private

◆ sync

final Object com.realtime.crossfire.jxclient.items.AbstractItemView.sync = new Object()
private

The documentation for this class was generated from the following file: