Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  // HTMLParser Library - A java-based parser for HTML
  // http://htmlparser.org
  // Copyright (C) 2006 Derrick Oswald
  //
  // Revision Control Information
  //
  // $URL: https://htmlparser.svn.sourceforge.net/svnroot/htmlparser/tags/HTMLParserProject-2.1/filterbuilder/src/main/java/org/htmlparser/parserapplications/filterbuilder/layouts/NullLayoutManager.java $
  // $Author: derrickoswald $
  // $Date: 2006-09-16 16:44:17 +0200 (Sat, 16 Sep 2006) $
 // $Revision: 4 $
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the Common Public License; either
 // version 1.0 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 // Common Public License for more details.
 //
 // You should have received a copy of the Common Public License
 // along with this library; if not, the license is available from
 // the Open Source Initiative (OSI) website:
 //   http://opensource.org/licenses/cpl1.0.php
 
 package org.htmlparser.parserapplications.filterbuilder.layouts;
 
 import java.awt.*;
 import java.io.*;

A layout manager that doesn't move things around. Attempts to set the bounds of components to accomodate them but doesn't move them.
 
 public class NullLayoutManager
     implements
         LayoutManager2,
         Serializable
 { 
    
Constructs a NullLayoutManager object.
 
     public NullLayoutManager ()
     {
     }
  
    
Calculates the minimum size dimensions for the specified panel given the components in the specified parent container.

Parameters:
target The component to be laid out.
Returns:
The minimum size.
See also:
preferredLayoutSize(java.awt.Container)
 
     public Dimension minimumLayoutSize (Container target)
     {
         return (preferredLayoutSize (target));
     }
  
    
Calculates the preferred size dimensions for the specified panel given the components in the specified parent container.

Parameters:
target The component to be laid out.
Returns:
A size deemed suitable for laying out the container.
See also:
minimumLayoutSize(java.awt.Container)
 
     public Dimension preferredLayoutSize (Container target)
     {
         int count;
         Container parent;
         Component component;
         Point point;
         Dimension dimension;
         Insets insets;
         Dimension ret;
         
         synchronized (target.getTreeLock ())
         {
             count = target.getComponentCount ();
             if (0 == count)
             {
                 // be the same size unless we have a parent
                 ret = target.getSize ();
                 parent = target.getParent ();
                 if (null != parent)
                 {
                     insets = parent.getInsets ();
                     ret = parent.getSize ();
                     ret.setSize (
                         ret.width - insets.left - insets.right,
                         ret.height - insets.top - insets.bottom);
                 }
             }
             else
             {
                 ret = new Dimension (0, 0);
                 for (int i = 0 ; i < count ; i++)
                 {
                     component = target.getComponent (i);
                    if (component.isVisible ())
                    {
                        point = component.getLocation ();
                        dimension = component.getPreferredSize();
                        ret.width = Math.max (ret.widthpoint.x + dimension.width);
                        ret.height = Math.max (ret.heightpoint.y + dimension.height);
                    }
                }
                insets = target.getInsets ();
                ret.width += insets.left + insets.right;
                ret.height += insets.top + insets.bottom;
            }
        }
        return (ret);
    }
  
    
Returns the maximum size of this component.

Parameters:
target The component to be laid out.
Returns:
The maximum size for the container.
See also:
preferredLayoutSize(java.awt.Container)
    public Dimension maximumLayoutSize (Container target)
    {
        return (preferredLayoutSize (target));
    }
  
    //
    // LayoutManager Interface
    //
  
    
Adds the specified component with the specified name to the layout.

Parameters:
name the component name
comp the component to be added
    public void addLayoutComponent (String nameComponent comp)
    {
    }        
  
    
Removes the specified component from the layout.

Parameters:
comp the component ot be removed
    public void removeLayoutComponent (Component comp)
    {
    }
  
    
Lays out the container.

Parameters:
target The container which needs to be laid out.
    public void layoutContainer (Container target)
    {
        int count;
        Component component;
        Dimension dimension;
        
        synchronized (target.getTreeLock ())
        {
            count = target.getComponentCount ();
            for (int i = 0 ; i < count ; i++)
            {
                component = target.getComponent (i);
                if (component.isVisible ())
                {
                    dimension = component.getPreferredSize();
                    component.setSize (dimension.widthdimension.height);
                }
            }
        }
    }
  
    //
    // LayoutManager2 Interface
    //
  
    
Adds the specified component to the layout, using the specified constraint object.

Parameters:
comp the component to be added
constraints where/how the component is added to the layout.
    public void addLayoutComponent (Component compObject constraints)
    {
    }
  
    
Returns the alignment along the x axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

Parameters:
target The target container.
Returns:
The X-axis alignment.
    public float getLayoutAlignmentX (Container target)
    {
        return (0.0f);
    }
  
    
Returns the alignment along the y axis. This specifies how the component would like to be aligned relative to other components. The value should be a number between 0 and 1 where 0 represents alignment along the origin, 1 is aligned the furthest away from the origin, 0.5 is centered, etc.

Parameters:
target The target container.
Returns:
The Y-axis alignment.
    public float getLayoutAlignmentY (Container target)
    {
        return (0.0f);
    }
  
    
Invalidates the layout, indicating that if the layout manager has cached information it should be discarded.

Parameters:
target The target container.
    public void invalidateLayout (Container target)
    {
    }
New to GrepCode? Check out our FAQ X