001/* 002 * Copyright (c) 2002-2007 JGoodies Karsten Lentzsch. All Rights Reserved. 003 * 004 * Redistribution and use in source and binary forms, with or without 005 * modification, are permitted provided that the following conditions are met: 006 * 007 * o Redistributions of source code must retain the above copyright notice, 008 * this list of conditions and the following disclaimer. 009 * 010 * o Redistributions in binary form must reproduce the above copyright notice, 011 * this list of conditions and the following disclaimer in the documentation 012 * and/or other materials provided with the distribution. 013 * 014 * o Neither the name of JGoodies Karsten Lentzsch nor the names of 015 * its contributors may be used to endorse or promote products derived 016 * from this software without specific prior written permission. 017 * 018 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 019 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 020 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 021 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR 022 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 023 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 024 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; 025 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 026 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE 027 * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, 028 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 029 */ 030 031package com.jgoodies.forms.layout; 032 033import java.awt.Container; 034import java.util.List; 035 036/** 037 * An interface that describes sizes as used by the {@link FormLayout}: 038 * component measuring sizes, constant sizes with value and unit, 039 * and bounded sizes that provide lower and upper bounds for a size.<p> 040 * 041 * You can find a motivation for the different <code>Size</code> types in 042 * the Forms article that is part of the product documentation and that is 043 * available online too, see 044 * <a href="http://www.jgoodies.com/articles/forms.pdf" > 045 * http://www.jgoodies.com/articles/forms.pdf</a>. 046 * 047 * @author Karsten Lentzsch 048 * @version $Revision$ 049 * 050 * @see Sizes 051 * @see ConstantSize 052 */ 053 054public interface Size { 055 056 /** 057 * Computes and returns my maximum size applied to the given list of 058 * components using the specified measures.<p> 059 * 060 * Invoked by {@link com.jgoodies.forms.layout.FormSpec} to determine 061 * the size of a column or row. This method is not intended to be called 062 * by API users, and it uses API invisible parameter types. 063 * 064 * @param container the layout container 065 * @param components the list of components used to compute the size 066 * @param minMeasure the measure that determines the minimum sizes 067 * @param prefMeasure the measure that determines the preferred sizes 068 * @param defaultMeasure the measure that determines the default sizes 069 * @return the maximum size in pixels for the given list of components 070 */ 071 int maximumSize(Container container, List components, 072 FormLayout.Measure minMeasure, FormLayout.Measure prefMeasure, 073 FormLayout.Measure defaultMeasure); 074 075}