Packagecom.yworks.graph.model
Classpublic class AbstractModelItem
InheritanceAbstractModelItem Inheritance Object
Implements IModelItem, IMutableLookup
Subclasses AbstractLabeledItem, DefaultBend, DefaultLabel, DefaultPort

A basic implementation of a IModelItem with support for pluggable ILookup implementations.



Protected Properties
 PropertyDefined By
  _lookupMap : IMapper
The map which is used by registerLookup() to store instances in.
AbstractModelItem
Public Methods
 MethodDefined By
  
AbstractModelItem(lookup:ILookup = null)
Creates a new item using the given initial lookup implementation, which may be null.
AbstractModelItem
  
Returns the currently set ILookup delegate.
AbstractModelItem
  
lookup(type:Class):Object
Simple lookup implementation that tries to find a registered lookup.
AbstractModelItem
  
registerLookup(type:Class, instance:Object):void
Register an implementation for the given type that should be returned when lookup is called with this given type.
AbstractModelItem
  
Sets the ILookup implementation used for lookup calls on this instance.
AbstractModelItem
Property Detail
_lookupMapproperty
protected var _lookupMap:IMapper

The map which is used by registerLookup() to store instances in. This map is lazily created upon first access to registerLookup(). Subclasses which access this map have to test for null.

Constructor Detail
AbstractModelItem()Constructor
public function AbstractModelItem(lookup:ILookup = null)

Creates a new item using the given initial lookup implementation, which may be null.

Parameters
lookup:ILookup (default = null)
Method Detail
getLookup()method
public function getLookup():ILookup

Returns the currently set ILookup delegate.

Returns
ILookup — The current lookup delegate

See also

lookup()method 
public function lookup(type:Class):Object

Simple lookup implementation that tries to find a registered lookup. If no such lookup is registered, returns this if this is assignable to the provided type.

This implementation tries to find an implementation of the given type in the following order:

Parameters

type:Class — The query type

Returns
Object — An implementation of type or null.

See also

registerLookup()method 
public function registerLookup(type:Class, instance:Object):void

Register an implementation for the given type that should be returned when lookup is called with this given type.

Parameters

type:Class — A type to register an implementation for
 
instance:Object — An implementation of type

setLookupImplementation()method 
public function setLookupImplementation(newLookup:ILookup):void

Sets the ILookup implementation used for lookup calls on this instance.

Parameters

newLookup:ILookup — the new implementation to use

See also