net.xoetrope.xui.helper
Class Measurer

java.lang.Object
  extended by net.xoetrope.xui.helper.Measurer

public class Measurer
extends java.lang.Object

A helper class to assist in positioning rows and columns of components within a container. The containers width is divided into columns and the height is divided into rows. Each cell is padded on either side.
No attempt is made to constrain the measurements. Therefore if an attempt is made to call nextX or nextY more times than there are rows or columns respectively then dimensions beyond the bounds on the container will be returned.

Copyright: Copyright (c) Xoetrope Ltd., 1998-2003
License: see license.txt


Constructor Summary
Measurer(java.awt.Container cont, int rows, int cols, int horzPadding, int vertPadding)
          Constructs a new Measurer.
 
Method Summary
 int getCellHeight()
          Get the cell width including padding
 int getCellWidth()
          Get the cell width including padding
 int getHeight()
          Get the cell content's height (the cell height less the padding)
 int getNextX()
          Get the left hand coordinate.
 int getNextY()
          Get the top coordinate.
 int getRemainingHeight()
          Get the remaining height available for a component, taking account of the required padding
 int getRemainingWidth()
          Get the remaining width available for a component, taking account of the required padding
 int getWidth()
          Get the cell width including padding (the cell width less the padding)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Measurer

public Measurer(java.awt.Container cont,
                int rows,
                int cols,
                int horzPadding,
                int vertPadding)
Constructs a new Measurer.

Parameters:
cont - the container to be dividied
rows - the number of rows into which the container's height is divided
cols - the number of columns into which the container's width is divided
horzPadding - the amount of padding on the left and right of the cell
vertPadding - the amount of padding on the top and bottom of the cell
Method Detail

getNextX

public int getNextX()
Get the left hand coordinate. The coordinate includes the cell padding

Returns:
the new coordinate

getNextY

public int getNextY()
Get the top coordinate. The coordinate includes the cell padding

Returns:
the new coordinate

getCellWidth

public int getCellWidth()
Get the cell width including padding

Returns:
the cell width

getCellHeight

public int getCellHeight()
Get the cell width including padding

Returns:
the cell height

getWidth

public int getWidth()
Get the cell width including padding (the cell width less the padding)

Returns:
the cell width

getHeight

public int getHeight()
Get the cell content's height (the cell height less the padding)

Returns:
the cell height

getRemainingWidth

public int getRemainingWidth()
Get the remaining width available for a component, taking account of the required padding

Returns:
the remaining width

getRemainingHeight

public int getRemainingHeight()
Get the remaining height available for a component, taking account of the required padding

Returns:
the remaining height