19 package com.basistech.df.cybertriage.autopsy.ctoptions.ctcloud;
 
   21 import java.awt.Color;
 
   22 import java.util.regex.Pattern;
 
   23 import javax.swing.event.DocumentEvent;
 
   24 import javax.swing.event.DocumentListener;
 
   25 import org.apache.commons.lang3.StringUtils;
 
   26 import org.openide.util.NbBundle.Messages;
 
   32 class CTLicenseDialog 
extends javax.swing.JDialog {
 
   34     private static final Pattern LICENSE_PATTERN = Pattern.compile(
"^\\s*[a-zA-Z0-9-_]+?\\s*$");
 
   35     private String licenseString = null;
 
   40     public CTLicenseDialog(java.awt.Frame parent, 
boolean modal) {
 
   44         this.licenseNumberTextField.getDocument().putProperty(
"filterNewlines", Boolean.TRUE);
 
   45         this.licenseNumberTextField.getDocument().addDocumentListener(
new DocumentListener() {
 
   47             public void changedUpdate(DocumentEvent e) {
 
   52             public void insertUpdate(DocumentEvent e) {
 
   57             public void removeUpdate(DocumentEvent e) {
 
   63         this.getRootPane().setDefaultButton(okButton);
 
   65         this.licenseNumberTextField.requestFocusInWindow();
 
   68     private void configureHintText() {
 
   70                 StringUtils.defaultString(
this.licenseNumberTextField.getToolTipText()),
 
   71                 this.licenseNumberTextField);
 
   73         textPrompt.setForeground(Color.LIGHT_GRAY);
 
   83         "CTLicenseDialog_verifyInput_licenseNumberError=<html>Please enter a license number</html>" 
   85     private void verifyInput() {
 
   86         String licenseInput = StringUtils.defaultString(this.licenseNumberTextField.getText());
 
   87         if (LICENSE_PATTERN.matcher(licenseInput).matches()) {
 
   88             this.warningLabel.setText(
"");
 
   89             this.okButton.setEnabled(
true);
 
   91             this.warningLabel.setText(Bundle.CTLicenseDialog_verifyInput_licenseNumberError());
 
   92             this.okButton.setEnabled(
false);
 
  101     @SuppressWarnings(
"unchecked")
 
  103     private void initComponents() {
 
  104         java.awt.GridBagConstraints gridBagConstraints;
 
  106         javax.swing.JLabel licenseNumberLabel = 
new javax.swing.JLabel();
 
  107         licenseNumberTextField = 
new javax.swing.JTextField();
 
  108         warningLabel = 
new javax.swing.JLabel();
 
  109         javax.swing.JPanel buttonPadding = 
new javax.swing.JPanel();
 
  110         javax.swing.JPanel buttonPanel = 
new javax.swing.JPanel();
 
  111         okButton = 
new javax.swing.JButton();
 
  112         cancelButton = 
new javax.swing.JButton();
 
  114         setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
 
  115         setTitle(
org.openide.util.NbBundle.getMessage(CTLicenseDialog.class, 
"CTLicenseDialog.title")); 
 
  116         setAlwaysOnTop(
true);
 
  118         getContentPane().setLayout(
new java.awt.GridBagLayout());
 
  120         org.openide.awt.Mnemonics.setLocalizedText(licenseNumberLabel, 
org.openide.util.NbBundle.getMessage(CTLicenseDialog.class, 
"CTLicenseDialog.licenseNumberLabel.text")); 
 
  121         gridBagConstraints = 
new java.awt.GridBagConstraints();
 
  122         gridBagConstraints.gridx = 0;
 
  123         gridBagConstraints.gridy = 0;
 
  124         gridBagConstraints.gridwidth = 3;
 
  125         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
  126         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
 
  127         gridBagConstraints.insets = 
new java.awt.Insets(5, 5, 5, 5);
 
  128         getContentPane().add(licenseNumberLabel, gridBagConstraints);
 
  130         licenseNumberTextField.setText(
org.openide.util.NbBundle.getMessage(CTLicenseDialog.class, 
"CTLicenseDialog.licenseNumberTextField.text")); 
 
  131         licenseNumberTextField.setToolTipText(
org.openide.util.NbBundle.getMessage(CTLicenseDialog.class, 
"CTLicenseDialog.licenseNumberTextField.toolTipText")); 
 
  132         gridBagConstraints = 
new java.awt.GridBagConstraints();
 
  133         gridBagConstraints.gridx = 0;
 
  134         gridBagConstraints.gridy = 1;
 
  135         gridBagConstraints.gridwidth = 3;
 
  136         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
  137         gridBagConstraints.insets = 
new java.awt.Insets(0, 5, 5, 5);
 
  138         getContentPane().add(licenseNumberTextField, gridBagConstraints);
 
  140         warningLabel.setForeground(java.awt.Color.RED);
 
  141         org.openide.awt.Mnemonics.setLocalizedText(warningLabel, 
org.openide.util.NbBundle.getMessage(CTLicenseDialog.class, 
"CTLicenseDialog.warningLabel.text")); 
 
  142         warningLabel.setMaximumSize(
new java.awt.Dimension(419, 36));
 
  143         warningLabel.setMinimumSize(
new java.awt.Dimension(419, 36));
 
  144         warningLabel.setPreferredSize(
new java.awt.Dimension(419, 36));
 
  145         gridBagConstraints = 
new java.awt.GridBagConstraints();
 
  146         gridBagConstraints.gridx = 0;
 
  147         gridBagConstraints.gridy = 2;
 
  148         gridBagConstraints.gridwidth = 3;
 
  149         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
 
  150         gridBagConstraints.insets = 
new java.awt.Insets(0, 5, 5, 5);
 
  151         getContentPane().add(warningLabel, gridBagConstraints);
 
  153         javax.swing.GroupLayout buttonPaddingLayout = 
new javax.swing.GroupLayout(buttonPadding);
 
  154         buttonPadding.setLayout(buttonPaddingLayout);
 
  155         buttonPaddingLayout.setHorizontalGroup(
 
  156             buttonPaddingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  157             .addGap(0, 0, Short.MAX_VALUE)
 
  159         buttonPaddingLayout.setVerticalGroup(
 
  160             buttonPaddingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
 
  161             .addGap(0, 0, Short.MAX_VALUE)
 
  164         gridBagConstraints = 
new java.awt.GridBagConstraints();
 
  165         gridBagConstraints.gridx = 0;
 
  166         gridBagConstraints.gridy = 3;
 
  167         gridBagConstraints.weightx = 1.0;
 
  168         getContentPane().add(buttonPadding, gridBagConstraints);
 
  170         buttonPanel.setLayout(
new java.awt.GridBagLayout());
 
  172         org.openide.awt.Mnemonics.setLocalizedText(okButton, 
org.openide.util.NbBundle.getMessage(CTLicenseDialog.class, 
"CTLicenseDialog.okButton.text")); 
 
  173         okButton.addActionListener(
new java.awt.event.ActionListener() {
 
  174             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  175                 okButtonActionPerformed(evt);
 
  178         gridBagConstraints = 
new java.awt.GridBagConstraints();
 
  179         gridBagConstraints.gridx = 0;
 
  180         gridBagConstraints.gridy = 0;
 
  181         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
  182         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
 
  183         gridBagConstraints.weightx = 1.0;
 
  184         gridBagConstraints.insets = 
new java.awt.Insets(0, 5, 10, 5);
 
  185         buttonPanel.add(okButton, gridBagConstraints);
 
  187         org.openide.awt.Mnemonics.setLocalizedText(cancelButton, 
org.openide.util.NbBundle.getMessage(CTLicenseDialog.class, 
"CTLicenseDialog.cancelButton.text")); 
 
  188         cancelButton.addActionListener(
new java.awt.event.ActionListener() {
 
  189             public void actionPerformed(java.awt.event.ActionEvent evt) {
 
  190                 cancelButtonActionPerformed(evt);
 
  193         gridBagConstraints = 
new java.awt.GridBagConstraints();
 
  194         gridBagConstraints.gridx = 1;
 
  195         gridBagConstraints.gridy = 0;
 
  196         gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
 
  197         gridBagConstraints.anchor = java.awt.GridBagConstraints.NORTHWEST;
 
  198         gridBagConstraints.weightx = 1.0;
 
  199         gridBagConstraints.insets = 
new java.awt.Insets(0, 0, 10, 10);
 
  200         buttonPanel.add(cancelButton, gridBagConstraints);
 
  202         gridBagConstraints = 
new java.awt.GridBagConstraints();
 
  203         gridBagConstraints.gridx = 1;
 
  204         gridBagConstraints.gridy = 3;
 
  205         gridBagConstraints.gridwidth = 2;
 
  206         getContentPane().add(buttonPanel, gridBagConstraints);
 
  211     private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {
 
  212         String inputText = this.licenseNumberTextField.getText();
 
  213         this.licenseString = inputText == null ? null : inputText.trim();
 
  217     private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {
 
  218         this.licenseString = null;
 
  224     private javax.swing.JButton cancelButton;
 
  225     private javax.swing.JTextField licenseNumberTextField;
 
  226     private javax.swing.JButton okButton;
 
  227     private javax.swing.JLabel warningLabel;
 
void changeAlpha(float alpha)