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 Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
getMinimumWidth()
Returns the component's minimum width.RenderNode[]
splitBy(long widthOfFirst)
Splits the component into two children.
-
-
-
Method Detail
-
splitBy
RenderNode[] splitBy(long widthOfFirst)
Splits the component into two children. The width of first cannot exceedwidthOfFirst
. If the separation is impossiblenull
is returned. Note, there is no guarantee that the first kid has width equal towidthOfFirst
.- Parameters:
widthOfFirst
- the maximum width of the first component- Returns:
- a pair of children or
null
- Throws:
IllegalStateException
- ifwidthOfFirst >= 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
-
-