Crossfire JXClient, Trunk
com.realtime.crossfire.jxclient.items.FloorView Class Reference

Provides a view to all items comprising the current floor view. More...

+ Inheritance diagram for com.realtime.crossfire.jxclient.items.FloorView:
+ Collaboration diagram for com.realtime.crossfire.jxclient.items.FloorView:

Public Member Functions

 FloorView (@NotNull final ItemSet itemSet)
 Creates a new instance. More...
 
int getCurrentFloorTag ()
 Returns the current floor location. More...
 
CfItem getItem (final int index)
 Returns the CfItem in a given slot. More...
 
int getSize ()
 Returns the number of items. More...
 
- Public Member Functions inherited from com.realtime.crossfire.jxclient.items.AbstractItemView
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. More...
 
void addLocationsListener (@NotNull final LocationsListener locationsListener)
 Adds a LocationsListener to be notified when any displayed item has changed. More...
 
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. More...
 
void removeLocationsListener (@NotNull final LocationsListener locationsListener)
 Removes a LocationsListener to be notified when any displayed item has changed. More...
 

Private Member Functions

int getOffset ()
 Returns the number of non-inventory items to be displayed on the floor. More...
 
void setCurrentFloorTag (final int currentFloorTag)
 Updates the currently opened container that's contents are shown in the floor view. More...
 

Private Attributes

int currentFloorTag
 The tag of the currently shown container or. More...
 
final ItemListener itemListener
 The ItemListener attached to the current floor object. More...
 
final ItemSet itemSet
 The ItemSet to monitor. More...
 
final ItemSetListener itemSetListener
 The ItemSetListener for detecting opened or closed containers. More...
 

Additional Inherited Members

- Protected Member Functions inherited from com.realtime.crossfire.jxclient.items.AbstractItemView
 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...
 

Detailed Description

Provides a view to all items comprising the current floor view.

If an opened container exists, the floor view consists of the container in the first slot followed by the contained items. Otherwise, all objects in location

0

are returned.

Author
Andreas Kirschbaum

Definition at line 36 of file FloorView.java.

Constructor & Destructor Documentation

◆ FloorView()

Member Function Documentation

◆ getCurrentFloorTag()

int com.realtime.crossfire.jxclient.items.FloorView.getCurrentFloorTag ( )

Returns the current floor location.

Returns
the current floor location: a container's tag or
0

Definition at line 116 of file FloorView.java.

References com.realtime.crossfire.jxclient.items.FloorView.currentFloorTag.

Referenced by com.realtime.crossfire.jxclient.gui.item.GUIItemInventory.button3Clicked(), com.realtime.crossfire.jxclient.scripts.AbstractScriptProcess.cmdRequest(), and com.realtime.crossfire.jxclient.gui.commands.ExecSelectionCommand.execute().

+ Here is the caller graph for this function:

◆ getItem()

CfItem com.realtime.crossfire.jxclient.items.FloorView.getItem ( final int  index)

Returns the CfItem in a given slot.

Parameters
indexthe slot index
Returns
the item or
null
if the slot is empty

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

Definition at line 145 of file FloorView.java.

References com.realtime.crossfire.jxclient.items.FloorView.currentFloorTag, com.realtime.crossfire.jxclient.items.ItemSet.getInventoryItem(), com.realtime.crossfire.jxclient.items.ItemSet.getItemByTag(), and com.realtime.crossfire.jxclient.items.FloorView.itemSet.

+ Here is the call graph for this function:

◆ getOffset()

int com.realtime.crossfire.jxclient.items.FloorView.getOffset ( )
private

Returns the number of non-inventory items to be displayed on the floor.

Currently, this can be zero or one (virtual container to close the currently opened container).

Returns
the number of non-inventory items to show

Definition at line 166 of file FloorView.java.

References com.realtime.crossfire.jxclient.items.FloorView.currentFloorTag.

Referenced by com.realtime.crossfire.jxclient.items.FloorView.getSize().

+ Here is the caller graph for this function:

◆ getSize()

int com.realtime.crossfire.jxclient.items.FloorView.getSize ( )

◆ setCurrentFloorTag()

void com.realtime.crossfire.jxclient.items.FloorView.setCurrentFloorTag ( final int  currentFloorTag)
private

Member Data Documentation

◆ currentFloorTag

◆ itemListener

final ItemListener com.realtime.crossfire.jxclient.items.FloorView.itemListener
private
Initial value:
= new ItemListener() {
@Override
public void itemChanged(final int tag) {
if (currentFloorTag != 0) {
}
}
@Override
public void itemRemoved(final int tag) {
}
@Override
public void inventoryAdded(final int tag, final int index, @NotNull final CfItem item) {
final int offset = getOffset();
addModifiedRange(index+offset, itemSet.getNumberOfItemsByLocation(tag)-1+offset);
}
@Override
public void inventoryRemoved(final int tag, final int index) {
final int offset = getOffset();
}
}

The ItemListener attached to the current floor object.

Definition at line 73 of file FloorView.java.

Referenced by com.realtime.crossfire.jxclient.items.FloorView.FloorView(), and com.realtime.crossfire.jxclient.items.FloorView.setCurrentFloorTag().

◆ itemSet

◆ itemSetListener

final ItemSetListener com.realtime.crossfire.jxclient.items.FloorView.itemSetListener
private
Initial value:
= new ItemSetListener() {
@Override
public void playerChanged(@Nullable final CfItem player) {
}
@Override
public void openContainerChanged(final int tag) {
}
}

The ItemSetListener for detecting opened or closed containers.

Definition at line 55 of file FloorView.java.

Referenced by com.realtime.crossfire.jxclient.items.FloorView.FloorView().


The documentation for this class was generated from the following file:
com.realtime.crossfire.jxclient.items.FloorView.itemSet
final ItemSet itemSet
The ItemSet to monitor.
Definition: FloorView.java:42
com.realtime.crossfire.jxclient.items.FloorView.setCurrentFloorTag
void setCurrentFloorTag(final int currentFloorTag)
Updates the currently opened container that's contents are shown in the floor view.
Definition: FloorView.java:125
com.realtime.crossfire.jxclient.items.FloorView.currentFloorTag
int currentFloorTag
The tag of the currently shown container or.
Definition: FloorView.java:48
com.realtime.crossfire.jxclient.items.FloorView.getOffset
int getOffset()
Returns the number of non-inventory items to be displayed on the floor.
Definition: FloorView.java:166
com.realtime.crossfire.jxclient.items.ItemSet.getNumberOfItemsByLocation
int getNumberOfItemsByLocation(final int location)
Returns the number of items in a given location.
Definition: ItemSet.java:148
com.realtime.crossfire.jxclient.items.AbstractItemView.addModified
void addModified(final int index)
Marks a slot as modified.
Definition: AbstractItemView.java:116
com.realtime.crossfire.jxclient.items.AbstractItemView.addModifiedRange
void addModifiedRange(final int firstIndex, final int lastIndex)
Marks a range of slots as modified.
Definition: AbstractItemView.java:103