* @return the created figure.
*/
public IFigure createFigure(IFigure figure) {
LayeredPane pane = new LayeredPane();
Layer layer = new Layer();
if (figureLayout == null) {
if (fillParent) {
figureLayout = new FillParentLayout();
} else {
figureLayout = new AlignedFlowLayout() {
@Override
protected void setBoundsOfChild(IFigure parent, IFigure child, Rectangle bounds) {
parent.getClientArea(Rectangle.SINGLETON);
bounds.translate(Rectangle.SINGLETON.x, Rectangle.SINGLETON.y);
if (resizeChildren)
child.setBounds(bounds);
else
child.setLocation(bounds.getLocation());
}
};
}
}
layer.setLayoutManager(figureLayout);
pane.add(layer);
layer.add(figure);
if (decorationLayer == null) {
decorationLayer = new Layer();
}
decorationLayer.setLayoutManager(decorationLayout);
pane.add(decorationLayer);