ProgramixGenericLib v5.0.1

com.programix.gui.layout
Class AbstractTableLayout

java.lang.Object
  extended by com.programix.gui.layout.AbstractTableLayout
All Implemented Interfaces:
LayoutManager, Serializable
Direct Known Subclasses:
AnchorTableLayout, ButtonLayout, ShelfLayout

public abstract class AbstractTableLayout
extends Object
implements LayoutManager, Serializable

Generalized layout for components that are going to be laid out in rows and columns.

There's nothing in this class that prevents a single instance from being used simultaneously by multiple containers. This class is abstract, so be sure that this is also true for the particular subclass that is being used.

Author:
Paul Hyde
See Also:
AnchorTableLayout, FormLayout, ColumnButtonLayout, RowButtonLayout, StackLayout, ShelfLayout, ColumnCoordinator, Serialized Form

Nested Class Summary
protected  class AbstractTableLayout.CellData
           
 
Field Summary
protected  AnchorPoint anchorPoint
          The region to cluster the table in when the container is bigger than the table requires.
protected  int borderGap
          The number of pixels to pad the top, bottom, left, and right areas around the table.
protected  int colGap
          The number of pixels between columns when there is more than one column.
protected  ColumnCoordinator columnCoordinator
          If non-null, then this coordinates the widths of some or all columns across containers--even those with different layout managers.
static AnchorPoint DEFAULT_ANCHOR_POINT
          The default anchor point used when the container is larger than is needed for the table.
static int DEFAULT_BORDER_GAP
          The default number of pixels to be placed around the outside of all the table before the edge of the container.
static int DEFAULT_COL_GAP
          The default number of pixels to be placed between columns when more than one column is present.
static int DEFAULT_ROW_GAP
          The default number of pixels to be placed between rows when more than one row is present.
protected  boolean ignoreInvisibleComponents
          If true (the default) then components that are not visible will be ignored during layout.
protected  int rowGap
          The number of pixels between rows when there is more than one row.
 
Constructor Summary
protected AbstractTableLayout(int rowGap, int colGap, int borderGap, AnchorPoint anchorPoint)
          Creates a table layout.
 
Method Summary
 void addLayoutComponent(String name, Component comp)
          Called by the graphical subsystem when a component is being added to the container.
protected abstract  AbstractTableLayout.CellData createCellData(Container pane)
           
 AnchorPoint getAnchorPoint()
          Returns the region to cluster the table in when the container is bigger than the table requires.
 int getBorderGap()
          Returns the number of pixels to pad the top, bottom, left, and right areas around the table.
protected  ColumnCoordinator getColumnCoordinator()
          Returns the currently assigned ColumnCoordinator or null none has been assigned.
 int getColumnGap()
          Returns the number of pixels placed between columns when more than one column is present.
 int getRowGap()
          Returns the number of pixels placed between rows when more than one row is present.
 boolean isIgnoreInvisibleComponents()
          Returns true if components that are not currently visible should be ignored during layout.
 void layoutContainer(Container parent)
          Called by the graphical subsystem when the container wants to re-layout the components within it.
 Dimension minimumLayoutSize(Container parent)
          Called by the graphical subsystem when the container wants to know what to report its minimum size as.
 Dimension preferredLayoutSize(Container parent)
          Called by the graphical subsystem when the container wants to know what to report its preferred size as.
 void removeLayoutComponent(Component comp)
          Called by the graphical subsystem when a component is being removed from the container.
 void setAnchorPoint(AnchorPoint anchorPoint)
          Changes the region to cluster the table in when the container is bigger than the table requires.
 void setBorderGap(int borderGap)
          Changes the number of pixels to pad the top, bottom, left, and right areas around the table.
protected  void setColumnCoordinator(ColumnCoordinator newCoordinator)
          Changes the currently assigned ColumnCoordinator.
 void setColumnGap(int colGap)
          Changes the number of pixels placed between columns when more than one column is present.
 void setIgnoreInvisibleComponents(boolean ignoreInvisibleComponents)
          Indicated whether or not invisible components should be considered during layout.
 void setRowGap(int rowGap)
          Changes the number of pixels placed between rows when more than one row is present.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_ROW_GAP

public static final int DEFAULT_ROW_GAP
The default number of pixels to be placed between rows when more than one row is present. This default value is 3.

See Also:
Constant Field Values

DEFAULT_COL_GAP

public static final int DEFAULT_COL_GAP
The default number of pixels to be placed between columns when more than one column is present. This default value is 3.

See Also:
Constant Field Values

DEFAULT_BORDER_GAP

public static final int DEFAULT_BORDER_GAP
The default number of pixels to be placed around the outside of all the table before the edge of the container. Used as a padding. This default value is 5.

See Also:
Constant Field Values

DEFAULT_ANCHOR_POINT

public static final AnchorPoint DEFAULT_ANCHOR_POINT
The default anchor point used when the container is larger than is needed for the table. This default value is AnchorPoint.NORTH.


rowGap

protected int rowGap
The number of pixels between rows when there is more than one row.


colGap

protected int colGap
The number of pixels between columns when there is more than one column.


borderGap

protected int borderGap
The number of pixels to pad the top, bottom, left, and right areas around the table. This is the minimum space between the outermost rows and columns and the edge of the container. This eliminates the need to set an "empty border" on this container.


anchorPoint

protected AnchorPoint anchorPoint
The region to cluster the table in when the container is bigger than the table requires. The table will remain anchored in that region and will not be stretched when their container is larger than needed.


