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 voidaddLayoutComponent(String name, Component comp)Binds a name in the layout to the specified component.GridBagConstraintsgetConstraint(String componentName)StringgetLayoutString()protected voidinit(String layoutString)protected voidinit(URL url)voidlayoutContainer(Container parent)DimensionminimumLayoutSize(Container parent)DimensionpreferredLayoutSize(Container parent)voidremoveLayoutComponent(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:
addLayoutComponentin 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:
removeLayoutComponentin interfaceLayoutManager
-
preferredLayoutSize
public Dimension preferredLayoutSize(Container parent)
- Specified by:
preferredLayoutSizein interfaceLayoutManager
-
minimumLayoutSize
public Dimension minimumLayoutSize(Container parent)
- Specified by:
minimumLayoutSizein interfaceLayoutManager
-
layoutContainer
public void layoutContainer(Container parent)
- Specified by:
layoutContainerin interfaceLayoutManager
-
getConstraint
public GridBagConstraints getConstraint(String componentName)
-
getLayoutString
public String getLayoutString()
-
-