com.realtime.crossfire.jxclient.items
Class FloorView

java.lang.Object
  extended by com.realtime.crossfire.jxclient.items.AbstractItemView
      extended by com.realtime.crossfire.jxclient.items.FloorView
All Implemented Interfaces:
ItemView

public class FloorView
extends AbstractItemView

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.


Field Summary
private  int currentFloor
          The tag of the currently shown container or 0 if no container is open.
private  ItemListener itemListener
          The ItemListener attached to the current floor object.
private  ItemSet itemSet
          The ItemSet to monitor.
private  ItemSetListener itemSetListener
          The ItemSetListener for detecting opened or closed containers.
 
Constructor Summary
FloorView(ItemSet itemSet)
          Creates a new instance.
 
Method Summary
 int getCurrentFloor()
          Returns the current floor location.
 CfItem getItem(int index)
          Returns the CfItem in a given slot.
private  int getOffset()
          Returns the number of non-inventory items to be displayed on the floor.
 int getSize()
          Returns the number of items.
private  void setCurrentFloor(int currentFloor)
          Updates the currently opened container that's contents are shown in the floor view.
 
Methods inherited from class com.realtime.crossfire.jxclient.items.AbstractItemView
addLocationListener, addLocationsListener, addModified, addModifiedRange, removeLocationListener, removeLocationsListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

currentFloor

private int currentFloor
The tag of the currently shown container or 0 if no container is open.


itemListener

@NotNull
private final ItemListener itemListener
The ItemListener attached to the current floor object.


itemSet

@NotNull
private final ItemSet itemSet
The ItemSet to monitor.


itemSetListener

@NotNull
private final ItemSetListener itemSetListener
The ItemSetListener for detecting opened or closed containers.

Constructor Detail

FloorView

public FloorView(@NotNull
                 ItemSet itemSet)
Creates a new instance.

Parameters:
itemSet - the item set to use
Method Detail

getCurrentFloor

public int getCurrentFloor()
Returns the current floor location.

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

getItem

@Nullable
public CfItem getItem(int index)
Returns the CfItem in a given slot.

Parameters:
index - the slot index
Returns:
the item or null if the slot is empty

getOffset

private int getOffset()
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

getSize

public int getSize()
Returns the number of items.

Returns:
the number of items

setCurrentFloor

private void setCurrentFloor(int currentFloor)
Updates the currently opened container that's contents are shown in the floor view.

Parameters:
currentFloor - the current floor tag