Beispiel #1
0
 /**
  * Computes and returns the pixel size of the given component using the given form specification,
  * measures, and cell size.
  *
  * @param component the component to measure
  * @param formSpec the specification of the component's column/row
  * @param minMeasure the measure for the minimum size
  * @param prefMeasure the measure for the preferred size
  * @param cellSize the cell size
  * @return the component size as measured or a constant
  */
 private int componentSize(
     Control component,
     FormSpec formSpec,
     int cellSize,
     FormLayout.Measure minMeasure,
     FormLayout.Measure prefMeasure) {
   if (formSpec == null) {
     return prefMeasure.sizeOf(component);
   } else if (formSpec.getSize() == Sizes.MINIMUM) {
     return minMeasure.sizeOf(component);
   } else if (formSpec.getSize() == Sizes.PREFERRED) {
     return prefMeasure.sizeOf(component);
   } else { // default mode
     return Math.min(cellSize, prefMeasure.sizeOf(component));
   }
 }