Packagecom.yworks.graph.model
Classpublic class DefaultPortCandidateDescriptor
InheritanceDefaultPortCandidateDescriptor Inheritance CanvasObjectDescriptorAdapter Inheritance Object
Implements IDisplayObjectCreator, IBoundsProvider, IHitTestable, IMarqueeTestable

A simple ICanvasObjectDescriptor that can be used to draw IPortCandidate instances in a CanvasComponent.



Public Properties
 PropertyDefined By
  candidateSize : int
Gets or sets the size to use for a valid candidate.
DefaultPortCandidateDescriptor
  currentCandidateSize : int
Gets or sets the size to use for the currentPortCandidate
DefaultPortCandidateDescriptor
  currentPortCandidate : IPortCandidate
Gets or sets the highlighted port candidate.
DefaultPortCandidateDescriptor
  invalidCenterFill : IFill
Gets or sets the fill to use for a invalid candidate.
DefaultPortCandidateDescriptor
  validCenterFill : IFill
Gets or sets the fill to use for a valid candidate.
DefaultPortCandidateDescriptor
Public Methods
 MethodDefined By
  
Instantiates a new descriptor.
DefaultPortCandidateDescriptor
  
Returns a tight rectangular area where the whole rendering would fit into.
DefaultPortCandidateDescriptor
  
DefaultPortCandidateDescriptor
  
getBoundsProvider(forUserObject:Object):IBoundsProvider
[override] Returns an implementation of IBoundsProvider that can determine the visible bounds of the rendering of the user object.
DefaultPortCandidateDescriptor
  
[override]
DefaultPortCandidateDescriptor
  
getHitTestable(forUserObject:Object):IHitTestable
[override] Returns an implementation of IHitTestable that can determine whether the rendering of the user object has been hit at a given coordinate.
DefaultPortCandidateDescriptor
  
isDirty(obj:ICanvasObject):Boolean
[override] Returns true if the canvas object needs to be repainted.
DefaultPortCandidateDescriptor
  
isHit(x:Number, y:Number, ctx:ICanvasContext):Boolean
Determines if something has been hit at the given coordinates in the world coordinate system.
DefaultPortCandidateDescriptor
  
Returns true if the corresponding item is considered to intersect the given rectangular box. This method may return false if the item cannot be selected using a selection marquee or optionally if the item is only partially contained within the box.
DefaultPortCandidateDescriptor
  
DefaultPortCandidateDescriptor
  
updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject
DefaultPortCandidateDescriptor
Property Detail
candidateSizeproperty
candidateSize:int

Gets or sets the size to use for a valid candidate.


Implementation
    public function get candidateSize():int
    public function set candidateSize(value:int):void
currentCandidateSizeproperty 
currentCandidateSize:int

Gets or sets the size to use for the currentPortCandidate


Implementation
    public function get currentCandidateSize():int
    public function set currentCandidateSize(value:int):void
currentPortCandidateproperty 
currentPortCandidate:IPortCandidate

Gets or sets the highlighted port candidate.

If this descriptor renders the same instance, it will be rendered highlighted.


Implementation
    public function get currentPortCandidate():IPortCandidate
    public function set currentPortCandidate(value:IPortCandidate):void
invalidCenterFillproperty 
invalidCenterFill:IFill

Gets or sets the fill to use for a invalid candidate.


Implementation
    public function get invalidCenterFill():IFill
    public function set invalidCenterFill(value:IFill):void
validCenterFillproperty 
validCenterFill:IFill

Gets or sets the fill to use for a valid candidate.


Implementation
    public function get validCenterFill():IFill
    public function set validCenterFill(value:IFill):void
Constructor Detail
DefaultPortCandidateDescriptor()Constructor
public function DefaultPortCandidateDescriptor()

Instantiates a new descriptor.

Method Detail
calculateBounds()method
public function calculateBounds(scratch:IMutableRectangle, ctx:ICanvasContext):IRectangle

Returns a tight rectangular area where the whole rendering would fit into.

Implementations can use the scratch rectangle to put their results in and return it as the result of the operation. Client has to always provide a non-null instance as a parameter. They may however decide to return an internally cached or dynamically created IRectangle implementation and disregard the scratch parameter. If calculating the bounds is too expensive or the painting is not bound to a certain area, this method may return null. If nothing is painted, this method should return an empty rectangle, where either or both the width and height is non-positive or ImmutableRectangle.Empty.

Parameters

scratch:IMutableRectangle — An instance that can optionally be used to fill with the corresponding values and be returned
 
ctx:ICanvasContext — The context to calculate the bounds for (currently not used)

Returns
IRectangle — The bounds or null to indicate an unbound area
createDisplayObject()method 
public function createDisplayObject(context:IDisplayObjectContext):DisplayObject

Parameters

context:IDisplayObjectContext

Returns
DisplayObject
getBoundsProvider()method 
override public function getBoundsProvider(forUserObject:Object):IBoundsProvider

Returns an implementation of IBoundsProvider that can determine the visible bounds of the rendering of the user object.

This method may always return the same instance. By contract, clients will not cache instances returned, but will always call this method before the methods on the instance will be called. This contract enables the use of the fly-weight design pattern. Implementations of this class can always return the same instance and reconfigure this instance upon each call to this method.

Parameters

forUserObject:Object — The user object to query the bounds for

Returns
IBoundsProvider — An implementation or null if the bounds are not known, in which case the bounds are treated as infinite
getDisplayObjectCreator()method 
override public function getDisplayObjectCreator(forUserObject:Object):IDisplayObjectCreator

Parameters

forUserObject:Object

Returns
IDisplayObjectCreator
getHitTestable()method 
override public function getHitTestable(forUserObject:Object):IHitTestable

Returns an implementation of IHitTestable that can determine whether the rendering of the user object has been hit at a given coordinate.

This method may always return the same instance. By contract, clients will not cache instances returned, but will always call this method before the methods on the instance will be called. This contract enables the use of the fly-weight design pattern. Implementations of this class can always return the same instance and reconfigure this instance upon each call to this method.

Parameters

forUserObject:Object — The user object to do the hit testing for

Returns
IHitTestable — An implementation or null if the rendering cannot be hit tested
isDirty()method 
override public function isDirty(obj:ICanvasObject):Boolean

Returns true if the canvas object needs to be repainted.

Parameters

obj:ICanvasObject — The canvas object.

Returns
Booleantrue if the canvas object needs to be repainted.
isHit()method 
public function isHit(x:Number, y:Number, ctx:ICanvasContext):Boolean

Determines if something has been hit at the given coordinates in the world coordinate system.

Parameters

x:Number — the x-coordinate in world coordinate system
 
y:Number — the y-coordinate in world coordinate system
 
ctx:ICanvasContext — the context the hit test is performed in

Returns
Boolean — whether something has been hit
isInBox()method 
public function isInBox(box:IRectangle, ctx:ICanvasContext):Boolean

Returns true if the corresponding item is considered to intersect the given rectangular box. This method may return false if the item cannot be selected using a selection marquee or optionally if the item is only partially contained within the box.

Parameters

box:IRectangle — The box describing the marquee's bounds
 
ctx:ICanvasContext — The current canvas context

Returns
Booleantrue if the item is considered to be captured by the marquee
paint()method 
public function paint(g:YGraphics, ctx:IPaintContext):void

Parameters

g:YGraphics
 
ctx:IPaintContext

updateDisplayObject()method 
public function updateDisplayObject(oldDisplayObject:DisplayObject, context:IDisplayObjectContext):DisplayObject

Parameters

oldDisplayObject:DisplayObject
 
context:IDisplayObjectContext

Returns
DisplayObject