@Override public List<Block> decorateGadget(Gadget gadget) { List<Block> viewBlock = super.decorateGadget(gadget); if (viewBlock.size() > 0) { viewBlock.get(0).addChild(getGadgetEditMetadata(gadget)); } return viewBlock; } }
block.addChild(childBlock.clone());
result.setParameter(CLASS_ATTRIBUTE_NAME, "footnoteBackRef"); result = new ListItemBlock(Collections.singletonList(result)); result.addChild(new SpaceBlock()); result.addChildren(parsedContent); return (ListItemBlock) result;
/** * Create a new ListBlock and add it in the provided parent block. * * @param numbered indicate if the list has to be numbered or with bullets * @param parentBlock the block where to add the new list block. * @return the new list block. */ private ListBLock createChildListBlock(boolean numbered, Block parentBlock) { ListBLock childListBlock = numbered ? new NumberedListBlock(Collections.emptyList()) : new BulletedListBlock(Collections.emptyList()); if (parentBlock != null) { parentBlock.addChild(childListBlock); } return childListBlock; } }
@Override public Block render(Locale locale, Collection<TranslationBundle> bundles, Object... parameters) { Block block = new CompositeBlock(); for (TranslationMessageElement element : this.elements) { block.addChild(element.render(locale, bundles, parameters)); } return null; }
@Override public List<Block> execute(FootnoteMacroParameters parameters, String content, MacroTransformationContext context) throws MacroExecutionException { Block root = context.getXDOM(); Block matchingBlock = root.getFirstBlock(MACRO_BLOCK_MATCHER, Block.Axes.DESCENDANT); if (matchingBlock != null) { return Collections.emptyList(); } Block putFootnotesMacro = new MacroBlock(PutFootnotesMacro.MACRO_NAME, Collections.<String, String>emptyMap(), false); root.addChild(putFootnotesMacro); return Collections.emptyList(); } }
/** * Add a {@link ListItemBlock} in the current toc tree block and return the new {@link ListItemBlock}. * * @param currentBlock the current block in the toc tree. * @param headerBlock the {@link HeaderBlock} to use to generate toc anchor label. * @return the new {@link ListItemBlock}. */ private Block addItemBlock(Block currentBlock, HeaderBlock headerBlock, String documentReference) { ListItemBlock itemBlock = headerBlock == null ? createEmptyTocEntry() : createTocEntry(headerBlock, documentReference); currentBlock.addChild(itemBlock); return itemBlock; }
String newClass = "container-columns container-columns-" + count; container.setParameter(CLASS_ATTRIBUTE, StringUtils.isEmpty(oldClass) ? newClass : oldClass + " " + newClass); container.addChild(new GroupBlock(clearFloatsParams));