public class TemplateLabelStyle extends AbstractTemplateStyle<ILabel> implements ILabelStyle
ILabelStyle
implementation that can render complex Node
s for the visualization of ILabel
s
using TemplateLabelStyleRenderer
.
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.
Constructor and Description |
---|
TemplateLabelStyle()
Creates a new instance with no style resource key and
TemplateLabelStyleRenderer as renderer. |
TemplateLabelStyle(String styleResourceKey)
Creates a new instance using the given resource key and
TemplateLabelStyleRenderer as renderer. |
TemplateLabelStyle(String styleResourceKey,
TemplateLabelStyleRenderer 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,
ILabel label)
Factory method that is called by the
TemplateLabelStyleRenderer to create the control that will be used for the
display of the label. |
GeneralPath |
getNormalizedOutline()
Gets the normalized outline of a label that will be displayed using the
created control . |
SizeD |
getPreferredSize(IRenderContext context,
ILabel label)
Convenience method that determines the preferred size of the label if this style was applied.
|
TemplateLabelStyleRenderer |
getRenderer()
Gets the renderer implementation that can be queried for implementations that provide details about the visual
appearance and visual behavior for a given label and this style instance.
|
protected URL |
getStyle(IRenderContext context,
IModelItem label)
|
String |
getStyleResourceKey()
|
boolean |
isAutoFlippingEnabled()
Gets a value indicating whether the rendering should automatically be flipped (rotated by 180 degrees) if otherwise it
would be rendered upside-down.
|
void |
setAutoFlippingEnabled(boolean value)
Sets a value indicating whether the rendering should automatically be flipped (rotated by 180 degrees) if otherwise it
would be rendered upside-down.
|
void |
setNormalizedOutline(GeneralPath value)
Sets the normalized outline of a label 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, setStyleTag
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
clone
public TemplateLabelStyle()
TemplateLabelStyleRenderer
as renderer.public TemplateLabelStyle(String styleResourceKey)
TemplateLabelStyleRenderer
as renderer.styleResourceKey
- The key of the style resource that will be used for the Node
.public TemplateLabelStyle(String styleResourceKey, TemplateLabelStyleRenderer 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, ILabel label)
TemplateLabelStyleRenderer
to create the control that will be used for the
display of the label.context
- The context for which the control should be created.label
- The label that will be rendered.public final GeneralPath getNormalizedOutline()
created control
.
The shape will automatically arranged and transformed to have the bounds of the label. 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, ILabel label)
context
- The context for which the size should be calculated.label
- The label to determine the preferred size of.public final TemplateLabelStyleRenderer getRenderer()
ILabelStyle
The idiom for retrieving, e.g. an IVisualCreator
implementation for a given style is:
getRenderer
in interface ILabelStyle
protected URL getStyle(IRenderContext context, IModelItem label)
context
- The context for which the style is needed.label
- The label that will be rendered.null
.public final String getStyleResourceKey()
null
in which case the default template will be used.setStyleResourceKey(java.lang.String)
public final boolean isAutoFlippingEnabled()
The default value is true
.
true
if labels should be flipped automatically; false
otherwise.setAutoFlippingEnabled(boolean)
public final void setAutoFlippingEnabled(boolean value)
The default value is true
.
value
- true
if labels should be flipped automatically; false
otherwise.isAutoFlippingEnabled()
public final void setNormalizedOutline(GeneralPath value)
created control
.
The shape will automatically arranged and transformed to have the bounds of the label. 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 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()