|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.visuals.adapters.ProportionalSpacePartitioner
public class ProportionalSpacePartitioner
The ProportionalSpacePartitioner class is a helper class for the AutoSizingGridLayout.
It partitions the total space specified in the proportions specified between
the elements (rows/columns) of the passed in array. If the PREFERRED_SIZE
param is used
in the percentages array, that element should receive its preferred size while the rest of
the percentages should still add up to equal 1.
If minumum and maximum sizes are specified, the ProportionalSpacePartitioner may run out of space when distributing between elements. In this case, elements will be given space in ascending order. Once all the space is given out, no more space will be allocated to elements.
An instance of ProportionalSpacePartitioner can be set on columnSpacePartitioner and/or the rowSpacePartitioner properties of the AutoSizingGridLayout.
SpacePartitionerInterface
,
AutoSizingGridLayout
,
Serialized FormField Summary | |
---|---|
protected double[] |
percentages
|
static double |
PREFERRED_SIZE
Used as a value to indicate to set the size as the preferred size instead of usign a percentage |
Fields inherited from class com.sas.visuals.adapters.MinMaxSpacePartitioner |
---|
giveMoreSpaceThanSpecified, maximums, minimums |
Constructor Summary | |
---|---|
ProportionalSpacePartitioner()
Constructor. |
|
ProportionalSpacePartitioner(double[] percentages)
Constructor which allows specifying the percentages given to each element (row/column). |
|
ProportionalSpacePartitioner(double[] percentages,
int[] minimums,
int[] maximums)
Constructor which allows specifying the percentages given to each element (row/column) as well as the minimum and maximum sizes of the elements. |
|
ProportionalSpacePartitioner(double[] percentages,
int[] minimums,
int[] maximums,
boolean giveMoreSpaceThanSpecified)
Constructor which allows specifying the percentages given to each element (row/column) as well as the minimum and maximum sizes of the elements. |
Method Summary | |
---|---|
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. |
double[] |
getPercentages()
Returns the percentages determining how much of totalSize
to allocate to each element. |
void |
setPercentages(double[] percentages)
Set the percentages determining how much of totalSize
to allocate to each element. |
Methods inherited from class com.sas.visuals.adapters.MinMaxSpacePartitioner |
---|
getConstrainedSize |
Field Detail |
---|
public static final double PREFERRED_SIZE
protected double[] percentages
Constructor Detail |
---|
public ProportionalSpacePartitioner()
public ProportionalSpacePartitioner(double[] percentages)
percentages
- Fractional percentages determining how much of totalSize
to allocate to each element. If PREFERRED_SIZE
is used as a param, then that
element should receive its preferred sizes and should have no bearing on the other percentages.public ProportionalSpacePartitioner(double[] percentages, int[] minimums, int[] maximums)
percentages
- Fractional percentages determining how much of totalSize
to allocate to each element. If PREFERRED_SIZE
is used as a param, then that
element should receive its preferred sizes and should have no bearing on the other percentages.minimums
- Array of minimum sizes for the elements.maximums
- Array of maximum sizes for the elements.public ProportionalSpacePartitioner(double[] percentages, int[] minimums, int[] maximums, boolean giveMoreSpaceThanSpecified)
percentages
- Fractional percentages determining how much of totalSize
to allocate to each element. If PREFERRED_SIZE
is used as a param, then that
element should receive its preferred sizes and should have no bearing on the other percentages.minimums
- Array of minimum sizes for the elements.maximums
- Array of maximum sizes for the elements.giveMoreSpaceThanSpecified
- Whether to allocate more than totalSize
to the elements is necessary to meet minimum and maximum requirements.Method Detail |
---|
public int getPartitionedSpace(int[] sizes, int totalSize, int[] preferredSizes)
MinMaxSpacePartitioner
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
getPartitionedSpace
in class MinMaxSpacePartitioner
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.getPartitionedSpace(int[], int, int[])
public double[] getPercentages()
totalSize
to allocate to each element.
percentages
- Fractional percentages determining how much of totalSize
to allocate to each element.setPercentages(double[])
public void setPercentages(double[] percentages)
totalSize
to allocate to each element.
getPercentages()
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |