org.nuiton.widget
Class XMLGridLayout

java.lang.Object
  extended by org.nuiton.widget.XMLGridLayout
All Implemented Interfaces:
LayoutManager

public class XMLGridLayout
extends Object
implements LayoutManager

XMLGridLayout uses a XML input (a string, for the time being) to define the layout of components inside the container. To do this a set of constraints in the form of GridBagConstraints are build and associated to a name. When adding the component to the container, the name of the constraint to be used must be supplied, using the add(name,component) method. If the name associated to the component has no associated constrain, the component is not layout.
Implementation Note: Internally this class uses a GridBagLayout and delegates to it all the calculations necesary to layout the components.

Author:
Rafael Alvarez

Constructor Summary
XMLGridLayout(String layoutStringOrFile)
           
XMLGridLayout(URL url)
           
 
Method Summary
 void addLayoutComponent(String name, Component comp)
          Binds a name in the layout to the specified component.
 GridBagConstraints getConstraint(String componentName)
           
 String getLayoutString()
           
protected  void init(String layoutString)
           
protected  void init(URL url)
           
 void layoutContainer(Container parent)
           
 Dimension minimumLayoutSize(Container parent)
           
 Dimension preferredLayoutSize(Container parent)
           
 void removeLayoutComponent(Component comp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLGridLayout

public XMLGridLayout(String layoutStringOrFile)

XMLGridLayout

public XMLGridLayout(URL url)
Method Detail

init

protected void init(URL url)

init

protected void init(String layoutString)
Parameters:
layoutString - string that represente the layout

addLayoutComponent

public void addLayoutComponent(String name,
                               Component comp)
Binds a name in the layout to the specified component. If the name is not defined in the layout an error message will be send to System.err

Specified by:
addLayoutComponent in interface LayoutManager
Parameters:
name - The name in the layout to bind the component to
comp - The component to bind to the specified name.

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Specified by:
removeLayoutComponent in interface LayoutManager

preferredLayoutSize

public Dimension preferredLayoutSize(Container parent)
Specified by:
preferredLayoutSize in interface LayoutManager

minimumLayoutSize

public Dimension minimumLayoutSize(Container parent)
Specified by:
minimumLayoutSize in interface LayoutManager

layoutContainer

public void layoutContainer(Container parent)
Specified by:
layoutContainer in interface LayoutManager

getConstraint

public GridBagConstraints getConstraint(String componentName)

getLayoutString

public String getLayoutString()


Copyright © 2004-2010 CodeLutin. All Rights Reserved.