Packagecom.yworks.graph.model
Classpublic class DefaultItemLookup
InheritanceDefaultItemLookup Inheritance Object
Implements ILookup, IContextLookup, IContextLookupChainLink
Subclasses DefaultBendLookup, DefaultColumnLookup, DefaultEdgeLookup, DefaultLabelLookup, DefaultNodeLookup, DefaultPortLookup, DefaultRowLookup, DefaultStripeLookup

An abstract base class for a ILookup implementation that also implements IContextLookupChainLink and IContextLookup.

Subclass implementers should override itemLookup() only.



Protected Properties
 PropertyDefined By
  item : IModelItem
[read-only] Gets the context item.
DefaultItemLookup
Public Methods
 MethodDefined By
  
Creates an instance using the given context item.
DefaultItemLookup
  
lookup(type:Class):Object
Returns an instance that implements the given type or null.
DefaultItemLookup
  
lookupForItem(item:Object, type:Class):Object
Tries to create or retrieve an implementation of the given type for a given item.
DefaultItemLookup
  
setItem(item:IModelItem):void
Sets the context item.
DefaultItemLookup
  
This method is called by the framework to register the fallback lookup implementation that should be used during a call to IContextLookup.lookup().
DefaultItemLookup
Protected Methods
 MethodDefined By
  
itemLookup(item:IModelItem, type:Class, nextLookup:ILookup, lastLookup:ILookup):Object
Subclasses need to override this method.
DefaultItemLookup
Property Detail
itemproperty
item:IModelItem  [read-only]

Gets the context item.


Implementation
    protected function get item():IModelItem
Constructor Detail
DefaultItemLookup()Constructor
public function DefaultItemLookup(item:IModelItem = null)

Creates an instance using the given context item.

Parameters
item:IModelItem (default = null)
Method Detail
itemLookup()method
protected function itemLookup(item:IModelItem, type:Class, nextLookup:ILookup, lastLookup:ILookup):Object

Subclasses need to override this method.

Parameters

item:IModelItem — The context item to lookup an implementation for.
 
type:Class — The type of the implementation to find.
 
nextLookup:ILookup — The lookup to use for another type.
 
lastLookup:ILookup — The lookup to use as a fallback for the type.

Returns
Object — An implementation of type or null.
lookup()method 
public function lookup(type:Class):Object

Returns an instance that implements the given type or null.

This implementation delegates to itemLookup(), unless the context item is null in which case it will return null.

Parameters

type:Class

Returns
Object
lookupForItem()method 
public function lookupForItem(item:Object, type:Class):Object

Tries to create or retrieve an implementation of the given type for a given item.

Parameters

item:Object — the item to lookup a type for
 
type:Class — the type to look up

Returns
Object — an implementation or null
setItem()method 
public function setItem(item:IModelItem):void

Sets the context item.

Parameters

item:IModelItem

setNext()method 
public function setNext(next:IContextLookup):void

This method is called by the framework to register the fallback lookup implementation that should be used during a call to IContextLookup.lookup().

If the implementation cannot satisfy the query, it will use the provided context as a fallback. Note that implementations can also use the results returned by the next lookup and decorate it appropriately.

Parameters

next:IContextLookup — The context to use as a fallback.