19 package org.sleuthkit.autopsy.communications.relationships;
21 import java.awt.Component;
22 import java.awt.KeyboardFocusManager;
23 import java.beans.PropertyChangeEvent;
24 import java.beans.PropertyChangeListener;
25 import static javax.swing.SwingUtilities.isDescendingFrom;
26 import javax.swing.event.TableModelEvent;
27 import javax.swing.event.TableModelListener;
28 import javax.swing.table.TableColumn;
29 import org.netbeans.swing.outline.DefaultOutlineModel;
30 import org.netbeans.swing.outline.Outline;
31 import org.openide.explorer.ExplorerManager;
32 import static org.openide.explorer.ExplorerUtils.createLookup;
33 import org.openide.nodes.AbstractNode;
34 import org.openide.nodes.ChildFactory;
35 import org.openide.nodes.Children;
36 import org.openide.nodes.Node;
37 import org.openide.util.Lookup;
47 public class MessagesPanel extends javax.swing.JPanel implements Lookup.Provider {
63 messageContentViewer =
new MessageDataContent();
64 splitPane.setRightComponent(messageContentViewer);
72 "From", Bundle.MessageViewer_columnHeader_From(),
73 "To", Bundle.MessageViewer_columnHeader_To(),
74 "Date", Bundle.MessageViewer_columnHeader_Date(),
75 "Subject", Bundle.MessageViewer_columnHeader_Subject(),
76 "Attms", Bundle.MessageViewer_columnHeader_Attms()
78 outline.setRootVisible(
false);
79 ((DefaultOutlineModel) outline.getOutlineModel()).setNodesColumnLabel(
"Type");
82 if (evt.getPropertyName().equals(ExplorerManager.PROP_SELECTED_NODES)) {
85 if (nodes != null && nodes.length == 1) {
86 messageContentViewer.setNode(nodes[0]);
88 messageContentViewer.setNode(null);
98 public void tableChanged(TableModelEvent e) {
99 if (e.getType() == TableModelEvent.INSERT) {
100 outline.setRowSelectionInterval(0, 0);
105 TableColumn column = outline.getColumnModel().getColumn(1);
106 column.setCellRenderer(
new NodeTableCellRenderer());
108 column = outline.getColumnModel().getColumn(2);
109 column.setCellRenderer(
new NodeTableCellRenderer());
118 setChildFactory(nodeFactory);
131 ExplorerManager getExplorerManager() {
139 if (focusPropertyListener == null) {
142 focusPropertyListener = (
final PropertyChangeEvent focusEvent) -> {
143 if (focusEvent.getPropertyName().equalsIgnoreCase(
"focusOwner")) {
152 KeyboardFocusManager.getCurrentKeyboardFocusManager()
153 .addPropertyChangeListener(
"focusOwner", focusPropertyListener);
157 if (newFocusOwner == null) {
160 if (isDescendingFrom(newFocusOwner, messageContentViewer)) {
162 proxyLookup.
setNewLookups(createLookup((messageContentViewer).getExplorerManager(), getActionMap()));
163 }
else if (isDescendingFrom(newFocusOwner,
MessagesPanel.this)) {
172 super.removeNotify();
173 KeyboardFocusManager.getCurrentKeyboardFocusManager()
174 .removePropertyChangeListener(
"focusOwner", focusPropertyListener);
177 final void setChildFactory(ChildFactory<?> nodeFactory) {
182 Children.create(nodeFactory,
true)),
191 @SuppressWarnings(
"unchecked")
195 splitPane =
new javax.swing.JSplitPane();
198 setLayout(
new java.awt.BorderLayout());
200 splitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
203 add(
splitPane, java.awt.BorderLayout.CENTER);
ExplorerManager getExplorerManager()
org.sleuthkit.autopsy.communications.relationships.OutlineViewPanel outlineViewPanel
static final long serialVersionUID
PropertyChangeListener focusPropertyListener
void setTableColumnsWidth(double...percentages)
void handleFocusChange(Component newFocusOwner)
final ModifiableProxyLookup proxyLookup
void setNewLookups(final Lookup...lookups)
final MessageDataContent messageContentViewer
javax.swing.JSplitPane splitPane
OutlineView getOutlineView()