Autopsy  4.10.0
Graphical digital forensics platform for The Sleuth Kit and other tools.
MultiUserCaseNode.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2017-2019 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.casemodule.multiusercasesbrowser;
20 
21 import java.util.ArrayList;
22 import java.util.Arrays;
23 import java.util.List;
24 import javax.swing.Action;
25 import org.openide.nodes.AbstractNode;
26 import org.openide.nodes.Children;
27 import org.openide.nodes.Sheet;
28 import org.openide.util.lookup.Lookups;
32 
37 final class MultiUserCaseNode extends AbstractNode {
38 
39  private final CaseNodeData caseNodeData;
40  private final MultiUserCaseBrowserCustomizer customizer;
41 
50  MultiUserCaseNode(CaseNodeData caseNodeData, MultiUserCaseBrowserCustomizer customizer) {
51  super(Children.LEAF, Lookups.fixed(caseNodeData));
52  super.setName(caseNodeData.getDisplayName());
53  super.setDisplayName(caseNodeData.getDisplayName());
54  this.caseNodeData = caseNodeData;
55  this.customizer = customizer;
56  }
57 
58  @Override
59  protected Sheet createSheet() {
60  Sheet sheet = super.createSheet();
61  Sheet.Set sheetSet = sheet.get(Sheet.PROPERTIES);
62  if (sheetSet == null) {
63  sheetSet = Sheet.createPropertiesSet();
64  sheet.put(sheetSet);
65  }
66  for (Column property : customizer.getColumns()) {
67  String propName = property.getDisplayName();
68  switch (property) {
69  case CREATE_DATE:
70  sheetSet.put(new NodeProperty<>(propName, propName, propName, caseNodeData.getCreateDate()));
71  break;
72  case DIRECTORY:
73  sheetSet.put(new NodeProperty<>(propName, propName, propName, caseNodeData.getDirectory().toString()));
74  break;
75  case LAST_ACCESS_DATE:
76  sheetSet.put(new NodeProperty<>(propName, propName, propName, caseNodeData.getLastAccessDate()));
77  break;
78  default:
79  break;
80  }
81  }
82  return sheet;
83  }
84 
85  @Override
86  public Action[] getActions(boolean context) {
87  List<Action> actions = new ArrayList<>();
88  actions.addAll(customizer.getActions(caseNodeData));
89  actions.addAll(Arrays.asList(super.getActions(context)));
90  return actions.toArray(new Action[actions.size()]);
91  }
92 
93  @Override
94  public Action getPreferredAction() {
95  return customizer.getPreferredAction(caseNodeData);
96  }
97 
98 }

Copyright © 2012-2018 Basis Technology. Generated on: Fri Mar 22 2019
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.