mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Merge pull request #2864 from wschaeferB/2745-contentViewerColumnCondition
2745 content viewer column condition
This commit is contained in:
commit
afe7017e01
@ -45,25 +45,15 @@
|
||||
<Layout>
|
||||
<DimensionLayout dim="0">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="jPanel1" pref="622" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
<DimensionLayout dim="1">
|
||||
<Group type="103" groupAlignment="0" attributes="0">
|
||||
<Component id="jScrollPane1" alignment="1" max="32767" attributes="0"/>
|
||||
<Component id="jPanel1" alignment="0" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</DimensionLayout>
|
||||
</Layout>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JScrollPane" name="jScrollPane1">
|
||||
<Properties>
|
||||
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[622, 58]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
|
||||
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
|
||||
<SubComponents>
|
||||
<Container class="javax.swing.JPanel" name="jPanel1">
|
||||
<Properties>
|
||||
@ -90,14 +80,14 @@
|
||||
<Component id="prevPageButton" min="-2" pref="23" max="-2" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
<Component id="nextPageButton" min="-2" pref="23" max="-2" attributes="0"/>
|
||||
<EmptySpace max="32767" attributes="0"/>
|
||||
<EmptySpace pref="366" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
<Component id="resultsTableScrollPane" alignment="1" max="32767" attributes="0"/>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="1" attributes="0">
|
||||
<EmptySpace pref="277" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="280" max="32767" attributes="0"/>
|
||||
<Component id="artifactLabel" min="-2" pref="258" max="-2" attributes="0"/>
|
||||
<EmptySpace pref="85" max="32767" attributes="0"/>
|
||||
<EmptySpace pref="84" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -116,13 +106,14 @@
|
||||
<Component id="prevPageButton" alignment="0" min="-2" pref="23" max="-2" attributes="0"/>
|
||||
<Component id="pageLabel2" min="-2" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<EmptySpace max="-2" attributes="0"/>
|
||||
<Component id="resultsTableScrollPane" pref="34" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" max="-2" attributes="0"/>
|
||||
<Component id="resultsTableScrollPane" pref="29" max="32767" attributes="0"/>
|
||||
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
|
||||
</Group>
|
||||
<Group type="103" rootIndex="1" groupAlignment="0" attributes="0">
|
||||
<Group type="102" alignment="0" attributes="0">
|
||||
<Component id="artifactLabel" min="-2" pref="23" max="-2" attributes="0"/>
|
||||
<EmptySpace min="0" pref="40" max="32767" attributes="0"/>
|
||||
<EmptySpace min="0" pref="401" max="32767" attributes="0"/>
|
||||
</Group>
|
||||
</Group>
|
||||
</Group>
|
||||
@ -247,8 +238,9 @@
|
||||
</Component>
|
||||
<Container class="javax.swing.JScrollPane" name="resultsTableScrollPane">
|
||||
<Properties>
|
||||
<Property name="horizontalScrollBarPolicy" type="int" value="31"/>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[620, 271]"/>
|
||||
<Dimension value="[620, 34]"/>
|
||||
</Property>
|
||||
</Properties>
|
||||
<AuxValues>
|
||||
@ -262,6 +254,4 @@
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Container>
|
||||
</SubComponents>
|
||||
</Form>
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Autopsy Forensic Browser
|
||||
*
|
||||
* Copyright 2011-2017 Basis Technology Corp.
|
||||
* Copyright 2011-2013 Basis Technology Corp.
|
||||
* Contact: carrier <at> sleuthkit <dot> org
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@ -26,12 +26,14 @@ import java.awt.event.ActionListener;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Enumeration;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.SwingWorker;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import javax.swing.table.TableColumn;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.openide.nodes.Node;
|
||||
import org.openide.util.Lookup;
|
||||
@ -50,7 +52,7 @@ import org.netbeans.swing.etable.ETable;
|
||||
|
||||
/**
|
||||
* Instances of this class display the BlackboardArtifacts associated with the
|
||||
* Content represented by a Node. Each BlackboardArtifact is rendered as an HTML
|
||||
* Content represented by a Node. Each BlackboardArtifact is rendered displayed in a JTable
|
||||
* representation of its BlackboardAttributes.
|
||||
*/
|
||||
@ServiceProvider(service = DataContentViewer.class, position = 3)
|
||||
@ -75,6 +77,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
||||
Bundle.DataContentViewerArtifact_attrsTableHeader_type(),
|
||||
Bundle.DataContentViewerArtifact_attrsTableHeader_value(),
|
||||
Bundle.DataContentViewerArtifact_attrsTableHeader_sources()};
|
||||
private static final int[] COLUMN_WIDTHS = {100, 800, 100};
|
||||
|
||||
public DataContentViewerArtifact() {
|
||||
initResultsTable();
|
||||
@ -86,30 +89,32 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
||||
|
||||
private void initResultsTable() {
|
||||
resultsTable = new ETable();
|
||||
|
||||
resultsTable.setModel(new javax.swing.table.DefaultTableModel() {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(int rowIndex, int columnIndex) {
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
resultsTable.setCellSelectionEnabled(true);
|
||||
resultsTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION);
|
||||
resultsTable.setColumnHidingAllowed(false);
|
||||
resultsTable.getTableHeader().setReorderingAllowed(false);
|
||||
resultsTable.setRowSorter(null); //null sorter turns off sorting
|
||||
resultsTable.setColumnHidingAllowed(false);
|
||||
resultsTable.getColumnModel().getSelectionModel().setSelectionMode(javax.swing.ListSelectionModel.SINGLE_INTERVAL_SELECTION);
|
||||
updateColumnSizes();
|
||||
}
|
||||
|
||||
private void updateColumnSizes() {
|
||||
resultsTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_NEXT_COLUMN);
|
||||
if (resultsTable.getColumnModel().getColumnCount() > 0) {
|
||||
resultsTable.getColumnModel().getColumn(0).setPreferredWidth(100);
|
||||
resultsTable.getColumnModel().getColumn(1).setPreferredWidth(800);
|
||||
resultsTable.getColumnModel().getColumn(2).setPreferredWidth(100);
|
||||
Enumeration<TableColumn> columns = resultsTable.getColumnModel().getColumns();
|
||||
while (columns.hasMoreElements()) {
|
||||
TableColumn col = columns.nextElement();
|
||||
if (col.getHeaderValue().equals(COLUMN_HEADERS[0])) {
|
||||
col.setPreferredWidth(COLUMN_WIDTHS[0]);
|
||||
} else if (col.getHeaderValue().equals(COLUMN_HEADERS[1])) {
|
||||
col.setPreferredWidth(COLUMN_WIDTHS[1]);
|
||||
} else if (col.getHeaderValue().equals(COLUMN_HEADERS[2])) {
|
||||
col.setPreferredWidth(COLUMN_WIDTHS[2]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,13 +124,12 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
||||
* regenerated by the Form Editor.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">
|
||||
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
|
||||
private void initComponents() {
|
||||
|
||||
rightClickMenu = new javax.swing.JPopupMenu();
|
||||
copyMenuItem = new javax.swing.JMenuItem();
|
||||
selectAllMenuItem = new javax.swing.JMenuItem();
|
||||
jScrollPane1 = new javax.swing.JScrollPane();
|
||||
jPanel1 = new javax.swing.JPanel();
|
||||
totalPageLabel = new javax.swing.JLabel();
|
||||
ofLabel = new javax.swing.JLabel();
|
||||
@ -145,9 +149,6 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
||||
|
||||
setPreferredSize(new java.awt.Dimension(622, 58));
|
||||
|
||||
jScrollPane1.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
jScrollPane1.setPreferredSize(new java.awt.Dimension(622, 58));
|
||||
|
||||
jPanel1.setPreferredSize(new java.awt.Dimension(620, 58));
|
||||
|
||||
totalPageLabel.setText(org.openide.util.NbBundle.getMessage(DataContentViewerArtifact.class, "DataContentViewerArtifact.totalPageLabel.text")); // NOI18N
|
||||
@ -197,7 +198,8 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
||||
}
|
||||
});
|
||||
|
||||
resultsTableScrollPane.setPreferredSize(new java.awt.Dimension(620, 271));
|
||||
resultsTableScrollPane.setHorizontalScrollBarPolicy(javax.swing.ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
|
||||
resultsTableScrollPane.setPreferredSize(new java.awt.Dimension(620, 34));
|
||||
|
||||
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
|
||||
jPanel1.setLayout(jPanel1Layout);
|
||||
@ -218,13 +220,13 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
||||
.addComponent(prevPageButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 0, 0)
|
||||
.addComponent(nextPageButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||
.addContainerGap(366, Short.MAX_VALUE))
|
||||
.addComponent(resultsTableScrollPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
|
||||
.addContainerGap(277, Short.MAX_VALUE)
|
||||
.addContainerGap(280, Short.MAX_VALUE)
|
||||
.addComponent(artifactLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 258, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addContainerGap(85, Short.MAX_VALUE)))
|
||||
.addContainerGap(84, Short.MAX_VALUE)))
|
||||
);
|
||||
jPanel1Layout.setVerticalGroup(
|
||||
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
@ -239,47 +241,45 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
||||
.addComponent(prevPageButton, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addComponent(pageLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
|
||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||
.addComponent(resultsTableScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 34, Short.MAX_VALUE))
|
||||
.addComponent(resultsTableScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 29, Short.MAX_VALUE)
|
||||
.addGap(0, 0, 0))
|
||||
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addGroup(jPanel1Layout.createSequentialGroup()
|
||||
.addComponent(artifactLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||
.addGap(0, 40, Short.MAX_VALUE)))
|
||||
.addGap(0, 401, Short.MAX_VALUE)))
|
||||
);
|
||||
|
||||
jScrollPane1.setViewportView(jPanel1);
|
||||
|
||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||
this.setLayout(layout);
|
||||
layout.setHorizontalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 622, Short.MAX_VALUE)
|
||||
);
|
||||
layout.setVerticalGroup(
|
||||
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||
.addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||
);
|
||||
}// </editor-fold>
|
||||
}// </editor-fold>//GEN-END:initComponents
|
||||
|
||||
private void prevPageButtonActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
currentPage = currentPage - 1;
|
||||
currentPageLabel.setText(Integer.toString(currentPage));
|
||||
artifactLabel.setText(artifactTableContents.get(currentPage - 1).getArtifactDisplayName());
|
||||
startNewTask(new SelectedArtifactChangedTask(currentPage));
|
||||
}
|
||||
|
||||
private void nextPageButtonActionPerformed(java.awt.event.ActionEvent evt) {
|
||||
private void nextPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_nextPageButtonActionPerformed
|
||||
currentPage = currentPage + 1;
|
||||
currentPageLabel.setText(Integer.toString(currentPage));
|
||||
artifactLabel.setText(artifactTableContents.get(currentPage - 1).getArtifactDisplayName());
|
||||
startNewTask(new SelectedArtifactChangedTask(currentPage));
|
||||
}
|
||||
}//GEN-LAST:event_nextPageButtonActionPerformed
|
||||
|
||||
// Variables declaration - do not modify
|
||||
private void prevPageButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_prevPageButtonActionPerformed
|
||||
currentPage = currentPage - 1;
|
||||
currentPageLabel.setText(Integer.toString(currentPage));
|
||||
artifactLabel.setText(artifactTableContents.get(currentPage - 1).getArtifactDisplayName());
|
||||
startNewTask(new SelectedArtifactChangedTask(currentPage));
|
||||
}//GEN-LAST:event_prevPageButtonActionPerformed
|
||||
|
||||
// Variables declaration - do not modify//GEN-BEGIN:variables
|
||||
private javax.swing.JLabel artifactLabel;
|
||||
private javax.swing.JMenuItem copyMenuItem;
|
||||
private javax.swing.JLabel currentPageLabel;
|
||||
private javax.swing.JPanel jPanel1;
|
||||
private javax.swing.JScrollPane jScrollPane1;
|
||||
private javax.swing.JButton nextPageButton;
|
||||
private javax.swing.JLabel ofLabel;
|
||||
private javax.swing.JLabel pageLabel;
|
||||
@ -289,7 +289,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
||||
private javax.swing.JPopupMenu rightClickMenu;
|
||||
private javax.swing.JMenuItem selectAllMenuItem;
|
||||
private javax.swing.JLabel totalPageLabel;
|
||||
// End of variables declaration
|
||||
// End of variables declaration//GEN-END:variables
|
||||
private ETable resultsTable;
|
||||
|
||||
private void customizeComponents() {
|
||||
@ -548,10 +548,6 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
||||
totalPageLabel.setText(Integer.toString(viewUpdate.numberOfPages));
|
||||
currentPageLabel.setText(Integer.toString(currentPage));
|
||||
artifactLabel.setText(viewUpdate.tableContents.getArtifactDisplayName());
|
||||
// @@@ This can take a long time. Perhaps a faster HTML renderer can be found.
|
||||
// Note that the rendering appears to be done on a background thread, since the
|
||||
// wait cursor reset below happens before the new text hits the JTextPane. On the
|
||||
// other hand, the UI is unresponsive...
|
||||
DefaultTableModel tModel = ((DefaultTableModel) resultsTable.getModel());
|
||||
tModel.setDataVector(viewUpdate.tableContents.getRows(), COLUMN_HEADERS);
|
||||
updateColumnSizes();
|
||||
@ -740,8 +736,7 @@ public class DataContentViewerArtifact extends javax.swing.JPanel implements Dat
|
||||
List<ResultsTableArtifact> artifactContents = getArtifactContents();
|
||||
ResultsTableArtifact artifactContent = artifactContents.get(pageIndex - 1);
|
||||
|
||||
// It may take a considerable amount of time to fetch the attributes of the selected artifact and render them
|
||||
// as HTML, so check for cancellation.
|
||||
// It may take a considerable amount of time to fetch the attributes of the selected artifact so check for cancellation.
|
||||
if (isCancelled()) {
|
||||
return null;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user