19 package org.sleuthkit.autopsy.contentviewers;
21 import java.awt.Component;
22 import org.openide.nodes.Node;
23 import org.openide.util.NbBundle;
24 import org.openide.util.NbBundle.Messages;
25 import org.openide.util.lookup.ServiceProvider;
31 import org.
sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
46 customizeComponents();
54 @SuppressWarnings(
"unchecked")
56 private
void initComponents() {
58 jPopupMenu1 =
new javax.swing.JPopupMenu();
59 jScrollPane2 =
new javax.swing.JScrollPane();
60 jTextPane1 =
new javax.swing.JTextPane();
62 jTextPane1.setEditable(
false);
63 jScrollPane2.setViewportView(jTextPane1);
65 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
66 this.setLayout(layout);
67 layout.setHorizontalGroup(
68 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
69 .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
71 layout.setVerticalGroup(
72 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
73 .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
97 jTextPane1.setText(
"<html><body>" + str +
"</body></html>");
101 sb.append(
"<table>");
105 sb.append(
"</table>");
108 private void addRow(StringBuilder sb, String key, String value) {
109 sb.append(
"<tr><td>");
111 sb.append(
"</td><td>");
113 sb.append(
"</td></tr>");
116 @Messages({
"Metadata.tableRowTitle.mimeType=MIME Type"})
119 AbstractFile file = node.getLookup().lookup(AbstractFile.class);
121 setText(NbBundle.getMessage(
this.getClass(),
"Metadata.nodeText.nonFilePassedIn"));
125 StringBuilder sb =
new StringBuilder();
129 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.name"), file.getUniquePath());
130 }
catch (TskCoreException ex) {
131 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.name"), file.getParentPath() +
"/" + file.getName());
134 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.type"), file.getType().getName());
135 addRow(sb, Bundle.Metadata_tableRowTitle_mimeType(), file.getMIMEType());
136 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.size"), Long.toString(file.getSize()));
137 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.fileNameAlloc"), file.getDirFlagAsString());
138 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.metadataAlloc"), file.getMetaFlagsAsString());
139 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.modified"),
ContentUtils.
getStringTime(file.getMtime(), file));
140 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.accessed"),
ContentUtils.
getStringTime(file.getAtime(), file));
141 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.created"),
ContentUtils.
getStringTime(file.getCrtime(), file));
142 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.changed"),
ContentUtils.
getStringTime(file.getCtime(), file));
145 String md5 = file.getMd5Hash();
147 md5 = NbBundle.getMessage(this.getClass(),
"Metadata.tableRowContent.md5notCalc");
149 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.md5"), md5);
150 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.hashLookupResults"), file.getKnown().toString());
152 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.internalid"), Long.toString(file.getId()));
153 if (file.getType().compareTo(TSK_DB_FILES_TYPE_ENUM.LOCAL) == 0) {
154 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.localPath"), file.getLocalAbsPath());
164 if (file instanceof FsContent) {
165 FsContent fsFile = (FsContent) file;
167 sb.append(
"<hr /><pre>\n");
168 sb.append(NbBundle.getMessage(
this.getClass(),
"Metadata.nodeText.text"));
169 sb.append(
" <br /><br />");
170 for (String str : fsFile.getMetaDataText()) {
171 sb.append(str).append(
"<br />");
173 sb.append(
"</pre>\n");
175 }
catch (TskCoreException ex) {
176 sb.append(NbBundle.getMessage(
this.getClass(),
"Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage());
179 setText(sb.toString());
180 jTextPane1.setCaretPosition(0);
181 this.setCursor(null);
186 return NbBundle.getMessage(this.getClass(),
"Metadata.title");
191 return NbBundle.getMessage(this.getClass(),
"Metadata.toolTip");
211 AbstractFile file = node.getLookup().lookup(AbstractFile.class);
void endTable(StringBuilder sb)
static String getStringTime(long epochSeconds, TimeZone tzone)
void addRow(StringBuilder sb, String key, String value)
javax.swing.JTextPane jTextPane1
javax.swing.JPopupMenu jPopupMenu1
void customizeComponents()
static void configureTextPaneAsHtml(JTextPane pane)
boolean isSupported(Node node)
DataContentViewer createInstance()
int isPreferred(Node node)
javax.swing.JScrollPane jScrollPane2
void startTable(StringBuilder sb)