private static boolean checkSign(MapillaryImage img, JCheckBox signCheckBox, String singString) {
   boolean contains = false;
   for (String sign : img.getSigns()) {
     if (sign.contains(singString)) contains = true;
   }
   if (contains == signCheckBox.isSelected() && contains) return true;
   return false;
 }
 /** Updates the title of the dialog. */
 public synchronized void updateTitle() {
   if (!SwingUtilities.isEventDispatchThread()) {
     SwingUtilities.invokeLater(this::updateTitle);
   } else if (this.image != null) {
     StringBuilder title = new StringBuilder(tr(BASE_TITLE));
     if (this.image instanceof MapillaryImage) {
       MapillaryImage mapillaryImage = (MapillaryImage) this.image;
       if (mapillaryImage.getUser() != null) title.append(" — ").append(mapillaryImage.getUser());
       if (mapillaryImage.getCapturedAt() != 0)
         title.append(" — ").append(mapillaryImage.getDate());
       setTitle(title.toString());
     } else if (this.image instanceof MapillaryImportedImage) {
       MapillaryImportedImage mapillaryImportedImage = (MapillaryImportedImage) this.image;
       title.append(" — ").append(mapillaryImportedImage.getFile().getName());
       title.append(" — ").append(mapillaryImportedImage.getDate());
       setTitle(title.toString());
     }
   }
 }
  /**
   * Downloads the picture of the selected MapillaryImage and sets in the MapillaryImageDisplay
   * object.
   *
   * @param fullQuality If the full quality picture must be downloaded or just the thumbnail.
   */
  public synchronized void updateImage(boolean fullQuality) {
    if (!SwingUtilities.isEventDispatchThread()) {
      SwingUtilities.invokeLater(this::updateImage);
    } else {
      if (!MapillaryLayer.hasInstance()) {
        return;
      }
      if (this.image == null) {
        this.mapillaryImageDisplay.setImage(null);
        setTitle(tr(BASE_TITLE));
        disableAllButtons();
        return;
      }
      // Enables/disables next/previous buttons
      this.nextButton.setEnabled(false);
      this.previousButton.setEnabled(false);
      if (this.image.getSequence() != null) {
        MapillaryAbstractImage tempImage = this.image;
        while (tempImage.next() != null) {
          tempImage = tempImage.next();
          if (tempImage.isVisible()) {
            this.nextButton.setEnabled(true);
            break;
          }
        }
      }
      if (this.image.getSequence() != null) {
        MapillaryAbstractImage tempImage = this.image;
        while (tempImage.previous() != null) {
          tempImage = tempImage.previous();
          if (tempImage.isVisible()) {
            this.previousButton.setEnabled(true);
            break;
          }
        }
      }
      if (this.image instanceof MapillaryImage) {
        this.mapillaryImageDisplay.hyperlink.setVisible(true);
        MapillaryImage mapillaryImage = (MapillaryImage) this.image;
        this.mapillaryImageDisplay.hyperlink.setURL(mapillaryImage.getKey());
        // Downloads the thumbnail.
        this.mapillaryImageDisplay.setImage(null);
        if (this.thumbnailCache != null) this.thumbnailCache.cancelOutstandingTasks();
        this.thumbnailCache =
            new MapillaryCache(mapillaryImage.getKey(), MapillaryCache.Type.THUMBNAIL);
        try {
          this.thumbnailCache.submit(this, false);
        } catch (IOException e) {
          Main.error(e);
        }

        // Downloads the full resolution image.
        if (fullQuality
            || new MapillaryCache(mapillaryImage.getKey(), MapillaryCache.Type.FULL_IMAGE).get()
                != null) {
          if (this.imageCache != null) this.imageCache.cancelOutstandingTasks();
          this.imageCache =
              new MapillaryCache(mapillaryImage.getKey(), MapillaryCache.Type.FULL_IMAGE);
          try {
            this.imageCache.submit(this, false);
          } catch (IOException e) {
            Main.error(e);
          }
        }
      } else if (this.image instanceof MapillaryImportedImage) {
        this.mapillaryImageDisplay.hyperlink.setVisible(false);
        this.mapillaryImageDisplay.hyperlink.setURL(null);
        MapillaryImportedImage mapillaryImage = (MapillaryImportedImage) this.image;
        try {
          this.mapillaryImageDisplay.setImage(mapillaryImage.getImage());
        } catch (IOException e) {
          Main.error(e);
        }
      }
      updateTitle();
    }
  }