mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
Updated based on TSK API change
This commit is contained in:
parent
eb2e34e5fc
commit
d393493a78
@ -1,383 +1,383 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011 Basis Technology Corp.
|
* Copyright 2011 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.directorytree;
|
package org.sleuthkit.autopsy.directorytree;
|
||||||
|
|
||||||
import java.awt.Toolkit;
|
import java.awt.Toolkit;
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import javax.swing.AbstractAction;
|
import javax.swing.AbstractAction;
|
||||||
import javax.swing.Action;
|
import javax.swing.Action;
|
||||||
import javax.swing.JDialog;
|
import javax.swing.JDialog;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JTable;
|
import javax.swing.JTable;
|
||||||
import javax.swing.table.DefaultTableModel;
|
import javax.swing.table.DefaultTableModel;
|
||||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||||
import org.sleuthkit.datamodel.Content;
|
import org.sleuthkit.datamodel.Content;
|
||||||
import org.sleuthkit.datamodel.ContentVisitor;
|
import org.sleuthkit.datamodel.ContentVisitor;
|
||||||
import org.sleuthkit.datamodel.DerivedFile;
|
import org.sleuthkit.datamodel.DerivedFile;
|
||||||
import org.sleuthkit.datamodel.Directory;
|
import org.sleuthkit.datamodel.Directory;
|
||||||
import org.sleuthkit.datamodel.FileSystem;
|
import org.sleuthkit.datamodel.FileSystem;
|
||||||
import org.sleuthkit.datamodel.Image;
|
import org.sleuthkit.datamodel.Image;
|
||||||
import org.sleuthkit.datamodel.LocalFile;
|
import org.sleuthkit.datamodel.LocalFile;
|
||||||
import org.sleuthkit.datamodel.VirtualDirectory;
|
import org.sleuthkit.datamodel.VirtualDirectory;
|
||||||
import org.sleuthkit.datamodel.Volume;
|
import org.sleuthkit.datamodel.Volume;
|
||||||
|
|
||||||
public class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? extends Action>> {
|
public class ExplorerNodeActionVisitor extends ContentVisitor.Default<List<? extends Action>> {
|
||||||
|
|
||||||
private static ExplorerNodeActionVisitor instance = new ExplorerNodeActionVisitor();
|
private static ExplorerNodeActionVisitor instance = new ExplorerNodeActionVisitor();
|
||||||
|
|
||||||
public static List<Action> getActions(Content c) {
|
public static List<Action> getActions(Content c) {
|
||||||
List<Action> actions = new ArrayList<Action>();
|
List<Action> actions = new ArrayList<Action>();
|
||||||
|
|
||||||
actions.addAll(c.accept(instance));
|
actions.addAll(c.accept(instance));
|
||||||
//TODO: fix this
|
//TODO: fix this
|
||||||
/*
|
/*
|
||||||
while (c.isOnto()) {
|
while (c.isOnto()) {
|
||||||
try {
|
try {
|
||||||
List<? extends Content> children = c.getChildren();
|
List<? extends Content> children = c.getChildren();
|
||||||
if (!children.isEmpty()) {
|
if (!children.isEmpty()) {
|
||||||
c = c.getChildren().get(0);
|
c = c.getChildren().get(0);
|
||||||
} else {
|
} else {
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
} catch (TskException ex) {
|
} catch (TskException ex) {
|
||||||
Log.get(ExplorerNodeActionVisitor.class).log(Level.WARNING, "Error getting show detail actions.", ex);
|
Log.get(ExplorerNodeActionVisitor.class).log(Level.WARNING, "Error getting show detail actions.", ex);
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
actions.addAll(c.accept(instance));
|
actions.addAll(c.accept(instance));
|
||||||
}*/
|
}*/
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExplorerNodeActionVisitor() {
|
ExplorerNodeActionVisitor() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Action> visit(final Image img) {
|
public List<? extends Action> visit(final Image img) {
|
||||||
List<Action> lst = new ArrayList<Action>();
|
List<Action> lst = new ArrayList<Action>();
|
||||||
lst.add(new ImageDetails("Image Details", img));
|
lst.add(new ImageDetails("Image Details", img));
|
||||||
//TODO lst.add(new ExtractAction("Extract Image", img));
|
//TODO lst.add(new ExtractAction("Extract Image", img));
|
||||||
lst.add(new ExtractUnallocAction("Extract Unallocated Space to Single Files", img));
|
lst.add(new ExtractUnallocAction("Extract Unallocated Space to Single Files", img));
|
||||||
return lst;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Action> visit(final FileSystem fs) {
|
public List<? extends Action> visit(final FileSystem fs) {
|
||||||
return Collections.singletonList(new FileSystemDetails("File System Details", fs));
|
return Collections.singletonList(new FileSystemDetails("File System Details", fs));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Action> visit(final Volume vol) {
|
public List<? extends Action> visit(final Volume vol) {
|
||||||
List<AbstractAction> lst = new ArrayList<AbstractAction>();
|
List<AbstractAction> lst = new ArrayList<AbstractAction>();
|
||||||
lst.add(new VolumeDetails("Volume Details", vol));
|
lst.add(new VolumeDetails("Volume Details", vol));
|
||||||
lst.add(new ExtractUnallocAction("Extract Unallocated Space to Single File", vol));
|
lst.add(new ExtractUnallocAction("Extract Unallocated Space to Single File", vol));
|
||||||
return lst;
|
return lst;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Action> visit(final Directory d) {
|
public List<? extends Action> visit(final Directory d) {
|
||||||
List<Action> actions = new ArrayList<Action>();
|
List<Action> actions = new ArrayList<Action>();
|
||||||
actions.add(TagAbstractFileAction.getInstance());
|
actions.add(TagAbstractFileAction.getInstance());
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Action> visit(final VirtualDirectory d) {
|
public List<? extends Action> visit(final VirtualDirectory d) {
|
||||||
List<Action> actions = new ArrayList<Action>();
|
List<Action> actions = new ArrayList<Action>();
|
||||||
actions.add(ExtractAction.getInstance());
|
actions.add(ExtractAction.getInstance());
|
||||||
actions.add(TagAbstractFileAction.getInstance());
|
actions.add(TagAbstractFileAction.getInstance());
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Action> visit(final DerivedFile d) {
|
public List<? extends Action> visit(final DerivedFile d) {
|
||||||
List<Action> actions = new ArrayList<Action>();
|
List<Action> actions = new ArrayList<Action>();
|
||||||
actions.add(ExtractAction.getInstance());
|
actions.add(ExtractAction.getInstance());
|
||||||
actions.add(TagAbstractFileAction.getInstance());
|
actions.add(TagAbstractFileAction.getInstance());
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Action> visit(final LocalFile d) {
|
public List<? extends Action> visit(final LocalFile d) {
|
||||||
List<Action> actions = new ArrayList<Action>();
|
List<Action> actions = new ArrayList<Action>();
|
||||||
actions.add(ExtractAction.getInstance());
|
actions.add(ExtractAction.getInstance());
|
||||||
actions.add(TagAbstractFileAction.getInstance());
|
actions.add(TagAbstractFileAction.getInstance());
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends Action> visit(final org.sleuthkit.datamodel.File d) {
|
public List<? extends Action> visit(final org.sleuthkit.datamodel.File d) {
|
||||||
List<Action> actions = new ArrayList<Action>();
|
List<Action> actions = new ArrayList<Action>();
|
||||||
actions.add(ExtractAction.getInstance());
|
actions.add(ExtractAction.getInstance());
|
||||||
actions.add(TagAbstractFileAction.getInstance());
|
actions.add(TagAbstractFileAction.getInstance());
|
||||||
return actions;
|
return actions;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected List<? extends Action> defaultVisit(Content di) {
|
protected List<? extends Action> defaultVisit(Content di) {
|
||||||
return Collections.<Action>emptyList();
|
return Collections.<Action>emptyList();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Below here are classes regarding node-specific actions
|
//Below here are classes regarding node-specific actions
|
||||||
/**
|
/**
|
||||||
* VolumeDetails class
|
* VolumeDetails class
|
||||||
*/
|
*/
|
||||||
private class VolumeDetails extends AbstractAction {
|
private class VolumeDetails extends AbstractAction {
|
||||||
|
|
||||||
private final String title;
|
private final String title;
|
||||||
private final Volume vol;
|
private final Volume vol;
|
||||||
|
|
||||||
VolumeDetails(String title, Volume vol) {
|
VolumeDetails(String title, Volume vol) {
|
||||||
super(title);
|
super(title);
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.vol = vol;
|
this.vol = vol;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Logger.noteAction(ExplorerNodeActionVisitor.class);
|
Logger.noteAction(ExplorerNodeActionVisitor.class);
|
||||||
|
|
||||||
final JFrame frame = new JFrame(title);
|
final JFrame frame = new JFrame(title);
|
||||||
final JDialog popUpWindow = new JDialog(frame, title, true); // to make the popUp Window to be modal
|
final JDialog popUpWindow = new JDialog(frame, title, true); // to make the popUp Window to be modal
|
||||||
|
|
||||||
|
|
||||||
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
|
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
|
|
||||||
// set the popUp window / JFrame
|
// set the popUp window / JFrame
|
||||||
popUpWindow.setSize(800, 400);
|
popUpWindow.setSize(800, 400);
|
||||||
|
|
||||||
int w = popUpWindow.getSize().width;
|
int w = popUpWindow.getSize().width;
|
||||||
int h = popUpWindow.getSize().height;
|
int h = popUpWindow.getSize().height;
|
||||||
|
|
||||||
// set the location of the popUp Window on the center of the screen
|
// set the location of the popUp Window on the center of the screen
|
||||||
popUpWindow.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
|
popUpWindow.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
|
||||||
|
|
||||||
VolumeDetailsPanel volumeDetailPanel = new VolumeDetailsPanel();
|
VolumeDetailsPanel volumeDetailPanel = new VolumeDetailsPanel();
|
||||||
Boolean counter = false;
|
Boolean counter = false;
|
||||||
|
|
||||||
volumeDetailPanel.setVolumeIDValue(Long.toString(vol.getAddr()));
|
volumeDetailPanel.setVolumeIDValue(Long.toString(vol.getAddr()));
|
||||||
volumeDetailPanel.setStartValue(Long.toString(vol.getStart()));
|
volumeDetailPanel.setStartValue(Long.toString(vol.getStart()));
|
||||||
volumeDetailPanel.setLengthValue(Long.toString(vol.getLength()));
|
volumeDetailPanel.setLengthValue(Long.toString(vol.getLength()));
|
||||||
volumeDetailPanel.setDescValue(vol.getDescription());
|
volumeDetailPanel.setDescValue(vol.getDescription());
|
||||||
volumeDetailPanel.setFlagsValue(vol.getFlagsAsString());
|
volumeDetailPanel.setFlagsValue(vol.getFlagsAsString());
|
||||||
counter = true;
|
counter = true;
|
||||||
|
|
||||||
if (counter) {
|
if (counter) {
|
||||||
// add the volume detail panel to the popUp window
|
// add the volume detail panel to the popUp window
|
||||||
popUpWindow.add(volumeDetailPanel);
|
popUpWindow.add(volumeDetailPanel);
|
||||||
} else {
|
} else {
|
||||||
// error handler if no volume matches
|
// error handler if no volume matches
|
||||||
JLabel error = new JLabel("Error: No Volume Matches.");
|
JLabel error = new JLabel("Error: No Volume Matches.");
|
||||||
error.setFont(new Font("Arial", Font.BOLD, 24));
|
error.setFont(new Font("Arial", Font.BOLD, 24));
|
||||||
popUpWindow.add(error);
|
popUpWindow.add(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the command to close the window to the button on the Volume Detail Panel
|
// add the command to close the window to the button on the Volume Detail Panel
|
||||||
volumeDetailPanel.setOKButtonActionListener(new ActionListener() {
|
volumeDetailPanel.setOKButtonActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
popUpWindow.dispose();
|
popUpWindow.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
popUpWindow.pack();
|
popUpWindow.pack();
|
||||||
popUpWindow.setResizable(false);
|
popUpWindow.setResizable(false);
|
||||||
popUpWindow.setVisible(true);
|
popUpWindow.setVisible(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ImageDetails panel class
|
* ImageDetails panel class
|
||||||
*/
|
*/
|
||||||
private class ImageDetails extends AbstractAction {
|
private class ImageDetails extends AbstractAction {
|
||||||
|
|
||||||
final String title;
|
final String title;
|
||||||
final Image img;
|
final Image img;
|
||||||
|
|
||||||
ImageDetails(String title, Image img) {
|
ImageDetails(String title, Image img) {
|
||||||
super(title);
|
super(title);
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.img = img;
|
this.img = img;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Logger.noteAction(ExplorerNodeActionVisitor.class);
|
Logger.noteAction(ExplorerNodeActionVisitor.class);
|
||||||
|
|
||||||
final JFrame frame = new JFrame(title);
|
final JFrame frame = new JFrame(title);
|
||||||
final JDialog popUpWindow = new JDialog(frame, title, true); // to make the popUp Window to be modal
|
final JDialog popUpWindow = new JDialog(frame, title, true); // to make the popUp Window to be modal
|
||||||
// if we select the Image Details menu
|
// if we select the Image Details menu
|
||||||
|
|
||||||
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
|
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
|
|
||||||
// set the popUp window / JFrame
|
// set the popUp window / JFrame
|
||||||
popUpWindow.setSize(750, 400);
|
popUpWindow.setSize(750, 400);
|
||||||
|
|
||||||
int w = popUpWindow.getSize().width;
|
int w = popUpWindow.getSize().width;
|
||||||
int h = popUpWindow.getSize().height;
|
int h = popUpWindow.getSize().height;
|
||||||
|
|
||||||
// set the location of the popUp Window on the center of the screen
|
// set the location of the popUp Window on the center of the screen
|
||||||
popUpWindow.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
|
popUpWindow.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
|
||||||
|
|
||||||
ImageDetailsPanel imgDetailPanel = new ImageDetailsPanel();
|
ImageDetailsPanel imgDetailPanel = new ImageDetailsPanel();
|
||||||
Boolean counter = false;
|
Boolean counter = false;
|
||||||
|
|
||||||
imgDetailPanel.setImgNameValue(img.getName());
|
imgDetailPanel.setImgNameValue(img.getName());
|
||||||
imgDetailPanel.setImgTypeValue(Image.imageTypeToString(img.getType()));
|
imgDetailPanel.setImgTypeValue(img.getType().getName());
|
||||||
imgDetailPanel.setImgSectorSizeValue(Long.toString(img.getSsize()));
|
imgDetailPanel.setImgSectorSizeValue(Long.toString(img.getSsize()));
|
||||||
counter = true;
|
counter = true;
|
||||||
|
|
||||||
if (counter) {
|
if (counter) {
|
||||||
// add the volume detail panel to the popUp window
|
// add the volume detail panel to the popUp window
|
||||||
popUpWindow.add(imgDetailPanel);
|
popUpWindow.add(imgDetailPanel);
|
||||||
} else {
|
} else {
|
||||||
// error handler if no volume matches
|
// error handler if no volume matches
|
||||||
JLabel error = new JLabel("Error: No Volume Matches.");
|
JLabel error = new JLabel("Error: No Volume Matches.");
|
||||||
error.setFont(new Font("Arial", Font.BOLD, 24));
|
error.setFont(new Font("Arial", Font.BOLD, 24));
|
||||||
popUpWindow.add(error);
|
popUpWindow.add(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// add the command to close the window to the button on the Volume Detail Panel
|
// add the command to close the window to the button on the Volume Detail Panel
|
||||||
imgDetailPanel.setOKButtonActionListener(new ActionListener() {
|
imgDetailPanel.setOKButtonActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
popUpWindow.dispose();
|
popUpWindow.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
popUpWindow.pack();
|
popUpWindow.pack();
|
||||||
popUpWindow.setResizable(false);
|
popUpWindow.setResizable(false);
|
||||||
popUpWindow.setVisible(true);
|
popUpWindow.setVisible(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FileSystemDetails class
|
* FileSystemDetails class
|
||||||
*/
|
*/
|
||||||
private class FileSystemDetails extends AbstractAction {
|
private class FileSystemDetails extends AbstractAction {
|
||||||
|
|
||||||
private final FileSystem fs;
|
private final FileSystem fs;
|
||||||
private final String title;
|
private final String title;
|
||||||
|
|
||||||
FileSystemDetails(String title, FileSystem fs) {
|
FileSystemDetails(String title, FileSystem fs) {
|
||||||
super(title);
|
super(title);
|
||||||
this.title = title;
|
this.title = title;
|
||||||
this.fs = fs;
|
this.fs = fs;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
|
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
|
||||||
|
|
||||||
Logger.noteAction(ExplorerNodeActionVisitor.class);
|
Logger.noteAction(ExplorerNodeActionVisitor.class);
|
||||||
|
|
||||||
final JFrame frame = new JFrame(title);
|
final JFrame frame = new JFrame(title);
|
||||||
final JDialog popUpWindow = new JDialog(frame, title, true); // to make the popUp Window to be modal
|
final JDialog popUpWindow = new JDialog(frame, title, true); // to make the popUp Window to be modal
|
||||||
|
|
||||||
// set the popUp window / JFrame
|
// set the popUp window / JFrame
|
||||||
|
|
||||||
popUpWindow.setSize(1000, 500);
|
popUpWindow.setSize(1000, 500);
|
||||||
|
|
||||||
int w = popUpWindow.getSize().width;
|
int w = popUpWindow.getSize().width;
|
||||||
int h = popUpWindow.getSize().height;
|
int h = popUpWindow.getSize().height;
|
||||||
|
|
||||||
// set the location of the popUp Window on the center of the screen
|
// set the location of the popUp Window on the center of the screen
|
||||||
popUpWindow.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
|
popUpWindow.setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
|
||||||
|
|
||||||
String[] columnNames = new String[]{
|
String[] columnNames = new String[]{
|
||||||
"fs_id",
|
"fs_id",
|
||||||
"img_offset",
|
"img_offset",
|
||||||
"par_id",
|
"par_id",
|
||||||
"fs_type",
|
"fs_type",
|
||||||
"block_size",
|
"block_size",
|
||||||
"block_count",
|
"block_count",
|
||||||
"root_inum",
|
"root_inum",
|
||||||
"first_inum",
|
"first_inum",
|
||||||
"last_inum"
|
"last_inum"
|
||||||
};
|
};
|
||||||
|
|
||||||
Object[][] rowValues = new Object[1][9];
|
Object[][] rowValues = new Object[1][9];
|
||||||
|
|
||||||
Content parent = null;
|
Content parent = null;
|
||||||
try {
|
try {
|
||||||
parent = fs.getParent();
|
parent = fs.getParent();
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
throw new RuntimeException("Problem getting parent from " + FileSystem.class.getName() + ": " + fs, ex);
|
throw new RuntimeException("Problem getting parent from " + FileSystem.class.getName() + ": " + fs, ex);
|
||||||
}
|
}
|
||||||
long id = -1;
|
long id = -1;
|
||||||
if (parent != null) {
|
if (parent != null) {
|
||||||
id = parent.getId();
|
id = parent.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
Arrays.fill(rowValues, 0, 1, new Object[]{
|
Arrays.fill(rowValues, 0, 1, new Object[]{
|
||||||
fs.getId(),
|
fs.getId(),
|
||||||
fs.getImageOffset(),
|
fs.getImageOffset(),
|
||||||
id,
|
id,
|
||||||
fs.getFsType(),
|
fs.getFsType(),
|
||||||
fs.getBlock_size(),
|
fs.getBlock_size(),
|
||||||
fs.getBlock_count(),
|
fs.getBlock_count(),
|
||||||
fs.getRoot_inum(),
|
fs.getRoot_inum(),
|
||||||
fs.getFirst_inum(),
|
fs.getFirst_inum(),
|
||||||
fs.getLastInum()
|
fs.getLastInum()
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
JTable table = new JTable(new DefaultTableModel(rowValues, columnNames));
|
JTable table = new JTable(new DefaultTableModel(rowValues, columnNames));
|
||||||
|
|
||||||
FileSystemDetailsPanel fsdPanel = new FileSystemDetailsPanel();
|
FileSystemDetailsPanel fsdPanel = new FileSystemDetailsPanel();
|
||||||
|
|
||||||
// add the command to close the window to the button on the Volume Detail Panel
|
// add the command to close the window to the button on the Volume Detail Panel
|
||||||
fsdPanel.setOKButtonActionListener(new ActionListener() {
|
fsdPanel.setOKButtonActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
popUpWindow.dispose();
|
popUpWindow.dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
fsdPanel.setFileSystemTypeValue(table.getValueAt(0, 3).toString());
|
fsdPanel.setFileSystemTypeValue(table.getValueAt(0, 3).toString());
|
||||||
fsdPanel.setImageOffsetValue(table.getValueAt(0, 1).toString());
|
fsdPanel.setImageOffsetValue(table.getValueAt(0, 1).toString());
|
||||||
fsdPanel.setVolumeIDValue(table.getValueAt(0, 2).toString()); //TODO: fix this to parent id, not vol id
|
fsdPanel.setVolumeIDValue(table.getValueAt(0, 2).toString()); //TODO: fix this to parent id, not vol id
|
||||||
fsdPanel.setBlockSizeValue(table.getValueAt(0, 4).toString());
|
fsdPanel.setBlockSizeValue(table.getValueAt(0, 4).toString());
|
||||||
fsdPanel.setBlockCountValue(table.getValueAt(0, 5).toString());
|
fsdPanel.setBlockCountValue(table.getValueAt(0, 5).toString());
|
||||||
fsdPanel.setRootInumValue(table.getValueAt(0, 6).toString());
|
fsdPanel.setRootInumValue(table.getValueAt(0, 6).toString());
|
||||||
fsdPanel.setFirstInumValue(table.getValueAt(0, 7).toString());
|
fsdPanel.setFirstInumValue(table.getValueAt(0, 7).toString());
|
||||||
fsdPanel.setLastInumValue(table.getValueAt(0, 8).toString());
|
fsdPanel.setLastInumValue(table.getValueAt(0, 8).toString());
|
||||||
|
|
||||||
popUpWindow.add(fsdPanel);
|
popUpWindow.add(fsdPanel);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
Logger.getLogger(ExplorerNodeActionVisitor.class.getName()).log(Level.WARNING, "Error setting up File System Details panel.", ex);
|
Logger.getLogger(ExplorerNodeActionVisitor.class.getName()).log(Level.WARNING, "Error setting up File System Details panel.", ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
popUpWindow.pack();
|
popUpWindow.pack();
|
||||||
popUpWindow.setResizable(false);
|
popUpWindow.setResizable(false);
|
||||||
popUpWindow.setVisible(true);
|
popUpWindow.setVisible(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user