/*
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
 */
package org.xwiki.rendering.block;

import org.xwiki.rendering.listener.Listener;

import java.util.Arrays;
import java.util.List;

/**
 * @version $Id$
 * @since 1.5M2
 */
public abstract class AbstractFatherBlock extends AbstractBlock
{
    public AbstractFatherBlock(List<Block> childrenBlocks)
    {
        addChildren(childrenBlocks);
    }
    
    public AbstractFatherBlock(Block childBlock)
    {
        this(Arrays.asList(new Block[] {childBlock}));
    }

    public abstract void before(Listener listener);

    public abstract void after(Listener listener);

    public void traverse(Listener listener)
    {
        before(listener);

        for (Block block: getChildren()) {
            block.traverse(listener);
        }

        after(listener);
    }
}

@@ -1030,107 +1030,380 @@
 %0A * 
-@version $Id$%0A * @since 1.5M2%0A */%0Apublic abstract class AbstractFatherBlock extends AbstractBlock%0A%7B
+A type of %7B@link Block%7D that has children. For example the Paragraph Block, the Bold Block, the List Block, etc.%0A *%0A * @version $Id$%0A * @since 1.5M2%0A */%0Apublic abstract class AbstractFatherBlock extends AbstractBlock%0A%7B%0A    /**%0A     * Constructs a block with children blocks.%0A     *%0A     * @param childrenBlocks the list of children blocks of the block to construct%0A     */
 %0A   
@@ -1511,234 +1511,1278 @@
   %7D%0A
+%0A
     
-%0A    public AbstractFatherBlock(Block childBlock)%0A    %7B%0A        this(Arrays.asList(new Block%5B%5D %7BchildBlock%7D));%0A    %7D%0A%0A    public abstract void before(Listener listener);%0A%0A    public abstract void after(Listener listener);%0A
+/**%0A     * Helper constructor to construct a block with a single child block.%0A     *%0A     * @param childBlock the single child block to add %0A     */%0A    public AbstractFatherBlock(Block childBlock)%0A    %7B%0A        this(Arrays.asList(childBlock));%0A    %7D%0A%0A    /**%0A     * Send %7B@link Listener%7D events corresponding to the start of the father block. For example for a Bold block, this%0A     * allows an XHTML Listener (aka a Renderer) to output %3Ccode%3E&lt;b&gt;%3C/code%3E.%0A     *%0A     * @param listener the listener that will receive the events sent by the father block before the children blocks%0A     *        have emitted their own events.%0A     */%0A    public abstract void before(Listener listener);%0A%0A    /**%0A     * Send %7B@link Listener%7D events corresponding to the end of the father block. For example for a Bold block, this%0A     * allows an XHTML Listener (aka a Renderer) to output %3Ccode%3E&lt;/b&gt;%3C/code%3E.%0A     *%0A     * @param listener the listener that will receive the events sent by the father block after the children blocks%0A     *        have emitted their own events.%0A     */%0A    public abstract void after(Listener listener);%0A%0A    /**%0A     * %7B@inheritDoc%7D%0A     * @see org.xwiki.rendering.block.AbstractBlock#traverse(org.xwiki.rendering.listener.Listener)%0A     */
 %0A   

Rewrite the Rendering engine