Interface SplittableRenderNode

  • All Known Implementing Classes:
    RenderableText

    public interface SplittableRenderNode
    This interface represents a component, that can be split horizontally. This is needed, if the component's width exceeds a line's capacity.
    Author:
    Andrey Khayrutdinov
    See Also:
    RenderableText
    • Method Detail

      • splitBy

        RenderNode[] splitBy​(long widthOfFirst)
        Splits the component into two children. The width of first cannot exceed widthOfFirst. If the separation is impossible null is returned.

        Note, there is no guarantee that the first kid has width equal to widthOfFirst.

        Parameters:
        widthOfFirst - the maximum width of the first component
        Returns:
        a pair of children or null
        Throws:
        IllegalStateException - if widthOfFirst >= getMinimumWidth()
      • getMinimumWidth

        long getMinimumWidth()
        Returns the component's minimum width.

        A layout processor can be implemented so, that it does not compute its children's positions on the spot, postponing this action until the end. However, if it finds out the component should be broken, it stops the routine. And this is the case when this method is useful, as it helps not to change the implementation of the processor. Normally each layout component knows about its bounds, hence it will not takes much effort to implement the method.

        Returns:
        the minimum width of the component