+1 On Thu, Jun 4, 2009 at 10:45, Vincent Massol <[email protected]> wrote:
Hi,
Right now we have a Block.replace(List<Block> newBlocks) API but I'd like to add a new one:
Block.replace(Block newBlock);
Here's a use case, be able to write:
for (LinkBlock block : xdom.getChildrenByType(LinkBlock.class, true)) { Block newBlock = new FormatBlock(Collections.<Block>singletonList(block), Format.ITALIC); block.replace(newBlock); }
Rather than:
for (LinkBlock block : xdom.getChildrenByType(LinkBlock.class, true)) { Block newBlock = new FormatBlock(Collections.<Block>singletonList(block), Format.ITALIC); block.replace(Collections.<Block>singletonList(newBlock)); }
The rationale is that in most cases when we do a replace we do it with a single block since most of our blocks contain children blocks.
I'd like to add this in 2.0 and also in 1.9 (not breaking anything). The reason for 1.9 is that I'd like to use it in our Rendering documentation (actually that's how I discovered the pb).
Here's my +1
Thanks -Vincent
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne