Package org.nuiton.jaxx.widgets.extra
Class XMLGridLayout
- java.lang.Object
-
- org.nuiton.jaxx.widgets.extra.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
Constructors Constructor Description XMLGridLayout(String layoutStringOrFile)
XMLGridLayout(URL url)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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)
-
-
-
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 interfaceLayoutManager
- Parameters:
name
- The name in the layout to bind the component tocomp
- The component to bind to the specified name.
-
removeLayoutComponent
public void removeLayoutComponent(Component comp)
- Specified by:
removeLayoutComponent
in interfaceLayoutManager
-
preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)
- Specified by:
preferredLayoutSize
in interfaceLayoutManager
-
minimumLayoutSize
public Dimension minimumLayoutSize(Container parent)
- Specified by:
minimumLayoutSize
in interfaceLayoutManager
-
layoutContainer
public void layoutContainer(Container parent)
- Specified by:
layoutContainer
in interfaceLayoutManager
-
getConstraint
public GridBagConstraints getConstraint(String componentName)
-
getLayoutString
public String getLayoutString()
-
-