Packagecom.yworks.graph.model
Interfacepublic interface IPortCandidate
Implementors DefaultPortCandidate

An interface for possible IPort candidates used by IPortCandidateProvider and the like. Note that if an instance's validity property is PortCandidateValidity.DYNAMIC this instance getPortCandidateAt method serves as a factory for the actual candidates.

See also

PortCandidateValidity
getPortCandidateAt
IEdgePortCandidateProvider
IPortCandidateProvider
DefaultPortCandidate


Public Properties
 PropertyDefined By
  candidateTag : Object
[read-only] Possibly yields a user defined tag for this candidate.
IPortCandidate
  locationModelParameter : IPortLocationModelParameter
[read-only] Returns the model parameter that will be used for the port if this candidate is chosen.
IPortCandidate
  owner : IPortOwner
[read-only] Returns the possible owner of the port to be created for this candidate.
IPortCandidate
  validity : PortCandidateValidity
[read-only] Determines whether this instance is a valid port candidate.
IPortCandidate
Public Methods
 MethodDefined By
  
If the client decides to use this port candidate, this method will serve as a factory to create the instance.
IPortCandidate
  
Returns the instance that is already live in the graph if this candidate wraps an exisiting port or null otherwise.
IPortCandidate
  
Returns a candidate that is derived from this instance that best fits the provided location.
IPortCandidate
Property Detail
candidateTagproperty
candidateTag:Object  [read-only]

Possibly yields a user defined tag for this candidate.

The interpretation of this value is implementation dependent and may be used for visual feedback or interactive behavior.


Implementation
    public function get candidateTag():Object
locationModelParameterproperty 
locationModelParameter:IPortLocationModelParameter  [read-only]

Returns the model parameter that will be used for the port if this candidate is chosen. Note that the value of this property is undefined if this instance's validity is PortCandidateValidity.DYNAMIC. In this case, the parameter needs to be obtained via the getPortCandidateAt instance.


Implementation
    public function get locationModelParameter():IPortLocationModelParameter

See also

ownerproperty 
owner:IPortOwner  [read-only]

Returns the possible owner of the port to be created for this candidate.


Implementation
    public function get owner():IPortOwner
validityproperty 
validity:PortCandidateValidity  [read-only]

Determines whether this instance is a valid port candidate.

Implementations of IPortCandidateProvider may return sets of port candidates where some of them are marked as invalid e.g. in order to provide visual feedback. If the value is PortCandidateValidity.DYNAMIC, method getPortCandidateAt needs to be used to determine a concrete candidate instance.


Implementation
    public function get validity():PortCandidateValidity

See also

Method Detail
createInstance()method
public function createInstance(context:IInputModeContext):IPort

If the client decides to use this port candidate, this method will serve as a factory to create the instance.

If this candidate wraps an existing port, it may return that instance. If this instance's validity is PortCandidateValidity.DYNAMIC this method may throw an error.

Parameters

context:IInputModeContext — The input mode context for which the port will be created. Implementations can depend on it providing an IGraph instance in the lookup of the instance.

Returns
IPort — The port instance to use if this candidate has been chosen. This method may not return null.
getInstance()method 
public function getInstance():IPort

Returns the instance that is already live in the graph if this candidate wraps an exisiting port or null otherwise.

Returns
IPort — The instance to use or otherwise.

See also

getPortCandidateAt()method 
public function getPortCandidateAt(context:IInputModeContext, location:IPoint):IPortCandidate

Returns a candidate that is derived from this instance that best fits the provided location. This method needs to be called by clients if the validity of this instance is PortCandidateValidity.DYNAMIC. In that case calling this method must return an instance whose validity is not PortCandidateValidity.DYNAMIC.

Parameters

context:IInputModeContext — The input mode context for which a concrete candidate is queried.
 
location:IPoint — The location for which a candidate should be returned.

Returns
IPortCandidate — An IPortCandidate implementation whose validity is guaranteed to be non-DYNAMIC.

See also