mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-18 02:27:42 +00:00
3610 add comments to clarifiy new methods and classes for outlineView aid2.0
This commit is contained in:
parent
8d7cc2550f
commit
14d271bb28
@ -90,7 +90,7 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
statusByService.put(ServicesMonitor.Service.REMOTE_KEYWORD_SEARCH.toString(), NbBundle.getMessage(AutoIngestDashboard.class, "AutoIngestDashboard.tbServicesStatusMessage.Message.Down"));
|
statusByService.put(ServicesMonitor.Service.REMOTE_KEYWORD_SEARCH.toString(), NbBundle.getMessage(AutoIngestDashboard.class, "AutoIngestDashboard.tbServicesStatusMessage.Message.Down"));
|
||||||
statusByService.put(ServicesMonitor.Service.MESSAGING.toString(), NbBundle.getMessage(AutoIngestDashboard.class, "AutoIngestDashboard.tbServicesStatusMessage.Message.Down"));
|
statusByService.put(ServicesMonitor.Service.MESSAGING.toString(), NbBundle.getMessage(AutoIngestDashboard.class, "AutoIngestDashboard.tbServicesStatusMessage.Message.Down"));
|
||||||
setServicesStatusMessage();
|
setServicesStatusMessage();
|
||||||
pendingJobsPanel = new AutoIngestJobsPanel(AutoIngestNode.AutoIngestJobType.PENDING_JOB);
|
pendingJobsPanel = new AutoIngestJobsPanel(AutoIngestJobsNode.AutoIngestJobType.PENDING_JOB);
|
||||||
pendingJobsPanel.setSize(pendingScrollPane.getSize());
|
pendingJobsPanel.setSize(pendingScrollPane.getSize());
|
||||||
pendingScrollPane.add(pendingJobsPanel);
|
pendingScrollPane.add(pendingJobsPanel);
|
||||||
pendingScrollPane.setViewportView(pendingJobsPanel);
|
pendingScrollPane.setViewportView(pendingJobsPanel);
|
||||||
@ -112,7 +112,7 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
this.deprioritizeCaseButton.setEnabled(enableDeprioritizeButtons);
|
this.deprioritizeCaseButton.setEnabled(enableDeprioritizeButtons);
|
||||||
});
|
});
|
||||||
pendingJobsPanel.setToolTipText(Bundle.AutoIngestDashboard_pendingTable.toolTipText());
|
pendingJobsPanel.setToolTipText(Bundle.AutoIngestDashboard_pendingTable.toolTipText());
|
||||||
runningJobsPanel = new AutoIngestJobsPanel(AutoIngestNode.AutoIngestJobType.RUNNING_JOB);
|
runningJobsPanel = new AutoIngestJobsPanel(AutoIngestJobsNode.AutoIngestJobType.RUNNING_JOB);
|
||||||
runningJobsPanel.setSize(runningScrollPane.getSize());
|
runningJobsPanel.setSize(runningScrollPane.getSize());
|
||||||
runningScrollPane.add(runningJobsPanel);
|
runningScrollPane.add(runningJobsPanel);
|
||||||
runningScrollPane.setViewportView(runningJobsPanel);
|
runningScrollPane.setViewportView(runningJobsPanel);
|
||||||
@ -124,7 +124,7 @@ final class AutoIngestDashboard extends JPanel implements Observer {
|
|||||||
this.deprioritizeCaseButton.setEnabled(enabled);
|
this.deprioritizeCaseButton.setEnabled(enabled);
|
||||||
});
|
});
|
||||||
runningJobsPanel.setToolTipText(Bundle.AutoIngestDashboard_runningTable.toolTipText());
|
runningJobsPanel.setToolTipText(Bundle.AutoIngestDashboard_runningTable.toolTipText());
|
||||||
completedJobsPanel = new AutoIngestJobsPanel(AutoIngestNode.AutoIngestJobType.COMPLETED_JOB);
|
completedJobsPanel = new AutoIngestJobsPanel(AutoIngestJobsNode.AutoIngestJobType.COMPLETED_JOB);
|
||||||
completedJobsPanel.setSize(completedScrollPane.getSize());
|
completedJobsPanel.setSize(completedScrollPane.getSize());
|
||||||
completedScrollPane.add(completedJobsPanel);
|
completedScrollPane.add(completedJobsPanel);
|
||||||
completedScrollPane.setViewportView(completedJobsPanel);
|
completedScrollPane.setViewportView(completedJobsPanel);
|
||||||
|
@ -33,7 +33,11 @@ import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestMonitor.JobsSnaps
|
|||||||
import org.sleuthkit.autopsy.guiutils.DurationCellRenderer;
|
import org.sleuthkit.autopsy.guiutils.DurationCellRenderer;
|
||||||
import org.sleuthkit.autopsy.guiutils.StatusIconCellRenderer;
|
import org.sleuthkit.autopsy.guiutils.StatusIconCellRenderer;
|
||||||
|
|
||||||
final class AutoIngestNode extends AbstractNode {
|
/**
|
||||||
|
* A node which represents all AutoIngestJobs of a given AutoIngestJobStatus.
|
||||||
|
* Each job with the specified status will have a child node representing it.
|
||||||
|
*/
|
||||||
|
final class AutoIngestJobsNode extends AbstractNode {
|
||||||
|
|
||||||
@Messages({
|
@Messages({
|
||||||
"AutoIngestNode.caseName.text=Case Name",
|
"AutoIngestNode.caseName.text=Case Name",
|
||||||
@ -47,24 +51,37 @@ final class AutoIngestNode extends AbstractNode {
|
|||||||
"AutoIngestNode.status.text=Status"
|
"AutoIngestNode.status.text=Status"
|
||||||
})
|
})
|
||||||
|
|
||||||
AutoIngestNode(JobsSnapshot snapshot, AutoIngestJobType type) {
|
/**
|
||||||
super(Children.create(new AutoIngestNodeChildren(snapshot, type), false));
|
* Construct a new AutoIngestJobsNode.
|
||||||
|
*/
|
||||||
|
AutoIngestJobsNode(JobsSnapshot snapshot, AutoIngestJobStatus status) {
|
||||||
|
super(Children.create(new AutoIngestNodeChildren(snapshot, status), false));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A ChildFactory for generating JobNodes.
|
||||||
|
*/
|
||||||
static class AutoIngestNodeChildren extends ChildFactory<AutoIngestJob> {
|
static class AutoIngestNodeChildren extends ChildFactory<AutoIngestJob> {
|
||||||
|
|
||||||
private final AutoIngestJobType autoIngestJobType;
|
private final AutoIngestJobStatus autoIngestJobStatus;
|
||||||
private final JobsSnapshot jobsSnapshot;
|
private final JobsSnapshot jobsSnapshot;
|
||||||
|
|
||||||
AutoIngestNodeChildren(JobsSnapshot snapshot, AutoIngestJobType type) {
|
/**
|
||||||
|
* Create children nodes for the AutoIngestJobsNode which will each
|
||||||
|
* represent a single AutoIngestJob
|
||||||
|
*
|
||||||
|
* @param snapshot the snapshot which contains the AutoIngestJobs
|
||||||
|
* @param status the status of the jobs being displayed
|
||||||
|
*/
|
||||||
|
AutoIngestNodeChildren(JobsSnapshot snapshot, AutoIngestJobStatus status) {
|
||||||
jobsSnapshot = snapshot;
|
jobsSnapshot = snapshot;
|
||||||
autoIngestJobType = type;
|
autoIngestJobStatus = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean createKeys(List<AutoIngestJob> list) {
|
protected boolean createKeys(List<AutoIngestJob> list) {
|
||||||
List<AutoIngestJob> jobs;
|
List<AutoIngestJob> jobs;
|
||||||
switch (autoIngestJobType) {
|
switch (autoIngestJobStatus) {
|
||||||
case PENDING_JOB:
|
case PENDING_JOB:
|
||||||
jobs = jobsSnapshot.getPendingJobs();
|
jobs = jobsSnapshot.getPendingJobs();
|
||||||
break;
|
break;
|
||||||
@ -85,28 +102,40 @@ final class AutoIngestNode extends AbstractNode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Node createNodeForKey(AutoIngestJob key) {
|
protected Node createNodeForKey(AutoIngestJob key) {
|
||||||
return new JobNode(key, autoIngestJobType);
|
return new JobNode(key, autoIngestJobStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A node which represents a single multi user case.
|
* A node which represents a single auto ingest job.
|
||||||
*/
|
*/
|
||||||
static final class JobNode extends AbstractNode {
|
static final class JobNode extends AbstractNode {
|
||||||
|
|
||||||
private final AutoIngestJob autoIngestJob;
|
private final AutoIngestJob autoIngestJob;
|
||||||
private final AutoIngestJobType jobType;
|
private final AutoIngestJobStatus jobStatus;
|
||||||
|
|
||||||
JobNode(AutoIngestJob job, AutoIngestJobType type) {
|
/**
|
||||||
|
* Construct a new JobNode to represent an AutoIngestJob and its status.
|
||||||
|
*
|
||||||
|
* @param job - the AutoIngestJob being represented by this node
|
||||||
|
* @param status - the current status of the AutoIngestJob being
|
||||||
|
* represented
|
||||||
|
*/
|
||||||
|
JobNode(AutoIngestJob job, AutoIngestJobStatus status) {
|
||||||
super(Children.LEAF);
|
super(Children.LEAF);
|
||||||
jobType = type;
|
jobStatus = status;
|
||||||
autoIngestJob = job;
|
autoIngestJob = job;
|
||||||
super.setName(autoIngestJob.getManifest().getCaseName());
|
super.setName(autoIngestJob.getManifest().getCaseName());
|
||||||
setName(autoIngestJob.getManifest().getCaseName());
|
setName(autoIngestJob.getManifest().getCaseName());
|
||||||
setDisplayName(autoIngestJob.getManifest().getCaseName());
|
setDisplayName(autoIngestJob.getManifest().getCaseName());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the AutoIngestJob which this node represents.
|
||||||
|
*
|
||||||
|
* @return autoIngestJob
|
||||||
|
*/
|
||||||
AutoIngestJob getAutoIngestJob() {
|
AutoIngestJob getAutoIngestJob() {
|
||||||
return autoIngestJob;
|
return autoIngestJob;
|
||||||
}
|
}
|
||||||
@ -123,7 +152,7 @@ final class AutoIngestNode extends AbstractNode {
|
|||||||
autoIngestJob.getManifest().getCaseName()));
|
autoIngestJob.getManifest().getCaseName()));
|
||||||
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(),
|
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(),
|
||||||
autoIngestJob.getManifest().getDataSourcePath().getFileName().toString()));
|
autoIngestJob.getManifest().getDataSourcePath().getFileName().toString()));
|
||||||
switch (jobType) {
|
switch (jobStatus) {
|
||||||
case PENDING_JOB:
|
case PENDING_JOB:
|
||||||
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(),
|
ss.put(new NodeProperty<>(Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(),
|
||||||
autoIngestJob.getManifest().getDateFileCreated()));
|
autoIngestJob.getManifest().getDateFileCreated()));
|
||||||
@ -153,7 +182,11 @@ final class AutoIngestNode extends AbstractNode {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
enum AutoIngestJobType {
|
/**
|
||||||
|
* An enumeration used to indicate the current status of an auto ingest job
|
||||||
|
* node.
|
||||||
|
*/
|
||||||
|
enum AutoIngestJobStatus {
|
||||||
PENDING_JOB, //NON-NLS
|
PENDING_JOB, //NON-NLS
|
||||||
RUNNING_JOB, //NON-NLS
|
RUNNING_JOB, //NON-NLS
|
||||||
COMPLETED_JOB //NON-NLS
|
COMPLETED_JOB //NON-NLS
|
@ -27,12 +27,11 @@ import org.netbeans.swing.outline.Outline;
|
|||||||
import org.openide.explorer.ExplorerManager;
|
import org.openide.explorer.ExplorerManager;
|
||||||
import org.openide.nodes.Node;
|
import org.openide.nodes.Node;
|
||||||
import org.sleuthkit.autopsy.datamodel.EmptyNode;
|
import org.sleuthkit.autopsy.datamodel.EmptyNode;
|
||||||
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestNode.AutoIngestJobType;
|
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestJobsNode.AutoIngestJobStatus;
|
||||||
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestNode.JobNode;
|
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestJobsNode.JobNode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* A panel which displays an outline view with all jobs for a specified status.
|
||||||
* @author wschaefer
|
|
||||||
*/
|
*/
|
||||||
final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerManager.Provider {
|
final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerManager.Provider {
|
||||||
|
|
||||||
@ -40,22 +39,28 @@ final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerMa
|
|||||||
private final org.openide.explorer.view.OutlineView outlineView;
|
private final org.openide.explorer.view.OutlineView outlineView;
|
||||||
private final Outline outline;
|
private final Outline outline;
|
||||||
private ExplorerManager explorerManager;
|
private ExplorerManager explorerManager;
|
||||||
private final AutoIngestJobType type;
|
private final AutoIngestJobStatus status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form PendingJobsPanel
|
* Creates a new AutoIngestJobsPanel of the specified jobStatus
|
||||||
|
*
|
||||||
|
* @param jobStatus the status of the jbos to be displayed on this panel
|
||||||
*/
|
*/
|
||||||
AutoIngestJobsPanel(AutoIngestJobType jobType) {
|
AutoIngestJobsPanel(AutoIngestJobStatus jobStatus) {
|
||||||
initComponents();
|
initComponents();
|
||||||
type = jobType;
|
status = jobStatus;
|
||||||
outlineView = new org.openide.explorer.view.OutlineView();
|
outlineView = new org.openide.explorer.view.OutlineView();
|
||||||
outline = outlineView.getOutline();
|
outline = outlineView.getOutline();
|
||||||
customize();
|
customize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set up the AutoIngestJobsPanel's so that its outlineView is displaying
|
||||||
|
* the correct columns for the specified AutoIngestJobStatus
|
||||||
|
*/
|
||||||
void customize() {
|
void customize() {
|
||||||
|
|
||||||
switch (type) {
|
switch (status) {
|
||||||
case PENDING_JOB:
|
case PENDING_JOB:
|
||||||
outlineView.setPropertyColumns(Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(),
|
outlineView.setPropertyColumns(Bundle.AutoIngestNode_dataSource_text(), Bundle.AutoIngestNode_dataSource_text(),
|
||||||
Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(),
|
Bundle.AutoIngestNode_jobCreated_text(), Bundle.AutoIngestNode_jobCreated_text(),
|
||||||
@ -102,6 +107,12 @@ final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerMa
|
|||||||
outline.setPreferredScrollableViewportSize(new Dimension(400, 100));
|
outline.setPreferredScrollableViewportSize(new Dimension(400, 100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a list selection listener to the selection model of the outline being
|
||||||
|
* used in this panel.
|
||||||
|
*
|
||||||
|
* @param listener the ListSelectionListener to add
|
||||||
|
*/
|
||||||
void addListSelectionListener(ListSelectionListener listener) {
|
void addListSelectionListener(ListSelectionListener listener) {
|
||||||
outline.getSelectionModel().addListSelectionListener(listener);
|
outline.getSelectionModel().addListSelectionListener(listener);
|
||||||
}
|
}
|
||||||
@ -111,20 +122,26 @@ final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerMa
|
|||||||
return explorerManager;
|
return explorerManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the contents of this AutoIngestJobsPanel while retaining currently
|
||||||
|
* selected node.
|
||||||
|
*
|
||||||
|
* @param jobsSnapshot - the JobsSnapshot which will provide the new
|
||||||
|
* contents
|
||||||
|
*/
|
||||||
void refresh(AutoIngestMonitor.JobsSnapshot jobsSnapshot) {
|
void refresh(AutoIngestMonitor.JobsSnapshot jobsSnapshot) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
outline.setRowSelectionAllowed(false);
|
outline.setRowSelectionAllowed(false);
|
||||||
Node[] selectedNodes = explorerManager.getSelectedNodes();
|
Node[] selectedNodes = explorerManager.getSelectedNodes();
|
||||||
AutoIngestNode autoIngestNode = new AutoIngestNode(jobsSnapshot, type);
|
AutoIngestJobsNode autoIngestNode = new AutoIngestJobsNode(jobsSnapshot, status);
|
||||||
explorerManager.setRootContext(autoIngestNode);
|
explorerManager.setRootContext(autoIngestNode);
|
||||||
outline.setRowSelectionAllowed(true);
|
outline.setRowSelectionAllowed(true);
|
||||||
if (selectedNodes.length > 0) {
|
if (selectedNodes.length > 0) {
|
||||||
try {
|
try {
|
||||||
explorerManager.setSelectedNodes(new Node[]{autoIngestNode.getChildren().findChild(selectedNodes[0].getName())});
|
explorerManager.setSelectedNodes(new Node[]{autoIngestNode.getChildren().findChild(selectedNodes[0].getName())});
|
||||||
} catch (PropertyVetoException ignore) {
|
} catch (PropertyVetoException ignore) {
|
||||||
//Unable to select previously selected node
|
//Unable to select previously selected node
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,8 +158,13 @@ final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerMa
|
|||||||
setLayout(new java.awt.BorderLayout());
|
setLayout(new java.awt.BorderLayout());
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the AutoIngestJob for the currently selected node of this panel.
|
||||||
|
*
|
||||||
|
* @return AutoIngestJob which is currently selected in this panel
|
||||||
|
*/
|
||||||
AutoIngestJob getSelectedAutoIngestJob() {
|
AutoIngestJob getSelectedAutoIngestJob() {
|
||||||
Node[] selectedRows = getSelectedNodes();
|
Node[] selectedRows = explorerManager.getSelectedNodes();
|
||||||
if (selectedRows.length == 1) {
|
if (selectedRows.length == 1) {
|
||||||
return ((JobNode) selectedRows[0]).getAutoIngestJob();
|
return ((JobNode) selectedRows[0]).getAutoIngestJob();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user