/** * Computes the maximum size for the given list of components, using * this form spec and the specified measure. * <p> * Invoked by FormLayout to determine the size of one of my elements * * @param container the layout container * @param components the list of components to measure * @param minMeasure the measure used to determine the minimum size * @param prefMeasure the measure used to determine the preferred size * @param defaultMeasure the measure used to determine the default size * @return the maximum size in pixels for the given list of components */ @Override public int maximumSize( Container container, List components, FormLayout.Measure minMeasure, FormLayout.Measure prefMeasure, FormLayout.Measure defaultMeasure) { FormLayout.Measure measure = this == MINIMUM ? minMeasure : (this == PREFERRED ? prefMeasure : defaultMeasure); int maximum = 0; for (Iterator i = components.iterator(); i.hasNext();) { Component c = (Component) i.next(); maximum = Math.max(maximum, measure.sizeOf(c)); } return maximum; }
/** * 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(Component 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)); } }
/** * Computes the maximum size for the given list of components, using * this form spec and the specified measure. * <p> * Invoked by FormLayout to determine the size of one of my elements * * @param container the layout container * @param components the list of components to measure * @param minMeasure the measure used to determine the minimum size * @param prefMeasure the measure used to determine the preferred size * @param defaultMeasure the measure used to determine the default size * @return the maximum size in pixels for the given list of components */ public int maximumSize( Container container, List components, FormLayout.Measure minMeasure, FormLayout.Measure prefMeasure, FormLayout.Measure defaultMeasure) { FormLayout.Measure measure = this == MINIMUM ? minMeasure : (this == PREFERRED ? prefMeasure : defaultMeasure); int maximum = 0; for (Iterator i = components.iterator(); i.hasNext();) { Component c = (Component) i.next(); maximum = Math.max(maximum, measure.sizeOf(c)); } return maximum; }
/** * Computes the maximum size for the given list of components, using * this form spec and the specified measure. * <p> * Invoked by FormLayout to determine the size of one of my elements * * @param container * the layout container * @param components * the list of components to measure * @param minMeasure * the measure used to determine the minimum size * @param prefMeasure * the measure used to determine the preferred size * @param defaultMeasure * the measure used to determine the default size * @return the maximum size in pixels for the given list of components */ public int maximumSize(Container container, List components, FormLayout.Measure minMeasure, FormLayout.Measure prefMeasure, FormLayout.Measure defaultMeasure) { FormLayout.Measure measure = this == MINIMUM ? minMeasure : (this == PREFERRED ? prefMeasure : defaultMeasure); int maximum = 0; for (Iterator i = components.iterator(); i.hasNext();) { Component c = (Component) i.next(); maximum = Math.max(maximum, measure.sizeOf(c)); } return maximum; }
/** * 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(Component 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)); } }
/** * 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 static int componentSize(Component 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)); } }