19 package org.sleuthkit.autopsy.report;
21 import java.awt.Component;
22 import java.awt.Dimension;
23 import java.awt.Toolkit;
24 import java.awt.event.MouseAdapter;
25 import java.awt.event.MouseEvent;
26 import java.util.ArrayList;
27 import java.util.Collections;
28 import java.util.Comparator;
29 import java.util.EnumMap;
30 import java.util.List;
32 import java.util.logging.Level;
33 import javax.swing.JCheckBox;
34 import javax.swing.JLabel;
35 import javax.swing.JList;
36 import javax.swing.ListCellRenderer;
37 import javax.swing.ListModel;
38 import javax.swing.event.ListDataListener;
39 import org.openide.util.NbBundle;
66 @SuppressWarnings(
"deprecation")
75 Collections.sort(
artifacts,
new Comparator<BlackboardArtifact.ARTIFACT_TYPE>() {
84 artifactStates.put(type, Boolean.TRUE);
100 public void mousePressed(MouseEvent evt) {
101 int index =
artifactList.locationToIndex(evt.getPoint());
103 artifactStates.put(type, !artifactStates.get(type));
113 this.setTitle(NbBundle.getMessage(
this.getClass(),
"ArtifactSelectionDialog.dlgTitle.text"));
114 Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
116 int w = this.getSize().width;
117 int h = this.getSize().height;
120 setLocation((screenDimension.width - w) / 2, (screenDimension.height - h) / 2);
122 this.setVisible(
true);
131 @SuppressWarnings(
"unchecked")
137 okButton =
new javax.swing.JButton();
142 setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
144 artifactList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
145 artifactList.setLayoutOrientation(javax.swing.JList.HORIZONTAL_WRAP);
149 okButton.addActionListener(
new java.awt.event.ActionListener() {
150 public void actionPerformed(java.awt.event.ActionEvent evt) {
158 selectAllButton.addActionListener(
new java.awt.event.ActionListener() {
159 public void actionPerformed(java.awt.event.ActionEvent evt) {
166 public void actionPerformed(java.awt.event.ActionEvent evt) {
171 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(getContentPane());
172 getContentPane().setLayout(layout);
173 layout.setHorizontalGroup(
174 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
175 .addGroup(layout.createSequentialGroup()
177 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
178 .addGroup(layout.createSequentialGroup()
180 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
181 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
182 .addComponent(
deselectAllButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
183 .addComponent(
selectAllButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
184 .addGroup(layout.createSequentialGroup()
186 .addGap(0, 221, Short.MAX_VALUE))
187 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
188 .addGap(0, 0, Short.MAX_VALUE)
192 layout.setVerticalGroup(
193 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
194 .addGroup(layout.createSequentialGroup()
197 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
198 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
199 .addComponent(
artifactScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 224, Short.MAX_VALUE)
200 .addGroup(layout.createSequentialGroup()
202 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
204 .addGap(0, 0, Short.MAX_VALUE)))
219 artifactStates.put(type, Boolean.TRUE);
226 artifactStates.put(type, Boolean.FALSE);
260 private class ArtifactRenderer extends JCheckBox implements ListCellRenderer<BlackboardArtifact.ARTIFACT_TYPE> {
265 setEnabled(list.isEnabled());
266 setSelected(artifactStates.get(value));
267 setFont(list.getFont());
268 setBackground(list.getBackground());
269 setForeground(list.getForeground());
ArtifactSelectionDialog(java.awt.Frame parent, boolean modal)
void selectAllButtonActionPerformed(java.awt.event.ActionEvent evt)
void removeListDataListener(ListDataListener l)
Component getListCellRendererComponent(JList<?extends ARTIFACT_TYPE > list, ARTIFACT_TYPE value, int index, boolean isSelected, boolean cellHasFocus)
Map< BlackboardArtifact.ARTIFACT_TYPE, Boolean > artifactStates
javax.swing.JButton okButton
void deselectAllButtonActionPerformed(java.awt.event.ActionEvent evt)
List< BlackboardArtifact.ARTIFACT_TYPE > artifacts
ArrayList< BlackboardArtifact.ARTIFACT_TYPE > getBlackboardArtifactTypesInUse()
ARTIFACT_TYPE getElementAt(int index)
ArtifactRenderer renderer
void okButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JLabel titleLabel
javax.swing.JButton selectAllButton
SleuthkitCase getSleuthkitCase()
void addListDataListener(ListDataListener l)
javax.swing.JButton deselectAllButton
javax.swing.JList< ARTIFACT_TYPE > artifactList
javax.swing.JScrollPane artifactScrollPane
static Case getCurrentCase()
static Logger getLogger(String name)