19 package org.sleuthkit.autopsy.corecomponents;
21 import java.awt.Cursor;
23 import java.awt.Window;
25 import java.io.IOException;
26 import java.net.MalformedURLException;
27 import java.net.URISyntaxException;
29 import java.text.MessageFormat;
30 import java.util.Locale;
31 import java.util.logging.Level;
32 import javax.swing.Icon;
33 import javax.swing.ImageIcon;
34 import javax.swing.JPanel;
35 import javax.swing.SwingUtilities;
36 import javax.swing.event.HyperlinkEvent;
37 import javax.swing.event.HyperlinkListener;
38 import org.netbeans.core.actions.HTMLViewAction;
39 import org.openide.modules.Places;
40 import org.openide.util.ImageUtilities;
41 import org.openide.util.NbBundle;
50 @SuppressWarnings(
"PMD.SingularField")
53 private static final long serialVersionUID = 1L;
55 private URL url = null;
60 about =
new ImageIcon(ImageUtilities.loadImage(
"org/sleuthkit/autopsy/images/splash.png"));
65 about =
new ImageIcon(ImageUtilities.loadImage(pathToBrandingImage));
71 logoLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
73 "LBL_Description",
new Object[]{getProductVersionValue(), getJavaValue(), getVMValue(),
74 getOperatingSystemValue(), getEncodingValue(), getSystemLocaleValue(), getUserDirValue(), getSleuthKitVersionValue(), Version.getNetbeansBuild(), Version.getBuildType().toString()}));
75 copyright.setBackground(getBackground());
76 if (verboseLoggingIsSet()) {
77 disableVerboseLoggingButton();
81 copyright.addHyperlinkListener(hyperlinkListener);
82 description.addHyperlinkListener(hyperlinkListener);
91 if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED
96 }
catch (IOException | URISyntaxException ex) {
97 logger.log(Level.WARNING,
"Failed to display URL in external viewer", ex);
106 logoLabel =
new javax.swing.JLabel();
107 jScrollPane3 =
new javax.swing.JScrollPane();
108 copyright =
new javax.swing.JTextPane();
109 jScrollPane2 =
new javax.swing.JScrollPane();
110 description =
new javax.swing.JTextPane();
111 verboseLoggingButton =
new javax.swing.JButton();
112 jButton2 =
new javax.swing.JButton();
114 setBackground(
new java.awt.Color(255, 255, 255));
116 logoLabel.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
117 logoLabel.setIcon(about);
118 logoLabel.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
119 logoLabel.addMouseListener(
new java.awt.event.MouseAdapter() {
120 public void mouseClicked(java.awt.event.MouseEvent evt) {
121 logoLabelMouseClicked(evt);
125 jScrollPane3.setBorder(null);
127 copyright.setEditable(
false);
128 copyright.setBorder(null);
129 copyright.setContentType(
"text/html");
130 copyright.setText(
org.openide.util.NbBundle.getBundle(
AboutWindowPanel.class).getString(
"LBL_Copyright"));
131 copyright.addMouseListener(
new java.awt.event.MouseAdapter() {
132 public void mouseClicked(java.awt.event.MouseEvent evt) {
133 copyrightMouseClicked(evt);
136 jScrollPane3.setViewportView(copyright);
138 description.setEditable(
false);
139 description.setContentType(
"text/html");
140 jScrollPane2.setViewportView(description);
142 verboseLoggingButton.setText(
"Activate verbose logging");
143 verboseLoggingButton.addActionListener(
new java.awt.event.ActionListener() {
144 public void actionPerformed(java.awt.event.ActionEvent evt) {
145 activateVerboseLogging(evt);
150 jButton2.addActionListener(
new java.awt.event.ActionListener() {
151 public void actionPerformed(java.awt.event.ActionEvent evt) {
152 jButton2ActionPerformed(evt);
156 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
157 this.setLayout(layout);
158 layout.setHorizontalGroup(
159 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
160 .addGroup(layout.createSequentialGroup()
162 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
163 .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 486, Short.MAX_VALUE)
164 .addComponent(jScrollPane3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 486, Short.MAX_VALUE)
165 .addComponent(logoLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 486, Short.MAX_VALUE)
166 .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
167 .addGap(0, 0, Short.MAX_VALUE)
168 .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
169 .addComponent(verboseLoggingButton, javax.swing.GroupLayout.Alignment.TRAILING)
170 .addComponent(jButton2, javax.swing.GroupLayout.Alignment.TRAILING))))
173 layout.setVerticalGroup(
174 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
175 .addGroup(layout.createSequentialGroup()
177 .addComponent(logoLabel)
178 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
179 .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 184, Short.MAX_VALUE)
180 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
181 .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
182 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
183 .addComponent(verboseLoggingButton)
185 .addComponent(jButton2)
202 }
catch (MalformedURLException ex) {
209 startVerboseLogging();
210 disableVerboseLoggingButton();
223 this.verboseLoggingButton.setEnabled(
false);
224 this.verboseLoggingButton.setText(
225 NbBundle.getMessage(
this.getClass(),
"ProductInformationPanel.verbLoggingEnabled.text"));
229 Window w = SwingUtilities.getWindowAncestor(
this);
236 org.openide.awt.StatusDisplayer.getDefault().setStatusText(
237 NbBundle.getMessage(HTMLViewAction.class,
"CTL_OpeningBrowser"));
242 }
catch (IOException | URISyntaxException ex) {
243 logger.log(Level.WARNING,
"Failed to display URL in external viewer", ex);
254 return MessageFormat.format(
255 NbBundle.getBundle(
"org.netbeans.core.startup.Bundle").getString(
"currentVersion"),
256 new Object[]{System.getProperty(
"netbeans.buildnumber")});
260 return NbBundle.getMessage(
AboutWindowPanel.class,
"Format_OperatingSystem_Value",
261 System.getProperty(
"os.name",
263 "ProductInformationPanel.propertyUnknown.text")),
264 System.getProperty(
"os.version",
266 "ProductInformationPanel.propertyUnknown.text")),
267 System.getProperty(
"os.arch",
269 "ProductInformationPanel.propertyUnknown.text")));
273 return System.getProperty(
"java.version",
275 "ProductInformationPanel.propertyUnknown.text"));
280 "ProductInformationPanel.getVMValue.text",
281 System.getProperty(
"java.vm.name",
283 "ProductInformationPanel.propertyUnknown.text")),
284 System.getProperty(
"java.vm.version",
""));
289 return Locale.getDefault().toString() + ((branding = NbBundle.getBranding()) == null ?
"" : (
" (" + branding +
")"));
293 return Places.getUserDirectory().getAbsolutePath();
297 return System.getProperty(
"file.encoding",
298 NbBundle.getMessage(
AboutWindowPanel.class,
"ProductInformationPanel.propertyUnknown.text"));
302 copyright.setText(text);
307 if (HyperlinkEvent.EventType.ENTERED == event.getEventType()) {
308 url =
event.getURL();
309 }
else if (HyperlinkEvent.EventType.EXITED == event.getEventType()) {
318 verboseLogging =
true;
330 return verboseLogging;
void hyperlinkUpdate(HyperlinkEvent e)
javax.swing.JTextPane copyright
static String getVMValue()
void disableVerboseLoggingButton()
static String getProductVersionValue()
static String getJavaValue()
AboutWindowPanel(String pathToBrandingImage)
static String getOperatingSystemValue()
void logoLabelMouseClicked(java.awt.event.MouseEvent evt)
javax.swing.JTextPane description
static String getEncodingValue()
boolean verboseLoggingIsSet()
javax.swing.JScrollPane jScrollPane2
void hyperlinkUpdate(HyperlinkEvent event)
javax.swing.JButton jButton2
void activateVerboseLogging(java.awt.event.ActionEvent evt)
javax.swing.JLabel logoLabel
void copyrightMouseClicked(java.awt.event.MouseEvent evt)
synchronized static Logger getLogger(String name)
javax.swing.JButton verboseLoggingButton
void jButton2ActionPerformed(java.awt.event.ActionEvent evt)
void startVerboseLogging()
static String getSleuthKitVersionValue()
javax.swing.JScrollPane jScrollPane3
static String getVersion()
static void startVerboseLogging(String logPath)
void setCopyright(String text)
static boolean isDesktopSupported()
static Desktop getDesktop()
static String getSystemLocaleValue()