Merge pull request #3460 from dgrove727/3545_LocalDiskImageBlockSize

3545 local disk image block size
This commit is contained in:
Richard Cordovano 2018-03-01 09:05:28 -05:00 committed by GitHub
commit 9be542dbde
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 198 additions and 108 deletions

View File

@ -219,6 +219,8 @@ MultiUserCasesPanel.searchLabel.text=Select any case and start typing to search
MultiUserCasesPanel.cancelButton.text=Cancel MultiUserCasesPanel.cancelButton.text=Cancel
ImageFilePanel.pathErrorLabel.text=Error Label ImageFilePanel.pathErrorLabel.text=Error Label
ImageFilePanel.sectorSizeLabel.text=Sector size: ImageFilePanel.sectorSizeLabel.text=Sector size:
LocalDiskPanel.sectorSizeLabel.text=Sector Size:
LocalDiskPanel.refreshTableButton.text=Refresh Local Disks
LocalFilesPanel.displayNameLabel.text=Logical File Set Display Name: Default LocalFilesPanel.displayNameLabel.text=Logical File Set Display Name: Default
LocalFilesPanel.errorLabel.text=Error Label LocalFilesPanel.errorLabel.text=Error Label
LocalFilesPanel.selectedPaths.toolTipText= LocalFilesPanel.selectedPaths.toolTipText=

View File

