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

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

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

Block.getParent介绍

[英]Get the parent block. All blocks have a parent and the top level parent is the XDOM object.
[中]获取父块。所有块都有一个父对象,顶级父对象是XDOM对象。

代码示例

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

/**
 * {@inheritDoc}
 *
 * @see org.xwiki.rendering.block.Block#getRoot()
 */
public Block getRoot()
{
  Block block = this;
  while (block.getParent() != null) {
    block = block.getParent();
  }
  return block;
}

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

/**
 * Protect form recursive inclusion.
 * 
 * @param currrentBlock the child block to check
 * @param reference the reference of the document being included
 * @throws MacroExecutionException recursive inclusion has been found
 */
private void checkRecursiveInclusion(Block currrentBlock, EntityReference reference) throws MacroExecutionException
{
  // Check for parent context=new macros
  Stack<Object> references = this.inclusionsBeingExecuted.get();
  if (references != null && references.contains(reference)) {
    throw new MacroExecutionException("Found recursive inclusion of document [" + reference + "]");
  }
  // Check for parent context=current macros
  Block parentBlock = currrentBlock.getParent();
  if (parentBlock != null) {
    if (parentBlock instanceof MacroMarkerBlock) {
      MacroMarkerBlock parentMacro = (MacroMarkerBlock) parentBlock;
      if (isRecursive(parentMacro, reference)) {
        throw new MacroExecutionException("Found recursive inclusion of document [" + reference + "]");
      }
    }
    checkRecursiveInclusion(parentBlock, reference);
  }
}

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

currentBlock = currentBlock.getParent().getParent();
  --currentLevel;
currentBlock = currentBlock.getParent();

代码示例来源:origin: com.xpn.xwiki.platform/xwiki-core

section.getParent().replaceChild(blocks, section);

代码示例来源:origin: org.wikbook/wikbook.xwiki

substitution.src.getParent().replaceChild(substitution.dst, substitution.src);

代码示例来源:origin: org.xwiki.platform/xwiki-platform-rendering-wikimacro-store

wikiMacroBlock.setParent(syncMetaDataBlock.getParent());
wikiMacroBlock.setNextSiblingBlock(syncMetaDataBlock.getNextSibling());
wikiMacroBlock.setPreviousSiblingBlock(syncMetaDataBlock.getPreviousSibling());
if (syncMetaDataBlock != null) {
  syncMetaDataBlock.getParent().replaceChild(this.syncContext.getCurrentMacroBlock(),
    syncMetaDataBlock);

相关文章