public abstract class AbstractPortCandidateProvider extends Object implements IPortCandidateProvider
IPortCandidateProvider
interface.NO_CANDIDATES
Constructor and Description |
---|
AbstractPortCandidateProvider() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
combine, combine, fromCandidates, fromCandidates, fromExistingPorts, fromNodeCenter, fromPortDefaults, fromShapeGeometry, fromShapeGeometry, fromUnoccupiedPorts
protected void addExistingPorts(IPortOwner owner, List<IPortCandidate> list)
Ports
of the owner
to the
provided list.owner
- The port owner whose ports should be added.list
- The list to add candidates for existing ports to.protected final DefaultPortCandidate createCandidate(IPortOwner owner, IPortLocationModelParameter locationParameter)
createInstance(IInputModeContext, DefaultPortCandidate)
method of this instance to delegate IPortCandidate.createPort(IInputModeContext)
queries to.owner
- The owner to use for the candidate.locationParameter
- The location of the candidate. This instance is assigned by reference to the candidate.IPortCandidate.createPort(IInputModeContext)
method delegates to this instance's
createInstance(IInputModeContext, DefaultPortCandidate)
.protected final DefaultPortCandidate createCandidate(IPortOwner owner, IPortLocationModelParameter locationParameter, boolean valid)
createInstance(IInputModeContext, DefaultPortCandidate)
method of this instance to delegate IPortCandidate.createPort(IInputModeContext)
queries to.locationParameter
- The location of the candidate. This instance is assigned by reference to the candidate.owner
- The owner to use for the candidate.valid
- Whether the port should be PortCandidateValidity.VALID
.IPortCandidate.createPort(IInputModeContext)
method delegates to this instance's
createInstance(IInputModeContext, DefaultPortCandidate)
.protected IPort createInstance(IInputModeContext context, DefaultPortCandidate candidate)
createCandidate(IPortOwner, IPortLocationModelParameter, boolean)
.
This method can be overridden by subclasses to perform more sophisticated port creation logic.
context
- The context in which the instance is created.candidate
- The candidate to create a port for.protected IPortCandidate getPortCandidateAt(IInputModeContext context, DefaultPortCandidate candidate, PointD suggestedLocation)
createCandidate(IPortOwner, IPortLocationModelParameter, boolean)
.
This method can be overridden by subclasses to perform more sophisticated candidate creation logic.
context
- The context in which the instance is created.candidate
- The candidate to create a port for.suggestedLocation
- The location to get a candidate for.Validity
may not be PortCandidateValidity.DYNAMIC
.protected abstract Iterable<IPortCandidate> getPortCandidates(IInputModeContext context)
This method is used as a callback by most of the getter methods in this class. Subclasses should override this method to provide the same candidates for all use-cases.
context
- The context for which the candidates should be provided.public Iterable<IPortCandidate> getSourcePortCandidates(IInputModeContext context)
getPortCandidates(IInputModeContext)
.getSourcePortCandidates
in interface IPortCandidateProvider
context
- The context for which the candidates should be provided.public Iterable<IPortCandidate> getSourcePortCandidates(IInputModeContext context, IPortCandidate target)
getPortCandidates(IInputModeContext)
.getSourcePortCandidates
in interface IPortCandidateProvider
target
- The opposite port candidate.public final IPortStyle getStyle()
createInstance(IInputModeContext, DefaultPortCandidate)
.
A value of null
will make the implementation use the corresponding current default port style.
setStyle(IPortStyle)
public final Object getTag()
createInstance(IInputModeContext, DefaultPortCandidate)
.setTag(Object)
public Iterable<IPortCandidate> getTargetPortCandidates(IInputModeContext context)
getPortCandidates(IInputModeContext)
.getTargetPortCandidates
in interface IPortCandidateProvider
context
- The context for which the candidates should be provided.public Iterable<IPortCandidate> getTargetPortCandidates(IInputModeContext context, IPortCandidate source)
getPortCandidates(IInputModeContext)
.getTargetPortCandidates
in interface IPortCandidateProvider
context
- The context for which the candidates should be provided.source
- The opposite port candidate.public final void setStyle(IPortStyle value)
createInstance(IInputModeContext, DefaultPortCandidate)
.
A value of null
will make the implementation use the corresponding current default port style.
value
- The Style to set.getStyle()
public final void setTag(Object value)
createInstance(IInputModeContext, DefaultPortCandidate)
.value
- The Tag to set.getTag()