com.sibvisions.rad.ui.swing.ext.layout
Class JVxGridLayout

java.lang.Object
  extended by com.sibvisions.rad.ui.swing.ext.layout.JVxGridLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.awt.LayoutManager2

public class JVxGridLayout
extends java.lang.Object
implements java.awt.LayoutManager2

The GridLayout class is a layout manager that lays out a container's components in a rectangular grid.


Nested Class Summary
static class JVxGridLayout.CellConstraints
          The CellConstraint class stores the X and Y position, the Width and Height and the insets of the component.
 
Constructor Summary
JVxGridLayout()
          Constructs a new GridLayout that calculates columns and rows automatically.
JVxGridLayout(int pColumns, int pRows)
          Constructs a new GridLayout.
 
Method Summary
 void addLayoutComponent(java.awt.Component pComp, java.lang.Object pConstraints)
          
 void addLayoutComponent(java.lang.String pName, java.awt.Component c)
          
static void checkNotNull(java.lang.Object pReference, java.lang.String pMessage)
          Throws a NullPointerException with the specified message if the given Object references null.
 int getColumns()
          Returns the number of columns.
 JVxGridLayout.CellConstraints getConstraints(java.awt.Component pComp)
          Gets the constraints for the specified IComponent.
 JVxGridLayout.CellConstraints getConstraints(int pColumns, int pRows)
          Creates a constraint with the specified number of rows and columns.
 JVxGridLayout.CellConstraints getConstraints(int pColumns, int pRows, int pWidth, int pHeight)
          Creates a constraint with the specified number of rows and columns with the determined dimensions.
 JVxGridLayout.CellConstraints getConstraints(int pColumns, int pRows, int pWidth, int pHeight, java.awt.Insets pInsets)
          Creates a constraint with the specified number of rows and columns with the determined dimensions and insets.
 int getHorizontalGap()
          Gets the horizontal gap.
 float getLayoutAlignmentX(java.awt.Container pTarget)
          
 float getLayoutAlignmentY(java.awt.Container pTarget)
          
 java.awt.Insets getMargins()
          Gets the margins.
 int getRows()
          Returns the number of rows.
 int getVerticalGap()
          Gets the vertical gap.
 void invalidateLayout(java.awt.Container pTarget)
          
 void layoutContainer(java.awt.Container pParent)
          
 java.awt.Dimension maximumLayoutSize(java.awt.Container pTarget)
          
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
          
 java.awt.Dimension preferredLayoutSize(java.awt.Container pParent)
          
 void removeLayoutComponent(java.awt.Component pComp)
          
 void setColumns(int pColumns)
          Sets the column count.
 void setConstraints(java.awt.Component pComponent, JVxGridLayout.CellConstraints pConstraints)
          Puts the component and its constraints into the constraint Map.
 void setHorizontalGap(int pHorizontalGap)
          Sets the horizontal gap.
 void setMargins(java.awt.Insets pMargins)
          Sets the margins.
 void setRows(int pRows)
          Sets the row count.
 void setVerticalGap(int pVerticalGap)
          Sets the vertical gap.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JVxGridLayout

public JVxGridLayout()
Constructs a new GridLayout that calculates columns and rows automatically.


JVxGridLayout

public JVxGridLayout(int pColumns,
                     int pRows)
Constructs a new GridLayout.

Parameters:
pColumns - the column count, a value smaller than 1 means automatic calculation.
pRows - the row count, a value smaller than 1 means automatic calculation.
Method Detail

addLayoutComponent

public void addLayoutComponent(java.lang.String pName,
                               java.awt.Component c)

Specified by:
addLayoutComponent in interface java.awt.LayoutManager

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component pComp)

Specified by:
removeLayoutComponent in interface java.awt.LayoutManager

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container pParent)

Specified by:
preferredLayoutSize in interface java.awt.LayoutManager

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)

Specified by:
minimumLayoutSize in interface java.awt.LayoutManager

layoutContainer

public void layoutContainer(java.awt.Container pParent)