ignoreInvisibleComponents

protected boolean ignoreInvisibleComponents
If true (the default) then components that are not visible will be ignored during layout.


columnCoordinator

protected ColumnCoordinator columnCoordinator
If non-null, then this coordinates the widths of some or all columns across containers--even those with different layout managers. See ColumnCoordinator for details on how to coordinate columns. Directly modifying this field is discouraged. Use getColumnCoordinator() and setColumnCoordinator(ColumnCoordinator) instead.

Constructor Detail

AbstractTableLayout

protected AbstractTableLayout(int rowGap,
                              int colGap,
                              int borderGap,
                              AnchorPoint anchorPoint)
Creates a table layout.

Parameters:
rowGap - space between rows. See setRowGap().
colGap - space between columns. See setColumnGap.
borderGap - space around the outside of the form. See setBorderGap().
anchorPoint - region to anchor to when there is extra space See setAnchorPoint().
Method Detail

layoutContainer

public void layoutContainer(Container parent)
Called by the graphical subsystem when the container wants to re-layout the components within it.

Specified by:
layoutContainer in interface LayoutManager

preferredLayoutSize

public Dimension preferredLayoutSize(Container parent)
Called by the graphical subsystem when the container wants to know what to report its preferred size as.

Specified by:
preferredLayoutSize in interface LayoutManager

minimumLayoutSize

public Dimension minimumLayoutSize(Container parent)
Called by the graphical subsystem when the container wants to know what to report its minimum size as. This layout manager returns its preferred size also as its minimum size.

Specified by:
minimumLayoutSize in interface LayoutManager

removeLayoutComponent

public void removeLayoutComponent(Component comp)
Called by the graphical subsystem when a component is being removed from the container. This layout manager does nothing for this request.

Specified by:
removeLayoutComponent in interface LayoutManager

addLayoutComponent

public void addLayoutComponent(String name,
                               Component comp)
Called by the graphical subsystem when a component is being added to the container. This layout manager does nothing for this request.

Specified by:
addLayoutComponent in interface LayoutManager

getRowGap

public int getRowGap()
Returns the number of pixels placed between rows when more than one row is present.


setRowGap

public void setRowGap(int rowGap)
Changes the number of pixels placed between rows when more than one row is present. Passed value is silently increased to 0 if a negative gap is specified.


getColumnGap

public int getColumnGap()
Returns the number of pixels placed between columns when more than one column is present. If there is only one column, then the value returned is meaningless.


setColumnGap

public void setColumnGap(int colGap)
Changes the number of pixels placed between columns when more than one column is present. Passed value is silently increased to 0 if a negative gap is specified. If there is only one column, then calling this method is meaningless.


getBorderGap

public int getBorderGap()
Returns the number of pixels to pad the top, bottom, left, and right areas around the table. This is the minimum space between the outermost rows and columns and the edge of the container. This eliminates the need to set an "empty border" on this container.


setBorderGap

public void setBorderGap(int borderGap)
Changes the number of pixels to pad the top, bottom, left, and right areas around the table. This is the minimum space between the outermost rows and columns and the edge of the container. This eliminates the need to set an "empty border" on this container. Passed value is silently increased to 0 if a negative gap is specified.


getAnchorPoint

public AnchorPoint getAnchorPoint()
Returns the region to cluster the table in when the container is bigger than the table requires. The table will remain anchored in that region and will not be stretched when its container is larger than needed.


setAnchorPoint

public void setAnchorPoint(AnchorPoint anchorPoint)
Changes the region to cluster the table in when the container is bigger than the table requires. The table will remain anchored in that region and will not be stretched when its container is larger than needed. If null is passed in, the DEFAULT_ANCHOR_POINT will be used instead.


isIgnoreInvisibleComponents

public boolean isIgnoreInvisibleComponents()
Returns true if components that are not currently visible should be ignored during layout. The default value is true.


setIgnoreInvisibleComponents

public void setIgnoreInvisibleComponents(boolean ignoreInvisibleComponents)
Indicated whether or not invisible components should be considered during layout. The default value is true which indicates that components that are not currently visible should be ignored.


getColumnCoordinator

protected ColumnCoordinator getColumnCoordinator()
Returns the currently assigned ColumnCoordinator or null none has been assigned. There can be zero or one ColumnCoordinator's assigned to a layout manager. By default, a layout manager does not have a ColumnCoordinator. See ColumnCoordinator for details.

NOTE: This method is generally for internal use.

Returns:
the current coordinator or null.

setColumnCoordinator

protected void setColumnCoordinator(ColumnCoordinator newCoordinator)
Changes the currently assigned ColumnCoordinator. There can be zero or one ColumnCoordinator's assigned to a layout manager. Passing null to this method clears the associated coordinator and automatically tells the previous coordinator (if there was one) that this layout manager is no longer coordinating. By default, a layout manager does not have a ColumnCoordinator. See ColumnCoordinator for details.

NOTE: This method is generally for internal use. Most users should call methods on ColumnCoordinator to alter a container's participation in column coordination.

Parameters:
newCoordinator - the new coordinator or null.

createCellData

protected abstract AbstractTableLayout.CellData createCellData(Container pane)

ProgramixGenericLib v5.0.1

Copyright © 2001-2009 Programix Incorporated. All rights reserved. ProgramixGenericLib is free and is OSI Certified Open Source Software under the BSD license.