@Override public Viewable createSpecificationItem(final LinkedSpecificationItem item) { return new HtmlSpecificationItem(this.outputStream, item); }
@Override public void render(final int level) { final String indentation = IndentationHelper.createIndentationPrefix(level); final SpecificationItemId id = this.item.getId(); renderStart(indentation, id); renderSummary(indentation, id); renderId(indentation, id); renderDescription(indentation); renderRationale(indentation); renderComment(indentation); renderNeeds(indentation); renderOrigin(indentation); renderLinks(indentation); renderEnd(indentation); }
private void renderLinks(final String indentation) { renderLinkForDirection(indentation, true); renderLinkForDirection(indentation, false); }
protected void renderLinkForDirection(final String indentation, final boolean in) { final int total = in ? this.item.countIncomingLinks() : this.item.countOutgoingLinks(); if (total > 0) { this.stream.print(indentation); this.stream.print(" <div class=\""); this.stream.print(in ? "in" : "out"); this.stream.println("\">"); this.stream.print(indentation); this.stream.print(" <h6>"); this.stream.print(in ? "In" : "Out"); this.stream.print(": "); this.stream.print(total); this.stream.println("</h6>"); this.stream.print(indentation); this.stream.println(" <ul>"); final Stream<TracedLink> links = this.item.getTracedLinks().stream() .filter(in ? TracedLink::isIncoming : TracedLink::isOutgoing); final List<TracedLink> sortedLinks = sortLinkStreamById(links); renderLinkEntry(sortedLinks, indentation); this.stream.print(indentation); this.stream.println(" </ul>"); this.stream.print(indentation); this.stream.println(" </div>"); } }
protected void renderDescription(final String indentation) { final String description = this.item.getDescription(); if (description != null && !description.isEmpty()) { renderMultilineText(indentation, description); } }
protected void renderLinkEntry(final List<TracedLink> outLinks, final String indentation) { for (final TracedLink link : outLinks) { final SpecificationItemId otherId = link.getOtherLinkEnd().getId(); this.stream.print(indentation); this.stream.print(" <li><a href=\"#"); this.stream.print(otherId); this.stream.print("\">"); this.stream.print(otherId); this.stream.print("</a>"); if (link.getStatus() != LinkStatus.COVERS && link.getStatus() != LinkStatus.COVERED_SHALLOW) { this.stream.print(" <em>(" + link.getStatus() + ")</em>"); } renderLinkOrigin(link); this.stream.println("</li>"); } }
protected void renderLinkForDirection(final String indentation, final boolean in) { final int total = in ? this.item.countIncomingLinks() : this.item.countOutgoingLinks(); if (total > 0) { this.stream.print(indentation); this.stream.print(" <div class=\""); this.stream.print(in ? "in" : "out"); this.stream.println("\">"); this.stream.print(indentation); this.stream.print(" <h6>"); this.stream.print(in ? "In" : "Out"); this.stream.print(": "); this.stream.print(total); this.stream.println("</h6>"); this.stream.print(indentation); this.stream.println(" <ul>"); final Stream<TracedLink> links = this.item.getTracedLinks().stream() .filter(in ? TracedLink::isIncoming : TracedLink::isOutgoing); final List<TracedLink> sortedLinks = sortLinkStreamById(links); renderLinkEntry(sortedLinks, indentation); this.stream.print(indentation); this.stream.println(" </ul>"); this.stream.print(indentation); this.stream.println(" </div>"); } }
protected void renderDescription(final String indentation) { final String description = this.item.getDescription(); if (description != null && !description.isEmpty()) { renderMultilineText(indentation, description); } }
protected void renderLinkEntry(final List<TracedLink> outLinks, final String indentation) { for (final TracedLink link : outLinks) { final SpecificationItemId otherId = link.getOtherLinkEnd().getId(); this.stream.print(indentation); this.stream.print(" <li><a href=\"#"); this.stream.print(otherId); this.stream.print("\">"); this.stream.print(otherId); this.stream.print("</a>"); if (link.getStatus() != LinkStatus.COVERS && link.getStatus() != LinkStatus.COVERED_SHALLOW) { this.stream.print(" <em>(" + link.getStatus() + ")</em>"); } renderLinkOrigin(link); this.stream.println("</li>"); } }
@Override public void render(final int level) { final String indentation = IndentationHelper.createIndentationPrefix(level); final SpecificationItemId id = this.item.getId(); renderStart(indentation, id); renderSummary(indentation, id); renderId(indentation, id); renderDescription(indentation); renderRationale(indentation); renderComment(indentation); renderNeeds(indentation); renderOrigin(indentation); renderLinks(indentation); renderEnd(indentation); }
private void renderRationale(final String indentation) { final String rationale = this.item.getItem().getRationale(); if (rationale != null && !rationale.isEmpty()) { this.stream.print(indentation); this.stream.println(" <h6>Rationale:</h6>"); renderMultilineText(indentation, rationale); } }
private void renderLinks(final String indentation) { renderLinkForDirection(indentation, true); renderLinkForDirection(indentation, false); }
@Override public Viewable createSpecificationItem(final LinkedSpecificationItem item) { return new HtmlSpecificationItem(this.outputStream, item); }
private void renderComment(final String indentation) { final String comment = this.item.getItem().getComment(); if (comment != null && !comment.isEmpty()) { this.stream.print(indentation); this.stream.println(" <h6>Comment:</h6>"); renderMultilineText(indentation, comment); } }
private void renderComment(final String indentation) { final String comment = this.item.getItem().getComment(); if (comment != null && !comment.isEmpty()) { this.stream.print(indentation); this.stream.println(" <h6>Comment:</h6>"); renderMultilineText(indentation, comment); } }
private void renderRationale(final String indentation) { final String rationale = this.item.getItem().getRationale(); if (rationale != null && !rationale.isEmpty()) { this.stream.print(indentation); this.stream.println(" <h6>Rationale:</h6>"); renderMultilineText(indentation, rationale); } }