*/
protected class TitleLayout extends AbstractLayout {
private static final int SPACING = 2;
public void layout(IFigure container) {
List elements = container.getChildren();
ImageFigure icon = (ImageFigure)elements.get(0);
Label text = (Label)elements.get(1);
Figure removeButton = (Figure)elements.get(2);
Figure addButton = (Figure)elements.get(3);
Rectangle containerBounds = container.getBounds();
int x = containerBounds.x + SPACING;
int y = containerBounds.y;
int height = containerBounds.height;
Dimension size = icon.getPreferredSize();
Rectangle bounds = new Rectangle(x, y, size.width, height);
icon.setBounds(bounds);
size = removeButton.getPreferredSize();
x = (containerBounds.x + containerBounds.width) - size.width;
bounds = new Rectangle(x, y, size.width, height);
removeButton.setBounds(bounds);
size = addButton.getPreferredSize();
x = x - size.width;
bounds = new Rectangle(x, y, size.width, height);
addButton.setBounds(bounds);
x = icon.getBounds().x + icon.getBounds().width;
x = x + SPACING;
int width = containerBounds.width - (icon.getBounds().width + removeButton.getBounds().width + addButton.getBounds().width);
bounds = new Rectangle(x, y, width, height);
text.setBounds(bounds);
}