19 package org.sleuthkit.autopsy.datasourcesummary.ui;
21 import java.awt.CardLayout;
22 import java.awt.Component;
23 import java.beans.PropertyChangeListener;
24 import java.util.Arrays;
25 import java.util.EnumSet;
26 import java.util.List;
27 import java.util.function.Consumer;
28 import org.openide.util.NbBundle.Messages;
38 "DataSourceSummaryTabbedPane_typesTab_title=Types",
39 "DataSourceSummaryTabbedPane_detailsTab_title=Container",
40 "DataSourceSummaryTabbedPane_userActivityTab_title=User Activity",
41 "DataSourceSummaryTabbedPane_ingestHistoryTab_title=Ingest History",
42 "DataSourceSummaryTabbedPane_recentFileTab_title=Recent Files",
43 "DataSourceSummaryTabbedPane_pastCasesTab_title=Past Cases",
44 "DataSourceSummaryTabbedPane_analysisTab_title=Analysis",
45 "DataSourceSummaryTabbedPane_geolocationTab_title=Geolocation",
46 "DataSourceSummaryTabbedPane_timelineTab_title=Timeline"
56 private final String tabTitle;
57 private final Component component;
58 private final Consumer<DataSource> onDataSource;
59 private final Runnable onClose;
69 DataSourceTab(String tabTitle, Component component, Consumer<DataSource> onDataSource, Runnable onClose) {
70 this.tabTitle = tabTitle;
71 this.component = component;
72 this.onDataSource = onDataSource;
73 this.onClose = onClose;
83 DataSourceTab(String tabTitle, BaseDataSourceSummaryPanel panel) {
85 panel.setParentCloseListener(() -> notifyParentClose());
87 this.tabTitle = tabTitle;
88 this.component = panel;
89 this.onDataSource = panel::setDataSource;
90 this.onClose = panel::close;
96 String getTabTitle() {
103 Component getComponent() {
110 Consumer<DataSource> getOnDataSource() {
122 private static final long serialVersionUID = 1L;
124 private static final String TABBED_PANE =
"tabbedPane";
125 private static final String NO_DATASOURCE_PANE =
"noDataSourcePane";
127 private Runnable notifyParentClose = null;
130 private final List<DataSourceTab> tabs = Arrays.asList(
131 new DataSourceTab(Bundle.DataSourceSummaryTabbedPane_typesTab_title(),
new TypesPanel()),
139 new DataSourceTab(Bundle.DataSourceSummaryTabbedPane_ingestHistoryTab_title(), ingestHistoryPanel, ingestHistoryPanel::setDataSource, () -> {
141 new DataSourceTab(Bundle.DataSourceSummaryTabbedPane_detailsTab_title(),
new ContainerPanel())
144 private DataSource dataSource = null;
150 private final PropertyChangeListener caseEventsListener = (evt) -> {
169 if (notifyParentClose != null) {
170 notifyParentClose.run();
179 void setParentCloseListener(Runnable parentCloseAction) {
180 notifyParentClose = parentCloseAction;
188 cardLayout = (CardLayout) this.getLayout();
192 tabbedPane.addTab(tab.getTabTitle(), tab.getComponent());
196 cardLayout.show(
this, NO_DATASOURCE_PANE);
214 this.dataSource = dataSource;
217 tab.getOnDataSource().accept(dataSource);
220 if (this.dataSource == null) {
221 cardLayout.show(
this, NO_DATASOURCE_PANE);
223 cardLayout.show(
this, TABBED_PANE);
232 tab.getOnClose().run();
243 @SuppressWarnings(
"unchecked")
245 private
void initComponents() {
247 tabbedPane =
new javax.swing.JTabbedPane();
248 javax.swing.JPanel noDataSourcePane =
new javax.swing.JPanel();
249 javax.swing.JLabel noDataSourceLabel =
new javax.swing.JLabel();
251 setLayout(
new java.awt.CardLayout());
252 add(tabbedPane,
"tabbedPane");
254 noDataSourcePane.setLayout(
new java.awt.BorderLayout());
256 noDataSourceLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
257 org.openide.awt.Mnemonics.setLocalizedText(noDataSourceLabel,
org.openide.util.NbBundle.getMessage(
DataSourceSummaryTabbedPane.class,
"DataSourceSummaryTabbedPane.noDataSourceLabel.text"));
258 noDataSourcePane.add(noDataSourceLabel, java.awt.BorderLayout.CENTER);
260 add(noDataSourcePane,
"noDataSourcePane");
DataSourceSummaryTabbedPane()
void setDataSource(DataSource dataSource)
DataSource getDataSource()
javax.swing.JTabbedPane tabbedPane
static void addEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)
static void removeEventTypeSubscriber(Set< Events > eventTypes, PropertyChangeListener subscriber)