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.lookup.ServiceProvider;
30 import org.
sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
45 customizeComponents();
53 @SuppressWarnings(
"unchecked")
55 private
void initComponents() {
57 jPopupMenu1 =
new javax.swing.JPopupMenu();
58 jScrollPane2 =
new javax.swing.JScrollPane();
59 jTextPane1 =
new javax.swing.JTextPane();
61 jTextPane1.setEditable(
false);
62 jScrollPane2.setViewportView(jTextPane1);
64 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
65 this.setLayout(layout);
66 layout.setHorizontalGroup(
67 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
68 .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
70 layout.setVerticalGroup(
71 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
72 .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE)
96 jTextPane1.setText(
"<html><body>" + str +
"</body></html>");
100 sb.append(
"<table>");
104 sb.append(
"</table>");
107 private void addRow(StringBuilder sb, String key, String value) {
108 sb.append(
"<tr><td>");
110 sb.append(
"</td><td>");
112 sb.append(
"</td></tr>");
117 AbstractFile file = node.getLookup().lookup(AbstractFile.class);
119 setText(NbBundle.getMessage(
this.getClass(),
"Metadata.nodeText.nonFilePassedIn"));
123 StringBuilder sb =
new StringBuilder();
127 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.name"), file.getUniquePath());
128 }
catch (TskCoreException ex) {
129 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.name"), file.getParentPath() +
"/" + file.getName());
132 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.type"), file.getType().getName());
133 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.size"),
new Long(file.getSize()).toString());
134 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.fileNameAlloc"), file.getDirFlagAsString());
135 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.metadataAlloc"), file.getMetaFlagsAsString());
136 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.modified"),
ContentUtils.
getStringTime(file.getMtime(), file));
137 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.accessed"),
ContentUtils.
getStringTime(file.getAtime(), file));
138 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.created"),
ContentUtils.
getStringTime(file.getCrtime(), file));
139 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.changed"),
ContentUtils.
getStringTime(file.getCtime(), file));
141 String md5 = file.getMd5Hash();
143 md5 = NbBundle.getMessage(this.getClass(),
"Metadata.tableRowContent.md5notCalc");
145 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.md5"), md5);
146 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.hashLookupResults"), file.getKnown().toString());
148 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.internalid"),
new Long(file.getId()).toString());
149 if (file.getType().compareTo(TSK_DB_FILES_TYPE_ENUM.LOCAL) == 0) {
150 addRow(sb, NbBundle.getMessage(
this.getClass(),
"Metadata.tableRowTitle.localPath"), file.getLocalAbsPath());
160 if (file instanceof FsContent) {
161 FsContent fsFile = (FsContent) file;
163 sb.append(
"<hr /><pre>\n");
164 sb.append(NbBundle.getMessage(
this.getClass(),
"Metadata.nodeText.text"));
165 sb.append(
" <br /><br />");
166 for (String str : fsFile.getMetaDataText()) {
167 sb.append(str).append(
"<br />");
169 sb.append(
"</pre>\n");
171 }
catch (TskCoreException ex) {
172 sb.append(NbBundle.getMessage(
this.getClass(),
"Metadata.nodeText.exceptionNotice.text")).append(ex.getLocalizedMessage());
175 setText(sb.toString());
176 jTextPane1.setCaretPosition(0);
177 this.setCursor(null);
182 return NbBundle.getMessage(this.getClass(),
"Metadata.title");
187 return NbBundle.getMessage(this.getClass(),
"Metadata.toolTip");
207 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)