public interface IPortCandidate
IPort
candidates used by IPortCandidateProvider
and the like.
Note that if an instance's Validity
property is PortCandidateValidity.DYNAMIC
this
instance getPortCandidateAt(IInputModeContext, PointD)
method serves as a factory for the actual candidates.
Modifier and Type | Method and Description |
---|---|
IPort |
createPort(IInputModeContext context)
If the client decides to use this port candidate, this method will serve as a factory to create the instance.
|
Object |
getCandidateTag()
Possibly yields a user defined tag for this candidate.
|
IPortLocationModelParameter |
getLocationParameter()
Returns the model parameter that will be used for the
LocationParameter if this
candidate is chosen. |
IPortOwner |
getOwner()
Returns the possible owner of the port to be created for this candidate.
|
IPort |
getPort()
Gets the port instance that is already live in the graph if this candidate wraps an existing port or
null
otherwise. |
IPortCandidate |
getPortCandidateAt(IInputModeContext context,
PointD location)
Returns a candidate that is derived from this instance that best fits the provided
location . |
PortCandidateValidity |
getValidity()
Determines whether this instance is a valid port candidate.
|
IPort createPort(IInputModeContext context)
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 UnsupportedOperationException
.
UnsupportedOperationException
- If the Validity
is PortCandidateValidity.DYNAMIC
.context
- 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.null
.IInputModeContext.getGraph()
,
getPort()
,
getPortCandidateAt(IInputModeContext, PointD)
Object getCandidateTag()
The interpretation of this value is implementation dependent and may be used for visual feedback or interactive behavior.
IPortLocationModelParameter getLocationParameter()
LocationParameter
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(IInputModeContext, PointD)
instance.
IPortOwner getOwner()
IPort getPort()
null
otherwise.null
otherwise.createPort(IInputModeContext)
IPortCandidate getPortCandidateAt(IInputModeContext context, PointD location)
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
.
context
- The input mode context for which a concrete candidate is queried.location
- The location for which a candidate should be returned.IPortCandidate
implementation whose Validity
is guaranteed to be
non-PortCandidateValidity.DYNAMIC
.getValidity()
PortCandidateValidity getValidity()
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(IInputModeContext, PointD)
needs to be
used to determine a concrete candidate instance.
getPortCandidateAt(IInputModeContext, PointD)