org.tbee.swing
Class DynaGridLayout

java.lang.Object
  extended by org.tbee.swing.DynaGridLayout
All Implemented Interfaces:
java.awt.event.ComponentListener, java.awt.LayoutManager, java.awt.LayoutManager2, java.util.EventListener

public class DynaGridLayout
extends java.lang.Object
implements java.awt.event.ComponentListener, java.awt.LayoutManager2

This class is a replacement for a FlowLayout inside a JScrollPane. Or a GridLayout in a JScrollPane. This layout can grow either horizontally or vertically, the other dimension is fixed. Based on the fixed dimension the number of columns (or rows) is determined for a grid layout. Then the components are laid out each row (or column) being flexible in height (width).


Nested Class Summary
static class DynaGridLayout.CC
           
static class DynaGridLayout.DIRECTION
           
 
Field Summary
static java.lang.String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
DynaGridLayout()
           
DynaGridLayout(javax.swing.JScrollPane scrollPane)
           
DynaGridLayout(javax.swing.JScrollPane scrollPane, int align)
           
DynaGridLayout(javax.swing.JScrollPane scrollPane, int align, int hgap, int vgap)
           
 
Method Summary
 void addLayoutComponent(java.awt.Component comp, java.lang.Object constraints)
           
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
           
 void componentHidden(java.awt.event.ComponentEvent e)
           
 void componentMoved(java.awt.event.ComponentEvent e)
           
 void componentResized(java.awt.event.ComponentEvent e)
           
 void componentShown(java.awt.event.ComponentEvent e)
           
 DynaGridLayout.CC getComponentConstraints(java.awt.Component comp)
          ComponentConstraints
 DynaGridLayout.DIRECTION getDirection()
          Direction
 float getLayoutAlignmentX(java.awt.Container target)
           
 float getLayoutAlignmentY(java.awt.Container target)
           
 javax.swing.JScrollPane getScrollPane()
          JScrollPane
 int getUseBorderToCreatedColumns()
           
 void invalidateLayout(java.awt.Container target)
           
 void layoutContainer(java.awt.Container parent)
           
 java.awt.Dimension maximumLayoutSize(java.awt.Container target)
           
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
           
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
           
 void removeLayoutComponent(java.awt.Component comp)
           
 void setComponentConstraints(java.awt.Component comp, DynaGridLayout.CC cc)
           
 void setDirection(DynaGridLayout.DIRECTION value)
           
 void setScrollPane(javax.swing.JScrollPane scrollPane)
           
 void setUseBorderToCreatedColumns(int value)
          UseBorderToCreatedColumns: if > 0 then a border is set on the components (overriding existing borders) to create columns
static void span(java.awt.Container container)
          Append a span to the component constraints of the last component in the container.
static void span(java.awt.Container container, java.awt.Component lComponent, boolean span)
          Append a span to the component constraints of the component in the container.
static void wrap(java.awt.Container container)
          Append a wrap to the component constraints of the last component in the container.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SOURCECODE_VERSION

public static final java.lang.String SOURCECODE_VERSION
Standard variable for determining version of a class file.

See Also:
Constant Field Values
Constructor Detail

DynaGridLayout

public DynaGridLayout()

DynaGridLayout

public DynaGridLayout(javax.swing.JScrollPane scrollPane)

DynaGridLayout

public DynaGridLayout(javax.swing.JScrollPane scrollPane,
                      int align)

DynaGridLayout

public DynaGridLayout(javax.swing.JScrollPane scrollPane,
                      int align,
                      int hgap,
                      int vgap)
Method Detail

getDirection

public DynaGridLayout.DIRECTION getDirection()
Direction


setDirection

public void setDirection(DynaGridLayout.DIRECTION value)

getScrollPane

public javax.swing.JScrollPane getScrollPane()
JScrollPane


setScrollPane

public void setScrollPane(javax.swing.JScrollPane scrollPane)

minimumLayoutSize

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

preferredLayoutSize

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

maximumLayoutSize

public java.awt.Dimension maximumLayoutSize(java.awt.Container target)
Specified by:
maximumLayoutSize in interface java.awt.LayoutManager2

layoutContainer

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

componentHidden

public void componentHidden(java.awt.event.ComponentEvent e)
Specified by:
componentHidden in interface java.awt.event.ComponentListener

componentMoved

public void componentMoved(java.awt.event.ComponentEvent e)
Specified by:
componentMoved in interface java.awt.event.ComponentListener

componentResized

public void componentResized(java.awt.event.ComponentEvent e)
Specified by:
componentResized in interface java.awt.event.ComponentListener

componentShown

public void componentShown(java.awt.event.ComponentEvent e)
Specified by:
componentShown in interface java.awt.event.ComponentListener

addLayoutComponent

public void addLayoutComponent(java.awt.Component comp,
                               java.lang.Object constraints)
Specified by:
addLayoutComponent in interface java.awt.LayoutManager2

getLayoutAlignmentX

public float getLayoutAlignmentX(java.awt.Container target)
Specified by:
getLayoutAlignmentX in interface java.awt.LayoutManager2

getLayoutAlignmentY

public float getLayoutAlignmentY(java.awt.Container target)
Specified by:
getLayoutAlignmentY in interface java.awt.LayoutManager2

invalidateLayout

public void invalidateLayout(java.awt.Container target)
Specified by:
invalidateLayout in interface java.awt.LayoutManager2

addLayoutComponent

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

removeLayoutComponent

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

setUseBorderToCreatedColumns

public void setUseBorderToCreatedColumns(int value)
UseBorderToCreatedColumns: if > 0 then a border is set on the components (overriding existing borders) to create columns


getUseBorderToCreatedColumns

public int getUseBorderToCreatedColumns()

getComponentConstraints

public DynaGridLayout.CC getComponentConstraints(java.awt.Component comp)
ComponentConstraints


setComponentConstraints

public void setComponentConstraints(java.awt.Component comp,
                                    DynaGridLayout.CC cc)

wrap

public static void wrap(java.awt.Container container)
Append a wrap to the component constraints of the last component in the container.

Parameters:
container -

span

public static void span(java.awt.Container container)
Append a span to the component constraints of the last component in the container.

Parameters:
container -

span

public static void span(java.awt.Container container,
                        java.awt.Component lComponent,
                        boolean span)
Append a span to the component constraints of the component in the container.

Parameters:
container -


Copyright © 2010. All Rights Reserved.