com.threerings.tudey.client.sprite
Class TileSprite

java.lang.Object
  extended by com.threerings.expr.SimpleScope
      extended by com.threerings.tudey.client.sprite.Sprite
          extended by com.threerings.tudey.client.sprite.EntrySprite
              extended by com.threerings.tudey.client.sprite.TileSprite
All Implemented Interfaces:
ConfigUpdateListener<TileConfig>, Scope, ScopeUpdateListener

public class TileSprite
extends EntrySprite
implements ConfigUpdateListener<TileConfig>

Represents a tile.


Nested Class Summary
static class TileSprite.Implementation
          The actual sprite implementation.
static class TileSprite.Original
          An original implementation.
 
Field Summary
protected  TileConfig _config
          The tile configuration.
protected  TudeySceneModel.TileEntry _entry
          The scene entry.
protected  TileSprite.Implementation _impl
          The tile implementation.
protected static TileConfig INVALID_CONFIG
          An invalid config used to force an initial update.
protected static TileSprite.Implementation NULL_IMPLEMENTATION
          An implementation that does nothing.
 
Fields inherited from class com.threerings.tudey.client.sprite.EntrySprite
_selected, SELECTED_COLOR
 
Fields inherited from class com.threerings.tudey.client.sprite.Sprite
_ctx, _view
 
Fields inherited from class com.threerings.expr.SimpleScope
_parentScope
 
Fields inherited from interface com.threerings.expr.Scope
EPOCH, NOW
 
Constructor Summary
TileSprite(TudeyContext ctx, TudeySceneView view, TudeySceneModel.TileEntry entry)
          Creates a new tile sprite.
 
Method Summary
 void configUpdated(ConfigEvent<TileConfig> event)
          Called when a configuration has been updated.
 void dispose()
          Releases the resources associated with this scope.
 TudeySceneModel.Entry getEntry()
          Returns a reference to the most recently set entry state.
 int getFloorFlags()
          Returns the sprite's floor flags.
 Model getModel()
          Returns the model associated with the sprite (if any).
protected  void setConfig(ConfigReference<TileConfig> ref)
          Sets the configuration of this tile.
protected  void setConfig(TileConfig config)
          Sets the configuration of this tile.
 void setSelected(boolean selected)
          Sets whether or not this sprite is selected.
 void update(TudeySceneModel.Entry entry)
          Updates the sprite with new entry state.
protected  void updateFromConfig()
          Updates the tile to match its new or modified configuration.
 
Methods inherited from class com.threerings.tudey.client.sprite.EntrySprite
isSelected
 
Methods inherited from class com.threerings.tudey.client.sprite.Sprite
createTooltipComponent, dispatchEvent, getFloorMask, getScopeName, getTooltipText, getTooltipTimeout, getTooltipWindowStyle, isClickable, isHoverable, setVisible
 
Methods inherited from class com.threerings.expr.SimpleScope
addListener, get, getParentScope, removeListener, scopeUpdated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_entry

protected TudeySceneModel.TileEntry _entry
The scene entry.


_config

protected TileConfig _config
The tile configuration.


_impl

protected TileSprite.Implementation _impl
The tile implementation.


INVALID_CONFIG

protected static TileConfig INVALID_CONFIG
An invalid config used to force an initial update.


NULL_IMPLEMENTATION

protected static final TileSprite.Implementation NULL_IMPLEMENTATION
An implementation that does nothing.

Constructor Detail

TileSprite

public TileSprite(TudeyContext ctx,
                  TudeySceneView view,
                  TudeySceneModel.TileEntry entry)
Creates a new tile sprite.

Method Detail

configUpdated

public void configUpdated(ConfigEvent<TileConfig> event)
Description copied from interface: ConfigUpdateListener
Called when a configuration has been updated.

Specified by:
configUpdated in interface ConfigUpdateListener<TileConfig>

getFloorFlags

public int getFloorFlags()
Description copied from class: Sprite
Returns the sprite's floor flags.

Overrides:
getFloorFlags in class Sprite

getEntry

public TudeySceneModel.Entry getEntry()
Description copied from class: EntrySprite
Returns a reference to the most recently set entry state.

Specified by:
getEntry in class EntrySprite

update

public void update(TudeySceneModel.Entry entry)
Description copied from class: EntrySprite
Updates the sprite with new entry state.

Specified by:
update in class EntrySprite

getModel

public Model getModel()
Description copied from class: Sprite
Returns the model associated with the sprite (if any).

Overrides:
getModel in class Sprite

setSelected

public void setSelected(boolean selected)
Description copied from class: EntrySprite
Sets whether or not this sprite is selected.

Overrides:
setSelected in class EntrySprite

dispose

public void dispose()
Description copied from class: SimpleScope
Releases the resources associated with this scope.

Overrides:
dispose in class SimpleScope

setConfig

protected void setConfig(ConfigReference<TileConfig> ref)
Sets the configuration of this tile.


setConfig

protected void setConfig(TileConfig config)
Sets the configuration of this tile.


updateFromConfig

protected void updateFromConfig()
Updates the tile to match its new or modified configuration.