19 package org.sleuthkit.autopsy.communications.relationships;
 
   21 import java.util.logging.Level;
 
   22 import javax.swing.Action;
 
   23 import org.openide.nodes.AbstractNode;
 
   24 import org.openide.nodes.Children;
 
   25 import org.openide.nodes.Sheet;
 
   29 import static org.
sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE;
 
   31 import static org.
sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT;
 
   39 final class ThreadNode 
extends AbstractNode{
 
   41     private static final Logger logger = Logger.getLogger(ThreadNode.class.getName());
 
   43     private final static int MAX_SUBJECT_LENGTH = 120;
 
   45     final private MessageNode messageNode;
 
   47     ThreadNode(BlackboardArtifact artifact, String threadID, Action preferredAction) {
 
   49             messageNode = 
new MessageNode(artifact, threadID, preferredAction);
 
   50         this.setIconBaseWithExtension(
"org/sleuthkit/autopsy/communications/images/threaded.png" );
 
   54     protected Sheet createSheet() {
 
   55         BlackboardArtifact artifact = messageNode.getArtifact();
 
   56         if(artifact == null) {
 
   57            return messageNode.createSheet() ;
 
   60         Sheet sheet =  messageNode.createSheet();
 
   61         BlackboardArtifact.ARTIFACT_TYPE artifactTypeID = BlackboardArtifact.ARTIFACT_TYPE.fromID(artifact.getArtifactTypeID());
 
   65         if(artifactTypeID != null && artifactTypeID == TSK_MESSAGE) {
 
   67                 BlackboardAttribute attribute = artifact.getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.fromID(TSK_TEXT.getTypeID())));
 
   68                 if(attribute != null) {
 
   69                     Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
 
   70                     sheetSet.remove(
"Subject");
 
   72                     String msg = attribute.getDisplayString();
 
   73                     if(msg != null && msg.length() > MAX_SUBJECT_LENGTH) {
 
   74                         msg = msg.substring(0, MAX_SUBJECT_LENGTH) + 
"...";
 
   77                     sheetSet.put(
new NodeProperty<>(
"Subject", Bundle.MessageNode_Node_Property_Subject(), 
"", msg)); 
 
   79             } 
catch (TskCoreException ex) {
 
   80                 logger.log(Level.WARNING, String.format(
"Unable to get the text message from message artifact %d", artifact.getId()), ex);
 
   87     String getThreadID() {
 
   88         return messageNode.getThreadID();
 
   92     public Action getPreferredAction() {
 
   93         return messageNode.getPreferredAction();
 
   97     public String getDisplayName() {
 
   98         return messageNode.getDisplayName();