public class IconLabelStyle extends Object implements ILabelStyle, Cloneable
This style draws the icon at the location specified by IconPlacement
and delegates the
drawing of the label's text to the Wrapped
style.
Constructor and Description |
---|
IconLabelStyle()
Creates a new instance using no icon and
IconLabelStyleRenderer as renderer. |
IconLabelStyle(String iconUrl)
Creates a new instance using the provided url and
IconLabelStyleRenderer as renderer. |
IconLabelStyle(String iconUrl,
IconLabelStyleRenderer renderer)
Creates a new instance using the provided url and renderer.
|
Modifier and Type | Method and Description |
---|---|
IconLabelStyle |
clone()
Creates a copy of this object and returns it.
|
Image |
getIcon()
Gets the icon to paint for the label.
|
ILabelModelParameter |
getIconPlacement()
Gets the parameter that specifies the icon placement.
|
SizeD |
getIconSize()
Gets the size of the icon to paint for the label.
|
IconLabelStyleRenderer |
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.
|
String |
getUrl()
Returns the string representing the URL to get the pixel data of the icon.
|
ILabelStyle |
getWrapped()
Gets the style that renders the text of the label.
|
InsetsD |
getWrappedInsets()
Gets the insets that should be applied for the
layout of the wrapped style
rendering. |
boolean |
isAutoFlippingEnabled()
|
void |
setAutoFlippingEnabled(boolean value)
|
void |
setIconPlacement(ILabelModelParameter value)
Sets the parameter that specifies the icon placement.
|
void |
setIconSize(SizeD value)
Sets the size of the icon to paint for the label.
|
void |
setUrl(String url)
Sets the string representing the URL to get the pixel data of the icon.
|
void |
setWrapped(ILabelStyle value)
Sets the style that renders the text of the label.
|
void |
setWrappedInsets(InsetsD value)
Sets the insets that should be applied for the
layout of the wrapped style
rendering. |
public IconLabelStyle()
IconLabelStyleRenderer
as renderer.public IconLabelStyle(String iconUrl)
IconLabelStyleRenderer
as renderer.iconUrl
- The url of the icon to draw.public IconLabelStyle(String iconUrl, IconLabelStyleRenderer renderer)
iconUrl
- The url of the icon to draw.renderer
- The custom renderer for this style instance.public final IconLabelStyle clone()
ICloneable
clone
in interface ICloneable
clone
in class Object
Object.clone()
public final Image getIcon()
public final ILabelModelParameter getIconPlacement()
All valid node label model parameters can be used. The label's layout
will be interpreted as the a node's layout and the icon will be placed relative to that layout as if it was a node's
label.
The default value is ExteriorLabelModel.WEST
.
NullPointerException
- value
is null.setIconPlacement(ILabelModelParameter)
public final SizeD getIconSize()
The default value is SizeD.EMPTY
.
setIconSize(SizeD)
public final IconLabelStyleRenderer getRenderer()
ILabelStyle
The idiom for retrieving, e.g. an IVisualCreator
implementation for a given style is:
getRenderer
in interface ILabelStyle
public String getUrl()
public final ILabelStyle getWrapped()
This style will be rendered before the icon and is responsible for rendering the
Text
, since IconLabelStyleRenderer
will only render the
Icon
.
The default value is DefaultLabelStyle
.
NullPointerException
- value
is null.setWrapped(ILabelStyle)
public final InsetsD getWrappedInsets()
layout
of the wrapped style
rendering.
The IconLabelStyleRenderer.getPreferredSize(com.yworks.yfiles.graph.ILabel, ILabelStyle)
will take the preferred
size of the Wrapped
's ILabelStyleRenderer
and add these insets to it. During the rendering
these insets will be used to offset the rendering of the wrapped style.
The default insets are empty.
setWrappedInsets(InsetsD)
public final boolean isAutoFlippingEnabled()
layout
's up vector
point downwards.
The default value is true
.
true
if this style should automatically flip the rendering so that it is never rendered upside down; false
otherwise.setAutoFlippingEnabled(boolean)
public final void setAutoFlippingEnabled(boolean value)
layout
's up vector
point downwards.
The default value is true
.
value
- true
if this style should automatically flip the rendering so that it is never rendered upside down; false
otherwise.isAutoFlippingEnabled()
public final void setIconPlacement(ILabelModelParameter value)
All valid node label model parameters can be used. The label's layout
will be interpreted as the a node's layout and the icon will be placed relative to that layout as if it was a node's
label.
The default value is ExteriorLabelModel.WEST
.
NullPointerException
- value
is null.value
- The icon placement parameter.getIconPlacement()
public final void setIconSize(SizeD value)
The default value is SizeD.EMPTY
.
value
- The icon size.getIconSize()
public void setUrl(String url)
public final void setWrapped(ILabelStyle value)
This style will be rendered before the icon and is responsible for rendering the
Text
, since IconLabelStyleRenderer
will only render the
Icon
.
The default value is DefaultLabelStyle
.
NullPointerException
- value
is null.value
- The style that renders the text of the label.getWrapped()
public final void setWrappedInsets(InsetsD value)
layout
of the wrapped style
rendering.
The IconLabelStyleRenderer.getPreferredSize(com.yworks.yfiles.graph.ILabel, ILabelStyle)
will take the preferred
size of the Wrapped
's ILabelStyleRenderer
and add these insets to it. During the rendering
these insets will be used to offset the rendering of the wrapped style.
The default insets are empty.
value
- The insets for the wrapped style rendering.getWrappedInsets()