public class TemplatePortStyle extends AbstractTemplateStyle<IPort> implements IPortStyle
IPortStyle interface that can render complex Nodes for the visualization of
IPorts by using TemplatePortStyleRenderer.
The StyleResourceKey is used to determine the Style that will be applied to the
Node. The style will be looked-up from the CanvasControl the style is used
in. Note that the RenderSize should be specified to match the size of the control style.
| Constructor and Description |
|---|
TemplatePortStyle()
Creates a new instance with no style resource key and
TemplatePortStyleRenderer as renderer. |
TemplatePortStyle(String styleResourceKey)
Creates a new instance using the given resource key and a custom renderer instance
TemplatePortStyleRenderer as
renderer. |
TemplatePortStyle(String styleResourceKey,
TemplatePortStyleRenderer renderer)
Creates a new instance using the given resource key and a custom renderer instance.
|
| Modifier and Type | Method and Description |
|---|---|
Node |
createControl(IRenderContext context,
IPort port)
Factory method that is called by the
TemplatePortStyleRenderer to create the control that will be used for the
display of the port. |
GeneralPath |
getNormalizedOutline()
Gets the normalized outline of a port that will be displayed using the
created control. |
SizeD |
getPreferredSize(IRenderContext context,
IPort port)
Convenience method that determines the preferred
RenderSize of the port if this style was
applied. |
TemplatePortStyleRenderer |
getRenderer()
Gets the renderer implementation that can be queried for implementations that provide details about the visual
appearance and visual behavior for a given port and this style instance.
|
SizeD |
getRenderSize()
Gets the
SizeD of a port that will be displayed using the
created control. |
protected URL |
getStyle(IRenderContext context,
IModelItem port)
Callback method that determines the
Style for the Node. |
String |
getStyleResourceKey()
|
void |
setNormalizedOutline(GeneralPath value)
Sets the normalized outline of a port that will be displayed using the
created control. |
void |
setRenderSize(SizeD value)
Sets the
SizeD of a port that will be displayed using the
created control. |
void |
setStyleResourceKey(String value)
|
addPropertyChangedListener, clone, getCanvasPropertyKey, getClassLoader, getContentPropertyKey, getContextLookup, getFXMLLoader, getItemPropertyKey, getStyleTag, onPropertyChanged, removePropertyChangedListener, setCanvasPropertyKey, setClassLoader, setContentPropertyKey, setContextLookup, setItemPropertyKey, setStyleTagequals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitclonepublic TemplatePortStyle()
TemplatePortStyleRenderer as renderer.public TemplatePortStyle(String styleResourceKey)
TemplatePortStyleRenderer as
renderer.styleResourceKey - The key of the style resource that will be used for the Node.public TemplatePortStyle(String styleResourceKey, TemplatePortStyleRenderer renderer)
styleResourceKey - The key of the style resource that will be used for the Node.renderer - The custom renderer for this style instance.public Node createControl(IRenderContext context, IPort port)
TemplatePortStyleRenderer to create the control that will be used for the
display of the port.context - The context for which the control should be created.port - The port that will be rendered.public final GeneralPath getNormalizedOutline()
created control.
The shape will automatically be arranged and transformed to have the bounds of the port. This shape will be used to
satisfy requests to IMarqueeTestable.isInBox(com.yworks.yfiles.view.input.IInputModeContext, com.yworks.yfiles.geometry.RectD)
and IHitTestable.isHit(com.yworks.yfiles.view.input.IInputModeContext, com.yworks.yfiles.geometry.PointD)
and may be left null to indicate default (rectangular) behavior.
The default value is null.
setNormalizedOutline(GeneralPath)public SizeD getPreferredSize(IRenderContext context, IPort port)
RenderSize of the port if this style was
applied.context - The context for which the size should be calculated.port - The port to determine the preferred size of.public final TemplatePortStyleRenderer getRenderer()
IPortStyle
The idiom for retrieving, e.g. an IVisualCreator implementation for a given style is:
getRenderer in interface IPortStylepublic final SizeD getRenderSize()
SizeD of a port that will be displayed using the
created control.
This size will be used to arrange the control correctly.
The default value is (5,5).
setRenderSize(SizeD)protected URL getStyle(IRenderContext context, IModelItem port)
Style for the Node.context - The context for which the style is needed.port - The port that will be rendered.null.public final String getStyleResourceKey()
String that will be used to look up
the URL to the FXML file which encodes
the Control.
The default value is null.
null in which case the default template will be used.setStyleResourceKey(String)public final void setNormalizedOutline(GeneralPath value)
created control.
The shape will automatically be arranged and transformed to have the bounds of the port. This shape will be used to
satisfy requests to IMarqueeTestable.isInBox(com.yworks.yfiles.view.input.IInputModeContext, com.yworks.yfiles.geometry.RectD)
and IHitTestable.isHit(com.yworks.yfiles.view.input.IInputModeContext, com.yworks.yfiles.geometry.PointD)
and may be left null to indicate default (rectangular) behavior.
The default value is null.
value - The NormalizedOutline to set.getNormalizedOutline()public final void setRenderSize(SizeD value)
SizeD of a port that will be displayed using the
created control.
This size will be used to arrange the control correctly.
The default value is (5,5).
value - The RenderSize to set.getRenderSize()public final void setStyleResourceKey(String value)
String that will be used to look up
the URL to the FXML file which encodes
the Control.
The default value is null.
value - The resource key for the style or null in which case the default template will be used.getStyleResourceKey()