Autopsy  3.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 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 
20 package org.sleuthkit.autopsy.casemodule;
21 
22 import java.awt.*;
23 import java.awt.Dialog;
24 import java.awt.Dimension;
25 import java.awt.Toolkit;
26 import java.awt.event.ActionEvent;
27 import java.awt.event.ActionListener;
28 import javax.swing.ImageIcon;
29 import javax.swing.JDialog;
30 import javax.swing.JFrame;
31 import javax.swing.JPanel;
32 import org.openide.util.Lookup;
33 import org.openide.util.NbBundle;
34 
38 public class CueBannerPanel extends javax.swing.JPanel {
39 
40  final private static String title = NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.title.text");
41  final private static JFrame frame = new JFrame(title);
42  final static JDialog recentCasesWindow = new JDialog(frame, title, true); // to make the popUp Window to be modal
43 
44  // for error handling
45  private static JPanel caller = new JPanel();
46  private String className = this.getClass().toString();
47 
48  public CueBannerPanel() {
50  refresh();
51  }
52 
53  public CueBannerPanel(String welcomeLogo) {
55  ClassLoader cl = Lookup.getDefault().lookup(ClassLoader.class);
56  if (cl != null) {
57  ImageIcon icon = new ImageIcon(cl.getResource(welcomeLogo));
58  autopsyLogo.setIcon(icon);
59  }
60  }
61 
67  @SuppressWarnings("unchecked")
68  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
69  private void initComponents() {
70 
71  autopsyLogo = new javax.swing.JLabel();
72  this.autopsyLogo.setText("");
73  newCaseButton = new javax.swing.JButton();
74  openRecentButton = new javax.swing.JButton();
75  createNewLabel = new javax.swing.JLabel();
76  openRecentLabel = new javax.swing.JLabel();
77  openCaseButton = new javax.swing.JButton();
78  openLabel = new javax.swing.JLabel();
79  closeButton = new javax.swing.JButton();
80  jSeparator1 = new javax.swing.JSeparator();
81 
82  autopsyLogo.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/casemodule/welcome_logo.png"))); // NOI18N
83  autopsyLogo.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.autopsyLogo.text")); // NOI18N
84 
85  newCaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/casemodule/btn_icon_create_new_case.png"))); // NOI18N
86  newCaseButton.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.newCaseButton.text")); // NOI18N
87  newCaseButton.setBorder(null);
88  newCaseButton.setBorderPainted(false);
89  newCaseButton.setContentAreaFilled(false);
90  newCaseButton.setPreferredSize(new java.awt.Dimension(64, 64));
91  newCaseButton.addActionListener(new java.awt.event.ActionListener() {
92  public void actionPerformed(java.awt.event.ActionEvent evt) {
94  }
95  });
96 
97  openRecentButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/casemodule/btn_icon_open_recent.png"))); // NOI18N
98  openRecentButton.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.openRecentButton.text")); // NOI18N
99  openRecentButton.setBorder(null);
100  openRecentButton.setBorderPainted(false);
101  openRecentButton.setContentAreaFilled(false);
102  openRecentButton.setPreferredSize(new java.awt.Dimension(64, 64));
103  openRecentButton.addActionListener(new java.awt.event.ActionListener() {
104  public void actionPerformed(java.awt.event.ActionEvent evt) {
106  }
107  });
108 
109  createNewLabel.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
110  createNewLabel.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.createNewLabel.text")); // NOI18N
111 
112  openRecentLabel.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
113  openRecentLabel.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.openRecentLabel.text")); // NOI18N
114 
115  openCaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/casemodule/btn_icon_open_existing.png"))); // NOI18N
116  openCaseButton.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.openCaseButton.text")); // NOI18N
117  openCaseButton.setBorder(null);
118  openCaseButton.setBorderPainted(false);
119  openCaseButton.setContentAreaFilled(false);
120  openCaseButton.setMargin(new java.awt.Insets(1, 1, 1, 1));
121  openCaseButton.setPreferredSize(new java.awt.Dimension(64, 64));
122  openCaseButton.addActionListener(new java.awt.event.ActionListener() {
123  public void actionPerformed(java.awt.event.ActionEvent evt) {
125  }
126  });
127 
128  openLabel.setFont(new java.awt.Font("Tahoma", 0, 13)); // NOI18N
129  openLabel.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.openLabel.text")); // NOI18N
130 
131  closeButton.setText(org.openide.util.NbBundle.getMessage(CueBannerPanel.class, "CueBannerPanel.closeButton.text")); // NOI18N
132 
133  jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
134 
135  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
136  this.setLayout(layout);
137  layout.setHorizontalGroup(
138  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
139  .addGroup(layout.createSequentialGroup()
140  .addContainerGap()
141  .addComponent(autopsyLogo)
142  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
143  .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 5, javax.swing.GroupLayout.PREFERRED_SIZE)
144  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
145  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
146  .addComponent(newCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
147  .addComponent(openRecentButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
148  .addComponent(openCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
149  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
150  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
151  .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
152  .addComponent(createNewLabel)
153  .addComponent(openRecentLabel)
154  .addComponent(openLabel))
155  .addComponent(closeButton, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE))
156  .addContainerGap())
157  );
158  layout.setVerticalGroup(
159  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
160  .addGroup(layout.createSequentialGroup()
161  .addContainerGap()
162  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
163  .addGroup(layout.createSequentialGroup()
164  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
165  .addComponent(newCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
166  .addComponent(createNewLabel))
167  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
168  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
169  .addComponent(openRecentButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
170  .addComponent(openRecentLabel))
171  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
172  .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
173  .addComponent(openCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
174  .addComponent(openLabel))
175  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
176  .addComponent(closeButton))
177  .addComponent(jSeparator1)
178  .addComponent(autopsyLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE))
179  .addContainerGap())
180  );
181  }// </editor-fold>//GEN-END:initComponents
182 
183  public void refresh() {
184  if (RecentCases.getInstance().getTotalRecentCases() == 0) {
185  openRecentButton.setEnabled(false);
186  openRecentLabel.setEnabled(false);
187  } else {
188  openRecentButton.setEnabled(true);
189  openRecentLabel.setEnabled(true);
190  }
191  }
192  private void newCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newCaseButtonActionPerformed
193  Lookup.getDefault().lookup(CaseNewActionInterface.class).actionPerformed(evt);
194  }//GEN-LAST:event_newCaseButtonActionPerformed
195 
196  private void openCaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openCaseButtonActionPerformed
197  Lookup.getDefault().lookup(CaseOpenAction.class).actionPerformed(evt);
198  }//GEN-LAST:event_openCaseButtonActionPerformed
199 
200  private void openRecentButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_openRecentButtonActionPerformed
201 
202  // open the recent cases dialog
203  Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
204 
205  // set the popUp window / JFrame
206  recentCasesWindow.setSize(750, 400);
207 
208  int w = recentCasesWindow.getSize().width;
209  int h = recentCasesWindow.getSize().height;
210 
211  // set the location of the popUp Window on the center of the screen
212  recentCasesWindow.setLocation((screenDimension.width - w)/2, (screenDimension.height - h)/2);
213 
214  OpenRecentCasePanel welcomeWindow = OpenRecentCasePanel.getInstance();
215 
216  // add the command to close the window to the button on the Volume Detail Panel
217  welcomeWindow.setCloseButtonActionListener( new ActionListener(){
218  @Override
219  public void actionPerformed(ActionEvent e){
220  recentCasesWindow.dispose();
221  }
222  });
223 
224  recentCasesWindow.add(welcomeWindow);
225  recentCasesWindow.pack();
226  recentCasesWindow.setResizable(false);
227  recentCasesWindow.setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
228  recentCasesWindow.setVisible(true);
229  }//GEN-LAST:event_openRecentButtonActionPerformed
230 
231 
232  // Variables declaration - do not modify//GEN-BEGIN:variables
233  private javax.swing.JLabel autopsyLogo;
234  private javax.swing.JButton closeButton;
235  private javax.swing.JLabel createNewLabel;
236  private javax.swing.JSeparator jSeparator1;
237  private javax.swing.JButton newCaseButton;
238  private javax.swing.JButton openCaseButton;
239  private javax.swing.JLabel openLabel;
240  private javax.swing.JButton openRecentButton;
241  private javax.swing.JLabel openRecentLabel;
242  // End of variables declaration//GEN-END:variables
243 
249  public void setCloseButtonActionListener(ActionListener e){
250  closeButton.addActionListener(e);
251  }
252 
258  public void setCloseButtonText(String text) {
259  closeButton.setText(text);
260  }
261 
265  public static void closeOpenRecentCasesWindow(){
266  //startupWindow.setVisible(false);
267  recentCasesWindow.dispose();
268  }
269 }
void openRecentButtonActionPerformed(java.awt.event.ActionEvent evt)
void newCaseButtonActionPerformed(java.awt.event.ActionEvent evt)
void openCaseButtonActionPerformed(java.awt.event.ActionEvent evt)

Copyright © 2012-2015 Basis Technology. Generated on: Mon Oct 19 2015
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.