com.sas.visuals
Class RowColumnLayout

com.sas.visuals.RowColumnLayout
All Implemented Interfaces:
java.awt.LayoutManager, java.io.Serializable

public class RowColumnLayout
implements java.awt.LayoutManager, java.io.Serializable

RowColumnLayout is a class that implements the java.awt.LayoutManager interface to be able to layout components within a container in rows and columns. By default it creates a grid layout that is filled column first.

Notes:


See Also:
Serialized Form

Constructor Summary
RowColumnLayout()
          Default constructor.
RowColumnLayout(int rows, int cols, int fill)
          Creates a grid layout with the specified rows and columns.
RowColumnLayout(int rows, int cols, int fill, int hgap, int vgap)
          Creates a grid layout with the specified rows, columns, horizontal gap, and vertical gap.
RowColumnLayout(int rows, int cols, int fill, int hgap, int vgap, boolean spacing)
          Creates a grid layout with the specified rows, columns, horizontal gap, and vertical gap.
 
Method Summary
 void addLayoutComponent(java.lang.String name, java.awt.Component comp)
          Adds the specified component with the specified name to the layout.
 boolean equals(java.lang.Object obj)
           
 int getColumns()
          Get the number of columns in this layout.
 int getFill()
          Get the order the grid gets filled with objects.
 int getHgap()
          Get the horizontal gap between components.
 int getRows()
          Get the number of rows in this layout.
 int getVgap()
          Get the vertical gap between components.
 boolean isAutoSpacing()
          Get if the RowColumnLayout is autoSpacing.
 void layoutContainer(java.awt.Container parent)
          Layout the components in the specified container.
 java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
          Returns the minimum dimensions needed to layout the components contained in the specified panel.
 java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
          Returns the preferred dimensions for this layout given the components in the specified panel.
 void removeLayoutComponent(java.awt.Component comp)
          Removes the specified component from the layout.
 void setAutoSpacing(boolean s)
          Set the RowColumnLayout autoSpacing property.
 void setColumns(int cols)
          Set the number of columns in this layout.
 void setFill(int fillFirst)
          Set the order the grid gets filled with objects.
 void setHgap(int hgap)
          Set the horizontal gap between components.
 void setRows(int rows)
          Set the number of rows in this layout.
 void setVgap(int vgap)
          Set the vertical gap between components.
 java.lang.String toString()
          Return the String representation of this RowColumnLayout's values.
 

Constructor Detail

RowColumnLayout

public RowColumnLayout()
Default constructor.


RowColumnLayout

public RowColumnLayout(int rows,
                       int cols,
                       int fill)
Creates a grid layout with the specified rows and columns.

Parameters:
rows - the rows
cols - the columns
fill - the order to fill the grid: by column or by row.

RowColumnLayout

public RowColumnLayout(int rows,
                       int cols,
                       int fill,
                       int hgap,
                       int vgap)
Creates a grid layout with the specified rows, columns, horizontal gap, and vertical gap.

Parameters:
rows - the rows; zero means 'any number.'
cols - the columns; zero means 'any number.'
fill - the order to fill the grid: by column or by row.
hgap - the horizontal gap variable
vgap - the vertical gap variable

RowColumnLayout

public RowColumnLayout(int rows,
                       int cols,
                       int fill,
                       int hgap,
                       int vgap,
                       boolean spacing)
Creates a grid layout with the specified rows, columns, horizontal gap, and vertical gap.

Parameters:
rows - the rows; zero means 'any number of rows'
cols - the columns; zero means 'any number of columns'
fill - the order to fill the grid: by column or by row.
hgap - the horizontal gap variable
vgap - the vertical gap variable
spacing - the autoSpacing variable
Method Detail

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

isAutoSpacing

public boolean isAutoSpacing()
Get if the RowColumnLayout is autoSpacing. If true the components will be spaced over the entire area of the container; otherwise they will be laid out in a grid starting at the top/left corner.

Returns:
if true, autoSpacing is on, otherwise autoSpacing is off
See Also:
setAutoSpacing(boolean)

setAutoSpacing

public void setAutoSpacing(boolean s)
Set the RowColumnLayout autoSpacing property. If true the components will be spaced over the entire area of the container; otherwise they will be laid out in a grid starting at the top/left corner.

Parameters:
s - if true, autoSpacing is on, otherwise autoSpacing is off
See Also:
isAutoSpacing()

getRows

public int getRows()
Get the number of rows in this layout.

Returns:
the rows in this layout
See Also:
setRows(int)

setRows

public void setRows(int rows)
Set the number of rows in this layout.

Parameters:
rows - number of rows in this layout
See Also:
getRows()

getColumns

public int getColumns()
Get the number of columns in this layout.

Returns:
the columns in this layout
See Also:
setColumns(int)

setColumns

public void setColumns(int cols)
Set the number of columns in this layout.

Parameters:
cols - number of columns in this layout
See Also:
getColumns()

getHgap

public int getHgap()
Get the horizontal gap between components.

Returns:
the horizontal gap between components.
See Also:
setHgap(int)

setHgap

public void setHgap(int hgap)
Set the horizontal gap between components.

Parameters:
hgap - the horizontal gap between components
See Also:
getHgap()

getVgap

public int getVgap()
Get the vertical gap between components.

Returns:
the vertical gap between components
See Also:
setVgap(int)

setVgap

public void setVgap(int vgap)
Set the vertical gap between components.

Parameters:
vgap - the vertical gap between components
See Also:
getVgap()

getFill

public int getFill()
Get the order the grid gets filled with objects.

Returns:
the fill order: 0 - the columns are filled first, 1 - the rows are filled first.
See Also:
setFill(int)

setFill

public void setFill(int fillFirst)
Set the order the grid gets filled with objects.

Parameters:
fillFirst - if 0 the columns are filled first, if 1 the rows are filled first.
See Also:
getFill()

addLayoutComponent

public void addLayoutComponent(java.lang.String name,
                               java.awt.Component comp)
Adds the specified component with the specified name to the layout.

Specified by:
addLayoutComponent in interface java.awt.LayoutManager
Parameters:
name - the name of the component
comp - the component to be added

removeLayoutComponent

public void removeLayoutComponent(java.awt.Component comp)
Removes the specified component from the layout. Does not apply.

Specified by:
removeLayoutComponent in interface java.awt.LayoutManager
Parameters:
comp - the component to be removed

preferredLayoutSize

public java.awt.Dimension preferredLayoutSize(java.awt.Container parent)
Returns the preferred dimensions for this layout given the components in the specified panel.

Specified by:
preferredLayoutSize in interface java.awt.LayoutManager
Parameters:
parent - the component which needs to be laid out
See Also:
minimumLayoutSize(java.awt.Container)

minimumLayoutSize

public java.awt.Dimension minimumLayoutSize(java.awt.Container parent)
Returns the minimum dimensions needed to layout the components contained in the specified panel.

Specified by:
minimumLayoutSize in interface java.awt.LayoutManager
Parameters:
parent - the component which needs to be laid out
See Also:
preferredLayoutSize(java.awt.Container)

layoutContainer

public void layoutContainer(java.awt.Container parent)
Layout the components in the specified container.

Specified by:
layoutContainer in interface java.awt.LayoutManager
Parameters:
parent - the specified container being laid out
See Also:
Container

toString

public java.lang.String toString()
Return the String representation of this RowColumnLayout's values.

Overrides:
toString in class java.lang.Object



Copyright © 2009 SAS Institute Inc. All Rights Reserved.