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;
46 @NbBundle.Messages({
"Category.one=CAT-1: Child Exploitation (Illegal)",
47 "Category.two=CAT-2: Child Exploitation (Non-Illegal/Age Difficult)",
48 "Category.three=CAT-3: CGI/Animation (Child Exploitive)",
49 "Category.four=CAT-4: Exemplar/Comparison (Internal Use Only)",
50 "Category.five=CAT-5: Non-pertinent",
51 "Category.zero=CAT-0: Uncategorized"})
59 ONE(Color.RED, 1, Bundle.Category_one()),
60 TWO(Color.ORANGE, 2, Bundle.Category_two()),
61 THREE(Color.YELLOW, 3, Bundle.Category_three()),
62 FOUR(Color.BISQUE, 4, Bundle.Category_four()),
63 FIVE(Color.GREEN, 5, Bundle.Category_five()),
64 ZERO(Color.LIGHTGREY, 0, Bundle.Category_zero());
66 private static final BorderWidths BORDER_WIDTHS_2 =
new BorderWidths(2);
67 private static final CornerRadii CORNER_RADII_4 =
new CornerRadii(4);
70 return nonZeroCategories;
73 private static final ImmutableList<DhsImageCategory> nonZeroCategories =
79 private static final Map<String, DhsImageCategory> nameMap =
81 Function.identity()));
84 return nameMap.get(displayName);
88 return nameMap.containsKey(tName);
92 return nameMap.containsKey(tName) ==
false;
104 this.displayName = name;
126 if (snapshot == null) {
127 Region region =
new Region();
128 region.setBackground(
new Background(
new BackgroundFill(getColor(), CORNER_RADII_4, Insets.EMPTY)));
129 region.setPrefSize(16, 16);
130 region.setBorder(
new Border(
new BorderStroke(getColor().darker(), BorderStrokeStyle.SOLID, CORNER_RADII_4, BORDER_WIDTHS_2)));
131 Scene scene =
new Scene(region, 16, 16, Color.TRANSPARENT);
132 snapshot = region.snapshot(null, null);
134 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()