Skip to content
Snippets Groups Projects
Unverified Commit a7b46a62 authored by Richard Cordovano's avatar Richard Cordovano Committed by GitHub
Browse files

Merge pull request #4213 from rcordovano/release-4.9.0

Restore encapsulation of OutlineView in DataResultViewerTable
parents 3d6df1d9 eccf7789
No related branches found
No related tags found
No related merge requests found
/* /*
* *
* Autopsy Forensic Browser * Autopsy Forensic Browser
* *
* Copyright 2018 Basis Technology Corp. * Copyright 2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org * Contact: carrier <at> sleuthkit <dot> org
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
* Unless required by applicable law or agreed to in writing, software * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, * distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
...@@ -31,11 +31,11 @@ ...@@ -31,11 +31,11 @@
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable; import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
/** /**
* <code>DataResultViewerTable</code> which overrides the default column * <code>DataResultViewerTable</code> which overrides the default column header
* header width calculations. The <code>CommonAttributesSearchResultsViewerTable</code> * width calculations. The <code>CommonAttributesSearchResultsViewerTable</code>
* presents multiple tiers of data which are not always present and it may not * 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 * 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. * rows and looking for wide cells. Rather, we just pick some reasonable values.
*/ */
public class CommonAttributesSearchResultsViewerTable extends DataResultViewerTable { public class CommonAttributesSearchResultsViewerTable extends DataResultViewerTable {
...@@ -43,7 +43,7 @@ public class CommonAttributesSearchResultsViewerTable extends DataResultViewerTa ...@@ -43,7 +43,7 @@ public class CommonAttributesSearchResultsViewerTable extends DataResultViewerTa
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private static final Logger LOGGER = Logger.getLogger(CommonAttributesSearchResultsViewerTable.class.getName()); private static final Logger LOGGER = Logger.getLogger(CommonAttributesSearchResultsViewerTable.class.getName());
private static final int DEFAULT_WIDTH = 100; private static final int DEFAULT_WIDTH = 100;
static { static {
...@@ -59,19 +59,20 @@ public class CommonAttributesSearchResultsViewerTable extends DataResultViewerTa ...@@ -59,19 +59,20 @@ public class CommonAttributesSearchResultsViewerTable extends DataResultViewerTa
COLUMN_WIDTHS = Collections.unmodifiableMap(map); COLUMN_WIDTHS = Collections.unmodifiableMap(map);
} }
/** /**
* Implements a DataResultViewerTable which constructs a tabular result viewer that * Implements a DataResultViewerTable which constructs a tabular result
* displays the children of the given root node using an OutlineView. The explorer * viewer that displays the children of the given root node using an
* manager will be discovered at runtime. * OutlineView. The explorer manager will be discovered at runtime.
* *
* Adds a TreeExpansionsListener to the outlineView to receive tree expansion events * Adds a TreeExpansionsListener to the outlineView to receive tree
* which dynamically loads children nodes when requested. * expansion events which dynamically loads children nodes when requested.
*/ */
public CommonAttributesSearchResultsViewerTable() { public CommonAttributesSearchResultsViewerTable() {
super(); super();
outlineView.addTreeExpansionListener(new InstanceCountNodeTreeExpansionListener()); addTreeExpansionListener(new InstanceCountNodeTreeExpansionListener());
} }
@NbBundle.Messages({ @NbBundle.Messages({
"CommonFilesSearchResultsViewerTable.noDescText= ", "CommonFilesSearchResultsViewerTable.noDescText= ",
"CommonFilesSearchResultsViewerTable.filesColLbl=Files", "CommonFilesSearchResultsViewerTable.filesColLbl=Files",
...@@ -95,8 +96,8 @@ protected void setColumnWidths() { ...@@ -95,8 +96,8 @@ protected void setColumnWidths() {
final String headerValue = column.getHeaderValue().toString(); final String headerValue = column.getHeaderValue().toString();
final Integer defaultWidth = COLUMN_WIDTHS.get(headerValue); final Integer defaultWidth = COLUMN_WIDTHS.get(headerValue);
if(defaultWidth == null){ if (defaultWidth == null) {
column.setPreferredWidth(DEFAULT_WIDTH); column.setPreferredWidth(DEFAULT_WIDTH);
LOGGER.log(Level.SEVERE, String.format("Tried to set width on a column not supported by the CommonFilesSearchResultsViewerTable: %s", headerValue)); LOGGER.log(Level.SEVERE, String.format("Tried to set width on a column not supported by the CommonFilesSearchResultsViewerTable: %s", headerValue));
} else { } else {
......
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
<Container class="org.openide.explorer.view.OutlineView" name="outlineView"> <Container class="org.openide.explorer.view.OutlineView" name="outlineView">
<AuxValues> <AuxValues>
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new OutlineView(DataResultViewerTable.FIRST_COLUMN_LABEL);"/> <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> </AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/> <Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.TableColumnModelEvent; import javax.swing.event.TableColumnModelEvent;
import javax.swing.event.TableColumnModelListener; import javax.swing.event.TableColumnModelListener;
import javax.swing.event.TreeExpansionListener;
import javax.swing.table.TableCellRenderer; import javax.swing.table.TableCellRenderer;
import javax.swing.table.TableColumn; import javax.swing.table.TableColumn;
import javax.swing.table.TableColumnModel; import javax.swing.table.TableColumnModel;
...@@ -265,6 +266,16 @@ public void setNode(Node rootNode) { ...@@ -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 * 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 * headers based on the children of the current root node. The persisted
...@@ -1036,7 +1047,7 @@ private void initComponents() { ...@@ -1036,7 +1047,7 @@ private void initComponents() {
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables // 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 // End of variables declaration//GEN-END:variables
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment