formatting

This commit is contained in:
Greg DiCristofaro 2020-09-22 15:46:21 -04:00
parent 690a799059
commit 3dd03d1683
3 changed files with 45 additions and 16 deletions

View File

@ -32,7 +32,6 @@ import java.util.stream.Collectors;
import java.util.stream.Stream; import java.util.stream.Stream;
import javax.swing.JLabel; import javax.swing.JLabel;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.openide.util.NbBundle.Messages; import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.coreutils.FileTypeUtils.FileTypeCategory; import org.sleuthkit.autopsy.coreutils.FileTypeUtils.FileTypeCategory;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
@ -154,29 +153,56 @@ class TypesPanel extends BaseDataSourceSummaryPanel {
} }
} }
/**
* Information concerning a particular category in the file types pie chart.
*/
private static class TypesPieCategory { private static class TypesPieCategory {
private final String label; private final String label;
private final Set<String> mimeTypes; private final Set<String> mimeTypes;
private final Color color; private final Color color;
/**
* Main constructor.
*
* @param label The label for this slice.
* @param mimeTypes The mime types associated with this slice.
* @param color The color associated with this slice.
*/
TypesPieCategory(String label, Set<String> mimeTypes, Color color) { TypesPieCategory(String label, Set<String> mimeTypes, Color color) {
this.label = label; this.label = label;
this.mimeTypes = mimeTypes; this.mimeTypes = mimeTypes;
this.color = color; this.color = color;
} }
/**
* Constructor that accepts FileTypeCategory.
*
* @param label The label for this slice.
* @param mimeTypes The mime types associated with this slice.
* @param color The color associated with this slice.
*/
TypesPieCategory(String label, FileTypeCategory fileCategory, Color color) { TypesPieCategory(String label, FileTypeCategory fileCategory, Color color) {
this(label, fileCategory.getMediaTypes(), color); this(label, fileCategory.getMediaTypes(), color);
} }
/**
* @return The label for this category.
*/
String getLabel() { String getLabel() {
return label; return label;
} }
/**
* @return The mime types associated with this category.
*/
Set<String> getMimeTypes() { Set<String> getMimeTypes() {
return mimeTypes; return mimeTypes;
} }
/**
* @return The color associated with this category.
*/
Color getColor() { Color getColor() {
return color; return color;
} }
@ -193,9 +219,9 @@ class TypesPanel extends BaseDataSourceSummaryPanel {
private static final Color VIDEOS_COLOR = Color.YELLOW; private static final Color VIDEOS_COLOR = Color.YELLOW;
private static final Color AUDIO_COLOR = Color.BLUE; private static final Color AUDIO_COLOR = Color.BLUE;
private static final Color DOCUMENTS_COLOR = Color.GREEN; private static final Color DOCUMENTS_COLOR = Color.GREEN;
private static final Color EXECUTABLES_COLOR = new Color(0,188,212); private static final Color EXECUTABLES_COLOR = new Color(0, 188, 212);
private static final Color UNKNOWN_COLOR = Color.ORANGE; private static final Color UNKNOWN_COLOR = Color.ORANGE;
private static final Color OTHER_COLOR = new Color(78,52,46); private static final Color OTHER_COLOR = new Color(78, 52, 46);
private static final Color NOT_ANALYZED_COLOR = Color.WHITE; private static final Color NOT_ANALYZED_COLOR = Color.WHITE;
// All file type categories. // All file type categories.
@ -331,7 +357,8 @@ class TypesPanel extends BaseDataSourceSummaryPanel {
/** /**
* Gets all the data for the file type pie chart. * Gets all the data for the file type pie chart.
* *
* @param dataSource The datasource. * @param mimeTypeData The means of acquiring data.
* @param dataSource The datasource.
* *
* @return The pie chart items. * @return The pie chart items.
*/ */
@ -374,9 +401,11 @@ class TypesPanel extends BaseDataSourceSummaryPanel {
PieChartItem notAnalyzedItem = new PieChartItem(Bundle.TypesPanel_fileMimeTypesChart_notAnalyzed_title(), PieChartItem notAnalyzedItem = new PieChartItem(Bundle.TypesPanel_fileMimeTypesChart_notAnalyzed_title(),
noMimeTypeCount, NOT_ANALYZED_COLOR); noMimeTypeCount, NOT_ANALYZED_COLOR);
// combine categories with 'other' and 'not analyzed'
List<PieChartItem> items = Stream.concat( List<PieChartItem> items = Stream.concat(
fileCategoryItems.stream(), fileCategoryItems.stream(),
Stream.of(otherPieItem, notAnalyzedItem)) Stream.of(otherPieItem, notAnalyzedItem))
// remove items that have no value
.filter(slice -> slice.getValue() > 0) .filter(slice -> slice.getValue() > 0)
.collect(Collectors.toList()); .collect(Collectors.toList());