pagelayout
Class ComponentCell

java.lang.Object
  extended by pagelayout.Cell
      extended by pagelayout.ComponentCell

public class ComponentCell
extends Cell

ComponentCell is a class that wraps an object of the type java.awt.Component in a Cell object.


Nested Class Summary
 
Nested classes/interfaces inherited from class pagelayout.Cell
Cell.Constraint
 
Field Summary
protected  int hgap
           
static int HGAP
          The default width of the empty strip around vertical edges of the component.
protected  int vgap
           
static int VGAP
          The default height of the empty strip around horizontal edges of the component.
 
Fields inherited from class pagelayout.Cell
BASELINE, BOTTOM, boundSpring, CENTER, constraint, filledSizeX, filledSizeY, fixMaxSize, FOUND_NOTREPLACED, FOUND_REPLACED, halign, JUSTIFIED, LEFT, links, MAX, NEWROW, NO_ALIGNMENT, NOT_FOUND, RIGHT, SKIP, TOP, valign
 
Constructor Summary
ComponentCell(java.awt.Component component)
          Creates the Cell object for a component.
ComponentCell(java.awt.Component component, int horizontalGap, int verticalGap)
          Creates the Cell object for a component with specified gaps.
 
Method Summary
 void addComponentsToContainer(java.awt.Container container)
          Add the component wrapped in this cell to the given container.
 BoundSpring computeBoundSpring()
          Returns the two-dimensional spring associated with this cell.
 Cell duplicate(ComponentDuplicator creator)
           
 int getBaseline()
          Returns the baseline of the component wrapped by this cell.
 java.awt.Component getComponent()
          Returns the component that this object wraps.
 ComponentCell getComponentCell()
           
 void setBaselineOffset(int b)
           
protected  void setBounds(int x, int y, int width, int height)
          Resizes the enclosed component to occupy the specified rectangle of the container with appropriate empty strips around it.
 void setComponentGaps(int hgap, int vgap)
          Sets the size of the empty area around all enclosed components.
 java.lang.String toString()
          Return the string representation of this cell.
 void xmlserialize(XMLPrintStream out, ComponentXMLSerializer xc)
           
 
Methods inherited from class pagelayout.Cell
addArgs, alignBaseline, alignBaseline, checkArgs, createLayout, dupConstraint, getAlignment, getBoundSpring, getCellByName, getChildAt, getComponentCell, getConstraint, getContainer, getDim, getFilledSizeX, getFilledSizeY, getName, getParent, getRootCell, getSize, invalidate, isCell, isCellOrComponent, isComponentCell, isFixedHeight, isFixedSize, isFixedWidth, layout, linkHeight, linkHeight, linkHeight, linkToContainerHeight, linkToContainerWidth, linkWidth, linkWidth, linkWidth, numberOfChildren, removeAllComponents, removeComponent, replaceCell, replaceChild, setAlignment, setBounds, setDim, setFixedHeight, setFixedHeight, setFixedHeight, setFixedHeight, setFixedHeight, setFixedSize, setFixedSize, setFixedSize, setFixedWidth, setFixedWidth, setFixedWidth, setFixedWidth, setFixedWidth, setName, setParent, setSize, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

vgap

protected int vgap

hgap

protected int hgap

VGAP

public static final int VGAP
The default height of the empty strip around horizontal edges of the component.

See Also:
Constant Field Values

HGAP

public static final int HGAP
The default width of the empty strip around vertical edges of the component.

See Also:
Constant Field Values
Constructor Detail

ComponentCell

public ComponentCell(java.awt.Component component)
Creates the Cell object for a component.

Parameters:
component - the component to be wrapped in this cell.

ComponentCell

public ComponentCell(java.awt.Component component,
                     int horizontalGap,
                     int verticalGap)
Creates the Cell object for a component with specified gaps.

Parameters:
component - the component to be wrapped in this cell.
horizontalGap - the width of the empty strips to be added adjacent to the vertical edges of the component.
verticalGap - the height of the empty strips to be added adjacent to the horizontal edges of the component.
Method Detail

setBaselineOffset

public void setBaselineOffset(int b)

toString

public java.lang.String toString()
Return the string representation of this cell.

Overrides:
toString in class java.lang.Object
Returns:
the string representation of this cell.

addComponentsToContainer

public void addComponentsToContainer(java.awt.Container container)
Add the component wrapped in this cell to the given container.

Overrides:
addComponentsToContainer in class Cell
Parameters:
container - the container to which the component must be added.

setBounds

protected void setBounds(int x,
                         int y,
                         int width,
                         int height)
Resizes the enclosed component to occupy the specified rectangle of the container with appropriate empty strips around it.

Overrides:
setBounds in class Cell
Parameters:
x - the x-coordinate of the top left of the rectangle.
y - the y-coordinate of the top left of the rectangle.
width - the width of the rectangle.
height - the height of the rectangle.

computeBoundSpring

public BoundSpring computeBoundSpring()
Returns the two-dimensional spring associated with this cell.

Specified by:
computeBoundSpring in class Cell
Returns:
The two-dimensional spring associated with this cell.

getComponent

public java.awt.Component getComponent()
Returns the component that this object wraps.

Overrides:
getComponent in class Cell
Returns:
The component enclosed within this cell.

setComponentGaps

public void setComponentGaps(int hgap,
                             int vgap)
Sets the size of the empty area around all enclosed components.

Overrides:
setComponentGaps in class Cell
Parameters:
hgap - the width of the vertical strips around the vertical edges.
vgap - the height of the horizontal strips around the horizontal edges.

getBaseline

public int getBaseline()
Returns the baseline of the component wrapped by this cell. The baseline is defined for components which display a single line of text, and it is the distance between the baseline of the text and the upper edge of the component.

Overrides:
getBaseline in class Cell
Returns:
The baseline for the component, if defined, and -1 if not.
See Also:
Cell.getBaseline(), Row.getBaseline(), Cell.getBaseline()

getComponentCell

public ComponentCell getComponentCell()
Overrides:
getComponentCell in class Cell

duplicate

public Cell duplicate(ComponentDuplicator creator)
Specified by:
duplicate in class Cell

xmlserialize

public void xmlserialize(XMLPrintStream out,
                         ComponentXMLSerializer xc)
Specified by:
xmlserialize in class Cell