org.crsh.text.ui
Class Layout
java.lang.Object
org.crsh.text.ui.Layout
- Direct Known Subclasses:
- Layout.Weighted
public abstract class Layout
- extends Object
The layout computes the lengths of a list of contiguous cells.
Method Summary |
(package private) abstract int[] |
compute(boolean spaced,
int length,
int[] actualLengths,
int[] minLengths)
Computes the list of lengths for the specifid list of cells with the following constraints:
the sum of the returned array elements must be equals to the length argument
a cell length should never be lesser than the provided minimum length
The returned array is the list of lengths from left to right, the array size may be less than the
number of cells (i.e the size of the actualLengths and minLengths arguments). |
static Layout |
flow()
|
static Layout |
weighted(int... weights)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
RTL
private static final Layout RTL
Layout
public Layout()
flow
public static Layout flow()
weighted
public static Layout weighted(int... weights)
throws NullPointerException,
IllegalArgumentException
- Throws:
NullPointerException
IllegalArgumentException
compute
abstract int[] compute(boolean spaced,
int length,
int[] actualLengths,
int[] minLengths)
- Computes the list of lengths for the specifid list of cells with the following constraints:
- the sum of the returned array elements must be equals to the
length
argument
- a cell length should never be lesser than the provided minimum length
The returned array is the list of lengths from left to right, the array size may be less than the
number of cells (i.e the size of the actualLengths
and minLengths
arguments). Missing
cells are just be discarded and not part of the resulting layout. Array should contain only positive values,
any zero length cell should be discarded. When cells must be discarded it must begin with the tail of the
list, i.e it is not allowed to discard a cell that does not have a successor.
- Parameters:
spaced
- true if the cells are separated by one charlength
- the lengthactualLengths
- the actual length : an estimation of what cell's desired lengthminLengths
- the minmum length : the length under which a cell cannot be rendered
- Returns:
- the list of length.
Copyright © 2014 eXo Platform SAS. All Rights Reserved.