public class MemoryIconLabelStyle extends Object implements ILabelStyle, Cloneable
ILabelStyle
interface
that uses BitmapSources
that are built from
memory as the icon
.
During serialization this instance will serialize the contents of the icon.
Note: by default the image contents are serialized in PNG format. Since the PNG conversion depends on classes
in packages javax.imageio
and javafx.embed.swing
image serialization will not be handled on
platforms where these packages are not available (e.g. Android). Developers who want to provide serialization support
for images on these platforms have to register a custom
GraphMLIOHandler.addHandleSerializationListener(IEventHandler)
serialization} and
GraphMLIOHandler.addHandleDeserializationListener(IEventHandler)
deserialization}
handler.
Constructor and Description |
---|
MemoryIconLabelStyle()
Creates a new instance using no icon and
IconLabelStyleRenderer as renderer. |
MemoryIconLabelStyle(Image icon)
Creates a new instance using the provided icon and
IconLabelStyleRenderer as renderer. |
MemoryIconLabelStyle(Image icon,
IconLabelStyleRenderer renderer)
Creates a new instance using the provided icon and renderer.
|
Modifier and Type | Method and Description |
---|---|
MemoryIconLabelStyle |
clone()
Creates a copy of this object and returns it.
|
Image |
getIcon()
Gets the icon to paint for the label.
|
ILabelModelParameter |
getIconPlacement()
Gets the icon placement model parameter.
|
SizeD |
getIconSize()
Gets the size of the icon to paint for the label.
|
ILabelStyle |
getInnerStyle()
Gets the inner style to decorate.
|
InsetsD |
getInnerStyleInsets()
Gets the insets that should be applied for the
layout of the inner style
rendering. |
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.
|
boolean |
isAutoFlippingEnabled()
|
void |
setAutoFlippingEnabled(boolean value)
|
void |
setIcon(Image value)
Sets the icon to paint for the label.
|
void |
setIconPlacement(ILabelModelParameter value)
Sets the icon placement model parameter.
|
void |
setIconSize(SizeD value)
Sets the size of the icon to paint for the label.
|
void |
setInnerStyle(ILabelStyle value)
Sets the inner style to decorate.
|
void |
setInnerStyleInsets(InsetsD value)
Sets the insets that should be applied for the
layout of the inner style
rendering. |
public MemoryIconLabelStyle()
IconLabelStyleRenderer
as renderer.public MemoryIconLabelStyle(Image icon)
IconLabelStyleRenderer
as renderer.icon
- The icon to draw.public MemoryIconLabelStyle(Image icon, IconLabelStyleRenderer renderer)
icon
- The icon to draw.renderer
- The custom renderer for this style instance.public final MemoryIconLabelStyle clone()
ICloneable
clone
in interface ICloneable
clone
in class Object
Object.clone()
public final Image getIcon()
setIcon(Image)
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 ILabelStyle getInnerStyle()
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.setInnerStyle(ILabelStyle)
public final InsetsD getInnerStyleInsets()
layout
of the inner style
rendering.
The IconLabelStyleRenderer.getPreferredSize(com.yworks.yfiles.graph.ILabel, ILabelStyle)
will take the preferred
size of the InnerStyle
's ILabelStyleRenderer
and add these insets to it. During the rendering
these insets will be used to offset the rendering of the inner style.
The default insets are empty.
setInnerStyleInsets(InsetsD)
public final IconLabelStyleRenderer getRenderer()
ILabelStyle
The idiom for retrieving, e.g. an IVisualCreator
implementation for a given style is:
getRenderer
in interface ILabelStyle
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;
otherwise,
false
.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;
otherwise,
false
.isAutoFlippingEnabled()
public final void setIcon(Image value)
value
- The icon.getIcon()
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 final void setInnerStyle(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 inner style to decorate.getInnerStyle()
public final void setInnerStyleInsets(InsetsD value)
layout
of the inner style
rendering.
The IconLabelStyleRenderer.getPreferredSize(com.yworks.yfiles.graph.ILabel, ILabelStyle)
will take the preferred
size of the InnerStyle
's ILabelStyleRenderer
and add these insets to it. During the rendering
these insets will be used to offset the rendering of the inner style.
The default insets are empty.
value
- The insets for the inner style rendering.getInnerStyleInsets()