19 package org.sleuthkit.autopsy.corecomponents;
21 import java.util.ArrayList;
22 import java.util.Collection;
23 import java.util.Collections;
24 import java.util.List;
25 import java.util.logging.Level;
26 import javax.swing.JComponent;
27 import org.openide.explorer.ExplorerManager;
28 import org.openide.explorer.ExplorerUtils;
29 import org.openide.nodes.Node;
30 import org.openide.util.NbBundle;
31 import org.openide.windows.Mode;
32 import org.openide.windows.RetainLocation;
33 import org.openide.windows.TopComponent;
34 import org.openide.windows.WindowManager;
70 @RetainLocation(
"editor")
71 @SuppressWarnings(
"PMD.SingularField")
75 private static final List<String> activeComponentIds = Collections.synchronizedList(
new ArrayList<String>());
101 initInstance(description, node, childNodeCount, resultViewTopComponent);
102 return resultViewTopComponent;
126 initInstance(description, node, childNodeCount, resultViewTopComponent);
127 return resultViewTopComponent;
148 return resultViewTopComponent;
163 resultViewTopComponent.
open();
164 resultViewTopComponent.
setNode(node);
165 resultViewTopComponent.
setPath(description);
166 resultViewTopComponent.requestActive();
191 initInstance(description, node, childNodeCount, newDataResult);
192 return newDataResult;
236 this.isMain = isMain;
237 this.explorerManager =
new ExplorerManager();
238 associateLookup(ExplorerUtils.createLookup(explorerManager, getActionMap()));
239 this.customModeName = mode;
240 this.dataResultPanel =
new DataResultPanel(title, isMain, viewers, contentViewTopComponent);
242 customizeComponent(title);
251 putClientProperty(TopComponent.PROP_CLOSING_DISABLED, isMain);
252 putClientProperty(TopComponent.PROP_MAXIMIZATION_DISABLED,
true);
253 putClientProperty(TopComponent.PROP_DRAGGING_DISABLED,
true);
254 activeComponentIds.add(title);
259 return explorerManager;
269 return new ArrayList<>(activeComponentIds);
274 if (customModeName == null) {
275 return TopComponent.PERSISTENCE_NEVER;
277 return TopComponent.PERSISTENCE_ALWAYS;
283 if (customModeName != null) {
284 Mode mode = WindowManager.getDefault().findMode(customModeName);
286 logger.log(Level.INFO,
"Found custom mode, setting: {0}", customModeName);
289 logger.log(Level.WARNING,
"Could not find mode: {0}, will dock into the default one", customModeName);
302 super.componentOpened();
303 this.dataResultPanel.
open();
308 super.componentActivated();
316 final Node[] nodeList = explorerManager.getSelectedNodes();
319 if (nodeList.length == 1) {
320 selectedNode = nodeList[0];
333 if (selectedNode != dataContentTopComponent.getNode()) {
334 dataContentTopComponent.
setNode(selectedNode);
340 super.componentClosed();
341 activeComponentIds.remove(this.getName());
342 dataResultPanel.close();
357 dataResultPanel.
setNode(selectedNode);
367 dataResultPanel.
setPath(pathText);
383 return (!this.isMain) || openCase.
hasData() ==
false;
413 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
414 this.setLayout(layout);
415 layout.setHorizontalGroup(
416 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
417 .addComponent(dataResultPanelLocal, javax.swing.GroupLayout.DEFAULT_SIZE, 967, Short.MAX_VALUE)
419 layout.setVerticalGroup(
420 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
421 .addComponent(dataResultPanelLocal, javax.swing.GroupLayout.DEFAULT_SIZE, 579, Short.MAX_VALUE)
void setNumberOfChildNodes(Integer numberOfChildNodes)
final DataResultPanel dataResultPanel
static final KeyStroke BOOKMARK_SHORTCUT
List< DataResultViewer > getViewers()
void resetTabs(Node node)
void setNode(Node selectedNode)
static DataResultTopComponent createInstance(String title, String description, Node node, int childNodeCount, Collection< DataResultViewer > viewers)
void customizeComponent(String title)
void setTitle(String title)
void setPath(String description)
static DataResultTopComponent createInstance(String title, String description, Node node, int childNodeCount)
static List< String > getActiveComponentIds()
void setNode(Node rootNode)
List< DataResultViewer > getViewers()
static synchronized DataContentTopComponent findInstance()
DataResultTopComponent(boolean isMain, String title, String mode, Collection< DataResultViewer > viewers, DataContentTopComponent contentViewTopComponent)
static void initInstance(String description, Node node, int childNodeCount, DataResultTopComponent resultViewTopComponent)
void setSelectedNodes(Node[] selectedNodes)
final ExplorerManager explorerManager
DataResultTopComponent(boolean isMain, String title)
final String customModeName
void componentActivated()
synchronized static Logger getLogger(String name)
static Case getCurrentCaseThrows()
DataResultTopComponent(String title)
ExplorerManager getExplorerManager()
void setSelectedNodes(Node[] selected)
void setPath(String pathText)
static DataResultTopComponent createInstance(String title, String mode, String description, Node node, int childNodeCount, DataContentTopComponent contentViewTopComponent)
void setNumberOfChildNodes(int childNodeCount)
static DataResultTopComponent createInstance(String title)
void setNode(Node selectedNode)