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().getStyle() & ~java.awt.Font.BOLD, 13));
160 newCaseLabel.setText(
org.openide.util.NbBundle.getMessage(
CueBannerPanel.class,
"CueBannerPanel.newCaseLabel.text"));
162 openRecentCaseLabel.setFont(openRecentCaseLabel.getFont().deriveFont(openRecentCaseLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 13));
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().getStyle() & ~java.awt.Font.BOLD, 13));
179 openCaseLabel.setText(
org.openide.util.NbBundle.getMessage(
CueBannerPanel.class,
"CueBannerPanel.openCaseLabel.text"));
181 closeButton.setFont(closeButton.getFont().deriveFont(closeButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
182 closeButton.setText(
org.openide.util.NbBundle.getMessage(
CueBannerPanel.class,
"CueBannerPanel.closeButton.text"));
184 jSeparator1.setOrientation(javax.swing.SwingConstants.VERTICAL);
186 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
187 this.setLayout(layout);
188 layout.setHorizontalGroup(
189 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
190 .addGroup(layout.createSequentialGroup()
192 .addComponent(autopsyLogo)
193 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
194 .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 5, javax.swing.GroupLayout.PREFERRED_SIZE)
195 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
196 .addGroup(layout.createSequentialGroup()
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(openRecentCaseButton, 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 .addComponent(newCaseLabel)
205 .addComponent(openRecentCaseLabel)
206 .addComponent(openCaseLabel))
208 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
209 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 139, Short.MAX_VALUE)
210 .addComponent(closeButton, javax.swing.GroupLayout.PREFERRED_SIZE, 73, javax.swing.GroupLayout.PREFERRED_SIZE)
211 .addContainerGap())))
213 layout.setVerticalGroup(
214 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
215 .addGroup(layout.createSequentialGroup()
217 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
218 .addComponent(autopsyLogo, javax.swing.GroupLayout.PREFERRED_SIZE, 257, javax.swing.GroupLayout.PREFERRED_SIZE)
219 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING,
false)
220 .addGroup(layout.createSequentialGroup()
221 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
222 .addComponent(newCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 56, javax.swing.GroupLayout.PREFERRED_SIZE)
223 .addComponent(newCaseLabel))
224 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
225 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
226 .addComponent(openRecentCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE)
227 .addComponent(openRecentCaseLabel))
228 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
229 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
230 .addComponent(openCaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
231 .addComponent(openCaseLabel))
232 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
233 .addComponent(closeButton))
234 .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 260, javax.swing.GroupLayout.PREFERRED_SIZE)))
235 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
244 setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
245 Lookup.getDefault().lookup(
CaseOpenAction.class).actionPerformed(evt);
250 recentCasesWindow.setLocationRelativeTo(
this);
251 OpenRecentCasePanel.getInstance();
252 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