Class LabelLimiter


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

      • LabelLimiter

        public LabelLimiter​(double maxWidth,
                            double maxHeight,
                            double wrapping)
        Constructor
        Parameters:
        maxWidth -
        maxHeight -
        wrapping -
    • Method Detail

      • 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:
      • 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.