/**
  * Gets the IconBox for the specified image IRI.
  *
  * @param iri The IRI pointing to the image.
  * @return The icon box containing the image.
  * @throws MalformedURLException
  */
 private IconBox getImageBox(IRI iri) throws MalformedURLException {
   ImageIcon imageIcon = new ImageIcon(iri.toURI().toURL());
   imageIcon.getImageLoadStatus();
   IconBox iconBox = new IconBox(imageIcon, new HTTPLink(iri.toURI()));
   iconBox.setMaxHeight(50);
   return iconBox;
 }
 /**
  * Renders an IRI as a full IRI rather than as an IRI that represents an entity in the signature
  * of the imports closure of the active ontology.
  *
  * @param page The page that the IRI should be rendered into.
  * @param iri The IRI to be rendered.
  * @return A list of paragraphs that represent the rendering of the annotation value.
  */
 private List<Paragraph> renderExternalIRI(Page page, IRI iri) {
   Paragraph paragraph;
   if (isLinkableAddress(iri)) {
     paragraph = page.addParagraph(iri.toString(), new HTTPLink(iri.toURI()));
   } else {
     paragraph = page.addParagraph(iri.toString());
   }
   return Arrays.asList(paragraph);
 }
  /**
   * Renders an IRI as a full IRI rather than as an IRI that represents an entity in the signature
   * of the imports closure of the active ontology.
   *
   * @param page The page that the IRI should be rendered into.
   * @param iri The IRI to be rendered.
   * @return A list of paragraphs that represent the rendering of the annotation value.
   */
  private List<Paragraph> renderExternalIRI(Page page, IRI iri) {
    List<Paragraph> paragraphs = new ArrayList<>();
    String iriString = iri.toString();
    if (isLinkableAddress(iri)) {
      if (isImageAddress(iri) && isDisplayThumbnails()) {
        try {
          IconBox iconBox = getImageBox(iri);
          page.add(iconBox);

        } catch (MalformedURLException e) {
          paragraphs.add(page.addParagraph(iriString, new HTTPLink(iri.toURI())));
        }
      } else {
        paragraphs.add(page.addParagraph(iriString, new HTTPLink(iri.toURI())));
      }
    } else {
      paragraphs.add(page.addParagraph(iriString));
    }
    return paragraphs;
  }
 private boolean isImageAddress(IRI iri) {
   String iriString = iri.toString();
   return iriString.endsWith(".png") || iriString.endsWith(".jpg") || iriString.endsWith(".jpeg");
 }
 /**
  * Determines whether an IRI that represents an annotation value can be opened in a web browser.
  * i.e. wherther or not the IRI represents a web link.
  *
  * @param iri The iri to be tested.
  * @return <code>true</code> if the IRI represents a web link, other wise <code>false</code>.
  */
 private boolean isLinkableAddress(IRI iri) {
   String scheme = iri.getScheme();
   return scheme != null && scheme.startsWith("http");
 }