org.bdgp.swing
Class XMLLayout

java.lang.Object
  |
  +--org.bdgp.swing.XMLLayout

public class XMLLayout
extends java.lang.Object

Defines the layout used by XMLLayoutPanel. The layout is defined in XML format, defined by the following DTD:

 <!ELEMENT component (EMPTY)>
 <!ATTLIST component id         CDATA#REQUIRED
 	            font       CDATA#IMPLIED
 		    background CDATA#IMPLIED
 		    foreground CDATA#IMPLIED
 		    height     CDATA#IMPLIED
 		    width      CDATA#IMPLIED>
 
 <!ELEMENT panel (north, south, east, west, center)?>
 <!ATTLIST panel     font       CDATA#IMPLIED
 		    background CDATA#IMPLIED
 		    foreground CDATA#IMPLIED
 		    height     CDATA#IMPLIED
 		    width      CDATA#IMPLIED>
 
 <!ELEMENT north  (component, panel, box, divider, scroller)>
 <!ELEMENT south  (component, panel, box, divider, scroller)>
 <!ELEMENT east   (component, panel, box, divider, scroller)>
 <!ELEMENT west   (component, panel, box, divider, scroller)>
 <!ELEMENT center (component, panel, box, divider, scroller)>
 
 
 <!ELEMENT box (component, panel, box, divider, scroller)+>
 <!ATTLIST box       orientation (vert, horz) "horz"
 	            font        CDATA#IMPLIED
 		    background  CDATA#IMPLIED
 		    foreground  CDATA#IMPLIED
 		    height      CDATA#IMPLIED
 		    width       CDATA#IMPLIED>
 
 <!ELEMENT divider (first, second)?>
 <!ATTLIST divider dividerSize CDATA#IMPLIED
                   orientation (vert, horz) "horz"
 	          font        CDATA#IMPLIED
 		  background  CDATA#IMPLIED
 		  foreground  CDATA#IMPLIED
 		  height      CDATA#IMPLIED
 		  width       CDATA#IMPLIED>
 
 <!ELEMENT first   (component, panel, box, divider, scroller)>
 <!ELEMENT second  (component, panel, box, divider, scroller)>
 
 <!ELEMENT scroller (component, panel, box, divider, scroller)>
 <!ATTLIST scroller dividerSize CDATA#IMPLIED
                    horz (AS_NEEDED, ALWAYS, NEVER) "AS_NEEDED"
                    vert (AS_NEEDED, ALWAYS, NEVER) "AS_NEEDED"
 	           font        CDATA#IMPLIED
 		   background  CDATA#IMPLIED
 		   foreground  CDATA#IMPLIED
 		   height      CDATA#IMPLIED
 		   width       CDATA#IMPLIED>
 
Explanation of the tags:

<panel> - Creates a panel using the Java border layout.

<box> - Creates a panel using the Java box layout.

<divider> - Creates a JDividerPane containing the specified components.

<scroller> - Creates a JScrollPane containing the specified component.

<component> - Creates some Java Component based on the specified id. ids are resolved by the ComponentNameResolver passed to

Each tag allows a font, background, foreground, width, and height parameter to be set. These values are collected and passed to setFont(), setBackground(), setForeground(), setPreferredWidth(), and setPreferredHeight(), respectively. Because Java components may ignore the values passed to any of these methods, there is no guarantee that specifying a value for these parameters in the XML document will cause a component to change.

See Also:
XMLLayoutPanel, ComponentNameResolver

Inner Class Summary
static class XMLLayout.BoxElement
           
static class XMLLayout.ComponentElement
           
static class XMLLayout.DividerElement
           
protected static class XMLLayout.LayoutBuilder
           
static class XMLLayout.LayoutItem
           
protected  class XMLLayout.LayoutNode
           
static class XMLLayout.PanelElement
           
static class XMLLayout.ScrollerElement
           
 
Field Summary
protected  XMLLayout.LayoutItem root
           
 
Constructor Summary
XMLLayout(XMLLayout.LayoutItem root)
           
 
Method Summary
static XMLLayout getLayout(java.io.File file)
           
static XMLLayout getLayout(org.bdgp.swing.InputSource document)
           
static XMLLayout getLayout(java.io.InputStream stream)
           
static XMLLayout getLayout(java.lang.String layout)
           
static XMLLayout getLayout(java.net.URL url)
           
 XMLLayout.LayoutItem getRoot()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

root

protected XMLLayout.LayoutItem root
Constructor Detail

XMLLayout

public XMLLayout(XMLLayout.LayoutItem root)
Method Detail

getRoot

public XMLLayout.LayoutItem getRoot()

getLayout

public static XMLLayout getLayout(java.lang.String layout)
                           throws org.bdgp.swing.SAXException

getLayout

public static XMLLayout getLayout(java.net.URL url)
                           throws org.bdgp.swing.SAXException,
                                  java.io.IOException

getLayout

public static XMLLayout getLayout(java.io.File file)
                           throws org.bdgp.swing.SAXException,
                                  java.io.IOException

getLayout

public static XMLLayout getLayout(java.io.InputStream stream)
                           throws org.bdgp.swing.SAXException,
                                  java.io.IOException

getLayout

public static XMLLayout getLayout(org.bdgp.swing.InputSource document)
                           throws org.bdgp.swing.SAXException,
                                  java.io.IOException