19 package org.sleuthkit.autopsy.datamodel;
21 import com.google.common.collect.ImmutableList;
23 import java.util.function.Function;
24 import java.util.stream.Collectors;
25 import java.util.stream.Stream;
26 import javafx.geometry.Insets;
27 import javafx.scene.Node;
28 import javafx.scene.Scene;
29 import javafx.scene.image.Image;
30 import javafx.scene.image.ImageView;
31 import javafx.scene.layout.Background;
32 import javafx.scene.layout.BackgroundFill;
33 import javafx.scene.layout.Border;
34 import javafx.scene.layout.BorderStroke;
35 import javafx.scene.layout.BorderStrokeStyle;
36 import javafx.scene.layout.BorderWidths;
37 import javafx.scene.layout.CornerRadii;
38 import javafx.scene.layout.Region;
39 import javafx.scene.paint.Color;
40 import org.openide.util.NbBundle;
45 @NbBundle.Messages({
"Category.one=CAT-1: Child Exploitation (Illegal)",
46 "Category.two=CAT-2: Child Exploitation (Non-Illegal/Age Difficult)",
47 "Category.three=CAT-3: CGI/Animation (Child Exploitive)",
48 "Category.four=CAT-4: Exemplar/Comparison (Internal Use Only)",
49 "Category.five=CAT-5: Non-pertinent",
50 "Category.zero=CAT-0: Uncategorized"})
58 ONE(Color.RED, 1, Bundle.Category_one()),
59 TWO(Color.ORANGE, 2, Bundle.Category_two()),
60 THREE(Color.YELLOW, 3, Bundle.Category_three()),
61 FOUR(Color.BISQUE, 4, Bundle.Category_four()),
62 FIVE(Color.GREEN, 5, Bundle.Category_five()),
63 ZERO(Color.LIGHTGREY, 0, Bundle.Category_zero());
65 private static final BorderWidths BORDER_WIDTHS_2 =
new BorderWidths(2);
66 private static final CornerRadii CORNER_RADII_4 =
new CornerRadii(4);
69 return nonZeroCategories;
72 private static final ImmutableList<DhsImageCategory> nonZeroCategories =
78 private static final Map<String, DhsImageCategory> nameMap =
80 Function.identity()));
83 return nameMap.get(displayName);
87 return nameMap.containsKey(tName);
91 return nameMap.containsKey(tName) ==
false;
103 this.displayName = name;
125 if (snapshot == null) {
126 Region region =
new Region();
127 region.setBackground(
new Background(
new BackgroundFill(getColor(), CORNER_RADII_4, Insets.EMPTY)));
128 region.setPrefSize(16, 16);
129 region.setBorder(
new Border(
new BorderStroke(getColor().darker(), BorderStrokeStyle.SOLID, CORNER_RADII_4, BORDER_WIDTHS_2)));
130 Scene scene =
new Scene(region, 16, 16, Color.TRANSPARENT);
131 snapshot = region.snapshot(null, null);
133 return new ImageView(snapshot);
static boolean isCategoryName(String tName)
DhsImageCategory(Color color, int id, String name)
static ImmutableList< DhsImageCategory > getNonZeroCategories()
static DhsImageCategory fromDisplayName(String displayName)
static boolean isNotCategoryName(String tName)
synchronized Node getGraphic()