예제 #1
0
  @Override
  public synchronized void setFile(final Long fileID) {
    if (Objects.equals(fileID, this.fileID) == false) {
      this.fileID = fileID;
      disposeContent();

      if (this.fileID == null || Case.isCaseOpen() == false) {
        if (registered == true) {
          ImageGalleryController.getDefault().getCategoryManager().unregisterListener(this);
          TagUtils.unregisterListener(this);
          registered = false;
        }
        file = null;
        Platform.runLater(
            () -> {
              clearContent();
            });
      } else {
        if (registered == false) {
          ImageGalleryController.getDefault().getCategoryManager().registerListener(this);
          TagUtils.registerListener(this);
          registered = true;
        }
        file = null;
        getFile();
        updateSelectionState();
        updateCategoryBorder();
        updateFollowUpIcon();
        updateUI();
        Platform.runLater(getContentUpdateRunnable());
      }
    }
  }
예제 #2
0
  @SuppressWarnings("deprecation")
  protected void initialize() {
    followUpToggle.setOnAction(
        (ActionEvent t) -> {
          if (followUpToggle.isSelected() == true) {
            globalSelectionModel.clearAndSelect(fileID);
            try {
              AddDrawableTagAction.getInstance().addTag(TagUtils.getFollowUpTagName(), "");
            } catch (TskCoreException ex) {
              LOGGER.log(Level.SEVERE, "Failed to add follow up tag.  Could not load TagName.", ex);
            }
          } else {
            // TODO: convert this to an action!
            final ImageGalleryController controller = ImageGalleryController.getDefault();
            try {
              // remove file from old category group
              controller
                  .getGroupManager()
                  .removeFromGroup(
                      new GroupKey<TagName>(DrawableAttribute.TAGS, TagUtils.getFollowUpTagName()),
                      fileID);

              List<ContentTag> contentTagsByContent =
                  Case.getCurrentCase()
                      .getServices()
                      .getTagsManager()
                      .getContentTagsByContent(file);
              for (ContentTag ct : contentTagsByContent) {
                if (ct.getName()
                    .getDisplayName()
                    .equals(TagUtils.getFollowUpTagName().getDisplayName())) {
                  Case.getCurrentCase().getServices().getTagsManager().deleteContentTag(ct);
                }
              }
              IngestServices.getInstance()
                  .fireModuleDataEvent(
                      new ModuleDataEvent(
                          "TagAction", BlackboardArtifact.ARTIFACT_TYPE.TSK_TAG_FILE)); // NON-NLS
              controller
                  .getGroupManager()
                  .handleFileUpdate(
                      FileUpdateEvent.newUpdateEvent(
                          Collections.singleton(fileID), DrawableAttribute.TAGS));
            } catch (TskCoreException ex) {
              LOGGER.log(Level.SEVERE, "Failed to delete follow up tag.", ex);
            }
          }
        });
  }
예제 #3
0
 protected boolean hasFollowUp() throws TskCoreException {
   String followUpTagName = TagUtils.getFollowUpTagName().getDisplayName();
   Collection<TagName> tagNames = DrawableAttribute.TAGS.getValue(getFile());
   return tagNames.stream().anyMatch((tn) -> tn.getDisplayName().equals(followUpTagName));
 }