|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.visuals.adapters.MinMaxSpacePartitioner
public class MinMaxSpacePartitioner
The MinMaxSpacePartitioner class is a helper class for the AutoSizingGridLayout.
It partitions the total space specified using the preferredSizes
passed
in to getPartitionedSpace. If the preferred size for an element is less than the
minimum for that column, the minimum size is used. If the preferred size for an
element is greater than the maximum for that column, the maximum size is used.
Once all the space is given out, no more space will be allocated to elements.
An instance of MinMaxSpacePartitioner can be set on columnSpacePartitioner and/or the rowSpacePartitioner properties of the AutoSizingGridLayout.
SpacePartitionerInterface
,
AutoSizingGridLayout
,
Serialized FormField Summary | |
---|---|
protected boolean |
giveMoreSpaceThanSpecified
|
protected int[] |
maximums
|
protected int[] |
minimums
|
Constructor Summary | |
---|---|
MinMaxSpacePartitioner()
Constructor. |
|
MinMaxSpacePartitioner(boolean giveMoreSpaceThanSpecified)
Constructor which allows specifying whether more that the totalSize
space may be allocated using in getPartitionedSpace . |
|
MinMaxSpacePartitioner(int[] minimums,
int[] maximums)
Constructor which allows specifying the minimum and maximum sizes of the elements. |
|
MinMaxSpacePartitioner(int[] minimums,
int[] maximums,
boolean giveMoreSpaceThanSpecified)
Constructor which allows specifying the minimum and maximum sizes of the elements. |
Method Summary | |
---|---|
protected int |
getConstrainedSize(int i,
int size,
int totalSize,
int sizeUsed)
getConstrainedSize is a helper method which subclasses may use if they do not wish to call super in their getParitionedSpace method. |
int |
getPartitionedSpace(int[] sizes,
int totalSize,
int[] preferredSizes)
getPartitionedSpace partitions the totalSize space between a number of "elements" and returns the sizes of those elements in the sizes
array. |
Field Detail |
---|
protected int[] minimums
protected int[] maximums
protected boolean giveMoreSpaceThanSpecified
Constructor Detail |
---|
public MinMaxSpacePartitioner()
public MinMaxSpacePartitioner(boolean giveMoreSpaceThanSpecified)
totalSize
space may be allocated using in getPartitionedSpace
.
giveMoreSpaceThanSpecified
- whether more that the totalSize
space may be allocated using in getPartitionedSpace
.public MinMaxSpacePartitioner(int[] minimums, int[] maximums)
minimums
- Array of minimum sizes for elements. Usually a positive int. If negative,
there is no minimum for that element. If minimums
is null, there are no
minimums for any element.maximums
- Array of maximum sizes for elements. Usually a positive int. If negative,
there is no maximum for that element. If maximums
is null, there are no
maximums for any element.public MinMaxSpacePartitioner(int[] minimums, int[] maximums, boolean giveMoreSpaceThanSpecified)
minimums
- Array of minimum sizes for elements. Usually a positive int. If negative,
there is no minimum for that element. If minimums
is null, there are no
minimums for any element.maximums
- Array of maximum sizes for elements. Usually a positive int. If negative,
there is no maximum for that element. If maximums
is null, there are no
maximums for any element.giveMoreSpaceThanSpecified
- whether more that the totalSize
space may be allocated using in getPartitionedSpace
.Method Detail |
---|
protected int getConstrainedSize(int i, int size, int totalSize, int sizeUsed)
i
- The zero based index of the element to determine the size ofsize
- The preferred size for this elementtotalSize
- The total amount of space to allocate to the elementssizeUsed
- The amount of totalSize used already
getPartitionedSpace(int[], int, int[])
public int getPartitionedSpace(int[] sizes, int totalSize, int[] preferredSizes)
sizes
array. An array of preferred sizes for the elements is passed in the
preferredSizes
array. These sizes are used as the base sizes
for the elements and then the sizes are adjusted based on the minimum and
maximum sizes set earlier.
getPartitionedSpace
in interface SpacePartitionerInterface
sizes
- An array allocated by the caller for getPartitionedSpace to
return the element sizes in.totalSize
- The total available size to partition between the elements.preferredSizes
- The preferred sizes of the elements
SpacePartitionerInterface
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |