org.xwiki.rendering.listener.WrappingListener类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.5k)|赞(0)|评价(0)|浏览(103)

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

WrappingListener介绍

[英]A Listener wrapping another Listener.
[中]

代码示例

代码示例来源:origin: org.xwiki.platform/xwiki-platform-wikistream-instance-oldcore

@Override
public void endWikiDocumentRevision(String version, FilterEventParameters parameters) throws WikiStreamException
{
  // Set content
  if (this.currentWikiPrinter != null) {
    this.document.setContent(this.currentWikiPrinter.getBuffer().toString());
    this.contentListener.setWrappedListener(null);
    this.currentWikiPrinter = null;
  }
}

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

@Override
public void beginDocument(MetaData metadata)
{
  Map<String, Object> metadataMap = new HashMap<String, Object>(metadata.getMetaData());
  metadataMap.remove(MetaData.SYNTAX);
  super.beginDocument(new MetaData(metadataMap));
}

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

@Override
  public void endDocument(MetaData metadata)
  {
    Map<String, Object> metadataMap = new HashMap<String, Object>(metadata.getMetaData());
    metadataMap.remove(MetaData.SYNTAX);

    super.endDocument(new MetaData(metadataMap));
  }
}

代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-syntax-doxia

@Override
public void beginTableRow(Map<String, String> parameters)
{
  super.beginTableRow(parameters);
  // Increase row count
  if (!this.unstacking) {
    int rowCount = this.rowCountStack.pop();
    rowCount++;
    this.rowCountStack.push(rowCount);
  }
}

代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-syntax-doxia

@Override
public void beginTable(Map<String, String> parameters)
{
  if (this.unstacking) {
    // We need to send a begin table rows event to the Doxia Sink since it requires such an Event before the
    // Row events.
    int rowCount = this.rowCountStack.peek();
    int[] justifications = new int[rowCount];
    for (int i = 0; i < rowCount; i++) {
      justifications[i] = Sink.JUSTIFY_CENTER;
    }
    super.beginTable(parameters);
    this.sink.tableRows(justifications, true);
  } else {
    // Start stacking Events since we need to count the number of table rows
    if (this.tableCount == 0) {
      pushListener(new QueueListener());
      this.rowCountStack.push(0);
    }
    this.tableCount++;
    super.beginTable(parameters);
  }
}

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

inlineFilterListener.setWrappedListener(listener);

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

/**
   * {@inheritDoc}
   * 
   * @see org.xwiki.rendering.listener.WrappingListener#endDocument(org.xwiki.rendering.listener.MetaData)
   */
  @Override
  public void endDocument(MetaData metaData)
  {
    Map<String, Object> metadataMap = new HashMap<String, Object>(metaData.getMetaData());
    metadataMap.remove(MetaData.SYNTAX);

    super.endDocument(new MetaData(metadataMap));
  }
}

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

/**
 * {@inheritDoc}
 * 
 * @see org.xwiki.rendering.listener.WrappingListener#beginDocument(org.xwiki.rendering.listener.MetaData)
 */
@Override
public void beginDocument(MetaData metaData)
{
  Map<String, Object> metadataMap = new HashMap<String, Object>(metaData.getMetaData());
  metadataMap.remove(MetaData.SYNTAX);
  super.beginDocument(new MetaData(metadataMap));
}

代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-syntax-wikimodel

/**
   * @since 6.0RC1
   * @since 5.4.5
   */
  public void parseInline(StreamParser parser, String content, Listener listener, boolean prefix)
    throws ParseException
  {
    if (prefix) {
      WrappingListener inlineFilterListener = new PrefixIgnoredInlineFilterListener();
      inlineFilterListener.setWrappedListener(listener);
      
      parser.parse(new StringReader("wikimarker " + content), inlineFilterListener);
    } else {
      WrappingListener inlineFilterListener = new InlineFilterListener();
      inlineFilterListener.setWrappedListener(listener);
      
      parser.parse(new StringReader(content), inlineFilterListener);
    }
  }
}

代码示例来源:origin: org.xwiki.rendering/xwiki-rendering-syntax-doxia

@Override
public void text(String text, SinkEventAttributes attributes)
{
  flushEmptyLines();
  if (this.isInVerbatim) {
    this.accumulatedText.append(text);
    return;
  }
  // TODO Handle parameters
  // Since Doxia doesn't generate events at the word level we need to reparse the
  // text to extract spaces, special symbols and words.
  // TODO: Use an inline parser. See https://jira.xwiki.org/browse/XWIKI-2748
  WrappingListener inlineFilterListener = new InlineFilterListener();
  inlineFilterListener.setWrappedListener(getListener());
  // Parse the text using the plain text parser
  try {
    this.plainParser.parse(new StringReader(text), inlineFilterListener);
  } catch (ParseException e) {
    // Shouldn't happen since we use a StringReader which shouldn't generate any IO.
    throw new RuntimeException("Failed to parse raw text [" + text + "]", e);
  }
}

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

inlineFilterListener.setWrappedListener(getListenerChain().getNextListener(getClass()));

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

private void runTestInternal() throws Throwable
{
  WikiPrinter printer = new DefaultWikiPrinter();
  if (!this.streaming) {
    Parser parser = getComponentManager().lookup(Parser.class, this.parserId);
    XDOM xdom = parser.parse(new StringReader(this.input));
    if (this.runTransformations) {
      SyntaxFactory syntaxFactory = getComponentManager().lookup(SyntaxFactory.class);
      TransformationManager transformationManager = getComponentManager().lookup(TransformationManager.class);
      TransformationContext txContext =
        new TransformationContext(xdom, syntaxFactory.createSyntaxFromIdString(this.parserId));
      transformationManager.performTransformations(xdom, txContext);
    }
    BlockRenderer renderer = getComponentManager().lookup(BlockRenderer.class, this.targetSyntaxId);
    // remove source syntax from XDOM metadata
    Map<String, Object> metadataMap = new HashMap<String, Object>(xdom.getMetaData().getMetaData());
    metadataMap.remove(MetaData.SYNTAX);
    xdom = new XDOM(xdom.getChildren(), new MetaData(metadataMap));
    renderer.render(xdom, printer);
  } else {
    StreamParser parser = getComponentManager().lookup(StreamParser.class, this.parserId);
    PrintRendererFactory printRendererFactory =
      getComponentManager().lookup(PrintRendererFactory.class, this.targetSyntaxId);
    // remove source syntax from begin/endDocument metadata
    WrappingListener listener = new SyntaxWrappingListener();
    listener.setWrappedListener(printRendererFactory.createRenderer(printer));
    parser.parse(new StringReader(this.input), listener);
  }
  assertEquals(this.expected, printer.toString());
}

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

listener.setWrappedListener(streamRendererFactory.createRenderer(printer));

代码示例来源:origin: org.xwiki.platform/xwiki-platform-wikistream-instance-oldcore

this.contentListener.setWrappedListener(rendererFactory.createRenderer(this.currentWikiPrinter));

相关文章