org.tbee.swing
Class DynaGridLayout

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

public class DynaGridLayout
extends Object
implements ComponentListener, 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 String SOURCECODE_VERSION
          Standard variable for determining version of a class file.
 
Constructor Summary
DynaGridLayout()
           
DynaGridLayout(JScrollPane scrollPane)
           
DynaGridLayout(JScrollPane scrollPane, int align)
           
DynaGridLayout(JScrollPane scrollPane, int align, int hgap, int vgap)
           
 
Method Summary
 void addLayoutComponent(Component comp, Object constraints)
           
 void addLayoutComponent(String name, Component comp)
           
 void componentHidden(ComponentEvent e)
           
 void componentMoved(ComponentEvent e)
           
 void componentResized(ComponentEvent e)
           
 void componentShown(ComponentEvent e)
           
 DynaGridLayout.CC getComponentConstraints(Component comp)
          ComponentConstraints
 DynaGridLayout.DIRECTION getDirection()
          Direction
 float getLayoutAlignmentX(Container target)
           
 float getLayoutAlignmentY(Container target)
           
 JScrollPane getScrollPane()
          JScrollPane
 int getUseBorderToCreatedColumns()
           
 void invalidateLayout(Container target)
           
 void layoutContainer(Container parent)
           
 Dimension maximumLayoutSize(Container target)
           
 Dimension minimumLayoutSize(Container parent)
           
 Dimension preferredLayoutSize(Container parent)
           
 void removeLayoutComponent(Component comp)
           
 void setComponentConstraints(Component comp, DynaGridLayout.CC cc)
           
 void setDirection(DynaGridLayout.DIRECTION value)
           
 void setScrollPane(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(Container container)
          Append a span to the component constraints of the last component in the container.
static void span(Container container, Component lComponent, boolean span)
          Append a span to the component constraints of the component in the container.
static void wrap(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 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(JScrollPane scrollPane)

DynaGridLayout

public DynaGridLayout(JScrollPane scrollPane,
                      int align)

DynaGridLayout

public DynaGridLayout(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 JScrollPane getScrollPane()
JScrollPane


setScrollPane

public void setScrollPane(JScrollPane scrollPane)

minimumLayoutSize

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

preferredLayoutSize

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

maximumLayoutSize

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

layoutContainer

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

componentHidden

public void componentHidden(ComponentEvent e)
Specified by:
componentHidden in interface ComponentListener

componentMoved

public void componentMoved(ComponentEvent e)
Specified by:
componentMoved in interface ComponentListener

componentResized

public void componentResized(ComponentEvent e)
Specified by:
componentResized in interface ComponentListener

componentShown

public void componentShown(ComponentEvent e)
Specified by:
componentShown in interface ComponentListener

addLayoutComponent

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

getLayoutAlignmentX

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

getLayoutAlignmentY

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

invalidateLayout

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

addLayoutComponent

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

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Specified by:
removeLayoutComponent in interface 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(Component comp)
ComponentConstraints


setComponentConstraints

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

wrap

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

Parameters:
container -

span

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

Parameters:
container -

span

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

Parameters:
container -


Copyright © 2012 KnowledgePlaza. All Rights Reserved.