Class LabelLimiter
java.lang.Object
org.eclipse.birt.chart.computation.LabelLimiter
Helper class to limit the size of a label by wrapping its text or shorten its
text with ellipsis.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Options used by method limitLabelSize. -
Constructor Summary
ConstructorsConstructorDescriptionLabelLimiter
(double maxWidth, double maxHeight, double wrapping) Constructor -
Method Summary
Modifier and TypeMethodDescriptiondouble
computeWrapping
(IDisplayServer xs, Label la) static final double
computeWrapping
(IDisplayServer xs, Label la, LabelLimiter lbLimit) Compute the wrapping with maxWidth, maxHeight.Returns a bounding box using maxWidth and maxHeightfinal double
final double
final double
final boolean
limitLabelSize
(IChartComputation cComp, IDisplayServer xs, Label la) modify the text of la to fit the limit size.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)
-
Constructor Details
-
LabelLimiter
public LabelLimiter(double maxWidth, double maxHeight, double wrapping) Constructor- Parameters:
maxWidth
-maxHeight
-wrapping
-
-
-
Method Details
-
computeWrapping
-
getBounding
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
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.
-