19 package org.sleuthkit.autopsy.directorytree;
21 import org.openide.util.NbBundle;
23 import java.awt.Toolkit;
24 import java.awt.Dimension;
26 import java.awt.event.ActionEvent;
27 import java.awt.event.ActionListener;
28 import java.util.ArrayList;
29 import java.util.Arrays;
30 import java.util.Collections;
31 import java.util.List;
32 import java.util.logging.Level;
33 import javax.swing.AbstractAction;
34 import javax.swing.Action;
35 import javax.swing.JDialog;
36 import javax.swing.JFrame;
37 import javax.swing.JLabel;
38 import javax.swing.JTable;
39 import javax.swing.table.DefaultTableModel;
57 List<Action> actions =
new ArrayList<>();
59 actions.addAll(c.accept(instance));
78 public List<? extends Action>
visit(
final Image img) {
79 List<Action> lst =
new ArrayList<>();
81 NbBundle.getMessage(
this.getClass(),
"ExplorerNodeActionVisitor.action.imgDetails.title"), img));
83 lst.add(
new ExtractUnallocAction(
84 NbBundle.getMessage(
this.getClass(),
"ExplorerNodeActionVisitor.action.extUnallocToSingleFiles"), img));
89 public List<? extends Action>
visit(
final FileSystem fs) {
91 NbBundle.getMessage(
this.getClass(),
"ExplorerNodeActionVisitor.action.fileSystemDetails.title"), fs));
95 public List<? extends Action>
visit(
final Volume vol) {
96 List<AbstractAction> lst =
new ArrayList<>();
98 NbBundle.getMessage(
this.getClass(),
"ExplorerNodeActionVisitor.action.volumeDetails.title"), vol));
99 lst.add(
new ExtractUnallocAction(
100 NbBundle.getMessage(
this.getClass(),
"ExplorerNodeActionVisitor.action.extUnallocToSingleFile"), vol));
105 public List<? extends Action>
visit(
final Directory d) {
106 List<Action> actions =
new ArrayList<>();
113 public List<? extends Action>
visit(
final VirtualDirectory d) {
114 List<Action> actions =
new ArrayList<>();
121 public List<? extends Action>
visit(
final DerivedFile d) {
122 List<Action> actions =
new ArrayList<>();
130 public List<? extends Action>
visit(
final LocalFile d) {
131 List<Action> actions =
new ArrayList<>();
140 List<Action> actions =
new ArrayList<>();
149 return Collections.<Action>emptyList();
169 final JFrame frame =
new JFrame(title);
170 final JDialog popUpWindow =
new JDialog(frame, title,
true);
172 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
175 popUpWindow.setSize(800, 400);
177 int w = popUpWindow.getSize().width;
178 int h = popUpWindow.getSize().height;
181 popUpWindow.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
183 VolumeDetailsPanel volumeDetailPanel =
new VolumeDetailsPanel();
184 Boolean counter =
false;
186 volumeDetailPanel.setVolumeIDValue(Long.toString(vol.getAddr()));
187 volumeDetailPanel.setStartValue(Long.toString(vol.getStart()));
188 volumeDetailPanel.setLengthValue(Long.toString(vol.getLength()));
189 volumeDetailPanel.setDescValue(vol.getDescription());
190 volumeDetailPanel.setFlagsValue(vol.getFlagsAsString());
195 popUpWindow.add(volumeDetailPanel);
198 JLabel error =
new JLabel(
199 NbBundle.getMessage(
this.getClass(),
"ExplorerNodeActionVisitor.volDetail.noVolMatchErr"));
200 error.setFont(error.getFont().deriveFont(Font.BOLD, 24));
201 popUpWindow.add(error);
205 volumeDetailPanel.setOKButtonActionListener(
new ActionListener() {
208 popUpWindow.dispose();
212 popUpWindow.setResizable(
false);
213 popUpWindow.setVisible(
true);
234 final JFrame frame =
new JFrame(title);
235 final JDialog popUpWindow =
new JDialog(frame, title,
true);
238 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
241 popUpWindow.setSize(750, 400);
243 int w = popUpWindow.getSize().width;
244 int h = popUpWindow.getSize().height;
247 popUpWindow.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
249 ImageDetailsPanel imgDetailPanel =
new ImageDetailsPanel();
250 Boolean counter =
false;
252 imgDetailPanel.setImgNameValue(img.getName());
253 imgDetailPanel.setImgTypeValue(img.getType().getName());
254 imgDetailPanel.setImgSectorSizeValue(Long.toString(img.getSsize()));
255 imgDetailPanel.setImgTotalSizeValue(Long.toString(img.getSize()));
256 String hash = img.getMd5();
258 imgDetailPanel.setVisibleHashInfo(hash != null);
259 imgDetailPanel.setImgHashValue(hash);
265 popUpWindow.add(imgDetailPanel);
268 JLabel error =
new JLabel(
269 NbBundle.getMessage(
this.getClass(),
"ExplorerNodeActionVisitor.imgDetail.noVolMatchesErr"));
270 error.setFont(error.getFont().deriveFont(Font.BOLD, 24));
271 popUpWindow.add(error);
275 imgDetailPanel.setOKButtonActionListener(
new ActionListener() {
278 popUpWindow.dispose();
283 popUpWindow.setResizable(
false);
284 popUpWindow.setVisible(
true);
293 private final FileSystem
fs;
304 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
306 final JFrame frame =
new JFrame(title);
307 final JDialog popUpWindow =
new JDialog(frame, title,
true);
310 popUpWindow.setSize(1000, 500);
312 int w = popUpWindow.getSize().width;
313 int h = popUpWindow.getSize().height;
316 popUpWindow.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
318 String[] columnNames =
new String[]{
330 Object[][] rowValues =
new Object[1][9];
332 Content parent = null;
334 parent = fs.getParent();
335 }
catch (Exception ex) {
336 throw new RuntimeException(
337 NbBundle.getMessage(
this.getClass(),
"ExplorerNodeActionVisitor.exception.probGetParent.text",
338 FileSystem.class.getName(),
fs), ex);
341 if (parent != null) {
345 Arrays.fill(rowValues, 0, 1,
new Object[]{
357 JTable table =
new JTable(
new DefaultTableModel(rowValues, columnNames));
359 FileSystemDetailsPanel fsdPanel =
new FileSystemDetailsPanel();
362 fsdPanel.setOKButtonActionListener(
new ActionListener() {
365 popUpWindow.dispose();
370 fsdPanel.setFileSystemTypeValue(table.getValueAt(0, 3).toString());
371 fsdPanel.setImageOffsetValue(table.getValueAt(0, 1).toString());
372 fsdPanel.setVolumeIDValue(table.getValueAt(0, 2).toString());
373 fsdPanel.setBlockSizeValue(table.getValueAt(0, 4).toString());
374 fsdPanel.setBlockCountValue(table.getValueAt(0, 5).toString());
375 fsdPanel.setRootInumValue(table.getValueAt(0, 6).toString());
376 fsdPanel.setFirstInumValue(table.getValueAt(0, 7).toString());
377 fsdPanel.setLastInumValue(table.getValueAt(0, 8).toString());
379 popUpWindow.add(fsdPanel);
380 }
catch (Exception ex) {
385 popUpWindow.setResizable(
false);
386 popUpWindow.setVisible(
true);
List<?extends Action > visit(final LocalFile d)
List<?extends Action > visit(final FileSystem fs)
List<?extends Action > visit(final Volume vol)
List<?extends Action > visit(final VirtualDirectory d)
List<?extends Action > visit(final Directory d)
static List< Action > getActions(Content c)
void actionPerformed(ActionEvent e)
static ExplorerNodeActionVisitor instance
void actionPerformed(ActionEvent e)
List<?extends Action > visit(final DerivedFile d)
List<?extends Action > visit(final org.sleuthkit.datamodel.File d)
synchronized static Logger getLogger(String name)
void actionPerformed(ActionEvent e)
List<?extends Action > visit(final Image img)
static synchronized AddContentTagAction getInstance()
List<?extends Action > defaultVisit(Content di)