Coverage Report - net.wotonomy.ui.swing.components.AbsoluteLayout
 
Classes in this File Line Coverage Branch Coverage Complexity
AbsoluteLayout
0% 
0% 
1.2
 
 1  
 /*
 2  
 Wotonomy: OpenStep design patterns for pure Java applications.
 3  
 Copyright (C) 2000 Blacksmith, Inc.
 4  
 
 5  
 This library is free software; you can redistribute it and/or
 6  
 modify it under the terms of the GNU Lesser General Public
 7  
 License as published by the Free Software Foundation; either
 8  
 version 2.1 of the License, or (at your option) any later version.
 9  
 
 10  
 This library is distributed in the hope that it will be useful,
 11  
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13  
 Lesser General Public License for more details.
 14  
 
 15  
 You should have received a copy of the GNU Lesser General Public
 16  
 License along with this library; if not, see http://www.gnu.org
 17  
 */
 18  
 
 19  
 package net.wotonomy.ui.swing.components;
 20  
 
 21  
 import java.awt.Component;
 22  
 import java.awt.Container;
 23  
 import java.awt.Dimension;
 24  
 import java.awt.LayoutManager;
 25  
 import java.io.Serializable;
 26  
 
 27  
 /**
 28  
  * AbsoluteLayout specifies that all components in the
 29  
  * container will be placed according to their size
 30  
  * and their location relative to the container's origin. <br><br>
 31  
  *
 32  
  * You can achieve the same effect by setting a container's
 33  
  * layout manager to null, but this class allows you to subclass
 34  
  * it if you need specific control or functionality.
 35  
  *
 36  
  * @author michael@mpowers.net
 37  
  * @author $Author: cgruber $
 38  
  * @version $Revision: 904 $
 39  
  */
 40  0
 public class AbsoluteLayout implements LayoutManager, Serializable
 41  
 {
 42  
     public void addLayoutComponent(String name,
 43  
                                    Component comp)
 44  
     {
 45  0
     }
 46  
 
 47  
     public void removeLayoutComponent(Component comp)
 48  
     {
 49  0
     }
 50  
 
 51  
     public Dimension preferredLayoutSize(Container parent)
 52  
     {
 53  0
         return minimumLayoutSize( parent );
 54  
     }
 55  
 
 56  
     public Dimension minimumLayoutSize(Container parent)
 57  
     {
 58  0
         int width = 0;
 59  0
         int height = 0;
 60  
 
 61  0
         Component[] c = parent.getComponents();
 62  0
         for ( int i = 0; i < c.length; i++ )
 63  
         {
 64  0
             width = Math.max( width, c[i].getLocation().x + c[i].getBounds().width );
 65  0
             height = Math.max( height, c[i].getLocation().y + c[i].getBounds().height );
 66  
         }
 67  
 
 68  0
         return new Dimension( width, height );
 69  
     }
 70  
 
 71  
     public void layoutContainer(Container parent)
 72  
     {
 73  0
     }
 74  
 }