com.yworks.yfiles.server.graphml.flexio.data
Class NodeStyleLabelStyleAdapter

java.lang.Object
  extended bycom.yworks.yfiles.server.graphml.flexio.data.NodeStyleLabelStyleAdapter
All Implemented Interfaces:
ILabelStyle, ISharedInstanceProvider, LabelSizeCalculator

public class NodeStyleLabelStyleAdapter
extends java.lang.Object
implements ILabelStyle, LabelSizeCalculator, ISharedInstanceProvider

A yFiles FLEX client label style data object that uses a node style instance to render the background and a label style instance to render the foreground of a label.


Constructor Summary
NodeStyleLabelStyleAdapter(INodeStyle nodeStyle, ILabelStyle labelStyle)
          Create a new instance using the given node style and label style
 
Method Summary
 boolean canCalculateSize(Label l)
          Whether the size of the given label can be calculated.
 YDimension getCalculatedSize(Label l)
          Calculates the size of a given label.
 ILabelStyle getLabelStyle()
          The label style that will be used to draw the foreground of the label.
 INodeStyle getNodeStyle()
          The node style that will be used to draw the background of the label.
 java.util.Collection getSharedInstances()
          Returns an Collection for objects that shall be shared.
 void setLabelStyle(ILabelStyle labelStyle)
          The label style that will be used to draw the foreground of the label.
 void setNodeStyle(INodeStyle nodeStyle)
          The node style that will be used to draw the background of the label.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NodeStyleLabelStyleAdapter

public NodeStyleLabelStyleAdapter(INodeStyle nodeStyle,
                                  ILabelStyle labelStyle)
Create a new instance using the given node style and label style

Parameters:
nodeStyle - The node style to use for painting the label's background
labelStyle - The label style to use for painting the label's foreground
Method Detail

getNodeStyle

public INodeStyle getNodeStyle()
The node style that will be used to draw the background of the label.


setNodeStyle

public void setNodeStyle(INodeStyle nodeStyle)
The node style that will be used to draw the background of the label.


getLabelStyle

public ILabelStyle getLabelStyle()
The label style that will be used to draw the foreground of the label.


setLabelStyle

public void setLabelStyle(ILabelStyle labelStyle)
The label style that will be used to draw the foreground of the label.


getCalculatedSize

public YDimension getCalculatedSize(Label l)
                             throws java.lang.IllegalArgumentException
Calculates the size of a given label.

Before calling this method, canCalculateSize(Label) should be queried if all prerequesites are met to calculate the size.

Specified by:
getCalculatedSize in interface LabelSizeCalculator
Parameters:
l - The label to calculate the size for.
Returns:
The calculated size of the label.
Throws:
java.lang.IllegalArgumentException - If the size of the label cannot be calculated.

canCalculateSize

public boolean canCalculateSize(Label l)
Whether the size of the given label can be calculated.

Usually, some prerequesites have to be met in order to calculate the size of a label. Most commonly, at least font has to be set to the style.

This method should always be called before getCalculatedSize(Label) is called.

Specified by:
canCalculateSize in interface LabelSizeCalculator
Parameters:
l - The label to calculate the size for.
Returns:
true if the size can be calculated.

getSharedInstances

public java.util.Collection getSharedInstances()
Description copied from interface: ISharedInstanceProvider
Returns an Collection for objects that shall be shared.

Specified by:
getSharedInstances in interface ISharedInstanceProvider
Returns:


Copyright © 2000-2013 yWorks GmbH. All rights reserved