com.yworks.yfiles.server.graphml.flexio
Interface LabelSizeCalculator

All Known Implementing Classes:
NodeStyleLabelStyleAdapter, SimpleLabelStyle, TLFLabelStyle

public interface LabelSizeCalculator

Implementors of this interface calculate the size of a Label.

The labels with no preferred size are queried by StyledLayoutGraph.setStyle(y.base.Node, com.yworks.yfiles.server.graphml.flexio.data.INodeStyle) or StyledLayoutGraph.setStyle(y.base.Node, com.yworks.yfiles.server.graphml.flexio.data.INodeStyle) for a style which implements this interface.

Note that the size on the client still may differ from the calculated size.


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.
 

Method Detail

getCalculatedSize

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

Before calling this method, canCalculateSize(com.yworks.yfiles.server.graphml.flexio.data.Label) should be queried if all prerequesites are met to calculate the size.

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(com.yworks.yfiles.server.graphml.flexio.data.Label) is called.

Parameters:
l - The label to calculate the size for.
Returns:
true if the size can be calculated.


Copyright © 2000-2013 yWorks GmbH. All rights reserved