Class XMLGridLayout

java.lang.Object
org.nuiton.jaxx.widgets.extra.XMLGridLayout
All Implemented Interfaces:
java.awt.LayoutManager

public class XMLGridLayout
extends java.lang.Object
implements java.awt.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​(java.lang.String layoutStringOrFile)  
    XMLGridLayout​(java.net.URL url)  
  • Method Summary

    Modifier and Type Method Description
    void addLayoutComponent​(java.lang.String name, java.awt.Component comp)
    Binds a name in the layout to the specified component.
    java.awt.GridBagConstraints getConstraint​(java.lang.String componentName)  
    java.lang.String getLayoutString()  
    protected void init​(java.lang.String layoutString)  
    protected void init​(java.net.URL url)  
    void layoutContainer​(java.awt.Container parent)  
    java.awt.Dimension minimumLayoutSize​(java.awt.Container parent)  
    java.awt.Dimension preferredLayoutSize​(java.awt.Container parent)  
    void removeLayoutComponent​(java.awt.Component comp)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • XMLGridLayout

      public XMLGridLayout​(java.lang.String layoutStringOrFile)
    • XMLGridLayout

      public XMLGridLayout​(java.net.URL url)
  • Method Details

    • init

      protected void init​(java.net.URL url)
    • init

      protected void init​(java.lang.String layoutString)
      Parameters:
      layoutString - string that represente the layout
    • addLayoutComponent

      public void addLayoutComponent​(java.lang.String name, java.awt.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 java.awt.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​(java.awt.Component comp)
      Specified by:
      removeLayoutComponent in interface java.awt.LayoutManager
    • preferredLayoutSize

      public java.awt.Dimension preferredLayoutSize​(java.awt.Container parent)
      Specified by:
      preferredLayoutSize in interface java.awt.LayoutManager
    • minimumLayoutSize

      public java.awt.Dimension minimumLayoutSize​(java.awt.Container parent)
      Specified by:
      minimumLayoutSize in interface java.awt.LayoutManager
    • layoutContainer

      public void layoutContainer​(java.awt.Container parent)
      Specified by:
      layoutContainer in interface java.awt.LayoutManager
    • getConstraint

      public java.awt.GridBagConstraints getConstraint​(java.lang.String componentName)
    • getLayoutString

      public java.lang.String getLayoutString()