@ -54,6 +54,7 @@ public class LocalDiskDSProcessor implements DataSourceProcessor, AutoIngestData
*/ */
private String deviceId; private String deviceId;
private String drivePath; private String drivePath;
private int sectorSize;
private String timeZone; private String timeZone;
private ImageWriterSettings imageWriterSettings; private ImageWriterSettings imageWriterSettings;
private boolean ignoreFatOrphanFiles; private boolean ignoreFatOrphanFiles;
@ -137,6 +138,7 @@ public class LocalDiskDSProcessor implements DataSourceProcessor, AutoIngestData
if (!setDataSourceOptionsCalled) { if (!setDataSourceOptionsCalled) {
deviceId = UUID.randomUUID().toString(); deviceId = UUID.randomUUID().toString();
drivePath = configPanel.getContentPaths(); drivePath = configPanel.getContentPaths();
sectorSize = configPanel.getSectorSize();
timeZone = configPanel.getTimeZone(); timeZone = configPanel.getTimeZone();
ignoreFatOrphanFiles = configPanel.getNoFatOrphans(); ignoreFatOrphanFiles = configPanel.getNoFatOrphans();
if (configPanel.getImageWriterEnabled()) { if (configPanel.getImageWriterEnabled()) {
@ -145,7 +147,7 @@ public class LocalDiskDSProcessor implements DataSourceProcessor, AutoIngestData
imageWriterSettings = null; imageWriterSettings = null;
} }
} }
addDiskTask = new AddImageTask(deviceId, drivePath, 0, timeZone, ignoreFatOrphanFiles, imageWriterSettings, progressMonitor, callback); addDiskTask = new AddImageTask(deviceId, drivePath, sectorSize, timeZone, ignoreFatOrphanFiles, imageWriterSettings, progressMonitor, callback);
new Thread(addDiskTask).start(); new Thread(addDiskTask).start();
} }
@ -171,7 +173,33 @@ public class LocalDiskDSProcessor implements DataSourceProcessor, AutoIngestData
* @param callback Callback to call when processing is done. * @param callback Callback to call when processing is done.
*/ */
public void run(String deviceId, String drivePath, String timeZone, boolean ignoreFatOrphanFiles, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) { public void run(String deviceId, String drivePath, String timeZone, boolean ignoreFatOrphanFiles, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
addDiskTask = new AddImageTask(deviceId, drivePath, 0, timeZone, ignoreFatOrphanFiles, imageWriterSettings, progressMonitor, callback); run(deviceId, drivePath, 0, timeZone, ignoreFatOrphanFiles, progressMonitor, callback);
}
/**
* Adds a data source to the case database using a background task in a
* separate thread and the given settings instead of those provided by the
* selection and configuration panel. Returns as soon as the background task
* is started and uses the callback object to signal task completion and
* return results.
*
* @param deviceId An ASCII-printable identifier for the device
* associated with the data source that is
* intended to be unique across multiple cases
* (e.g., a UUID).
* @param drivePath Path to the local drive.
* @param sectorSize The sector size (use '0' for autodetect).
* @param timeZone The time zone to use when processing dates
* and times for the image, obtained from
* java.util.TimeZone.getID.
* @param ignoreFatOrphanFiles Whether to parse orphans if the image has a
* FAT filesystem.
* @param progressMonitor Progress monitor for reporting progress
* during processing.
* @param callback Callback to call when processing is done.
*/
private void run(String deviceId, String drivePath, int sectorSize, String timeZone, boolean ignoreFatOrphanFiles, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callback) {
addDiskTask = new AddImageTask(deviceId, drivePath, sectorSize, timeZone, ignoreFatOrphanFiles, imageWriterSettings, progressMonitor, callback);
new Thread(addDiskTask).start(); new Thread(addDiskTask).start();
} }
@ -227,10 +255,11 @@ public class LocalDiskDSProcessor implements DataSourceProcessor, AutoIngestData
public void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) throws AutoIngestDataSourceProcessorException { public void process(String deviceId, Path dataSourcePath, DataSourceProcessorProgressMonitor progressMonitor, DataSourceProcessorCallback callBack) throws AutoIngestDataSourceProcessorException {
this.deviceId = deviceId; this.deviceId = deviceId;
this.drivePath = dataSourcePath.toString(); this.drivePath = dataSourcePath.toString();
this.sectorSize = 0;
this.timeZone = Calendar.getInstance().getTimeZone().getID(); this.timeZone = Calendar.getInstance().getTimeZone().getID();
this.ignoreFatOrphanFiles = false; this.ignoreFatOrphanFiles = false;
setDataSourceOptionsCalled = true; setDataSourceOptionsCalled = true;
run(deviceId, drivePath, timeZone, ignoreFatOrphanFiles, progressMonitor, callBack); run(deviceId, drivePath, sectorSize, timeZone, ignoreFatOrphanFiles, progressMonitor, callBack);
} }
/** /**
@ -250,6 +279,7 @@ public class LocalDiskDSProcessor implements DataSourceProcessor, AutoIngestData
public void setDataSourceOptions(String drivePath, String timeZone, boolean ignoreFatOrphanFiles) { public void setDataSourceOptions(String drivePath, String timeZone, boolean ignoreFatOrphanFiles) {
this.deviceId = UUID.randomUUID().toString(); this.deviceId = UUID.randomUUID().toString();
this.drivePath = drivePath; this.drivePath = drivePath;
this.sectorSize = 0;
this.timeZone = Calendar.getInstance().getTimeZone().getID(); this.timeZone = Calendar.getInstance().getTimeZone().getID();
this.ignoreFatOrphanFiles = ignoreFatOrphanFiles; this.ignoreFatOrphanFiles = ignoreFatOrphanFiles;
setDataSourceOptionsCalled = true; setDataSourceOptionsCalled = true;

View File

@ -27,55 +27,52 @@
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Component id="diskLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="refreshTableButton" min="-2" pref="129" max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane1" alignment="1" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="1" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="noFatOrphansCheckbox" min="-2" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" attributes="0">
<Component id="copyImageCheckbox" min="-2" max="-2" attributes="0"/>
<Component id="descLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Group type="102" attributes="0">
<Component id="pathTextField" min="-2" pref="342" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="browseButton" pref="92" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="imageWriterErrorLabel" min="-2" max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
<Component id="changeDatabasePathCheckbox" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="timeZoneLabel" min="-2" max="-2" attributes="0"/> <Component id="timeZoneLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="timeZoneComboBox" max="32767" attributes="0"/> <Component id="timeZoneComboBox" max="32767" attributes="0"/>
</Group> </Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0">
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="changeDatabasePathCheckbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="imageWriterErrorLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="descLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="1" attributes="0">
<Component id="copyImageCheckbox" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="errorLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="sectorSizeLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="sectorSizeComboBox" min="-2" pref="85" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
<Component id="pathTextField" min="-2" pref="342" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="browseButton" min="-2" pref="106" max="-2" attributes="0"/>
</Group>
<Component id="noFatOrphansCheckbox" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group> </Group>
</Group> </Group>
<Component id="jScrollPane1" alignment="1" pref="488" max="32767" attributes="0"/>
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
<Component id="refreshTablebutton" min="-2" pref="129" max="-2" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="diskLabel" min="-2" max="-2" attributes="0"/>
<Component id="errorLabel" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group> </Group>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
</Group> </Group>
@ -85,27 +82,32 @@
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<Component id="diskLabel" min="-2" max="-2" attributes="0"/> <Component id="diskLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" pref="100" max="-2" attributes="0"/> <Component id="jScrollPane1" min="-2" pref="100" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="refreshTablebutton" min="-2" max="-2" attributes="0"/> <Component id="refreshTableButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="timeZoneLabel" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="timeZoneLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="timeZoneComboBox" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="timeZoneComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="noFatOrphansCheckbox" min="-2" max="-2" attributes="0"/> <Component id="noFatOrphansCheckbox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="descLabel" min="-2" max="-2" attributes="0"/> <Component id="descLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="sectorSizeLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="sectorSizeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="copyImageCheckbox" min="-2" max="-2" attributes="0"/> <Component id="copyImageCheckbox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="1" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="browseButton" min="-2" max="-2" attributes="0"/> <Component id="pathTextField" alignment="3" min="-2" pref="23" max="-2" attributes="0"/>
<Component id="pathTextField" min="-2" pref="23" max="-2" attributes="0"/> <Component id="browseButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group> </Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="changeDatabasePathCheckbox" min="-2" max="-2" attributes="0"/> <Component id="changeDatabasePathCheckbox" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2" attributes="0"/> <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
@ -113,7 +115,7 @@
<Component id="imageWriterErrorLabel" min="-2" max="-2" attributes="0"/> <Component id="imageWriterErrorLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="errorLabel" min="-2" max="-2" attributes="0"/> <Component id="errorLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="58" max="32767" attributes="0"/> <EmptySpace pref="43" max="32767" attributes="0"/>
</Group> </Group>
</Group> </Group>
</DimensionLayout> </DimensionLayout>
@ -276,15 +278,32 @@
</Property> </Property>
</Properties> </Properties>
</Component> </Component>
<Component class="javax.swing.JButton" name="refreshTablebutton"> <Component class="javax.swing.JButton" name="refreshTableButton">
<Properties> <Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="LocalDiskPanel.refreshTablebutton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/> <ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="LocalDiskPanel.refreshTableButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property> </Property>
</Properties> </Properties>
<Events> <Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="refreshTablebuttonActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="refreshTableButtonActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JLabel" name="sectorSizeLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="LocalDiskPanel.sectorSizeLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JComboBox" name="sectorSizeComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
<StringArray count="0"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
</AuxValues>
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -1,7 +1,7 @@
/* /*
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2011-2017 Basis Technology Corp. * Copyright 2011-2018 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");
@ -42,8 +42,6 @@ import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.imagewriter.ImageWriterSettings; import org.sleuthkit.autopsy.imagewriter.ImageWriterSettings;
@NbBundle.Messages({"LocalDiskPanel.refreshTablebutton.text=Refresh Local Disks"
})
/** /**
* ImageTypePanel for adding a local disk or partition such as PhysicalDrive0 or * ImageTypePanel for adding a local disk or partition such as PhysicalDrive0 or
* C:. * C:.
@ -51,6 +49,7 @@ import org.sleuthkit.autopsy.imagewriter.ImageWriterSettings;
final class LocalDiskPanel extends JPanel { final class LocalDiskPanel extends JPanel {
private static final Logger logger = Logger.getLogger(LocalDiskPanel.class.getName()); private static final Logger logger = Logger.getLogger(LocalDiskPanel.class.getName());
private static final String[] SECTOR_SIZE_CHOICES = {"Auto Detect", "512", "1024", "2048", "4096"};
private static LocalDiskPanel instance; private static LocalDiskPanel instance;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private List<LocalDisk> disks; private List<LocalDisk> disks;
@ -68,6 +67,7 @@ final class LocalDiskPanel extends JPanel {
initComponents(); initComponents();
customInit(); customInit();
createTimeZoneList(); createTimeZoneList();
createSectorSizeList();
refreshTable(); refreshTable();
diskTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { diskTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
@Override @Override
@ -115,7 +115,7 @@ final class LocalDiskPanel extends JPanel {
diskTable.setEnabled(false); diskTable.setEnabled(false);
imageWriterErrorLabel.setVisible(false); imageWriterErrorLabel.setVisible(false);
imageWriterErrorLabel.setText(""); imageWriterErrorLabel.setText("");
if(! PlatformUtil.isWindowsOS()){ if (!PlatformUtil.isWindowsOS()) {
copyImageCheckbox.setSelected(false); copyImageCheckbox.setSelected(false);
copyImageCheckbox.setEnabled(false); copyImageCheckbox.setEnabled(false);
} }
@ -147,7 +147,9 @@ final class LocalDiskPanel extends JPanel {
jLabel1 = new javax.swing.JLabel(); jLabel1 = new javax.swing.JLabel();
imageWriterErrorLabel = new javax.swing.JLabel(); imageWriterErrorLabel = new javax.swing.JLabel();
changeDatabasePathCheckbox = new javax.swing.JCheckBox(); changeDatabasePathCheckbox = new javax.swing.JCheckBox();
refreshTablebutton = new javax.swing.JButton(); refreshTableButton = new javax.swing.JButton();
sectorSizeLabel = new javax.swing.JLabel();
sectorSizeComboBox = new javax.swing.JComboBox<>();
setMinimumSize(new java.awt.Dimension(0, 420)); setMinimumSize(new java.awt.Dimension(0, 420));
setPreferredSize(new java.awt.Dimension(485, 410)); setPreferredSize(new java.awt.Dimension(485, 410));
@ -205,13 +207,15 @@ final class LocalDiskPanel extends JPanel {
org.openide.awt.Mnemonics.setLocalizedText(changeDatabasePathCheckbox, org.openide.util.NbBundle.getMessage(LocalDiskPanel.class, "LocalDiskPanel.changeDatabasePathCheckbox.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(changeDatabasePathCheckbox, org.openide.util.NbBundle.getMessage(LocalDiskPanel.class, "LocalDiskPanel.changeDatabasePathCheckbox.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(refreshTablebutton, org.openide.util.NbBundle.getMessage(LocalDiskPanel.class, "LocalDiskPanel.refreshTablebutton.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(refreshTableButton, org.openide.util.NbBundle.getMessage(LocalDiskPanel.class, "LocalDiskPanel.refreshTableButton.text")); // NOI18N
refreshTablebutton.addActionListener(new java.awt.event.ActionListener() { refreshTableButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
refreshTablebuttonActionPerformed(evt); refreshTableButtonActionPerformed(evt);
} }
}); });
org.openide.awt.Mnemonics.setLocalizedText(sectorSizeLabel, org.openide.util.NbBundle.getMessage(LocalDiskPanel.class, "LocalDiskPanel.sectorSizeLabel.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
@ -219,66 +223,73 @@ final class LocalDiskPanel extends JPanel {
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addContainerGap() .addComponent(diskLabel)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(noFatOrphansCheckbox)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(copyImageCheckbox)
.addComponent(descLabel))
.addGroup(layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 342, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(browseButton, javax.swing.GroupLayout.DEFAULT_SIZE, 92, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(imageWriterErrorLabel)
.addComponent(jLabel1)
.addComponent(changeDatabasePathCheckbox))
.addGap(0, 0, Short.MAX_VALUE)))))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addComponent(timeZoneLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(timeZoneComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 488, Short.MAX_VALUE)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE) .addGap(0, 0, Short.MAX_VALUE)
.addComponent(refreshTablebutton, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(refreshTableButton, javax.swing.GroupLayout.PREFERRED_SIZE, 129, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addContainerGap()
.addComponent(diskLabel) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(errorLabel)) .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE))) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(copyImageCheckbox)
.addComponent(errorLabel)
.addGroup(layout.createSequentialGroup()
.addComponent(sectorSizeLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(sectorSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 85, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(21, 21, 21)
.addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 342, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(browseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 106, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(noFatOrphansCheckbox)
.addGap(0, 0, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(timeZoneLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(timeZoneComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addGap(21, 21, 21)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(changeDatabasePathCheckbox, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(imageWriterErrorLabel, javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(descLabel, javax.swing.GroupLayout.Alignment.LEADING))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))))
.addContainerGap()) .addContainerGap())
); );
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(diskLabel) .addComponent(diskLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGap(1, 1, 1)
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 100, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(refreshTablebutton) .addComponent(refreshTableButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(timeZoneLabel) .addComponent(timeZoneLabel)
.addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(noFatOrphansCheckbox) .addComponent(noFatOrphansCheckbox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(descLabel) .addComponent(descLabel)
.addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(sectorSizeLabel)
.addComponent(sectorSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(copyImageCheckbox) .addComponent(copyImageCheckbox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(browseButton) .addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(pathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(browseButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(changeDatabasePathCheckbox) .addComponent(changeDatabasePathCheckbox)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1) .addComponent(jLabel1)
@ -286,7 +297,7 @@ final class LocalDiskPanel extends JPanel {
.addComponent(imageWriterErrorLabel) .addComponent(imageWriterErrorLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(errorLabel) .addComponent(errorLabel)
.addContainerGap(58, Short.MAX_VALUE)) .addContainerGap(43, Short.MAX_VALUE))
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
@ -317,9 +328,9 @@ final class LocalDiskPanel extends JPanel {
fireUpdateEvent(); fireUpdateEvent();
}//GEN-LAST:event_browseButtonActionPerformed }//GEN-LAST:event_browseButtonActionPerformed
private void refreshTablebuttonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshTablebuttonActionPerformed private void refreshTableButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_refreshTableButtonActionPerformed
refreshTable(); refreshTable();
}//GEN-LAST:event_refreshTablebuttonActionPerformed }//GEN-LAST:event_refreshTableButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton browseButton; private javax.swing.JButton browseButton;
@ -334,7 +345,9 @@ final class LocalDiskPanel extends JPanel {
private javax.swing.JScrollPane jScrollPane1; private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JCheckBox noFatOrphansCheckbox; private javax.swing.JCheckBox noFatOrphansCheckbox;
private javax.swing.JTextField pathTextField; private javax.swing.JTextField pathTextField;
private javax.swing.JButton refreshTablebutton; private javax.swing.JButton refreshTableButton;
private javax.swing.JComboBox<String> sectorSizeComboBox;
private javax.swing.JLabel sectorSizeLabel;
private javax.swing.JComboBox<String> timeZoneComboBox; private javax.swing.JComboBox<String> timeZoneComboBox;
private javax.swing.JLabel timeZoneLabel; private javax.swing.JLabel timeZoneLabel;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
@ -365,6 +378,21 @@ final class LocalDiskPanel extends JPanel {
} }
} }
/**
* Get the sector size.
*
* @return 0 if autodetect; otherwise the value selected.
*/
int getSectorSize() {
int sectorSizeSelectionIndex = sectorSizeComboBox.getSelectedIndex();
if (sectorSizeSelectionIndex == 0) {
return 0;
}
return Integer.valueOf((String) sectorSizeComboBox.getSelectedItem());
}
String getTimeZone() { String getTimeZone() {
String tz = timeZoneComboBox.getSelectedItem().toString(); String tz = timeZoneComboBox.getSelectedItem().toString();
return tz.substring(tz.indexOf(")") + 2).trim(); return tz.substring(tz.indexOf(")") + 2).trim();
@ -464,8 +492,8 @@ final class LocalDiskPanel extends JPanel {
} }
/** /**
* Creates the drop down list for the time zones and then makes the local * Creates the drop down list for the time zones and defaults the selection
* machine time zone to be selected. * to the local machine time zone.
*/ */
public void createTimeZoneList() { public void createTimeZoneList() {
// load and add all timezone // load and add all timezone
@ -500,6 +528,17 @@ final class LocalDiskPanel extends JPanel {
} }
/**
* Creates the drop down list for the sector size and defaults the selection
* to "Auto Detect".
*/
private void createSectorSizeList() {
for (String choice : SECTOR_SIZE_CHOICES) {
sectorSizeComboBox.addItem(choice);
}
sectorSizeComboBox.setSelectedIndex(0);
}
/** /**
* Table model for displaing information from LocalDisk Objects in a table. * Table model for displaing information from LocalDisk Objects in a table.
*/ */