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;
71 @RetainLocation(
"editor")
72 @SuppressWarnings(
"PMD.SingularField")
76 private static final List<String> activeComponentIds = Collections.synchronizedList(
new ArrayList<String>());
102 initInstance(description, node, childNodeCount, resultViewTopComponent);
103 return resultViewTopComponent;
127 initInstance(description, node, childNodeCount, resultViewTopComponent);
128 return resultViewTopComponent;
149 return resultViewTopComponent;
164 resultViewTopComponent.
open();
165 resultViewTopComponent.
setNode(node);
166 resultViewTopComponent.
setPath(description);
167 resultViewTopComponent.requestActive();
192 initInstance(description, node, childNodeCount, newDataResult);
193 return newDataResult;
237 this.isMain = isMain;
238 this.explorerManager =
new ExplorerManager();
239 associateLookup(ExplorerUtils.createLookup(explorerManager, getActionMap()));
240 this.customModeName = mode;
241 this.dataResultPanel =
new DataResultPanel(title, isMain, viewers, contentViewTopComponent);
243 customizeComponent(title);
254 putClientProperty(TopComponent.PROP_CLOSING_DISABLED, isMain);
255 putClientProperty(TopComponent.PROP_MAXIMIZATION_DISABLED,
true);
256 putClientProperty(TopComponent.PROP_DRAGGING_DISABLED,
true);
257 activeComponentIds.add(title);
262 return explorerManager;
272 return new ArrayList<>(activeComponentIds);
277 if (customModeName == null) {
278 return TopComponent.PERSISTENCE_NEVER;
280 return TopComponent.PERSISTENCE_ALWAYS;
286 if (customModeName != null) {
287 Mode mode = WindowManager.getDefault().findMode(customModeName);
289 logger.log(Level.INFO,
"Found custom mode, setting: {0}", customModeName);
292 logger.log(Level.WARNING,
"Could not find mode: {0}, will dock into the default one", customModeName);
305 super.componentOpened();
306 this.dataResultPanel.
open();
311 super.componentActivated();
319 final Node[] nodeList = explorerManager.getSelectedNodes();
322 if (nodeList.length == 1) {
323 selectedNode = nodeList[0];
336 if (selectedNode != dataContentTopComponent.getNode()) {
337 dataContentTopComponent.
setNode(selectedNode);
343 super.componentClosed();
344 activeComponentIds.remove(this.getName());
345 dataResultPanel.close();
360 dataResultPanel.
setNode(selectedNode);
370 dataResultPanel.
setPath(pathText);
386 return (!this.isMain) || openCase.
hasData() ==
false;
416 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
417 this.setLayout(layout);
418 layout.setHorizontalGroup(
419 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
420 .addComponent(dataResultPanelLocal, javax.swing.GroupLayout.DEFAULT_SIZE, 967, Short.MAX_VALUE)
422 layout.setVerticalGroup(
423 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
424 .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)
static final KeyStroke EXTERNAL_VIEWER_SHORTCUT
final ExplorerManager explorerManager
DataResultTopComponent(boolean isMain, String title)
final String customModeName
static synchronized ExternalViewerShortcutAction getInstance()
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)