org.xwiki.rendering.block.Block.addChild()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(3.5k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中org.xwiki.rendering.block.Block.addChild()方法的一些代码示例,展示了Block.addChild()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.addChild()方法的具体详情如下:
包路径:org.xwiki.rendering.block.Block
类名称:Block
方法名:addChild

Block.addChild介绍

[英]Helper method to add a single child block to the end of the children list of the current block. For adding several blocks at once use #addChildren(java.util.List).
[中]方法将单个子块添加到当前块的子列表的末尾。要同时添加几个块,请使用#addChildren(java.util.List)。

代码示例

代码示例来源:origin: org.xwiki.platform/xwiki-platform-dashboard-macro

@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;
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-core-rendering-api

block.addChild(childBlock.clone());

代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-macro-footnotes

result.setParameter(CLASS_ATTRIBUTE_NAME, "footnoteBackRef");
result = new ListItemBlock(Collections.singletonList(result));
result.addChild(new SpaceBlock());
result.addChildren(parsedContent);
return (ListItemBlock) result;

代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-macro-toc

/**
   * 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;
  }
}

代码示例来源:origin: org.xwiki.platform/xwiki-core-rendering-macro-box

boxBlock.addChild(imageBlock);
boxBlock.addChild(new NewLineBlock());

代码示例来源:origin: org.xwiki.platform/xwiki-platform-localization-api

@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;
}

代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-macro-footnotes

@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();
  }
}

代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-macro-toc

/**
 * 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;
}

代码示例来源:origin: org.xwiki.platform/xwiki-platform-rendering-macro-container

String newClass = "container-columns container-columns-" + count;
container.setParameter(CLASS_ATTRIBUTE, StringUtils.isEmpty(oldClass) ? newClass : oldClass + " " + newClass);
container.addChild(new GroupBlock(clearFloatsParams));

相关文章