com.abstractics.xmlpanel.xmllayout
Class XmlLayout

java.lang.Object
  extended bycom.abstractics.xmlpanel.xmllayout.XmlLayout
All Implemented Interfaces:
javax.swing.SwingConstants

public class XmlLayout
extends java.lang.Object
implements javax.swing.SwingConstants

In determining both widths and heights for the layout, the following precedence is followed:

Version:
$Id: XmlLayout.java,v 1.2 2006/03/15 05:37:44 andyman99 Exp $
Author:
Andrew Lawrence, Copyright 2006 Abstractics, L.L.C., Licensed under the Apache License, Version 2.0

Field Summary
static java.awt.Insets INSETS_ZERO
           
 
Fields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
 
Constructor Summary
XmlLayout(org.w3c.dom.Element element)
          Creates a layout from the element given.
XmlLayout(org.w3c.dom.Element element, XmlPanel panel)
          Creates a layout from the Document given and uses any existing components in the map (keyed by component name) if they match names given in the XML, instead of creating new components.
XmlLayout(java.lang.String xml)
          Creates a layout from the XML string given.
XmlLayout(java.lang.String xml, XmlPanel panel)
          Creates a layout from the XML string given and uses any existing components in the map (keyed by component name) if they match names given in the XML, instead of creating new components.
 
Method Summary
 java.lang.String getCellAlign()
           
 java.lang.String getCellPadding()
           
 java.util.Map getComponentMap()
           
 java.awt.Component getComponentNamed(java.lang.String name)
           
 java.awt.Component[] getComponents()
           
 XmlLayoutCell[] getFloatingCells()
           
 java.awt.Insets getMargins()
           
 java.awt.Dimension getMinimumSize()
          Returns the sum of all minimum row heights and the max of all minimum row widths.
 java.awt.Dimension getPreferredSize()
          Returns the sum of all preferred row heights and the max of all preferred row widths, plus margins
 java.awt.Rectangle[] getRectangles()
           
 java.lang.String[] getRequiredHeights()
           
 XmlLayoutRow[] getRows()
           
 void layout(java.awt.Dimension size)
          Given the size that this panel should be, this method sets all of the locations and dimensions for the components.
 void layout(java.awt.Dimension size, java.awt.Insets borderInsets)
          Given the size that this panel should be, this method sets all of the locations and dimensions for the components.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INSETS_ZERO

public static final java.awt.Insets INSETS_ZERO
Constructor Detail

XmlLayout

public XmlLayout(org.w3c.dom.Element element)
Creates a layout from the element given.

Parameters:
element - Element representing the XML

XmlLayout

public XmlLayout(org.w3c.dom.Element element,
                 XmlPanel panel)
Creates a layout from the Document given and uses any existing components in the map (keyed by component name) if they match names given in the XML, instead of creating new components.

Parameters:
element - Element representing the XML
panel - The XmlPanel that this component is being placed into - for reference only.

XmlLayout

public XmlLayout(java.lang.String xml)
          throws XmlException
Creates a layout from the XML string given.

Parameters:
xml -
Throws:
java.io.IOException - Thrown if there is a problem with parsing the XML
XmlException

XmlLayout

public XmlLayout(java.lang.String xml,
                 XmlPanel panel)
          throws XmlException
Creates a layout from the XML string given and uses any existing components in the map (keyed by component name) if they match names given in the XML, instead of creating new components.

Parameters:
xml -
panel - The XmlPanel that this component is being placed into - for reference only.
Throws:
XmlException - Thrown if there is a problem with parsing the XML
Method Detail

getRows

public XmlLayoutRow[] getRows()
Returns:
Returns the rows.

getRequiredHeights

public java.lang.String[] getRequiredHeights()

getMargins

public java.awt.Insets getMargins()
Returns:
Returns the padding.

getMinimumSize

public java.awt.Dimension getMinimumSize()
Returns the sum of all minimum row heights and the max of all minimum row widths. plus margins

Returns:

getPreferredSize

public java.awt.Dimension getPreferredSize()
Returns the sum of all preferred row heights and the max of all preferred row widths, plus margins

Returns:

getRectangles

public java.awt.Rectangle[] getRectangles()
Returns:
An array of Rectangle objects for every cell in the layout

layout

public void layout(java.awt.Dimension size)
Given the size that this panel should be, this method sets all of the locations and dimensions for the components. This method uses the size provided, with no inset margins

Parameters:
size -

layout

public void layout(java.awt.Dimension size,
                   java.awt.Insets borderInsets)
Given the size that this panel should be, this method sets all of the locations and dimensions for the components. The insets provided are to be allocated for on top of the margins specifed for the layout.

Parameters:
size -
borderInsets - Insets representing the border on the panel

getComponentMap

public java.util.Map getComponentMap()
Returns:
Returns a map of component values keyed by their component name. Components that don't have a name will not be included in this map

getComponents

public java.awt.Component[] getComponents()

getComponentNamed

public java.awt.Component getComponentNamed(java.lang.String name)
Parameters:
name -
Returns:
The component with the given name, or null if not found

getCellAlign

public java.lang.String getCellAlign()
Returns:
Returns the cellalign attribute for this panel

getCellPadding

public java.lang.String getCellPadding()
Returns:
Returns the cellpadding attribute for this panel

getFloatingCells

public XmlLayoutCell[] getFloatingCells()