mirror of
https://github.com/elisspace/autopsy.git
synced 2026-09-28 13:30:00 +00:00
more logging
This commit is contained in:
@@ -24,7 +24,6 @@ import org.openide.util.HelpCtx;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.openide.util.actions.CallableSystemAction;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.core.Installer;
|
||||
import org.sleuthkit.datamodel.TskCoreException;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
|
||||
|
||||
+26
-17
@@ -23,23 +23,27 @@ import java.util.Collections;
|
||||
import java.util.Enumeration;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.table.TableColumn;
|
||||
import javax.swing.table.TableColumnModel;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
|
||||
|
||||
/**
|
||||
* <code>DataResultViewerTable</code> which overrides the default column
|
||||
* header width calculations. The <code>CommonFilesSearchResultsViewerTable</code>
|
||||
* presents multiple tiers of data which are not always present and it may not
|
||||
* make sense to try to calculate the column widths for such tables by sampling
|
||||
* rows and looking for wide cells. Rather, we just pick some reasonable values.
|
||||
* <code>DataResultViewerTable</code> which overrides the default column header
|
||||
* width calculations. The <code>CommonFilesSearchResultsViewerTable</code>
|
||||
* presents multiple tiers of data which are not always present and it may not
|
||||
* make sense to try to calculate the column widths for such tables by sampling
|
||||
* rows and looking for wide cells. Rather, we just pick some reasonable values.
|
||||
*/
|
||||
public class CommonFilesSearchResultsViewerTable extends DataResultViewerTable {
|
||||
|
||||
|
||||
private static final Map<String, Integer> COLUMN_WIDTHS;
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
|
||||
private static final Logger LOGGER = Logger.getLogger(CommonFilesSearchResultsViewerTable.class.getName());
|
||||
|
||||
static {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
map.put(Bundle.CommonFilesSearchResultsViewerTable_filesColLbl(), 260);
|
||||
@@ -49,10 +53,10 @@ public class CommonFilesSearchResultsViewerTable extends DataResultViewerTable {
|
||||
map.put(Bundle.CommonFilesSearchResultsViewerTable_hashsetHitsColLbl(), 100);
|
||||
map.put(Bundle.CommonFilesSearchResultsViewerTable_mimeTypeColLbl(), 130);
|
||||
map.put(Bundle.CommonFilesSearchResultsViewerTable_tagsColLbl1(), 300);
|
||||
|
||||
|
||||
COLUMN_WIDTHS = Collections.unmodifiableMap(map);
|
||||
}
|
||||
|
||||
|
||||
@NbBundle.Messages({
|
||||
"CommonFilesSearchResultsViewerTable.filesColLbl=Files",
|
||||
"CommonFilesSearchResultsViewerTable.instancesColLbl=Instances",
|
||||
@@ -63,18 +67,23 @@ public class CommonFilesSearchResultsViewerTable extends DataResultViewerTable {
|
||||
"CommonFilesSearchResultsViewerTable.tagsColLbl1=Tags"
|
||||
})
|
||||
@Override
|
||||
protected void setColumnWidths(){
|
||||
protected void setColumnWidths() {
|
||||
TableColumnModel model = this.getColumnModel();
|
||||
|
||||
|
||||
Enumeration<TableColumn> columnsEnumerator = model.getColumns();
|
||||
while(columnsEnumerator.hasMoreElements()){
|
||||
|
||||
while (columnsEnumerator.hasMoreElements()) {
|
||||
|
||||
TableColumn column = columnsEnumerator.nextElement();
|
||||
|
||||
|
||||
final String headerValue = column.getHeaderValue().toString();
|
||||
final Integer get = COLUMN_WIDTHS.get(headerValue);
|
||||
|
||||
column.setPreferredWidth(get);
|
||||
|
||||
try {
|
||||
final Integer get = COLUMN_WIDTHS.get(headerValue);
|
||||
|
||||
column.setPreferredWidth(get);
|
||||
} catch (NullPointerException e) {
|
||||
LOGGER.log(Level.WARNING, String.format("Tried to set width on a column not supported by the CommonFilesSearchResultsViewerTable: %s", headerValue), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user