diff --git a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonAttributesSearchResultsViewerTable.java b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonAttributesSearchResultsViewerTable.java index a33e23ffa019f84eb09b7a022611660c82cf3706..92d4b1a2d95f696fe39818cf617431aefcd26688 100644 --- a/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonAttributesSearchResultsViewerTable.java +++ b/Core/src/org/sleuthkit/autopsy/commonfilesearch/CommonAttributesSearchResultsViewerTable.java @@ -1,16 +1,16 @@ /* - * + * * Autopsy Forensic Browser - * + * * Copyright 2018 Basis Technology Corp. * Contact: carrier <at> sleuthkit <dot> org - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -31,11 +31,11 @@ import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable; /** - * <code>DataResultViewerTable</code> which overrides the default column - * header width calculations. The <code>CommonAttributesSearchResultsViewerTable</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>CommonAttributesSearchResultsViewerTable</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 CommonAttributesSearchResultsViewerTable extends DataResultViewerTable { @@ -43,7 +43,7 @@ public class CommonAttributesSearchResultsViewerTable extends DataResultViewerTa private static final long serialVersionUID = 1L; private static final Logger LOGGER = Logger.getLogger(CommonAttributesSearchResultsViewerTable.class.getName()); - + private static final int DEFAULT_WIDTH = 100; static { @@ -59,19 +59,20 @@ public class CommonAttributesSearchResultsViewerTable extends DataResultViewerTa COLUMN_WIDTHS = Collections.unmodifiableMap(map); } + /** - * Implements a DataResultViewerTable which constructs a tabular result viewer that - * displays the children of the given root node using an OutlineView. The explorer - * manager will be discovered at runtime. - * - * Adds a TreeExpansionsListener to the outlineView to receive tree expansion events - * which dynamically loads children nodes when requested. + * Implements a DataResultViewerTable which constructs a tabular result + * viewer that displays the children of the given root node using an + * OutlineView. The explorer manager will be discovered at runtime. + * + * Adds a TreeExpansionsListener to the outlineView to receive tree + * expansion events which dynamically loads children nodes when requested. */ public CommonAttributesSearchResultsViewerTable() { super(); - outlineView.addTreeExpansionListener(new InstanceCountNodeTreeExpansionListener()); + addTreeExpansionListener(new InstanceCountNodeTreeExpansionListener()); } - + @NbBundle.Messages({ "CommonFilesSearchResultsViewerTable.noDescText= ", "CommonFilesSearchResultsViewerTable.filesColLbl=Files", @@ -95,8 +96,8 @@ protected void setColumnWidths() { final String headerValue = column.getHeaderValue().toString(); final Integer defaultWidth = COLUMN_WIDTHS.get(headerValue); - - if(defaultWidth == null){ + + if (defaultWidth == null) { column.setPreferredWidth(DEFAULT_WIDTH); LOGGER.log(Level.SEVERE, String.format("Tried to set width on a column not supported by the CommonFilesSearchResultsViewerTable: %s", headerValue)); } else { diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.form b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.form index 8ad47b32c7201febf3a7847e6ffd57676b59d04d..d6c32623a47296656b68c4ac0e9296edf825d193 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.form +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.form @@ -29,7 +29,6 @@ <Container class="org.openide.explorer.view.OutlineView" name="outlineView"> <AuxValues> <AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new OutlineView(DataResultViewerTable.FIRST_COLUMN_LABEL);"/> - <AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="4"/> </AuxValues> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java index 1679d0296ad320ec79e5c37a50d15434da0cdc09..bf18c4b8310611ac50643715639bfb0f1b1d76ab 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/DataResultViewerTable.java @@ -46,6 +46,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.event.TableColumnModelEvent; import javax.swing.event.TableColumnModelListener; +import javax.swing.event.TreeExpansionListener; import javax.swing.table.TableCellRenderer; import javax.swing.table.TableColumn; import javax.swing.table.TableColumnModel; @@ -265,6 +266,16 @@ public void setNode(Node rootNode) { } } + /** + * Adds a tree expansion listener to the OutlineView of this tabular results + * viewer. + * + * @param listener The listener + */ + protected void addTreeExpansionListener(TreeExpansionListener listener) { + outlineView.addTreeExpansionListener(listener); + } + /** * Sets up the Outline view of this tabular result viewer by creating column * headers based on the children of the current root node. The persisted @@ -1036,7 +1047,7 @@ private void initComponents() { ); }// </editor-fold>//GEN-END:initComponents // Variables declaration - do not modify//GEN-BEGIN:variables - protected org.openide.explorer.view.OutlineView outlineView; + private org.openide.explorer.view.OutlineView outlineView; // End of variables declaration//GEN-END:variables }