htmllayout
Class HtmlLayout

java.lang.Object
  |
  +--htmllayout.HtmlLayout
All Implemented Interfaces:
java.awt.LayoutManager

public class HtmlLayout
extends java.lang.Object
implements java.awt.LayoutManager

HtmlLayout uses a string containing HTML like table tags to layout components.
Ex:

 <table rows=2 cols=2>
  <tr>
   <td> A label
   <td component=someName>
  <tr>
   <td component=anotherName vert=max>
   <td component="some other name" horz=max>
 

Tags and their options

Table

TR

TD

Author:
Paul Buchheit

Constructor Summary
HtmlLayout(java.lang.String html)
          Creates an HtmlLayout with the specified "HTML" string.
 
Method Summary
 void addLabels(java.awt.Container parent)
          If this layout includes any automatic lables (text within a TD) this will add them to container parent.
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
           
 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)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HtmlLayout

public HtmlLayout(java.lang.String html)
Creates an HtmlLayout with the specified "HTML" string.
Parameters:
html - The "HTML" which specifies the layout, if this is not valid table-html a BadTableHtmlException will be thrown. Html can be tested ahead of time using HtmlLayoutTest.
See Also:
BadTableHtmlException, HtmlLayoutTest
Method Detail

addLabels

public void addLabels(java.awt.Container parent)
If this layout includes any automatic lables (text within a TD) this will add them to container parent. It is not always necessary to call this, if you don't it will automatically be called when the container is first sized or layed out. Ordinarily this is ok but not always, such as when using CardLayout. Calling addLabels manually at the same time as the other components are added will never be a problem.

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Specified by:
addLayoutComponent in interface java.awt.LayoutManager
See Also:
LayoutManager.addLayoutComponent(java.lang.String, java.awt.Component)

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
See Also:
LayoutManager.removeLayoutComponent(java.awt.Component)

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
See Also:
LayoutManager.preferredLayoutSize(java.awt.Container)

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
See Also:
LayoutManager.minimumLayoutSize(java.awt.Container)

layoutContainer

public void layoutContainer(java.awt.Container parent)
Specified by:
layoutContainer in interface java.awt.LayoutManager
See Also:
LayoutManager.layoutContainer(java.awt.Container)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object