19 package org.sleuthkit.autopsy.casemodule;
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;
38 @SuppressWarnings(
"PMD.SingularField")
41 private static final long serialVersionUID = 1L;
49 if (null != recentCasesWindow) {
50 recentCasesWindow.setVisible(
false);
56 initRecentCasesWindow();
62 ClassLoader cl = Lookup.getDefault().lookup(ClassLoader.class);
64 ImageIcon icon =
new ImageIcon(cl.getResource(welcomeLogo));
65 autopsyLogo.setIcon(icon);
67 initRecentCasesWindow();
72 closeButton.addActionListener(e);
76 closeButton.setText(text);
84 recentCasesWindow =
new JDialog(
85 WindowManager.getDefault().getMainWindow(),
86 NbBundle.getMessage(
CueBannerPanel.class,
"CueBannerPanel.title.text"),
87 Dialog.ModalityType.APPLICATION_MODAL);
88 recentCasesWindow.setSize(
new Dimension(750, 400));
89 recentCasesWindow.getRootPane().registerKeyboardAction(
91 recentCasesWindow.setVisible(
false);
93 KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
94 OpenRecentCasePanel recentCasesPanel = OpenRecentCasePanel.getInstance();
95 recentCasesPanel.setCloseButtonActionListener(
new ActionListener() {
97 public void actionPerformed(ActionEvent e) {
98 recentCasesWindow.setVisible(
false);
101 recentCasesWindow.add(recentCasesPanel);
102 recentCasesWindow.pack();
103 recentCasesWindow.setResizable(
false);
107 boolean enableOpenRecentCaseButton = (RecentCases.getInstance().getTotalRecentCases() > 0);
108 openRecentCaseButton.setEnabled(enableOpenRecentCaseButton);
109 openRecentCaseLabel.setEnabled(enableOpenRecentCaseButton);
117 @SuppressWarnings(
"unchecked")
119 private
void initComponents() {
121 autopsyLogo =
new javax.swing.JLabel();
122 this.autopsyLogo.setText(
"");
123 newCaseButton =
new javax.swing.JButton();
124 openRecentCaseButton =
new javax.swing.JButton();
125 newCaseLabel =
new javax.swing.JLabel();
126 openRecentCaseLabel =
new javax.swing.JLabel();
127 openCaseButton =
new javax.swing.JButton();
128 openCaseLabel =
new javax.swing.JLabel();
129 closeButton =
new javax.swing.JButton();
130 jSeparator1 =
new javax.swing.JSeparator();
132 autopsyLogo.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/casemodule/welcome_logo.png")));
133 autopsyLogo.setText(
org.openide.util.NbBundle.getMessage(
CueBannerPanel.class,
"CueBannerPanel.autopsyLogo.text"));
135 newCaseButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/casemodule/btn_icon_create_new_case.png")));
136 newCaseButton.setText(
org.openide.util.NbBundle.getMessage(
CueBannerPanel.class,
"CueBannerPanel.newCaseButton.text"));
137 newCaseButton.setBorder(null);
138 newCaseButton.setBorderPainted(
false);
139 newCaseButton.setContentAreaFilled(
false);
140 newCaseButton.setPreferredSize(
new java.awt.Dimension(64, 64));
141 newCaseButton.addActionListener(
new java.awt.event.ActionListener() {
142 public void actionPerformed(java.awt.event.ActionEvent evt) {
143 newCaseButtonActionPerformed(evt);
147 openRecentCaseButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/casemodule/btn_icon_open_recent.png")));
148 openRecentCaseButton.setText(
org.openide.util.NbBundle.getMessage(
CueBannerPanel.class,
"CueBannerPanel.openRecentCaseButton.text"));
149 openRecentCaseButton.setBorder(null);
150 openRecentCaseButton.setBorderPainted(
false);
151 openRecentCaseButton.setContentAreaFilled(
false);
152 openRecentCaseButton.setPreferredSize(
new java.awt.Dimension(64, 64));
153 openRecentCaseButton.addActionListener(
new java.awt.event.ActionListener() {
154 public void actionPerformed(java.awt.event.ActionEvent evt) {
155 openRecentCaseButtonActionPerformed(evt);
159 newCaseLabel.setFont(newCaseLabel.getFont().deriveFont(newCaseLabel.getFont().getSize()+2f));
160 newCaseLabel.setText(
org.openide.util.NbBundle.getMessage(
CueBannerPanel.class,
"CueBannerPanel.newCaseLabel.text"));
162 openRecentCaseLabel.setFont(openRecentCaseLabel.getFont().deriveFont(openRecentCaseLabel.getFont().getSize()+2f));
163 openRecentCaseLabel.setText(
org.openide.util.NbBundle.getMessage(
CueBannerPanel.class,
"CueBannerPanel.openRecentCaseLabel.text"));
165 openCaseButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/casemodule/btn_icon_open_existing.png")));
166 openCaseButton.setText(
org.openide.util.NbBundle.getMessage(
CueBannerPanel.class,
"CueBannerPanel.openCaseButton.text"));
167 openCaseButton.setBorder(null);
168 openCaseButton.setBorderPainted(
false);
169 openCaseButton.setContentAreaFilled(
false);
170 openCaseButton.setMargin(
new java.awt.Insets(1, 1, 1, 1));
171 openCaseButton.setPreferredSize(
new java.awt.Dimension(64, 64));
172 openCaseButton.addActionListener(
new java.awt.event.ActionListener() {
173 public void actionPerformed(java.awt.event.ActionEvent evt) {
174 openCaseButtonActionPerformed(evt);
178 openCaseLabel.setFont(openCaseLabel.getFont().deriveFont(openCaseLabel.getFont().getSize()+2f));
179 openCaseLabel.setText(
org.openide.util.NbBundle.getMessage(
CueBannerPanel.class,
"CueBannerPanel.openCaseLabel.text"));
181 closeButton.setText(
org.openide.util.NbBundle.getMessage(
CueBannerPanel.class,
"CueBannerPanel.closeButton.text"));
183 jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
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()
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))
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())))
212 layout.setVerticalGroup(
213 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
214 .addGroup(layout.createSequentialGroup()
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))
243 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
244 Lookup.getDefault().lookup(
CaseOpenAction.class).actionPerformed(evt);
249 recentCasesWindow.setLocationRelativeTo(
this);
250 OpenRecentCasePanel.getInstance();
252 recentCasesWindow.setAlwaysOnTop(
true);
253 recentCasesWindow.setVisible(
true);
javax.swing.JButton closeButton
void openRecentCaseButtonActionPerformed(java.awt.event.ActionEvent evt)
void setCloseButtonActionListener(ActionListener e)
javax.swing.JButton openRecentCaseButton
javax.swing.JLabel newCaseLabel
javax.swing.JLabel autopsyLogo
javax.swing.JButton newCaseButton
static void closeOpenRecentCasesWindow()
javax.swing.JLabel openRecentCaseLabel
void newCaseButtonActionPerformed(java.awt.event.ActionEvent evt)
void setCloseButtonText(String text)
static JDialog recentCasesWindow
void initRecentCasesWindow()
javax.swing.JLabel openCaseLabel
CueBannerPanel(String welcomeLogo)
void openCaseButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JSeparator jSeparator1
javax.swing.JButton openCaseButton