Specified by:
layoutContainer in interface java.awt.LayoutManager

addLayoutComponent

public void addLayoutComponent(java.awt.Component pComp,
                               java.lang.Object pConstraints)

Specified by:
addLayoutComponent in interface java.awt.LayoutManager2

maximumLayoutSize

public java.awt.Dimension maximumLayoutSize(java.awt.Container pTarget)

Specified by:
maximumLayoutSize in interface java.awt.LayoutManager2

getLayoutAlignmentX

public float getLayoutAlignmentX(java.awt.Container pTarget)

Specified by:
getLayoutAlignmentX in interface java.awt.LayoutManager2

getLayoutAlignmentY

public float getLayoutAlignmentY(java.awt.Container pTarget)

Specified by:
getLayoutAlignmentY in interface java.awt.LayoutManager2

invalidateLayout

public void invalidateLayout(java.awt.Container pTarget)

Specified by:
invalidateLayout in interface java.awt.LayoutManager2

getColumns

public int getColumns()
Returns the number of columns.

Returns:
the number of columns

setColumns

public void setColumns(int pColumns)
Sets the column count.

Parameters:
pColumns - the column count

getRows

public int getRows()
Returns the number of rows.

Returns:
the number of rows

setRows

public void setRows(int pRows)
Sets the row count.

Parameters:
pRows - the row count

getConstraints

public JVxGridLayout.CellConstraints getConstraints(java.awt.Component pComp)
Gets the constraints for the specified IComponent.

Parameters:
pComp - the IComponent to be queried
Returns:
the constraint for the specified IComponent, or null if component is null or is not present in this layout

getConstraints

public JVxGridLayout.CellConstraints getConstraints(int pColumns,
                                                    int pRows)
Creates a constraint with the specified number of rows and columns.

Parameters:
pColumns - the number of columns
pRows - the number of rows
Returns:
the constraint

getConstraints

public JVxGridLayout.CellConstraints getConstraints(int pColumns,
                                                    int pRows,
                                                    int pWidth,
                                                    int pHeight)
Creates a constraint with the specified number of rows and columns with the determined dimensions.

Parameters:
pColumns - the number of columns
pRows - the number of rows
pWidth - width of the content
pHeight - height of the content
Returns:
the constraint

getConstraints

public JVxGridLayout.CellConstraints getConstraints(int pColumns,
                                                    int pRows,
                                                    int pWidth,
                                                    int pHeight,
                                                    java.awt.Insets pInsets)
Creates a constraint with the specified number of rows and columns with the determined dimensions and insets.

Parameters:
pColumns - the number of columns
pRows - the number of rows
pWidth - width of the content
pHeight - height of the content
pInsets - the determined insets
Returns:
the constraint

setConstraints

public void setConstraints(java.awt.Component pComponent,
                           JVxGridLayout.CellConstraints pConstraints)
Puts the component and its constraints into the constraint Map.

Parameters:
pComponent - the component
pConstraints - the components constraints

getMargins

public java.awt.Insets getMargins()
Gets the margins.

Returns:
the margins.

setMargins

public void setMargins(java.awt.Insets pMargins)
Sets the margins.

Parameters:
pMargins - the margins

getHorizontalGap

public int getHorizontalGap()
Gets the horizontal gap.

Returns:
the horizontal gap

setHorizontalGap

public void setHorizontalGap(int pHorizontalGap)
Sets the horizontal gap.

Parameters:
pHorizontalGap - the horizontal gap

getVerticalGap

public int getVerticalGap()
Gets the vertical gap.

Returns:
the vertical gap

setVerticalGap

public void setVerticalGap(int pVerticalGap)
Sets the vertical gap.

Parameters:
pVerticalGap - the vertical gap

checkNotNull

public static void checkNotNull(java.lang.Object pReference,
                                java.lang.String pMessage)
Throws a NullPointerException with the specified message if the given Object references null.

Parameters:
pReference - the Object which shall be checked
pMessage - the specified message


Copyright © 2009 SIB Visions GmbH. All Rights Reserved.