コード例 #1
0
 private boolean isValidDrawTarget(RenderNode node) {
   while (node != null) {
     if (ids.contains(node.getInstanceId())) {
       return true;
     }
     node = node.getParent();
   }
   return false;
 }
コード例 #2
0
  protected void drawComplexText(final RenderableComplexText renderableComplexText) {
    try {

      if (renderableComplexText.getRichText().isEmpty()) {
        // This text is empty.
        return;
      }
      if (renderableComplexText.isNodeVisible(getParagraphBounds(), isOverflowX(), isOverflowY())
          == false) {
        return;
      }

      // iterate through all inline elements
      for (final RichTextSpec.StyledChunk styledChunk :
          renderableComplexText.getRichText().getStyleChunks()) {
        RenderNode node = styledChunk.getOriginatingTextNode();
        InstanceID dummy = node.getInstanceId();
        textExtractorHelper.startInlineBox(
            dummy,
            styledChunk.getOriginalAttributes(),
            styledChunk.getStyleSheet(),
            BoxDefinition.EMPTY);
        if (node instanceof RenderableReplacedContentBox) {
          processRenderableContent((RenderableReplacedContentBox) node);
          result = true;
        } else {
          String text = styledChunk.getText();
          xmlWriter.writeText(characterEntityParser.encodeEntities(text));
          if (text.trim().length() > 0) {
            result = true;
          }
        }
        textExtractorHelper.finishBox(dummy, styledChunk.getOriginalAttributes());
        clearText();
      }
    } catch (final IOException ioe) {
      throw new InvalidReportStateException("Failed to write text", ioe);
    }
  }