Autopsy  4.8.0
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  */
20 package org.sleuthkit.autopsy.commonfilesearch;
21 
22 import java.util.Collections;
23 import java.util.Enumeration;
24 import java.util.HashMap;
25 import java.util.Map;
26 import java.util.logging.Level;
27 import java.util.logging.Logger;
28 import javax.swing.table.TableColumn;
29 import javax.swing.table.TableColumnModel;
30 import org.openide.util.NbBundle;
33 
42 
43  private static final Map<String, Integer> COLUMN_WIDTHS;
44  private static final long serialVersionUID = 1L;
45 
46  private static final Logger LOGGER = Logger.getLogger(CommonAttributesSearchResultsViewerTable.class.getName());
47 
48  private static final int DEFAULT_WIDTH = 100;
49 
50  static {
51  Map<String, Integer> map = new HashMap<>();
52  map.put(Bundle.CommonFilesSearchResultsViewerTable_filesColLbl(), 260);
53  map.put(Bundle.CommonFilesSearchResultsViewerTable_instancesColLbl(), 65);
54  map.put(Bundle.CommonFilesSearchResultsViewerTable_pathColLbl(), 300);
55  map.put(Bundle.CommonFilesSearchResultsViewerTable_caseColLbl1(), 200);
56  map.put(Bundle.CommonFilesSearchResultsViewerTable_dataSourceColLbl(), 200);
57  map.put(Bundle.CommonFilesSearchResultsViewerTable_hashsetHitsColLbl(), 100);
58  map.put(Bundle.CommonFilesSearchResultsViewerTable_mimeTypeColLbl(), 130);
59  map.put(Bundle.CommonFilesSearchResultsViewerTable_tagsColLbl1(), 300);
60 
61  COLUMN_WIDTHS = Collections.unmodifiableMap(map);
62  }
72  super();
73  outlineView.addTreeExpansionListener(new DelayedLoadChildNodesOnTreeExpansion());
74  }
75 
76  @NbBundle.Messages({
77  "CommonFilesSearchResultsViewerTable.noDescText= ",
78  "CommonFilesSearchResultsViewerTable.filesColLbl=Files",
79  "CommonFilesSearchResultsViewerTable.instancesColLbl=Instances",
80  "CommonFilesSearchResultsViewerTable.pathColLbl=Parent Path",
81  "CommonFilesSearchResultsViewerTable.hashsetHitsColLbl=Hash Set Hits",
82  "CommonFilesSearchResultsViewerTable.caseColLbl1=Case",
83  "CommonFilesSearchResultsViewerTable.dataSourceColLbl=Data Source",
84  "CommonFilesSearchResultsViewerTable.mimeTypeColLbl=MIME Type",
85  "CommonFilesSearchResultsViewerTable.tagsColLbl1=Tags"
86  })
87  @Override
88  protected void setColumnWidths() {
89  TableColumnModel model = this.getColumnModel();
90 
91  Enumeration<TableColumn> columnsEnumerator = model.getColumns();
92  while (columnsEnumerator.hasMoreElements()) {
93 
94  TableColumn column = columnsEnumerator.nextElement();
95 
96  final String headerValue = column.getHeaderValue().toString();
97 
98  final Integer defaultWidth = COLUMN_WIDTHS.get(headerValue);
99 
100  if(defaultWidth == null){
101  column.setPreferredWidth(DEFAULT_WIDTH);
102  LOGGER.log(Level.SEVERE, String.format("Tried to set width on a column not supported by the CommonFilesSearchResultsViewerTable: %s", headerValue));
103  } else {
104  column.setPreferredWidth(defaultWidth);
105  }
106  }
107  }
108 }
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2018 Basis Technology. Generated on: Thu Oct 4 2018
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.