Package org.eclipse.birt.chart.computation

# Class LabelLimiter

java.lang.Object
org.eclipse.birt.chart.computation.LabelLimiter

public class LabelLimiter extends Object
Helper class to limit the size of a label by wrapping its text or shorten its text with ellipsis.

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`LabelLimiter.Option`
Options used by method limitLabelSize.

## Constructor Summary

Constructors
Constructor
Description
`LabelLimiter(double maxWidth, double maxHeight, double wrapping)`
Constructor

## Method Summary

Modifier and Type
Method
Description
`double`
`computeWrapping(IDisplayServer xs, Label la)`
`static final double`
`computeWrapping(IDisplayServer xs, Label la, LabelLimiter lbLimit)`
Compute the wrapping with maxWidth, maxHeight.
`BoundingBox`
`getBounding(BoundingBox bb)`
Returns a bounding box using maxWidth and maxHeight
`final double`
`getMaxHeight()`
`final double`
`getMaxWidth()`
`final double`
`getWrapping()`
`final boolean`
`isSuccessed()`
`LabelLimiter`
`limitLabelSize(IChartComputation cComp, IDisplayServer xs, Label la)`
modify the text of la to fit the limit size.
`LabelLimiter`
`limitLabelSize(IChartComputation cComp, IDisplayServer xs, Label la, EnumSet<LabelLimiter.Option> options)`
modify the text of la to fit the limit size.
`static final LabelLimiter`
`limitLabelSize(IChartComputation cComp, IDisplayServer xs, Label la, LabelLimiter lbLimit, EnumSet<LabelLimiter.Option> options)`
To compute the text of the label with a limited size, the label text will be wrapped and shortened with ellipsis if required, the size of the label bound will be returned.
`final void`
`setMaxHeight(double maxHeight)`
`final void`
`setMaxWidth(double maxWidth)`
`final void`
`setWrapping(double wrapping)`

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### LabelLimiter

public LabelLimiter(double maxWidth, double maxHeight, double wrapping)
Constructor

Parameters:
  `maxWidth` -
  `maxHeight` -
  `wrapping` -

## Method Details

### computeWrapping

public double computeWrapping(IDisplayServer xs, Label la)

### getBounding

public BoundingBox getBounding(BoundingBox bb)
Returns a bounding box using maxWidth and maxHeight

Parameters:
  `bb` - will be updated and returned if not null, otherwise a new bounding box will be created.
Returns:

### computeWrapping

public static final double computeWrapping(IDisplayServer xs, Label la, LabelLimiter lbLimit)
Compute the wrapping with maxWidth, maxHeight. If the wrapping is set to 0, namely auto, this method should be called before calling limitLabelSize.

Parameters:
  `xs` -
  `la` -
  `lbLimit` -
Returns:

### limitLabelSize

public LabelLimiter limitLabelSize(IChartComputation cComp, IDisplayServer xs, Label la) throws ChartException
modify the text of la to fit the limit size.

Parameters:
  `xs` -
  `la` -
Returns:
Throws:
  `ChartException`

### limitLabelSize

public LabelLimiter limitLabelSize(IChartComputation cComp, IDisplayServer xs, Label la, EnumSet<LabelLimiter.Option> options) throws ChartException
modify the text of la to fit the limit size.

Parameters:
  `xs` -
  `la` -
  `options` -
Returns:
Throws:
  `ChartException`

### limitLabelSize

public static final LabelLimiter limitLabelSize(IChartComputation cComp, IDisplayServer xs, Label la, LabelLimiter lbLimit, EnumSet<LabelLimiter.Option> options) throws ChartException
To compute the text of the label with a limited size, the label text will be wrapped and shortened with ellipsis if required, the size of the label bound will be returned.

Parameters:
  `xs` -
  `la` -
  `maxSize` -
  `lbLimit` -
  `options` -
Returns:
Throws:
  `ChartException`

### getMaxWidth

public final double getMaxWidth()

Returns:
  Returns the maxWidth.

### setMaxWidth

public final void setMaxWidth(double maxWidth)

Parameters:
  `maxWidth` - The maxWidth to set.

### getMaxHeight

public final double getMaxHeight()

Returns:
  Returns the maxHeight.

### setMaxHeight

public final void setMaxHeight(double maxHeight)

Parameters:
  `maxHeight` - The maxHeight to set.

### getWrapping

public final double getWrapping()

Returns:
  Returns the wrapping.

### setWrapping

public final void setWrapping(double wrapping)

Parameters:
  `wrapping` - The wrapping to set.

### isSuccessed

public final boolean isSuccessed()

Returns:
  Returns the bSuccessed.