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