|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.visuals.adapters.EqualSpacePartitioner
public class EqualSpacePartitioner
The EqualSpacePartitioner class is a helper class for the AutoSizingGridLayout. The EqualSpacePartitioner operates in two modes. Either it will divide the total available space between the number of available parts, or it will determine the preferred size of the largest part and give that much space to each part. The default is to use the preferred size of the largest part for each part.
The minimumSize and maximumSize properties constrain the sizes returned by getPartitionedSpace. Once the size of each part is determined based on the mode of operation, the minimum size and maximum size are used to adjust the size of each part. If minimumSize or maximumSize is zero, that constraint is ignored.
An instance of EqualSpacePartitioner can be set on the columnSpacePartitioner and/or rowSpacePartitioner property of the AutoSizingGridLayout.
SpacePartitionerInterface
,
AutoSizingGridLayout
,
Serialized FormField Summary | |
---|---|
protected boolean |
divideTotalSpace
|
protected int |
maximumSize
|
protected int |
minimumSize
|
protected boolean[] |
partitionsToDivide
|
Constructor Summary | |
---|---|
EqualSpacePartitioner()
Default contructor. |
|
EqualSpacePartitioner(boolean divideTotalSpace)
Contructor. |
Method Summary | |
---|---|
protected int |
constrainSize(int size)
Helper method used to constrain the passed in size based on the minimumSize and maximumSize properties. |
int |
getMaximumSize()
Returns the maximum size of the parts. |
int |
getMinimumSize()
Returns the minimum size of the parts. |
int |
getPartitionedSpace(int[] sizes,
int totalSize,
int[] preferredSizes)
Partition the space represented by totalSize into parts and store the
resulting size in the sizes array. |
boolean |
isDivideTotalSpace()
|
void |
setDivideTotalSpace(boolean divideTotalSpace)
|
void |
setMaximumSize(int maximumSize)
Sets the maximum size of the parts. |
void |
setMinimumSize(int minimumSize)
Sets the minimum size of the parts. |
Field Detail |
---|
protected boolean divideTotalSpace
protected int minimumSize
protected int maximumSize
protected boolean[] partitionsToDivide
Constructor Detail |
---|
public EqualSpacePartitioner()
public EqualSpacePartitioner(boolean divideTotalSpace)
divideTotalSpace
- Whether to divide the total available space
between the number of available parts or to determine the preferred
size of the largest part and give that much space to each part, if
there is extra space left over, it is distributed equally amongst the parts.Method Detail |
---|
protected int constrainSize(int size)
size
- The size to constrain.public int getPartitionedSpace(int[] sizes, int totalSize, int[] preferredSizes)
SpacePartitionerInterface
totalSize
into parts and store the
resulting size in the sizes
array. preferredSizes
may also be
passed in to specify a preferred size for each of the parts.
Note that the length of the sizes
array and the preferredSizes
array should be equal if the preferredSizes
array is specified.
getPartitionedSpace
in interface SpacePartitionerInterface
sizes
- The array to return the sizes of the parts in.totalSize
- The amount of space to split up between the parts.preferredSizes
- The preferred size of the parts. This may be null to indicate
that no preferred size is available.
totalSize
left over after the space has been allocated.
Note that for some implementations, this value may be negative.SpacePartitionerInterface.getPartitionedSpace(int[], int, int[])
public int getMinimumSize()
setMinimumSize(int)
,
getMaximumSize()
,
setMaximumSize(int)
public void setMinimumSize(int minimumSize)
minimumSize
- the minimum size of the partsgetMinimumSize()
,
getMaximumSize()
,
setMaximumSize(int)
public int getMaximumSize()
setMaximumSize(int)
,
getMinimumSize()
,
setMinimumSize(int)
public void setMaximumSize(int maximumSize)
maximumSize
- the maximum size of the partsgetMaximumSize()
,
getMinimumSize()
,
setMinimumSize(int)
public boolean isDivideTotalSpace()
public void setDivideTotalSpace(boolean divideTotalSpace)
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |