Autopsy  4.1
Graphical digital forensics platform for The Sleuth Kit and other tools.
CueBannerPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2017 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;
20 
21 import java.awt.Dialog;
22 import java.awt.Dimension;
23 import java.awt.event.ActionEvent;
24 import java.awt.event.ActionListener;
25 import java.awt.event.KeyEvent;
26 import javax.swing.ImageIcon;
27 import javax.swing.JComponent;
28 import javax.swing.JDialog;
29 import javax.swing.KeyStroke;
30 import org.openide.util.Lookup;
31 import org.openide.util.NbBundle;
32 import org.openide.windows.WindowManager;
33 
34 /*
35  * The panel in the default Autopsy startup window.
36  */
37 public class CueBannerPanel extends javax.swing.JPanel {
38 
39  private static final long serialVersionUID = 1L;
40  /*
41  * This is field is static for the sake of the closeOpenRecentCasesWindow
42  * method.
43  */
44  private static JDialog recentCasesWindow;
45 
46  public static void closeOpenRecentCasesWindow() {
47  if (null != recentCasesWindow) {
48  recentCasesWindow.setVisible(false);
49  }
50  }
51 
52  public CueBannerPanel() {
56  }
57 
58  public CueBannerPanel(String welcomeLogo) {
60  ClassLoader cl = Lookup.getDefault().lookup(ClassLoader.class);
61  if (cl != null) {
62  ImageIcon icon = new ImageIcon(cl.getResource(welcomeLogo));
63  autopsyLogo.setIcon(icon);
64  }
67  }
68 
69  public void setCloseButtonActionListener(ActionListener e) {
70  closeButton.addActionListener(e);
71  }
72 
73  public void setCloseButtonText(String text) {
74  closeButton.setText(text);
75  }
76 
77  public void refresh() {
79  }
80 
81  private void customizeComponents() {
82  recentCasesWindow = new JDialog(
83  WindowManager.getDefault().getMainWindow(),
84  NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.title.text"),
85  Dialog.ModalityType.APPLICATION_MODAL);
86  recentCasesWindow.setSize(new Dimension(750, 400));
87  recentCasesWindow.getRootPane().registerKeyboardAction(
88  e -> {
89  recentCasesWindow.setVisible(false);
90  },
91  KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
92  OpenRecentCasePanel recentCasesPanel = OpenRecentCasePanel.getInstance();
93  recentCasesPanel.setCloseButtonActionListener(new ActionListener() {
94  @Override
95  public void actionPerformed(ActionEvent e) {
96  recentCasesWindow.setVisible(false);
97  }
98  });
99  recentCasesWindow.add(recentCasesPanel);
100  recentCasesWindow.pack();
101  recentCasesWindow.setResizable(false);
102  }
103 
104  private void enableComponents() {
105  if (RecentCases.getInstance().getTotalRecentCases() == 0) {
106  openRecentButton.setEnabled(false);
107  openRecentLabel.setEnabled(false);
108  } else {
109  openRecentButton.setEnabled(true);
110  openRecentLabel.setEnabled(true);
111  }
112  }
113 
119  @SuppressWarnings("unchecked")
120  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
121  private void initComponents() {
122 
123  autopsyLogo = new javax.swing.JLabel();
124  this.autopsyLogo.setText("");
125  newCaseButton = new javax.swing.JButton();
126  openRecentButton = new javax.swing.JButton();
127  createNewLabel = new javax.swing.JLabel();
128  openRecentLabel = new javax.swing.JLabel();
129  openCaseButton = new javax.swing.JButton();
130  openLabel = new javax.swing.JLabel();
131  closeButton = new javax.swing.JButton();
132  jSeparator1 = new javax.swing.JSeparator();
133 
134  autopsyLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/casemodule/welcome_logo.png"))); // NOI18N
135  autopsyLogo.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.autopsyLogo.text")); // NOI18N
136 
137  newCaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/casemodule/btn_icon_create_new_case.png"))); // NOI18N
138  newCaseButton.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.newCaseButton.text")); // NOI18N
139  newCaseButton.setBorder(null);
140  newCaseButton.setBorderPainted(false);
141  newCaseButton.setContentAreaFilled(false);
142  newCaseButton.setPreferredSize(new java.awt.Dimension(64, 64));
143  newCaseButton.addActionListener(new java.awt.event.ActionListener() {
144  public void actionPerformed(java.awt.event.ActionEvent evt) {
146  }
147  });
148 
149  openRecentButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/casemodule/btn_icon_open_recent.png"))); // NOI18N
150  openRecentButton.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.openRecentButton.text")); // NOI18N
151  openRecentButton.setBorder(null);
152  openRecentButton.setBorderPainted(false);
153  openRecentButton.setContentAreaFilled(false);
154  openRecentButton.setPreferredSize(new java.awt.Dimension(64, 64));
155  openRecentButton.addActionListener(new java.awt.event.ActionListener() {
156  public void actionPerformed(java.awt.event.ActionEvent evt) {
158  }
159  });
160 
161  createNewLabel.setFont(createNewLabel.getFont().deriveFont(createNewLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 13));
162  createNewLabel.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.createNewLabel.text")); // NOI18N
163 
164  openRecentLabel.setFont(openRecentLabel.getFont().deriveFont(openRecentLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 13));
165  openRecentLabel.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.openRecentLabel.text")); // NOI18N
166 
167  openCaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/casemodule/btn_icon_open_existing.png"))); // NOI18N
168  openCaseButton.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.openCaseButton.text")); // NOI18N
169  openCaseButton.setBorder(null);
170  openCaseButton.setBorderPainted(false);
171  openCaseButton.setContentAreaFilled(false);
172  openCaseButton.setMargin(new java.awt.Insets(1, 1, 1, 1));
173  openCaseButton.setPreferredSize(new java.awt.Dimension(64, 64));
174  openCaseButton.addActionListener(new java.awt.event.ActionListener() {
175  public void actionPerformed(java.awt.event.ActionEvent evt) {
177  }
178  });
179 
180  openLabel.setFont(openLabel.getFont().deriveFont(openLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 13));
181  openLabel.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.openLabel.text")); // NOI18N
182 
183  closeButton.setFont(closeButton.getFont().deriveFont(closeButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
184  closeButton.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.closeButton.text")); // NOI18N
185 
186  jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
187 
188  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
189  this.setLayout(layout);
190  layout.setHorizontalGroup(
191  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
192  .addGroup(layout.createSequentialGroup()
193  .addContainerGap()
194  .addComponent(autopsyLogo)
195  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
196  .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 5, javax.swing.GroupLayout.PREFERRED_SIZE)
197  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
198  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
199  .addComponent(newCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
200  .addComponent(openRecentButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
201  .addComponent(openCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
202  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
203  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
204  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
205  .addComponent(createNewLabel)
206  .addComponent(openRecentLabel)
207  .addComponent(openLabel))
208  .addComponent(closeButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
209  .addContainerGap())
210  );
211  layout.setVerticalGroup(
212  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
213  .addGroup(layout.createSequentialGroup()
214  .addContainerGap()
215  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
216  .addGroup(layout.createSequentialGroup()
217  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
218  .addComponent(newCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
219  .addComponent(createNewLabel))
220  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
221  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
222  .addComponent(openRecentButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
223  .addComponent(openRecentLabel))
224  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
225  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
226  .addComponent(openCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
227  .addComponent(openLabel))
228  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
229  .addComponent(closeButton))
230  .addComponent(jSeparator1)
231  .addComponent(autopsyLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE))
232  .addContainerGap())
233  );
234  }// </editor-fold>//GEN-END:initComponents
235 
236  private void newCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newCaseButtonActionPerformed
237  Lookup.getDefault().lookup(CaseNewActionInterface.class).actionPerformed(evt);
238  }//GEN-LAST:event_newCaseButtonActionPerformed
239 
240  private void openCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openCaseButtonActionPerformed
241  Lookup.getDefault().lookup(CaseOpenAction.class).actionPerformed(evt);
242  }//GEN-LAST:event_openCaseButtonActionPerformed
243 
244  private void openRecentButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openRecentButtonActionPerformed
245  recentCasesWindow.setLocationRelativeTo(WindowManager.getDefault().getMainWindow());
246  OpenRecentCasePanel.getInstance(); //refreshes the recent cases table
247  recentCasesWindow.setVisible(true);
248  }//GEN-LAST:event_openRecentButtonActionPerformed
249 
250  // Variables declaration - do not modify//GEN-BEGIN:variables
251  private javax.swing.JLabel autopsyLogo;
252  private javax.swing.JButton closeButton;
253  private javax.swing.JLabel createNewLabel;
254  private javax.swing.JSeparator jSeparator1;
255  private javax.swing.JButton newCaseButton;
256  private javax.swing.JButton openCaseButton;
257  private javax.swing.JLabel openLabel;
258  private javax.swing.JButton openRecentButton;
259  private javax.swing.JLabel openRecentLabel;
260  // End of variables declaration//GEN-END:variables
261 
262 }
void openRecentButtonActionPerformed(java.awt.event.ActionEvent evt)
void newCaseButtonActionPerformed(java.awt.event.ActionEvent evt)
void openCaseButtonActionPerformed(java.awt.event.ActionEvent evt)

Copyright © 2012-2016 Basis Technology. Generated on: Mon Apr 24 2017
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.