Autopsy 4.22.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
CommonAttributesSearchResultsViewerTable.java
Go to the documentation of this file.
1/*
2 *
3 * Autopsy Forensic Browser
4 *
5 * Copyright 2018 Basis Technology Corp.
6 * Contact: carrier <at> sleuthkit <dot> org
7 *
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 */
20package org.sleuthkit.autopsy.commonpropertiessearch;
21
22import java.util.Collections;
23import java.util.Enumeration;
24import java.util.HashMap;
25import java.util.Map;
26import java.util.logging.Level;
27import org.sleuthkit.autopsy.coreutils.Logger;
28import javax.swing.table.TableColumn;
29import javax.swing.table.TableColumnModel;
30import org.openide.util.NbBundle;
31import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
32import org.sleuthkit.autopsy.datamodel.AbstractAbstractFileNode;
33
42
43 private static final Map<String, Integer> COLUMN_WIDTHS;
44 private static final long serialVersionUID = 1L;
45
47
48 private static final int DEFAULT_WIDTH = 100;
49
50 static {
51 Map<String, Integer> map = new HashMap<>();
52 map.put(NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.nameColLbl"), 260);
53 map.put(NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.createSheet.score.name"), 20);
54 map.put(NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.createSheet.comment.name"), 20);
55 map.put(NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.createSheet.count.name"), 20);
56 map.put(Bundle.CommonFilesSearchResultsViewerTable_instancesColLbl(), 65);
57 map.put(Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), 300);
58 map.put(Bundle.CommonFilesSearchResultsViewerTable_caseColLbl(), 200);
59 map.put(Bundle.CommonFilesSearchResultsViewerTable_localPath(), 200);
60 map.put(Bundle.CommonFilesSearchResultsViewerTable_valueColLbl(), 200);
61 map.put(Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), 200);
62 map.put(NbBundle.getMessage(AbstractAbstractFileNode.class, "AbstractAbstractFileNode.mimeType"), 130);
63
64 COLUMN_WIDTHS = Collections.unmodifiableMap(map);
65 }
66
76 super();
77 addTreeExpansionListener(new InstanceCountNodeTreeExpansionListener());
78 }
79
80 @NbBundle.Messages({
81 "CommonFilesSearchResultsViewerTable.noDescText= ",
82 "CommonFilesSearchResultsViewerTable.instancesColLbl=Instances",
83 "CommonFilesSearchResultsViewerTable.localPath=Parent Path in Current Case",
84 "CommonFilesSearchResultsViewerTable.pathColLbl=Parent Path",
85 "CommonFilesSearchResultsViewerTable.caseColLbl=Case",
86 "CommonFilesSearchResultsViewerTable.valueColLbl=Value",
87 "CommonFilesSearchResultsViewerTable.dataSourceColLbl=Data Source",
88 })
89 @Override
90 protected void setColumnWidths() {
91 TableColumnModel model = this.getColumnModel();
92
93 Enumeration<TableColumn> columnsEnumerator = model.getColumns();
94 while (columnsEnumerator.hasMoreElements()) {
95
96 TableColumn column = columnsEnumerator.nextElement();
97
98 final String headerValue = column.getHeaderValue().toString();
99
100 final Integer defaultWidth = COLUMN_WIDTHS.get(headerValue);
101
102 if (defaultWidth == null) {
103 column.setPreferredWidth(DEFAULT_WIDTH);
104 LOGGER.log(Level.WARNING, String.format("Tried to set width on a column not supported by the CommonAttributesSearchResultsViewerTable: %s", headerValue));
105 } else {
106 column.setPreferredWidth(defaultWidth);
107 }
108 }
109 }
110}
synchronized static Logger getLogger(String name)
Definition Logger.java:124

Copyright © 2012-2024 Sleuth Kit Labs. Generated on:
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.